Commit 9c756f01 authored by Kevin Dang's avatar Kevin Dang

final updates for this set of commits

parent f98436f3
......@@ -2,7 +2,7 @@
// Gui.cpp
// Lux
//
// Created by Dat Nguyen on 13/04/2016.
// Created by Dat Nguyen & Kevin Dang
//
//
......@@ -20,7 +20,7 @@ void Gui::setup(){
guiBrushes.setup();
guiBrushes.setName("Brush Effects");
guiBrushes.setPosition(810,100);
guiBrushes.setPosition(ofGetWindowWidth()-210,10);
guiBrushes.add(standard.setup("Standard", true));
guiBrushes.add(standardSize.setup("Standard Brush Size", 2.f, 1.f, 10.f));
guiBrushes.add(bubbles.setup("Bubble", false));
......
......@@ -2,7 +2,7 @@
// Gui.h
// Lux
//
// Created by Dat Nguyen on 13/04/2016.
// Created by Dat Nguyen & Kevin Dang
//
//
......@@ -12,9 +12,6 @@
#include "ofMain.h"
#include "ofxGui.h"
class lightDrawing;
class Gui{
public:
......
......@@ -33,9 +33,8 @@ 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);
}
......@@ -69,28 +68,21 @@ void lightDrawing::draw() {
void lightDrawing::clearPreviousLine() {
// only allows you to delete the last added element
if (drawLine.size() > 0 && lineWidth.size() > 0) { // you need this condition or the program will crash
if (drawLine.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());
}
......@@ -101,7 +93,6 @@ 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);
}
......@@ -113,6 +104,10 @@ void lightDrawing::mouseReleased(ofVec3f _pos) {
}
void lightDrawing::bubblesetup(){
}
void lightDrawing::bubbledraw(){
for(int i = 0; i < storeSphere.size(); i++){
storeSphere[i].draw();
......@@ -121,11 +116,18 @@ void lightDrawing::bubbledraw(){
void lightDrawing::createbubble(ofVec3f _pos){
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)));
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,18 +33,15 @@ 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);
};
......
This diff is collapsed.
......@@ -3,8 +3,10 @@
#include "ofMain.h"
#include "lightDrawing.h"
#include "Gui.h"
#include "worldObjects.h"
#include "lightBalls.h"
#include "flocking.h"
#include <vector>
#include "populateSmallSphere.h"
class ofApp : public ofBaseApp{
public:
......@@ -54,59 +56,12 @@ public:
Gui userInterface;
ofVec3f lightPos;
ofVec3f boxTestPosition;
ofVec3f boxTestDimensions;
// make sure X and Y is in-between 1 and -1 in z axis
// this is for step 0:
ofVec2f mouseCoordinatesForRayCasting;
// this is for step 1:
ofVec3f theRayTest;
float xTest, yTest, zTest;
// this is for step 2:
ofVec4f rayClipTest;
// this is for step 3:
ofVec4f rayEyeTest;
ofMatrix4x4 inverseProjectionMatrixTest;
ofMatrix4x4 theRayClipMatrix;
ofMatrix4x4 multiplicationOfInverseMatrixAndRayClipMatrix;
ofMatrix4x4 transposedTheRayClipMatrix;
ofVec4f rowOneOfTransposedMatrix;
ofVec4f theFinalRayEyeofVec4f;
// this is for step 4:
ofVec3f rayForWorldCoordinates;
ofMatrix4x4 inverseViewMatrix;
ofMatrix4x4 newRayEyeMatrix;
ofMatrix4x4 multiplicationOfInverseViewAndnewRayEyeMatrix;
ofMatrix4x4 transposedOfInverseViewxNewRayEyeMatrix;
ofVec4f rowOneOfTransposedMultiplicationResult;
bool intersectionWithBoundaryBox(const ofVec3f worldSpace, const ofVec3f boxPosition, const ofVec3f boxWHD) {
if ((worldSpace.x > boxPosition.x && worldSpace.x < boxWHD.x) && (worldSpace.y > boxPosition.y && worldSpace.y < boxWHD.y)) {
return true;
} else {
return false;
}
};
int state;
populateSmallSphere smallSpheres;
lightBalls lightBalls;
......
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