zone.h

Engine/source/T3D/zone.h

More...

Classes:

class

A volume in space that encloses objects.

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 _ZONE_H_
25#define _ZONE_H_
26
27#ifndef _SCENEPOLYHEDRALZONE_H_
28#include "scene/zones/scenePolyhedralZone.h"
29#endif
30
31#ifndef _SCENEAMBIENTSOUNDOBJECT_H_
32#include "scene/mixin/sceneAmbientSoundObject.h"
33#endif
34
35#ifndef _TVECTOR_H_
36#include "core/util/tVector.h"
37#endif
38
39
40/// A volume in space that encloses objects.
41///
42/// Zones do not physically contain objects in the scene.  Rather, any object
43/// that has its world box coincide with the world box of a zone is considered
44/// to be part of that zone.  As such, objects can be in multiple zones at
45/// the same time.
46class Zone : public SceneAmbientSoundObject< ScenePolyhedralZone >
47{
48   public:
49      bool mSelecting = false;
50      static void initPersistFields();
51      static bool _doSelect(void* object, const char* index, const char* data);
52      typedef SceneAmbientSoundObject< ScenePolyhedralZone> Parent;
53      void selectWithin();
54   protected:
55
56      // SceneVolume.
57      virtual ColorI _getDefaultEditorSolidColor() const { return ColorI( 255, 0, 0, 45 ); }
58
59   public:
60
61      Zone() {}
62      Zone( const Polyhedron& polyhedron )
63      {
64         mPolyhedron = polyhedron;
65      }
66
67      // SimObject
68      DECLARE_CONOBJECT( Zone );
69      DECLARE_DESCRIPTION( "A volume that encloses objects for visibility culling." );
70      DECLARE_CATEGORY( "3D" );
71
72      static void consoleInit();
73};
74
75#endif // _ZONE_H_
76