const Matrix Object::identity_matrix;
Object::Object():
- lods(1),
- lod0_watched(false)
+ lods(1)
{ }
Object::Object(const Mesh *m, const Technique *t):
- lods(1),
- lod0_watched(false)
+ Object()
{
set_mesh(m);
set_technique(t);
}
-// TODO should have copy-c'tor to set watch on lod0 mesh if necessary
+Object::Object(const Object &other):
+ lods(other.lods),
+ bounding_sphere(other.bounding_sphere)
+{
+ if(other.lod0_watched)
+ watch_lod0();
+}
+
+Object::Object(Object &&other):
+ lods(move(other.lods)),
+ bounding_sphere(move(other.bounding_sphere))
+{
+ if(other.lod0_watched)
+ watch_lod0();
+}
Object::~Object()
{
lod0_watched = false;
if(i==0 && m)
- if(ResourceManager *rm = m->get_manager())
- {
- rm->observe_resource(*m, *this);
- lod0_watched = true;
- }
+ watch_lod0();
update_bounding_sphere();
}
+void Object::watch_lod0()
+{
+ if(ResourceManager *rm = lods[0].mesh->get_manager())
+ {
+ rm->observe_resource(*lods[0].mesh, *this);
+ lod0_watched = true;
+ }
+}
+
void Object::update_bounding_sphere()
{
vector<Vector3> points;