esp::sensor::CameraSensor class

Base classes

class VisualSensor

Constructors, destructors, conversion operators

CameraSensor(scene::SceneNode& cameraNode, const CameraSensorSpec::ptr& spec) explicit

Public functions

void setProjectionParameters(const CameraSensorSpec& spec)
Updates this sensor's CameraSensorSpec cameraSensorSpec_ to reflect the passed new values.
auto getRenderCamera() const -> gfx::RenderCamera* override
Returns pointer to member RenderCamera that CameraSensor will use for rendering.
auto depthUnprojection() const -> Corrade::Containers::Optional<Magnum::Vector2> override
Returns the parameters needed to unproject depth for this sensor's perspective projection model. See gfx::calculateDepthUnprojection.
auto drawObservation(sim::Simulator& sim) -> bool override
Draw an observation to the frame buffer using simulator's renderer.
void modifyZoom(float factor)
Modify the zoom matrix for perspective and ortho cameras.
void resetZoom()
Resets the zoom on this CameraSensor to reflect current sensor spec values.
void setFOV(Mn::Deg FOV)
Sets the FOV for this CameraSensor. Only consumed by pinhole/perspective cameras.
void setCameraType(const SensorSubType& _cameraType)
Sets camera type and calculates appropriate size vector for display.
auto getCameraType() const -> SensorSubType
Returns the camera type of this Sensor.
void setWidth(int width)
Sets width of this sensor's view port.
void setHeight(int height)
Sets height of this sensor's view port.
void setNear(float _near)
Sets near plane distance.
void setFar(float _far)
Sets far plane distance.
auto specification() const -> CameraSensorSpec::ptr
Return a pointer to this camera sensor's SensorSpec.
auto getProjectionMatrix() const -> Mn::Matrix4 override
Return this sensor's projection matrix.

Protected functions

void recomputeBaseProjectionMatrix()
Recalculate the base projection matrix, based on camera type and display size. This should be called only when camera type, size or clipping planes change.
void recomputeProjectionMatrix()
Recalculate the projection Matrix used by this Camera Sensor, which should be recomputeulated zoomMatrix_ or baseProjMatrix_ change.
void draw(scene::SceneGraph& sceneGraph, gfx::RenderCamera::Flags flags)
Draw the scene graph with the specified camera flag.

Protected variables

Magnum::Matrix4 projectionMatrix_
This camera's projection matrix. Should be recomputed every time size changes.
Magnum::Matrix4 baseProjMatrix_
A base projection matrix based on camera's type and display size.
Magnum::Matrix4 zoomMatrix_
A matrix to determine the zoom for the projection.
Mn::Vector2 nearPlaneSize_
size of near plane
gfx::RenderCamera* renderCamera_
raw pointer to member RenderCamera that CameraSensor will use for rendering
CameraSensorSpec::ptr cameraSensorSpec_

Function documentation

void esp::sensor::CameraSensor::setProjectionParameters(const CameraSensorSpec& spec)

Updates this sensor's CameraSensorSpec cameraSensorSpec_ to reflect the passed new values.

Parameters
spec in Instance of CameraSensorSpec that sensor will use to update its own SensorSpec

bool esp::sensor::CameraSensor::drawObservation(sim::Simulator& sim) override

Draw an observation to the frame buffer using simulator's renderer.

Parameters
sim in Instance of Simulator class for which the observation needs to be drawn
Returns true if success, otherwise false (e.g., frame buffer is not set)

void esp::sensor::CameraSensor::modifyZoom(float factor)

Modify the zoom matrix for perspective and ortho cameras.

Parameters
factor Modification amount.

void esp::sensor::CameraSensor::setFOV(Mn::Deg FOV)

Sets the FOV for this CameraSensor. Only consumed by pinhole/perspective cameras.

Parameters
FOV desired FOV to set.

void esp::sensor::CameraSensor::draw(scene::SceneGraph& sceneGraph, gfx::RenderCamera::Flags flags) protected

Draw the scene graph with the specified camera flag.

Parameters
sceneGraph in scene graph to be drawn
flags in flag for the render camera