mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
Tweak PanelAttachable::setTransforms.
Use reference instead of pointer, and make it virtual.
This commit is contained in:
parent
c37c3ec2d2
commit
9bd72e5769
4 changed files with 11 additions and 12 deletions
|
@ -39,7 +39,7 @@ BillboardOverlay::BillboardOverlay(const BillboardOverlay* billboardOverlay) :
|
|||
{
|
||||
}
|
||||
|
||||
void BillboardOverlay::setTransforms(Transform *transform) {
|
||||
void BillboardOverlay::setTransforms(Transform& transform) {
|
||||
PanelAttachable::setTransforms(transform);
|
||||
if (_isFacingAvatar) {
|
||||
glm::quat rotation = Application::getInstance()->getCamera()->getOrientation();
|
||||
|
@ -49,7 +49,7 @@ void BillboardOverlay::setTransforms(Transform *transform) {
|
|||
}
|
||||
|
||||
void BillboardOverlay::update(float deltatime) {
|
||||
setTransforms(&_transform);
|
||||
setTransforms(_transform);
|
||||
}
|
||||
|
||||
void BillboardOverlay::render(RenderArgs* args) {
|
||||
|
@ -98,7 +98,7 @@ void BillboardOverlay::render(RenderArgs* args) {
|
|||
xColor color = getColor();
|
||||
float alpha = getAlpha();
|
||||
|
||||
setTransforms(&_transform);
|
||||
setTransforms(_transform);
|
||||
Transform transform = _transform;
|
||||
transform.postScale(glm::vec3(getDimensions(), 1.0f));
|
||||
|
||||
|
@ -197,7 +197,7 @@ bool BillboardOverlay::findRayIntersection(const glm::vec3& origin, const glm::v
|
|||
float& distance, BoxFace& face) {
|
||||
if (_texture && _texture->isLoaded()) {
|
||||
// Make sure position and rotation is updated.
|
||||
setTransforms(&_transform);
|
||||
setTransforms(_transform);
|
||||
|
||||
// Produce the dimensions of the billboard based on the image's aspect ratio and the overlay's scale.
|
||||
bool isNull = _fromImage.isNull();
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
virtual BillboardOverlay* createClone() const;
|
||||
|
||||
protected:
|
||||
void setTransforms(Transform* transform);
|
||||
virtual void setTransforms(Transform& transform);
|
||||
|
||||
private:
|
||||
void setBillboardURL(const QString& url);
|
||||
|
|
|
@ -26,13 +26,12 @@ PanelAttachable::PanelAttachable(const PanelAttachable* panelAttachable) :
|
|||
{
|
||||
}
|
||||
|
||||
void PanelAttachable::setTransforms(Transform* transform) {
|
||||
Q_ASSERT(transform != nullptr);
|
||||
void PanelAttachable::setTransforms(Transform& transform) {
|
||||
if (getAttachedPanel()) {
|
||||
transform->setTranslation(getAttachedPanel()->getAnchorPosition());
|
||||
transform->setRotation(getAttachedPanel()->getOffsetRotation());
|
||||
transform->postTranslate(getOffsetPosition() + getAttachedPanel()->getOffsetPosition());
|
||||
transform->postRotate(getFacingRotation() * getAttachedPanel()->getFacingRotation());
|
||||
transform.setTranslation(getAttachedPanel()->getAnchorPosition());
|
||||
transform.setRotation(getAttachedPanel()->getOffsetRotation());
|
||||
transform.postTranslate(getOffsetPosition() + getAttachedPanel()->getOffsetPosition());
|
||||
transform.postRotate(getFacingRotation() * getAttachedPanel()->getFacingRotation());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
void setProperties(const QScriptValue& properties);
|
||||
|
||||
protected:
|
||||
void setTransforms(Transform* transform);
|
||||
virtual void setTransforms(Transform& transform);
|
||||
|
||||
private:
|
||||
FloatingUIPanel::Pointer _attachedPanel;
|
||||
|
|
Loading…
Reference in a new issue