#define MSP_GL_OBJECT_H_
#include <vector>
-#include <msp/datafile/collection.h>
#include "objectpass.h"
#include "renderable.h"
const Material *material;
public:
- class Loader: public DataFile::Loader
+ class Loader: public DataFile::CollectionObjectLoader<Object>
{
- public:
- typedef DataFile::Collection Collection;
-
- protected:
- Object &obj;
- Collection &coll;
-
public:
Loader(Object &, Collection &);
- Object &get_object() const { return obj; }
- Collection &get_collection() const { return coll; }
private:
virtual void finish();
void lod_mesh(unsigned, const std::string &);
const Technique *get_technique() const { return technique; }
- virtual bool has_pass(const Tag &) const;
-
/**
Renders the object. A tag can be provided to render a non-default pass.
*/
template<typename Iter>
void render(Iter begin, Iter end, const Tag &tag=Tag()) const
{
+ if(!can_render(tag))
+ return;
+
const ObjectPass *pass=get_pass(tag);
setup_render(pass);
for(Iter i=begin; i!=end; ++i)
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;