X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fobject.h;h=7d9f1619d58e5846759a68cc753f9951ad3808b6;hb=175153f224916b92d02a325aac5628956cda8daf;hp=80a73cba61e2caf6ac53281af7bb7ded14c303e8;hpb=ae45c0397e2cb8f0a01f2f31d01c95ff3870271e;p=libs%2Fgl.git diff --git a/source/render/object.h b/source/render/object.h index 80a73cba..7d9f1619 100644 --- a/source/render/object.h +++ b/source/render/object.h @@ -14,16 +14,19 @@ class ObjectInstance; class Technique; /** -Combines a Mesh with a Technique to give it an appearance. The Technique will -define which render passes the Object supports. +Combines a Mesh with a Technique for a complete model. -In many cases, it's desirable to include multiple copies of an Object in a -Scene, with different model matrices. ObjectInstances can be used to alter the -rendering of an object on a per-instance basis. +An object does not have a model matrix and will be rendered at origin if used +by itself. The ObjectInstance class provides a way to position objects in a +scene and customize them in other ways. -Objects can have multiple levels of detail. The most detailed level has index -0, with increasing indices having less detail. When rendering an instance, the -instance's get_level_of_detail method is called to determine which LoD to use. +Objects can have multiple levels of detail, with different resources. The most +detailed level has index 0, with increasing indices having less detail. When +rendering an instance, the instance's get_level_of_detail method is called to +determine which LoD to use. + +An Object can be rendered with any tag its Technique supports. Unknown tags +are silently ignored. */ class Object: public Renderable, private ResourceObserver { @@ -67,7 +70,7 @@ private: std::vector lods; Geometry::BoundingSphere bounding_sphere; - bool lod0_watched; + bool lod0_watched = false; static const Matrix identity_matrix; @@ -83,8 +86,9 @@ public: /** Sets the mesh for the highest level of detail (index 0). */ void set_mesh(const Mesh *m) { set_mesh(0, m); } - /** Sets the mesh for a given level of detail. Previous LoDs must have been - defined. */ + /** Sets the mesh for a specific level of detail. LoDs must be defined in + order, without gaps. If this call creates a new LoD, technique is copied + from the previous one. */ void set_mesh(unsigned, const Mesh *); private: @@ -95,8 +99,9 @@ public: /** Sets the technique for the highest level of detail (index 0). */ void set_technique(const Technique *t) { set_technique(0, t); } - /** Sets the technique for a given level of detail. Previous LoDs must have - been defined. */ + /** Sets the technique for a specific level of detail. LoDs must be defined + in order, without gaps. If this call creates a new LoD, mesh is copied from + the previous one. */ void set_technique(unsigned, const Technique *); const Technique *get_technique(unsigned = 0) const;