From 67f8a7a783e550cab8e6a77d997b31815ee8cd7e Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 2 Feb 2008 14:53:46 +0000 Subject: introduced librender --- src/client/shipdrawer.cc | 61 ++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 30 deletions(-) (limited to 'src/client/shipdrawer.cc') 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 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 +} -- cgit v1.2.3