3 #ifndef SCENEVIEW_DRAWABLE_HPP__
4 #define SCENEVIEW_DRAWABLE_HPP__
8 #include <sceneview/geometry_resource.hpp>
9 #include <sceneview/material_resource.hpp>
22 typedef std::shared_ptr<Drawable> Ptr;
27 static Ptr Create(
const GeometryResource::Ptr& geometry,
28 const MaterialResource::Ptr& material) {
29 return Ptr(
new Drawable(geometry, material));
32 const GeometryResource::Ptr& Geometry() {
return geometry_; }
34 const MaterialResource::Ptr& Material() {
return material_; }
36 virtual void SetMaterial(
const MaterialResource::Ptr& material);
71 return geometry_->BoundingBox();
75 Drawable(
const GeometryResource::Ptr& geometry,
76 const MaterialResource::Ptr& material);
88 void AddListener(
DrawNode* listener);
90 void RemoveListener(
DrawNode* listener);
92 std::vector<DrawNode*> listeners_;
94 GeometryResource::Ptr geometry_;
95 MaterialResource::Ptr material_;
100 #endif // SCENEVIEW_DRAWABLE_HPP__
void BoundingBoxChanged()
Call this when the bounding box changes.
Fundamental drawable unit.
Definition: drawable.hpp:20
Geometry that can be rendered with glDrawArrays() or glDrawElements().
Definition: geometry_resource.hpp:91
An axis-aligned box typically used for bounding box and intersection calculations.
Definition: axis_aligned_box.hpp:17
virtual void PostDraw()
Called by the render engine just after rendering the geometry referenced by this object.
Definition: drawable.hpp:64
Scene node that contains a list of drawable objects.
Definition: draw_node.hpp:26
virtual const AxisAlignedBox & BoundingBox()
Called by the render engine to determine the axis-aligned bounding box of the Drawable, in the Drawable's own coordinate frame.
Definition: drawable.hpp:70
virtual bool PreDraw()
Called by the render engine just before rendering the geometry referenced by this object...
Definition: drawable.hpp:58