]> git.tdb.fi Git - libs/gl.git/blob - source/objectinstance.h
Use DevIL for loading images
[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
13 namespace Msp {
14 namespace GL {
15
16 class Object;
17 class ProgramData;
18
19 class ObjectPass;
20
21 /**
22 Represents a single instance of an Object.  An application can derive another
23 class from this and overload the hook functions to specify location and other
24 instance-specific parameters for the rendered objects.
25 */
26 class ObjectInstance
27 {
28 protected:
29         const Object &object;
30
31 public:
32         ObjectInstance(const Object &);
33
34         const Object &get_object() const { return object; }
35
36         void render() const;
37         void render(const std::string &) const;
38
39         /**
40         Hook function, called from Object just before rendering the mesh.
41         */
42         virtual void setup_render(const ObjectPass &) const { }
43
44         /**
45         Hook function, called from Object right after rendering the mesh.
46         */
47         virtual void finish_render(const ObjectPass &) const { }
48
49         virtual unsigned get_level_of_detail() const { return 0; }
50 };
51
52 } // namespace GL
53 } // namespaec Msp
54
55 #endif