DEKI/ENGINE docs
Deki 0.19.0
Modular C++ 2D engine for embedded displays and desktop
Loading...
Searching...
No Matches
Deki::ICamera Class Referenceabstract

Camera interface for coordinate conversion. More...

#include <deki/ICamera.h>

Public Member Functions

virtual void ScreenToWorld (float screenX, float screenY, int bufferWidth, int bufferHeight, float &worldX, float &worldY) const =0
virtual void WorldToScreen (float worldX, float worldY, int bufferWidth, int bufferHeight, float &screenX, float &screenY) const =0
virtual void GetClearColor (uint8_t &r, uint8_t &g, uint8_t &b) const =0
virtual void SetClearColor (uint8_t r, uint8_t g, uint8_t b)=0
virtual float GetPixelsPerMeter (int bufferWidth, int bufferHeight) const =0
virtual float GetOrthoHeight () const =0
virtual void SetOrthoHeight (float meters)=0
virtual void SetFixedPixelsPerMeter (float pixelsPerMeter)=0
virtual ProjectionMode GetProjectionMode () const =0
virtual void SetProjectionMode (ProjectionMode mode)=0
virtual float GetFieldOfView () const =0
virtual float GetNearPlane () const =0
virtual float GetFarPlane () const =0
virtual Mat4 GetProjectionMatrix (int bufferWidth, int bufferHeight) const =0
 Projection matrix for a buffer of this size, orthographic or perspective per GetProjectionMode().
virtual ~ICamera ()=default

Static Public Attributes

static constexpr uint32_t kInterfaceID = 0x43414D00

Detailed Description

Camera interface for coordinate conversion.

Packages implement it on their camera components. The editor finds it with Object::FindInterface<ICamera>() without knowing the concrete type.

Coordinate model: screen pixels (float) = (world - camera) * pixelsPerMeter + buffer_center with world in meters. pixelsPerMeter is the buffer's height over the camera's ortho height (Deki::OrthoPixelsPerMeter, ScreenScale.h), so a camera shows the same height of world on every screen whatever its resolution; a wider screen shows more at the sides.

Constructor & Destructor Documentation

◆ ~ICamera()

virtual Deki::ICamera::~ICamera ( )
virtualdefault

Member Function Documentation

◆ ScreenToWorld()

virtual void Deki::ICamera::ScreenToWorld ( float screenX,
float screenY,
int bufferWidth,
int bufferHeight,
float & worldX,
float & worldY ) const
pure virtual

◆ WorldToScreen()

virtual void Deki::ICamera::WorldToScreen ( float worldX,
float worldY,
int bufferWidth,
int bufferHeight,
float & screenX,
float & screenY ) const
pure virtual

◆ GetClearColor()

virtual void Deki::ICamera::GetClearColor ( uint8_t & r,
uint8_t & g,
uint8_t & b ) const
pure virtual

◆ SetClearColor()

virtual void Deki::ICamera::SetClearColor ( uint8_t r,
uint8_t g,
uint8_t b )
pure virtual

◆ GetPixelsPerMeter()

virtual float Deki::ICamera::GetPixelsPerMeter ( int bufferWidth,
int bufferHeight ) const
pure virtual

◆ GetOrthoHeight()

virtual float Deki::ICamera::GetOrthoHeight ( ) const
pure virtual

◆ SetOrthoHeight()

virtual void Deki::ICamera::SetOrthoHeight ( float meters)
pure virtual

◆ SetFixedPixelsPerMeter()

virtual void Deki::ICamera::SetFixedPixelsPerMeter ( float pixelsPerMeter)
pure virtual

◆ GetProjectionMode()

virtual ProjectionMode Deki::ICamera::GetProjectionMode ( ) const
pure virtual

◆ SetProjectionMode()

virtual void Deki::ICamera::SetProjectionMode ( ProjectionMode mode)
pure virtual

◆ GetFieldOfView()

virtual float Deki::ICamera::GetFieldOfView ( ) const
pure virtual

◆ GetNearPlane()

virtual float Deki::ICamera::GetNearPlane ( ) const
pure virtual

◆ GetFarPlane()

virtual float Deki::ICamera::GetFarPlane ( ) const
pure virtual

◆ GetProjectionMatrix()

virtual Mat4 Deki::ICamera::GetProjectionMatrix ( int bufferWidth,
int bufferHeight ) const
pure virtual

Projection matrix for a buffer of this size, orthographic or perspective per GetProjectionMode().

Standard2DRenderer maps through WorldToScreen instead.

Member Data Documentation

◆ kInterfaceID

uint32_t Deki::ICamera::kInterfaceID = 0x43414D00
staticconstexpr

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