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/model/mapfile.cc80
-rw-r--r--src/model/model.cc22
-rw-r--r--src/model/primitives.cc9
3 files changed, 57 insertions, 54 deletions
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index e06de58..359efe7 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -170,7 +170,7 @@ MapFile::~MapFile()
void MapFile::clear_materials()
{
// delete primitives for each material
- for (Materials::iterator mit = map_materials.begin(); mit != map_materials.end(); mit++) {
+ for (Materials::iterator mit = map_materials.begin(); mit != map_materials.end(); ++mit) {
// delete list of primitives
delete(*mit).second;
}
@@ -179,7 +179,7 @@ void MapFile::clear_materials()
map_collisiontriangles.clear();
// delete origin vertices
- for (std::vector<math::Vector3f *>::iterator ovit = class_origin_vertices.begin(); ovit != class_origin_vertices.end(); ovit++) {
+ for (std::vector<math::Vector3f *>::iterator ovit = class_origin_vertices.begin(); ovit != class_origin_vertices.end(); ++ovit) {
delete (*ovit);
}
class_origin_vertices.clear();
@@ -625,12 +625,12 @@ bool MapFile::getline()
// end-of-brush
// for every face
- for (std::vector<Face *>::iterator face = planes.begin(); face != planes.end(); face++) {
+ for (std::vector<Face *>::iterator face = planes.begin(); face != planes.end(); ++face) {
make_brushface((*face));
}
// clean planes
- for (std::vector<Face *>::iterator it = planes.begin(); it != planes.end(); it++) {
+ for (std::vector<Face *>::iterator it = planes.begin(); it != planes.end(); ++it) {
delete(*it);
}
planes.clear();
@@ -786,7 +786,7 @@ void MapFile::make_brushface(Face *face)
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++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
(*it)->get_x() = (-face->d() -
face->normal().z() * (*it)->z() -
face->normal().y() * (*it)->y()) /
@@ -810,7 +810,7 @@ void MapFile::make_brushface(Face *face)
}
// calculate the x coordinate of each face vertex
- for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
(*it)->get_y() = (-face->d() -
face->normal().z() * (*it)->z() -
face->normal().x() * (*it)->x()) /
@@ -834,7 +834,7 @@ void MapFile::make_brushface(Face *face)
}
// calculate the x coordinate of each face vertex
- for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
(*it)->get_z() = (-face->d() -
face->normal().x() * (*it)->x() -
face->normal().y() * (*it)->y()) /
@@ -844,7 +844,7 @@ void MapFile::make_brushface(Face *face)
// intersect the face with every plane
- for (std::vector<Face *>::iterator pit = planes.begin(); pit != planes.end(); pit++) {
+ for (std::vector<Face *>::iterator pit = planes.begin(); pit != planes.end(); ++pit) {
Face *plane = (*pit);
if (plane == face) {
@@ -883,7 +883,7 @@ void MapFile::make_brushface(Face *face)
// find current
std::vector<Vector3f *>::iterator vit = vl.begin();
while ((*vit) != vl.at(i)) {
- vit++;
+ ++vit;
}
// check if prev - v intersects with plane
@@ -905,7 +905,7 @@ void MapFile::make_brushface(Face *face)
}
vit = vl.insert(vit, s);
- vit++;
+ ++vit;
i++;
}
@@ -928,7 +928,7 @@ void MapFile::make_brushface(Face *face)
}
vit = vl.insert(vit, s);
- vit++;
+ ++vit;
i++;
}
@@ -956,14 +956,14 @@ void MapFile::make_brushface(Face *face)
if ((face->material()->flags() & Material::Origin)) {
// add vertices to the origin list
- for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
class_origin_vertices.push_back(new math::Vector3f((*(*it) * SCALE)));
}
} else {
// add vertices to the bounding box
- for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
class_box.expand(*(*it) * SCALE);
}
@@ -1027,7 +1027,7 @@ void MapFile::make_brushface(Face *face)
}
// clean up the vertex list
- for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); it++) {
+ for (std::vector<Vector3f *>::iterator it = vl.begin(); it != vl.end(); ++it) {
delete(*it);
}
@@ -1216,7 +1216,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
// origin bruhes override group center
if (class_origin_vertices.size()) {
math::Vector3f v;
- for (std::vector<math::Vector3f *>::iterator i = class_origin_vertices.begin(); i != class_origin_vertices.end(); i++) {
+ for (std::vector<math::Vector3f *>::iterator i = class_origin_vertices.begin(); i != class_origin_vertices.end(); ++i) {
v += *(*i);
}
@@ -1238,7 +1238,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
break;
}
- for (Materials::iterator mit = map_materials.begin(); mit != map_materials.end(); mit++) {
+ for (Materials::iterator mit = map_materials.begin(); mit != map_materials.end(); ++mit) {
// split the Primitives with this material into fragments
Primitives *primitives = (*mit).second;
@@ -1249,7 +1249,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
if (map_load_clip) {
// clip materials are loaded into the CollisionMesh
- for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); tris_it++) {
+ for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); ++tris_it) {
Triangle *triangle = (*tris_it);
//model->collisionmesh()->add_triangle(triangle->v0(), triangle->v1(), triangle->v2());
map_collisiontriangles.add(*triangle);
@@ -1261,7 +1261,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
Fragment *fragment = new Fragment(Fragment::Triangles, primitives->material());
// add structural triangles to the fragment
- for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); tris_it++) {
+ for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); ++tris_it) {
Triangle *triangle = (*tris_it);
if (!triangle->detail()) {
size_t count = 0;
@@ -1274,7 +1274,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
}
// add detail triangles to the fragment
- for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); tris_it++) {
+ for (Primitives::Triangles::iterator tris_it = primitives->triangles().begin(); tris_it != primitives->triangles().end(); ++tris_it) {
Triangle *triangle = (*tris_it);
if (triangle->detail()) {
size_t count = 0;
@@ -1301,7 +1301,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
Fragment *fragment = new Fragment(Fragment::Quads, primitives->material());
// add structural quads to the fragment
- for (Primitives::Quads::iterator quad_it = primitives->quads().begin(); quad_it != primitives->quads().end(); quad_it++) {
+ for (Primitives::Quads::iterator quad_it = primitives->quads().begin(); quad_it != primitives->quads().end(); ++quad_it) {
Quad *quad = (*quad_it);
if (!quad->detail()) {
size_t count = 0;
@@ -1316,7 +1316,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
}
// add detail quads to the fragment
- for (Primitives::Quads::iterator quad_it = primitives->quads().begin(); quad_it != primitives->quads().end(); quad_it++) {
+ for (Primitives::Quads::iterator quad_it = primitives->quads().begin(); quad_it != primitives->quads().end(); ++quad_it) {
Quad *quad = (*quad_it);
if (quad->detail()) {
size_t count = 0;
@@ -1347,7 +1347,7 @@ void MapFile::load_fragmentgroup(Model *model, const FragmentGroup::Type class_t
CollisionMesh *collisionmesh = new CollisionMesh();
// add clip triangles to collision mesh
- for (TriangleList::iterator it = map_collisiontriangles.begin(); it != map_collisiontriangles.end(); it++) {
+ for (TriangleList::iterator it = map_collisiontriangles.begin(); it != map_collisiontriangles.end(); ++it) {
Triangle *triangle = (*it);
collisionmesh->add_triangle(triangle->v0() - translation, triangle->v1() - translation, triangle->v2() - translation);
}
@@ -1901,7 +1901,7 @@ Model * MapFile::load(std::string const &name)
mapfile.close();
- for (SubModelList::iterator smit = submodel_list.begin(); smit != submodel_list.end(); smit++) {
+ for (SubModelList::iterator smit = submodel_list.begin(); smit != submodel_list.end(); ++smit) {
tag_submodel = (*smit);
Model *submodel_model = 0;
@@ -1940,7 +1940,7 @@ Model * MapFile::load(std::string const &name)
}
// copy fragmentgroups
- for (Model::Groups::iterator git = submodel_model->groups().begin(); git != submodel_model->groups().end(); git++) {
+ for (Model::Groups::iterator git = submodel_model->groups().begin(); git != submodel_model->groups().end(); ++git) {
FragmentGroup *groupsrc = (*git);
FragmentGroup *groupdst = new FragmentGroup();
@@ -1955,7 +1955,7 @@ Model * MapFile::load(std::string const &name)
groupdst->set_axis(tag_submodel->axis() * groupsrc->axis());
// copy fragments, this only copies the original fragment's pointer into the vertex array
- for (FragmentGroup::Fragments::const_iterator fit = groupsrc->fragments().begin(); fit != groupsrc->fragments().end(); fit++) {
+ for (FragmentGroup::Fragments::const_iterator fit = groupsrc->fragments().begin(); fit != groupsrc->fragments().end(); ++fit) {
Fragment *fragmentdst = new Fragment(*(*fit));
groupdst->add_fragment(fragmentdst);
@@ -1982,7 +1982,7 @@ Model * MapFile::load(std::string const &name)
// import submodel collisionmodel meshes
if (mapfile.map_load_clip && submodel_model->collisionmodel()) {
for (CollisionModel::CollisionMeshes::iterator cmit = submodel_model->collisionmodel()->meshes().begin();
- cmit != submodel_model->collisionmodel()->meshes().end(); cmit++) {
+ cmit != submodel_model->collisionmodel()->meshes().end(); ++cmit) {
CollisionMesh *meshsrc = (*cmit);
CollisionMesh *meshdst = new CollisionMesh(*meshsrc);
@@ -1998,7 +1998,7 @@ Model * MapFile::load(std::string const &name)
}
// copy light tags
- for (Model::Lights::const_iterator lit = submodel_model->lights().begin(); lit != submodel_model->lights().end(); lit++) {
+ for (Model::Lights::const_iterator lit = submodel_model->lights().begin(); lit != submodel_model->lights().end(); ++lit) {
tag_light = new Light(*(*lit));
tag_light->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_light->location() - submodel_model->origin()) * tag_submodel->scale());
tag_light->set_radius(tag_light->radius() * tag_submodel->scale());
@@ -2006,7 +2006,7 @@ Model * MapFile::load(std::string const &name)
}
// copy flare tags
- for (Model::Flares::const_iterator flit = submodel_model->flares().begin(); flit != submodel_model->flares().end(); flit++) {
+ for (Model::Flares::const_iterator flit = submodel_model->flares().begin(); flit != submodel_model->flares().end(); ++flit) {
tag_flare = new Flare(*(*flit));
tag_flare->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_flare->location() - submodel_model->origin()) * tag_submodel->scale());
tag_flare->set_radius(tag_flare->radius() * tag_submodel->scale());
@@ -2014,7 +2014,7 @@ Model * MapFile::load(std::string const &name)
}
// copy particle system tags
- for (Model::ParticleSystems::const_iterator pit = submodel_model->particles().begin(); pit != submodel_model->particles().end(); pit++) {
+ for (Model::ParticleSystems::const_iterator pit = submodel_model->particles().begin(); pit != submodel_model->particles().end(); ++pit) {
tag_particles = new Particles(*(*pit));
tag_particles->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_particles->location() - submodel_model->origin()) * tag_submodel->scale());
tag_particles->set_scale(tag_particles->scale() * tag_submodel->scale());
@@ -2022,21 +2022,21 @@ Model * MapFile::load(std::string const &name)
}
// copy sound tags
- for (Model::Sounds::const_iterator sit = submodel_model->sounds().begin(); sit != submodel_model->sounds().end(); sit++) {
+ for (Model::Sounds::const_iterator sit = submodel_model->sounds().begin(); sit != submodel_model->sounds().end(); ++sit) {
tag_sound = new Sound(*(*sit));
tag_sound->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_sound->location() - submodel_model->origin()) * tag_submodel->scale());
model->add_sound(tag_sound);
}
// copy dock tags
- for (Model::Docks::const_iterator dit = submodel_model->docks().begin(); dit != submodel_model->docks().end(); dit++) {
+ for (Model::Docks::const_iterator dit = submodel_model->docks().begin(); dit != submodel_model->docks().end(); ++dit) {
tag_dock = new Dock(*(*dit));
tag_dock->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_dock->location() - submodel_model->origin()) * tag_submodel->scale());
model->add_dock(tag_dock);
}
// copy weapon tags
- for (Model::Weapons::const_iterator wit = submodel_model->weapons().begin(); wit != submodel_model->weapons().end(); wit++) {
+ for (Model::Weapons::const_iterator wit = submodel_model->weapons().begin(); wit != submodel_model->weapons().end(); ++wit) {
tag_weapon = new Weapon(*(*wit));
tag_weapon->get_location().assign(tag_submodel->location() + tag_submodel->axis() * (tag_weapon->location() - submodel_model->origin()) * tag_submodel->scale());
model->add_weapon(tag_weapon);
@@ -2060,7 +2060,7 @@ Model * MapFile::load(std::string const &name)
// translate transformed vertex groups
size_t frags = 0;
- for (Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
+ for (Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); ++git) {
FragmentGroup *fragmentgroup = (*git);
fragmentgroup->set_location(fragmentgroup->location() - map_center);
frags += fragmentgroup->size();
@@ -2079,27 +2079,27 @@ Model * MapFile::load(std::string const &name)
// translate tags
- for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); lit++) {
+ for (Model::Lights::iterator lit = model->lights().begin(); lit != model->lights().end(); ++lit) {
(*lit)->get_location() -= map_center;
}
- for (Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); flit++) {
+ for (Model::Flares::iterator flit = model->flares().begin(); flit != model->flares().end(); ++flit) {
(*flit)->get_location() -= map_center;
}
- for (Model::ParticleSystems::iterator pit = model->particles().begin(); pit != model->particles().end(); pit++) {
+ for (Model::ParticleSystems::iterator pit = model->particles().begin(); pit != model->particles().end(); ++pit) {
(*pit)->get_location() -= map_center;
}
- for(Model::Sounds::iterator sit = model->sounds().begin(); sit != model->sounds().end(); sit++) {
+ for(Model::Sounds::iterator sit = model->sounds().begin(); sit != model->sounds().end(); ++sit) {
(*sit)->get_location() -= map_center;
}
- for (Model::Docks::iterator dit = model->docks().begin(); dit != model->docks().end(); dit++) {
+ for (Model::Docks::iterator dit = model->docks().begin(); dit != model->docks().end(); ++dit) {
(*dit)->get_location() -= map_center;
}
- for (Model::Weapons::iterator wit = model->weapons().begin(); wit != model->weapons().end(); wit++) {
+ for (Model::Weapons::iterator wit = model->weapons().begin(); wit != model->weapons().end(); ++wit) {
(*wit)->get_location() -= map_center;
}
@@ -2115,7 +2115,7 @@ Model * MapFile::load(std::string const &name)
size_t collision_mesh_count = 0; // number of meshes in the collision model
for (CollisionModel::CollisionMeshes::const_iterator cmit = model->collisionmodel()->meshes().begin();
- cmit != model->collisionmodel()->meshes().end(); cmit++) {
+ cmit != model->collisionmodel()->meshes().end(); ++cmit) {
collision_tris_count += (*cmit)->size();
collision_mesh_count++;
diff --git a/src/model/model.cc b/src/model/model.cc
index 304e151..f2fb481 100644
--- a/src/model/model.cc
+++ b/src/model/model.cc
@@ -38,43 +38,43 @@ Model::Model(const std::string & name) :
Model::~Model()
{
// delete all fragment groups
- for (Groups::iterator git = model_groups.begin(); git != model_groups.end(); git++) {
+ for (Groups::iterator git = model_groups.begin(); git != model_groups.end(); ++git) {
delete(*git);
}
model_groups.clear();
// delete all docks
- for (Docks::iterator dit = model_docks.begin(); dit != model_docks.end(); dit++) {
+ for (Docks::iterator dit = model_docks.begin(); dit != model_docks.end(); ++dit) {
delete(*dit);
}
model_docks.clear();
// delete all particle systems
- for (Model::ParticleSystems::iterator pit = model_particles.begin(); pit != model_particles.end(); pit++) {
+ for (Model::ParticleSystems::iterator pit = model_particles.begin(); pit != model_particles.end(); ++pit) {
delete(*pit);
}
model_particles.clear();
// delete all lights
- for (Lights::iterator lit = model_lights.begin(); lit != model_lights.end(); lit++) {
+ for (Lights::iterator lit = model_lights.begin(); lit != model_lights.end(); ++lit) {
delete(*lit);
}
model_lights.clear();
// delete all flares
- for (Flares::iterator flit = model_flares.begin(); flit != model_flares.end(); flit++) {
+ for (Flares::iterator flit = model_flares.begin(); flit != model_flares.end(); ++flit) {
delete(*flit);
}
model_flares.clear();
// delete all sound tags
- for (Sounds::iterator sit = model_sounds.begin(); sit != model_sounds.end(); sit++) {
+ for (Sounds::iterator sit = model_sounds.begin(); sit != model_sounds.end(); ++sit) {
delete (*sit);
}
model_sounds.clear();
// delete all weapon tags
- for (Weapons::iterator wit = model_weapons.begin(); wit != model_weapons.end(); wit++) {
+ for (Weapons::iterator wit = model_weapons.begin(); wit != model_weapons.end(); ++wit) {
delete (*wit);
}
model_weapons.clear();
@@ -152,7 +152,7 @@ Model *Model::search(const std::string & searchname)
return 0;
}
- for (Registry::iterator it = model_registry.begin(); it != model_registry.end(); it++) {
+ for (Registry::iterator it = model_registry.begin(); it != model_registry.end(); ++it) {
std::string label((*it).first);
Model *model= (*it).second;
@@ -194,7 +194,7 @@ Model *Model::load(const std::string & name)
void Model::clear()
{
// delete all models in the registry
- for (Registry::iterator mit = model_registry.begin(); mit != model_registry.end(); mit++) {
+ for (Registry::iterator mit = model_registry.begin(); mit != model_registry.end(); ++mit) {
delete(*mit).second;
}
model_registry.clear();
@@ -206,11 +206,11 @@ void Model::clear()
void Model::list()
{
- for (Registry::iterator mit = model_registry.begin(); mit != model_registry.end(); mit++) {
+ for (Registry::iterator mit = model_registry.begin(); mit != model_registry.end(); ++mit) {
Model *model = (*mit).second;
size_t frags = 0;
- for (Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
+ for (Groups::iterator git = model->groups().begin(); git != model->groups().end(); ++git) {
frags += (*git)->size();
}
diff --git a/src/model/primitives.cc b/src/model/primitives.cc
index 85b07ee..e58bd14 100644
--- a/src/model/primitives.cc
+++ b/src/model/primitives.cc
@@ -17,13 +17,15 @@ Primitives::Primitives(Material *material)
Primitives::~Primitives()
{
// clear list of triangles
- for (std::list<Triangle *>::iterator tris_it = primitives_triangles.begin(); tris_it != primitives_triangles.end(); tris_it++)
+ for (std::list<Triangle *>::iterator tris_it = primitives_triangles.begin(); tris_it != primitives_triangles.end(); ++tris_it) {
delete(*tris_it);
+ }
primitives_triangles.clear();
// clear list of quads
- for (std::list<Quad *>::iterator quad_it = primitives_quads.begin(); quad_it != primitives_quads.end(); quad_it++)
+ for (std::list<Quad *>::iterator quad_it = primitives_quads.begin(); quad_it != primitives_quads.end(); ++quad_it) {
delete(*quad_it);
+ }
primitives_quads.clear();
}
@@ -37,4 +39,5 @@ void Primitives::add_quad(Quad *quad)
primitives_quads.push_back(quad);
}
-}
+} // namespace model
+