From 80aaacbaef16b4eba33428aec268f80e7466cbb1 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 16 Aug 2009 21:23:47 +0000 Subject: minor cleanups, corrected map widget --- doc/index.html | 4 ++-- osirion.kdevelop | 2 +- src/client/map.cc | 4 ++-- src/core/gameinterface.cc | 2 +- src/model/asefile.cc | 2 +- src/model/face.h | 31 +++++++++++++++++++++++-------- src/model/mapfile.cc | 17 ++++++++--------- src/model/model.cc | 16 +++++++++++----- src/model/parts.h | 18 ++++++++++-------- 9 files changed, 59 insertions(+), 37 deletions(-) diff --git a/doc/index.html b/doc/index.html index 25707cc..9c9f48a 100644 --- a/doc/index.html +++ b/doc/index.html @@ -108,7 +108,7 @@ http://ingar.satgnu.net/osirion

- The official Osirion IRC channel is #osirion on irc.soliter.org. + The official IRC channel is #osirion on the FreeNode IRC network.

@@ -130,7 +130,7 @@ of authors and copyright.

- Copyright © 2007-2008
+ Copyright © 2007-2009
Stijn "Ingar" Buys <ingar@telenet.be>

diff --git a/osirion.kdevelop b/osirion.kdevelop index 65328ac..105213e 100644 --- a/osirion.kdevelop +++ b/osirion.kdevelop @@ -21,7 +21,7 @@ - src/model/libmodel.la + src/render/librender.la debug diff --git a/src/client/map.cc b/src/client/map.cc index 46ac583..aca5e97 100644 --- a/src/client/map.cc +++ b/src/client/map.cc @@ -106,7 +106,7 @@ void Map::draw() size_t texture_current = render::Textures::bind(texture_entity); v[0] += s * 0.5f; - v[0] += s * 0.5f; + v[1] += s * 0.5f; core::Zone *zone = core::localplayer()->zone(); @@ -127,7 +127,7 @@ void Map::draw() l.assign(v); if (targets::is_valid_map_target(entity)) { - draw_icon = true; + draw_icon = true; l[0] -= s / scale * entity->location().y(); l[1] -= s / scale * entity->location().x(); diff --git a/src/core/gameinterface.cc b/src/core/gameinterface.cc index 4b66489..ce011dd 100644 --- a/src/core/gameinterface.cc +++ b/src/core/gameinterface.cc @@ -73,7 +73,7 @@ GameInterface::GameInterface() // size of the vertex array in megabytes Cvar::sv_arraysize = core::Cvar::get("sv_arraysize", 128.0f , core::Cvar::Archive); - Cvar::sv_arraysize->set_info("[int] size of the vertex array in MegabBytes"); + Cvar::sv_arraysize->set_info("[int] size of the vertex array in megabyte"); size_t mb = (size_t) Cvar::sv_arraysize->value(); if (mb < 4 * sizeof(float)) 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; } -- cgit v1.2.3