3 This file is part of libmspgl
4 Copyright © 2007 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
8 #ifndef MSP_GL_OBJECT_H_
9 #define MSP_GL_OBJECT_H_
12 #include <msp/datafile/collection.h>
13 #include "objectpass.h"
26 Stores data for a complete 3D object. This includes a mesh, a shader and data
27 for it and a number of textures. Only the mesh is mandatory, other components
30 See also class ObjectInstance.
35 std::vector<Mesh *> meshes;
36 std::vector<Texture *> textures;
37 std::map<std::string, ObjectPass> passes;
39 ObjectPass *normal_pass;
42 class Loader: public DataFile::Loader
45 typedef DataFile::Collection Collection;
51 std::vector<std::string> textures;
54 Loader(Object &, Collection &);
57 Object &get_object() const { return obj; }
58 Collection &get_collection() const { return coll; }
60 void lod_mesh(unsigned, const std::string &);
61 void material_inline();
62 void mesh(const std::string &);
63 void pass(const std::string &);
64 void shader(const std::string &);
65 void texture(const std::string &);
71 bool has_pass(const std::string &) const;
72 const ObjectPass &get_pass(const std::string &) const;
75 Renders the object. If an ObjectInstance is provided, its hook functions
78 void render(const ObjectInstance * =0) const;
79 void render(const std::string &, const ObjectInstance *) const;
82 Renders multiple instances of the object in one go. This may be a
83 performance improvement, as the object-specific render setup only has to be
86 void render(const std::list<const ObjectInstance *> &) const;
87 void render(const std::string &, const std::list<const ObjectInstance *> &) const;
89 void setup_render(const ObjectPass &) const;
90 void finish_render(const ObjectPass &) const;
91 void render(const ObjectPass &, const ObjectInstance *) const;
92 void render(const ObjectPass &, const std::list<const ObjectInstance *> &) const;