lods(1)
{ }
-Object::Object(const Mesh *m, const Technique *t)
+Object::Object(const Mesh *m, const Technique *t):
+ lods(1)
{
set_mesh(m);
set_technique(t);
vector<Vector3> points;
for(vector<LevelOfDetail>::const_iterator i=lods.begin(); i!=lods.end(); ++i)
{
- if(!i->mesh)
+ if(!i->mesh || !i->mesh->is_loaded())
continue;
const VertexArray &vertices = i->mesh->get_vertices();
}
}
+ /* Don't touch the bounding sphere if we had no vertices to avoid
+ overwriting a possible hint. */
+ if(points.empty())
+ return;
+
bounding_sphere = Geometry::BoundingSphere<float, 3>::from_point_cloud(points.begin(), points.end());
}
void Object::Loader::init()
{
+ add("bounding_sphere_hint", &Loader::bounding_sphere_hint);
add("level_of_detail", &Loader::level_of_detail);
}
obj.update_bounding_sphere();
}
+void Object::Loader::bounding_sphere_hint(float x, float y, float z, float r)
+{
+ obj.bounding_sphere = Geometry::BoundingSphere<float, 3>(Vector3(x, y, z), r);
+}
+
void Object::Loader::level_of_detail(unsigned i)
{
LodLoader ldr(obj, i, coll);