decalSphere.h
Engine/source/T3D/decal/decalSphere.h
Classes:
class
A bounding sphere in world space and a list of DecalInstance(s) contained by it.
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#ifndef _DECALSPHERE_H_ 25#define _DECALSPHERE_H_ 26 27#ifndef _TVECTOR_H_ 28#include "core/util/tVector.h" 29#endif 30 31#ifndef _MSPHERE_H_ 32#include "math/mSphere.h" 33#endif 34 35 36class DecalInstance; 37class SceneZoneSpaceManager; 38 39 40/// A bounding sphere in world space and a list of DecalInstance(s) 41/// contained by it. DecalInstance(s) are organized/binned in this fashion 42/// as a lookup and culling optimization. 43class DecalSphere 44{ 45 public: 46 47 static F32 smDistanceTolerance; 48 static F32 smRadiusTolerance; 49 50 DecalSphere() 51 { 52 VECTOR_SET_ASSOCIATION( mItems ); 53 VECTOR_SET_ASSOCIATION( mZones ); 54 } 55 DecalSphere( const Point3F &position, F32 radius ) 56 { 57 VECTOR_SET_ASSOCIATION( mItems ); 58 VECTOR_SET_ASSOCIATION( mZones ); 59 60 mWorldSphere.center = position; 61 mWorldSphere.radius = radius; 62 } 63 64 /// Recompute #mWorldSphere from the current instance list. 65 void updateWorldSphere(); 66 67 /// Recompute the zoning information from the current bounds. 68 void updateZoning( SceneZoneSpaceManager* zoneManager ); 69 70 /// Decal instances in this sphere. 71 Vector< DecalInstance*> mItems; 72 73 /// Zones that intersect with this sphere. If this is empty, the zoning 74 /// state of the sphere is uninitialized. 75 Vector< U32> mZones; 76 77 /// World-space sphere corresponding to this DecalSphere. 78 SphereF mWorldSphere; 79 80 /// 81 bool tryAddItem( DecalInstance* inst ); 82}; 83 84#endif // !_DECALSPHERE_H_ 85