]> git.tdb.fi Git - libs/gl.git/commitdiff
Add some accessors
authorMikko Rasa <tdb@tdb.fi>
Wed, 10 Dec 2014 16:08:09 +0000 (18:08 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 10 Dec 2014 16:08:09 +0000 (18:08 +0200)
source/lighting.cpp
source/lighting.h
source/object.h
source/program.h
source/texturing.cpp
source/texturing.h

index 239bdc19d0d03fdb9d0bcfaf58902d4c12abf4f6..a927d622fade9b0c81a916f51ef31bce079bf825 100644 (file)
@@ -58,6 +58,11 @@ void Lighting::detach(unsigned i)
                Light::unbind_from(i);
 }
 
+const Light *Lighting::get_attached_light(unsigned i) const
+{
+       return i<lights.size() ? lights[i] : 0;
+}
+
 void Lighting::update_shader_data(ProgramData &shdata, const Matrix &view_matrix) const
 {
        shdata.uniform("ambient_color", ambient);
index 5469cef5a8df3755d5c2fbb7dd13a734855d62ca..8b3feb5f343af74622aa26b8b9689697a8da09a3 100644 (file)
@@ -52,6 +52,10 @@ public:
        /** Detaches a light source. */
        void detach(unsigned);
 
+       /** Returns an attached light.  If no light is attached at that index, null
+       is returned. */
+       const Light *get_attached_light(unsigned) const;
+
        /** Updates a ProgramData object with the uniforms for the Lighting,
        including all attached light sources.  A view matrix must be passed in. */
        void update_shader_data(ProgramData &, const Matrix &) const;
index 95ba8fabc5d746bb3b41453632b340dea7673f74..192cf069bd8f4c8bf1b8a9ca801f5682e7fe4876 100644 (file)
@@ -101,6 +101,7 @@ public:
        void set_technique(unsigned, const Technique *);
 
        const Technique *get_technique(unsigned = 0) const;
+       unsigned get_n_lods() const { return lods.size(); }
 
        virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
 
index 4feb862d29483cf99359e52750d671726e1175ef..53daaa76caad73669d09aaab4ba21453e9a3b107 100644 (file)
@@ -90,7 +90,7 @@ public:
        void attach_shader(Shader &shader);
        void attach_shader_owned(Shader *shader);
        void detach_shader(Shader &shader);
-       const ShaderList &get_shaders() const { return shaders; }
+       const ShaderList &get_attached_shaders() const { return shaders; }
 
        void bind_attribute(unsigned, const std::string &);
        void bind_attribute(VertexComponent, const std::string &);
index 093c602e917c2ec7bf3ee67a626eedb4f4e43ab4..dff3757fdb6d9b8985234e87241153d94b41a80b 100644 (file)
@@ -37,6 +37,11 @@ void Texturing::set_attachment(unsigned attch, const Texture *tex)
                bind_attachment(attch);
 }
 
+const Texture *Texturing::get_attached_texture(unsigned i) const
+{
+       return i<attachments.size() ? attachments[i] : 0;
+}
+
 void Texturing::bind_attachment(unsigned i) const
 {
        if(const Texture *tex = attachments[i])
index 34141c64136fb4d4d0dac7dfbdc90e76cbad6ba0..0b3a9751b5f98ebe17f6e55a48fe3d4a998b92c1 100644 (file)
@@ -21,6 +21,10 @@ public:
        void detach(unsigned);
 private:
        void set_attachment(unsigned, const Texture *);
+public:
+       const Texture *get_attached_texture(unsigned) const;
+
+private:
        void bind_attachment(unsigned) const;
 
        static void unbind_attachment(unsigned);