From 912ebb62d5e8602a196a59887ef4d41cf0d6edbf Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 9 Mar 2008 11:04:35 +0000 Subject: fixed sphere black hole, added basic HUD with speed and direction indicator, basic shaped entities readable from world.ini --- src/core/entity.cc | 3 +++ src/core/entity.h | 2 +- src/core/model.cc | 25 ++++++++++++++++++++----- 3 files changed, 24 insertions(+), 6 deletions(-) (limited to 'src/core') diff --git a/src/core/entity.cc b/src/core/entity.cc index 891c758..36868af 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -98,6 +98,9 @@ Entity::Entity(unsigned int flags) : entity_destroyed = false; entity_dirty = false; + entity_modelname.clear(); + entity_name.clear(); + add(this); } diff --git a/src/core/entity.h b/src/core/entity.h index d887bc1..0eda501 100644 --- a/src/core/entity.h +++ b/src/core/entity.h @@ -33,7 +33,7 @@ public: enum Type {Default=0, Dynamic=1, Controlable=2}; /// Entity shape constants - enum Shape {Diamond=0, Sphere=1, Cube=2}; + enum Shape {Diamond=0, Sphere=1, Cube=2, Axis=3}; /// create a new entity and add it to the registry Entity(unsigned int flags = 0); diff --git a/src/core/model.cc b/src/core/model.cc index 1e571c3..52f0dde 100644 --- a/src/core/model.cc +++ b/src/core/model.cc @@ -453,16 +453,31 @@ void Model::make_face(math::Plane3f *face, std::vector & planes color = 0; } else color = new math::Color(1.0f, 0.0, 1.0f); - + + /* + // split face into triangles + while (vl.size() >2 ) { + std::vector::iterator v0 = vl.begin(); + std::vector::reverse_iterator vn = vl.rbegin(); + std::vector::reverse_iterator vn1 = vl.rbegin(); + ++vn1; + */ Face *mf = new Face(face->normal()*-1, color); - if (color) delete color; - for (std::vector::iterator it = vl.begin(); it != vl.end(); it++) { mf->add_vertex(*(*it) * model_scale); } - - //con_debug << "adding face\n"; add_face(mf); + /* + mf->add_vertex(*(*vn) * model_scale); + mf->add_vertex(*(*v0) * model_scale); + mf->add_vertex(*(*vn1) * model_scale); + add_face(mf); + + vl.pop_back(); + } + */ + + if (color) delete color; } else { con_debug << "Unresolved face!\n"; } -- cgit v1.2.3