Commit 11d82eed authored by Dat Nguyen's avatar Dat Nguyen

added linesize

parent 9c756f01
......@@ -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);
}
......@@ -70,8 +71,10 @@ 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();
}
}
......@@ -83,6 +86,7 @@ void lightDrawing::mouseDragged(ofVec3f _pos) {
void lightDrawing::mouseRPressed() {
lineWidth.push_back(standardSize);
drawLine.push_back(ofPolyline());
}
......@@ -104,9 +108,6 @@ void lightDrawing::mouseReleased(ofVec3f _pos) {
}
void lightDrawing::bubblesetup(){
}
void lightDrawing::bubbledraw(){
for(int i = 0; i < storeSphere.size(); i++){
......@@ -116,18 +117,12 @@ 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)));
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)));
}
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,12 +33,12 @@ 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);
......
......@@ -87,7 +87,9 @@ void ofApp::setup(){
for(int i = 0; i<5; i++){
v_light.push_back(light);
}
}
......@@ -213,14 +215,16 @@ void ofApp::draw(){
}
if (state == 1) {
for(int i = 0; i<v_light.size(); i++){
v_light[i].enable();
// light.setPosition(0, 0, planeDist);
v_light[i].setPosition(lightPos.x, lightPos.y, lightPos.z);
v_light[i].setAmbientColor(ofFloatColor(userInterface.a1, userInterface.a2, userInterface.a3, 1.0));
v_light[i].setDiffuseColor(ofFloatColor(userInterface.d1, userInterface.d2, userInterface.d3));
v_light[i].setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
}
//Lighting
light.enable();
// light.setPosition(0, 0, planeDist);
light.setPosition(lightPos.x, lightPos.y, lightPos.z);
light.setAmbientColor(ofFloatColor(userInterface.a1, userInterface.a2, userInterface.a3, 1.0));
light.setDiffuseColor(ofFloatColor(userInterface.d1, userInterface.d2, userInterface.d3));
light.setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
cam.begin();
......
......@@ -54,6 +54,8 @@ public:
ofLight light;
vector<ofLight> v_light;
Gui userInterface;
ofVec3f lightPos;
......
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