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