Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/game.cc12
-rw-r--r--src/render/model.cc20
2 files changed, 20 insertions, 12 deletions
diff --git a/src/game/game.cc b/src/game/game.cc
index 5157270..cf9f496 100644
--- a/src/game/game.cc
+++ b/src/game/game.cc
@@ -83,8 +83,8 @@ void Game::init()
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_name ="cube: Borg cube green";
- cube->entity_modelname = "cube";
+ cube->entity_name ="ccube: Borg cube green";
+ cube->entity_modelname = "ccube";
cube->entity_moduletypeid = cube_enttype;
// the red cube
@@ -96,6 +96,14 @@ void Game::init()
cube->entity_modelname = "cube";
cube->entity_moduletypeid = cube_enttype;
+ // diamond
+ 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_modelname = "ship";
+
// the yellow sphere
core::Entity *sphere = new core::Entity(core::Entity::Solid & core::Entity::Static);
sphere->entity_shape = core::Entity::Sphere;
diff --git a/src/render/model.cc b/src/render/model.cc
index f048b7f..5019c7e 100644
--- a/src/render/model.cc
+++ b/src/render/model.cc
@@ -135,7 +135,7 @@ Model::Model(std::string const & name) :
ifs.close();
- con_debug << "Loaded model " << name << " with " << model_face.size() << " polygons\n";
+ con_debug << " maps/" << name << ".map " << model_face.size() << " polygons\n";
}
Model::~Model()
@@ -165,10 +165,10 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
vl.push_back(new math::Vector3f(0, -MAX_BOUNDS, MAX_BOUNDS));
vl.push_back(new math::Vector3f(0, MAX_BOUNDS, MAX_BOUNDS));
vl.push_back(new math::Vector3f(0, MAX_BOUNDS, -MAX_BOUNDS));
-
+
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->x = ( face->d() -
+ (*it)->x = ( -face->d() -
face->normal().z * (*it)->z -
face->normal().y * (*it)->y ) /
face->normal().x;
@@ -185,7 +185,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->y = ( face->d() -
+ (*it)->y = ( -face->d() -
face->normal().z * (*it)->z -
face->normal().x * (*it)->x ) /
face->normal().y;
@@ -202,7 +202,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
// calculate the x coordinate of each face vertex
for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
- (*it)->z = ( face->d() -
+ (*it)->z = ( -face->d() -
face->normal().x * (*it)->x -
face->normal().y * (*it)->y ) /
face->normal().z;
@@ -289,10 +289,10 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
// calculate intersection
// calculate intersection
- float t1 = -plane->normal().x * next.x - plane->normal().y * next.y - plane->normal().z * next.z -plane->d();
- float t2 = (plane->normal().x * v.x - plane->normal().x * next.x +
- plane->normal().y * v.y - plane->normal().y * next.y +
- plane->normal().z * v.z - plane->normal().z * next.z);
+ float t1 = -plane->normal().x * v.x - plane->normal().y * v.y - plane->normal().z * v.z -plane->d();
+ float t2 = (plane->normal().x * next.x - plane->normal().x * v.x +
+ plane->normal().y * next.y - plane->normal().y * v.y +
+ plane->normal().z * next.z - plane->normal().z * v.z);
//cout << "next t2 " << t2 << std::endl;
Vector3f *s = new Vector3f;
@@ -300,7 +300,7 @@ void Model::make_face(math::Plane3f *face, std::vector<math::Plane3f *> & planes
*s = v;
} else {
for (int j = 0; j < 3; j++)
- (*s)[j] = next [j] + t1 * ( v[j] - next[j]) / t2;
+ (*s)[j] = v [j] + t1 * ( next[j] - v[j]) / t2;
}
//cout << " added " << *s << std::endl;