Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-02-09 17:48:16 +0000
committerStijn Buys <ingar@osirion.org>2008-02-09 17:48:16 +0000
commit48aa068b036f565d6b94d4207242066ba655afe4 (patch)
tree4b68cf169c7fcd4bc6f2eecc7c072830d91830f8 /src/client/view.cc
parent23aee34002facf39b56d209320817375db3b6189 (diff)
entities, step 1
Diffstat (limited to 'src/client/view.cc')
-rw-r--r--src/client/view.cc45
1 files changed, 6 insertions, 39 deletions
diff --git a/src/client/view.cc b/src/client/view.cc
index 07e7cff..4627d26 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -7,9 +7,8 @@
#include "client/client.h"
#include "client/camera.h"
#include "client/console.h"
-#include "client/shipdrawer.h"
-#include "client/stardrawer.h"
#include "client/video.h"
+#include "client/draw.h"
#include "render/render.h"
#include "game/game.h"
#include "sys/sys.h"
@@ -26,31 +25,16 @@ namespace client
namespace view
{
-ShipDrawer *shipdrawer = 0;
-StarDrawer *stardrawer = 0;
-game::Ship *target = 0; // the view's target
-
float fps = 0;
void init()
{
- if (!shipdrawer) {
- stardrawer = new StarDrawer(&game.star);
- shipdrawer = new ShipDrawer(&game.ship);
- target = &game.ship;
- }
-
camera::init();
}
void shutdown()
{
camera::shutdown();
-
- delete stardrawer;
- stardrawer = 0;
- delete shipdrawer;
- shipdrawer = 0;
}
void reset()
@@ -77,26 +61,6 @@ void reset()
gl::disable(GL_CULL_FACE);
}
-
-void draw_world(float elapsed)
-{
- using namespace render;
-
- // draw the world
- gl::push();
-
- gl::translate(game.ship.location - target->location);
- gl::scale(0.2f, 0.2f, 0.2f);
- shipdrawer->draw(elapsed);
- gl::pop();
-
- gl::push();
- gl::translate(game.star.location - target->location);
- stardrawer->draw(elapsed);
- gl::pop();
-
-}
-
void draw_background(float elapsed)
{
using namespace render::gl;
@@ -115,12 +79,14 @@ void draw_background(float elapsed)
vertex(0,-1, 0);
end();
+ translate(camera::target);
+
int gridsize = 32;
float s = 1.0f / gridsize;
float y = -4.0f;
- float dx = target->location.x - floorf(target->location.x);
- float dz = target->location.z - floorf(target->location.z);
+ float dx = camera::target.x - floorf(camera::target.x);
+ float dz = camera::target.z - floorf(camera::target.z);
color(0,0, 1.0f);
begin(Lines);
@@ -233,6 +199,7 @@ void frame(float seconds)
gl::loadidentity();
gl::rotate(90.0f, 0, 1.0, 0);
+ camera::target = game.ship->location;
camera::draw(seconds); // draw the current camera transformation
gl::enable(GL_DEPTH_TEST); // enable depth buffer writing