#define MSP_GL_OBJECT_H_
#include <vector>
+#include "misc.h"
#include "objectpass.h"
#include "renderable.h"
class Texture;
/**
-Stores data for a complete 3D object. An Object must always have a Mesh, and
-may also have a Technique to determine its appearance. Textures and material
-specified by the Technique may be overridden. Simple textured objects are also
-possible without a Technique.
+Stores a Mesh together with a Technique to determine its appearance.
It is possible to use a single Object for rendering multiple identical or
similar objects. See class ObjectInstance.
{
private:
std::vector<const Mesh *> meshes;
+ bool own_technique;
const Technique *technique;
- std::vector<const Texture *> textures;
- const Texture *main_texture;
- const Material *material;
public:
class Loader: public DataFile::CollectionObjectLoader<Object>
Loader(Object &, Collection &);
private:
- virtual void finish();
void lod_mesh(unsigned, const std::string &);
- void material_inline();
void mesh(const std::string &);
- void shader_texture(const std::string &);
- void technique(const std::string &);
- void texture(const std::string &);
+ void technique();
};
Object();
template<typename Iter>
void render(Iter begin, Iter end, const Tag &tag=Tag()) const
{
- if(!can_render(tag))
+ const RenderPass *pass=get_pass(tag);
+ if(!pass)
return;
- const ObjectPass *pass=get_pass(tag);
- setup_render(pass);
+ Bind bind(*pass);
for(Iter i=begin; i!=end; ++i)
render_instance(**i, tag);
- finish_render(pass);
}
private:
- bool can_render(const Tag &) const;
- const ObjectPass *get_pass(const Tag &) const;
- void setup_render(const ObjectPass *) const;
- void finish_render(const ObjectPass *) const;
+ const RenderPass *get_pass(const Tag &) const;
void render_instance(const ObjectInstance &, const Tag &) const;
};