summaryrefslogtreecommitdiffstats
path: root/src/Authoring
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2020-04-30 13:22:17 +0300
committerAntti Määttä <antti.maatta@qt.io>2020-04-30 13:56:09 +0300
commit3db28c596f1bd164af7511192b18cd77c2719c10 (patch)
treee8ae2f08c026c5f14a82ad1b3d86905c40cc8e68 /src/Authoring
parente83b3abaab4b1ae38812335e7527dae6f767356a (diff)
Remove scale and position of axis helper camera
Only rotation should be applied to the axis camera. Task-number: QT3DS-4104 Change-Id: Ifbc01c0931d7d3edfc4210644d46c53380ef0980 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'src/Authoring')
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp2
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h5
-rw-r--r--src/Authoring/Qt3DStudio/Render/StudioTranslationWidget.cpp9
3 files changed, 10 insertions, 6 deletions
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
index 0c641af9..de1991f0 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
+++ b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.cpp
@@ -2321,7 +2321,7 @@ void STranslation::PreRender(bool scenePreviewPass)
}
if (m_axisHelperEnabled && !scenePreviewPass) {
if (m_EditCameraEnabled) {
- m_EditCameraInfo.ApplyToCamera(m_AxisCamera, theViewportDims);
+ m_EditCameraInfo.ApplyToCamera(m_AxisCamera, theViewportDims, true);
} else {
// Get scene camera
SLayerTranslator *layerTranslator = static_cast<SLayerTranslator *>(GetOrCreateTranslator(m_Doc.GetActiveLayer()));
diff --git a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
index 37b110b1..ed7ea70d 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
+++ b/src/Authoring/Qt3DStudio/Render/StudioRendererTranslation.h
@@ -169,7 +169,7 @@ namespace studio {
{
}
- void ApplyToCamera(SCamera &inCamera, QT3DSVec2 inViewport)
+ void ApplyToCamera(SCamera &inCamera, QT3DSVec2 inViewport, bool noScale = false)
{
// Setup shared default values.
inCamera.m_ClipFar = 2000000.0f;
@@ -231,7 +231,8 @@ namespace studio {
thePositionMatrix.column3.y = m_Position.y;
thePositionMatrix.column3.z = m_Position.z + 600;
theGlobalTransform = theGlobalTransform * theRotationTransform;
- theGlobalTransform = theGlobalTransform * theScaleMatrix;
+ if (!noScale)
+ theGlobalTransform = theGlobalTransform * theScaleMatrix;
theGlobalTransform = theGlobalTransform * thePivotMatrix.getInverse();
theGlobalTransform = theGlobalTransform * thePositionMatrix;
// This works because the camera has no hierarchy.
diff --git a/src/Authoring/Qt3DStudio/Render/StudioTranslationWidget.cpp b/src/Authoring/Qt3DStudio/Render/StudioTranslationWidget.cpp
index 30a9fc2e..47206714 100644
--- a/src/Authoring/Qt3DStudio/Render/StudioTranslationWidget.cpp
+++ b/src/Authoring/Qt3DStudio/Render/StudioTranslationWidget.cpp
@@ -146,10 +146,13 @@ struct STranslationWidget : public SStudioWidgetImpl<StudioWidgetTypes::Translat
// and rotate the widget axes to match world axes. Scale the widget to be smaller
// and less intrusive than actual translation widget.
auto rot = QT3DSMat44::createIdentity();
- if (helpWidgetInfo.m_Camera->m_Flags.IsOrthographic())
- rot = helpWidgetInfo.m_Camera->m_LocalTransform.getInverse().getTranspose();
- else
+ if (helpWidgetInfo.m_Camera->m_Flags.IsOrthographic()) {
+ rot = helpWidgetInfo.m_Camera->m_LocalTransform;
+ rot.setPosition({});
+ rot = rot.getInverse().getTranspose();
+ } else {
helpWidgetInfo.m_Camera->CalculateRotationMatrix(rot);
+ }
helpWidgetInfo.m_Camera->FlipCoordinateSystem(rot);
rot.scale(QT3DSVec4(0.6, 0.6, 0.6, 1));