Cogs.Core
|
Contains common operations for camera setup. More...
Functions | |
template<class TransformComponent , class OrbitingCameraController > | |
glm::quat | getCameraOrientation (const TransformComponent transformComponent, const OrbitingCameraController orbitingCameraController) |
template<class CameraComponent , class TransformComponent , class OrbitingCameraController , typename ProjectionMode > | |
glm::dvec3 | viewAll (const CameraComponent cameraComponent, const TransformComponent transformComponent, const OrbitingCameraController orbitingCameraController, const ProjectionMode projectionMode, const Cogs::Geometry::DBoundingBox &boundingBox, glm::vec2 viewport=glm::vec2(0.0f, 0.0f)) |
View all for given bounding box. | |
template<class CameraData > | |
bool | getProjectedCoordinates (const glm::vec2 &coordinatesToProject, const CameraData &cameraData, const glm::vec3 &targetPlaneNormal, const glm::vec3 &targetPlanePosition, glm::vec3 &projectedCoordinates) |
Project a screen coordinate onto a plane in 3d space. | |
Contains common operations for camera setup.
Uses: CameraHelper.h for calculation. Support both Cogs.Native API usage and direct Cogs classes: Using Cogs::Native: Cogs::Native::ProjectionMode projectionMode = camera->cameraComponent->projectionMode Cogs::Utility::CameraUtils::viewAll(camera->cameraComponent, camera->transformComponent, camera->getComponent<OrbitingCameraController>(), projectionMode, bbox, viewport); Using Cogs::Core: Cogs::Core::ProjectionMode projectionMode = cameraComponent->projectionMode; Cogs::Utility::CameraUtils::viewAll(camera->getComponent<CameraComponent>(), camera->getComponent<TransformComponent>(), camera->getComponent<OrbitingCameraController>(), projectionMode, bbox, viewport);
|
inline |
Get the Camera Orientation Quaternion.
TransformComponent | Cogs.Native of Core::TransformComponent |
OrbitingCameraController | Cogs.Native of Core::OrbitingCameraController |
transformComponent | Camera transform if not using orbiting controller. |
orbitingCameraController | Optional orbiting controller. Use transformComponent if not present. |
Definition at line 29 of file CameraUtils.h.
References Cogs::Utility::CameraHelper::getOrientation().
Referenced by viewAll().
|
inline |
Project a screen coordinate onto a plane in 3d space.
coordinatesToProject | - Screen coordinate to project. | |
cameraData | - CameraData of the camera used for projection. | |
cameraPosition | - Position of the camera used for projection. | |
targetPlaneNormal | - Normal vector of the plane used for projecting onto. As a convenience, a normal of exactly [0,0,0] will be interpreted as a plane orthogonal to the camera view direction. | |
targetPlanePosition | - Position of the plane used for projecting onto. | |
[out] | projectedCoordinates | - Resulting projected coordinate. |
Definition at line 103 of file CameraUtils.h.
|
inline |
View all for given bounding box.
Ensures a sphere enclosing the bounding box is visible. Update passed components. Either in CameraComponent/TransformComponent or OrbitingCameraController/CameraComponent. Updated cameraComponent->farDistance is extended if needed to include bounds (Near Distance not changed).
cameraComponent | - CameraComponent of the selected camera. |
transformComponent | - TransformComponent of the selected camera. |
orbitingCameraController | - Optional OrbitingCameraController component of the selected camera. |
projectionMode | - Perspective or Orthogonal projection |
boundingBox | - Bounding box to focus on. Must have Extents. |
viewport | - Optional viewport in pixels of window. |
Definition at line 56 of file CameraUtils.h.
References getCameraOrientation(), Cogs::Utility::CameraHelper::getCenter(), Cogs::Utility::CameraHelper::getFarDistance(), Cogs::Utility::CameraHelper::getFocalDistance(), Cogs::Utility::CameraHelper::getOrthoHeight(), and Cogs::Utility::CameraHelper::getViewAllPosition().