aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Main.cpp103
-rw-r--r--objects/frigate_industrial.obj1145
-rw-r--r--objects/material/frigate_industrial.mtl41
-rw-r--r--objects/material/probe.mtl11
-rw-r--r--objects/probe.obj187
-rw-r--r--objects/textures/crate.bmpbin0 -> 196662 bytes
-rw-r--r--objects/textures/earth.bmpbin0 -> 25165962 bytes
-rw-r--r--objects/textures/leaf.bmpbin0 -> 3210 bytes
-rw-r--r--objects/textures/metal.bmpbin0 -> 3145866 bytes
-rw-r--r--objects/textures/star.bmpbin0 -> 786570 bytes
-rw-r--r--objects/textures/stars.bmpbin0 -> 786554 bytes
-rw-r--r--objects/textures/windows.bmpbin0 -> 196746 bytes
-rw-r--r--sons_of_sol/ControlMotionEvent.hpp65
-rw-r--r--sons_of_sol/ControlMotionListener.hpp20
-rw-r--r--sons_of_sol/ControlMultiplexer.hpp95
-rw-r--r--sons_of_sol/PlayerShip.hpp125
-rw-r--r--sons_of_sol/SonsOfSolApplication.hpp56
-rw-r--r--sons_of_sol/private_db/ControlMultiplexer.cpp58
-rw-r--r--sons_of_sol/private_db/PlayerShip.cpp103
-rw-r--r--sons_of_sol/private_db/SonsOfSolApplication.cpp202
20 files changed, 2072 insertions, 139 deletions
diff --git a/Main.cpp b/Main.cpp
index 1b23bc0..1685244 100644
--- a/Main.cpp
+++ b/Main.cpp
@@ -14,6 +14,8 @@
#include "glox/GloxColor.hpp"
#include "glox/GloxLookAtPerspective.hpp"
+#include "sons_of_sol/SonsOfSolApplication.hpp"
+
using namespace slox;
using namespace glox;
using namespace std;
@@ -23,105 +25,8 @@ void exit( const SDL_QuitEvent& evt ) {
exit( 0 );
}
-class SonsOfSol : public SloxApplication, SloxRawEventHandler {
-public:
- void reshape( int width, int height ) {
- m_viewport.setWidth( width );
- m_viewport.setHeight( height );
-
- m_viewport.render();
- m_perspective.setAspectRatio( m_viewport.getAspectRatio() );
- m_perspective.project();
- }
-
- void onEvent( const SDL_Event& event ) { SloxRawEventHandler::onEvent( event ); }
-
- bool initialize( int argc, char** argv ) {
- (void) argc;
- (void) argv;
-
- unsigned int tex = 0;
-
- SDL_Init( SDL_INIT_VIDEO );
- m_screen = SDL_SetVideoMode( 600, 600, 0, SDL_OPENGL|SDL_RESIZABLE|SDL_DOUBLEBUF );
-
- m_perspective.setPosition( GloxPoint<>( 0, 0, 10 ) );
-
- this->addQuitListener( new SloxFunctionQuitListener( exit ) );
-
- if( ! m_screen ) {
- /* If the screen could not be initialized, print
- * a useful video message */
- this->setError( "Cannot set SDL video mode\n" );
- return false;
- }
-
- SDL_WM_SetCaption( "Sons Of Sol", "" );
- reshape( m_screen->w, m_screen->h );
-
- if( SloxTextureFactory::readBitmapFile( "stars.bmp", &tex ) ) {
- /* Either there was a warning or an error, print out
- * either */
- fprintf( stderr, "%s\n", SloxTextureFactory::getMessage().c_str() );
-
- if( tex == 0 ) {
- /* If the texture hasn't changed, its an error, otherwise
- * it's a warning, so continue */
- this->setError( "Aborting: unable to load texture" );
- return false;
- }
- }
- m_sky_tex.setId( tex );
- GloxTextureRepeat texrep( &m_sky_tex, 3, 3 );
- m_sky = new GloxTexturedCube( 900.0f, GloxColor( 255, 255, 255 ),
- texrep, texrep, texrep, texrep, texrep, texrep );
-
- m_quit = false;
- return true;
- }
-
- bool loop( uint32_t ticks ) {
- (void) ticks;
- /* Set some parameters */
- GloxState::clear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
- GloxState::enable( GL_DEPTH_TEST );
- GloxState::loadIdentity();
-
- /* Translate to the this perspective */
- m_perspective.render();
- m_sky->draw();
-
- GloxColor( 255,255,255 ).render();
-
- GloxWith( GL_QUADS, {
- GloxPoint<>( 0,0,0 ).plot();
- GloxPoint<>( 0,5,0 ).plot();
- GloxPoint<>( 5,5,0 ).plot();
- GloxPoint<>( 5,0,0 ).plot();
- } )
-
- glFlush();
- SDL_GL_SwapBuffers();
- /* Slow down a little */
- SDL_Delay( 5 );
- return !m_quit;
- }
-
-
- ~SonsOfSol() {
- }
-private:
- GloxViewport m_viewport;
- GloxLookAtPerspective m_perspective;
- GloxTexturedCube* m_sky;
- GloxTexture m_sky_tex;
-
- SDL_Surface* m_screen;
-
- bool m_quit;
-};
-
int main ( int argc, char ** argv ) {
- SonsOfSol game;
+ SonsOfSolApplication game;
game.run( argc, argv );
+ return 0;
}
diff --git a/objects/frigate_industrial.obj b/objects/frigate_industrial.obj
new file mode 100644
index 0000000..7b4a24b
--- /dev/null
+++ b/objects/frigate_industrial.obj
@@ -0,0 +1,1145 @@
+# Blender v2.68 (sub 0) OBJ File: 'frigate_industrial.blend'
+# www.blender.org
+mtllib frigate_industrial.mtl
+o Cube
+v 1.000000 -4.400962 -1.000000
+v -1.000000 -4.400962 -1.000000
+v 0.509967 -2.200231 0.988432
+v -0.509967 -2.200230 0.988432
+v 1.000000 6.982783 -1.000000
+v 0.000000 -4.400962 -1.000000
+v 1.000000 -4.400962 0.000000
+v -1.000000 6.982784 -1.000000
+v -1.000000 -4.400962 0.000000
+v 0.509967 6.114709 0.998452
+v -0.000000 -2.200231 0.988432
+v -0.509967 6.114709 0.998452
+v 0.000000 6.982783 -1.000000
+v -0.000000 6.114709 0.998452
+v 1.000000 6.982781 0.000000
+v -1.022261 6.994311 0.000000
+v 0.721413 12.585482 -0.564245
+v 1.000000 1.755132 -1.000000
+v -0.500000 -4.400962 -1.000000
+v 1.000000 -4.400962 0.500000
+v -1.000000 7.886236 -1.000000
+v -1.000000 -4.400961 0.500000
+v 0.509967 2.502633 0.988432
+v -0.254984 -2.200230 0.988432
+v -0.509967 6.804891 0.998452
+v 1.000000 7.886236 -1.000000
+v 2.744694 7.799883 -1.498303
+v 0.500000 -4.400962 -1.000000
+v 1.000000 -4.400962 -0.500000
+v -1.000000 1.755132 -1.000000
+v -1.000000 -4.400962 -0.500000
+v 2.744694 7.069129 -1.498303
+v 0.509967 6.804889 0.998452
+v 2.852272 7.069129 -1.498303
+v 0.254983 -2.200231 0.988432
+v -0.509967 2.502634 0.988432
+v -0.500000 6.982783 -1.000000
+v 0.500000 6.982783 -1.000000
+v 0.000000 7.886236 -1.000000
+v 0.000000 1.755132 -1.000000
+v -0.000000 2.502633 0.988432
+v -0.000000 6.804891 0.998452
+v 0.254983 6.114709 0.998452
+v -0.254984 6.114709 0.998452
+v 1.000000 1.755132 0.000000
+v 1.000000 7.886234 0.000000
+v 1.000000 6.982783 -0.500000
+v 1.000000 6.982781 0.500000
+v -0.500000 -4.400962 0.000000
+v 0.500000 -4.400962 0.000000
+v -0.000000 -4.400962 -0.500000
+v -0.000000 -4.400962 0.500000
+v -1.000000 7.886236 0.000000
+v -1.000000 1.755132 0.000000
+v -1.000000 6.982784 -0.500000
+v -1.000000 6.982783 0.500000
+v 2.852272 7.799883 -1.498303
+v 2.665603 7.799883 1.645780
+v 2.665603 7.069129 1.645780
+v 2.773181 7.069129 1.645780
+v -0.500000 1.755132 -1.000000
+v -0.254984 2.502634 0.988432
+v 1.000000 1.755131 0.500000
+v -0.500000 -4.400962 0.500000
+v -1.000000 7.886236 0.500000
+v 2.773181 7.799883 1.645780
+v -0.500000 7.886236 -1.000000
+v 0.500000 7.886236 -1.000000
+v 0.500000 1.755132 -1.000000
+v 0.254983 2.502633 0.988432
+v 0.254983 6.804889 0.998452
+v -0.254984 6.804891 0.998452
+v 1.000000 1.755132 -0.500000
+v 1.000000 7.886236 -0.500000
+v 1.000000 7.886234 0.500000
+v -0.500000 -4.400962 -0.500000
+v 0.500000 -4.400962 -0.500000
+v 0.500000 -4.400962 0.500000
+v -1.000000 7.886236 -0.500000
+v -1.000000 1.755132 -0.500000
+v -1.022261 1.726429 0.500000
+v 3.570951 7.799883 0.666324
+v 3.570951 7.069129 0.666324
+v 3.570951 7.799883 -0.256289
+v -0.000001 -9.321733 -0.000000
+v -0.500001 -9.321733 -0.000000
+v 0.562324 -9.321733 -0.000000
+v -0.000001 -9.321733 -0.500000
+v -0.000001 -9.321733 0.500000
+v -0.500001 -9.321733 0.500000
+v -0.500001 -9.321733 -0.500000
+v 0.499999 -9.321733 -0.500000
+v 0.499999 -9.321733 0.500000
+v 1.698846 -4.400962 0.000000
+v 1.698846 6.982781 0.000000
+v 1.698846 -4.400963 0.500000
+v 1.698846 1.755131 0.000000
+v 1.698846 7.886234 0.000000
+v 1.698846 6.982781 0.500000
+v 1.698846 1.755131 0.500000
+v 1.698846 7.886234 0.500000
+v -0.750000 -4.400962 -1.000000
+v -1.000000 -4.400962 -0.750000
+v -0.750000 -4.400962 -0.500000
+v -0.500000 -4.400962 -0.750000
+v -0.750000 -4.400962 -0.750000
+v -0.894381 -9.710403 -0.894380
+v -0.855621 -9.710403 -0.894380
+v -0.894381 -9.710403 -0.855619
+v -0.855621 -9.710403 -0.855619
+v -0.201494 -15.053990 0.201492
+v -0.298508 -15.053990 0.201492
+v -0.201494 -15.053990 0.298507
+v -0.298508 -15.053990 0.298507
+v 0.524332 -9.365698 -0.274334
+v 0.524332 -9.365698 0.274333
+v 1.000000 1.755132 -1.219876
+v -1.000000 1.755132 -1.185570
+v 0.000000 1.755132 -1.398051
+v -0.500000 1.755132 -1.398051
+v 0.500000 1.755132 -1.398051
+v 0.226188 -2.284603 -1.180069
+v 0.273812 -2.284603 -1.180069
+v 0.226188 -2.284603 -1.217982
+v 0.273812 -2.284603 -1.217982
+v 2.450417 -4.400962 0.000000
+v 2.450417 -4.400963 0.500000
+v 2.450417 1.755131 0.000000
+v 2.450417 1.755131 0.500000
+v 2.559559 -9.782540 -0.222024
+v 2.559559 -9.782540 0.722025
+v 2.559560 2.625406 -0.222024
+v 2.559559 2.625404 0.722025
+v 2.699779 -9.782540 -0.222024
+v 2.699779 -9.782540 0.722025
+v 2.699780 2.625406 -0.222024
+v 2.699779 2.625404 0.722025
+v 1.583696 -7.937670 2.096182
+v 1.583696 0.780533 2.096182
+v 1.723915 -7.937670 2.096182
+v 1.723916 0.780533 2.096182
+v 1.790421 -7.779339 -1.831149
+v 1.790422 0.622206 -1.831149
+v 1.930641 -7.779339 -1.831149
+v 1.930641 0.622206 -1.831149
+v -1.721108 1.726429 0.000000
+v -1.721108 1.726429 0.500000
+v -1.721108 6.994310 0.000000
+v -1.721108 6.994310 0.500000
+v -2.472679 1.726429 0.000000
+v -2.472679 1.726429 0.500000
+v -2.472679 6.994310 0.000000
+v -2.472679 6.994310 0.500000
+v -2.581821 -0.612768 -0.222024
+v -2.581821 -0.612768 0.722025
+v -2.581821 10.672450 -0.222024
+v -2.581821 10.672450 0.722025
+v -2.722041 -0.612768 -0.222024
+v -2.722041 -0.612768 0.722025
+v -2.722041 10.672450 -0.222024
+v -2.722041 10.672450 0.722025
+v -1.605958 1.710955 2.096182
+v -1.605958 8.348727 2.096182
+v -1.746177 1.710955 2.096182
+v -1.746177 8.348727 2.096182
+v -1.812683 1.910377 -1.831149
+v -1.812683 8.149306 -1.831149
+v -1.952902 1.910377 -1.831149
+v -1.952903 8.149306 -1.831149
+v -0.500001 -5.919474 -0.000000
+v -0.500001 -5.294299 0.500000
+v -1.524574 -9.328818 0.000000
+v -1.524574 -9.328818 0.500000
+v -1.524574 -5.265311 0.000000
+v -1.524574 -5.265311 0.500000
+v -1.633717 -3.055185 -0.222024
+v -1.633716 -3.055185 0.722025
+v -1.773936 -3.055185 -0.222024
+v -1.773936 -3.055185 0.722025
+v -0.946725 11.456480 0.006182
+v 1.053275 11.456478 0.006182
+v 0.053275 11.456480 1.006181
+v 0.053275 11.456480 -0.993818
+v 0.435381 12.585482 0.873729
+v 1.053276 11.456478 1.006181
+v -0.716561 12.585482 -0.278214
+v 0.912533 12.585482 -0.278214
+v 0.435383 12.585482 -0.755365
+v 1.053275 11.456480 -0.993818
+v -0.946725 11.456480 1.006181
+v -0.391837 12.585482 0.792254
+v -0.635086 12.585482 0.549005
+v -0.946724 11.456480 -0.993818
+v 0.831058 12.585482 0.549006
+v -0.239410 12.585482 -0.755365
+v 0.097986 12.585482 0.940840
+v -0.783673 12.585482 0.059181
+v 0.979645 12.585482 0.231185
+v 0.097987 12.585482 -0.822477
+v -0.525441 12.585482 0.682608
+v 0.721413 12.585482 0.682609
+v -0.525441 12.585482 -0.564245
+v 3.570951 7.069129 -0.256289
+v 3.463373 7.069129 -0.256289
+v 3.463373 7.799883 -0.256289
+v 3.463373 7.069129 0.666324
+v 3.463373 7.799883 0.666324
+v 3.238686 7.699403 0.396602
+v 3.238686 7.169609 0.396602
+v 3.238686 7.699403 0.103398
+v 3.238686 7.169609 0.103398
+v -0.320998 11.395020 0.024426
+v 0.441986 11.395020 0.024426
+v 0.060494 11.418424 0.405918
+v 0.060494 11.395020 -0.357066
+v -0.946725 11.456480 0.506182
+v -0.320998 11.395020 -0.357066
+v -0.446725 11.456480 -0.993818
+v 0.553275 11.456480 -0.993818
+v 0.553275 11.456478 1.006181
+v -0.446725 11.456480 1.006181
+v 1.053275 11.456480 -0.493818
+v 1.053275 11.456478 0.506182
+v -0.946725 11.456480 -0.493818
+v -0.320998 11.418424 0.405918
+v 0.441986 11.418423 0.405918
+v 0.441986 11.395020 -0.357066
+v 0.441986 9.272356 -0.337128
+v 0.441986 9.295760 0.425857
+v -0.320999 9.295763 0.425857
+v -0.320999 9.272356 -0.337128
+v 0.060494 9.272356 -0.337128
+v 0.060494 9.295763 0.425857
+v 0.441986 9.272356 0.044365
+v -0.320999 9.272356 0.044365
+v 0.060494 9.272356 0.044365
+v 2.744694 10.619725 -1.498303
+v 2.852272 10.619725 -1.498303
+v 2.665603 10.619725 1.645780
+v 2.773181 10.619725 1.645780
+v 3.570951 10.619725 0.666324
+v 3.570951 10.619725 -0.256289
+v 3.463373 10.619725 -0.256289
+v 3.463373 10.619725 0.666324
+v 1.546385 13.902023 -1.011115
+v 1.653962 13.902023 -1.011115
+v 1.467293 13.902023 1.210317
+v 1.574871 13.902023 1.210317
+v 2.372641 13.902023 0.367009
+v 2.372641 13.902023 0.081267
+v 2.265063 13.902023 0.081267
+v 2.265063 13.902023 0.367009
+v 2.744694 3.878959 -1.498303
+v 2.852272 3.878959 -1.498303
+v 2.665603 3.878959 1.645780
+v 2.773181 3.878959 1.645780
+v 3.570951 3.878959 0.666324
+v 3.570951 3.878959 -0.256289
+v 3.463373 3.878959 -0.256289
+v 3.463373 3.878959 0.666324
+v -1.409283 13.558038 -0.204105
+v -1.409283 13.558038 0.739944
+v -1.549503 13.558038 -0.204105
+v -1.549502 13.558038 0.739944
+v -0.433419 11.234316 2.114101
+v -0.573639 11.234316 2.114101
+v -0.640145 11.034892 -1.813230
+v -0.780365 11.034892 -1.813230
+v 1.583696 -3.578567 2.096182
+v -1.633716 -10.105862 -0.222024
+v -1.633716 -10.105862 0.722025
+v -1.773936 -10.105862 -0.222024
+v -1.773936 -10.105862 0.722025
+v -0.657853 -8.458631 2.096182
+v -0.657853 -4.702415 2.096182
+v -0.798072 -8.458631 2.096182
+v -0.798072 -4.702415 2.096182
+v -0.864578 -8.317263 -1.831149
+v -0.864578 -4.843781 -1.831149
+v -1.004797 -8.317263 -1.831149
+v -1.004798 -4.843781 -1.831149
+v 1.349422 -12.739285 0.249998
+v 1.349422 -12.739285 0.249998
+v 1.349422 -12.739285 0.249998
+v 1.349422 -12.739285 0.249998
+v -0.201494 -15.053990 0.250000
+v -0.250001 -15.053990 0.201492
+v -0.250001 -15.053990 0.298507
+v -0.298508 -15.053990 0.250000
+v -0.250001 -15.053990 0.250000
+v -0.225748 -15.790425 0.274253
+v -0.225748 -15.790425 0.274253
+v -0.225748 -15.790425 0.274253
+v -0.225748 -15.790425 0.274253
+v -0.298508 -15.053990 0.225746
+v -0.274255 -15.053990 0.201492
+v -0.274255 -15.053990 0.250000
+v -0.250001 -15.053990 0.225746
+v -0.274255 -15.053990 0.225746
+v -0.286382 -15.394701 0.213619
+v -0.286382 -15.394701 0.213619
+v -0.286382 -15.394701 0.213619
+v -0.286382 -15.394701 0.213619
+vn 0.000000 0.000000 -1.000000
+vn 1.000000 -0.000000 0.000000
+vn 0.000000 -1.000000 0.000000
+vn -0.999991 -0.004249 -0.000000
+vn 0.000000 1.000000 0.000000
+vn -0.998674 0.024926 0.045038
+vn 0.335411 0.039589 -0.941240
+vn -1.000000 0.000000 -0.000000
+vn -0.998674 0.024926 -0.045038
+vn -0.998990 -0.004245 -0.044721
+vn 0.999889 -0.014920 0.000000
+vn 0.000000 0.001731 -0.999999
+vn -0.999889 0.014920 0.000000
+vn 0.000000 -0.035129 0.999383
+vn 0.000000 -0.000000 1.000000
+vn -0.000000 -0.029969 0.999551
+vn 0.999802 -0.019889 0.000000
+vn -0.000000 -0.019889 -0.999802
+vn -0.999802 -0.019889 -0.000000
+vn 0.000000 -0.019889 0.999802
+vn -0.000000 -0.035129 -0.999383
+vn -0.999383 -0.035129 -0.000000
+vn 0.999383 -0.035129 0.000000
+vn 0.000000 0.075924 -0.997114
+vn 0.000000 -0.044530 0.999008
+vn -0.000000 -0.044530 -0.999008
+vn -0.998436 -0.055903 0.000000
+vn 0.998436 -0.055903 0.000000
+vn 0.000000 -1.000000 -0.000001
+vn 0.000000 0.998356 0.057312
+vn -0.000001 0.999734 0.023051
+vn 0.000000 0.000000 0.000000
+vn 0.999123 -0.041869 -0.000000
+vn 0.000000 -0.029968 -0.999551
+vn -0.999123 -0.041869 -0.000000
+vn 0.000000 -0.032916 0.999458
+vn -0.000000 -0.032916 -0.999458
+vn -0.999458 -0.032916 -0.000001
+vn 0.999458 -0.032916 0.000001
+vn 0.000000 -0.035570 0.999367
+vn -0.999367 -0.035570 0.000000
+vn 0.999367 -0.035570 0.000000
+vn -0.000000 -0.035570 -0.999367
+vn -0.999010 0.000000 -0.044479
+vn -0.000003 -1.000000 0.000003
+vn -0.998997 0.004231 0.044576
+vn -0.998995 -0.003629 -0.044686
+vn -0.999802 -0.019889 -0.000003
+vn 0.999383 -0.035129 0.000001
+vn -0.390902 0.032653 -0.919853
+vn -0.039773 0.999209 0.000000
+vn 0.015984 0.999872 -0.000000
+vn 0.685049 0.244087 0.686331
+vn 0.059145 0.991180 -0.118412
+vn 0.004700 0.999969 0.006195
+vn 0.708975 0.236274 -0.664418
+vn 0.986450 0.162694 -0.019990
+vn -0.155461 0.985900 -0.061586
+vn -0.673055 0.265481 0.690268
+vn 0.000000 0.189856 0.981780
+vn -0.577837 0.579791 0.574358
+vn -0.052278 0.989380 -0.135411
+vn 0.002411 0.984436 -0.175573
+vn -0.230628 0.971862 0.047761
+vn 0.000000 0.710410 0.703757
+vn 0.046327 0.986297 0.158208
+vn 0.013459 0.999817 -0.011597
+vn -0.003296 0.965300 0.261055
+vn 0.000000 0.208625 -0.977966
+vn 0.700247 0.713523 -0.021851
+vn -0.036988 0.978668 0.202002
+vn -0.695334 0.263131 -0.668722
+vn 0.033448 0.998444 0.044588
+vn 0.197821 0.978332 -0.060732
+vn 0.332041 0.935545 0.120273
+vn -0.981292 0.191443 -0.019684
+vn -0.700247 0.713523 -0.021851
+vn 0.202765 0.978057 0.047670
+vn 0.027497 0.999359 -0.022462
+vn -0.580096 0.555254 -0.595935
+vn 0.000000 0.681661 -0.731620
+vn 0.000000 0.999512 -0.030610
+vn 0.580126 0.555223 -0.595935
+vn -0.121189 0.990722 0.061281
+vn 0.577837 0.579791 0.574358
+vn -0.000001 -0.216668 0.976245
+vn 0.000000 -0.216669 0.976245
+vn -0.865542 0.000000 0.500837
+vn -0.775353 0.000000 -0.631528
+vn 0.775353 0.000000 0.631528
+vn 0.865542 0.000000 -0.500837
+vn -0.408238 0.912875 0.000000
+vn -0.408238 -0.912875 0.000000
+vn -0.848123 -0.000000 -0.529800
+vn 0.120448 0.992720 0.000000
+vn 0.120446 -0.992720 0.000000
+vn 0.066998 -0.000000 0.997753
+vn -0.768335 0.000000 0.640048
+vn -0.702959 0.009258 0.711170
+vn -0.000000 -0.001662 0.999999
+vn 0.066998 -0.000000 -0.997753
+vn -0.992227 0.124437 0.000000
+vn 0.000000 1.000000 0.000002
+vn -0.897430 -0.000000 -0.441157
+vn -0.999794 -0.020277 -0.000000
+vn -0.897430 0.000000 0.441157
+vn 1.000000 -0.000000 0.000001
+vn 0.000000 -0.626251 -0.779621
+vn 0.815324 0.000000 0.579005
+vn 0.000000 -0.597355 0.801977
+vn -0.000000 0.597355 0.801977
+vn -0.815324 0.000000 -0.579005
+vn -0.902231 0.000000 0.431253
+vn 0.902231 -0.000000 -0.431253
+vn 0.000000 0.626252 -0.779621
+vn -0.999560 -0.029660 -0.000000
+vn -0.640321 0.264668 -0.721069
+vn -0.897429 0.000000 0.441158
+vn -0.998913 0.046607 0.000000
+vn 1.000000 0.000000 -0.000001
+vn 0.000000 0.537704 0.843133
+vn 0.815324 0.000000 -0.579005
+vn 0.000000 0.509017 -0.860756
+vn 0.570707 -0.227002 -0.789154
+vn -0.815324 0.000000 0.579005
+vn -0.902231 -0.000000 -0.431253
+vn 0.902231 0.000000 0.431253
+vn -0.926436 0.376451 0.000000
+vn 0.725968 -0.012023 0.687623
+vn 0.806295 0.363614 -0.466554
+vn 0.939356 0.342943 -0.000000
+vn 0.000000 0.131518 0.991314
+vn 0.727917 0.344409 0.592891
+vn -0.806295 -0.363614 0.466554
+vn -0.727917 -0.344409 -0.592891
+vn -0.939356 -0.342943 -0.000000
+vn 0.000000 0.146820 -0.989163
+vn -0.000000 0.044390 0.999014
+vn -0.000000 -0.027324 -0.999627
+vn 0.821171 -0.570682 0.000000
+vn -0.811149 0.584839 0.000000
+vn -0.932227 -0.361875 0.000000
+vn 0.932227 0.361874 0.000000
+vn -0.000000 -0.509017 -0.860756
+vn 0.000000 -0.537704 0.843133
+vn -0.570707 0.227002 0.789154
+vn 0.000000 -0.006210 0.999981
+vn 0.000000 0.006210 -0.999981
+vn 0.926436 -0.376451 -0.000000
+vn 0.640321 -0.264668 0.721069
+vn -0.990279 0.139093 0.000000
+vn 0.000000 0.668824 0.743421
+vn 0.000000 0.640587 -0.767885
+vn 0.000000 -0.668824 0.743421
+vn -0.000000 -0.640588 -0.767885
+vn -0.998783 -0.049323 -0.000000
+vn -0.995621 -0.093483 0.000000
+vn -0.897429 0.000000 -0.441158
+vn -0.999560 -0.029660 0.000001
+vn 0.993248 -0.116012 -0.000000
+vn 0.785650 0.339984 -0.516880
+vn 0.690291 0.311562 0.653015
+vn -0.785650 -0.339984 0.516880
+vn -0.690291 -0.311562 -0.653014
+vn 0.821171 -0.570682 -0.000001
+vn -0.811149 0.584839 0.000001
+vn 0.932227 0.361875 -0.000000
+vn 0.000000 -0.509018 -0.860756
+vn 0.640320 -0.264668 0.721069
+vn 0.000000 0.668823 0.743421
+vn 0.000000 -0.668824 0.743420
+vn -0.998783 -0.049323 0.000001
+vn -0.993011 0.116581 0.017396
+vn -0.718863 0.122654 0.684194
+vn -0.995025 0.099094 -0.008240
+vn -0.994720 0.100803 0.018677
+vn -0.008240 0.095920 -0.995331
+vn -0.695456 0.163335 -0.699728
+vn 0.000000 0.076083 -0.997070
+vn 0.008606 0.094729 -0.995453
+vn 0.696188 0.131596 -0.705679
+vn 0.723869 0.078982 0.685354
+vn 0.008759 0.047273 0.998840
+vn -0.019105 0.070467 0.997314
+vn 0.998871 0.046632 -0.007935
+vn 0.998810 0.044557 0.018464
+vn 0.000000 0.028047 0.999603
+vn 0.997681 0.066042 0.016205
+vn 0.705949 -0.000000 0.708263
+vn 0.713103 -0.000000 0.701059
+vn -0.692371 0.002932 0.721536
+vn 0.000000 -0.002774 0.999996
+vn 0.714789 -0.001940 0.699337
+vn -1.000000 0.000001 -0.000000
+vn -0.713103 0.000000 0.701059
+vn 0.988698 -0.085371 0.123242
+vn -0.700193 -0.002544 0.713949
+vn 0.988698 -0.085371 -0.123241
+vn -0.006916 0.999976 -0.000000
+vn -0.017668 -0.624491 0.780832
+vn -0.714789 -0.001940 0.699337
+vn -1.000000 0.000000 -0.000001
+vn 0.999920 0.012665 0.000000
+vn 0.992320 -0.000000 0.123694
+vn -0.690050 0.000000 0.723762
+vn -0.170662 -0.970437 -0.170662
+vn 0.000000 -0.987400 0.158243
+vn 0.000000 -0.987400 -0.158243
+vn -0.170662 -0.970437 0.170662
+vn 0.992320 -0.000000 -0.123693
+vn -0.538141 -0.842855 0.000000
+usemtl Material
+s off
+f 61//1 19//1 30//1
+f 67//1 37//1 21//1
+f 68//1 38//1 39//1
+f 69//1 28//1 40//1
+f 73//2 45//2 29//2
+f 74//2 46//2 15//2
+f 76//3 49//3 9//3
+f 80//4 54//4 16//4
+f 61//3 30//3 120//3
+f 40//1 6//1 61//1
+f 46//5 75//5 98//5
+f 7//1 45//1 94//1
+f 49//3 64//3 9//3
+f 16//6 56//6 53//6
+f 39//1 13//1 67//1
+f 26//1 5//1 68//1
+f 5//7 117//7 121//7
+f 18//1 1//1 69//1
+f 18//2 73//2 1//2
+f 5//2 47//2 18//2
+f 47//2 15//2 73//2
+f 26//2 74//2 5//2
+f 45//1 15//1 97//1
+f 106//3 104//3 103//3
+f 8//8 55//8 21//8
+f 55//9 16//9 53//9
+f 30//8 80//8 8//8
+f 30//8 31//8 80//8
+f 31//8 9//8 80//8
+f 54//10 81//10 16//10
+f 9//8 22//8 54//8
+f 75//11 46//11 223//11
+f 39//12 67//12 183//12
+f 79//13 53//13 180//13
+f 53//13 65//13 216//13
+f 67//12 21//12 218//12
+f 21//13 79//13 224//13
+f 89//14 90//14 113//14
+f 100//15 96//15 129//15
+f 95//2 99//2 97//2
+f 96//16 20//16 283//16
+f 48//15 63//15 99//15
+f 15//1 46//1 95//1
+f 75//15 48//15 101//15
+f 63//15 20//15 100//15
+f 102//17 106//17 108//17
+f 19//3 105//3 102//3
+f 105//3 76//3 106//3
+f 108//3 110//3 109//3
+f 2//18 102//18 107//18
+f 103//19 2//19 109//19
+f 106//20 103//20 110//20
+f 288//3 114//3 289//3
+f 86//21 85//21 112//21
+f 90//22 86//22 114//22
+f 85//23 89//23 111//23
+f 13//24 119//24 37//24
+f 40//3 61//3 119//3
+f 69//25 40//25 123//25
+f 38//24 121//24 13//24
+f 18//3 69//3 121//3
+f 37//24 120//24 8//24
+f 30//8 8//8 118//8
+f 5//2 18//2 117//2
+f 123//3 122//3 125//3
+f 119//26 121//26 124//26
+f 40//27 119//27 122//27
+f 121//28 69//28 125//28
+f 96//29 94//29 127//29
+f 97//5 100//5 128//5
+f 94//1 97//1 126//1
+f 149//1 147//1 153//1
+f 81//30 54//30 147//30
+f 16//31 148//31 56//31
+f 147//5 146//5 151//5
+f 148//3 149//3 152//3
+f 146//15 148//15 150//15
+f 56//1 81//1 149//1
+f 54//15 16//15 146//15
+f 46//11 74//11 181//11
+f 26//12 68//12 189//12
+f 74//11 26//11 222//11
+f 68//12 39//12 219//12
+f 283//32 282//32 284//32
+f 94//33 96//33 285//33
+f 7//34 94//34 284//34
+f 20//35 7//35 282//35
+f 299//3 297//3 295//3
+f 111//3 286//3 287//3
+f 113//36 288//36 293//36
+f 292//32 291//32 293//32
+f 290//37 286//37 292//37
+f 288//38 290//38 294//38
+f 286//39 113//39 291//39
+f 299//40 295//40 301//40
+f 287//3 298//3 296//3
+f 298//3 290//3 299//3
+f 302//32 303//32 301//32
+f 295//41 112//41 300//41
+f 296//42 299//42 303//42
+f 112//43 296//43 302//43
+f 19//1 102//1 30//1
+f 102//1 2//1 30//1
+f 37//1 8//1 21//1
+f 38//1 13//1 39//1
+f 28//1 6//1 40//1
+f 45//2 7//2 29//2
+f 47//2 74//2 15//2
+f 104//3 76//3 9//3
+f 31//3 104//3 9//3
+f 55//44 80//44 16//44
+f 30//3 118//3 120//3
+f 6//1 19//1 61//1
+f 75//5 101//5 98//5
+f 45//1 97//1 94//1
+f 64//45 22//45 9//45
+f 56//8 65//8 53//8
+f 13//1 37//1 67//1
+f 5//1 38//1 68//1
+f 38//24 5//24 121//24
+f 1//1 28//1 69//1
+f 73//2 29//2 1//2
+f 47//2 73//2 18//2
+f 15//2 45//2 73//2
+f 74//2 47//2 5//2
+f 15//1 95//1 97//1
+f 104//3 31//3 103//3
+f 55//8 79//8 21//8
+f 79//8 55//8 53//8
+f 80//8 55//8 8//8
+f 2//8 103//8 30//8
+f 103//8 31//8 30//8
+f 9//8 54//8 80//8
+f 81//46 56//46 16//46
+f 22//47 81//47 54//47
+f 46//11 181//11 223//11
+f 67//12 218//12 183//12
+f 224//13 79//13 180//13
+f 180//13 53//13 216//13
+f 21//12 193//12 218//12
+f 193//13 21//13 224//13
+f 90//14 114//14 288//14
+f 113//14 90//14 288//14
+f 96//15 127//15 129//15
+f 99//2 100//2 97//2
+f 285//32 96//32 283//32
+f 63//15 100//15 99//15
+f 46//1 98//1 95//1
+f 48//15 99//15 101//15
+f 20//15 96//15 100//15
+f 106//17 110//17 108//17
+f 105//3 106//3 102//3
+f 76//3 104//3 106//3
+f 107//3 108//3 109//3
+f 102//18 108//18 107//18
+f 2//48 107//48 109//48
+f 103//20 109//20 110//20
+f 290//3 288//3 297//3
+f 288//3 289//3 297//3
+f 85//21 111//21 287//21
+f 112//21 85//21 296//21
+f 85//21 287//21 296//21
+f 114//22 86//22 289//22
+f 86//22 112//22 295//22
+f 289//22 86//22 295//22
+f 89//49 113//49 286//49
+f 111//49 89//49 286//49
+f 119//24 120//24 37//24
+f 61//3 120//3 119//3
+f 40//25 122//25 123//25
+f 121//24 119//24 13//24
+f 117//3 18//3 121//3
+f 120//50 118//50 8//50
+f 122//3 124//3 125//3
+f 121//26 125//26 124//26
+f 119//27 124//27 122//27
+f 69//28 123//28 125//28
+f 94//29 126//29 127//29
+f 100//5 129//5 128//5
+f 97//1 128//1 126//1
+f 147//1 151//1 153//1
+f 54//51 146//51 147//51
+f 148//52 149//52 56//52
+f 146//5 150//5 151//5
+f 149//3 153//3 152//3
+f 148//15 152//15 150//15
+f 81//1 147//1 149//1
+f 16//15 148//15 146//15
+f 74//11 222//11 181//11
+f 68//12 219//12 189//12
+f 26//11 189//11 222//11
+f 39//12 183//12 219//12
+f 285//32 283//32 284//32
+f 284//32 94//32 285//32
+f 282//32 7//32 284//32
+f 283//32 20//32 282//32
+f 297//3 289//3 295//3
+f 286//3 290//3 298//3
+f 287//3 286//3 298//3
+f 291//32 113//32 293//32
+f 294//32 292//32 293//32
+f 294//32 290//32 292//32
+f 293//32 288//32 294//32
+f 292//32 286//32 291//32
+f 303//32 299//32 301//32
+f 298//3 299//3 296//3
+f 290//3 297//3 299//3
+f 300//32 302//32 301//32
+f 301//32 295//32 300//32
+f 302//32 296//32 303//32
+f 300//32 112//32 302//32
+s 1
+f 217//53 195//54 202//55
+f 225//56 212//57 192//58
+f 227//59 215//60 228//61
+f 227//59 188//62 199//63
+f 212//57 217//53 197//64
+f 215//60 217//53 232//65
+f 215//60 199//63 217//53
+f 191//66 225//56 200//67
+f 196//68 214//69 225//56
+f 212//57 225//56 235//70
+f 184//71 226//72 196//68
+f 201//73 194//74 226//72
+f 194//74 198//75 213//76
+f 213//76 227//59 234//77
+f 198//75 187//78 227//59
+f 187//78 17//79 227//59
+f 229//80 234//77 233//81
+f 236//82 232//65 235//70
+f 233//81 236//82 230//83
+f 234//77 228//61 236//82
+f 225//56 214//69 230//83
+f 214//69 226//72 229//80
+f 226//72 213//76 234//77
+f 217//53 212//57 235//70
+f 186//84 217//53 202//55
+f 212//57 197//64 192//58
+f 215//60 232//65 228//61
+f 215//60 227//59 199//63
+f 217//53 186//84 197//64
+f 217//53 231//85 232//65
+f 199//63 195//54 217//53
+f 225//56 192//58 200//67
+f 191//66 196//68 225//56
+f 225//56 230//83 235//70
+f 226//72 214//69 196//68
+f 184//71 201//73 226//72
+f 226//72 194//74 213//76
+f 227//59 228//61 234//77
+f 213//76 198//75 227//59
+f 17//79 188//62 227//59
+f 234//77 236//82 233//81
+f 232//65 231//85 235//70
+f 236//82 235//70 230//83
+f 228//61 232//65 236//82
+f 214//69 233//81 230//83
+f 233//81 214//69 229//80
+f 229//80 226//72 234//77
+f 231//85 217//53 235//70
+usemtl Material.001
+s off
+f 64//86 24//86 22//86
+f 78//87 35//87 11//87
+f 204//88 205//88 32//88
+f 207//89 58//89 244//89
+f 52//87 11//87 64//87
+f 203//2 83//2 258//2
+f 32//1 27//1 34//1
+f 58//15 66//15 239//15
+f 207//89 206//89 58//89
+f 83//90 82//90 60//90
+f 58//15 59//15 66//15
+f 84//91 203//91 57//91
+f 32//1 34//1 253//1
+f 27//88 205//88 237//88
+f 84//2 82//2 203//2
+f 210//92 208//92 205//92
+f 209//93 211//93 204//93
+f 211//94 210//94 204//94
+f 34//91 203//91 254//91
+f 98//95 101//95 210//95
+f 99//96 95//96 209//96
+f 20//87 3//87 35//87
+f 101//97 99//97 209//97
+f 208//98 209//98 207//98
+f 65//99 25//99 216//99
+f 42//100 71//100 220//100
+f 95//101 98//101 211//101
+f 128//102 129//102 132//102
+f 132//103 133//103 136//103
+f 126//104 128//104 130//104
+f 127//105 126//105 131//105
+f 129//106 127//106 131//106
+f 136//107 137//107 134//107
+f 134//108 130//108 142//108
+f 131//3 130//3 135//3
+f 135//109 137//109 140//109
+f 139//15 269//15 141//15
+f 131//110 135//110 138//110
+f 137//111 133//111 139//111
+f 139//112 133//112 269//112
+f 142//1 143//1 144//1
+f 130//113 132//113 142//113
+f 136//114 134//114 145//114
+f 132//115 136//115 143//115
+f 152//116 153//116 156//116
+f 167//117 156//117 261//117
+f 150//118 152//118 156//118
+f 151//119 150//119 155//119
+f 153//104 151//104 157//104
+f 160//120 161//120 158//120
+f 158//121 154//121 166//121
+f 159//1 155//1 177//1
+f 159//122 161//122 164//122
+f 163//1 162//1 165//1
+f 155//123 159//123 162//123
+f 165//124 161//124 264//124
+f 157//125 155//125 163//125
+f 166//15 167//15 168//15
+f 154//126 156//126 166//126
+f 160//127 158//127 169//127
+f 156//128 157//128 262//128
+f 71//100 33//100 185//100
+f 25//100 72//100 190//100
+f 33//129 75//129 223//129
+f 72//100 42//100 221//100
+f 242//130 238//130 246//130
+f 241//131 242//131 249//131
+f 239//132 240//132 247//132
+f 82//2 84//2 241//2
+f 84//91 57//91 242//91
+f 205//8 207//8 243//8
+f 66//90 82//90 240//90
+f 57//1 27//1 238//1
+f 251//5 250//5 245//5
+f 249//5 252//5 247//5
+f 251//5 252//5 250//5
+f 240//133 241//133 248//133
+f 237//134 243//134 245//134
+f 244//135 239//135 247//135
+f 243//136 244//136 252//136
+f 238//137 237//137 245//137
+f 258//3 259//3 253//3
+f 260//3 257//3 255//3
+f 59//89 206//89 255//89
+f 60//15 59//15 256//15
+f 206//8 204//8 260//8
+f 83//90 60//90 257//90
+f 204//88 32//88 259//88
+f 257//138 260//138 133//138
+f 259//139 258//139 132//139
+f 258//140 257//140 137//140
+f 260//141 259//141 133//141
+f 155//142 154//142 177//142
+f 154//15 158//15 176//15
+f 158//143 159//143 178//143
+f 261//3 262//3 263//3
+f 264//144 262//144 265//144
+f 261//145 263//145 267//145
+f 157//146 163//146 262//146
+f 169//147 167//147 267//147
+f 163//148 165//148 265//148
+f 161//149 160//149 264//149
+f 160//150 169//150 263//150
+f 178//120 179//120 272//120
+f 173//151 172//151 271//151
+f 176//3 177//3 178//3
+f 270//126 176//126 279//126
+f 272//152 270//152 278//152
+f 271//5 270//5 273//5
+f 275//1 274//1 277//1
+f 271//153 273//153 274//153
+f 178//127 272//127 281//127
+f 176//154 178//154 279//154
+f 278//15 279//15 280//15
+f 177//125 271//125 275//125
+f 175//104 173//104 177//104
+f 273//122 179//122 276//122
+f 179//155 177//155 275//155
+f 172//118 174//118 176//118
+f 174//156 175//156 176//156
+f 24//87 4//87 22//87
+f 52//87 78//87 11//87
+f 205//88 27//88 32//88
+f 58//89 239//89 244//89
+f 11//86 24//86 64//86
+f 83//2 257//2 258//2
+f 27//1 57//1 34//1
+f 66//15 240//15 239//15
+f 206//89 59//89 58//89
+f 82//90 66//90 60//90
+f 59//15 60//15 66//15
+f 203//91 34//91 57//91
+f 34//1 254//1 253//1
+f 205//88 243//88 237//88
+f 82//2 83//2 203//2
+f 208//92 207//92 205//92
+f 206//93 209//93 204//93
+f 210//94 205//94 204//94
+f 203//91 258//91 254//91
+f 101//95 208//95 210//95
+f 95//96 211//96 209//96
+f 78//87 20//87 35//87
+f 208//97 101//97 209//97
+f 209//98 206//98 207//98
+f 25//157 190//157 216//157
+f 182//100 42//100 220//100
+f 98//101 210//101 211//101
+f 129//102 133//102 132//102
+f 133//103 137//103 136//103
+f 128//158 132//158 130//158
+f 126//105 130//105 131//105
+f 133//106 129//106 131//106
+f 137//2 135//2 134//2
+f 144//108 134//108 142//108
+f 130//3 134//3 135//3
+f 137//109 141//109 140//109
+f 269//15 138//15 141//15
+f 138//15 140//15 141//15
+f 135//110 140//110 138//110
+f 141//111 137//111 139//111
+f 133//112 131//112 138//112
+f 269//112 133//112 138//112
+f 143//1 145//1 144//1
+f 132//113 143//113 142//113
+f 134//114 144//114 145//114
+f 136//115 145//115 143//115
+f 153//159 157//159 156//159
+f 267//117 167//117 261//117
+f 154//106 150//106 156//106
+f 150//119 154//119 155//119
+f 151//104 155//104 157//104
+f 161//2 159//2 158//2
+f 168//121 158//121 166//121
+f 179//1 159//1 177//1
+f 161//122 165//122 164//122
+f 162//1 164//1 165//1
+f 159//123 164//123 162//123
+f 266//124 165//124 264//124
+f 155//125 162//125 163//125
+f 167//15 169//15 168//15
+f 156//126 167//126 166//126
+f 158//127 168//127 169//127
+f 261//128 156//128 262//128
+f 220//100 71//100 185//100
+f 72//100 221//100 190//100
+f 185//160 33//160 223//160
+f 42//100 182//100 221//100
+f 250//161 242//161 246//161
+f 242//131 250//131 249//131
+f 240//132 248//132 247//132
+f 84//2 242//2 241//2
+f 57//91 238//91 242//91
+f 207//8 244//8 243//8
+f 82//90 241//90 240//90
+f 27//1 237//1 238//1
+f 250//5 246//5 245//5
+f 248//5 249//5 247//5
+f 252//5 249//5 250//5
+f 241//162 249//162 248//162
+f 243//163 251//163 245//163
+f 252//164 244//164 247//164
+f 251//136 243//136 252//136
+f 246//137 238//137 245//137
+f 254//3 258//3 253//3
+f 257//3 256//3 255//3
+f 206//89 260//89 255//89
+f 59//15 255//15 256//15
+f 204//8 259//8 260//8
+f 60//90 256//90 257//90
+f 32//88 253//88 259//88
+f 137//138 257//138 133//138
+f 258//139 136//139 132//139
+f 136//165 258//165 137//165
+f 259//166 132//166 133//166
+f 154//142 176//142 177//142
+f 158//15 178//15 176//15
+f 159//167 179//167 178//167
+f 262//3 264//3 263//3
+f 266//168 264//168 265//168
+f 263//145 268//145 267//145
+f 163//146 265//146 262//146
+f 268//147 169//147 267//147
+f 165//148 266//148 265//148
+f 160//149 263//149 264//149
+f 169//169 268//169 263//169
+f 179//2 273//2 272//2
+f 172//151 270//151 271//151
+f 177//3 179//3 178//3
+f 278//126 270//126 279//126
+f 280//170 272//170 278//170
+f 270//5 272//5 273//5
+f 274//1 276//1 277//1
+f 273//153 276//153 274//153
+f 272//127 280//127 281//127
+f 178//171 281//171 279//171
+f 279//15 281//15 280//15
+f 271//125 274//125 275//125
+f 173//104 271//104 177//104
+f 179//122 277//122 276//122
+f 277//155 179//155 275//155
+f 270//106 172//106 176//106
+f 175//172 177//172 176//172
+usemtl Material.002
+s 1
+f 216//173 190//174 192//58
+f 224//175 180//176 197//64
+f 180//176 216//173 192//58
+f 195//54 218//177 193//178
+f 199//63 183//179 218//177
+f 188//62 219//180 199//63
+f 17//79 189//181 188//62
+f 201//73 184//71 185//182
+f 184//71 196//68 220//183
+f 196//68 191//66 221//184
+f 191//66 200//67 190//174
+f 17//79 187//78 189//181
+f 187//78 198//75 222//185
+f 198//75 194//74 181//186
+f 194//74 201//73 185//182
+f 193//178 224//175 186//84
+f 190//174 200//67 192//58
+f 186//84 224//175 197//64
+f 197//64 180//176 192//58
+f 202//55 195//54 193//178
+f 195//54 199//63 218//177
+f 219//180 183//179 199//63
+f 189//181 219//180 188//62
+f 184//71 220//183 185//182
+f 196//68 182//187 220//183
+f 182//187 196//68 221//184
+f 221//184 191//66 190//174
+f 187//78 222//185 189//181
+f 198//75 181//186 222//185
+f 194//74 223//188 181//186
+f 223//188 194//74 185//182
+f 202//55 193//178 186//84
+usemtl Material.003
+s off
+f 62//15 36//15 24//15
+f 63//189 23//189 20//189
+f 70//15 41//15 35//15
+f 71//15 42//15 43//15
+f 72//15 25//15 44//15
+f 75//190 33//190 10//190
+f 78//15 52//15 93//15
+f 81//191 36//191 56//191
+f 41//15 62//15 11//15
+f 14//192 44//192 41//192
+f 44//192 12//192 62//192
+f 48//193 10//193 23//193
+f 64//194 49//194 171//194
+f 56//195 12//195 65//195
+f 23//15 70//15 3//15
+f 10//192 43//192 23//192
+f 43//192 14//192 70//192
+f 33//15 71//15 10//15
+f 42//15 72//15 14//15
+f 6//3 51//3 19//3
+f 86//15 170//15 174//15
+f 28//3 77//3 6//3
+f 1//3 29//3 28//3
+f 29//3 7//3 77//3
+f 87//196 93//196 116//196
+f 7//3 20//3 50//3
+f 22//197 4//197 81//197
+f 88//3 92//3 85//3
+f 88//3 85//3 91//3
+f 85//3 93//3 89//3
+f 76//1 51//1 91//1
+f 49//8 76//8 170//8
+f 51//1 77//1 88//1
+f 92//198 87//198 115//198
+f 90//199 86//199 173//199
+f 170//200 171//200 175//200
+f 171//1 90//1 175//1
+f 52//15 64//15 171//15
+f 36//15 4//15 24//15
+f 23//189 3//189 20//189
+f 41//15 11//15 35//15
+f 42//15 14//15 43//15
+f 25//15 12//15 44//15
+f 48//190 75//190 10//190
+f 52//15 89//15 93//15
+f 36//201 12//201 56//201
+f 62//15 24//15 11//15
+f 44//192 62//192 41//192
+f 12//192 36//192 62//192
+f 63//189 48//189 23//189
+f 49//202 170//202 171//202
+f 170//8 86//8 171//8
+f 86//8 90//8 171//8
+f 12//195 25//195 65//195
+f 70//15 35//15 3//15
+f 43//192 70//192 23//192
+f 14//192 41//192 70//192
+f 71//15 43//15 10//15
+f 72//15 44//15 14//15
+f 51//3 76//3 105//3
+f 19//3 51//3 105//3
+f 172//15 86//15 174//15
+f 77//3 51//3 6//3
+f 29//3 77//3 28//3
+f 7//3 50//3 77//3
+f 50//203 78//203 87//203
+f 78//204 93//204 87//204
+f 20//3 78//3 50//3
+f 4//205 36//205 81//205
+f 92//206 115//206 85//206
+f 115//207 87//207 85//207
+f 85//3 86//3 91//3
+f 87//208 116//208 85//208
+f 116//209 93//209 85//209
+f 51//1 88//1 91//1
+f 76//8 91//8 86//8
+f 170//202 76//202 86//202
+f 77//1 92//1 88//1
+f 77//203 50//203 87//203
+f 92//210 77//210 87//210
+f 86//199 172//199 173//199
+f 174//211 170//211 175//211
+f 90//1 173//1 175//1
+f 89//15 52//15 90//15
+f 52//15 171//15 90//15
diff --git a/objects/material/frigate_industrial.mtl b/objects/material/frigate_industrial.mtl
new file mode 100644
index 0000000..e0cea3c
--- /dev/null
+++ b/objects/material/frigate_industrial.mtl
@@ -0,0 +1,41 @@
+# Blender MTL File: 'frigate_industrial.blend'
+# Material Count: 4
+
+newmtl Material
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.722474 0.722474 0.722474
+Ks 0.314433 0.314433 0.314433
+Ni 1.000000
+d 1.000000
+illum 2
+map_Kd textures/metal.bmp
+
+newmtl Material.001
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+map_Kd textures/metal.bmp
+
+newmtl Material.002
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Material.003
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
+map_Kd textures/windows.bmp
diff --git a/objects/material/probe.mtl b/objects/material/probe.mtl
new file mode 100644
index 0000000..8ce4b82
--- /dev/null
+++ b/objects/material/probe.mtl
@@ -0,0 +1,11 @@
+# Blender MTL File: 'None'
+# Material Count: 1
+
+newmtl Material
+Ns 96.078431
+Ka 0.000000 0.000000 0.000000
+Kd 0.640000 0.640000 0.640000
+Ks 0.500000 0.500000 0.500000
+Ni 1.000000
+d 1.000000
+illum 2
diff --git a/objects/probe.obj b/objects/probe.obj
new file mode 100644
index 0000000..53a738b
--- /dev/null
+++ b/objects/probe.obj
@@ -0,0 +1,187 @@
+# Blender v2.69 (sub 0) OBJ File: ''
+# www.blender.org
+mtllib probe.mtl
+o Cube
+v 1.000000 -1.000000 -1.000000
+v 1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 1.000000
+v -1.000000 -1.000000 -1.000000
+v 1.000000 1.000000 -0.999999
+v 0.999999 1.000000 1.000001
+v -1.000000 1.000000 1.000000
+v -1.000000 1.000000 -1.000000
+v 1.000000 -1.000000 0.000000
+v 0.000000 -1.000000 -1.000000
+v 1.000000 0.000000 -1.000000
+v 0.000000 -1.000000 1.000000
+v 1.000000 0.000000 1.000000
+v -1.000000 -1.000000 -0.000000
+v -1.000000 0.000000 1.000000
+v -1.000000 0.000000 -1.000000
+v 1.000000 1.000000 0.000001
+v 0.000000 1.000000 -1.000000
+v -0.000001 1.000000 1.000000
+v -1.000000 1.000000 -0.000000
+v 0.000000 -1.000000 -0.000000
+v -0.000000 1.000000 0.000000
+v 1.000000 0.000000 0.000000
+v -0.000000 0.000000 1.000000
+v -1.000000 0.000000 -0.000000
+v 0.000000 0.000000 -1.000000
+v 3.264206 0.500000 0.500001
+v 3.264206 0.500000 0.500001
+v 3.264206 0.502325 0.500001
+v 2.141050 0.500000 0.500001
+v 0.500000 -0.500000 2.796476
+v 0.499999 -0.500000 2.796476
+v 0.499999 -0.500000 2.796476
+v 0.499999 -0.500000 2.796476
+v -0.500000 -2.098940 0.500000
+v -0.500000 -2.098940 0.500000
+v -0.500000 -2.098940 0.500000
+v -0.500000 -2.098940 0.500000
+v -2.201032 0.500000 -0.500000
+v -2.201032 0.500000 -0.500000
+v -2.201032 0.500000 -0.500000
+v -2.201032 0.500000 -0.500000
+v -0.499999 -0.500000 -2.400411
+v -0.499999 -0.500000 -2.400411
+v -0.499999 -0.500000 -2.400411
+v -0.499999 -0.500000 -2.400411
+v -0.500000 1.920522 0.500000
+v -0.500000 1.920522 0.500000
+v -0.500000 1.920522 0.500000
+v -0.500000 1.920522 0.500000
+vn 0.910216 -0.414134 0.000000
+vn 0.000000 0.477304 -0.878738
+vn 0.401352 0.000000 -0.915924
+vn -0.000000 -0.000000 1.000000
+vn -0.384334 -0.000000 0.923194
+vn 0.941773 -0.000000 -0.336249
+vn 0.000000 -1.000000 0.000000
+vn 0.000000 1.000000 -0.000000
+vn 1.000000 0.000000 0.000000
+vn -0.963382 -0.000000 0.268131
+vn -1.000000 -0.000000 -0.000000
+vn 0.000000 0.000000 -1.000000
+vn 0.401352 -0.915924 0.000000
+vn 0.214676 0.976685 0.000000
+vn 0.215633 -0.000000 0.976475
+vn -0.000000 0.963382 0.268131
+vn 0.963382 0.000000 0.268131
+vn 0.000000 -0.963382 0.268131
+vn 0.000000 -0.414134 -0.910216
+vn -0.910216 -0.414134 -0.000000
+vn -0.000000 -0.414134 0.910216
+vn -0.384334 -0.923194 -0.000000
+vn -0.384334 0.923194 -0.000000
+vn -0.384333 0.000000 -0.923194
+vn 0.000000 0.941773 -0.336249
+vn -0.941773 0.000000 -0.336249
+vn 0.000000 -0.941773 -0.336249
+vn 0.878738 0.477304 0.000000
+vn -0.878738 0.477304 -0.000000
+vn -0.000000 0.477304 0.878738
+vn 0.001460 -0.705438 -0.708770
+vn 1.000000 -0.000000 0.000001
+vn 0.000000 -0.707106 -0.707107
+vn 0.215638 0.000000 0.976473
+vn 0.000000 0.242536 0.970143
+usemtl Material
+s off
+f 21//1 12//1 38//1
+f 22//2 20//2 50//2
+f 23//3 17//3 30//3
+f 24//4 19//4 15//4
+f 25//5 20//5 41//5
+f 26//6 10//6 44//6
+f 10//7 21//7 4//7
+f 1//7 9//7 10//7
+f 9//7 2//7 21//7
+f 17//8 22//8 6//8
+f 5//8 18//8 17//8
+f 18//8 8//8 22//8
+f 9//9 23//9 2//9
+f 1//9 11//9 9//9
+f 11//9 5//9 23//9
+f 12//4 24//4 3//4
+f 24//10 12//10 32//10
+f 13//4 6//4 24//4
+f 14//11 25//11 4//11
+f 3//11 15//11 14//11
+f 15//11 7//11 25//11
+f 18//12 26//12 8//12
+f 5//12 11//12 18//12
+f 11//12 1//12 26//12
+f 30//12 29//12 28//12
+f 13//13 23//13 30//13
+f 17//14 6//14 29//14
+f 6//15 13//15 28//15
+f 31//4 33//4 32//4
+f 13//16 24//16 34//16
+f 2//17 13//17 33//17
+f 12//18 2//18 32//18
+f 38//4 36//4 37//4
+f 14//19 21//19 38//19
+f 3//20 14//20 37//20
+f 12//21 3//21 35//21
+f 42//4 41//4 40//4
+f 16//22 25//22 42//22
+f 20//23 8//23 39//23
+f 8//24 16//24 40//24
+f 46//4 44//4 45//4
+f 16//25 26//25 46//25
+f 4//26 16//26 45//26
+f 10//27 4//27 43//27
+f 50//4 49//4 48//4
+f 19//28 22//28 50//28
+f 20//29 7//29 47//29
+f 7//30 19//30 48//30
+f 12//7 36//7 38//7
+f 20//2 49//2 50//2
+f 17//31 29//31 30//31
+f 19//4 7//4 15//4
+f 42//4 25//4 41//4
+f 46//4 26//4 44//4
+f 21//7 14//7 4//7
+f 9//7 21//7 10//7
+f 2//7 12//7 21//7
+f 22//8 19//8 6//8
+f 18//8 22//8 17//8
+f 8//8 20//8 22//8
+f 23//9 13//9 2//9
+f 11//9 23//9 9//9
+f 5//32 17//32 23//32
+f 24//4 15//4 3//4
+f 34//4 24//4 32//4
+f 6//4 19//4 24//4
+f 25//11 16//11 4//11
+f 15//11 25//11 14//11
+f 7//11 20//11 25//11
+f 26//12 16//12 8//12
+f 11//12 26//12 18//12
+f 1//12 10//12 26//12
+f 29//4 27//4 28//4
+f 28//33 13//33 30//33
+f 6//34 27//34 29//34
+f 27//4 6//4 28//4
+f 33//4 34//4 32//4
+f 33//4 13//4 34//4
+f 31//4 2//4 33//4
+f 2//12 31//12 32//12
+f 36//4 35//4 37//4
+f 37//9 14//9 38//9
+f 35//7 3//7 37//7
+f 36//8 12//8 35//8
+f 41//4 39//4 40//4
+f 40//4 16//4 42//4
+f 41//4 20//4 39//4
+f 39//4 8//4 40//4
+f 44//4 43//4 45//4
+f 45//4 16//4 46//4
+f 43//4 4//4 45//4
+f 44//4 10//4 43//4
+f 49//4 47//4 48//4
+f 48//35 19//35 50//35
+f 49//4 20//4 47//4
+f 47//4 7//4 48//4
diff --git a/objects/textures/crate.bmp b/objects/textures/crate.bmp
new file mode 100644
index 0000000..652ff7e
--- /dev/null
+++ b/objects/textures/crate.bmp
Binary files differ
diff --git a/objects/textures/earth.bmp b/objects/textures/earth.bmp
new file mode 100644
index 0000000..3985db0
--- /dev/null
+++ b/objects/textures/earth.bmp
Binary files differ
diff --git a/objects/textures/leaf.bmp b/objects/textures/leaf.bmp
new file mode 100644
index 0000000..ef666a4
--- /dev/null
+++ b/objects/textures/leaf.bmp
Binary files differ
diff --git a/objects/textures/metal.bmp b/objects/textures/metal.bmp
new file mode 100644
index 0000000..48a3b2e
--- /dev/null
+++ b/objects/textures/metal.bmp
Binary files differ
diff --git a/objects/textures/star.bmp b/objects/textures/star.bmp
new file mode 100644
index 0000000..297d8fb
--- /dev/null
+++ b/objects/textures/star.bmp
Binary files differ
diff --git a/objects/textures/stars.bmp b/objects/textures/stars.bmp
new file mode 100644
index 0000000..352ab57
--- /dev/null
+++ b/objects/textures/stars.bmp
Binary files differ
diff --git a/objects/textures/windows.bmp b/objects/textures/windows.bmp
new file mode 100644
index 0000000..3426951
--- /dev/null
+++ b/objects/textures/windows.bmp
Binary files differ
diff --git a/sons_of_sol/ControlMotionEvent.hpp b/sons_of_sol/ControlMotionEvent.hpp
new file mode 100644
index 0000000..5a93a69
--- /dev/null
+++ b/sons_of_sol/ControlMotionEvent.hpp
@@ -0,0 +1,65 @@
+#ifndef CONTROLMOTIONEVENT_HPP_
+#define CONTROLMOTIONEVENT_HPP_
+
+/*
+ * Author: jrahm
+ * created: 2013/11/01
+ * ControlMotionEvent.hpp: <description>
+ */
+
+/* This is the class used to
+ * signal an event from the controller.
+ *
+ * These values have been normalized */
+class ControlMotionEvent {
+public:
+ enum MotionEventType {
+ NONE
+ , PITCH
+ , ROLL
+ , YAW
+ , THROTTLE
+ , STRAFE_SIDE
+ , STRAFE_UP
+ , FIRE_PRIMARY
+ };
+
+ enum MotionOrigin {
+ JOYSTICK,
+ MOUSE,
+ BUTTON
+ };
+
+ ControlMotionEvent( MotionEventType type, double mag, MotionOrigin origin ) :
+ mag( mag ), type( type ), origin( origin ) {}
+
+ inline double getMagnitude() const {
+ return mag;
+ }
+
+ inline MotionEventType getType() const {
+ return type;
+ }
+
+ inline MotionOrigin getOrigin() const {
+ return origin;
+ }
+
+ inline void setMagnitude( double mag ) {
+ this->mag = mag;
+ }
+
+ inline void setType( MotionEventType type ) {
+ this->type = type;
+ }
+
+ inline void setOrigin( MotionOrigin origin ) {
+ this->origin = origin;
+ }
+private:
+ double mag;
+ MotionEventType type;
+ MotionOrigin origin;
+};
+
+#endif /* CONTROLMOTIONEVENT_HPP_ */
diff --git a/sons_of_sol/ControlMotionListener.hpp b/sons_of_sol/ControlMotionListener.hpp
new file mode 100644
index 0000000..8269ebe
--- /dev/null
+++ b/sons_of_sol/ControlMotionListener.hpp
@@ -0,0 +1,20 @@
+#ifndef CONTROLMOTIONLISTENER_HPP_
+#define CONTROLMOTIONLISTENER_HPP_
+
+/*
+ * Author: jrahm
+ * created: 2013/11/01
+ * ControlMotionListener.hpp: <description>
+ */
+
+#include "sons_of_sol/ControlMotionEvent.hpp"
+
+class ControlMotionListener {
+public:
+ /* Called once there is a control motion */
+ virtual inline void onControlMotion( const ControlMotionEvent& event ) {
+ (void) event;
+ }
+};
+
+#endif /* CONTROLMOTIONLISTENER_HPP_ */
diff --git a/sons_of_sol/ControlMultiplexer.hpp b/sons_of_sol/ControlMultiplexer.hpp
new file mode 100644
index 0000000..33ae28d
--- /dev/null
+++ b/sons_of_sol/ControlMultiplexer.hpp
@@ -0,0 +1,95 @@
+#ifndef CONTROLMULTIPLEXER_HPP_
+#define CONTROLMULTIPLEXER_HPP_
+
+/*
+ * Author: jrahm
+ * created: 2013/11/01
+ * ControlMultiplexer.hpp:
+ *
+ * Listens to multiple events and multiplexes them
+ * into a single movement event for the ship
+ */
+
+#include "slox/events/SloxKeyListener.hpp"
+#include "slox/events/SloxMouseMotionListener.hpp"
+
+#include "sons_of_sol/ControlMotionEvent.hpp"
+#include "sons_of_sol/ControlMotionListener.hpp"
+
+#include <map>
+#include <vector>
+
+class ControlMultiplexer :
+ public slox::SloxKeyListener,
+ public slox::SloxMouseMotionListener {
+public:
+ /* Construct a new control multiplexer */
+ ControlMultiplexer();
+
+ /* Adds a listener to this ControlMultiplexer */
+ inline void addControlMotionListener( ControlMotionListener* listener ) {
+ m_motion_listeners.push_back( listener );
+ }
+
+ /* Called when a key is released. This event will be converted
+ * into ControlMotionEvent and sent */
+ virtual void onKeyUp( const SDL_KeyboardEvent& evt ) ;
+
+ /* Called when there was a key press. This event may be converted
+ * into ControlMotionEvent which is then sent off to all
+ * the listeners. If there is no mapping then the motion
+ * event is not sent */
+ virtual void onKeyDown( const SDL_KeyboardEvent& evt ) ;
+
+ /* Called when the mouse is moved. This
+ * is interpreted as a joystick event */
+ virtual void onMouseMoved( const SDL_MouseMotionEvent& evt );
+
+ /* Called when there is an event that is called */
+ void fireControlEvent( const ControlMotionEvent& evt );
+
+ /* Adds a mapping from a key to a MotionEventType. Keys are represented
+ * as a 1 for pressed and 0 for not pressed, so some normalization must
+ * be done with a joystick in order to received the desired results */
+ inline void setKeyMapping( SDLKey key, ControlMotionEvent::MotionEventType to, float mult=1.0f ) {
+ m_keysym_map[ key ] = M_MapVal( to, mult );;
+ }
+
+ /* Removes a mapping from this multiplexer, such that
+ * a key of this type pressed will no longer fire that
+ * event */
+ inline void removeKeyMapping( SDLKey key ) {
+ m_keysym_map.erase( key );
+ }
+
+ /* Sets a joystick axis mapping. If the joystick_index = 255 then it
+ * is interpreted as the mouse */
+ inline void setJoyAxisMapping( uint8_t joystick_index, uint8_t axis_index,
+ ControlMotionEvent::MotionEventType to, float mult=1.0f ) {
+ m_joy_axis_map[ joystick_index << 8 | axis_index ] = M_MapVal( to, mult );
+ }
+
+ inline void removeJoyAxisMapping( uint8_t joystick_index, uint8_t axis_index ) {
+ m_joy_axis_map.erase( joystick_index << axis_index );
+ }
+
+private:
+ struct M_MapVal {
+ inline M_MapVal( ControlMotionEvent::MotionEventType typ, float mult ) :
+ type( typ ), multiplier( mult ) {}
+ inline M_MapVal( ) : type( ControlMotionEvent::NONE ), multiplier( 0.0f ) {}
+ ControlMotionEvent::MotionEventType type;
+ float multiplier;
+ };
+ /* The listeners on this multiplexer */
+ std::vector< ControlMotionListener* > m_motion_listeners;
+
+ /* The keysym map */
+ std::map< SDLKey, M_MapVal > m_keysym_map;
+
+ /* Mapping of a bit oring of joystick index and axis index to
+ * an event type */
+ std::map< uint16_t, M_MapVal > m_joy_axis_map;
+};
+
+#endif /* CONTROLMULTIPLEXER_HPP_ */
diff --git a/sons_of_sol/PlayerShip.hpp b/sons_of_sol/PlayerShip.hpp
new file mode 100644
index 0000000..ea5f178
--- /dev/null
+++ b/sons_of_sol/PlayerShip.hpp
@@ -0,0 +1,125 @@
+#ifndef SHIP_HPP_
+#define SHIP_HPP_
+
+/*
+ * Author: jrahm
+ * created: 2013/10/31
+ * Ship.hpp: <description>
+ */
+
+#include "glox/GloxPoint.hpp"
+#include "glox/GloxVector3.hpp"
+#include "glox/GloxLookAtPerspective.hpp"
+
+#include "slox/events/SloxKeyListener.hpp"
+
+#include "ControlMotionListener.hpp"
+
+/* This is a class
+ * for the first person
+ * ship */
+class PlayerShip : public ControlMotionListener {
+public:
+ inline PlayerShip() :
+ m_forward( 0, 0, -1 ), m_up( 0, 1, 0 ), m_right( 1, 0, 0 ),
+ m_dpitch( 0 ),
+ m_dyaw( 0 ),
+ m_droll( 0 ),
+ m_dforward( 0 ),
+ m_dup( 0 ),
+ m_dright( 0 ) {}
+
+ /* Draw the heads-up-display of the
+ * ship */
+ void drawHUD();
+
+ /* Render the perspective of
+ * this ship */
+ void renderPerspective();
+
+ /* Move the ship up and down */
+ void pitch( float angle );
+
+ /* Roll the ship */
+ void roll( float angle );
+
+ /* Rotate the ship side to side */
+ void yaw( float angle );
+
+ /* Update this object */
+ void update();
+
+ const glox::GloxStandardProjection& getPerspective( ) const {
+ return m_perspective;
+ }
+
+ glox::GloxStandardProjection& getPerspective( ) {
+ return m_perspective;
+ }
+
+ void setPerspective( const glox::GloxLookAtPerspective& perspective ) {
+ m_perspective = perspective;
+ }
+
+ inline void setDPitch( float dpitch ) {
+ this->m_dpitch = dpitch;
+ }
+
+ inline void setDRoll( float droll ) {
+ this->m_droll = droll;
+ }
+
+ inline void setDYaw( float dyaw ) {
+ this->m_dyaw = dyaw;
+ }
+
+ inline float getDPitch() const {
+ return m_dpitch;
+ }
+
+ inline float getDYaw() const {
+ return m_dyaw;
+ }
+
+ inline float getDRoll() const {
+ return m_droll;
+ }
+
+ virtual void onControlMotion( const ControlMotionEvent& evt );
+
+ inline const glox::GloxPoint<> getPosition() const {
+ return m_position;
+ }
+
+ inline void setPosition( const glox::GloxPoint<>& pos ) {
+ m_position = pos;
+ }
+private:
+ /* The position of the ship */
+ glox::GloxPoint<> m_position;
+
+ /* The orientation of the ship */
+ glox::GloxVector3<> m_forward;
+ glox::GloxVector3<> m_up;
+ glox::GloxVector3<> m_right;
+
+ /* The perspective of the ship */
+ glox::GloxLookAtPerspective m_perspective;
+
+ float m_dpitch;
+ float m_dyaw;
+
+ float m_droll;
+ float m_droll_to;
+
+ float m_dforward;
+ float m_dforward_to;
+
+ float m_dup;
+ float m_dup_to;
+
+ float m_dright;
+ float m_dright_to;
+};
+
+#endif /* SHIP_HPP_ */
diff --git a/sons_of_sol/SonsOfSolApplication.hpp b/sons_of_sol/SonsOfSolApplication.hpp
index 1faeaa4..6c1afeb 100644
--- a/sons_of_sol/SonsOfSolApplication.hpp
+++ b/sons_of_sol/SonsOfSolApplication.hpp
@@ -16,26 +16,42 @@
#include "glox/GloxCommon.hpp"
#include "glox/GloxFirstPersonPerspective.hpp"
#include "glox/objects/GloxTexturedCube.hpp"
+#include "glox/objects/GloxTexturedSphere.hpp"
#include "glox/GloxColor.hpp"
#include "glox/GloxLookAtPerspective.hpp"
#include "glox/GloxLightSourceManager.hpp"
+#include "glox/objects/GloxCube.hpp"
+#include "slox/loader/SloxModelObject.hpp"
+#include "slox/loader/SloxObjectLoader.hpp"
+
+#include "sons_of_sol/PlayerShip.hpp"
+#include "sons_of_sol/ControlMultiplexer.hpp"
class SonsOfSolApplication : public
slox::SloxApplication,
slox::SloxRawEventHandler,
+ slox::SloxResizeListener,
+ slox::SloxKeyListener,
slox::SloxQuitListener {
public:
/* Process an event */
- inline void onEvent( const SDL_Event& event )
+ virtual inline void onEvent( const SDL_Event& event )
{ SloxRawEventHandler::onEvent( event ); }
+ virtual inline void onKeyDown( const SDL_KeyboardEvent& evt ) {
+ if( evt.keysym.sym == SDLK_ESCAPE ) exit( 0 );
+ if( evt.keysym.sym == SDLK_f ) {
+ setFullScreen();
+ };
+ }
+
/* Initializes this application;
* returns true if initialization
* succeeded, false otherwise */
- bool initialize( int argc, char** argv );
+ virtual bool initialize( int argc, char** argv );
/* The main loop of the application */
- bool loop( uint32_t ticks ) {
+ virtual bool loop( uint32_t ticks ) {
/* Update things that we might
* want to */
update( ticks );
@@ -59,7 +75,7 @@ public:
/* What happens when a quit event is
* intercepted */
- inline void onQuit( const SDL_QuitEvent& evt ) {
+ virtual inline void onQuit( const SDL_QuitEvent& evt ) {
(void) evt;
m_quit = true;
}
@@ -68,19 +84,21 @@ public:
}
-private:
-
/* Resizes the perspective for OpenGL */
+ inline void onResize( const SDL_ResizeEvent& evt ) {
+ m_screen = SDL_SetVideoMode(evt.w,evt.h,0,SDL_OPENGL|SDL_RESIZABLE|SDL_DOUBLEBUF);
+ reshape( evt.w, evt.h );
+ }
+private:
+ void setupControls() ;
void reshape( int width, int height );
/* Sets up the lights to be used */
void enableLighting( );
-
void update( uint32_t ticks );
-
void display( ) ;
-
bool loadTextures();
+ void setFullScreen();
/* perspective stuff */
glox::GloxViewport m_viewport;
@@ -88,19 +106,37 @@ private:
/* The sky */
glox::GloxTexturedCube* m_sky;
+ glox::GloxTexturedCube* m_crate;
+ glox::GloxTexturedSphere* m_earth;
/* Textures */
glox::GloxTexture m_sky_tex;
glox::GloxTexture m_leaf_tex;
- glox::GloxTexture m_cube_tex;
+ glox::GloxTexture m_crate_tex;
+ glox::GloxTexture m_star_tex;
+ glox::GloxTexture m_earth_tex;
+ /* The sun */
+ glox::GloxPointCollection<glox::GloxPointNormalTexture> m_star;
+
+ /* The little test object */
+ slox::SloxModelObject* m_probe;
+ slox::SloxModelObject* m_frigate_industrial;
+
+ slox::SloxTextureFactory m_texture_factory;
+ slox::SloxObjectLoader m_object_loader;
/* A boolean stating if it is time
* to quit */
bool m_quit;
glox::GloxLightSourceManager m_light_manager;
+ PlayerShip m_ship;
SDL_Surface* m_screen;
+ ControlMultiplexer m_event_multiplexer;
+
+ int m_screen_width;
+ int m_screen_height;
};
#endif /* SONSOFSOLAPPLICATION_HPP_ */
diff --git a/sons_of_sol/private_db/ControlMultiplexer.cpp b/sons_of_sol/private_db/ControlMultiplexer.cpp
new file mode 100644
index 0000000..97ae2f4
--- /dev/null
+++ b/sons_of_sol/private_db/ControlMultiplexer.cpp
@@ -0,0 +1,58 @@
+#include "sons_of_sol/ControlMultiplexer.hpp"
+
+ControlMultiplexer::ControlMultiplexer() {
+
+}
+
+void ControlMultiplexer::onKeyUp( const SDL_KeyboardEvent& evt ) {
+ std::map< SDLKey, M_MapVal >::iterator itr;
+ itr = m_keysym_map.find( evt.keysym.sym );
+
+ if( itr != m_keysym_map.end() ) {
+ ControlMotionEvent event( (*itr).second.type, 0, ControlMotionEvent::BUTTON );
+ fireControlEvent( event );
+ }
+}
+
+void ControlMultiplexer::onKeyDown( const SDL_KeyboardEvent& evt ) {
+ std::map< SDLKey, M_MapVal >::iterator itr;
+ itr = m_keysym_map.find( evt.keysym.sym );
+
+ if( itr != m_keysym_map.end() ) {
+ ControlMotionEvent event( (*itr).second.type, 1 * (*itr).second.multiplier, ControlMotionEvent::BUTTON );
+ fireControlEvent( event );
+ }
+}
+
+void ControlMultiplexer::onMouseMoved( const SDL_MouseMotionEvent& evt ) {
+ std::map< uint16_t, M_MapVal >::iterator itr;
+ /* x direction on mousepad */
+ itr = m_joy_axis_map.find( 0xFF00 );
+ const SDL_VideoInfo* info = SDL_GetVideoInfo(); //<-- calls SDL_GetVideoInfo();
+ int screen_width = info->current_w;
+ int screen_height = info->current_h;
+
+ float x_norm = (evt.x - screen_width / 2) / ((float) screen_width / 2.0);
+ if( itr != m_joy_axis_map.end() ) {
+ ControlMotionEvent event( itr->second.type, x_norm * (*itr).second.multiplier,
+ ControlMotionEvent::MOUSE );
+ fireControlEvent( event );
+ }
+
+ /* y direction */
+ float y_norm = (evt.y - screen_height / 2) / ((float) screen_height / 2.0);
+ itr = m_joy_axis_map.find( 0xFF01 );
+ if( itr != m_joy_axis_map.end() ) {
+ ControlMotionEvent event( itr->second.type, y_norm * (*itr).second.multiplier,
+ ControlMotionEvent::MOUSE );
+ fireControlEvent( event );
+ }
+}
+
+void ControlMultiplexer::fireControlEvent( const ControlMotionEvent& evt ) {
+ std::vector< ControlMotionListener* >::iterator itr;
+
+ for( itr = m_motion_listeners.begin(); itr != m_motion_listeners.end() ; ++ itr ) {
+ (*itr)->onControlMotion( evt );
+ }
+}
diff --git a/sons_of_sol/private_db/PlayerShip.cpp b/sons_of_sol/private_db/PlayerShip.cpp
new file mode 100644
index 0000000..f8d8ec1
--- /dev/null
+++ b/sons_of_sol/private_db/PlayerShip.cpp
@@ -0,0 +1,103 @@
+#include "sons_of_sol/PlayerShip.hpp"
+
+#include "glox/GloxCommon.hpp"
+#include "glox/GloxColor.hpp"
+
+using namespace glox;
+
+
+void PlayerShip::pitch( float angle ) {
+ /* Update the forward vector */
+ m_forward *= (float)GloxCos( angle );
+ m_forward += ( m_up * (float)GloxSin( angle ) );
+ m_forward.normalize();
+
+ m_up = m_right.cross( m_forward );
+}
+
+void PlayerShip::roll( float angle ) {
+ m_right *= (float)GloxCos( angle );
+ m_right += m_up * GloxSin( angle );
+ m_right.normalize();
+
+ m_up = m_right.cross( m_forward );
+}
+
+void PlayerShip::yaw( float angle ) {
+ m_right *= (float)GloxCos( angle );
+ m_right += m_forward * GloxSin( angle );
+ m_right.normalize();
+
+ m_forward = m_up.cross( m_right );
+}
+
+void PlayerShip::renderPerspective( ) {
+ m_perspective.setLookAtPoint( m_position + m_forward.toPoint() );
+ m_perspective.setPosition( m_position + (m_forward.toPoint() * 0.2f) );
+ m_perspective.setUpVector( m_up.toPoint() );
+
+ GloxColor( 255,255,255 ).render();
+ GloxWith( GL_LINES,
+ GloxPoint<>( 0,0,0 ).plot();
+ m_position.plot() );
+}
+
+void PlayerShip::drawHUD() {
+
+}
+
+static inline float update_val( float to, float x, int inertia ) {
+ return ( to + (inertia - 1) * x ) / inertia;
+}
+
+void PlayerShip::onControlMotion( const ControlMotionEvent& evt ) {
+ //printf( "Event Mag: %f\n", evt.getMagnitude() );
+
+ if( evt.getType() == ControlMotionEvent::PITCH ) {
+ m_dpitch = update_val( evt.getMagnitude(), m_dpitch, 10 );
+ }
+
+ if( evt.getType() == ControlMotionEvent::THROTTLE ) {
+ m_dforward_to = evt.getMagnitude();
+ }
+
+ if( evt.getType() == ControlMotionEvent::YAW ) {
+ m_dyaw = update_val( evt.getMagnitude(), m_dyaw, 10 );
+ }
+
+ if( evt.getType() == ControlMotionEvent::ROLL ) {
+ m_droll_to = evt.getMagnitude();
+ }
+
+ if( evt.getType() == ControlMotionEvent::STRAFE_SIDE ) {
+ m_dright_to = evt.getMagnitude();
+ }
+
+ if( evt.getType() == ControlMotionEvent::STRAFE_UP ) {
+ m_dup_to = evt.getMagnitude();
+ }
+}
+
+void PlayerShip::update() {
+ // printf( "dpitch: %f, droll: %f, dyaw: %f, dforward: %f, dright: %f, dup: %f\n",
+ // m_dpitch, m_droll, m_dyaw, m_dforward, m_dright, m_dup );
+
+ pitch( m_dpitch );
+ roll( m_droll );
+ yaw( m_dyaw );
+
+ m_position += (m_forward * m_dforward).toPoint();
+ m_position += (m_right * m_dright).toPoint();
+ m_position += (m_up * m_dup).toPoint();
+
+ m_droll = update_val( m_droll_to, m_droll, 20 );
+ m_dup = update_val( m_dup_to, m_dup, 20 );
+ m_dright = update_val( m_dright_to, m_dright, 20 );
+ m_dforward = update_val( m_dforward_to, m_dforward, 200 );
+
+ // This is only the case if we are using a mouse
+ m_dpitch = update_val( 0, m_dpitch, 100 );
+ m_dyaw = update_val( 0, m_dyaw, 100 );
+ // m_droll = (m_droll_to * ( 1 - exp( - m_droll_count ) ) + m_droll * ( 1 - exp( - m_droll_count ) ) )/ 2.0;
+ renderPerspective();
+}
diff --git a/sons_of_sol/private_db/SonsOfSolApplication.cpp b/sons_of_sol/private_db/SonsOfSolApplication.cpp
index f6a52c2..c49ae07 100644
--- a/sons_of_sol/private_db/SonsOfSolApplication.cpp
+++ b/sons_of_sol/private_db/SonsOfSolApplication.cpp
@@ -1,17 +1,74 @@
#include "sons_of_sol/SonsOfSolApplication.hpp"
#include "glox/GloxLightSource.hpp"
+#include "glox/GloxRotation.hpp"
+#include "glox/GloxScopedRotation.hpp"
+
+#include <iostream>
using namespace slox;
using namespace glox;
+using namespace std;
+
+void SonsOfSolApplication::setupControls() {
+ m_event_multiplexer.setKeyMapping( SDLK_w, ControlMotionEvent::THROTTLE, 5.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_s, ControlMotionEvent::THROTTLE, -5.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_d, ControlMotionEvent::STRAFE_SIDE );
+ m_event_multiplexer.setKeyMapping( SDLK_a, ControlMotionEvent::STRAFE_SIDE, -1.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_z, ControlMotionEvent::STRAFE_UP, -1.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_x, ControlMotionEvent::STRAFE_UP, 0.3f );
+
+ m_event_multiplexer.setKeyMapping( SDLK_q, ControlMotionEvent::ROLL, 2.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_e, ControlMotionEvent::ROLL, -2.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_k, ControlMotionEvent::PITCH );
+ m_event_multiplexer.setKeyMapping( SDLK_j, ControlMotionEvent::PITCH, -1.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_l, ControlMotionEvent::YAW, -1.0f );
+ m_event_multiplexer.setKeyMapping( SDLK_h, ControlMotionEvent::YAW );
+
+ m_event_multiplexer.setJoyAxisMapping( 255, 0, ControlMotionEvent::YAW, -1.0f );
+ m_event_multiplexer.setJoyAxisMapping( 255, 1, ControlMotionEvent::PITCH, -1.0f );
+}
+
+void SonsOfSolApplication::setFullScreen() {
+ m_screen = SDL_SetVideoMode(m_screen_width,m_screen_height,0,
+ SDL_OPENGL|SDL_RESIZABLE|SDL_DOUBLEBUF|SDL_FULLSCREEN);
+ reshape( m_screen_width, m_screen_height );
+}
bool SonsOfSolApplication::initialize( int argc, char** argv ) {
+ (void) argc;
+ (void) argv;
+
+ /* Use our texture factory to load textures */
+ m_object_loader.setTextureFactory( &m_texture_factory );
+
+ setupControls();
+
SDL_Init( SDL_INIT_VIDEO );
+ const SDL_VideoInfo* info = SDL_GetVideoInfo(); //<-- calls SDL_GetVideoInfo();
+ m_screen_width = info->current_w;
+ m_screen_height = info->current_h;
m_screen = SDL_SetVideoMode( 600, 600, 0, SDL_OPENGL|SDL_RESIZABLE|SDL_DOUBLEBUF );
m_perspective.setPosition( GloxPoint<>( 0, 0, 10 ) );
+ m_perspective.setZFar( 10000.0 );
+ m_ship.setPerspective( m_perspective );
+
+ if( argv[1] == NULL || strcmp(argv[1],"nograb") ) {
+ SDL_ShowCursor( 0 );
+ SDL_WM_GrabInput(SDL_GRAB_ON);
+ }
+
+ /* Add some listeners */
this->addQuitListener( this );
+ this->addKeyListener( this );
+
+ this->addKeyListener( & m_event_multiplexer );
+ this->addMouseMotionListener( & m_event_multiplexer );
+ this->addResizeListener( this );
+
+ m_event_multiplexer.addControlMotionListener( & m_ship );
if( ! m_screen ) {
/* If the screen could not be initialized, print
@@ -26,35 +83,77 @@ bool SonsOfSolApplication::initialize( int argc, char** argv ) {
/* Load the textures into memory */
if( ! loadTextures() ) return false;
- GloxTextureRepeat texrep( &m_sky_tex, 3, 3 );
- m_sky = new GloxTexturedCube( 900.0f, GloxColor( 255, 255, 255 ),
+ GloxTextureRepeat texrep( &m_sky_tex, 1.8, 1.8 );
+ m_sky = new GloxTexturedCube( 9900.0f, GloxColor( 255, 255, 255 ),
+ texrep, texrep, texrep, texrep, texrep, texrep );
+
+ texrep = GloxTextureRepeat( &m_crate_tex, 1, 1 );
+ m_crate = new GloxTexturedCube( 5.0f, GloxColor( 255, 255, 255 ),
texrep, texrep, texrep, texrep, texrep, texrep );
+
+ m_object_loader.addToPath( "objects" );
+ m_object_loader.addToPath( "objects/material" );
+ m_earth = new GloxTexturedSphere( 900.0f, 5.0f, m_earth_tex );
+ m_probe = m_object_loader.loadObjectFromFile( "probe.obj" );
+
+ if( ! m_probe ) {
+ cerr << "Unable to load probe: " << m_object_loader.getReason() << endl;
+ exit( 123 );
+ }
+
+ m_frigate_industrial = m_object_loader.loadObjectFromFile( "frigate_industrial.obj" );
+ if( ! m_frigate_industrial ) {
+ cerr << "Unable to load frigate_industrial\n" << m_object_loader.getReason() << endl;
+ exit( 123 );
+ }
+
+ /* Add the points for the sun */
+ m_star.add( GloxPointNormalTexture(
+ GloxPoint<>( -100, 100, -4500 ), GloxNormal<>(0,0,0), GloxPoint<>( 0,0 ) ) );
+ m_star.add( GloxPointNormalTexture(
+ GloxPoint<>( 100, 100, -4500 ), GloxNormal<>(0,0,0), GloxPoint<>( 1,0 ) ) );
+ m_star.add( GloxPointNormalTexture(
+ GloxPoint<>( 100, 300, -4500 ), GloxNormal<>(0,0,0), GloxPoint<>( 1,1 ) ) );
+ m_star.add( GloxPointNormalTexture(
+ GloxPoint<>( -100, 300, -4500 ), GloxNormal<>(0,0,0), GloxPoint<>( 0,1 ) ) );
+
+ /* Move the light souce to the sun */
+ GloxLightSource* source = m_light_manager.getLightSource( 0 );
+ source->setPosition( GloxPointf( 0, 200, -695 ) );
m_quit = false;
+
+ this->enableLighting();
return true;
}
-#define NTEX 3
+#define NTEX 5
bool SonsOfSolApplication::loadTextures() {
const char* files[NTEX] = {
"stars.bmp",
"leaf.bmp",
- "crate.bmp"
+ "crate.bmp",
+ "star.bmp",
+ "earth.bmp"
};
GloxTexture* textures[NTEX] = {
&m_sky_tex,
&m_leaf_tex,
- &m_cube_tex
+ &m_crate_tex,
+ &m_star_tex,
+ &m_earth_tex
};
- unsigned int tex;
+ unsigned int tex = 0;
+ m_texture_factory.addToPath( "objects/textures/" );
+ m_texture_factory.addToPath( "objects/" );
for ( int i = 0; i < NTEX; ++ i ) {
- if( SloxTextureFactory::readBitmapFile( files[i], &tex ) ) {
+ if( m_texture_factory.readBitmapFile( files[i], &tex ) ) {
/* Either there was a warning or an error, print out
* either */
- fprintf( stderr, "Reading %s: %s\n", files[i], SloxTextureFactory::getMessage().c_str() );
+ fprintf( stderr, "Reading %s: %s\n", files[i], m_texture_factory.getMessage().c_str() );
if( tex == 0 ) {
/* If the texture hasn't changed, its an error, otherwise
@@ -64,44 +163,87 @@ bool SonsOfSolApplication::loadTextures() {
}
}
textures[i]->setId( tex );
+ tex = 0;
}
return true;
}
void SonsOfSolApplication::enableLighting() {
- int ambient_coef = 30;
- int diffuse_coef = 100;
+ /* There is very little ambient light
+ * in space */
+ // int ambient_coef = 0.5;
+ // int diffuse_coef = 100;
int specular_coef = 0;
- GloxLightSource* source = m_light_manager.getLightSource( 0 );
+ GloxLightSource* sun = m_light_manager.getLightSource( 0 );
+ GloxLightSource* earth = m_light_manager.getLightSource( 1 );
- GloxColor base(2,2,2);
- source->setAmbient ( base * ambient_coef );
- source->setDiffuse ( base * diffuse_coef );
- source->setSpecular( base * specular_coef );
- source->setLightModelAttribute( GL_LIGHT_MODEL_LOCAL_VIEWER, 1 );
- GloxTrace( "init", "Source=%p\n", source );
- source->setEnabled( true );
+ GloxColor base(2,2,0);
+ sun->setLightModelAttribute( GL_LIGHT_MODEL_AMBIENT, GloxColor(100,100,90) );
+ sun->setAmbient ( GloxColor( 0, 0, 0 ) );
+ sun->setDiffuse ( GloxColor( 255, 235, 200 ) );
+ sun->setSpecular( base * specular_coef );
+ sun->setLightModelAttribute( GL_LIGHT_MODEL_LOCAL_VIEWER, 1 );
+ sun->setEnabled( true );
+
+ earth->setLightModelAttribute( GL_LIGHT_MODEL_AMBIENT, GloxColor(0,0,0) );
+ earth->setAmbient ( GloxColor(0,0,0) );
+ earth->setDiffuse ( GloxColor(130,155,155) );
+ earth->setSpecular( base * specular_coef );
+ earth->setLightModelAttribute( GL_LIGHT_MODEL_LOCAL_VIEWER, 1 );
+ earth->setPosition( GloxPoint<>( 700,-1000,0 ) );
}
void SonsOfSolApplication::update( uint32_t ticks ) {
-
+ (void) ticks;
+ m_ship.update();
}
void SonsOfSolApplication::display() {
/* Translate to the this perspective */
- m_perspective.render();
- m_sky->draw();
+ m_ship.drawHUD();
+ m_ship.getPerspective().render();
+
+ /* We don't want lighting for the skybox */
+ GloxDisableFor( GL_LIGHTING,
+ /* Draw some stuff relative to the
+ * ship so the ship cannot break out
+ * of the skybox */
+ GloxWithTranslation( m_ship.getPosition(),
+ /* Draw the background sky */
+ m_sky->draw();
+ /* Draw the star texture */
+ GloxEnableFor( GL_TEXTURE_2D,
+ m_star_tex.bind();
+ GloxWith( GL_QUADS, m_star.plot() );
+ );
+ )
+ );
+
+ GloxWithTranslation( m_ship.getPosition() + GloxPoint<>( 700,-1000,0 ),
+ GloxRotation( -90, 0, 0, 1 ).render();
+ m_earth->draw()
+ )
- GloxColor( 255,255,255 ).render();
- GloxWith( GL_QUADS, {
- GloxPoint<>( 0,0,0 ).plot();
- GloxPoint<>( 0,5,0 ).plot();
- GloxPoint<>( 5,5,0 ).plot();
- GloxPoint<>( 5,0,0 ).plot();
- } );
+ m_light_manager.getLightSource( 1 )->setEnabled( true );
+ m_light_manager.render();
+
+ m_crate->draw();
+ GloxWithTranslation( GloxPoint<>( 0,10,0 ),
+ m_probe->draw() );
+
+ GloxScale( 100,
+ GloxWithTranslation( GloxPoint<>( 10,10,10 ),
+ glPushMatrix();
+ glRotatef( 90, 1.2, 1.3, 1.4 );
+ m_frigate_industrial->draw();
+ glPopMatrix();
+ )
+ );
+
+ GloxColor( 255,255,255 ).render();
}
void SonsOfSolApplication::reshape( int width, int height ) {
@@ -109,6 +251,6 @@ void SonsOfSolApplication::reshape( int width, int height ) {
m_viewport.setHeight( height );
m_viewport.render();
- m_perspective.setAspectRatio( m_viewport.getAspectRatio() );
- m_perspective.project();
+ m_ship.getPerspective().setAspectRatio( m_viewport.getAspectRatio() );
+ m_ship.getPerspective().project();
}