MoveComponent.cpp 814 B

123456789101112131415161718192021222324252627
  1. // Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Scene/Components/MoveComponent.h>
  6. #include <AnKi/Scene/SceneNode.h>
  7. namespace anki {
  8. void MoveComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
  9. {
  10. const Bool movedThisFrame = info.m_node->updateTransform();
  11. const Bool movedLastFrame = m_movedLastFrame;
  12. m_movedLastFrame = movedThisFrame;
  13. updated = movedThisFrame || movedLastFrame != movedThisFrame;
  14. if(updated) [[unlikely]]
  15. {
  16. Array<Mat3x4, 2> trfs;
  17. trfs[0] = Mat3x4(info.m_node->getWorldTransform());
  18. trfs[1] = Mat3x4(info.m_node->getPreviousWorldTransform());
  19. m_gpuSceneTransforms.uploadToGpuScene(trfs);
  20. }
  21. }
  22. } // end namespace anki