1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#include "Scene/BsSceneActor.h"
4#include "Scene/BsSceneObject.h"
5
6namespace bs
7{
8 void SceneActor::setTransform(const Transform& transform)
9 {
10 if (mMobility != ObjectMobility::Movable)
11 return;
12
13 mTransform = transform;
14 _markCoreDirty(ActorDirtyFlag::Transform);
15 }
16
17 void SceneActor::setMobility(ObjectMobility mobility)
18 {
19 mMobility = mobility;
20 _markCoreDirty(ActorDirtyFlag::Mobility);
21 }
22
23 void SceneActor::setActive(bool active)
24 {
25 mActive = active;
26 _markCoreDirty(ActorDirtyFlag::Active);
27 }
28
29 void SceneActor::_updateState(const SceneObject& so, bool force)
30 {
31 UINT32 curHash = so.getTransformHash();
32 if (curHash != mHash || force)
33 {
34 setTransform(so.getTransform());
35
36 mHash = curHash;
37 }
38
39 if (so.getActive() != mActive || force)
40 setActive(so.getActive());
41
42 if (so.getMobility() != mMobility || force)
43 setMobility(so.getMobility());
44 }
45}
46