Simplify Overlays payloadGetBounds

This commit is contained in:
Atlante45 2015-06-22 15:10:48 -07:00
parent 6bb21b7a48
commit e8da8e374c
2 changed files with 3 additions and 6 deletions

View file

@ -47,6 +47,8 @@ public:
void init(QScriptEngine* scriptEngine);
virtual void update(float deltatime) {}
virtual void render(RenderArgs* args) = 0;
virtual AABox getBounds() const = 0;
virtual bool addToScene(Overlay::Pointer overlay, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges);
virtual void removeFromScene(Overlay::Pointer overlay, std::shared_ptr<render::Scene> scene, render::PendingChanges& pendingChanges);

View file

@ -46,12 +46,7 @@ namespace render {
}
}
template <> const Item::Bound payloadGetBound(const Overlay::Pointer& overlay) {
if (overlay->is3D()) {
return std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getBounds();
} else {
QRect bounds = std::dynamic_pointer_cast<Overlay2D>(overlay)->getBounds();
return AABox(glm::vec3(bounds.x(), bounds.y(), 0.0f), glm::vec3(bounds.width(), bounds.height(), 0.1f));
}
return overlay->getBounds();
}
template <> int payloadGetLayer(const Overlay::Pointer& overlay) {
// MAgic number while we are defining the layering mechanism: