X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fobject.h;h=48e3045930559fd354af6d868a935100a2fab09d;hp=95ba8fabc5d746bb3b41453632b340dea7673f74;hb=49f1812b3e5ad73748015df52d0e4dee17246036;hpb=5b532dcb2a4a2d15d0b6607374284c979ece36a8 diff --git a/source/object.h b/source/object.h index 95ba8fab..48e30459 100644 --- a/source/object.h +++ b/source/object.h @@ -5,7 +5,7 @@ #include "bindable.h" #include "renderable.h" #include "renderpass.h" -#include "resourcewatcher.h" +#include "resourceobserver.h" namespace Msp { namespace GL { @@ -28,7 +28,7 @@ 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. */ -class Object: public Renderable, private ResourceWatcher +class Object: public Renderable, private ResourceObserver { private: struct LevelOfDetail; @@ -59,6 +59,7 @@ public: void init(); virtual void finish(); + void bounding_sphere_hint(float, float, float, float); void level_of_detail(unsigned); }; @@ -71,6 +72,9 @@ private: std::vector lods; Geometry::BoundingSphere bounding_sphere; + bool lod0_watched; + + static Matrix identity_matrix; public: Object(); @@ -101,11 +105,11 @@ public: void set_technique(unsigned, const Technique *); const Technique *get_technique(unsigned = 0) const; + unsigned get_n_lods() const { return lods.size(); } + virtual const Matrix *get_matrix() const { return &identity_matrix; } virtual const Geometry::BoundingSphere *get_bounding_sphere() const { return &bounding_sphere; } - virtual void render(const Tag &tag = Tag()) const; - virtual void render(Renderer &, const Tag & = Tag()) const; /** Renders an instance of the object. The instance's hook functions are @@ -120,6 +124,7 @@ private: const RenderPass *get_pass(const Tag &, unsigned) const; virtual void resource_loaded(Resource &); + virtual void resource_removed(Resource &); }; } // namespace GL