Commit cf236846 authored by Kevin Dang's avatar Kevin Dang

fixed mouse drawing problem with lightCluster

parent dbcd4d21
......@@ -27,9 +27,6 @@ public:
void update(ofVec3f _pos);
// ofLight light;
ofPolyline currentPolyline;
bool leftMouseButtonPressed;
......@@ -56,52 +53,4 @@ public:
#endif /* lightDrawing_h */
/*
1. Look through drawLine[i] element
2. Loop through the positions of that specific drawLine[i] element to find each position for the SUM calculation and also the number of positions in order to calculate average
*/
// std::cout << "drawLine[" << i << "] : Position[" << a << "] = " << getLineXYZ[a] << std::endl;
// std::cout<<getLineXYZ[a].x<<std::endl;
// for (int i = 0; i < drawLine.size(); i++) {
// // we store all the vertices from the lines inside a vector of ofPoint
// vector <ofPoint> test = drawLine[i].getVertices();
//
// // create a ofVec3f variable which will store all the points
// ofVec3f insertTest;
//
//
// for (int a = 0; a < test.size(); a++) {
// // std::cout << "This is " << a << ": "<< test[a] << std::endl;
//
// insertTest.set(test[a].x,test[a].y,test[a].z);
// std::cout << insertTest << std::endl;
// }
//
//
// light.setPosition(insertTest);
// }
......@@ -42,14 +42,14 @@ void ofApp::camRotate(){
cam.pan(xdiff);
if(mouseMode == false)
glfwSetCursorPos(window, windowcenterx, windowcentery);
glfwSetCursorPos(window, windowcenterx, windowcentery);
}
//--------------------------------------------------------------
void ofApp::setup(){
mouseMode = false;
isMouseInited = false;
isMouseHeldDown = false;
......@@ -89,8 +89,8 @@ void ofApp::setup(){
guiBrushes.setName("Brush Effects");
guiBrushes.setPosition(810,10);
guiBrushes.add(standard.setup("Standard", false));
guiBrushes.add(bubbles.setup("Bubble", true));
guiBrushes.add(lightCluster.setup("Line Cluster", false));
guiBrushes.add(bubbles.setup("Bubble", false));
guiBrushes.add(lightCluster.setup("Line Cluster", true));
LightDrawing.bubblesetup();
}
......@@ -98,7 +98,7 @@ void ofApp::setup(){
//--------------------------------------------------------------
void ofApp::update(){
/*** Simon's Help Start ***/
......@@ -131,24 +131,24 @@ void ofApp::update(){
if(mouseMode == false){
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
}else{
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
}
if(isMouseHeldDown == true && standard == true){
LightDrawing.mouseDragged(pos);
}
if(isMouseHeldDown == true && bubbles == true && ofGetFrameNum() % 2 == 0){
LightDrawing.createbubble(pos);
LightDrawing.createbubble(pos);
}
if(isMouseHeldDown == true && lightCluster == true){
LightDrawing.mouseDragged(pos);
LightDrawing.mousePressed(pos);
}
......@@ -178,21 +178,21 @@ void ofApp::update(){
cam.boom(1.4);
}
//light.setSpotlight();
//ofSeedRandom();
srand(time(NULL));
srand(time(NULL));
LightDrawing.update(pos);
}
//--------------------------------------------------------------
void ofApp::draw(){
ofBackground(45);
ofEnableDepthTest();
//Lighting
......@@ -210,24 +210,22 @@ void ofApp::draw(){
//ofDrawLine(cam.getPosition(), cam.getPosition() + ray * cam.getFarClip()); //notice we can't see this line at all !!!
//this is because it goes directly from the origin of the camera
//along the line of sight
for (int i = 0; i < 50; i++) {
ofSetColor(255);
ofFill();
// ofDrawBox(<#float x#>, <#float y#>, <#float z#>, <#float size#>);
// ofDrawBox(ofRandom(-1000,1000),ofRandom(-1000,1000), ofRandom(-1000,1000),100);
ofDrawBox(100,100,10,100);
}
LightDrawing.draw();
LightDrawing.bubbledraw();
if(bubbles == true){
}
cam.end();
ofDisableDepthTest();
ofDisableLighting();
......@@ -240,8 +238,8 @@ void ofApp::draw(){
ofFill();
ofCircle(ofGetWindowWidth()/2,ofGetWindowHeight()/2,2);
}
//--------------------------------------------------------------
......@@ -253,7 +251,7 @@ void ofApp::keyPressed(int key){
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
if (key == 'r') {
LightDrawing.clearAllLines();
}
......@@ -263,27 +261,23 @@ void ofApp::keyReleased(int key){
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
if(mouseMode == false)
camRotate();
camRotate();
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
if(mouseMode == false)
camRotate();
camRotate();
LightDrawing.mouseDragged(pos);
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
if(mouseMode == false && standard == true){
// LightDrawing.mousePressed(pos);
if (button == OF_MOUSE_BUTTON_LEFT) {
LightDrawing.mouseRPressed();
}
LightDrawing.mouseRPressed();
isMouseHeldDown = true;
}
......@@ -294,9 +288,7 @@ void ofApp::mousePressed(int x, int y, int button){
if (lightCluster == true) {
if (button == OF_MOUSE_BUTTON_LEFT) {
LightDrawing.mousePressed(pos);
}
isMouseHeldDown = true;
}
}
......@@ -304,38 +296,34 @@ void ofApp::mousePressed(int x, int y, int button){
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
if(mouseMode == false)
isMouseHeldDown = false;
if (button == OF_MOUSE_BUTTON_LEFT) {
LightDrawing.mouseReleased(pos);
}
isMouseHeldDown = false;
LightDrawing.mouseReleased(pos);
LightDrawing.mouseRReleased();
if (button == OF_MOUSE_BUTTON_LEFT) {
LightDrawing.mouseRReleased();
}
}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){
}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
void ofApp::dragEvent(ofDragInfo dragInfo){
}
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