OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::Frustum Class Reference

A frustum represents a pyramid, capped at the near and far end which is used to represent either a visible area or a projection area. More...

#include <OgreFrustum.h>

+ Inheritance diagram for Ogre::Frustum:

Public Member Functions

 Frustum (IdType id, ObjectMemoryManager *objectMemoryManager)
 Named constructor. More...
 
 ~Frustum () override
 
const Plane_getCachedFrustumPlanes () const
 Returns the frustum planes, doesn't check if dirty. More...
 
const Vector3_getCachedWorldSpaceCorners () const
 
virtual void calcViewMatrixRelative (const Vector3 &relPos, Matrix4 &matToUpdate) const
 Calculate a view matrix for this frustum, relative to a potentially dynamic point. More...
 
virtual void disableCustomNearClipPlane ()
 Disables any custom near clip plane. More...
 
virtual void disableReflection ()
 Disables reflection modification previously turned on with enableReflection. More...
 
virtual void enableCustomNearClipPlane (const MovablePlane *plane)
 Links the frustum to a custom near clip plane, which can be used to clip geometry in a custom manner without using user clip planes. More...
 
virtual void enableCustomNearClipPlane (const Plane &plane)
 Links the frustum to a custom near clip plane, which can be used to clip geometry in a custom manner without using user clip planes. More...
 
virtual void enableReflection (const MovablePlane *p)
 Modifies this frustum so it always renders from the reflection of itself through the plane specified. More...
 
virtual void enableReflection (const Plane &p)
 Modifies this frustum so it always renders from the reflection of itself through the plane specified. More...
 
virtual Real getAspectRatio () const
 Retrieves the current aspect ratio. More...
 
const AxisAlignedBoxgetBoundingBox () const
 Overridden from MovableObject. More...
 
void getCustomWorldSpaceCorners (ArrayVector3 outCorners[(8+ARRAY_PACKED_REALS - 1)/ARRAY_PACKED_REALS], Real customFarPlane) const
 
virtual Real getFarClipDistance () const
 Retrieves the distance from the frustum to the far clipping plane. More...
 
virtual Real getFocalLength () const
 Returns focal length of frustum. More...
 
virtual const RadiangetFOVy () const
 Retrieves the frustums Y-dimension Field Of View (FOV). More...
 
virtual void getFrustumExtents (Real &outleft, Real &outright, Real &outtop, Real &outbottom, FrustrumExtentsType frustrumExtentsType=FET_PROJ_PLANE_POS) const
 Get the extents of the frustum in view space. More...
 
bool getFrustumExtentsManuallySet () const
 
virtual const Vector2getFrustumOffset () const
 Retrieves the frustum offsets. More...
 
virtual const PlanegetFrustumPlane (unsigned short plane) const
 Retrieves a specified plane of the frustum (world space). More...
 
const PlanegetFrustumPlanes () const
 Retrieves the clipping planes of the frustum (world space). More...
 
const LightListgetLights () const override
 Overridden from Renderable. More...
 
const StringgetMovableType () const override
 Overridden from MovableObject. More...
 
virtual Real getNearClipDistance () const
 Sets the position of the near clipping plane. More...
 
virtual const QuaterniongetOrientationForViewUpdate () const
 Get the derived orientation of this frustum. More...
 
OrientationMode getOrientationMode () const
 Get the orientation mode of the frustum. More...
 
Radian getOrientationModeAngle () const
 Get the orientation mode angle of the frustum. More...
 
virtual Real getOrthoWindowHeight () const
 Gets the orthographic window height, for use with orthographic rendering only. More...
 
virtual Real getOrthoWindowWidth () const
 Gets the orthographic window width, for use with orthographic rendering only. More...
 
PlaneBoundedVolume getPlaneBoundedVolume ()
 Gets a world-space list of planes enclosing the frustum. More...
 
virtual const Vector3getPositionForViewUpdate () const
 Get the derived position of this frustum. More...
 
virtual const Matrix4getProjectionMatrix () const
 Gets the normal projection matrix for this frustum, ie the projection matrix which conforms to standard right-handed rules and uses depth range [-1,+1]. More...
 
virtual const Matrix4getProjectionMatrixWithRSDepth () const
 Gets the depth-adjusted projection matrix for the current rendersystem, but one which still conforms to right-hand rules. More...
 
Vector2 getProjectionParamsAB () const
 Returns the terms projectionA and projectionB in .x and .y respectively, which can be used to reconstruct linear depth from a Z buffer. More...
 
virtual ProjectionType getProjectionType () const
 Retrieves info on the type of projection used (orthographic or perspective). More...
 
virtual const Matrix4getReflectionMatrix () const
 Returns the reflection matrix of the frustum if appropriate. More...
 
virtual const PlanegetReflectionPlane () const
 Returns the reflection plane of the frustum if appropriate. More...
 
void getRenderOperation (v1::RenderOperation &op, bool casterPass) override
 Overridden from Renderable. More...
 
Real getSquaredViewDepth (const Camera *cam) const
 Overridden from Renderable. More...
 
virtual const Matrix4getViewMatrix () const
 Gets the view matrix for this frustum. More...
 
virtual const Vector3getWorldSpaceCorners () const
 Gets the world space corners of the frustum. More...
 
void getWorldTransforms (Matrix4 *xform) const override
 Overridden from Renderable. More...
 
virtual bool isCustomNearClipPlaneEnabled () const
 Is a custom near clip plane in use? More...
 
virtual bool isCustomProjectionMatrixEnabled () const
 Returns whether a custom projection matrix is in use. More...
 
virtual bool isCustomViewMatrixEnabled () const
 Returns whether a custom view matrix is in use. More...
 
virtual bool isReflected () const
 Returns whether this frustum is being reflected. More...
 
virtual bool isVisible (const AxisAlignedBox &bound, FrustumPlane *culledBy=0) const
 Tests whether the given container is visible in the Frustum. More...
 
virtual bool isVisible (const Sphere &bound, FrustumPlane *culledBy=0) const
 Tests whether the given container is visible in the Frustum. More...
 
virtual bool isVisible (const Vector3 &vert, FrustumPlane *culledBy=0) const
 Tests whether the given vertex is visible in the Frustum. More...
 
virtual bool projectSphere (const Sphere &sphere, Real *left, Real *top, Real *right, Real *bottom) const
 Project a sphere onto the near plane and get the bounding rectangle. More...
 
virtual void resetFrustumExtents ()
 Reset the frustum extents to be automatically derived from other params. More...
 
virtual void setAspectRatio (Real ratio)
 Sets the aspect ratio for the frustum viewport. More...
 
virtual void setCustomProjectionMatrix (bool enable, const Matrix4 &projectionMatrix=Matrix4::IDENTITY, bool alternateDepthRange=false)
 Set whether to use a custom projection matrix on this frustum. More...
 
virtual void setCustomViewMatrix (bool enable, const Matrix4 &viewMatrix=Matrix4::IDENTITY)
 Set whether to use a custom view matrix on this frustum. More...
 
virtual void setFarClipDistance (Real farDist)
 Sets the distance to the far clipping plane. More...
 
virtual void setFocalLength (Real focalLength=1.0)
 Sets frustum focal length (used in stereo rendering). More...
 
virtual void setFOVy (const Radian &fovy)
 Sets the Y-dimension Field Of View (FOV) of the frustum. More...
 
virtual void setFrustumExtents (Real left, Real right, Real top, Real bottom, FrustrumExtentsType frustrumExtentsType=FET_PROJ_PLANE_POS)
 Manually set the extents of the frustum. More...
 
virtual void setFrustumOffset (const Vector2 &offset)
 Sets frustum offsets, used in stereo rendering. More...
 
virtual void setFrustumOffset (Real horizontal=0.0, Real vertical=0.0)
 Sets frustum offsets, used in stereo rendering. More...
 
virtual void setNearClipDistance (Real nearDist)
 Sets the position of the near clipping plane. More...
 
void setOrientationMode (OrientationMode orientationMode)
 Set the orientation mode of the frustum. More...
 
virtual void setOrthoWindow (Real w, Real h)
 Sets the orthographic window settings, for use with orthographic rendering only. More...
 
virtual void setOrthoWindowHeight (Real h)
 Sets the orthographic window height, for use with orthographic rendering only. More...
 
virtual void setOrthoWindowWidth (Real w)
 Sets the orthographic window width, for use with orthographic rendering only. More...
 
virtual void setProjectionType (ProjectionType pt)
 Sets the type of projection to use (orthographic or perspective). More...
 
- Public Member Functions inherited from Ogre::MovableObject
 MovableObject (IdType id, ObjectMemoryManager *objectMemoryManager, SceneManager *manager, uint8 renderQueueId)
 Constructor. More...
 
 MovableObject (ObjectData *objectDataPtrs)
 Don't use this constructor unless you know what you're doing. More...
 
virtual ~MovableObject ()
 Virtual destructor - read Scott Meyers if you don't know why this is needed. More...
 
LightList_getLightList ()
 Returns a pointer to the current list of lights for this object. More...
 
SceneManager_getManager () const
 Get the manager of this object, if any (internal use only) More...
 
ObjectData_getObjectData ()
 Returns a direct access to the ObjectData state. More...
 
const Matrix4_getParentNodeFullTransform () const
 Returns the full transformation of the parent sceneNode or the attachingPoint node. More...
 
virtual void _notifyAttached (Node *parent)
 Internal method called to notify the object that it has been attached to a node. More...
 
void _notifyManager (SceneManager *man)
 Notify the object of it's manager (internal use only) More...
 
virtual void _notifyParentNodeMemoryChanged ()
 
virtual void _notifyStaticDirty () const
 Called by SceneManager when it is telling we're a static MovableObject being dirty Don't call this directly. More...
 
virtual void _releaseManualHardwareResources ()
 Notifies the movable object that hardware resources were lost. More...
 
virtual void _restoreManualHardwareResources ()
 Notifies the movable object that hardware resources should be restored. More...
 
virtual void _updateRenderQueue (RenderQueue *queue, Camera *camera, const Camera *lodCamera)
 Internal method by which the movable object must add Renderable subclass instances to the rendering queue. More...
 
void addQueryFlags (uint32 flags)
 As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object. More...
 
void addVisibilityFlags (uint32 flags)
 As setVisibilityFlags, except the flags passed as parameters are appended to the existing flags on this object. More...
 
void detachFromParent ()
 Detaches an object from a parent SceneNode if attached. More...
 
RealAsUint getCachedDistanceToCamera () const
 Returns the distance to camera as calculated in cullFrustum() More...
 
Real getCachedDistanceToCameraAsReal () const
 Returns the distance to camera as calculated in cullFrustum() More...
 
bool getCastShadows () const
 Returns whether shadow casting is enabled for this object. More...
 
unsigned char getCurrentMeshLod () const
 
uint32 getLightMask () const
 Get a bitwise mask which will filter the lights affecting this object. More...
 
ListenergetListener () const
 Gets the current listener for this object. More...
 
Aabb getLocalAabb () const
 Retrieves the local axis-aligned bounding box for this object. More...
 
float getLocalRadius () const
 See getLocalAabb and getWorldRadius. More...
 
const StringgetName () const
 Returns the name of this object. More...
 
NodegetParentNode () const
 Returns the node to which this object is attached. More...
 
SceneNodegetParentSceneNode () const
 
uint32 getQueryFlags () const
 Returns the query flags relevant for this object. More...
 
Real getRenderingDistance () const
 Gets the distance at which batches are no longer rendered. More...
 
Real getRenderingMinPixelSize () const
 Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered. More...
 
uint8 getRenderQueueGroup () const
 Gets the queue group for this entity, see setRenderQueueGroup for full details. More...
 
Real getShadowRenderingDistance () const
 Gets the distance at which batches are no longer casting shadows. More...
 
SkeletonInstancegetSkeletonInstance () const
 
UserObjectBindingsgetUserObjectBindings ()
 Return an instance of user objects binding associated with this class. More...
 
const UserObjectBindingsgetUserObjectBindings () const
 Return an instance of user objects binding associated with this class. More...
 
uint32 getVisibilityFlags () const
 Returns the visibility flags relevant for this object. More...
 
bool getVisible () const
 Gets this object whether to be visible or not, if it has a renderable component. More...
 
Aabb getWorldAabb () const
 Gets the axis aligned box in world space. More...
 
Aabb getWorldAabbUpdated ()
 Gets the axis aligned box in world space. More...
 
float getWorldRadius () const
 Gets the bounding Radius scaled by max( scale.x, scale.y, scale.z ). More...
 
float getWorldRadiusUpdated ()
 Gets the bounding Radius scaled by max( scale.x, scale.y, scale.z ). More...
 
virtual void instanceBatchCullFrustumThreaded (const Frustum *frustum, const Camera *lodCamera, uint32 combinedVisibilityFlags)
 
bool isAttached () const
 Returns true if this object is attached to a Node. More...
 
bool isStatic () const
 Checks whether this MovableObject is static. More...
 
bool isVisible () const
 Returns whether or not this object is supposed to be visible or not. More...
 
const LightListqueryLights () const
 Gets a list of lights, ordered relative to how close they are to this movable object. More...
 
void removeQueryFlags (uint32 flags)
 As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object. More...
 
void removeVisibilityFlags (uint32 flags)
 As setVisibilityFlags, except the flags passed as parameters are removed from the existing flags on this object. More...
 
void resetMeshLod ()
 Sets mCurrentMeshLod to 0. More...
 
void setCastShadows (bool enabled)
 Sets whether or not this object will cast shadows. More...
 
void setLightMask (uint32 lightMask)
 Set a bitwise mask which will filter the lights affecting this object. More...
 
void setListener (Listener *listener)
 Sets a listener for this object. More...
 
void setLocalAabb (const Aabb box)
 Sets the local axis-aligned bounding box for this object. More...
 
void setName (const String &name)
 Sets a custom name for this node. More...
 
void setQueryFlags (uint32 flags)
 Sets the query flags for this object. More...
 
void setRenderingDistance (Real dist)
 Sets the distance at which the object is no longer rendered. More...
 
void setRenderingMinPixelSize (Real pixelSize)
 Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered. More...
 
virtual void setRenderQueueGroup (uint8 queueID)
 Sets the render queue group this entity will be rendered through. More...
 
void setShadowRenderingDistance (Real dist)
 Sets the distance at which the object is no longer casting shadows. More...
 
bool setStatic (bool bStatic)
 Turns this Node into static or dynamic. More...
 
void setVisibilityFlags (uint32 flags)
 Sets the visibility flags for this object. More...
 
void setVisible (bool visible)
 Tells this object whether to be visible or not, if it has a renderable component. More...
 
- Public Member Functions inherited from Ogre::AnimableObject
 AnimableObject ()
 
virtual ~AnimableObject ()
 
virtual AnimableValuePtr createAnimableValue (const String &valueName)
 Create a reference-counted AnimableValuePtr for the named value. More...
 
const StringVectorgetAnimableValueNames () const
 Gets a list of animable value names for this object. More...
 
- Public Member Functions inherited from Ogre::IdObject
 IdObject (IdType id)
 We don't call generateNewId() here, to prevent objects in the stack (i.e. More...
 
IdType getId () const
 Get the unique id of this object. More...
 
bool operator() (const IdObject &left, const IdObject &right)
 
bool operator() (const IdObject *left, const IdObject *right)
 
- Public Member Functions inherited from Ogre::Renderable
 Renderable ()
 
virtual ~Renderable ()
 Virtual destructor needed as class has virtual methods. More...
 
virtual void _setHlmsHashes (uint32 hash, uint32 casterHash)
 Manually sets the hlms hashes. Don't call this directly. More...
 
virtual void _setNullDatablock ()
 Sets the datablock to a null pointer. More...
 
virtual void _updateCustomGpuParameter (const GpuProgramParameters_AutoConstantEntry &constantEntry, GpuProgramParameters *params) const
 Update a custom GpuProgramParameters constant which is derived from information only this Renderable knows. More...
 
void addPoseWeight (size_t index, float w)
 
virtual bool getCastsShadows () const
 Method which reports whether this renderable would normally cast a shadow. More...
 
uint8 getCurrentMaterialLod () const
 
const Vector4getCustomParameter (size_t index) const
 Gets the custom value associated with this Renderable at the given index. More...
 
const CustomParameterMapgetCustomParameters () const
 
HlmsDatablockgetDatablock () const
 
const StringgetDatablockOrMaterialName () const
 
uint32 getHlmsCasterHash () const
 
uint32 getHlmsHash () const
 
MaterialPtr getMaterial () const
 Retrieves the material this renderable object uses. More...
 
unsigned short getNumPoses () const
 
virtual unsigned short getNumWorldTransforms () const
 Returns the number of world transform matrices this renderable requires. More...
 
virtual ParticleType::ParticleType getParticleType () const
 Used by ParticleSystemDef to indicate Hlms they want specific shader code. More...
 
virtual bool getPolygonModeOverrideable () const
 Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting. More...
 
bool getPoseHalfPrecision () const
 
bool getPoseNormals () const
 
TexBufferPackedgetPoseTexBuffer () const
 
float getPoseWeight (size_t index) const
 
float * getPoseWeights () const
 
uint8 getRenderQueueSubGroup () const
 
bool getUseIdentityProjection () const
 Returns whether or not to use an 'identity' projection. More...
 
bool getUseIdentityView () const
 Returns whether or not to use an 'identity' view. More...
 
virtual bool getUseIdentityViewProjMatrixIsDynamic () const
 Returns whether the Hlms implementation should evaluate getUseIdentityProjection per object at runtime, or if it can assume the Renderable will remain with the same setting until the datablock is flushed (performance optimization) More...
 
virtual bool getUseIdentityWorldMatrix () const
 Returns whether the world matrix is an identity matrix. More...
 
virtual OGRE_DEPRECATED const AnygetUserAny () const
 
UserObjectBindingsgetUserObjectBindings ()
 Return an instance of user objects binding associated with this class. More...
 
const UserObjectBindingsgetUserObjectBindings () const
 Return an instance of user objects binding associated with this class. More...
 
const VertexArrayObjectArraygetVaos (VertexPass vertexPass) const
 
bool hasCustomParameter (size_t index) const
 Checks whether a custom value is associated with this Renderable at the given index. More...
 
bool hasSkeletonAnimation () const
 
virtual void postRender (SceneManager *sm, RenderSystem *rsys)
 Called immediately after the Renderable has been rendered. More...
 
virtual bool preRender (SceneManager *sm, RenderSystem *rsys)
 Called just prior to the Renderable being rendered. More...
 
void removeCustomParameter (size_t index)
 Removes a custom value which is associated with this Renderable at the given index. More...
 
void resetMaterialLod ()
 Sets mCurrentMaterialLod to 0. More...
 
void setCustomParameter (size_t index, const Vector4 &value)
 Sets a custom parameter for this Renderable, which may be used to drive calculations for this specific Renderable, like GPU program parameters. More...
 
virtual void setDatablock (HlmsDatablock *datablock)
 Assigns a datablock (i.e. HLMS Material) to this renderable. More...
 
void setDatablock (IdString datablockName)
 Assigns a datablock (i.e. More...
 
void setDatablockOrMaterialName (String materialName, String groupName)
 First tries to see if an HLMS datablock exist with the given name, if not, tries to search among low level materials. More...
 
virtual void setMaterial (const MaterialPtr &material)
 Sets the given material. Overrides HLMS materials. More...
 
void setMaterialName (const String &name, const String &groupName)
 Sets the name of the Material to be used. Prefer using HLMS. More...
 
virtual void setPolygonModeOverrideable (bool override)
 Sets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting. More...
 
void setPoseWeight (size_t index, float w)
 
void setRenderQueueSubGroup (uint8 subGroup)
 Sets the render queue sub group. More...
 
void setUseIdentityProjection (bool useIdentityProjection)
 Sets whether or not to use an 'identity' projection. More...
 
void setUseIdentityView (bool useIdentityView)
 Sets whether or not to use an 'identity' view. More...
 
virtual OGRE_DEPRECATED void setUserAny (const Any &anything)
 

Static Public Attributes

static const Real INFINITE_FAR_PLANE_ADJUST
 Small constant used to reduce far plane projection to avoid inaccuracies. More...
 
- Static Public Attributes inherited from Ogre::MovableObject
static const FastArray< Realc_DefaultLodMesh
 

Additional Inherited Members

- Public Types inherited from Ogre::MovableObject
typedef FastArray< MovableObject * > MovableObjectArray
 
- Public Types inherited from Ogre::Renderable
typedef map< size_t, Vector4 >::type CustomParameterMap
 
- Static Public Member Functions inherited from Ogre::MovableObject
static void buildLightList (const size_t numNodes, ObjectData t, const LightListInfo &globalLightList)
 
static void calculateCastersBox (const size_t numNodes, ObjectData t, uint32 sceneVisibilityFlags, AxisAlignedBox *outBox)
 
static void cullFrustum (const size_t numNodes, ObjectData t, const Camera *frustum, MovableObjectArray &outCulledObjects, const CullFrustumPreparedData &pd)
 
static void cullFrustumPrepare (const Camera *frustum, uint32 sceneVisibilityFlags, const Camera *lodCamera, CullFrustumPreparedData &pd)
 
static void cullLights (const size_t numNodes, ObjectData t, uint32 sceneLightMask, LightListInfo &outGlobalLightList, const FrustumVec &frustums, const FrustumVec &cubemapFrustums)
 See SceneManager::cullLights & see MovableObject::cullFrustum. More...
 
static uint32 getDefaultLightMask ()
 Get the default light mask for all future MovableObject instances. More...
 
static uint32 getDefaultQueryFlags ()
 Get the default query flags for all future MovableObject instances. More...
 
static uint32 getDefaultVisibilityFlags ()
 Get the default visibility flags for all future MovableObject instances. More...
 
static void setDefaultLightMask (uint32 mask)
 Set the default light mask for all future MovableObject instances. More...
 
static void setDefaultQueryFlags (uint32 flags)
 Set the default query flags for all future MovableObject instances. More...
 
static void setDefaultVisibilityFlags (uint32 flags)
 Set the default visibility flags for all future MovableObject instances. More...
 
static void updateAllBounds (const size_t numNodes, ObjectData t)
 
- Static Public Member Functions inherited from Ogre::Renderable
static uint8 getDefaultRenderQueueSubGroup ()
 
static void setDefaultRenderQueueSubGroup (uint8 subGroup)
 Sets the default render queue sub group for all future Renderable instances. More...
 
- Public Attributes inherited from Ogre::MovableObject
size_t mGlobalIndex
 Index in the vector holding this MO reference (could be our parent node, or a global array tracking all movable objecst to avoid memory leaks). More...
 
size_t mParentIndex
 Index in the vector holding this MO reference (could be our parent node, or a global array tracking all movable objecst to avoid memory leaks). More...
 
RenderableArray mRenderables
 
- Public Attributes inherited from Ogre::Renderable
uint8 mCustomParameter
 
uint32 mHlmsGlobalIndex
 Index in the vector holding this Rendrable reference in the HLMS datablock. More...
 
bool mRenderableVisible
 Control visibility at Renderable (e.g. More...
 

Detailed Description

A frustum represents a pyramid, capped at the near and far end which is used to represent either a visible area or a projection area.

Can be used for a number of applications.

Constructor & Destructor Documentation

◆ Frustum()

Ogre::Frustum::Frustum ( IdType  id,
ObjectMemoryManager objectMemoryManager 
)

Named constructor.

◆ ~Frustum()

Ogre::Frustum::~Frustum ( )
override

Member Function Documentation

◆ _getCachedFrustumPlanes()

const Plane* Ogre::Frustum::_getCachedFrustumPlanes ( ) const
inline

Returns the frustum planes, doesn't check if dirty.

◆ _getCachedWorldSpaceCorners()

const Vector3* Ogre::Frustum::_getCachedWorldSpaceCorners ( ) const
inline

◆ calcViewMatrixRelative()

virtual void Ogre::Frustum::calcViewMatrixRelative ( const Vector3 relPos,
Matrix4 matToUpdate 
) const
virtual

Calculate a view matrix for this frustum, relative to a potentially dynamic point.

Mainly for use by OGRE internally when using camera-relative rendering for frustums that are not the centre (e.g. texture projection)

◆ disableCustomNearClipPlane()

virtual void Ogre::Frustum::disableCustomNearClipPlane ( )
virtual

Disables any custom near clip plane.

◆ disableReflection()

virtual void Ogre::Frustum::disableReflection ( )
virtual

Disables reflection modification previously turned on with enableReflection.

◆ enableCustomNearClipPlane() [1/2]

virtual void Ogre::Frustum::enableCustomNearClipPlane ( const MovablePlane plane)
virtual

Links the frustum to a custom near clip plane, which can be used to clip geometry in a custom manner without using user clip planes.

Remarks
There are several applications for clipping a scene arbitrarily by a single plane; the most common is when rendering a reflection to a texture, and you only want to render geometry that is above the water plane (to do otherwise results in artefacts). Whilst it is possible to use user clip planes, they are not supported on all cards, and sometimes are not hardware accelerated when they are available. Instead, where a single clip plane is involved, this technique uses a 'fudging' of the near clip plane, which is available and fast on all hardware, to perform as the arbitrary clip plane. This does change the shape of the frustum, leading to some depth buffer loss of precision, but for many of the uses of this technique that is not an issue.
This version of the method links to a plane, rather than requiring a by-value plane definition, and therefore you can make changes to the plane (e.g. by moving / rotating the node it is attached to) and they will automatically affect this object.
Note
This technique only works for perspective projection.
Parameters
planeThe plane to link to to perform the clipping. This plane must continue to exist while the camera is linked to it; do not destroy it before the frustum.

◆ enableCustomNearClipPlane() [2/2]

virtual void Ogre::Frustum::enableCustomNearClipPlane ( const Plane plane)
virtual

Links the frustum to a custom near clip plane, which can be used to clip geometry in a custom manner without using user clip planes.

Remarks
There are several applications for clipping a scene arbitrarily by a single plane; the most common is when rendering a reflection to a texture, and you only want to render geometry that is above the water plane (to do otherwise results in artefacts). Whilst it is possible to use user clip planes, they are not supported on all cards, and sometimes are not hardware accelerated when they are available. Instead, where a single clip plane is involved, this technique uses a 'fudging' of the near clip plane, which is available and fast on all hardware, to perform as the arbitrary clip plane. This does change the shape of the frustum, leading to some depth buffer loss of precision, but for many of the uses of this technique that is not an issue.
Note
This technique only works for perspective projection.
Parameters
planeThe plane to link to to perform the clipping. This plane must continue to exist while the camera is linked to it; do not destroy it before the frustum.

◆ enableReflection() [1/2]

virtual void Ogre::Frustum::enableReflection ( const MovablePlane p)
virtual

Modifies this frustum so it always renders from the reflection of itself through the plane specified.

Note that this version of the method links to a plane so that changes to it are picked up automatically. It is important that this plane continues to exist whilst this object does; do not destroy the plane before the frustum.

Remarks
This is obviously useful for performing planar reflections.

◆ enableReflection() [2/2]

virtual void Ogre::Frustum::enableReflection ( const Plane p)
virtual

Modifies this frustum so it always renders from the reflection of itself through the plane specified.

Remarks
This is obviously useful for performing planar reflections.

◆ getAspectRatio()

virtual Real Ogre::Frustum::getAspectRatio ( ) const
virtual

Retrieves the current aspect ratio.

◆ getBoundingBox()

const AxisAlignedBox& Ogre::Frustum::getBoundingBox ( ) const

Overridden from MovableObject.

◆ getCustomWorldSpaceCorners()

void Ogre::Frustum::getCustomWorldSpaceCorners ( ArrayVector3  outCorners[(8+ARRAY_PACKED_REALS - 1)/ARRAY_PACKED_REALS],
Real  customFarPlane 
) const

◆ getFarClipDistance()

virtual Real Ogre::Frustum::getFarClipDistance ( ) const
virtual

Retrieves the distance from the frustum to the far clipping plane.

Reimplemented in Ogre::Camera.

◆ getFocalLength()

virtual Real Ogre::Frustum::getFocalLength ( ) const
virtual

Returns focal length of frustum.

◆ getFOVy()

virtual const Radian& Ogre::Frustum::getFOVy ( ) const
virtual

Retrieves the frustums Y-dimension Field Of View (FOV).

◆ getFrustumExtents()

virtual void Ogre::Frustum::getFrustumExtents ( Real outleft,
Real outright,
Real outtop,
Real outbottom,
FrustrumExtentsType  frustrumExtentsType = FET_PROJ_PLANE_POS 
) const
virtual

Get the extents of the frustum in view space.

Parameters
outleft,outright,outtop,outbottomThe position where the side clip planes intersect the near clip plane, in eye space OR the tangent of the half angles from the eye to the edges of the near clip plane
frustrumExtentsTypeSpecifies in what format the extents are returned. See OgreFrustrum::setFrustumExtents for more information

◆ getFrustumExtentsManuallySet()

bool Ogre::Frustum::getFrustumExtentsManuallySet ( ) const

◆ getFrustumOffset()

virtual const Vector2& Ogre::Frustum::getFrustumOffset ( ) const
virtual

Retrieves the frustum offsets.

◆ getFrustumPlane()

virtual const Plane& Ogre::Frustum::getFrustumPlane ( unsigned short  plane) const
virtual

Retrieves a specified plane of the frustum (world space).

Remarks
Gets a reference to one of the planes which make up the frustum frustum, e.g. for clipping purposes.

Reimplemented in Ogre::Camera.

◆ getFrustumPlanes()

const Plane* Ogre::Frustum::getFrustumPlanes ( ) const

Retrieves the clipping planes of the frustum (world space).

Remarks
The clipping planes are ordered as declared in enumerate constants FrustumPlane.

◆ getLights()

const LightList& Ogre::Frustum::getLights ( ) const
overridevirtual

Overridden from Renderable.

Implements Ogre::Renderable.

◆ getMovableType()

const String& Ogre::Frustum::getMovableType ( ) const
overridevirtual

Overridden from MovableObject.

Implements Ogre::MovableObject.

◆ getNearClipDistance()

virtual Real Ogre::Frustum::getNearClipDistance ( ) const
virtual

Sets the position of the near clipping plane.

Reimplemented in Ogre::Camera.

◆ getOrientationForViewUpdate()

virtual const Quaternion& Ogre::Frustum::getOrientationForViewUpdate ( ) const
virtual

Get the derived orientation of this frustum.

Reimplemented in Ogre::Camera.

◆ getOrientationMode()

OrientationMode Ogre::Frustum::getOrientationMode ( ) const

Get the orientation mode of the frustum.

Remarks
Getting the orientation of a frustum is only supported on iOS at this time. An exception is thrown on other platforms.

◆ getOrientationModeAngle()

Radian Ogre::Frustum::getOrientationModeAngle ( ) const

Get the orientation mode angle of the frustum.

Remarks
Getting the orientation of a frustum is only supported on iOS at this time. An exception is thrown on other platforms.

◆ getOrthoWindowHeight()

virtual Real Ogre::Frustum::getOrthoWindowHeight ( ) const
virtual

Gets the orthographic window height, for use with orthographic rendering only.

◆ getOrthoWindowWidth()

virtual Real Ogre::Frustum::getOrthoWindowWidth ( ) const
virtual

Gets the orthographic window width, for use with orthographic rendering only.

Note
This is calculated from the orthographic height and the aspect ratio

◆ getPlaneBoundedVolume()

PlaneBoundedVolume Ogre::Frustum::getPlaneBoundedVolume ( )

Gets a world-space list of planes enclosing the frustum.

◆ getPositionForViewUpdate()

virtual const Vector3& Ogre::Frustum::getPositionForViewUpdate ( ) const
virtual

Get the derived position of this frustum.

Reimplemented in Ogre::Camera.

◆ getProjectionMatrix()

virtual const Matrix4& Ogre::Frustum::getProjectionMatrix ( ) const
virtual

Gets the normal projection matrix for this frustum, ie the projection matrix which conforms to standard right-handed rules and uses depth range [-1,+1].

Remarks
This differs from the rendering-API dependent getProjectionMatrixRS in that it always returns a right-handed projection matrix with depth range [-1,+1], result no matter what rendering API is being used - this is required for some uniform algebra for example.

◆ getProjectionMatrixWithRSDepth()

virtual const Matrix4& Ogre::Frustum::getProjectionMatrixWithRSDepth ( ) const
virtual

Gets the depth-adjusted projection matrix for the current rendersystem, but one which still conforms to right-hand rules.

Remarks
This differs from the rendering-API dependent getProjectionMatrix in that it always returns a right-handed projection matrix result no matter what rendering API is being used - this is required for vertex and fragment programs for example. However, the resulting depth range may still vary between render systems since D3D uses [0,1] and GL uses [-1,1].

◆ getProjectionParamsAB()

Vector2 Ogre::Frustum::getProjectionParamsAB ( ) const

Returns the terms projectionA and projectionB in .x and .y respectively, which can be used to reconstruct linear depth from a Z buffer.

If the projection type is PT_PERSPECTIVE, use the following formula:

linearDepth = projectionParams.y / (fDepth - projectionParams.x);

But if the projection type is PT_ORTHOGRAPHIC, use the formula:

linearDepth = (fDepth - projectionParams.x) / projectionParams.y; 

◆ getProjectionType()

virtual ProjectionType Ogre::Frustum::getProjectionType ( ) const
virtual

Retrieves info on the type of projection used (orthographic or perspective).

◆ getReflectionMatrix()

virtual const Matrix4& Ogre::Frustum::getReflectionMatrix ( ) const
inlinevirtual

Returns the reflection matrix of the frustum if appropriate.

◆ getReflectionPlane()

virtual const Plane& Ogre::Frustum::getReflectionPlane ( ) const
inlinevirtual

Returns the reflection plane of the frustum if appropriate.

◆ getRenderOperation()

void Ogre::Frustum::getRenderOperation ( v1::RenderOperation op,
bool  casterPass 
)
overridevirtual

Overridden from Renderable.

Implements Ogre::Renderable.

◆ getSquaredViewDepth()

Real Ogre::Frustum::getSquaredViewDepth ( const Camera cam) const

Overridden from Renderable.

◆ getViewMatrix()

virtual const Matrix4& Ogre::Frustum::getViewMatrix ( ) const
virtual

Gets the view matrix for this frustum.

Mainly for use by OGRE internally.

Reimplemented in Ogre::Camera.

◆ getWorldSpaceCorners()

virtual const Vector3* Ogre::Frustum::getWorldSpaceCorners ( ) const
virtual

Gets the world space corners of the frustum.

Remarks
The corners are ordered as follows: top-right near, top-left near, bottom-left near, bottom-right near, top-right far, top-left far, bottom-left far, bottom-right far.

Reimplemented in Ogre::Camera.

◆ getWorldTransforms()

void Ogre::Frustum::getWorldTransforms ( Matrix4 xform) const
overridevirtual

Overridden from Renderable.

Implements Ogre::Renderable.

◆ isCustomNearClipPlaneEnabled()

virtual bool Ogre::Frustum::isCustomNearClipPlaneEnabled ( ) const
inlinevirtual

Is a custom near clip plane in use?

◆ isCustomProjectionMatrixEnabled()

virtual bool Ogre::Frustum::isCustomProjectionMatrixEnabled ( ) const
inlinevirtual

Returns whether a custom projection matrix is in use.

◆ isCustomViewMatrixEnabled()

virtual bool Ogre::Frustum::isCustomViewMatrixEnabled ( ) const
inlinevirtual

Returns whether a custom view matrix is in use.

◆ isReflected()

virtual bool Ogre::Frustum::isReflected ( ) const
inlinevirtual

Returns whether this frustum is being reflected.

◆ isVisible() [1/3]

virtual bool Ogre::Frustum::isVisible ( const AxisAlignedBox bound,
FrustumPlane culledBy = 0 
) const
virtual

Tests whether the given container is visible in the Frustum.

Parameters
boundBounding box to be checked (world space).
culledByOptional pointer to an int which will be filled by the plane number which culled the box if the result was false;
Returns
If the box was visible, true is returned.
Otherwise, false is returned.

Reimplemented in Ogre::Camera.

◆ isVisible() [2/3]

virtual bool Ogre::Frustum::isVisible ( const Sphere bound,
FrustumPlane culledBy = 0 
) const
virtual

Tests whether the given container is visible in the Frustum.

Parameters
boundBounding sphere to be checked (world space).
culledByOptional pointer to an int which will be filled by the plane number which culled the box if the result was false;
Returns
If the sphere was visible, true is returned.
Otherwise, false is returned.

Reimplemented in Ogre::Camera.

◆ isVisible() [3/3]

virtual bool Ogre::Frustum::isVisible ( const Vector3 vert,
FrustumPlane culledBy = 0 
) const
virtual

Tests whether the given vertex is visible in the Frustum.

Parameters
vertVertex to be checked (world space).
culledByOptional pointer to an int which will be filled by the plane number which culled the box if the result was false;
Returns
If the sphere was visible, true is returned.
Otherwise, false is returned.

Reimplemented in Ogre::Camera.

◆ projectSphere()

virtual bool Ogre::Frustum::projectSphere ( const Sphere sphere,
Real left,
Real top,
Real right,
Real bottom 
) const
virtual

Project a sphere onto the near plane and get the bounding rectangle.

Parameters
sphereThe world-space sphere to project.
leftPointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
topPointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
rightPointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
bottomPointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
Returns
true if the sphere was projected to a subset of the near plane, false if the entire near plane was contained.

Reimplemented in Ogre::Camera.

◆ resetFrustumExtents()

virtual void Ogre::Frustum::resetFrustumExtents ( )
virtual

Reset the frustum extents to be automatically derived from other params.

◆ setAspectRatio()

virtual void Ogre::Frustum::setAspectRatio ( Real  ratio)
virtual

Sets the aspect ratio for the frustum viewport.

Remarks
The ratio between the x and y dimensions of the rectangular area visible through the frustum is known as aspect ratio: aspect = width / height .
The default for most fullscreen windows is 1.3333 - this is also assumed by Ogre unless you use this method to state otherwise.

◆ setCustomProjectionMatrix()

virtual void Ogre::Frustum::setCustomProjectionMatrix ( bool  enable,
const Matrix4 projectionMatrix = Matrix4::IDENTITY,
bool  alternateDepthRange = false 
)
virtual

Set whether to use a custom projection matrix on this frustum.

Remarks
This is an advanced method which allows you to manually set the projection matrix on this frustum, rather than having it calculate itself based on the clipping distances or the field of view.

See Frustum::setCustomViewMatrix

Note
After enabling a custom projection matrix, the frustum will no longer update on its own based on field of view and near / far distance changes. You are completely responsible for keeping the projection matrix up to date if those values change. The custom matrix will be returned from getProjectionMatrix and derivative functions. Even when using a custom projection matrix, you should still call the methods that update the ner / far distances and field of view.
Parameters
enableIf true, the custom projection matrix passed as the second parameter will be used in preference to an auto calculated one. If false, the frustum will revert to auto calculating the projection matrix.
projectionMatrixThe custom view matrix to use.
alternateDepthRangeSet this to true if the input projectionMatrix has the depth in range [0; 1] instead of the range [-1; 1] that Ogre expects.

Projection matrices obtained from Oculus SDK's need to set this to true.

Note that we will internally convert the projection matrix by performing the range conversion, so don't expect Frustum::getProjectionMatrix to return you exactly the same projection matrix you passed to us!

◆ setCustomViewMatrix()

virtual void Ogre::Frustum::setCustomViewMatrix ( bool  enable,
const Matrix4 viewMatrix = Matrix4::IDENTITY 
)
virtual

Set whether to use a custom view matrix on this frustum.

Remarks
This is an advanced method which allows you to manually set the view matrix on this frustum, rather than having it calculate itself based on it's position and orientation.
Note
After enabling a custom view matrix, the frustum will no longer update on its own based on position / orientation changes. You are completely responsible for keeping the view matrix up to date. The custom matrix will be returned from getViewMatrix.
Parameters
enableIf true, the custom view matrix passed as the second parameter will be used in preference to an auto calculated one. If false, the frustum will revert to auto calculating the view matrix.
viewMatrixThe custom view matrix to use, the matrix must be an affine matrix.
See also
Frustum::setCustomProjectionMatrix, Matrix4::isAffine

◆ setFarClipDistance()

virtual void Ogre::Frustum::setFarClipDistance ( Real  farDist)
virtual

Sets the distance to the far clipping plane.

Remarks
The view frustum is a pyramid created from the frustum position and the edges of the viewport. This method sets the distance for the far end of that pyramid. Different applications need different values: e.g. a flight sim needs a much further far clipping plane than a first-person shooter. An important point here is that the larger the ratio between near and far clipping planes, the lower the accuracy of the Z-buffer used to depth-cue pixels. This is because the Z-range is limited to the size of the Z buffer (16 or 32-bit) and the max values must be spread over the gap between near and far clip planes. As it happens, you can affect the accuracy far more by altering the near distance rather than the far distance, but keep this in mind.
Parameters
farDistThe distance to the far clipping plane from the frustum in world coordinates.If you specify 0, this means an infinite view distance which is useful especially when projecting shadows; but be careful not to use a near distance too close.

◆ setFocalLength()

virtual void Ogre::Frustum::setFocalLength ( Real  focalLength = 1.0)
virtual

Sets frustum focal length (used in stereo rendering).

Parameters
focalLengthThe distance to the focal plane from the frustum in world coordinates.

◆ setFOVy()

virtual void Ogre::Frustum::setFOVy ( const Radian fovy)
virtual

Sets the Y-dimension Field Of View (FOV) of the frustum.

Remarks
Field Of View (FOV) is the angle made between the frustum's position, and the edges of the 'screen' onto which the scene is projected. High values (90+ degrees) result in a wide-angle, fish-eye kind of view, low values (30- degrees) in a stretched, telescopic kind of view. Typical values are between 45 and 60 degrees.
This value represents the VERTICAL field-of-view. The horizontal field of view is calculated from this depending on the dimensions of the viewport (they will only be the same if the viewport is square).
Note
Setting the FOV overrides the value supplied for frustum::setNearClipPlane.

◆ setFrustumExtents()

virtual void Ogre::Frustum::setFrustumExtents ( Real  left,
Real  right,
Real  top,
Real  bottom,
FrustrumExtentsType  frustrumExtentsType = FET_PROJ_PLANE_POS 
)
virtual

Manually set the extents of the frustum.

Parameters
left,right,top,bottomThe position where the side clip planes intersect the near clip plane, in eye space OR the tangent of the half angles from the eye to the edges of the near clip plane
frustrumExtentsTypeSpecifies how the extents are represented. Be default they are the positions on near clip plane. However if this is a scene camera it is recommended that you actually use the tangent of the half angles. ie Half the FoV angles. This is because Ogre uses this camera setup to calculate custom clipping planes for PSSM algorithms, and Forward+ algorithms, but alter the near and far clip distances.
If you supply extents as positions on the projection plane the near clip distance has already been calculated as part of the supplied extents, however if they are tangent of the half angles Ogre can apply different near clip distances dynamically.

◆ setFrustumOffset() [1/2]

virtual void Ogre::Frustum::setFrustumOffset ( const Vector2 offset)
virtual

Sets frustum offsets, used in stereo rendering.

Remarks
You can set both horizontal and vertical plane offsets of "eye"; in stereo rendering frustum is moved in horizontal plane. To be able to render from two "eyes" you'll need two cameras rendering on two RenderTargets.
The frustum offsets is in world coordinates, and default to (0, 0) - no offsets.
Parameters
offsetThe horizontal and vertical plane offsets.

◆ setFrustumOffset() [2/2]

virtual void Ogre::Frustum::setFrustumOffset ( Real  horizontal = 0.0,
Real  vertical = 0.0 
)
virtual

Sets frustum offsets, used in stereo rendering.

Remarks
You can set both horizontal and vertical plane offsets of "eye"; in stereo rendering frustum is moved in horizontal plane. To be able to render from two "eyes" you'll need two cameras rendering on two RenderTargets.
The frustum offsets is in world coordinates, and default to (0, 0) - no offsets.
Parameters
horizontalThe horizontal plane offset.
verticalThe vertical plane offset.

◆ setNearClipDistance()

virtual void Ogre::Frustum::setNearClipDistance ( Real  nearDist)
virtual

Sets the position of the near clipping plane.

Remarks
The position of the near clipping plane is the distance from the frustums position to the screen on which the world is projected. The near plane distance, combined with the field-of-view and the aspect ratio, determines the size of the viewport through which the world is viewed (in world co-ordinates). Note that this world viewport is different to a screen viewport, which has it's dimensions expressed in pixels. The frustums viewport should have the same aspect ratio as the screen viewport it renders into to avoid distortion.
Parameters
nearDistThe distance to the near clipping plane from the frustum in world coordinates.

◆ setOrientationMode()

void Ogre::Frustum::setOrientationMode ( OrientationMode  orientationMode)

Set the orientation mode of the frustum.

Default is OR_DEGREE_0

Remarks
Setting the orientation of a frustum is only supported on iOS at this time. An exception is thrown on other platforms.

◆ setOrthoWindow()

virtual void Ogre::Frustum::setOrthoWindow ( Real  w,
Real  h 
)
virtual

Sets the orthographic window settings, for use with orthographic rendering only.

Note
Calling this method will recalculate the aspect ratio, use setOrthoWindowHeight or setOrthoWindowWidth alone if you wish to preserve the aspect ratio but just fit one or other dimension to a particular size.
Parameters
wThe width of the view window in world units.
hThe height of the view window in world units.

◆ setOrthoWindowHeight()

virtual void Ogre::Frustum::setOrthoWindowHeight ( Real  h)
virtual

Sets the orthographic window height, for use with orthographic rendering only.

Note
The width of the window will be calculated from the aspect ratio.
Parameters
hThe height of the view window in world units.

◆ setOrthoWindowWidth()

virtual void Ogre::Frustum::setOrthoWindowWidth ( Real  w)
virtual

Sets the orthographic window width, for use with orthographic rendering only.

Note
The height of the window will be calculated from the aspect ratio.
Parameters
wThe width of the view window in world units.

◆ setProjectionType()

virtual void Ogre::Frustum::setProjectionType ( ProjectionType  pt)
virtual

Sets the type of projection to use (orthographic or perspective).

Default is perspective.

Member Data Documentation

◆ INFINITE_FAR_PLANE_ADJUST

const Real Ogre::Frustum::INFINITE_FAR_PLANE_ADJUST
static

Small constant used to reduce far plane projection to avoid inaccuracies.


The documentation for this class was generated from the following file: