]> git.tdb.fi Git - libs/gl.git/blob - source/objectinstance.h
Style update: add spaces around assignment operators
[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 /**
21 Represents a single instance of an Object.  An application can derive another
22 class from this and overload the hook functions to specify location and other
23 instance-specific parameters for the rendered objects.
24
25 The finish_render function generally should clean up everything done by
26 setup_render, unless the rendering sequence is known to allow otherwise.
27 */
28 class ObjectInstance: public Renderable
29 {
30 protected:
31         const Object &object;
32
33 public:
34         ObjectInstance(const Object &);
35
36         const Object &get_object() const { return object; }
37
38         virtual void render(const Tag &tag = Tag()) const;
39
40         /**
41         Hook function, called from Object just before rendering the mesh.
42         */
43         virtual void setup_render(const Tag &) const { }
44
45         /**
46         Hook function, called from Object right after rendering the mesh.
47         */
48         virtual void finish_render(const Tag &) const { }
49
50         virtual unsigned get_level_of_detail() const { return 0; }
51 };
52
53 } // namespace GL
54 } // namespaec Msp
55
56 #endif