Nirtcpp 2.1.0
Nirtcpp is a high-performance c++ graphics engine.
Loading...
Searching...
No Matches
nirt::scene::SViewFrustum Class Reference

Defines the view frustum. That's the space visible by the camera. More...

#include <nirtcpp/core/engine/SViewFrustum.hpp>

Collaboration diagram for nirt::scene::SViewFrustum:
Collaboration graph

Public Types

enum  VFPLANES {
  VF_FAR_PLANE = 0 , VF_NEAR_PLANE , VF_LEFT_PLANE , VF_RIGHT_PLANE ,
  VF_BOTTOM_PLANE , VF_TOP_PLANE , VF_PLANE_COUNT
}
 

Public Member Functions

 SViewFrustum ()
 Default Constructor.
 
 SViewFrustum (const core::matrix4 &mat, bool zClipFromZero)
 This constructor creates a view frustum based on a projection and/or view matrix.
 
void setFrom (const core::matrix4 &mat, bool zClipFromZero)
 This constructor creates a view frustum based on a projection and/or view matrix.
 
void transform (const core::matrix4 &mat)
 transforms the frustum by the matrix
 
core::vector3df getFarLeftUp () const
 returns the point which is on the far left upper corner inside the the view frustum.
 
core::vector3df getFarLeftDown () const
 returns the point which is on the far left bottom corner inside the the view frustum.
 
core::vector3df getFarRightUp () const
 returns the point which is on the far right top corner inside the the view frustum.
 
core::vector3df getFarRightDown () const
 returns the point which is on the far right bottom corner inside the the view frustum.
 
core::vector3df getNearLeftUp () const
 returns the point which is on the near left upper corner inside the the view frustum.
 
core::vector3df getNearLeftDown () const
 returns the point which is on the near left bottom corner inside the the view frustum.
 
core::vector3df getNearRightUp () const
 returns the point which is on the near right top corner inside the the view frustum.
 
core::vector3df getNearRightDown () const
 returns the point which is on the near right bottom corner inside the the view frustum.
 
const core::aabbox3d< f32 > & getBoundingBox () const
 returns a bounding box enclosing the whole view frustum
 
void recalculateBoundingBox ()
 recalculates the bounding box and sphere based on the planes
 
float getBoundingRadius () const
 get the bounding sphere's radius (of an optimized sphere, not the AABB's)
 
core::vector3df getBoundingCenter () const
 get the bounding sphere's radius (of an optimized sphere, not the AABB's)
 
void setFarNearDistance (float distance)
 the cam should tell the frustum the distance between far and near
 
core::matrix4getTransform (video::E_TRANSFORMATION_STATE state)
 get the given state's matrix based on frustum E_TRANSFORMATION_STATE
 
const core::matrix4getTransform (video::E_TRANSFORMATION_STATE state) const
 get the given state's matrix based on frustum E_TRANSFORMATION_STATE
 
bool clipLine (core::line3d< f32 > &line) const
 clips a line to the view frustum.
 

Public Attributes

core::vector3df cameraPosition
 the position of the camera
 
core::plane3d< f32planes [VF_PLANE_COUNT]
 all planes enclosing the view frustum.
 
core::aabbox3d< f32boundingBox
 bounding box around the view frustum
 

Detailed Description

Defines the view frustum. That's the space visible by the camera.

The view frustum is enclosed by 6 planes. These six planes share eight points. A bounding box around these eight points is also stored in this structure.

Member Enumeration Documentation

◆ VFPLANES

Enumerator
VF_FAR_PLANE 

Far plane of the frustum. That is the plane furthest away from the eye.

VF_NEAR_PLANE 

Near plane of the frustum. That is the plane nearest to the eye.

VF_LEFT_PLANE 

Left plane of the frustum.

VF_RIGHT_PLANE 

Right plane of the frustum.

VF_BOTTOM_PLANE 

Bottom plane of the frustum.

VF_TOP_PLANE 

Top plane of the frustum.

VF_PLANE_COUNT 

Amount of planes enclosing the view frustum. Should be 6.

Member Function Documentation

◆ clipLine()

bool nirt::scene::SViewFrustum::clipLine ( core::line3d< f32 > &  line) const
inline

clips a line to the view frustum.

Clips a line to the frustum.

Returns
True if the line was clipped, false if not

◆ getTransform() [1/2]

core::matrix4 & nirt::scene::SViewFrustum::getTransform ( video::E_TRANSFORMATION_STATE  state)
inline

get the given state's matrix based on frustum E_TRANSFORMATION_STATE

View Frustum depends on Projection & View Matrix

◆ getTransform() [2/2]

const core::matrix4 & nirt::scene::SViewFrustum::getTransform ( video::E_TRANSFORMATION_STATE  state) const
inline

get the given state's matrix based on frustum E_TRANSFORMATION_STATE

View Frustum depends on Projection & View Matrix

◆ setFrom()

void nirt::scene::SViewFrustum::setFrom ( const core::matrix4 mat,
bool  zClipFromZero 
)
inline

This constructor creates a view frustum based on a projection and/or view matrix.

This constructor creates a view frustum based on a projection and/or view matrix.

◆ transform()

void nirt::scene::SViewFrustum::transform ( const core::matrix4 mat)
inline

transforms the frustum by the matrix

Parameters
matMatrix by which the view frustum is transformed.

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

Nirtcpp    @cppfx.xyz

Utxcpp    utx::print