Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--developer/TODO6
-rw-r--r--src/model/asefile.cc2
-rw-r--r--src/model/mapfile.cc32
-rw-r--r--src/render/draw.cc1
4 files changed, 27 insertions, 14 deletions
diff --git a/developer/TODO b/developer/TODO
index 2e0ba91..97ef271 100644
--- a/developer/TODO
+++ b/developer/TODO
@@ -79,17 +79,17 @@ client:
(ok) testmodel functionality
render:
- disable texturing and lighting while drawing normals
+ correct Camera::axis when using ModelView (-> flare axis in testmodel)
fix skybox envmapping -> cube map
star light strenght
general globe texture stretching, coordinates seem to be off
(ok) have r_loadmodels load particle scripts and flare textures
+ (ok) disable texturing and lighting while drawing normals
(unfixable) globe texture distortion at the poles
ui:
-
unify event handlers, expand Event class and make derived event classes
listview scrolling
@@ -108,7 +108,7 @@ sound:
(ok) suppress error message spam if the sound subsystem failed to initialize
game:
- add Ship::ship_dock, making docking indepdendent of player->view()
+ add Ship::ship_dock, making docking independent of player->view()
have the goto command check the target's Docked state -> ties into ship dock awereness
ship health/shield/armor
diff --git a/src/model/asefile.cc b/src/model/asefile.cc
index 64b38d3..74076c1 100644
--- a/src/model/asefile.cc
+++ b/src/model/asefile.cc
@@ -675,7 +675,7 @@ Model *ASEFile::load(const std::string &name)
asefile.box().max() - ase_center
);
model->set_radius(model->box().max().length());
- model->set_origin(ase_center);
+ model->set_origin(ase_center * -1.0f);
asefile.fragmentgroup()->set_transform(true);
asefile.fragmentgroup()->set_location(ase_center * -1.0f);
diff --git a/src/model/mapfile.cc b/src/model/mapfile.cc
index c016659..09bb3af 100644
--- a/src/model/mapfile.cc
+++ b/src/model/mapfile.cc
@@ -1675,9 +1675,29 @@ Model * MapFile::load(std::string const &name)
}
if (submodel_model) {
- tag_submodel->get_location() += submodel_model->origin() * tag_submodel->scale();
+ tag_submodel->get_location() -= submodel_model->origin() * tag_submodel->scale();
- // copy fragmentgroups
+ // adjust the submodel bounding box to the origin
+ const math::Vector3f min((submodel_model->model_box.min() - submodel_model->origin()) * tag_submodel->scale());
+ const math::Vector3f max((submodel_model->model_box.max() - submodel_model->origin()) * tag_submodel->scale());
+
+ math::Vector3f cube[8];
+ cube[0].assign(min.x(), min.y(), min.z());
+ cube[1].assign(min.x(), max.y(), min.z());
+ cube[2].assign(max.x(), min.y(), min.z());
+ cube[3].assign(max.x(), max.y(), min.z());
+
+ cube[4].assign(min.x(), min.y(), max.z());
+ cube[5].assign(min.x(), max.y(), max.z());
+ cube[6].assign(max.x(), min.y(), max.z());
+ cube[7].assign(max.x(), max.y(), max.z());
+
+ for (size_t i = 0; i < 8; i++) {
+ // rotate the bounding box around the origin
+ mapfile.map_box.expand(tag_submodel->location() + tag_submodel->axis() * cube[i] + submodel_model->origin() * tag_submodel->scale());
+ }
+
+ // copy fragmentgroups
for (Model::Groups::iterator git = submodel_model->groups().begin(); git != submodel_model->groups().end(); git++) {
FragmentGroup *groupsrc = (*git);
FragmentGroup *groupdst = new FragmentGroup();
@@ -1715,12 +1735,6 @@ Model * MapFile::load(std::string const &name)
}
}
- // add the scaled submodel bounding box to the map bounding box
- mapfile.map_box.expand(
- tag_submodel->location() + submodel_model->model_box.min() * tag_submodel->scale(),
- tag_submodel->location() + submodel_model->model_box.max() * tag_submodel->scale()
- );
-
// copy light tags
for (Model::Lights::const_iterator lit = submodel_model->lights().begin(); lit != submodel_model->lights().end(); lit++) {
tag_light = new Light(*(*lit));
@@ -1769,7 +1783,7 @@ Model * MapFile::load(std::string const &name)
);
model->set_radius(model->box().max().length());
- model->set_origin(map_center);
+ model->set_origin(map_center * -1.0f);
// translate transformed vertex groups
for (Model::Groups::iterator git = model->groups().begin(); git != model->groups().end(); git++) {
diff --git a/src/render/draw.cc b/src/render/draw.cc
index 6f97e99..30271f5 100644
--- a/src/render/draw.cc
+++ b/src/render/draw.cc
@@ -609,7 +609,6 @@ void draw_model_fragments(model::Model *model,
const float rotation_angle = math::degrees360f((group->engine() ? enginetime : core::application()->time()) * group->speed());
gl::rotate(-rotation_angle, group->axis().forward());
} else {
- // FIXME group origin is lost
gl::multmatrix(group->axis());
}