Cogs.Core
Functions
Cogs::Utility::CameraHelper Namespace Reference

Contains common utility members for camera setup Other camera utilities: Interpolation utilities can be found in: Foundation/Geometry/EasingFn.h Foundation/Geometry/Interpolator.h Foundation/Geometry/Interpolation.hpp Component: CinematicCameraComponent Library: glm. More...

Functions

COGSCORE_DLL_API glm::dvec3 getCenter (const Cogs::Geometry::DBoundingBox &boundingBox)
 Gets center of non-empty bounding box.
 
COGSCORE_DLL_API float getFarDistance (const glm::dvec3 &position, const Cogs::Geometry::DBoundingBox &boundingBox)
 Gets camera far distance given bounding box.
 
COGSCORE_DLL_API float getFocalDistance (const glm::dvec3 &position, const Cogs::Geometry::DBoundingBox &boundingBox)
 Gets distance from given position (camera position) to center of bounding box.
 
COGSCORE_DLL_API glm::quat getOrientation (float horizontalAngle, float verticalAngle)
 Gets the camera orientation from the horizontal and vertical angle values.
 
COGSCORE_DLL_API float getOrthoHeight (const Cogs::Geometry::DBoundingBox &boundingBox)
 Calculate Orthographic camera orthoHeight Field to view boundingbox.
 
COGSCORE_DLL_API float getRadius (const Cogs::Geometry::DBoundingBox &boundingBox)
 Gets the radius of the bounding sphere.
 
COGSCORE_DLL_API glm::dvec3 getFocalPosition (const glm::dvec3 &position, const glm::quat &orientation, float focalDistance)
 
COGSCORE_DLL_API glm::dvec3 getViewAllPosition (const Cogs::Geometry::DBoundingBox &boundingBox, const glm::quat &orientation, float fieldOfView, glm::vec2 viewport)
 

Detailed Description

Contains common utility members for camera setup Other camera utilities: Interpolation utilities can be found in: Foundation/Geometry/EasingFn.h Foundation/Geometry/Interpolator.h Foundation/Geometry/Interpolation.hpp Component: CinematicCameraComponent Library: glm.

Function Documentation

◆ getCenter()

glm::dvec3 Cogs::Utility::CameraHelper::getCenter ( const Cogs::Geometry::DBoundingBox &  boundingBox)

Gets center of non-empty bounding box.

Definition at line 17 of file CameraHelper.cpp.

Referenced by getFocalDistance(), getViewAllPosition(), and Cogs::Utility::CameraUtils::viewAll().

◆ getFarDistance()

float Cogs::Utility::CameraHelper::getFarDistance ( const glm::dvec3 &  position,
const Cogs::Geometry::DBoundingBox &  boundingBox 
)

Gets camera far distance given bounding box.

Definition at line 23 of file CameraHelper.cpp.

References getFocalDistance(), and getRadius().

Referenced by Cogs::Utility::CameraUtils::viewAll().

◆ getFocalDistance()

float Cogs::Utility::CameraHelper::getFocalDistance ( const glm::dvec3 &  position,
const Cogs::Geometry::DBoundingBox &  boundingBox 
)

Gets distance from given position (camera position) to center of bounding box.

Definition at line 29 of file CameraHelper.cpp.

References getCenter().

Referenced by getFarDistance(), and Cogs::Utility::CameraUtils::viewAll().

◆ getFocalPosition()

glm::dvec3 Cogs::Utility::CameraHelper::getFocalPosition ( const glm::dvec3 &  position,
const glm::quat &  orientation,
float  focalDistance 
)

Calculate focal point given camera position, orientation and distance. Can be used to calculate any point aloing an orientation.

Parameters
positionStart position
orientationOrientation of camera
focalDistanceDistance along ray.
Returns
calcualted position

Definition at line 61 of file CameraHelper.cpp.

◆ getOrientation()

glm::quat Cogs::Utility::CameraHelper::getOrientation ( float  horizontalAngle,
float  verticalAngle 
)

Gets the camera orientation from the horizontal and vertical angle values.

Parameters
horizontalAngleHorizontal rotation angle
verticalAngleVertical rotation Angle
Returns
glm::quat representing Camera direction

Definition at line 36 of file CameraHelper.cpp.

Referenced by Cogs::Utility::CameraUtils::getCameraOrientation().

◆ getOrthoHeight()

float Cogs::Utility::CameraHelper::getOrthoHeight ( const Cogs::Geometry::DBoundingBox &  boundingBox)

Calculate Orthographic camera orthoHeight Field to view boundingbox.

Definition at line 44 of file CameraHelper.cpp.

References getRadius().

Referenced by Cogs::Utility::CameraUtils::viewAll().

◆ getRadius()

float Cogs::Utility::CameraHelper::getRadius ( const Cogs::Geometry::DBoundingBox &  boundingBox)

Gets the radius of the bounding sphere.

Definition at line 54 of file CameraHelper.cpp.

Referenced by getFarDistance(), getOrthoHeight(), and getViewAllPosition().

◆ getViewAllPosition()

glm::dvec3 Cogs::Utility::CameraHelper::getViewAllPosition ( const Cogs::Geometry::DBoundingBox &  boundingBox,
const glm::quat &  orientation,
float  fieldOfView,
glm::vec2  viewport 
)

Calculates a camera position where boundingbox given is shown on the screen.

2D viewport defaults to 0.0f, which would result in an assumed aspect ratio of 1.0f. Use the actual width and height, in pixels, of the 3D view to use the correct aspect ratio in calculations.

Parameters
boundingBoxMust be a boundingbox with hasExtent(BoundingBoxType box)
orientationCamera orientation
fieldOfViewCamera field of view (also used in ortho camera).
viewportWidth/Height in pixels of the 3D view
Returns
New Camera Position

Definition at line 69 of file CameraHelper.cpp.

References getCenter(), and getRadius().

Referenced by Cogs::Utility::CameraUtils::viewAll().