Torque3D Documentation / _generateds / scenePolyhedralZone.h

scenePolyhedralZone.h

Engine/source/scene/zones/scenePolyhedralZone.h

More...

Classes:

class

A simple zone space that is described by a polyhedron.

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 _SCENEPOLYHEDRALZONE_H_
25#define _SCENEPOLYHEDRALZONE_H_
26
27#ifndef _SCENESIMPLEZONE_H_
28#include "scene/zones/sceneSimpleZone.h"
29#endif
30
31#ifndef _SCENEPOLYHEDRALOBJECT_H_
32#include "scene/mixin/scenePolyhedralObject.h"
33#endif
34
35#ifndef _MINTERSECTOR_H_
36#include "math/mIntersector.h"
37#endif
38
39
40/// A simple zone space that is described by a polyhedron.
41///
42/// By default, if no other polyhedron is assigned to a polyhedral zone, the
43/// polyhedron is initialized from the zone's object box.
44class ScenePolyhedralZone : public ScenePolyhedralObject< SceneSimpleZone >
45{
46   public:
47
48      typedef ScenePolyhedralObject< SceneSimpleZone> Parent;
49
50   protected:
51
52      typedef PolyhedronBoxIntersector< PolyhedronType> IntersectorType;
53
54      /// Fast polyhedron/AABB intersector used for testing SceneObject AABBs
55      /// for overlap with the zone.
56      IntersectorType mIntersector;
57
58      /// Precompute polyhedron/AABB intersection data.
59      void _updateIntersector()
60      {
61         mIntersector = IntersectorType( getPolyhedron(), getTransform(), getScale(), getWorldBox() );
62      }
63
64      // SceneSimpleZone.
65      virtual void _updateOrientedWorldBox();
66
67   public:
68
69      ScenePolyhedralZone() {}
70      ScenePolyhedralZone( const PolyhedronType& polyhedron );
71
72      // SimObject.
73      virtual bool onAdd();
74
75      // SceneObject.
76      virtual void setTransform( const MatrixF& mat );
77
78      // SceneZoneSpace.
79      virtual bool getOverlappingZones( const Box3F& aabb, U32* outZones, U32& outNumZones );
80};
81
82#endif // !_SCENEPOLYHEDRALZONE_H_
83