mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 08:17:35 +02:00
Use dynamic_pointer_cast instead of static_cast
This commit is contained in:
parent
6db4184748
commit
6bb21b7a48
1 changed files with 5 additions and 5 deletions
|
@ -35,8 +35,8 @@
|
||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
template <> const ItemKey payloadGetKey(const Overlay::Pointer& overlay) {
|
template <> const ItemKey payloadGetKey(const Overlay::Pointer& overlay) {
|
||||||
if (overlay->is3D() && !static_cast<Base3DOverlay*>(overlay.get())->getDrawOnHUD()) {
|
if (overlay->is3D() && !std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getDrawOnHUD()) {
|
||||||
if (static_cast<Base3DOverlay*>(overlay.get())->getDrawInFront()) {
|
if (std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getDrawInFront()) {
|
||||||
return ItemKey::Builder().withTypeShape().withLayered().build();
|
return ItemKey::Builder().withTypeShape().withLayered().build();
|
||||||
} else {
|
} else {
|
||||||
return ItemKey::Builder::opaqueShape();
|
return ItemKey::Builder::opaqueShape();
|
||||||
|
@ -47,9 +47,9 @@ namespace render {
|
||||||
}
|
}
|
||||||
template <> const Item::Bound payloadGetBound(const Overlay::Pointer& overlay) {
|
template <> const Item::Bound payloadGetBound(const Overlay::Pointer& overlay) {
|
||||||
if (overlay->is3D()) {
|
if (overlay->is3D()) {
|
||||||
return static_cast<Base3DOverlay*>(overlay.get())->getBounds();
|
return std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getBounds();
|
||||||
} else {
|
} else {
|
||||||
QRect bounds = static_cast<Overlay2D*>(overlay.get())->getBounds();
|
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 AABox(glm::vec3(bounds.x(), bounds.y(), 0.0f), glm::vec3(bounds.width(), bounds.height(), 0.1f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace render {
|
||||||
const int LAYER_3D_FRONT = 1;
|
const int LAYER_3D_FRONT = 1;
|
||||||
const int LAYER_3D = 0;
|
const int LAYER_3D = 0;
|
||||||
if (overlay->is3D()) {
|
if (overlay->is3D()) {
|
||||||
return (static_cast<Base3DOverlay*>(overlay.get())->getDrawInFront() ? LAYER_3D_FRONT : LAYER_3D);
|
return (std::dynamic_pointer_cast<Base3DOverlay>(overlay)->getDrawInFront() ? LAYER_3D_FRONT : LAYER_3D);
|
||||||
} else {
|
} else {
|
||||||
return LAYER_2D;
|
return LAYER_2D;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue