]> git.tdb.fi Git - libs/gl.git/blob - source/objectinstance.h
Add a Tag class to identify passes
[libs/gl.git] / source / objectinstance.h
1 /* $Id$
2
3 This file is part of libmspgl
4 Copyright © 2007  Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_GL_OBJETCINSTANCE_H_
9 #define MSP_GL_OBJETCINSTANCE_H_
10
11 #include <string>
12 #include "renderable.h"
13
14 namespace Msp {
15 namespace GL {
16
17 class Object;
18 class ProgramData;
19
20 class ObjectPass;
21
22 /**
23 Represents a single instance of an Object.  An application can derive another
24 class from this and overload the hook functions to specify location and other
25 instance-specific parameters for the rendered objects.
26 */
27 class ObjectInstance: public Renderable
28 {
29 protected:
30         const Object &object;
31
32 public:
33         ObjectInstance(const Object &);
34
35         const Object &get_object() const { return object; }
36
37         virtual bool has_pass(const Tag &tag) const;
38
39         virtual void render(const Tag &tag=Tag()) const;
40
41         /**
42         Hook function, called from Object just before rendering the mesh.
43         */
44         virtual void setup_render(const ObjectPass &) const { }
45
46         /**
47         Hook function, called from Object right after rendering the mesh.
48         */
49         virtual void finish_render(const ObjectPass &) const { }
50
51         virtual unsigned get_level_of_detail() const { return 0; }
52 };
53
54 } // namespace GL
55 } // namespaec Msp
56
57 #endif