Since the tag object is small, it can be passed in a register.
Keeping a deprecated version would make it hard to tell which version
is being called.
throw invalid_argument("AnimatedObject::set_uniform");
}
-void AnimatedObject::setup_render(Renderer &renderer, const Tag &) const
+void AnimatedObject::setup_render(Renderer &renderer, Tag) const
{
renderer.transform(matrix);
if(shdata)
virtual const Matrix *get_matrix() const { return &matrix; }
- virtual void setup_render(Renderer &, const Tag &) const;
+ virtual void setup_render(Renderer &, Tag) const;
};
} // namespace GL
enabled_passes.insert(Tag());
}
-void Effect::enable_for_pass(const Tag &tag)
+void Effect::enable_for_pass(Tag tag)
{
enabled_passes.insert(tag);
}
-void Effect::disable_for_pass(const Tag &tag)
+void Effect::disable_for_pass(Tag tag)
{
enabled_passes.erase(tag);
}
public:
virtual ~Effect() { }
- void enable_for_pass(const Tag &);
- void disable_for_pass(const Tag &);
+ void enable_for_pass(Tag);
+ void disable_for_pass(Tag);
virtual const Matrix *get_matrix() const { return renderable.get_matrix(); }
virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return renderable.get_bounding_sphere(); }
}
}
-void EnvironmentMap::render(Renderer &renderer, const Tag &tag) const
+void EnvironmentMap::render(Renderer &renderer, Tag tag) const
{
if(!enabled_passes.count(tag))
return renderer.render(renderable, tag);
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL
rendered = false;
}
-void ShadowMap::render(Renderer &renderer, const Tag &tag) const
+void ShadowMap::render(Renderer &renderer, Tag tag) const
{
if(!enabled_passes.count(tag))
return renderer.render(renderable, tag);
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL
namespace Msp {
namespace GL {
-RenderPass &Technique::add_pass(const Tag &tag)
+RenderPass &Technique::add_pass(Tag tag)
{
return insert_unique(passes, tag, RenderPass())->second;
}
-bool Technique::has_pass(const Tag &tag) const
+bool Technique::has_pass(Tag tag) const
{
return passes.count(tag);
}
-const RenderPass &Technique::get_pass(const Tag &tag) const
+const RenderPass &Technique::get_pass(Tag tag) const
{
return get_item(passes, tag);
}
-const RenderPass *Technique::find_pass(const Tag &tag) const
+const RenderPass *Technique::find_pass(Tag tag) const
{
PassMap::const_iterator i = passes.find(tag);
return (i!=passes.end() ? &i->second : 0);
PassMap passes;
public:
- RenderPass &add_pass(const Tag &);
- bool has_pass(const Tag &) const;
- const RenderPass &get_pass(const Tag &) const;
- const RenderPass *find_pass(const Tag &) const;
+ RenderPass &add_pass(Tag);
+ bool has_pass(Tag) const;
+ const RenderPass &get_pass(Tag) const;
+ const RenderPass *find_pass(Tag) const;
const PassMap &get_passes() const { return passes; }
bool replace_texture(const std::string &, const Texture &);
bool replace_material(const std::string &, const Material &);
d[matrix_offset+i] = m(i/4, i%4);
}
-void InstanceArray::render(Renderer &renderer, const Tag &tag) const
+void InstanceArray::render(Renderer &renderer, Tag tag) const
{
if(instances.empty())
return;
public:
void remove(ObjectInstance &);
- virtual void render(Renderer &, const Tag &) const;
+ virtual void render(Renderer &, Tag) const;
};
template<typename T>
(*j)->finish_frame();
}
-void InstanceScene::render(Renderer &renderer, const Tag &tag) const
+void InstanceScene::render(Renderer &renderer, Tag tag) const
{
if(setup_frustum(renderer))
{
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag &tag = Tag()) const;
+ virtual void render(Renderer &, Tag tag = Tag()) const;
};
} // namespace GL
return lods[i].technique.get();
}
-void Object::render(Renderer &renderer, const Tag &tag) const
+void Object::render(Renderer &renderer, Tag tag) const
{
const RenderPass *pass = get_pass(tag, 0);
if(!pass)
finish_render(renderer, tag);
}
-void Object::render(Renderer &renderer, const ObjectInstance &inst, const Tag &tag) const
+void Object::render(Renderer &renderer, const ObjectInstance &inst, Tag tag) const
{
unsigned lod = min<unsigned>(inst.get_level_of_detail(renderer), lods.size()-1);
const RenderPass *pass = get_pass(tag, lod);
finish_render(renderer, tag);
}
-const RenderPass *Object::get_pass(const Tag &tag, unsigned lod) const
+const RenderPass *Object::get_pass(Tag tag, unsigned lod) const
{
const Technique *tech = lods[lod].technique.get();
if(!tech)
virtual const Matrix *get_matrix() const { return &identity_matrix; }
virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return &bounding_sphere; }
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
/** Renders an instance of the object. The instance's hook functions are
called before and after drawing the mesh. */
- virtual void render(Renderer &, const ObjectInstance &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, const ObjectInstance &, Tag = Tag()) const;
protected:
- virtual void setup_render(Renderer &, const Tag &) const { }
- virtual void finish_render(Renderer &, const Tag &) const { }
+ virtual void setup_render(Renderer &, Tag) const { }
+ virtual void finish_render(Renderer &, Tag) const { }
private:
- const RenderPass *get_pass(const Tag &, unsigned) const;
+ const RenderPass *get_pass(Tag, unsigned) const;
virtual void resource_loaded(Resource &);
virtual void resource_removed(Resource &);
object(obj)
{ }
-void ObjectInstance::render(Renderer &renderer, const Tag &tag) const
+void ObjectInstance::render(Renderer &renderer, Tag tag) const
{
object.render(renderer, *this, tag);
}
-void ObjectInstance::setup_render(Renderer &renderer, const Tag &) const
+void ObjectInstance::setup_render(Renderer &renderer, Tag) const
{
renderer.transform(matrix);
}
virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const { return object.get_bounding_sphere(); }
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
/** Hook function, called from Object just before rendering the mesh.
Renderer state will have been pushed before this is called. */
- virtual void setup_render(Renderer &, const Tag &) const;
+ virtual void setup_render(Renderer &, Tag) const;
/** Hook function, called from Object right after rendering the mesh. Since
Object takes care of pushing Renderer state, this rarely needs to do
anything. */
- virtual void finish_render(Renderer &, const Tag &) const { }
+ virtual void finish_render(Renderer &, Tag) const { }
virtual unsigned get_level_of_detail(const Renderer &) const;
};
i->renderable->finish_frame();
}
-void OccludedScene::render(Renderer &renderer, const Tag &tag) const
+void OccludedScene::render(Renderer &renderer, Tag tag) const
{
if(renderables.empty())
return;
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL
(*i)->finish_frame();
}
-void OrderedScene::render(Renderer &renderer, const Tag &tag) const
+void OrderedScene::render(Renderer &renderer, Tag tag) const
{
if(setup_frustum(renderer))
{
virtual void finish_frame();
using Scene::render;
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL
}
}
-Pipeline::Pass &Pipeline::add_pass(const Tag &tag, Renderable &r)
+Pipeline::Pass &Pipeline::add_pass(Tag tag, Renderable &r)
{
passes.push_back(Pass(tag, &r));
return passes.back();
i->renderable->finish_frame();
}
-void Pipeline::render(Renderer &renderer, const Tag &tag) const
+void Pipeline::render(Renderer &renderer, Tag tag) const
{
if(tag.id)
return;
}
-Pipeline::Pass::Pass(const Tag &t, Renderable *r):
+Pipeline::Pass::Pass(Tag t, Renderable *r):
tag(t),
lighting(0),
depth_test(0),
Renderable *renderable;
public:
- Pass(const Tag &, Renderable *);
+ Pass(Tag, Renderable *);
- const Tag &get_tag() const { return tag; }
+ Tag get_tag() const { return tag; }
void set_lighting(const Lighting *);
void set_depth_test(const DepthTest *);
/** Adds a pass to the pipeline. It's permissible to add the same
Renderable multiple times. */
- Pass &add_pass(const Tag &, Renderable &);
+ Pass &add_pass(Tag, Renderable &);
/** Adds a postprocessor to the pipeline. */
void add_postprocessor(PostProcessor &);
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag &tag = Tag()) const;
+ virtual void render(Renderer &, Tag tag = Tag()) const;
private:
void create_targets(unsigned);
/** Renders the Renderable. Implementors should take care to return the
renderer to the state it was in, for example by using Renderer::Push. */
- virtual void render(Renderer &, const Tag & = Tag()) const = 0;
+ virtual void render(Renderer &, Tag = Tag()) const = 0;
};
} // namespace Msp
excluded.erase(&renderable);
}
-void Renderer::render(const Renderable &renderable, const Tag &tag)
+void Renderer::render(const Renderable &renderable, Tag tag)
{
if(!excluded.count(&renderable))
renderable.render(*this, tag);
void exclude(const Renderable &);
void include(const Renderable &);
- void render(const Renderable &, const Tag & = Tag());
+ void render(const Renderable &, Tag = Tag());
void draw(const Batch &);
void draw_instanced(const Batch &, unsigned);
(*i)->finish_frame();
}
-void SimpleScene::render(Renderer &renderer, const Tag &tag) const
+void SimpleScene::render(Renderer &renderer, Tag tag) const
{
populate_cache();
if(setup_frustum(renderer))
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL
renderable->finish_frame();
}
-void Slot::render(Renderer &renderer, const Tag &tag) const
+void Slot::render(Renderer &renderer, Tag tag) const
{
if(renderable)
renderer.render(*renderable, tag);
virtual const Geometry::BoundingSphere<float, 3> *get_bounding_sphere() const;
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag &) const;
+ virtual void render(Renderer &, Tag) const;
};
} // namespace GL
Tag(const char *);
Tag(const std::string &s);
- bool operator<(const Tag &t) const { return id<t.id; }
- bool operator==(const Tag &t) const { return id==t.id; }
+ bool operator<(Tag t) const { return id<t.id; }
+ bool operator==(Tag t) const { return id==t.id; }
};
} // namespace GL
}
}
-void Text::render(Renderer &renderer, const Tag &tag) const
+void Text::render(Renderer &renderer, Tag tag) const
{
object.render(renderer, tag);
}
float get_width() const { return width; }
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
operator const Object &() const { return object; }
};
i->renderable->finish_frame();
}
-void ZSortedScene::render(Renderer &renderer, const Tag &tag) const
+void ZSortedScene::render(Renderer &renderer, Tag tag) const
{
if(renderables.empty())
return;
virtual void setup_frame(Renderer &);
virtual void finish_frame();
- virtual void render(Renderer &, const Tag & = Tag()) const;
+ virtual void render(Renderer &, Tag = Tag()) const;
};
} // namespace GL