]> git.tdb.fi Git - libs/gl.git/blobdiff - source/object.h
Fix various issues with constant condition elimination
[libs/gl.git] / source / object.h
index a11bfd9b654d0ffa98887fefcb2c886a360e1d98..48e3045930559fd354af6d868a935100a2fab09d 100644 (file)
@@ -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;
@@ -72,6 +72,9 @@ private:
 
        std::vector<LevelOfDetail> lods;
        Geometry::BoundingSphere<float, 3> bounding_sphere;
+       bool lod0_watched;
+
+       static Matrix identity_matrix;
 
 public:
        Object();
@@ -104,10 +107,9 @@ public:
        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<float, 3> *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
@@ -122,6 +124,7 @@ private:
        const RenderPass *get_pass(const Tag &, unsigned) const;
 
        virtual void resource_loaded(Resource &);
+       virtual void resource_removed(Resource &);
 };
 
 } // namespace GL