OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
OgrePCZFrustum.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2014 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 OgrePCZFrustum.h - PCZ Supplemental Culling Frustum
28 
29 This isn't really a traditional "frustum", but more a collection of
30 extra culling planes used by the PCZ Scene Manager for supplementing
31 the camera culling and light zone culling by creating extra culling
32 planes from visible portals. Since portals are 4 sided, the extra
33 culling planes tend to form frustums (pyramids) but nothing in the
34 code really assumes that the culling planes are frustums. They are
35 just treated as planes.
36 
37 The "originPlane" is a culling plane which passes through the origin
38 point specified. It is used to cull portals which are close to, but
39 behind the camera view. (the nature of the culling routine doesn't
40 give correct results if you just use the "near" plane of the standard
41 camera frustum (unless that near plane distance is 0.0, but that is
42 highly not recommended for other reasons having to do with having a
43 legal view frustum).
44 ---------------------------------------------------------------------------
45 begin : Mon May 29 2007
46 author : Eric Cha
47 email : ericc@xenopi.com
48 Code Style Update :
49 
50 ---------------------------------------------------------------------------
51 */
52 
53 #ifndef PCZ_FRUSTUM_H
54 #define PCZ_FRUSTUM_H
55 
56 #include "OgrePCZPrerequisites.h"
57 #include "OgreFrustum.h"
58 
59 namespace Ogre
60 {
61  class PortalBase;
62  class PCPlane;
63 
65 
70  {
71  public:
72  // visibility types
74  {
77  FULL
78  };
79 
81  PCZFrustum();
83  ~PCZFrustum();
84 
85  /* isVisible function for aabb */
86  bool isVisible( const AxisAlignedBox &bound) const;
87  /* isVisible function for sphere */
88  bool isVisible( const Sphere &bound) const;
89  /* isVisible() function for portals */
90  bool isVisible(const PortalBase* portal) const;
91  /* special function that returns true only when aabb fully fits inside the frustum. */
92  bool isFullyVisible(const AxisAlignedBox& bound) const;
93  /* special function that returns true only when sphere fully fits inside the frustum. */
94  bool isFullyVisible(const Sphere& bound) const;
95  /* special function that returns true only when portal fully fits inside the frustum. */
96  bool isFullyVisible(const PortalBase* portal) const;
97  /* more detailed check for visibility of an AABB */
98  PCZFrustum::Visibility getVisibility(const AxisAlignedBox & bound);
99 
102  int addPortalCullingPlanes(PortalBase* portal);
104  void removePortalCullingPlanes(PortalBase* portal);
106  void removeAllCullingPlanes(void);
108  void setOrigin(const Vector3 & newOrigin) {mOrigin = newOrigin;}
110  void setOriginPlane(const Vector3 &rkNormal, const Vector3 &rkPoint);
112  void setUseOriginPlane(bool yesno) {mUseOriginPlane = yesno;}
114  PCPlane * getUnusedCullingPlane(void);
115 
117  inline void setProjectionType(ProjectionType projType)
118  { mProjType = projType; }
121  { return mProjType; }
122 
123  protected:
130 
131  };
132 
133 }
134 
135 
136 #endif
Specialized frustum shaped culling volume that has culling planes created from portals.
Defines a plane in 3D space.
Definition: OgrePlane.h:61
A 3D box aligned with the x/y/z axes.
PortalBase - Base class to Portal and AntiPortal classes.
ProjectionType mProjType
void setProjectionType(ProjectionType projType)
Set the projection type of this PCZFrustum.
PCPlaneList mActiveCullingPlanes
ProjectionType getProjectionType() const
Get the projection type of this PCZFrustum.
ProjectionType
Specifies perspective (realistic) or orthographic (architectural) projection.
Definition: OgreFrustum.h:62
A sphere primitive, mostly used for bounds checking.
Definition: OgreSphere.h:51
#define _OgrePCZPluginExport
Standard 3-dimensional vector.
Definition: OgreVector3.h:50
void setUseOriginPlane(bool yesno)
Tell the frustum whether or not to use the originplane.
list< PCPlane * >::type PCPlaneList
PCPlaneList mCullingPlaneReservoir
void setOrigin(const Vector3 &newOrigin)
Set the origin value.