diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-02 14:53:46 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-02 14:53:46 +0000 |
commit | 67f8a7a783e550cab8e6a77d997b31815ee8cd7e (patch) | |
tree | b68bde793bb881b965366569cfc9cea65423eb12 /src/client | |
parent | 8ac9b27f5f0a1e833974058464cdf7029c9d7e0b (diff) |
introduced librender
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/Makefile.am | 6 | ||||
-rw-r--r-- | src/client/camera.cc | 2 | ||||
-rw-r--r-- | src/client/camera.h | 2 | ||||
-rw-r--r-- | src/client/shipdrawer.cc | 61 | ||||
-rw-r--r-- | src/client/stardrawer.cc | 4 | ||||
-rw-r--r-- | src/client/stardrawer.h | 4 | ||||
-rw-r--r-- | src/client/video.cc | 8 | ||||
-rw-r--r-- | src/client/view.cc | 4 |
8 files changed, 50 insertions, 41 deletions
diff --git a/src/client/Makefile.am b/src/client/Makefile.am index f1a3f9d..4c20c54 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -8,6 +8,6 @@ libclient_la_LDFLAGS = -avoid-version -no-undefined $(GL_LIBS) $(LIBSDL_LIBS) noinst_LTLIBRARIES = libclient.la noinst_HEADERS = application.h camera.h client.h console.h input.h shipdrawer.h stardrawer.h \ video.h view.h -libclient_la_LIBADD = $(top_builddir)/src/math/libmath.la \ - $(top_builddir)/src/sys/libsys.la $(top_builddir)/src/filesystem/libfilesystem.la \ - $(top_builddir)/src/core/libcore.la $(top_builddir)/src/game/libgame.la $(top_builddir)/src/gl/libgl.la +libclient_la_LIBADD = $(top_builddir)/src/render/librender.la \ + $(top_builddir)/src/core/libcore.la $(top_builddir)/src/filesystem/libfilesystem.la \ + $(top_builddir)/src/game/libgame.la $(top_builddir)/src/math/libmath.la $(top_builddir)/src/sys/libsys.la diff --git a/src/client/camera.cc b/src/client/camera.cc index 08c60fa..5355a26 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -11,6 +11,8 @@ using math::degrees360f; using math::degrees180f; +using namespace render; + namespace client { diff --git a/src/client/camera.h b/src/client/camera.h index da0890b..1a25689 100644 --- a/src/client/camera.h +++ b/src/client/camera.h @@ -7,7 +7,7 @@ #ifndef __INCLUDED_CLIENT_CAMERA_H__ #define __INCLUDED_CLIENT_CAMERA_H__ -#include "gl/gllib.h" +#include "render/render.h" namespace client { diff --git a/src/client/shipdrawer.cc b/src/client/shipdrawer.cc index e1c9adf..074dbd8 100644 --- a/src/client/shipdrawer.cc +++ b/src/client/shipdrawer.cc @@ -5,14 +5,15 @@ */ #include "client/shipdrawer.h" -#include "gl/gllib.h" -#include "gl/box.h" +#include "render/render.h" +#include "render/box.h" #include <iostream> namespace client { -using namespace gl; +using namespace render; + using math::Vector3f; using math::Color; @@ -40,12 +41,12 @@ void ShipDrawer::draw(float elapsed) { gl::push(); - rotate(ship->yaw(), 0.0f, 1.0f, 0.0f ); + gl::rotate(ship->yaw(), 0.0f, 1.0f, 0.0f ); Vector3f tl(0.25, 0.125, 0.125); Vector3f br(-0.25, -0.125, -0.125); - gl::Box box(tl, br); + Box box(tl, br); box.draw(); tl = Vector3f(0, 0.07, 0.25); @@ -70,43 +71,43 @@ void ShipDrawer::draw(float elapsed) cockpit.draw(); if(ship->thrust() > 0 ) { - color(1.0f,0 ,0 ); - begin(Lines); - vertex(-0.5f, 0, 0.185); - vertex(-0.5f-0.25f*ship->thrust(), 0, 0.185); + gl::color(1.0f,0 ,0 ); + gl::begin(gl::Lines); + gl::vertex(-0.5f, 0, 0.185); + gl::vertex(-0.5f-0.25f*ship->thrust(), 0, 0.185); - vertex(-0.5f, 0, -0.185f); - vertex(-0.5f-0.25f*ship->thrust(), 0, -0.185f); - end(); + gl::vertex(-0.5f, 0, -0.185f); + gl::vertex(-0.5f-0.25f*ship->thrust(), 0, -0.185f); + gl::end(); } // shield rotation - rotate(angle, 0.0f, 1.0f, 0.0f ); + gl::rotate(angle, 0.0f, 1.0f, 0.0f ); angle += 180.0f * elapsed; if( angle > 360.0f ) { angle -= 360.0f; } // draw the shield - color(Color(0.0f, 1.0f ,0.0f , 0.5f)); + gl::color(Color(0.0f, 1.0f ,0.0f , 0.5f)); + + gl::begin(gl::LineStrip); + gl::vertex(v0); + gl::vertex(v1); + gl::vertex(v2); + gl::vertex(v3); + gl::vertex(v0); + gl::end(); - begin(LineStrip); - vertex(v0); - vertex(v1); - vertex(v2); - vertex(v3); - vertex(v0); - end(); - - begin(LineStrip); - vertex(v4); - vertex(v5); - vertex(v6); - vertex(v7); - vertex(v4); - end(); + gl::begin(gl::LineStrip); + gl::vertex(v4); + gl::vertex(v5); + gl::vertex(v6); + gl::vertex(v7); + gl::vertex(v4); + gl::end(); gl::pop(); } -} // namespace client +} diff --git a/src/client/stardrawer.cc b/src/client/stardrawer.cc index 0f591bf..534c1e6 100644 --- a/src/client/stardrawer.cc +++ b/src/client/stardrawer.cc @@ -5,10 +5,12 @@ // projet headers #include "client/stardrawer.h" -#include "gl/gllib.h" +#include "render/render.h" namespace client { +using namespace render; + StarDrawer::StarDrawer(game::Star *s) { star = s; sphere.radius = s->radius; diff --git a/src/client/stardrawer.h b/src/client/stardrawer.h index 6042659..dbfd91a 100644 --- a/src/client/stardrawer.h +++ b/src/client/stardrawer.h @@ -6,7 +6,7 @@ #ifndef __INCLUDED_STARDRAWER_H__ #define __INCLUDED_STARDRAWER_H__ -#include "gl/gllib.h" +#include "render/sphere.h" #include "game/star.h" namespace client { @@ -22,7 +22,7 @@ public: private: game::Star *star; - gl::Sphere sphere; + render::Sphere sphere; }; } // namespace client diff --git a/src/client/video.cc b/src/client/video.cc index ca0401f..5772961 100644 --- a/src/client/video.cc +++ b/src/client/video.cc @@ -5,11 +5,13 @@ */ #include "client/client.h" -#include "gl/gllib.h" +#include "render/render.h" #include "sys/sys.h" #include <SDL/SDL.h> +using namespace render; + namespace client { Video::Video() @@ -90,7 +92,7 @@ void Video::init() return; } - gl::init(); + render::init(); initialized = true; view.init(); @@ -107,7 +109,7 @@ void Video::draw(float elapsed) void Video::shutdown() { view.shutdown(); - gl::shutdown(); + render::shutdown(); initialized = false; width = 0; diff --git a/src/client/view.cc b/src/client/view.cc index 30dd6d6..8754549 100644 --- a/src/client/view.cc +++ b/src/client/view.cc @@ -7,13 +7,15 @@ #include "client/client.h" #include "client/shipdrawer.h" #include "client/stardrawer.h" +#include "render/render.h" #include "game/game.h" -#include "gl/gllib.h" #include "sys/sys.h" #include "math/mathlib.h" #include <SDL/SDL.h> +using namespace render; + namespace client { |