BsSceneObject.cpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsSceneObject.h"
  4. #include "BsComponent.h"
  5. #include "BsCoreSceneManager.h"
  6. #include "BsException.h"
  7. #include "BsDebug.h"
  8. #include "BsSceneObjectRTTI.h"
  9. #include "BsMemorySerializer.h"
  10. #include "BsGameObjectManager.h"
  11. #include "BsPrefabUtility.h"
  12. #include "BsMatrix3.h"
  13. #include "BsCoreApplication.h"
  14. namespace BansheeEngine
  15. {
  16. SceneObject::SceneObject(const String& name, UINT32 flags)
  17. :GameObject(), mPosition(Vector3::ZERO), mRotation(Quaternion::IDENTITY), mScale(Vector3::ONE),
  18. mWorldPosition(Vector3::ZERO), mWorldRotation(Quaternion::IDENTITY), mWorldScale(Vector3::ONE),
  19. mCachedLocalTfrm(Matrix4::IDENTITY), mDirtyFlags(0xFFFFFFFF), mCachedWorldTfrm(Matrix4::IDENTITY),
  20. mActiveSelf(true), mActiveHierarchy(true), mDirtyHash(0), mFlags(flags), mPrefabHash(0)
  21. {
  22. setName(name);
  23. }
  24. SceneObject::~SceneObject()
  25. {
  26. if(!mThisHandle.isDestroyed())
  27. {
  28. LOGWRN("Object is being deleted without being destroyed first?");
  29. destroyInternal(mThisHandle, true);
  30. }
  31. }
  32. HSceneObject SceneObject::create(const String& name, UINT32 flags)
  33. {
  34. HSceneObject newObject = createInternal(name, flags);
  35. if (newObject->isInstantiated())
  36. gCoreSceneManager().registerNewSO(newObject);
  37. return newObject;
  38. }
  39. HSceneObject SceneObject::createInternal(const String& name, UINT32 flags)
  40. {
  41. SPtr<SceneObject> sceneObjectPtr = SPtr<SceneObject>(new (bs_alloc<SceneObject>()) SceneObject(name, flags),
  42. &bs_delete<SceneObject>, StdAlloc<SceneObject>());
  43. HSceneObject sceneObject = GameObjectManager::instance().registerObject(sceneObjectPtr);
  44. sceneObject->mThisHandle = sceneObject;
  45. return sceneObject;
  46. }
  47. HSceneObject SceneObject::createInternal(const SPtr<SceneObject>& soPtr, UINT64 originalId)
  48. {
  49. HSceneObject sceneObject = GameObjectManager::instance().registerObject(soPtr, originalId);
  50. sceneObject->mThisHandle = sceneObject;
  51. return sceneObject;
  52. }
  53. void SceneObject::destroy(bool immediate)
  54. {
  55. // Parent is our owner, so when his reference to us is removed, delete might be called.
  56. // So make sure this is the last thing we do.
  57. if(mParent != nullptr)
  58. {
  59. if(!mParent.isDestroyed())
  60. mParent->removeChild(mThisHandle);
  61. mParent = nullptr;
  62. }
  63. destroyInternal(mThisHandle, immediate);
  64. }
  65. void SceneObject::destroyInternal(GameObjectHandleBase& handle, bool immediate)
  66. {
  67. if (immediate)
  68. {
  69. for (auto iter = mChildren.begin(); iter != mChildren.end(); ++iter)
  70. (*iter)->destroyInternal(*iter, true);
  71. mChildren.clear();
  72. for (auto iter = mComponents.begin(); iter != mComponents.end(); ++iter)
  73. {
  74. HComponent component = *iter;
  75. component->_setIsDestroyed();
  76. if (isInstantiated())
  77. {
  78. if (getActive())
  79. component->onDisabled();
  80. component->onDestroyed();
  81. }
  82. component->destroyInternal(*iter, true);
  83. }
  84. mComponents.clear();
  85. GameObjectManager::instance().unregisterObject(handle);
  86. }
  87. else
  88. GameObjectManager::instance().queueForDestroy(handle);
  89. }
  90. void SceneObject::_setInstanceData(GameObjectInstanceDataPtr& other)
  91. {
  92. GameObject::_setInstanceData(other);
  93. // Instance data changed, so make sure to refresh the handles to reflect that
  94. mThisHandle._setHandleData(mThisHandle.getInternalPtr());
  95. }
  96. String SceneObject::getPrefabLink() const
  97. {
  98. const SceneObject* curObj = this;
  99. while (curObj != nullptr)
  100. {
  101. if (!curObj->mPrefabLinkUUID.empty())
  102. return curObj->mPrefabLinkUUID;
  103. if (curObj->mParent != nullptr)
  104. curObj = curObj->mParent.get();
  105. else
  106. curObj = nullptr;
  107. }
  108. return "";
  109. }
  110. HSceneObject SceneObject::getPrefabParent() const
  111. {
  112. HSceneObject curObj = mThisHandle;
  113. while (curObj != nullptr)
  114. {
  115. if (!curObj->mPrefabLinkUUID.empty())
  116. return curObj;
  117. if (curObj->mParent != nullptr)
  118. curObj = curObj->mParent;
  119. else
  120. curObj = nullptr;
  121. }
  122. return curObj;
  123. }
  124. void SceneObject::breakPrefabLink()
  125. {
  126. SceneObject* rootObj = this;
  127. while (rootObj != nullptr)
  128. {
  129. if (!rootObj->mPrefabLinkUUID.empty())
  130. break;
  131. if (rootObj->mParent != nullptr)
  132. rootObj = rootObj->mParent.get();
  133. else
  134. rootObj = nullptr;
  135. }
  136. if (rootObj != nullptr)
  137. {
  138. rootObj->mPrefabLinkUUID = "";
  139. rootObj->mPrefabDiff = nullptr;
  140. PrefabUtility::clearPrefabIds(rootObj->getHandle());
  141. }
  142. }
  143. bool SceneObject::hasFlag(UINT32 flag) const
  144. {
  145. return (mFlags & flag) != 0;
  146. }
  147. void SceneObject::setFlags(UINT32 flags)
  148. {
  149. mFlags |= flags;
  150. for (auto& child : mChildren)
  151. child->setFlags(flags);
  152. }
  153. void SceneObject::unsetFlags(UINT32 flags)
  154. {
  155. mFlags &= ~flags;
  156. for (auto& child : mChildren)
  157. child->unsetFlags(flags);
  158. }
  159. void SceneObject::_instantiate()
  160. {
  161. std::function<void(SceneObject*)> instantiateRecursive = [&](SceneObject* obj)
  162. {
  163. obj->mFlags &= ~SOF_DontInstantiate;
  164. if (obj->mParent == nullptr)
  165. gCoreSceneManager().registerNewSO(obj->mThisHandle);
  166. for (auto& component : obj->mComponents)
  167. component->instantiate();
  168. for (auto& child : obj->mChildren)
  169. instantiateRecursive(child.get());
  170. };
  171. std::function<void(SceneObject*)> triggerEventsRecursive = [&](SceneObject* obj)
  172. {
  173. for (auto& component : obj->mComponents)
  174. {
  175. component->onInitialized();
  176. if (obj->getActive())
  177. component->onEnabled();
  178. }
  179. for (auto& child : obj->mChildren)
  180. triggerEventsRecursive(child.get());
  181. };
  182. instantiateRecursive(this);
  183. triggerEventsRecursive(this);
  184. }
  185. /************************************************************************/
  186. /* Transform */
  187. /************************************************************************/
  188. void SceneObject::setPosition(const Vector3& position)
  189. {
  190. mPosition = position;
  191. notifyTransformChanged(TCF_Transform);
  192. }
  193. void SceneObject::setRotation(const Quaternion& rotation)
  194. {
  195. mRotation = rotation;
  196. notifyTransformChanged(TCF_Transform);
  197. }
  198. void SceneObject::setScale(const Vector3& scale)
  199. {
  200. mScale = scale;
  201. notifyTransformChanged(TCF_Transform);
  202. }
  203. void SceneObject::setWorldPosition(const Vector3& position)
  204. {
  205. if (mParent != nullptr)
  206. {
  207. Vector3 invScale = mParent->getWorldScale();
  208. if (invScale.x != 0) invScale.x = 1.0f / invScale.x;
  209. if (invScale.y != 0) invScale.y = 1.0f / invScale.y;
  210. if (invScale.z != 0) invScale.z = 1.0f / invScale.z;
  211. Quaternion invRotation = mParent->getWorldRotation().inverse();
  212. mPosition = invRotation.rotate(position - mParent->getWorldPosition()) * invScale;
  213. }
  214. else
  215. mPosition = position;
  216. notifyTransformChanged(TCF_Transform);
  217. }
  218. void SceneObject::setWorldRotation(const Quaternion& rotation)
  219. {
  220. if (mParent != nullptr)
  221. {
  222. Quaternion invRotation = mParent->getWorldRotation().inverse();
  223. mRotation = invRotation * rotation;
  224. }
  225. else
  226. mRotation = rotation;
  227. notifyTransformChanged(TCF_Transform);
  228. }
  229. void SceneObject::setWorldScale(const Vector3& scale)
  230. {
  231. if (mParent != nullptr)
  232. {
  233. Matrix3 rotScale;
  234. mParent->getWorldTfrm().extract3x3Matrix(rotScale);
  235. rotScale.inverse();
  236. Matrix3 scaleMat = Matrix3(Quaternion::IDENTITY, scale);
  237. scaleMat = rotScale * scaleMat;
  238. Quaternion rotation;
  239. Vector3 localScale;
  240. scaleMat.decomposition(rotation, localScale);
  241. mScale = localScale;
  242. }
  243. else
  244. mScale = scale;
  245. notifyTransformChanged(TCF_Transform);
  246. }
  247. const Vector3& SceneObject::getWorldPosition() const
  248. {
  249. if (!isCachedWorldTfrmUpToDate())
  250. updateWorldTfrm();
  251. return mWorldPosition;
  252. }
  253. const Quaternion& SceneObject::getWorldRotation() const
  254. {
  255. if (!isCachedWorldTfrmUpToDate())
  256. updateWorldTfrm();
  257. return mWorldRotation;
  258. }
  259. const Vector3& SceneObject::getWorldScale() const
  260. {
  261. if (!isCachedWorldTfrmUpToDate())
  262. updateWorldTfrm();
  263. return mWorldScale;
  264. }
  265. void SceneObject::lookAt(const Vector3& location, const Vector3& up)
  266. {
  267. Vector3 forward = location - getWorldPosition();
  268. Quaternion rotation = getWorldRotation();
  269. rotation.lookRotation(forward, up);
  270. setWorldRotation(rotation);
  271. }
  272. const Matrix4& SceneObject::getWorldTfrm() const
  273. {
  274. if (!isCachedWorldTfrmUpToDate())
  275. updateWorldTfrm();
  276. return mCachedWorldTfrm;
  277. }
  278. Matrix4 SceneObject::getInvWorldTfrm() const
  279. {
  280. if (!isCachedWorldTfrmUpToDate())
  281. updateWorldTfrm();
  282. Matrix4 worldToLocal = Matrix4::inverseTRS(mWorldPosition, mWorldRotation, mWorldScale);
  283. return worldToLocal;
  284. }
  285. const Matrix4& SceneObject::getLocalTfrm() const
  286. {
  287. if (!isCachedLocalTfrmUpToDate())
  288. updateLocalTfrm();
  289. return mCachedLocalTfrm;
  290. }
  291. void SceneObject::move(const Vector3& vec)
  292. {
  293. setPosition(mPosition + vec);
  294. }
  295. void SceneObject::moveRelative(const Vector3& vec)
  296. {
  297. // Transform the axes of the relative vector by camera's local axes
  298. Vector3 trans = mRotation.rotate(vec);
  299. setPosition(mPosition + trans);
  300. }
  301. void SceneObject::rotate(const Vector3& axis, const Radian& angle)
  302. {
  303. Quaternion q;
  304. q.fromAxisAngle(axis, angle);
  305. rotate(q);
  306. }
  307. void SceneObject::rotate(const Quaternion& q)
  308. {
  309. // Note the order of the mult, i.e. q comes after
  310. // Normalize the quat to avoid cumulative problems with precision
  311. Quaternion qnorm = q;
  312. qnorm.normalize();
  313. setRotation(qnorm * mRotation);
  314. }
  315. void SceneObject::roll(const Radian& angle)
  316. {
  317. // Rotate around local Z axis
  318. Vector3 zAxis = mRotation.rotate(Vector3::UNIT_Z);
  319. rotate(zAxis, angle);
  320. }
  321. void SceneObject::yaw(const Radian& angle)
  322. {
  323. Vector3 yAxis = mRotation.rotate(Vector3::UNIT_Y);
  324. rotate(yAxis, angle);
  325. }
  326. void SceneObject::pitch(const Radian& angle)
  327. {
  328. // Rotate around local X axis
  329. Vector3 xAxis = mRotation.rotate(Vector3::UNIT_X);
  330. rotate(xAxis, angle);
  331. }
  332. void SceneObject::setForward(const Vector3& forwardDir)
  333. {
  334. Quaternion currentRotation = getWorldRotation();
  335. currentRotation.lookRotation(forwardDir);
  336. setWorldRotation(currentRotation);
  337. }
  338. void SceneObject::updateTransformsIfDirty()
  339. {
  340. if (!isCachedLocalTfrmUpToDate())
  341. updateLocalTfrm();
  342. if (!isCachedWorldTfrmUpToDate())
  343. updateWorldTfrm();
  344. }
  345. void SceneObject::notifyTransformChanged(TransformChangedFlags flags) const
  346. {
  347. mDirtyFlags |= DirtyFlags::LocalTfrmDirty | DirtyFlags::WorldTfrmDirty;
  348. mDirtyHash++;
  349. for(auto& entry : mComponents)
  350. {
  351. if (entry->supportsNotify(flags))
  352. entry->onTransformChanged(flags);
  353. }
  354. for (auto& entry : mChildren)
  355. entry->notifyTransformChanged(flags);
  356. }
  357. void SceneObject::updateWorldTfrm() const
  358. {
  359. if(mParent != nullptr)
  360. {
  361. // Update orientation
  362. const Quaternion& parentOrientation = mParent->getWorldRotation();
  363. mWorldRotation = parentOrientation * mRotation;
  364. // Update scale
  365. const Vector3& parentScale = mParent->getWorldScale();
  366. // Scale own position by parent scale, just combine
  367. // as equivalent axes, no shearing
  368. mWorldScale = parentScale * mScale;
  369. // Change position vector based on parent's orientation & scale
  370. mWorldPosition = parentOrientation.rotate(parentScale * mPosition);
  371. // Add altered position vector to parents
  372. mWorldPosition += mParent->getWorldPosition();
  373. mCachedWorldTfrm.setTRS(mWorldPosition, mWorldRotation, mWorldScale);
  374. }
  375. else
  376. {
  377. mWorldRotation = mRotation;
  378. mWorldPosition = mPosition;
  379. mWorldScale = mScale;
  380. mCachedWorldTfrm = getLocalTfrm();
  381. }
  382. mDirtyFlags &= ~DirtyFlags::WorldTfrmDirty;
  383. }
  384. void SceneObject::updateLocalTfrm() const
  385. {
  386. mCachedLocalTfrm.setTRS(mPosition, mRotation, mScale);
  387. mDirtyFlags &= ~DirtyFlags::LocalTfrmDirty;
  388. }
  389. /************************************************************************/
  390. /* Hierarchy */
  391. /************************************************************************/
  392. void SceneObject::setParent(const HSceneObject& parent, bool keepWorldTransform)
  393. {
  394. if (parent.isDestroyed())
  395. return;
  396. #if BS_EDITOR_BUILD
  397. String originalPrefab = getPrefabLink();
  398. #endif
  399. _setParent(parent, keepWorldTransform);
  400. #if BS_EDITOR_BUILD
  401. if (gCoreApplication().isEditor())
  402. {
  403. String newPrefab = getPrefabLink();
  404. if (originalPrefab != newPrefab)
  405. PrefabUtility::clearPrefabIds(mThisHandle);
  406. }
  407. #endif
  408. }
  409. void SceneObject::_setParent(const HSceneObject& parent, bool keepWorldTransform)
  410. {
  411. if (mThisHandle == parent)
  412. return;
  413. if (mParent == nullptr || mParent != parent)
  414. {
  415. Vector3 worldPos;
  416. Quaternion worldRot;
  417. Vector3 worldScale;
  418. if (keepWorldTransform)
  419. {
  420. // Make sure the object keeps its world coordinates
  421. worldPos = getWorldPosition();
  422. worldRot = getWorldRotation();
  423. worldScale = getWorldScale();
  424. }
  425. if (mParent != nullptr)
  426. mParent->removeChild(mThisHandle);
  427. if (parent != nullptr)
  428. parent->addChild(mThisHandle);
  429. mParent = parent;
  430. if (keepWorldTransform)
  431. {
  432. setWorldPosition(worldPos);
  433. setWorldRotation(worldRot);
  434. setWorldScale(worldScale);
  435. }
  436. notifyTransformChanged((TransformChangedFlags)(TCF_Parent | TCF_Transform));
  437. }
  438. }
  439. HSceneObject SceneObject::getChild(UINT32 idx) const
  440. {
  441. if(idx < 0 || idx >= mChildren.size())
  442. {
  443. BS_EXCEPT(InternalErrorException, "Child index out of range.");
  444. }
  445. return mChildren[idx];
  446. }
  447. int SceneObject::indexOfChild(const HSceneObject& child) const
  448. {
  449. for(int i = 0; i < (int)mChildren.size(); i++)
  450. {
  451. if(mChildren[i] == child)
  452. return i;
  453. }
  454. return -1;
  455. }
  456. void SceneObject::addChild(const HSceneObject& object)
  457. {
  458. mChildren.push_back(object);
  459. object->setFlags(mFlags);
  460. }
  461. void SceneObject::removeChild(const HSceneObject& object)
  462. {
  463. auto result = find(mChildren.begin(), mChildren.end(), object);
  464. if(result != mChildren.end())
  465. mChildren.erase(result);
  466. else
  467. {
  468. BS_EXCEPT(InternalErrorException,
  469. "Trying to remove a child but it's not a child of the transform.");
  470. }
  471. }
  472. HSceneObject SceneObject::findChild(const String& name, bool recursive)
  473. {
  474. for (auto& child : mChildren)
  475. {
  476. if (child->getName() == name)
  477. return child;
  478. }
  479. if (recursive)
  480. {
  481. for (auto& child : mChildren)
  482. {
  483. HSceneObject foundObject = child->findChild(name, true);
  484. if (foundObject != nullptr)
  485. return foundObject;
  486. }
  487. }
  488. return HSceneObject();
  489. }
  490. Vector<HSceneObject> SceneObject::findChildren(const String& name, bool recursive)
  491. {
  492. std::function<void(const HSceneObject&, Vector<HSceneObject>&)> findChildrenInternal =
  493. [&](const HSceneObject& so, Vector<HSceneObject>& output)
  494. {
  495. for (auto& child : so->mChildren)
  496. {
  497. if (child->getName() == name)
  498. output.push_back(child);
  499. }
  500. if (recursive)
  501. {
  502. for (auto& child : so->mChildren)
  503. findChildrenInternal(child, output);
  504. }
  505. };
  506. Vector<HSceneObject> output;
  507. findChildrenInternal(mThisHandle, output);
  508. return output;
  509. }
  510. void SceneObject::setActive(bool active)
  511. {
  512. mActiveSelf = active;
  513. setActiveHierarchy(active);
  514. }
  515. void SceneObject::setActiveHierarchy(bool active)
  516. {
  517. bool activeHierarchy = active && mActiveSelf;
  518. if (mActiveHierarchy != activeHierarchy)
  519. {
  520. mActiveHierarchy = activeHierarchy;
  521. if (activeHierarchy)
  522. {
  523. for (auto& component : mComponents)
  524. component->onEnabled();
  525. }
  526. else
  527. {
  528. for (auto& component : mComponents)
  529. component->onDisabled();
  530. }
  531. }
  532. for (auto child : mChildren)
  533. {
  534. child->setActiveHierarchy(mActiveHierarchy);
  535. }
  536. }
  537. bool SceneObject::getActive(bool self)
  538. {
  539. if (self)
  540. return mActiveSelf;
  541. else
  542. return mActiveHierarchy;
  543. }
  544. HSceneObject SceneObject::clone(bool instantiate)
  545. {
  546. if (!instantiate)
  547. setFlags(SOF_DontInstantiate);
  548. UINT32 bufferSize = 0;
  549. MemorySerializer serializer;
  550. UINT8* buffer = serializer.encode(this, bufferSize, (void*(*)(UINT32))&bs_alloc);
  551. GameObjectManager::instance().setDeserializationMode(GODM_UseNewIds | GODM_RestoreExternal);
  552. std::shared_ptr<SceneObject> cloneObj = std::static_pointer_cast<SceneObject>(serializer.decode(buffer, bufferSize));
  553. bs_free(buffer);
  554. if (!instantiate)
  555. unsetFlags(SOF_DontInstantiate);
  556. return cloneObj->mThisHandle;
  557. }
  558. HComponent SceneObject::getComponent(RTTITypeBase* type) const
  559. {
  560. for(auto& entry : mComponents)
  561. {
  562. if(entry->getRTTI()->isDerivedFrom(type))
  563. return entry;
  564. }
  565. return HComponent();
  566. }
  567. void SceneObject::destroyComponent(const HComponent component, bool immediate)
  568. {
  569. if(component == nullptr)
  570. {
  571. LOGDBG("Trying to remove a null component");
  572. return;
  573. }
  574. auto iter = std::find(mComponents.begin(), mComponents.end(), component);
  575. if(iter != mComponents.end())
  576. {
  577. (*iter)->_setIsDestroyed();
  578. if (isInstantiated())
  579. {
  580. if (getActive())
  581. component->onDisabled();
  582. (*iter)->onDestroyed();
  583. }
  584. (*iter)->destroyInternal(*iter, immediate);
  585. mComponents.erase(iter);
  586. }
  587. else
  588. LOGDBG("Trying to remove a component that doesn't exist on this SceneObject.");
  589. }
  590. void SceneObject::destroyComponent(Component* component, bool immediate)
  591. {
  592. auto iterFind = std::find_if(mComponents.begin(), mComponents.end(),
  593. [component](const HComponent& x)
  594. {
  595. if(x.isDestroyed())
  596. return false;
  597. return x._getHandleData()->mPtr->object.get() == component; }
  598. );
  599. if(iterFind != mComponents.end())
  600. {
  601. destroyComponent(*iterFind, immediate);
  602. }
  603. }
  604. void SceneObject::addComponentInternal(const std::shared_ptr<Component> component)
  605. {
  606. GameObjectHandle<Component> newComponent = GameObjectManager::instance().getObject(component->getInstanceId());
  607. newComponent->mParent = mThisHandle;
  608. newComponent->mThisHandle = newComponent;
  609. mComponents.push_back(newComponent);
  610. }
  611. RTTITypeBase* SceneObject::getRTTIStatic()
  612. {
  613. return SceneObjectRTTI::instance();
  614. }
  615. RTTITypeBase* SceneObject::getRTTI() const
  616. {
  617. return SceneObject::getRTTIStatic();
  618. }
  619. }