Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
creativeProjects2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kevin Dang
creativeProjects2
Commits
8274fea7
Commit
8274fea7
authored
Apr 12, 2016
by
Kevin Dang
Browse files
Options
Browse Files
Download
Plain Diff
delete in future: commiting DS_STORE file
parents
399a4144
68ed9617
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
110 additions
and
192 deletions
+110
-192
Lux/.DS_Store
Lux/.DS_Store
+0
-0
Lux/Lux.xcodeproj/project.xcworkspace/xcuserdata/Dat.xcuserdatad/UserInterfaceState.xcuserstate
...xcuserdata/Dat.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Lux/Lux.xcodeproj/project.xcworkspace/xcuserdata/Kevin.xcuserdatad/UserInterfaceState.xcuserstate
...userdata/Kevin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Lux/Lux.xcodeproj/xcuserdata/Kevin.xcuserdatad/xcschemes/xcschememanagement.plist
...data/Kevin.xcuserdatad/xcschemes/xcschememanagement.plist
+0
-14
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
+0
-0
Lux/src/lightDrawing.cpp
Lux/src/lightDrawing.cpp
+77
-71
Lux/src/lightDrawing.h
Lux/src/lightDrawing.h
+13
-18
Lux/src/ofApp.cpp
Lux/src/ofApp.cpp
+20
-89
No files found.
Lux/.DS_Store
View file @
8274fea7
No preview for this file type
Lux/Lux.xcodeproj/project.xcworkspace/xcuserdata/Dat.xcuserdatad/UserInterfaceState.xcuserstate
View file @
8274fea7
No preview for this file type
Lux/Lux.xcodeproj/project.xcworkspace/xcuserdata/Kevin.xcuserdatad/UserInterfaceState.xcuserstate
deleted
100644 → 0
View file @
399a4144
File deleted
Lux/Lux.xcodeproj/xcuserdata/Kevin.xcuserdatad/xcschemes/xcschememanagement.plist
deleted
100644 → 0
View file @
399a4144
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version=
"1.0"
>
<dict>
<key>
SuppressBuildableAutocreation
</key>
<dict>
<key>
E4B69B5A0A3A1756003C02F2
</key>
<dict>
<key>
primary
</key>
<true/>
</dict>
</dict>
</dict>
</plist>
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
View file @
8274fea7
No preview for this file type
Lux/src/lightDrawing.cpp
View file @
8274fea7
...
...
@@ -2,117 +2,123 @@
// lightDrawing.cpp
// Lux
//
// Created by
Dat Nguyen & Kevin Dang
// Created by
Kevin Dang on 06/04/2016.
//
//
#include <stdio.h>
#include "lightDrawing.h"
// based from tutorial: http://openframeworks.cc/ofBook/chapters/foreword.html
lightDrawing
::
lightDrawing
()
{}
void
lightDrawing
::
setup
()
{
minDistance
=
10
;
leftMouseButtonPressed
=
false
;
rightMouseButtonPressed
=
false
;
// initialise count variable
// value is set at -1 so that
// it matches the drawLine element number
storeLineXYZCount
=
-
1
;
countTest
=
0
;
sumX
=
0
;
}
<<<<<<<
HEAD
=======
void
lightDrawing
::
update
(
ofVec3f
_pos
)
{
if
(
rightMouseButtonPressed
)
{
if
(
lastPoint
.
distance
(
_pos
)
>=
minDistance
)
{
currentPolyline
.
curveTo
(
_pos
);
lastPoint
=
_pos
;
}
}
}
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
void
lightDrawing
::
draw
()
{
ofPushStyle
();
ofSetColor
(
255
);
ofSetLineWidth
(
2
);
for
(
int
i
=
0
;
i
<
drawLine
.
size
();
i
++
)
{
drawLine
[
i
].
draw
();
drawLine
[
i
].
getSmoothed
(
1
);
}
ofPopStyle
();
ofPushStyle
();
for
(
int
i
=
0
;
i
<
polylines
.
size
();
i
++
)
{
ofPolyline
polyline
=
polylines
[
i
];
polyline
.
draw
();
ofSetColor
(
255
,
50
);
float
numPoints
=
polyline
.
size
();
float
tangentLength
=
300
;
for
(
int
p
=
0
;
p
<
500
;
p
+=
1
)
{
ofVec3f
point
=
polyline
.
getPointAtPercent
(
p
/
500.0
);
float
floatIndex
=
p
/
500.0
*
(
numPoints
-
1
);
ofVec3f
tangent
=
polyline
.
getTangentAtIndexInterpolated
(
floatIndex
)
*
tangentLength
;
ofLine
(
point
-
tangent
/
2
,
point
+
tangent
/
2
);
for
(
int
a
=
0
;
a
<
getLineXYZ
.
size
();
a
++
)
{
getLineXYZ
=
drawLine
[
i
].
getVertices
();
allX
=
getLineXYZ
[
a
].
x
;
// prints out the individual values of X
//std::cout << "drawLine[" << i << "] : Position[" << a << "] = " << allX << std::endl;
// this variable should be used for MEAN calculation
numberOfPositions
=
a
;
while
(
countTest
<=
a
)
{
// this has to be <= or it will not take into account the next element
sumX
+=
getLineXYZ
[
countTest
].
x
;
sumY
+=
getLineXYZ
[
countTest
].
y
;
sumZ
+=
getLineXYZ
[
countTest
].
z
;
countTest
++
;
}
meanX
=
sumX
/
countTest
;
meanY
=
sumY
/
countTest
;
meanZ
=
sumZ
/
countTest
;
}
// std::cout << "" << std::endl;
// std::cout << "This is sumX for drawLine[" << i << "]: " << sumX << std::endl;
// std::cout << "This is countTest: " << countTest << std::endl;
// std::cout << "This is meanX: " << meanX << std::endl;
// std::cout << "This is meanY: " << meanY << std::endl;
// std::cout << "This is meanZ: " << meanZ << std::endl;
}
ofSetColor
(
255
,
130
);
ofSetLineWidth
(
1
);
currentPolyline
.
draw
();
ofPopStyle
();
// std::cout << "" << std::endl;
// std::cout << "" << std::endl;
}
void
lightDrawing
::
clearAllLines
()
{
// for (int i = 0; i < drawLine.size(); i++) {
// drawLine[i].clear();
// }
drawLine
.
clear
();
}
void
lightDrawing
::
mouseDragged
(
ofVec3f
_pos
)
{
if
(
leftMouseButtonPressed
)
{
drawLine
[
drawLine
.
size
()
-
1
].
addVertex
(
_pos
);
}
drawLine
[
drawLine
.
size
()
-
1
].
addVertex
(
_pos
);
// creates new element for every point position
getLineXYZ
.
push_back
(
ofVec3f
());
// for each nth element of 'drawLine object'
// store all the points relative to that nth object inside a ofVec3f object: getLineXYZ
}
void
lightDrawing
::
mouseRPressed
()
{
leftMouseButtonPressed
=
true
;
void
lightDrawing
::
mousePressed
()
{
drawLine
.
push_back
(
ofPolyline
());
}
void
lightDrawing
::
mouseRReleased
()
{
leftMouseButtonPressed
=
false
;
}
void
lightDrawing
::
mousePressed
(
ofVec3f
_pos
)
{
// drawLine.push_back(ofPolyline());
rightMouseButtonPressed
=
true
;
currentPolyline
.
curveTo
(
_pos
.
x
,
_pos
.
y
,
_pos
.
z
);
currentPolyline
.
curveTo
(
_pos
.
x
,
_pos
.
y
,
_pos
.
z
);
lastPoint
.
set
(
_pos
.
x
,
_pos
.
y
,
_pos
.
z
);
}
void
lightDrawing
::
mouseReleased
(
ofVec3f
_pos
)
{
rightMouseButtonPressed
=
false
;
currentPolyline
.
curveTo
(
_pos
.
x
,
_pos
.
y
,
_pos
.
z
);
polylines
.
push_back
(
currentPolyline
);
currentPolyline
.
clear
();
// create a new ofVec3f variabe everytime mouse is pressed
// this is only for the storeLineXYZ as it takes the average
// of all the other points
// i.e. you only need one set of storeLineXYZ for all the getLineXYZ data
// of one line drawing
storeLineXYZ
.
push_back
(
ofVec3f
());
// increment count variable to match
// with the number of elements in drawLine
storeLineXYZCount
++
;
}
void
lightDrawing
::
bubblesetup
(){
...
...
@@ -129,16 +135,16 @@ 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
),
0
));
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
),
0
));
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
),
0
));
storeSphere
[
storeSphere
.
size
()
-
1
].
setPosition
(
_pos
+
ofVec3f
(
ofRandom
(
-
5
,
5
),
ofRandom
(
-
5
,
5
),
ofRandom
(
-
5
,
5
)
));
}
Lux/src/lightDrawing.h
View file @
8274fea7
...
...
@@ -2,7 +2,7 @@
// lightDrawing.h
// Lux
//
// Created by
Dat Nguyen & Kevin Dang
// Created by
Kevin Dang on 06/04/2016.
//
//
...
...
@@ -10,7 +10,6 @@
#define lightDrawing_h
#include "ofMain.h"
// based from tutorial: http://openframeworks.cc/ofBook/chapters/foreword.html
class
lightDrawing
{
public:
...
...
@@ -22,33 +21,29 @@ public:
void
draw
();
void
clearAllLines
();
void
mouseDragged
(
ofVec3f
_pos
);
void
mouseRPressed
();
void
mouseRReleased
();
void
mousePressed
();
<<<<<<<
HEAD
=======
void
update
(
ofVec3f
_pos
);
// ofLight light;
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
vector
<
ofVec3f
>
getLineXYZ
;
vector
<
ofVec3f
>
storeLineXYZ
;
ofPolyline
currentPolyline
;
bool
leftMouseButtonPressed
;
bool
rightMouseButtonPressed
;
ofVec3f
lastPoint
;
float
minDistance
;
vector
<
ofPolyline
>
polylines
;
void
mousePressed
(
ofVec3f
_pos
);
void
mouseReleased
(
ofVec3f
_pos
);
int
storeLineXYZCount
;
float
meanX
,
meanY
,
meanZ
;
float
allX
;
float
sumX
;
float
sumY
;
float
sumZ
;
int
numberOfPositions
;
float
tempCatchValue
;
int
countTest
;
vector
<
ofSpherePrimitive
>
storeSphere
;
...
...
Lux/src/ofApp.cpp
View file @
8274fea7
...
...
@@ -42,23 +42,14 @@ void ofApp::camRotate(){
cam
.
pan
(
xdiff
);
if
(
mouseMode
==
false
)
glfwSetCursorPos
(
window
,
windowcenterx
,
windowcentery
);
glfwSetCursorPos
(
window
,
windowcenterx
,
windowcentery
);
}
//--------------------------------------------------------------
void
ofApp
::
setup
(){
<<<<<<<
HEAD
=======
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
mouseMode
=
false
;
isMouseInited
=
false
;
isMouseHeldDown
=
false
;
...
...
@@ -85,7 +76,6 @@ void ofApp::setup(){
LightDrawing
.
setup
();
<<<<<<<
HEAD
guiLighting
.
setup
();
guiLighting
.
setName
(
"Lighting Controls"
);
guiLighting
.
add
(
a1
.
setup
(
"Red"
,
0.8
f
,
-
1.0
f
,
1.0
f
));
...
...
@@ -102,26 +92,12 @@ void ofApp::setup(){
guiBrushes
.
add
(
bubbles
.
setup
(
"Bubble"
,
true
));
LightDrawing
.
bubblesetup
();
=======
gui
.
setup
();
gui
.
add
(
a1
.
setup
(
"Red"
,
0.8
f
,
-
1.0
f
,
1.0
f
));
gui
.
add
(
a2
.
setup
(
"Green"
,
0.
f
,
-
1.0
f
,
1.0
f
));
gui
.
add
(
a3
.
setup
(
"Blue"
,
0.2
f
,
-
1.0
f
,
1.0
f
));
gui
.
add
(
d1
.
setup
(
"Diffuse 1"
,
0.
f
,
-
1.0
f
,
1.0
f
));
gui
.
add
(
d2
.
setup
(
"Diffuse 2"
,
0.
f
,
-
1.0
f
,
1.0
f
));
gui
.
add
(
d3
.
setup
(
"Diffuse 3"
,
1.
f
,
-
1.0
f
,
1.0
f
));
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
}
//--------------------------------------------------------------
void
ofApp
::
update
(){
/*** Simon's Help Start ***/
...
...
@@ -154,14 +130,13 @@ void ofApp::update(){
if
(
mouseMode
==
false
){
glfwSetInputMode
(
window
,
GLFW_CURSOR
,
GLFW_CURSOR_DISABLED
);
}
else
{
glfwSetInputMode
(
window
,
GLFW_CURSOR
,
GLFW_CURSOR_NORMAL
);
}
<<<<<<<
HEAD
if
(
isMouseHeldDown
==
true
&&
standard
==
true
){
LightDrawing
.
mouseDragged
(
pos
);
...
...
@@ -170,14 +145,6 @@ void ofApp::update(){
if
(
isMouseHeldDown
==
true
&&
bubbles
==
true
&&
ofGetFrameNum
()
%
2
==
0
){
LightDrawing
.
createbubble
(
pos
);
}
=======
if
(
isMouseHeldDown
==
true
){
LightDrawing
.
mouseDragged
(
pos
);
}
LightDrawing
.
update
(
pos
);
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
if
(
ofGetKeyPressed
(
'w'
)
==
true
)
{
...
...
@@ -205,19 +172,19 @@ void ofApp::update(){
cam
.
boom
(
1.4
);
}
//light.setSpotlight();
//ofSeedRandom();
srand
(
time
(
NULL
));
srand
(
time
(
NULL
));
}
//--------------------------------------------------------------
void
ofApp
::
draw
(){
ofBackground
(
45
);
ofEnableDepthTest
();
//Lighting
...
...
@@ -243,7 +210,6 @@ void ofApp::draw(){
// ofDrawBox(ofRandom(-1000,1000),ofRandom(-1000,1000), ofRandom(-1000,1000),100);
ofDrawBox
(
100
,
100
,
10
,
100
);
}
<<<<<<<
HEAD
LightDrawing
.
draw
();
...
...
@@ -255,16 +221,6 @@ void ofApp::draw(){
}
cam
.
end
();
=======
//LightDrawing.light.enable();
LightDrawing
.
draw
();
//LightDrawing.light.disable();
cam
.
end
();
light
.
disable
();
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
ofDisableDepthTest
();
ofDisableLighting
();
...
...
@@ -276,8 +232,8 @@ void ofApp::draw(){
ofFill
();
ofCircle
(
ofGetWindowWidth
()
/
2
,
ofGetWindowHeight
()
/
2
,
2
);
}
//--------------------------------------------------------------
...
...
@@ -289,7 +245,7 @@ void ofApp::keyPressed(int key){
//--------------------------------------------------------------
void
ofApp
::
keyReleased
(
int
key
){
if
(
key
==
'r'
)
{
LightDrawing
.
clearAllLines
();
}
...
...
@@ -299,37 +255,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
();
LightDrawing
.
mouseDragged
(
pos
);
camRotate
();
}
//--------------------------------------------------------------
void
ofApp
::
mousePressed
(
int
x
,
int
y
,
int
button
){
<<<<<<<
HEAD
if
(
mouseMode
==
false
&&
standard
==
true
){
LightDrawing
.
mousePressed
();
isMouseHeldDown
=
true
;
}
if
(
bubbles
==
true
){
=======
if
(
mouseMode
==
false
){
if
(
button
==
OF_MOUSE_BUTTON_RIGHT
)
{
LightDrawing
.
mousePressed
(
pos
);
}
if
(
button
==
OF_MOUSE_BUTTON_LEFT
)
{
LightDrawing
.
mouseRPressed
();
}
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
isMouseHeldDown
=
true
;
}
...
...
@@ -339,43 +281,32 @@ void ofApp::mousePressed(int x, int y, int button){
//--------------------------------------------------------------
void
ofApp
::
mouseReleased
(
int
x
,
int
y
,
int
button
){
if
(
mouseMode
==
false
)
<<<<<<<
HEAD
isMouseHeldDown
=
false
;
=======
isMouseHeldDown
=
false
;
if
(
button
==
OF_MOUSE_BUTTON_RIGHT
)
{
LightDrawing
.
mouseReleased
(
pos
);
}
if
(
button
==
OF_MOUSE_BUTTON_LEFT
)
{
LightDrawing
.
mouseRReleased
();
}
>>>>>>>
b7a8325226dd9b7d66922592cd4a1dd23d5317bc
}
//--------------------------------------------------------------
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
){
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment