From 1bade94c3210b6131f9cfd3cd297a40a3484c255 Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Tue, 6 Sep 2022 19:37:39 +1000 Subject: [PATCH] standard order of scale/translation --- ios/src/SceneAsset.cpp | 2 +- ios/src/SceneAsset.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ios/src/SceneAsset.cpp b/ios/src/SceneAsset.cpp index a8e972cf..38176038 100644 --- a/ios/src/SceneAsset.cpp +++ b/ios/src/SceneAsset.cpp @@ -290,7 +290,7 @@ void SceneAsset::transformToUnitCube() { void SceneAsset::updateTransform() { auto &tm = _engine->getTransformManager(); auto transform = - math::mat4f::scaling(_scale) * _position * _rotation; + _position * _rotation * math::mat4f::scaling(_scale); tm.setTransform(tm.getInstance(_asset->getRoot()), transform); } diff --git a/ios/src/SceneAsset.hpp b/ios/src/SceneAsset.hpp index 61e33a55..4305a0be 100644 --- a/ios/src/SceneAsset.hpp +++ b/ios/src/SceneAsset.hpp @@ -108,8 +108,12 @@ namespace polyvox { // a slot to preload textures filament::Texture* _texture = nullptr; + // initialized to identity math::mat4f _position; + + // initialized to identity math::mat4f _rotation; + float _scale = 1; void updateTransform();