Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2009-08-16 21:23:47 +0000
committerStijn Buys <ingar@osirion.org>2009-08-16 21:23:47 +0000
commit80aaacbaef16b4eba33428aec268f80e7466cbb1 (patch)
treef157011d8e97d490ec3a9b0e8b28980f091de87b /src/model
parentd763e294f44eb38b94bf7e2055b77a982b72b7c0 (diff)
minor cleanups, corrected map widget
Diffstat (limited to 'src/model')
-rw-r--r--src/model/asefile.cc2
-rw-r--r--src/model/face.h31
-rw-r--r--src/model/mapfile.cc17
-rw-r--r--src/model/model.cc16
-rw-r--r--src/model/parts.h18
5 files changed, 53 insertions, 31 deletions
diff --git a/src/model/asefile.cc b/src/model/asefile.cc
index 17169f4..6010947 100644
--- a/src/model/asefile.cc
+++ b/src/model/asefile.cc
@@ -467,7 +467,7 @@ Model * ASEFile::load(const std::string &name)
model->add_group(group);
con_debug << " " << asefile.name() << " " << asefile.ase_vertexlist.size() << " vertices " <<
- model->model_tris_count << "/" << model->model_tris_detail_count << " tris/detail" << std::endl;
+ model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris" << std::endl;
return model;
}
diff --git a/src/model/face.h b/src/model/face.h
index 8c75522..725f798 100644
--- a/src/model/face.h
+++ b/src/model/face.h
@@ -73,28 +73,43 @@ public:
}
/// indidcates if this plane was generated from a detail brush
- inline bool & detail()
+ inline bool detail() const
{
return face_detail;
}
/// surface flags
- inline unsigned int & surface_flags()
+ inline unsigned int surface_flags() const
{
return face_surface_flags;
}
- /// return texture transformation vectors
- /// @param index 0 <= i < 2
- inline math::Vector3f &tex_vec(size_t index) { return face_tex_vec[index]; }
+ /**
+ * @brief return texture transformation vectors
+ * @param index 0 <= i < 2
+ */
+ inline const math::Vector3f &tex_vec(size_t index) {
+ return face_tex_vec[index];
+ }
/// return texture shift
- inline math::Vector2f &tex_shift() { return face_tex_shift; }
-
+ inline const math::Vector2f &tex_shift() { return face_tex_shift; }
inline void set_material(Material *material) { face_material = material; }
-
+ inline void set_detail(const bool detail = true) { face_detail = detail; }
+
+ inline void set_surface_flags(const unsigned int flags) { face_surface_flags = flags; }
+
+ /**
+ * @brief return texture transformation vectors
+ * @param index 0 <= i < 2
+ */
+ inline math::Vector3f &get_tex_vec(size_t index) { return face_tex_vec[index]; }
+
+ /// return texture shift
+ inline math::Vector2f &get_tex_shift() { return face_tex_shift; }
+
private:
math::Vector3f face_normal;
math::Vector3f face_point[3];
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index cc96051..575232e 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -121,9 +121,9 @@ void face_texture_verts(Face &face, const math::Vector2f &tex_shift, const float
for (i=0 ; i<2 ; i++)
for (j=0 ; j<3 ; j++)
- face.tex_vec(i)[j] = vecs[i][j] / scale[i];
+ face.get_tex_vec(i)[j] = vecs[i][j] / scale[i];
- face.tex_shift().assign(tex_shift);
+ face.get_tex_shift().assign(tex_shift);
}
// from radiant tools/quake3/q3map2/map.c
@@ -131,8 +131,8 @@ void face_texture_verts(Face &face, const math::Vector2f &tex_shift, const float
const math::Vector2f map_texture_coords(Face *face, const math::Vector3f &v)
{
return math::Vector2f (
- (face->tex_shift().x() + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(),
- (face->tex_shift().y() + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height()
+ (face->get_tex_shift().x() + math::dotproduct(face->tex_vec(0), v)) / face->material()->size().width(),
+ (face->get_tex_shift().y() + math::dotproduct(face->tex_vec(1), v)) / face->material()->size().height()
);
}
@@ -395,14 +395,14 @@ bool MapFile::getline()
if (!(linestream >> n))
n = 0;
if (n > 0)
- face->detail() = true;
+ face->set_detail();
// surface flags
if (!(linestream >> n)) {
n = 0;
warning_q2brush = true;
}
- face->surface_flags() = n;
+ face->set_surface_flags(n);
planes.push_back(face);
@@ -1462,9 +1462,8 @@ Model * MapFile::load(std::string const &name)
}
con_debug << " " << mapfile.name() << " " << mapfile.map_brushes << " brushes " <<
- model->model_tris_count << "/" << model->model_tris_detail_count << " tris/detail " <<
- model->model_quad_count << "/" << model->model_quad_detail_count << " quads/detail" <<
- std::endl;
+ model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris " <<
+ model->model_quad_detail_count << "/" << model->model_quad_count << " detail/quads" << std::endl;
if (mapfile.warning_q2brush)
con_warn << " quake2 style brushes detected" << std::endl;
diff --git a/src/model/model.cc b/src/model/model.cc
index 3f0b00b..2b3ec7a 100644
--- a/src/model/model.cc
+++ b/src/model/model.cc
@@ -151,8 +151,8 @@ void Model::list_model(Model *model)
}
con_print << " " << model->name() << " " << frags << " frags " <<
- model->model_tris_count << "/" << model->model_tris_detail_count << " tris/detail " <<
- model->model_quad_count << "/" << model->model_quad_detail_count << " quads/detail" << std::endl;
+ model->model_tris_detail_count << "/" << model->model_tris_count << " detail/tris " <<
+ model->model_quad_detail_count << "/" << model->model_quad_count << " detail/quads" << std::endl;
}
void Model::list()
@@ -163,9 +163,15 @@ void Model::list()
}
con_print << model_registry.size() << " registered models" << std::endl;
- if (VertexArray::instance())
- con_print << "vertex array " << (VertexArray::instance()->index() * 100 / VertexArray::instance()->size())
- << "% of " << VertexArray::instance()->size() * 4 *sizeof(float) / (1024*1024) << "Mb used" << std::endl;
+ if (VertexArray::instance()) {
+
+ con_print << "vertex array "
+ << VertexArray::instance()->index() * 3 * sizeof(float) / (1024*1024) << "/"
+ << VertexArray::instance()->size() * 3 * sizeof(float) / (1024*1024) << "Mb "
+ << VertexArray::instance()->index() / 3 << "/" << VertexArray::instance()->size() / 3 << " verts "
+ << (VertexArray::instance()->index() * 100 / VertexArray::instance()->size())<< "% used"
+ << std::endl;
+ }
}
}
diff --git a/src/model/parts.h b/src/model/parts.h
index 5c90efb..210a225 100644
--- a/src/model/parts.h
+++ b/src/model/parts.h
@@ -259,12 +259,12 @@ public:
/* ---- inspectors ----------------------------------------- */
- inline const math::Axis axis() const
+ inline const math::Axis &axis() const
{
return flare_axis;
}
- inline const Cull cull() const
+ inline Cull cull() const
{
return flare_cull;
}
@@ -292,7 +292,9 @@ class Particles : public Part
{
public:
Particles();
+
Particles(const math::Vector3f & location);
+
~Particles();
inline const math::Axis &axis() const
@@ -305,22 +307,22 @@ public:
return particles_script;
}
- inline const bool entity() const
+ inline bool entity() const
{
return particles_entity;
}
- inline const bool engine() const
+ inline bool engine() const
{
return particles_engine;
}
- inline const float radius() const
+ inline float radius() const
{
return particles_radius;
}
- inline const Cull cull() const
+ inline Cull cull() const
{
return particles_cull;
}
@@ -404,10 +406,10 @@ public:
inline const std::string& name() const { return submodel_name; }
- inline const float scale() const { return submodel_scale; }
-
inline const math::Axis& axis() const { return submodel_axis; }
+ inline float scale() const { return submodel_scale; }
+
inline void set_scale(const float scale) { submodel_scale = scale; }