mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-05 21:29:53 +02:00
fix laser end not disappearing
This commit is contained in:
parent
224386317d
commit
9188ae9fb5
5 changed files with 18 additions and 10 deletions
|
@ -265,7 +265,7 @@ void Base3DOverlay::locationChanged(bool tellPhysics) {
|
||||||
SpatiallyNestable::locationChanged(tellPhysics);
|
SpatiallyNestable::locationChanged(tellPhysics);
|
||||||
|
|
||||||
// Force the actual update of the render transform through the notify call
|
// Force the actual update of the render transform through the notify call
|
||||||
notifyRenderTransformChange();
|
notifyRenderVariableChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Base3DOverlay::parentDeleted() {
|
void Base3DOverlay::parentDeleted() {
|
||||||
|
@ -275,13 +275,13 @@ void Base3DOverlay::parentDeleted() {
|
||||||
void Base3DOverlay::update(float duration) {
|
void Base3DOverlay::update(float duration) {
|
||||||
// In Base3DOverlay, if its location or bound changed, the renderTrasnformDirty flag is true.
|
// In Base3DOverlay, if its location or bound changed, the renderTrasnformDirty flag is true.
|
||||||
// then the correct transform used for rendering is computed in the update transaction and assigned.
|
// then the correct transform used for rendering is computed in the update transaction and assigned.
|
||||||
if (_renderTransformDirty) {
|
if (_renderVariableDirty) {
|
||||||
auto itemID = getRenderItemID();
|
auto itemID = getRenderItemID();
|
||||||
if (render::Item::isValidID(itemID)) {
|
if (render::Item::isValidID(itemID)) {
|
||||||
// Capture the render transform value in game loop before
|
// Capture the render transform value in game loop before
|
||||||
auto latestTransform = evalRenderTransform();
|
auto latestTransform = evalRenderTransform();
|
||||||
bool latestVisible = getVisible();
|
bool latestVisible = getVisible();
|
||||||
_renderTransformDirty = false;
|
_renderVariableDirty = false;
|
||||||
render::ScenePointer scene = qApp->getMain3DScene();
|
render::ScenePointer scene = qApp->getMain3DScene();
|
||||||
render::Transaction transaction;
|
render::Transaction transaction;
|
||||||
transaction.updateItem<Overlay>(itemID, [latestTransform, latestVisible](Overlay& data) {
|
transaction.updateItem<Overlay>(itemID, [latestTransform, latestVisible](Overlay& data) {
|
||||||
|
@ -297,8 +297,8 @@ void Base3DOverlay::update(float duration) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Base3DOverlay::notifyRenderTransformChange() const {
|
void Base3DOverlay::notifyRenderVariableChange() const {
|
||||||
_renderTransformDirty = true;
|
_renderVariableDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Transform Base3DOverlay::evalRenderTransform() {
|
Transform Base3DOverlay::evalRenderTransform() {
|
||||||
|
@ -318,3 +318,8 @@ SpatialParentTree* Base3DOverlay::getParentTree() const {
|
||||||
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
EntityTreePointer entityTree = entityTreeRenderer ? entityTreeRenderer->getTree() : nullptr;
|
||||||
return entityTree.get();
|
return entityTree.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Base3DOverlay::setVisible(bool visible) {
|
||||||
|
Parent::setVisible(visible);
|
||||||
|
notifyRenderVariableChange();
|
||||||
|
}
|
|
@ -18,11 +18,14 @@
|
||||||
|
|
||||||
class Base3DOverlay : public Overlay, public SpatiallyNestable {
|
class Base3DOverlay : public Overlay, public SpatiallyNestable {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
using Parent = Overlay;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Base3DOverlay();
|
Base3DOverlay();
|
||||||
Base3DOverlay(const Base3DOverlay* base3DOverlay);
|
Base3DOverlay(const Base3DOverlay* base3DOverlay);
|
||||||
|
|
||||||
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
virtual OverlayID getOverlayID() const override { return OverlayID(getID().toString()); }
|
virtual OverlayID getOverlayID() const override { return OverlayID(getID().toString()); }
|
||||||
void setOverlayID(OverlayID overlayID) override { setID(overlayID); }
|
void setOverlayID(OverlayID overlayID) override { setID(overlayID); }
|
||||||
|
|
||||||
|
@ -56,7 +59,7 @@ public:
|
||||||
|
|
||||||
void update(float deltatime) override;
|
void update(float deltatime) override;
|
||||||
|
|
||||||
void notifyRenderTransformChange() const;
|
void notifyRenderVariableChange() const;
|
||||||
|
|
||||||
void setProperties(const QVariantMap& properties) override;
|
void setProperties(const QVariantMap& properties) override;
|
||||||
QVariant getProperty(const QString& property) override;
|
QVariant getProperty(const QString& property) override;
|
||||||
|
@ -89,7 +92,7 @@ protected:
|
||||||
bool _drawInFront;
|
bool _drawInFront;
|
||||||
bool _drawHUDLayer;
|
bool _drawHUDLayer;
|
||||||
bool _isGrabbable { false };
|
bool _isGrabbable { false };
|
||||||
mutable bool _renderTransformDirty{ true };
|
mutable bool _renderVariableDirty { true };
|
||||||
|
|
||||||
QString _name;
|
QString _name;
|
||||||
};
|
};
|
||||||
|
|
|
@ -96,7 +96,7 @@ void Line3DOverlay::setEnd(const glm::vec3& end) {
|
||||||
} else {
|
} else {
|
||||||
_direction = glm::vec3(0.0f);
|
_direction = glm::vec3(0.0f);
|
||||||
}
|
}
|
||||||
notifyRenderTransformChange();
|
notifyRenderVariableChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Line3DOverlay::setLocalEnd(const glm::vec3& localEnd) {
|
void Line3DOverlay::setLocalEnd(const glm::vec3& localEnd) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ AABox Planar3DOverlay::getBounds() const {
|
||||||
|
|
||||||
void Planar3DOverlay::setDimensions(const glm::vec2& value) {
|
void Planar3DOverlay::setDimensions(const glm::vec2& value) {
|
||||||
_dimensions = value;
|
_dimensions = value;
|
||||||
notifyRenderTransformChange();
|
notifyRenderVariableChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Planar3DOverlay::setProperties(const QVariantMap& properties) {
|
void Planar3DOverlay::setProperties(const QVariantMap& properties) {
|
||||||
|
|
|
@ -28,7 +28,7 @@ AABox Volume3DOverlay::getBounds() const {
|
||||||
|
|
||||||
void Volume3DOverlay::setDimensions(const glm::vec3& value) {
|
void Volume3DOverlay::setDimensions(const glm::vec3& value) {
|
||||||
_localBoundingBox.setBox(-value / 2.0f, value);
|
_localBoundingBox.setBox(-value / 2.0f, value);
|
||||||
notifyRenderTransformChange();
|
notifyRenderVariableChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Volume3DOverlay::setProperties(const QVariantMap& properties) {
|
void Volume3DOverlay::setProperties(const QVariantMap& properties) {
|
||||||
|
|
Loading…
Reference in a new issue