sceneRootZone.cpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2012 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. #include "platform/platform.h"
  23. #include "scene/zones/sceneRootZone.h"
  24. #include "scene/sceneManager.h"
  25. #include "scene/sceneRenderState.h"
  26. //RD: for the SceneRootZone, it may be worthwhile to put an optimized path in place that
  27. // does some spatially aware testing of portals rather than just blindly going through
  28. // the list of connected zone managers
  29. //-----------------------------------------------------------------------------
  30. SceneRootZone::SceneRootZone()
  31. {
  32. setGlobalBounds();
  33. resetWorldBox();
  34. // Clear netflags we have inherited. We don't
  35. // network scene roots.
  36. mNetFlags.clear( Ghostable | ScopeAlways );
  37. // Clear type flags we have inherited.
  38. mTypeMask &= ~StaticObjectType;
  39. }
  40. //-----------------------------------------------------------------------------
  41. String SceneRootZone::describeSelf() const
  42. {
  43. String str = Parent::describeSelf();
  44. str += "|SceneRootZone";
  45. return str;
  46. }
  47. //-----------------------------------------------------------------------------
  48. bool SceneRootZone::onSceneAdd()
  49. {
  50. if( !Parent::onSceneAdd() )
  51. return false;
  52. AssertFatal( getZoneRangeStart() == SceneZoneSpaceManager::RootZoneId, "SceneRootZone::onSceneAdd - SceneRootZone must be first scene object zone manager!" );
  53. return true;
  54. }
  55. //-----------------------------------------------------------------------------
  56. void SceneRootZone::onSceneRemove()
  57. {
  58. AssertFatal( getZoneRangeStart() == SceneZoneSpaceManager::RootZoneId, "SceneRootZone::onSceneRemove - SceneRootZone must be first scene object zone manager!");
  59. Parent::onSceneRemove();
  60. }
  61. //-----------------------------------------------------------------------------
  62. bool SceneRootZone::onAdd()
  63. {
  64. AssertFatal( false, "SceneRootZone::onAdd - Must not register SceneRootZone!" );
  65. return false;
  66. }
  67. //-----------------------------------------------------------------------------
  68. void SceneRootZone::onRemove()
  69. {
  70. AssertFatal( false, "SceneRootZone::onRemove - Must not be called!" );
  71. }
  72. //-----------------------------------------------------------------------------
  73. U32 SceneRootZone::getPointZone( const Point3F &p ) const
  74. {
  75. return 0;
  76. }
  77. //-----------------------------------------------------------------------------
  78. bool SceneRootZone::getOverlappingZones( const Box3F& aabb, U32* outZones, U32& outNumZones )
  79. {
  80. // Everything overlaps the outside zone.
  81. outZones[ 0 ] = SceneZoneSpaceManager::RootZoneId;
  82. outNumZones = 1;
  83. return false;
  84. }
  85. //-----------------------------------------------------------------------------
  86. bool SceneRootZone::containsPoint( const Point3F &point ) const
  87. {
  88. return true;
  89. }