Commit a6095406 authored by Dat Nguyen's avatar Dat Nguyen

Added vector of lineWidths for standard brush

parent 5a29850b
......@@ -33,8 +33,9 @@ void lightDrawing::draw() {
ofPushStyle();
ofSetColor(255);
ofSetLineWidth(standardSize);
for (int i = 0; i < drawLine.size(); i++) {
ofSetLineWidth(lineWidth[i]);
drawLine[i].draw();
drawLine[i].getSmoothed(1);
}
......@@ -68,21 +69,28 @@ void lightDrawing::draw() {
void lightDrawing::clearPreviousLine() {
// only allows you to delete the last added element
if (drawLine.size() > 0) { // you need this condition or the program will crash
if (drawLine.size() > 0 && lineWidth.size() > 0) { // you need this condition or the program will crash
drawLine.pop_back();
//Remove previous line width
lineWidth.pop_back();
}
}
void lightDrawing::mouseDragged(ofVec3f _pos) {
drawLine[drawLine.size() - 1].addVertex(_pos);
drawLine[drawLine.size() - 1].addVertex(_pos);
}
void lightDrawing::mouseRPressed() {
lineWidth.push_back(standardSize);
drawLine.push_back(ofPolyline());
}
......@@ -93,6 +101,7 @@ void lightDrawing::mousePressed(ofVec3f _pos) {
currentPolyline.curveTo(_pos.x,_pos.y,_pos.z);
currentPolyline.curveTo(_pos.x,_pos.y,_pos.z);
lastPoint.set(_pos.x,_pos.y,_pos.z);
}
......@@ -104,10 +113,6 @@ void lightDrawing::mouseReleased(ofVec3f _pos) {
}
void lightDrawing::bubblesetup(){
}
void lightDrawing::bubbledraw(){
for(int i = 0; i < storeSphere.size(); i++){
storeSphere[i].draw();
......@@ -116,18 +121,11 @@ void lightDrawing::bubbledraw(){
void lightDrawing::createbubble(ofVec3f _pos){
sphere.setRadius(ofRandom(0.01,2));
storeSphere.push_back(sphere);
storeSphere[storeSphere.size()-1].setPosition(_pos+ofVec3f(ofRandom(-5,5),ofRandom(-5,5),ofRandom(-5,5)));
sphere.setRadius(ofRandom(0.01,2));
storeSphere.push_back(sphere);
storeSphere[storeSphere.size()-1].setPosition(_pos+ofVec3f(ofRandom(-5,5),ofRandom(-5,5),ofRandom(-5,5)));
sphere.setRadius(ofRandom(0.01,2));
storeSphere.push_back(sphere);
storeSphere[storeSphere.size()-1].setPosition(_pos+ofVec3f(ofRandom(-5,5),ofRandom(-5,5),ofRandom(-5,5)));
for(int i = 0; i<3; i++){
sphere.setRadius(ofRandom(0.01,2));
storeSphere.push_back(sphere);
storeSphere[storeSphere.size()-1].setPosition(_pos+ofVec3f(ofRandom(-5,5),ofRandom(-5,5),ofRandom(-5,5)));
}
}
......@@ -33,15 +33,18 @@ public:
float minDistance;
vector <ofPolyline> polylines;
vector <float> lineWidth;
void mousePressed(ofVec3f _pos);
void mouseReleased(ofVec3f _pos);
vector <ofSpherePrimitive> storeSphere;
ofSpherePrimitive sphere;
void bubblesetup();
void bubbledraw();
void createbubble(ofVec3f _pos);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment