OGRE-Next: Ogre::Frustum Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
Ogre::Frustum Class Reference
Core » Math

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:
[legend]

## Public Member Functions
| Frustum (IdType id, ObjectMemoryManager *objectMemoryManager)
| Named constructor.
| ~Frustum () override
const Plane * | _getCachedFrustumPlanes () const
| Returns the frustum planes, doesn't check if dirty.
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.
virtual void | disableCustomNearClipPlane ()
| Disables any custom near clip plane.
virtual void | disableReflection ()
| Disables reflection modification previously turned on with enableReflection.
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.
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.
virtual void | enableReflection (const MovablePlane *p)
| Modifies this frustum so it always renders from the reflection of itself through the plane specified.
virtual void | enableReflection (const Plane &p)
| Modifies this frustum so it always renders from the reflection of itself through the plane specified.
virtual Real | getAspectRatio () const
| Retrieves the current aspect ratio.
const AxisAlignedBox & | getBoundingBox () const
| Overridden from MovableObject.
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.
virtual Real | getFocalLength () const
| Returns focal length of frustum.
virtual const Radian & | getFOVy () const
| Retrieves the frustums Y-dimension Field Of View (FOV).
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.
bool | getFrustumExtentsManuallySet () const
virtual const Vector2 & | getFrustumOffset () const
| Retrieves the frustum offsets.
virtual const Plane & | getFrustumPlane (unsigned short plane) const
| Retrieves a specified plane of the frustum (world space).
const Plane * | getFrustumPlanes () const
| Retrieves the clipping planes of the frustum (world space).
const LightList & | getLights () const override
| Overridden from Renderable.
const String & | getMovableType () const override
| Overridden from MovableObject.
virtual Real | getNearClipDistance () const
| Sets the position of the near clipping plane.
virtual const Quaternion & | getOrientationForViewUpdate () const
| Get the derived orientation of this frustum.
OrientationMode | getOrientationMode () const
| Get the orientation mode of the frustum.
Radian | getOrientationModeAngle () const
| Get the orientation mode angle of the frustum.
virtual Real | getOrthoWindowHeight () const
| Gets the orthographic window height, for use with orthographic rendering only.
virtual Real | getOrthoWindowWidth () const
| Gets the orthographic window width, for use with orthographic rendering only.
PlaneBoundedVolume | getPlaneBoundedVolume ()
| Gets a world-space list of planes enclosing the frustum.
virtual const Vector3 & | getPositionForViewUpdate () const
| Get the derived position of this frustum.
virtual const Matrix4 & | getProjectionMatrix () 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].
virtual const Matrix4 & | getProjectionMatrixWithRSDepth () const
| Gets the depth-adjusted projection matrix for the current rendersystem, but one which still conforms to right-hand rules.
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.
virtual ProjectionType | getProjectionType () const
| Retrieves info on the type of projection used (orthographic or perspective).
virtual const Matrix4 & | getReflectionMatrix () const
| Returns the reflection matrix of the frustum if appropriate.
virtual const Plane & | getReflectionPlane () const
| Returns the reflection plane of the frustum if appropriate.
void | getRenderOperation (v1::RenderOperation &op, bool casterPass) override
| Overridden from Renderable.
Real | getSquaredViewDepth (const Camera *cam) const
| Overridden from Renderable.
virtual const Matrix4 & | getViewMatrix () const
| Gets the view matrix for this frustum.
virtual const Vector3 * | getWorldSpaceCorners () const
| Gets the world space corners of the frustum.
void | getWorldTransforms (Matrix4 *xform) const override
| Overridden from Renderable.
virtual bool | isCustomNearClipPlaneEnabled () const
| Is a custom near clip plane in use?
virtual bool | isCustomProjectionMatrixEnabled () const
| Returns whether a custom projection matrix is in use.
virtual bool | isCustomViewMatrixEnabled () const
| Returns whether a custom view matrix is in use.
virtual bool | isReflected () const
| Returns whether this frustum is being reflected.
virtual bool | isVisible (const AxisAlignedBox &bound, FrustumPlane *culledBy=0) const
| Tests whether the given container is visible in the Frustum.
virtual bool | isVisible (const Sphere &bound, FrustumPlane *culledBy=0) const
| Tests whether the given container is visible in the Frustum.
virtual bool | isVisible (const Vector3 &vert, FrustumPlane *culledBy=0) const
| Tests whether the given vertex is visible in the Frustum.
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.
virtual void | resetFrustumExtents ()
| Reset the frustum extents to be automatically derived from other params.
virtual void | setAspectRatio (Real ratio)
| Sets the aspect ratio for the frustum viewport.
virtual void | setCustomProjectionMatrix (bool enable, const Matrix4 &projectionMatrix=Matrix4::IDENTITY, bool alternateDepthRange=false)
| Set whether to use a custom projection matrix on this frustum.
virtual void | setCustomViewMatrix (bool enable, const Matrix4 &viewMatrix=Matrix4::IDENTITY)
| Set whether to use a custom view matrix on this frustum.
virtual void | setFarClipDistance (Real farDist)
| Sets the distance to the far clipping plane.
virtual void | setFocalLength (Real focalLength=1.0)
| Sets frustum focal length (used in stereo rendering).
virtual void | setFOVy (const Radian &fovy)
| Sets the Y-dimension Field Of View (FOV) of the frustum.
virtual void | setFrustumExtents (Real left, Real right, Real top, Real bottom, FrustrumExtentsType frustrumExtentsType=FET_PROJ_PLANE_POS)
| Manually set the extents of the frustum.
virtual void | setFrustumOffset (const Vector2 &offset)
| Sets frustum offsets, used in stereo rendering.
virtual void | setFrustumOffset (Real horizontal=0.0, Real vertical=0.0)
| Sets frustum offsets, used in stereo rendering.
virtual void | setNearClipDistance (Real nearDist)
| Sets the position of the near clipping plane.
void | setOrientationMode (OrientationMode orientationMode)
| Set the orientation mode of the frustum.
virtual void | setOrthoWindow (Real w, Real h)
| Sets the orthographic window settings, for use with orthographic rendering only.
virtual void | setOrthoWindowHeight (Real h)
| Sets the orthographic window height, for use with orthographic rendering only.
virtual void | setOrthoWindowWidth (Real w)
| Sets the orthographic window width, for use with orthographic rendering only.
virtual void | setProjectionType (ProjectionType pt)
| Sets the type of projection to use (orthographic or perspective).
Public Member Functions inherited from Ogre::MovableObject
| MovableObject (IdType id, ObjectMemoryManager *objectMemoryManager, SceneManager *manager, uint8 renderQueueId)
| Constructor.
| MovableObject (ObjectData *objectDataPtrs)
| Don't use this constructor unless you know what you're doing.
virtual | ~MovableObject ()
| Virtual destructor - read Scott Meyers if you don't know why this is needed.
LightList * | _getLightList ()
| Returns a pointer to the current list of lights for this object.
SceneManager * | _getManager () const
| Get the manager of this object, if any (internal use only)
ObjectData & | _getObjectData ()
| Returns a direct access to the ObjectData state.
const Matrix4 & | _getParentNodeFullTransform () const
| Returns the full transformation of the parent sceneNode or the attachingPoint node.
virtual void | _notifyAttached (Node *parent)
| Internal method called to notify the object that it has been attached to a node.
void | _notifyManager (SceneManager *man)
| Notify the object of it's manager (internal use only)
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.
virtual void | _releaseManualHardwareResources ()
| Notifies the movable object that hardware resources were lost.
virtual void | _restoreManualHardwareResources ()
| Notifies the movable object that hardware resources should be restored.
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.
void | addQueryFlags (uint32 flags)
| As setQueryFlags, except the flags passed as parameters are appended to the existing flags on this object.
void | addVisibilityFlags (uint32 flags)
| As setVisibilityFlags, except the flags passed as parameters are appended to the existing flags on this object.
void | detachFromParent ()
| Detaches an object from a parent SceneNode if attached.
RealAsUint | getCachedDistanceToCamera () const
| Returns the distance to camera as calculated in cullFrustum()
Real | getCachedDistanceToCameraAsReal () const
| Returns the distance to camera as calculated in cullFrustum()
bool | getCastShadows () const
| Returns whether shadow casting is enabled for this object.
unsigned char | getCurrentMeshLod () const
uint32 | getLightMask () const
| Get a bitwise mask which will filter the lights affecting this object.
Listener * | getListener () const
| Gets the current listener for this object.
Aabb | getLocalAabb () const
| Retrieves the local axis-aligned bounding box for this object.
float | getLocalRadius () const
| See getLocalAabb and getWorldRadius.
const String & | getName () const
| Returns the name of this object.
Node * | getParentNode () const
| Returns the node to which this object is attached.
SceneNode * | getParentSceneNode () const
uint32 | getQueryFlags () const
| Returns the query flags relevant for this object.
Real | getRenderingDistance () const
| Gets the distance at which batches are no longer rendered.
Real | getRenderingMinPixelSize () const
| Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered.
uint8 | getRenderQueueGroup () const
| Gets the queue group for this entity, see setRenderQueueGroup for full details.
Real | getShadowRenderingDistance () const
| Gets the distance at which batches are no longer casting shadows.
SkeletonInstance * | getSkeletonInstance () const
UserObjectBindings & | getUserObjectBindings ()
| Return an instance of user objects binding associated with this class.
const UserObjectBindings & | getUserObjectBindings () const
| Return an instance of user objects binding associated with this class.
uint32 | getVisibilityFlags () const
| Returns the visibility flags relevant for this object.
bool | getVisible () const
| Gets this object whether to be visible or not, if it has a renderable component.
Aabb | getWorldAabb () const
| Gets the axis aligned box in world space.
Aabb | getWorldAabbUpdated ()
| Gets the axis aligned box in world space.
float | getWorldRadius () const
| Gets the bounding Radius scaled by max( scale.x, scale.y, scale.z ).
float | getWorldRadiusUpdated ()
| Gets the bounding Radius scaled by max( scale.x, scale.y, scale.z ).
virtual void | instanceBatchCullFrustumThreaded (const Frustum *frustum, const Camera *lodCamera, uint32 combinedVisibilityFlags)
bool | isAttached () const
| Returns true if this object is attached to a Node.
bool | isStatic () const
| Checks whether this MovableObject is static.
bool | isVisible () const
| Returns whether or not this object is supposed to be visible or not.
const LightList & | queryLights () const
| Gets a list of lights, ordered relative to how close they are to this movable object.
void | removeQueryFlags (uint32 flags)
| As setQueryFlags, except the flags passed as parameters are removed from the existing flags on this object.
void | removeVisibilityFlags (uint32 flags)
| As setVisibilityFlags, except the flags passed as parameters are removed from the existing flags on this object.
void | setCastShadows (bool enabled)
| Sets whether or not this object will cast shadows.
void | setLightMask (uint32 lightMask)
| Set a bitwise mask which will filter the lights affecting this object.
void | setListener (Listener *listener)
| Sets a listener for this object.
void | setLocalAabb (const Aabb box)
| Sets the local axis-aligned bounding box for this object.
void | setName (const String &name)
| Sets a custom name for this node.
void | setQueryFlags (uint32 flags)
| Sets the query flags for this object.
void | setRenderingDistance (Real dist)
| Sets the distance at which the object is no longer rendered.
void | setRenderingMinPixelSize (Real pixelSize)
| Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered.
virtual void | setRenderQueueGroup (uint8 queueID)
| Sets the render queue group this entity will be rendered through.
void | setShadowRenderingDistance (Real dist)
| Sets the distance at which the object is no longer casting shadows.
bool | setStatic (bool bStatic)
| Turns this Node into static or dynamic.
void | setVisibilityFlags (uint32 flags)
| Sets the visibility flags for this object.
void | setVisible (bool visible)
| Tells this object whether to be visible or not, if it has a renderable component.
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.
const StringVector & | getAnimableValueNames () const
| Gets a list of animable value names for this object.
Public Member Functions inherited from Ogre::IdObject
| IdObject (IdType id)
| We don't call generateNewId() here, to prevent objects in the stack (i.e.
IdType | getId () const
| Get the unique id of this object.
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.
virtual void | _setHlmsHashes (uint32 hash, uint32 casterHash)
| Manually sets the hlms hashes. Don't call this directly.
virtual void | _setNullDatablock ()
| Sets the datablock to a null pointer.
virtual void | _updateCustomGpuParameter (const GpuProgramParameters_AutoConstantEntry &constantEntry, GpuProgramParameters *params) const
| Update a custom GpuProgramParameters constant which is derived from information only this Renderable knows.
void | addPoseWeight (size_t index, float w)
virtual bool | getCastsShadows () const
| Method which reports whether this renderable would normally cast a shadow.
uint8 | getCurrentMaterialLod () const
const Vector4 & | getCustomParameter (size_t index) const
| Gets the custom value associated with this Renderable at the given index.
const CustomParameterMap & | getCustomParameters () const
HlmsDatablock * | getDatablock () const
const String & | getDatablockOrMaterialName () const
uint32 | getHlmsCasterHash () const
uint32 | getHlmsHash () const
MaterialPtr | getMaterial () const
| Retrieves the material this renderable object uses.
unsigned short | getNumPoses () const
virtual unsigned short | getNumWorldTransforms () const
| Returns the number of world transform matrices this renderable requires.
virtual bool | getPolygonModeOverrideable () const
| Gets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting.
bool | getPoseHalfPrecision () const
bool | getPoseNormals () const
TexBufferPacked * | getPoseTexBuffer () 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.
bool | getUseIdentityView () const
| Returns whether or not to use an 'identity' view.
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)
virtual bool | getUseIdentityWorldMatrix () const
| Returns whether the world matrix is an identity matrix.
virtual OGRE_DEPRECATED const Any & | getUserAny () const
UserObjectBindings & | getUserObjectBindings ()
| Return an instance of user objects binding associated with this class.
const UserObjectBindings & | getUserObjectBindings () const
| Return an instance of user objects binding associated with this class.
const VertexArrayObjectArray & | getVaos (VertexPass vertexPass) const
bool | hasCustomParameter (size_t index) const
| Checks whether a custom value is associated with this Renderable at the given index.
bool | hasSkeletonAnimation () const
virtual void | postRender (SceneManager *sm, RenderSystem *rsys)
| Called immediately after the Renderable has been rendered.
virtual bool | preRender (SceneManager *sm, RenderSystem *rsys)
| Called just prior to the Renderable being rendered.
void | removeCustomParameter (size_t index)
| Removes a custom value which is associated with this Renderable at the given index.
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.
virtual void | setDatablock (HlmsDatablock *datablock)
| Assigns a datablock (i.e. HLMS Material) to this renderable.
void | setDatablock (IdString datablockName)
| Assigns a datablock (i.e.
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.
virtual void | setMaterial (const MaterialPtr &material)
| Sets the given material. Overrides HLMS materials.
void | setMaterialName (const String &name, const String &groupName)
| Sets the name of the Material to be used. Prefer using HLMS.
virtual void | setPolygonModeOverrideable (bool override)
| Sets whether this renderable's chosen detail level can be overridden (downgraded) by the camera setting.
void | setPoseWeight (size_t index, float w)
void | setRenderQueueSubGroup (uint8 subGroup)
| Sets the render queue sub group.
void | setUseIdentityProjection (bool useIdentityProjection)
| Sets whether or not to use an 'identity' projection.
void | setUseIdentityView (bool useIdentityView)
| Sets whether or not to use an 'identity' view.
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.
Static Public Attributes inherited from Ogre::MovableObject
static const FastArray< Real > | c_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, uint32 sceneVisibilityFlags, MovableObjectArray &outCulledObjects, const Camera *lodCamera)
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.
static uint32 | getDefaultLightMask ()
| Get the default light mask for all future MovableObject instances.
static uint32 | getDefaultQueryFlags ()
| Get the default query flags for all future MovableObject instances.
static uint32 | getDefaultVisibilityFlags ()
| Get the default visibility flags for all future MovableObject instances.
static void | setDefaultLightMask (uint32 mask)
| Set the default light mask for all future MovableObject instances.
static void | setDefaultQueryFlags (uint32 flags)
| Set the default query flags for all future MovableObject instances.
static void | setDefaultVisibilityFlags (uint32 flags)
| Set the default visibility flags for all future MovableObject instances.
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.
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).
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).
RenderableArray | mRenderables
Public Attributes inherited from Ogre::Renderable
uint8 | mCustomParameter
uint32 | mHlmsGlobalIndex
| Index in the vector holding this Rendrable reference in the HLMS datablock.
bool | mRenderableVisible
| Control visibility at Renderable (e.g.

## 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.

Referenced by Ogre::Camera::getCullingFrustum(), and Ogre::Camera::setCullingFrustum().

## ◆ ~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

  plane | The 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

  plane | The 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

References ARRAY_PACKED_REALS.

## ◆ 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,outbottom | The 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
  frustrumExtentsType | Specifies in what format the extents are returned. See OgreFrustrum::setFrustumExtents for more information

References Ogre::FET_PROJ_PLANE_POS.

## ◆ 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

  bound | Bounding box to be checked (world space).
  culledBy | Optional 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

  bound | Bounding sphere to be checked (world space).
  culledBy | Optional 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

  vert | Vertex to be checked (world space).
  culledBy | Optional 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

  sphere | The world-space sphere to project.
  left | Pointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
  top | Pointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
  right | Pointers to destination values, these will be completed with the normalised device coordinates (in the range {-1,1}).
  bottom | Pointers 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

  enable | If `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.
  projectionMatrix | The custom view matrix to use.
  alternateDepthRange | Set 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!

References Ogre::Matrix4::IDENTITY.

## ◆ 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

  enable | If `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.
  viewMatrix | The custom view matrix to use, the matrix must be an affine matrix.

See also
  Frustum::setCustomProjectionMatrix, Matrix4::isAffine

References Ogre::Matrix4::IDENTITY.

## ◆ 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

  farDist | The 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

  focalLength | The 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,bottom | The 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
  frustrumExtentsType | Specifies 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.

References Ogre::FET_PROJ_PLANE_POS.

## ◆ 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

  offset | The 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

  horizontal | The horizontal plane offset.
  vertical | The 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

  nearDist | The 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

  w | The width of the view window in world units.
  h | The 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

  h | The 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

  w | The 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:

- OgreFrustum.h