aboutsummaryrefslogtreecommitdiff
path: root/sons_of_sol
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2013-12-11 02:39:59 -0700
committerJoshua Rahm <joshua.rahm@colorado.edu>2013-12-11 02:39:59 -0700
commit678a0d1e4c97349ae2d29b4bdda8d670ce2490cf (patch)
treef5b8b21b2f1baf803c03a8e247e18c918af5d0cd /sons_of_sol
parent2e297229c65eeb6ec899a6f77bd333c7abc331e4 (diff)
downloadSonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.tar.gz
SonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.tar.bz2
SonsOfSol-678a0d1e4c97349ae2d29b4bdda8d670ce2490cf.zip
Made shader look awesome, added readme, ready for final commit
Diffstat (limited to 'sons_of_sol')
-rw-r--r--sons_of_sol/SonsOfSolApplication.hpp1
-rw-r--r--sons_of_sol/private_db/ApplicationDisplay.cpp63
-rw-r--r--sons_of_sol/private_db/ApplicationInit.cpp1
3 files changed, 3 insertions, 62 deletions
diff --git a/sons_of_sol/SonsOfSolApplication.hpp b/sons_of_sol/SonsOfSolApplication.hpp
index 27187c9..ea56614 100644
--- a/sons_of_sol/SonsOfSolApplication.hpp
+++ b/sons_of_sol/SonsOfSolApplication.hpp
@@ -175,6 +175,7 @@ private:
glox::GloxProgram* m_moon_prog ;
int m_earth_shader_light_pos ;
int m_earth_shader_camera_pos ;
+ int m_earth_shader_time ;
int m_moon_shader_light_pos ;
int m_moon_shader_camera_pos ;
};
diff --git a/sons_of_sol/private_db/ApplicationDisplay.cpp b/sons_of_sol/private_db/ApplicationDisplay.cpp
index e4a2a78..c1a8d87 100644
--- a/sons_of_sol/private_db/ApplicationDisplay.cpp
+++ b/sons_of_sol/private_db/ApplicationDisplay.cpp
@@ -13,68 +13,6 @@ using namespace std;
float randJitter() {
return ((rand() & 0xFF) - 128.0) / (256.0 * 10) ;
}
-void Cockpit()
-{
- // Screen edge
-// float w = 1.8;
- // Save transform attributes (Matrix Mode and Enabled Modes)
- glPushAttrib(GL_TRANSFORM_BIT|GL_ENABLE_BIT);
- // Save projection matrix and set unit transform
- glMatrixMode(GL_PROJECTION);
- glPushMatrix();
- glLoadIdentity();
- glOrtho(-1.8,+1.8,-1,1,-1,1);
- // Save model view matrix and set to indentity
- glMatrixMode(GL_MODELVIEW);
- glPushMatrix();
- glLoadIdentity();
- // Draw instrument panel with texture
- // glColor3f(1,1,1);
- // glEnable(GL_TEXTURE_2D);
- // glBegin(GL_QUADS);
- // glTexCoord2d(0,0);glVertex2f(-2,-1);
- // glTexCoord2d(1,0);glVertex2f(+2,-1);
- // glTexCoord2d(1,1);glVertex2f(+2, 0);
- // glTexCoord2d(0,1);glVertex2f(-2, 0);
- // glEnd();
- // glDisable(GL_TEXTURE_2D);
- // Draw the inside of the cockpit in grey
-// glColor3f(0.6,0.6,0.6);
-// glBegin(GL_QUADS);
-// // Port
-// glVertex2f(-2,-1);
-// glVertex2f(-2,+1);
-// glVertex2f(-w,+1);
-// glVertex2f(-w,-1);
-// // Starboard
-// glVertex2f(+2,-1);
-// glVertex2f(+2,+1);
-// glVertex2f(+w,+1);
-// glVertex2f(+w,-1);
-// // Port overhead
-// glVertex2f(-2.00,+0.8);
-// glVertex2f(-2.00,+1);
-// glVertex2f(-0.03,+1);
-// glVertex2f(-0.03,+0.9);
-// // Starboard overhead
-// glVertex2f(+2.00,+0.8);
-// glVertex2f(+2.00,+1);
-// glVertex2f(+0.03,+1);
-// glVertex2f(+0.03,+0.9);
-// // Windshield divide
-// glVertex2f(-0.03,+1);
-// glVertex2f(+0.03,+1);
-// glVertex2f(+0.03,+0);
-// glVertex2f(-0.03,+0);
-// glEnd();
- // Reset model view matrix
- glPopMatrix();
- // Reset projection matrix
- glMatrixMode(GL_PROJECTION);
- glPopMatrix();
- // Pop transform attributes (Matrix Mode and Enabled Modes)
- glPopAttrib();
-}
void SonsOfSolApplication::display() {
if ( m_script_ttl >= 0 ) {
@@ -136,6 +74,7 @@ void SonsOfSolApplication::display() {
m_earth_prog->render() ;
m_earth_prog->setUniformVector3( m_earth_shader_light_pos,
m_light_manager.getLightSource(0)->getPosition() ) ;
+ m_earth_prog->setUniformFloat( m_earth_shader_time, SDL_GetTicks() / 300000.0 ) ;
//GloxPoint<> pos( GloxCos( ticks ) * FAR_DISTANCE_END/4.0, 0, GloxSin( ticks ) * FAR_DISTANCE_END/4.0 );
GloxPoint<> pos( -250000, 0, 0 );
diff --git a/sons_of_sol/private_db/ApplicationInit.cpp b/sons_of_sol/private_db/ApplicationInit.cpp
index ea409ed..30b4b10 100644
--- a/sons_of_sol/private_db/ApplicationInit.cpp
+++ b/sons_of_sol/private_db/ApplicationInit.cpp
@@ -199,6 +199,7 @@ bool SonsOfSolApplication::initialize( int argc, char** argv ) {
}
m_earth_shader_light_pos = m_earth_prog->getUniformLocation( "lightPos" );
m_earth_shader_camera_pos = m_earth_prog->getUniformLocation( "cameraPos" );
+ m_earth_shader_time = m_earth_prog->getUniformLocation( "time" ) ;
cout << "Earth light " << m_earth_shader_light_pos << endl;
cout << "Earth camera " << m_earth_shader_camera_pos << endl;