Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/camera.cc23
-rw-r--r--src/client/draw.cc38
-rw-r--r--src/client/view.cc3
-rw-r--r--src/core/entity.cc2
-rw-r--r--src/game/game.cc22
-rw-r--r--src/game/ship.cc2
-rw-r--r--src/render/model.cc2
7 files changed, 51 insertions, 41 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc
index d9aa16e..e8a6625 100644
--- a/src/client/camera.cc
+++ b/src/client/camera.cc
@@ -52,7 +52,7 @@ float x_offset;
float z_offset;
// default pitch in mode::Track
-const float pitch_track = -15.0f;
+const float pitch_track = 15.0f;
// default rotate offset increase/decrease
float rotate_offset_inc;
// default translate offset increase/decrease
@@ -161,22 +161,27 @@ void draw(float elapsed)
pitch_current = degrees360f( pitch_current - d *elapsed);
}
+ // map world coordinates to opengl coordinates
+ gl::rotate(90.0f, 0, 1.0, 0);
+ gl::rotate(-90.0f, 1.0f , 0, 0);
+
+ // map camera coordinates to opengl coordinates
switch (mode) {
case Free:
- gl::translate(1.0f+distance, -distance/2, 0.0f);
- gl::rotate(-pitch_current, 0, 0, 1.0f);
- gl::rotate(-yaw_current, 0, 1.0f, 0);
+ gl::translate(1.0f+distance, 0.0f, -distance/2);
+ gl::rotate(-pitch_current, 0, 1.0f, 0 );
+ gl::rotate(-yaw_current, 0, 0, 1.0f);
gl::translate(-1*target);
break;
case Track:
- gl::translate(1.0f+distance, -distance , 0.0f);
- gl::rotate(-pitch_current, 0, 0, 1.0f);
- gl::rotate(-yaw_current, 0, 1.0f, 0);
+ gl::translate(1.0f+distance, 0.0f, -distance);
+ gl::rotate(-pitch_current, 0, 1.0f, 0);
+ gl::rotate(-yaw_current, 0, 0, 1.0f);
gl::translate(-1*target);
break;
case Overview:
- gl::rotate(75.0f, 0.0f, 0.0f, 1.0f);
- gl::translate(0.0f, -distance, 0.0f);
+ gl::rotate(-75.0f, 0.0f, 1.0f, 0.0f);
+ gl::translate(0.0f, 0.0f, -distance);
//gl::translate(x_offset, 0.0f, z_offset);
gl::translate(-1*target);
break;
diff --git a/src/client/draw.cc b/src/client/draw.cc
index 76c55b3..cdf80c2 100644
--- a/src/client/draw.cc
+++ b/src/client/draw.cc
@@ -45,11 +45,11 @@ void draw_entity_diamond(core::Entity *entity)
gl::color(entity->color());
gl::vertex(-r,0.0f,0.0f);
- gl::vertex(0.0f,0.0f,r/2);
- gl::vertex(0.0f,0.0f,-r/2);
+ gl::vertex(0.0f,r/2,0.0f);
+ gl::vertex(0.0f,-r/2,0.0f);
- gl::vertex(0.0f,r,0.0f);
- gl::vertex(0.0f,-r, 0.0f);
+ gl::vertex(0.0f,0.0f,r);
+ gl::vertex(0.0f,0.0f,-r);
gl::end();
}
@@ -108,7 +108,7 @@ void draw_ship(core::EntityControlable *entity)
gl::push();
gl::translate(entity->location());
gl::scale(0.2f, 0.2f, 0.2f);
- gl::rotate(entity->direction(), 0.0f, 1.0f, 0.0f );
+ gl::rotate(entity->direction(), 0.0f, 0.0f, 1.0f );
Vector3f tl(0.25, 0.125, 0.125);
Vector3f br(-0.25, -0.125, -0.125);
@@ -151,25 +151,23 @@ void draw_ship(core::EntityControlable *entity)
}
// shield rotation
- gl::rotate(angle, 0.0f, 1.0f, 0.0f );
+ gl::rotate(angle, 0.0f, 0.0f, 1.0f );
// draw the shield
gl::color(Color(0.0f, 1.0f ,0.0f , 0.5f));
- gl::begin(gl::LineStrip);
+ gl::begin(gl::LineLoop);
gl::vertex(v0);
gl::vertex(v1);
gl::vertex(v2);
gl::vertex(v3);
- gl::vertex(v0);
gl::end();
- gl::begin(gl::LineStrip);
+ gl::begin(gl::LineLoop);
gl::vertex(v4);
gl::vertex(v5);
gl::vertex(v6);
gl::vertex(v7);
- gl::vertex(v4);
gl::end();
gl::pop();
@@ -183,28 +181,28 @@ void draw_spacegrid()
int gridsize = 32;
float s = 1.0f / gridsize;
- float y = -4.0f;
+ float z = -4.0f;
float dx = camera::target.x - floorf(camera::target.x);
- float dz = camera::target.z - floorf(camera::target.z);
+ float dy = camera::target.y - floorf(camera::target.y);
color(0,0, 1.0f);
begin(Lines);
for (int i=-gridsize; i <= gridsize; i++) {
color(0,0, 0, 0);
- vertex(i-dx, y, -gridsize-dz);
+ vertex(i-dx, -gridsize-dy, z);
color(0,0, (gridsize-abs(i))*s, (gridsize-abs(i))*s);
- vertex(i-dx, y, -dz);
- vertex(i-dx, y, -dz);
+ vertex(i-dx, -dy, z );
+ vertex(i-dx, -dy ,z );
color(0,0, 0, 0);
- vertex(i-dx, y, gridsize-dz);
+ vertex(i-dx, gridsize-dy, z);
- vertex(-gridsize-dx, y, i-dz);
+ vertex(-gridsize-dx, i-dy, z );
color(0,0, (gridsize-abs(i))*s, (gridsize-abs(i))*s);
- vertex(-dx, y, i-dz);
- vertex(-dx, y, i-dz);
+ vertex(-dx, i-dy, z);
+ vertex(-dx, i-dy, z);
color(0,0, 0, 0);
- vertex(gridsize-dx, y, i-dz);
+ vertex(gridsize-dx, i-dy, z);
}
end();
}
diff --git a/src/client/view.cc b/src/client/view.cc
index 96a0631..8ddd33c 100644
--- a/src/client/view.cc
+++ b/src/client/view.cc
@@ -174,8 +174,7 @@ void frame(float seconds)
gl::matrixmode(GL_MODELVIEW); // map world to screen coordinates
gl::loadidentity();
- gl::rotate(90.0f, 0, 1.0, 0);
-
+
camera::draw(seconds); // draw the current camera transformation
gl::enable(GL_DEPTH_TEST); // enable depth buffer writing
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 2fe381b..2a0518a 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -198,7 +198,7 @@ void EntityDynamic::frame(float seconds)
// location avoid sin/cos calculations
entity_location.x += cosf(entity_direction * M_PI / 180) * entity_speed * seconds;
- entity_location.z -= sinf(entity_direction * M_PI / 180) * entity_speed * seconds;
+ entity_location.y += sinf(entity_direction * M_PI / 180) * entity_speed * seconds;
entity_dirty = true;
}
diff --git a/src/game/game.cc b/src/game/game.cc
index cf9f496..828a35b 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -75,14 +75,14 @@ void Game::init()
// the star
Star *star = new Star();
- star->entity_location = Vector3f(256.0f, 0.0f, 256.0f);
+ star->entity_location = Vector3f(256.0f, -256.0f, 0.0f);
star->entity_name = "star: Sabishi Hoshi";
// the green cube
core::Entity *cube = new core::Entity(core::Entity::Solid & core::Entity::Static);
cube->entity_shape = core::Entity::Cube;
cube->entity_color = Color(0.0f, 0.8f, 0.0f);
- cube->entity_location = Vector3f(24.0f, 0.0f, -24.0f);
+ cube->entity_location = Vector3f(24.0f, 24.0f, 0.0f);
cube->entity_name ="ccube: Borg cube green";
cube->entity_modelname = "ccube";
cube->entity_moduletypeid = cube_enttype;
@@ -91,24 +91,32 @@ void Game::init()
cube = new core::Entity(core::Entity::Solid & core::Entity::Static);
cube->entity_shape = core::Entity::Cube;
cube->entity_color = Color(1.0f, 0.0f, 0.0f);
- cube->entity_location = Vector3f(16.0f, 0.0f, -16.0f);
+ cube->entity_location = Vector3f(16.0f, 16.0f, 0.0f);
cube->entity_name = "cube: Borg cube red";
cube->entity_modelname = "cube";
cube->entity_moduletypeid = cube_enttype;
- // diamond
+ // Thornaider
cube = new core::Entity(core::Entity::Solid & core::Entity::Static);
cube->entity_shape = core::Entity::Diamond;
cube->entity_color = Color(0.5f, 1.0f, 5.0f);
- cube->entity_location = Vector3f(16.0f, 0.0f, -20.0f);
- cube->entity_name = "diamond: big bucks";
+ cube->entity_location = Vector3f(16.0f, 20.0f, 0.0f);
+ cube->entity_name = "wreck: Thornaider";
cube->entity_modelname = "ship";
+ // Micron Vector
+ cube = new core::Entity(core::Entity::Solid & core::Entity::Static);
+ cube->entity_shape = core::Entity::Diamond;
+ cube->entity_color = Color(0.5f, 1.0f, 5.0f);
+ cube->entity_location = Vector3f(18.0f, 22.0f, 0.0f);
+ cube->entity_name = "wreck: Micron Vector";
+ cube->entity_modelname = "micron_vector";
+
// the yellow sphere
core::Entity *sphere = new core::Entity(core::Entity::Solid & core::Entity::Static);
sphere->entity_shape = core::Entity::Sphere;
sphere->entity_color = Color(0.8f, 0.8f, 0.0f);
- sphere->entity_location = Vector3f(0.0f, 0.0f, -32.0f);
+ sphere->entity_location = Vector3f(0.0f, 32.0f, 0.0f);
sphere->entity_name ="sphere: The Sphere";
// the galactic origin
diff --git a/src/game/ship.cc b/src/game/ship.cc
index 1bcdfbf..e2a42d8 100644
--- a/src/game/ship.cc
+++ b/src/game/ship.cc
@@ -61,7 +61,7 @@ void Ship::frame(float seconds)
// location TODO avoid sin/cos calculations
entity_location.x += cosf(entity_direction * M_PI / 180) * entity_speed * seconds;
- entity_location.z -= sinf(entity_direction * M_PI / 180) * entity_speed * seconds;
+ entity_location.y += sinf(entity_direction * M_PI / 180) * entity_speed * seconds;
entity_dirty = true;
}
diff --git a/src/render/model.cc b/src/render/model.cc
index 81d9ee9..e486d75 100644
--- a/src/render/model.cc
+++ b/src/render/model.cc
@@ -27,7 +27,7 @@ std::map<std::string, Model*> Model::registry;
Model::Model(std::string const & name) :
model_name(name)
{
- model_scale = 1.0f / 64.0f;
+ model_scale = 1.0f / 1024.0f;
std::string fn("maps/");
fn.append(name);