Vigilante Game Framework  1.0.0.8
A 2D/3D C++ Game Framework using SFML.
Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
V3DCamera Class Referenceabstract

Base 3D Camera. More...

#include <V3DCamera.h>

Inheritance diagram for V3DCamera:
V3DOrthographicCamera V3DPerspectiveCamera

Public Member Functions

 V3DCamera (const sf::Vector3f &pos, float zNear=0.1f, float zFar=500.0f)
 
glm::mat4 Orientation () const
 
void LookAt (const sf::Vector3f &pos)
 
glm::mat4 ViewMatrix () const
 
virtual glm::mat4 ProjectionMatrix () const =0
 
glm::mat4 PVMatrix () const
 
sf::Vector3f Forward () const
 Camera's Forward Vector.
 
sf::Vector3f Right () const
 Camera's Right Vector.
 
sf::Vector3f Up () const
 Camera's Up Vector.
 
virtual bool PointInView (sf::Vector3f p)
 
virtual bool SphereInView (sf::Vector3f p, float radius)
 
virtual bool BoxInView (sf::Vector3f p, sf::Vector3f min, sf::Vector3f max)
 

Public Attributes

sf::Vector3f Position
 The Camera Position.
 
sf::Vector3f Rotation
 The Camera Angle.
 
sf::FloatRect Viewport
 Render Viewport Area to apply a Renderscene.
 

Protected Types

enum  FrustumPlane : unsigned char {
  PRIGHT, PLEFT, PTOP, PBOTTOM,
  PNEAR, PFAR
}
 Sides of a Frustum plane for box overlap.
 

Protected Member Functions

void normalizeAngles ()
 Normalize the rotation angles.
 
void updatePlanes ()
 Updates the plane coordinates based on the view-projection transform.
 
float pointPlaneDistance (const glm::vec4 &plane, const glm::vec3 &point)
 Works out the distance between a point and plane based on dot-product.
 

Protected Attributes

float fnear
 Field Near value.
 
float ffar
 Field Far value.
 
glm::vec4 planes [6]
 The plane coordinates for all six size.
 

Detailed Description

Base 3D Camera.

Constructor & Destructor Documentation

◆ V3DCamera()

V3DCamera::V3DCamera ( const sf::Vector3f &  pos,
float  zNear = 0.1f,
float  zFar = 500.0f 
)
Parameters
posInitial Camera Position.
zNearThe near z value for the projection matrix.
zFarThe far z value for the projection matrix.

Member Function Documentation

◆ BoxInView()

virtual bool V3DCamera::BoxInView ( sf::Vector3f  p,
sf::Vector3f  min,
sf::Vector3f  max 
)
virtual
Parameters
pCentre Position of Box.
minLowest values in the box (possibly negative).
maxHighest values in the box.
Returns
True if box is in view.

◆ LookAt()

void V3DCamera::LookAt ( const sf::Vector3f &  pos)
Parameters
posThe target position for the camera to look at.

◆ Orientation()

glm::mat4 V3DCamera::Orientation ( ) const
Returns
Calculated the rotation matrix.

◆ PointInView()

virtual bool V3DCamera::PointInView ( sf::Vector3f  p)
virtual
Parameters
pPosition of 3D Point.
Returns
True if

◆ ProjectionMatrix()

virtual glm::mat4 V3DCamera::ProjectionMatrix ( ) const
pure virtual
Returns
The calculated Projection Matrix of the Camera.

Implemented in V3DOrthographicCamera, and V3DPerspectiveCamera.

◆ PVMatrix()

glm::mat4 V3DCamera::PVMatrix ( ) const
Returns
The combined Projection View Matrix of the Camera. Combine with a model matrix to get the transform of the model in a scene.

◆ SphereInView()

virtual bool V3DCamera::SphereInView ( sf::Vector3f  p,
float  radius 
)
virtual
Parameters
pCentre Position of Sphere.
radiusRadius of Sphere.
Returns
True if sphere is in view.

◆ ViewMatrix()

glm::mat4 V3DCamera::ViewMatrix ( ) const
Returns
The calculated View Matrix of the Camera.

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