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
1a3d3354
Commit
1a3d3354
authored
Apr 21, 2016
by
Kevin Dang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some comments to the code
parent
5ca5cf98
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
33 additions
and
28 deletions
+33
-28
Final Project/Lux/src/flocking.h
Final Project/Lux/src/flocking.h
+5
-5
Final Project/Lux/src/lightBalls.cpp
Final Project/Lux/src/lightBalls.cpp
+5
-5
Final Project/Lux/src/lightBalls.h
Final Project/Lux/src/lightBalls.h
+4
-4
Final Project/Lux/src/main.cpp
Final Project/Lux/src/main.cpp
+2
-0
Final Project/Lux/src/ofApp.h
Final Project/Lux/src/ofApp.h
+3
-3
Final Project/Lux/src/populateSmallSphere.cpp
Final Project/Lux/src/populateSmallSphere.cpp
+4
-4
Final Project/Lux/src/populateSmallSphere.h
Final Project/Lux/src/populateSmallSphere.h
+3
-2
Final Project/Lux/src/smallSphereObject.h
Final Project/Lux/src/smallSphereObject.h
+7
-5
No files found.
Final Project/Lux/src/flocking.h
View file @
1a3d3354
...
...
@@ -12,14 +12,14 @@
class
flocking
{
public:
flocking
(
float
_x
,
float
_y
,
float
_z
);
float
x
;
float
y
;
float
z
;
flocking
(
float
_x
,
float
_y
,
float
_z
);
// constructor takes in x y z for sphere positions
float
x
;
// x
float
y
;
// y
float
z
;
// z
void
display
();
void
update
(
ofVec3f
_tempPos
);
ofVec3f
location
,
velocity
,
acceleration
,
dir
,
staticTarget
;
float
topSpeed
;
float
topSpeed
;
};
...
...
Final Project/Lux/src/lightBalls.cpp
View file @
1a3d3354
...
...
@@ -10,24 +10,24 @@
#include "lightBalls.h"
lightBalls
::
lightBalls
()
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
Flocking
.
push_back
(
flocking
(
0
,
0
,
0
));
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
// only create 5 light spheres in our world
Flocking
.
push_back
(
flocking
(
0
,
0
,
0
));
// set initial position to 0,0,0
}
}
void
lightBalls
::
update
(
ofVec3f
_tempPos
)
{
for
(
int
i
=
0
;
i
<
Flocking
.
size
();
i
++
)
{
Flocking
[
i
].
update
(
_tempPos
);
Flocking
[
i
].
update
(
_tempPos
);
// apply the update function to all elements in the vector
}
for
(
int
i
=
0
;
i
<
Flocking
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
Flocking
.
size
();
i
++
)
{
// this controls the movement and direction of the sphere objects
Flocking
[
i
].
dir
.
set
(
Flocking
[
i
].
staticTarget
.
x
-
Flocking
[
i
].
location
.
x
,
Flocking
[
i
].
staticTarget
.
y
-
Flocking
[
i
].
location
.
y
);
}
}
void
lightBalls
::
display
()
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
// displays all elements in the vector
Flocking
[
i
].
display
();
}
}
...
...
Final Project/Lux/src/lightBalls.h
View file @
1a3d3354
...
...
@@ -9,14 +9,14 @@
#ifndef lightBalls_h
#define lightBalls_h
#include "ofMain.h"
#include "flocking.h"
#include "flocking.h"
// include the flocking class to use in this lightBall object
class
lightBalls
{
public:
lightBalls
();
void
display
();
lightBalls
();
void
display
();
void
update
(
ofVec3f
_tempPos
);
vector
<
flocking
>
Flocking
;
vector
<
flocking
>
Flocking
;
// create vector of Flocking class
};
#endif
/* lightBalls_h */
Final Project/Lux/src/main.cpp
View file @
1a3d3354
...
...
@@ -5,6 +5,8 @@
int
main
(
){
ofSetupOpenGL
(
1024
,
768
,
OF_FULLSCREEN
);
// <-------- setup the GL context
// set the screen to full screen mode
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
// pass in width and height too:
...
...
Final Project/Lux/src/ofApp.h
View file @
1a3d3354
...
...
@@ -11,9 +11,9 @@
class
ofApp
:
public
ofBaseApp
{
public:
void
setup
();
void
update
();
void
draw
();
void
setup
();
void
update
();
void
draw
();
void
camRotate
();
...
...
Final Project/Lux/src/populateSmallSphere.cpp
View file @
1a3d3354
...
...
@@ -11,18 +11,18 @@
populateSmallSphere
::
populateSmallSphere
()
{
for
(
int
i
=
0
;
i
<
600
;
i
++
)
{
sphereObjects
.
push_back
(
smallSphereObject
(
0
,
0
,
0
));
sphereObjects
.
push_back
(
smallSphereObject
(
0
,
0
,
0
));
// populate the world with 600 small sphere objects
}
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
boxObject
.
push_back
(
boxObjects
(
0
,
0
,
0
));
boxObject
.
push_back
(
boxObjects
(
0
,
0
,
0
));
// populate the world with box objects
}
}
void
populateSmallSphere
::
display
()
{
for
(
int
i
=
0
;
i
<
sphereObjects
.
size
();
i
++
)
{
sphereObjects
[
i
].
display
();
sphereObjects
[
i
].
display
();
// display the small sphere objects in the world
}
for
(
int
i
=
0
;
i
<
boxObject
.
size
();
i
++
)
{
boxObject
[
i
].
display
();
boxObject
[
i
].
display
();
// display the box object
}
}
\ No newline at end of file
Final Project/Lux/src/populateSmallSphere.h
View file @
1a3d3354
...
...
@@ -9,14 +9,15 @@
#ifndef populateSmallSphere_h
#define populateSmallSphere_h
#include "ofMain.h"
#include "smallSphereObject.h"
#include "smallSphereObject.h"
// include the smallSphereObject.h class
class
populateSmallSphere
{
public:
populateSmallSphere
();
void
display
();
vector
<
smallSphereObject
>
sphereObjects
;
// create vector of smallSphereObject and boxObjects
vector
<
smallSphereObject
>
sphereObjects
;
vector
<
boxObjects
>
boxObject
;
};
...
...
Final Project/Lux/src/smallSphereObject.h
View file @
1a3d3354
...
...
@@ -10,21 +10,23 @@
#define smallSphereObject_h
#include "ofMain.h"
// this is the class for the static sphere objects, used to populate the world
class
smallSphereObject
{
protected:
float
x
;
float
y
;
float
z
;
ofVec3f
location
;
public:
explicit
smallSphereObject
(
float
_x
,
float
_y
,
float
_z
);
ofVec3f
location
;
// create vector for location variable which takes in the floats x,y,z
public:
explicit
smallSphereObject
(
float
_x
,
float
_y
,
float
_z
);
// the explicit keyword allows for constructor inheritance
virtual
void
display
();
};
class
boxObjects
:
public
smallSphereObject
{
class
boxObjects
:
public
smallSphereObject
{
// boxObject inherits smallSphereObject
public:
using
smallSphereObject
::
smallSphereObject
;
using
smallSphereObject
::
smallSphereObject
;
// inherits the constructor from base class
void
display
();
};
...
...
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