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
c3b6776d
Commit
c3b6776d
authored
Apr 18, 2016
by
Dat Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiple light source updated
parent
f6d080e6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
34 deletions
+67
-34
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
+0
-0
Lux/src/Gui.cpp
Lux/src/Gui.cpp
+3
-2
Lux/src/ofApp.cpp
Lux/src/ofApp.cpp
+61
-32
Lux/src/ofApp.h
Lux/src/ofApp.h
+3
-0
No files found.
Lux/bin/LuxDebug.app/Contents/MacOS/LuxDebug
View file @
c3b6776d
No preview for this file type
Lux/src/Gui.cpp
View file @
c3b6776d
...
...
@@ -21,9 +21,10 @@ void Gui::setup(){
guiLighting1
.
setup
();
guiLighting1
.
setName
(
"Lighting Controls2"
);
guiLighting1
.
setPosition
(
10
,
500
);
guiLighting1
.
add
(
selection
.
setup
(
"SphereNum"
,
0
,
0
,
4
));
guiLighting1
.
add
(
a11
.
setup
(
"Red"
,
0.
8
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
a22
.
setup
(
"Green"
,
0.
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
a11
.
setup
(
"Red"
,
0.
1
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
a22
.
setup
(
"Green"
,
0.
8
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
a33
.
setup
(
"Blue"
,
0.2
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
d11
.
setup
(
"Diffuse 1"
,
0.
f
,
-
1.0
f
,
1.0
f
));
guiLighting1
.
add
(
d22
.
setup
(
"Diffuse 2"
,
0.
f
,
-
1.0
f
,
1.0
f
));
...
...
Lux/src/ofApp.cpp
View file @
c3b6776d
...
...
@@ -53,6 +53,7 @@ void ofApp::camRotate(){
//--------------------------------------------------------------
void
ofApp
::
setup
(){
ofSetVerticalSync
(
true
);
state
=
1
;
mouseMode
=
false
;
...
...
@@ -85,7 +86,8 @@ void ofApp::setup(){
lightPos
.
set
(
0
,
0
,
planeDist
);
ofDisableArbTex
();
ofSetSmoothLighting
(
true
);
for
(
int
i
=
0
;
i
<
5
;
i
++
){
v_light
.
push_back
(
light
);
...
...
@@ -180,10 +182,10 @@ void ofApp::update(){
}
if
(
ofGetKeyPressed
(
'q'
)
==
true
)
{
cam
.
boom
(
-
1.4
);
cam
.
boom
(
1.4
);
}
if
(
ofGetKeyPressed
(
'e'
)
==
true
)
{
cam
.
boom
(
1.4
);
cam
.
boom
(
-
1.4
);
}
...
...
@@ -206,12 +208,36 @@ void ofApp::update(){
}
v_light
[
0
].
setAmbientColor
(
ofFloatColor
(
userInterface
.
a1
,
userInterface
.
a2
,
userInterface
.
a3
,
1.0
));
v_light
[
0
].
setDiffuseColor
(
ofFloatColor
(
userInterface
.
d1
,
userInterface
.
d2
,
userInterface
.
d3
));
v_light
[
0
].
setSpecularColor
(
ofFloatColor
(
1.
f
,
1.
f
,
1.
f
));
v_light
[
1
].
setAmbientColor
(
ofFloatColor
(
0.7
,
0.7
,
0.7
,
1.0
));
v_light
[
1
].
setDiffuseColor
(
ofFloatColor
(
0.5
,
0.5
,
0.5
));
v_light
[
1
].
setSpecularColor
(
ofFloatColor
(
1.
f
,
1.
f
,
1.
f
));
// v_light[0].setAmbientColor(ofFloatColor(userInterface.a1, userInterface.a2, userInterface.a3, 1.0));
// v_light[0].setDiffuseColor(ofFloatColor(userInterface.d1, userInterface.d2, userInterface.d3));
// v_light[0].setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
// v_light[1].setAmbientColor(ofFloatColor(0.7, 0.7, 0.7, 1.0));
// v_light[1].setDiffuseColor(ofFloatColor(0.5, 0.5, 0.5));
// v_light[1].setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
light0
.
setDiffuseColor
(
ofColor
(
0.
f
,
255.
f
,
0.
f
));
// specular color, the highlight/shininess color //
light0
.
setSpecularColor
(
ofColor
(
255.
f
,
255.
f
,
0.
f
));
light0
.
setPointLight
();
light1
.
setDiffuseColor
(
ofColor
(
255.
f
,
0.
f
,
0.
f
));
light1
.
setSpecularColor
(
ofColor
(
255.
f
,
255.
f
,
255.
f
));
// turn the light into spotLight, emit a cone of light //
light1
.
setPointLight
();
// // size of the cone of emitted light, angle between light axis and side of cone //
// // angle range between 0 - 90 in degrees //
// light1.setSpotlightCutOff( 50 );
//
// // rate of falloff, illumitation decreases as the angle from the cone axis increases //
// // range 0 - 128, zero is even illumination, 128 is max falloff //
// light1.setSpotConcentration( 45 );
light0
.
setPosition
(
lightBalls
.
Flocking
[
0
].
location
.
x
,
lightBalls
.
Flocking
[
0
].
location
.
y
,
lightBalls
.
Flocking
[
0
].
location
.
z
);
light1
.
setPosition
(
lightBalls
.
Flocking
[
1
].
location
.
x
,
lightBalls
.
Flocking
[
1
].
location
.
y
,
lightBalls
.
Flocking
[
1
].
location
.
z
);
}
//--------------------------------------------------------------
...
...
@@ -220,6 +246,9 @@ void ofApp::draw(){
ofBackground
(
45
);
ofEnableDepthTest
();
ofEnableLighting
();
light0
.
enable
();
light1
.
enable
();
// v_light[userInterface.selection].setAmbientColor(ofFloatColor(userInterface.a1, userInterface.a2, userInterface.a3, 1.0));
// v_light[userInterface.selection].setDiffuseColor(ofFloatColor(userInterface.d1, userInterface.d2, userInterface.d3));
// v_light[userInterface.selection].setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
...
...
@@ -230,29 +259,29 @@ void ofApp::draw(){
// v_light[1].setDiffuseColor(ofFloatColor(0.5, 0.5, 0.5));
// v_light[1].setSpecularColor(ofFloatColor(1.f, 1.f, 1.f));
GLfloat
light_ambient
[]
=
{
userInterface
.
a1
,
userInterface
.
a2
,
userInterface
.
a3
,
1.0
};
GLfloat
light_diffuse
[]
=
{
userInterface
.
d1
,
userInterface
.
d2
,
userInterface
.
d3
,
1.0
};
GLfloat
light_specular
[]
=
{
1.0
,
1.0
,
1
.0
,
1.0
};
GLfloat
light_position
[]
=
{
lightBalls
.
Flocking
[
0
].
location
.
x
,
lightBalls
.
Flocking
[
0
].
location
.
y
,
lightBalls
.
Flocking
[
0
].
location
.
z
,
0.0
};
glLightfv
(
GL_LIGHT0
,
GL_AMBIENT
,
light_ambient
);
glLightfv
(
GL_LIGHT0
,
GL_DIFFUSE
,
light_diffuse
);
glLightfv
(
GL_LIGHT0
,
GL_SPECULAR
,
light_specular
);
glLightfv
(
GL_LIGHT0
,
GL_POSITION
,
light_position
);
//glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 6
0.0f);
glEnable
(
GL_LIGHT0
);
GLfloat
light_ambient1
[]
=
{
userInterface
.
a11
,
userInterface
.
a22
,
userInterface
.
a33
,
1.0
};
GLfloat
light_diffuse1
[]
=
{
userInterface
.
d11
,
userInterface
.
d22
,
userInterface
.
d33
,
1.0
};
GLfloat
light_specular1
[]
=
{
1.0
,
1.0
,
1
.0
,
1.0
};
GLfloat
light_position1
[]
=
{
lightBalls
.
Flocking
[
1
].
location
.
x
,
lightBalls
.
Flocking
[
1
].
location
.
y
,
lightBalls
.
Flocking
[
1
].
location
.
z
,
0.0
};
glLightfv
(
GL_LIGHT1
,
GL_AMBIENT
,
light_ambient1
);
glLightfv
(
GL_LIGHT1
,
GL_DIFFUSE
,
light_diffuse1
);
glLightfv
(
GL_LIGHT1
,
GL_SPECULAR
,
light_specular1
);
glLightfv
(
GL_LIGHT1
,
GL_POSITION
,
light_position1
);
//glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 6
0.0f);
glEnable
(
GL_LIGHT1
);
//
GLfloat light_ambient[] = {userInterface.a1, userInterface.a2, userInterface.a3, 1.0};
//
GLfloat light_diffuse[] = {userInterface.d1, userInterface.d2, userInterface.d3, 1.0};
// GLfloat light_specular[] = {1.0, 0.0, 0
.0, 1.0};
//
GLfloat light_position[] = {lightBalls.Flocking[0].location.x, lightBalls.Flocking[0].location.y, lightBalls.Flocking[0].location.z, 0.0};
//
//
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
//
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
//
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
//
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
// glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 9
0.0f);
//
glEnable(GL_LIGHT0);
//
//
GLfloat light_ambient1[] = {userInterface.a11, userInterface.a22, userInterface.a33, 1.0};
//
GLfloat light_diffuse1[] = {userInterface.d11, userInterface.d22, userInterface.d33, 1.0};
// GLfloat light_specular1[] = {0.0, 1.0, 0
.0, 1.0};
//
GLfloat light_position1[] = {lightBalls.Flocking[1].location.x, lightBalls.Flocking[1].location.y, lightBalls.Flocking[1].location.z, 0.0};
//
//
glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient1);
//
glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse1);
//
glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular1);
//
glLightfv(GL_LIGHT1, GL_POSITION, light_position1);
// glLightf(GL_LIGHT1, GL_SPOT_CUTOFF, 9
0.0f);
//
glEnable(GL_LIGHT1);
if
(
state
==
0
)
{
...
...
Lux/src/ofApp.h
View file @
c3b6776d
...
...
@@ -52,6 +52,9 @@ public:
GLFWwindow
*
window
=
static_cast
<
ofAppGLFWWindow
*>
(
ofGetWindowPtr
())
->
getGLFWWindow
();
ofLight
light0
;
ofLight
light1
;
ofLight
light
;
vector
<
ofLight
>
v_light
;
...
...
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