Drag[en]gine Game Engine  1.21
deCamera Class Reference

World camera. More...

#include <deCamera.h>

Inheritance diagram for deCamera:
deResource deObject

Public Types

typedef deTObjectReference< deCameraRef
 Type holding strong reference. More...
 
- Public Types inherited from deResource
typedef deTObjectReference< deResourceRef
 Type holding strong reference. More...
 
- Public Types inherited from deObject
typedef deTObjectReference< deObjectRef
 Type holding strong reference. More...
 

Public Member Functions

Management
const decDVectorGetPosition () const
 Position. More...
 
void SetPosition (const decDVector &position)
 Set position. More...
 
const decQuaternionGetOrientation () const
 Orientation. More...
 
void SetOrientation (const decQuaternion &orientation)
 Set orientation. More...
 
float GetFov () const
 Vertical field of view in radians for the entire view. More...
 
void SetFov (float fov)
 Set vertical field of view in radians of the entire view. More...
 
float GetFovRatio () const
 Aspect ratio of the horizontal field of view to the vertical field of view. More...
 
void SetFovRatio (float ratio)
 Set aspect ratio of the horizonral field of view to the vertical field of view. More...
 
float GetImageDistance () const
 Distance to the image plane. More...
 
void SetImageDistance (float distance)
 Set distance to the image plane. More...
 
float GetViewDistance () const
 Viewing distance up to which world geometry is rendered. More...
 
void SetViewDistance (float distance)
 Set view distance up to which world geometry is rendered. More...
 
bool GetEnableHDRR () const
 Enable high definition range rendering (HDRR) if supported. More...
 
void SetEnableHDRR (bool enable)
 Set to enable high definition range rendering (HDRR) if supported. More...
 
float GetExposure () const
 Exposure. More...
 
void SetExposure (float exposure)
 Set exposure. More...
 
float GetLowestIntensity () const
 Lowest intensity the eye can adapt to. More...
 
void SetLowestIntensity (float lowestIntensity)
 Set lowest intensity the eye can adapt to. More...
 
float GetHighestIntensity () const
 Highest intensity the eye can adapt to. More...
 
void SetHighestIntensity (float highestIntensity)
 Set highest intensity the eye can adapt to. More...
 
float GetAdaptionTime () const
 Adaption time of the eye in seconds. More...
 
void SetAdaptionTime (float adaptionTime)
 Set adaption time of the eye in seconds. More...
 
bool GetEnableGI () const
 Enable global illumination (GI) if supported. More...
 
void SetEnableGI (bool enable)
 Set to enable global illumination (GI) if supported. More...
 
decLayerMaskGetLayerMask ()
 Layer mask. Call NotifyLayerMaskChanged afterwards. More...
 
const decLayerMaskGetLayerMask () const
 
void NotifyLayerMaskChanged ()
 Notifies the peers that the layer mask changed. More...
 
void ResetAdaptedIntensity ()
 Request graphic module to reset adapted intensity to optimal value. More...
 
float GetWhiteIntensity () const
 White intensity multiplier. More...
 
void SetWhiteIntensity (float intensity)
 Set white intensity multiplier. More...
 
float GetBloomIntensity () const
 Bloom intensity multiplier. More...
 
void SetBloomIntensity (float intensity)
 Set bloom intensity multiplier. More...
 
float GetBloomStrength () const
 Bloom strength as multiplier of intensity beyond bloom intensity. More...
 
void SetBloomStrength (float strength)
 Set bloom strength as multiplier of intensity beyond bloom intensity. More...
 
float GetBloomBlend () const
 Bloom blend as multiplier of intensity beyond bloom intensity. More...
 
void SetBloomBlend (float blend)
 Set bloom blend as multiplier of intensity beyond bloom intensity. More...
 
float GetBloomSize () const
 Bloom size as percentage of screen width. More...
 
void SetBloomSize (float size)
 Bloom size as percentage of screen width. More...
 
const decCurveBezierGetToneMapCurve () const
 Custom tone mapping curve or empty curve to disable. More...
 
void SetToneMapCurve (const decCurveBezier &curve)
 Set custom tone mapping curve or empty curve to disable. More...
 
Effects
int GetEffectCount () const
 Count of effects. More...
 
deEffectGetEffectAt (int index) const
 Effect at the given index. More...
 
void AddEffect (deEffect *effect)
 Adds an effect. More...
 
void RemoveEffect (deEffect *effect)
 Removes an effect. More...
 
void RemoveAllEffects ()
 Removes all effects. More...
 
System Peers
deBaseGraphicCameraGetPeerGraphic () const
 Graphic system camera peer. More...
 
void SetPeerGraphic (deBaseGraphicCamera *peer)
 Set graphic system camera peer. More...
 
- Public Member Functions inherited from deResource
deResourceManagerGetResourceManager () const
 Resource manager or NULL if resource is leaking. More...
 
deEngineGetEngine () const
 Game engine object from resource manager. More...
 
deResourceGetLLManagerPrev () const
 Previous resource in the resource manager linked list. More...
 
void SetLLManagerPrev (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
deResourceGetLLManagerNext () const
 Next resource in the resource manager linked list. More...
 
void SetLLManagerNext (deResource *resource)
 Set next resource in the resource manager linked list. More...
 
void MarkLeaking ()
 Marks the resource leaking. More...
 
 deResource (deResourceManager *resourceManager)
 Create resource. More...
 
- Public Member Functions inherited from deObject
int GetRefCount () const
 Reference count. More...
 
void AddReference ()
 Add reference increasing reference count by 1. More...
 
void FreeReference ()
 Decrease reference count by one and delete object if count reaches 0. More...
 
 deObject ()
 Create object with reference count of 1. More...
 

Constructors and Destructors

 deCamera (deCameraManager *manager)
 Create new camera object with the given resource manager. More...
 
virtual ~deCamera ()
 Clean up camera. More...
 

Linked List

deWorldGetParentWorld () const
 Parent world or NULL. More...
 
void SetParentWorld (deWorld *world)
 Set parent world or NULL. More...
 
deCameraGetLLWorldPrev () const
 Previous camera in the parent world linked list. More...
 
void SetLLWorldPrev (deCamera *camera)
 Set next camera in the parent world linked list. More...
 
deCameraGetLLWorldNext () const
 Next camera in the parent world linked list. More...
 
void SetLLWorldNext (deCamera *camera)
 Set next camera in the parent world linked list. More...
 

Additional Inherited Members

- Protected Member Functions inherited from deResource
virtual ~deResource ()
 Clean up resource. More...
 
- Protected Member Functions inherited from deObject
virtual ~deObject ()
 Clean up object. More...
 

Detailed Description

World camera.

A world camera defines the camera parameters used for rendering a world. Cameras have various parameters useful to alter the way the world is rendered.

The lower and upper intensity parameter indicates the range of intensity the camera can automatically adapt to. The chosen intensity level for a camera is the "scene intensity" (or "average intensity"). This intensity is mapped to a reasonable middle gray value in the final image.

The exposure is used to increase or decrease the overall luminance of the rendered world. This alters the scene intensity mapping to the middle gray value. Use values lower than 1 to make the image darker and values higher than 1 to brighten up the image. Reducing the exposure usually decreases also the contrast which can make images more pleasant.

Using the "scene intensity" a "maximum intensity" is determined for the image. The maximum intensity maps to pure white in the final image. Using the white intensity parameter this intensity can be shifted to avoid bright parts of the image to wash out to white. This can happen when the camera is located inside a room while looking out into the sun light. The behavior of the white intensity parameter depends on the presence of custom tone mapping. If custom tone mapping curve is not used the white intensity parameter alters the tone mapping parameters used by the graphic module to reduce the washing out to white. If custom tone mapping curve is used the white intensity parameter indicates the upper bound of the input send through the curve. Pixel intensities above the white intensity are thus clamped to the white intensity. The default value is 2.

In games overbrighting is often used as a gameplay element to simulate very bright pixel for example an energy beam or entering a room with glaring light while coming out of night light conditions. Overbrighting can be done in two ways. For overbrighting affecting the entire screen like for example flashbangs using a post processing color matrix effect is the best choice. For overbrighting on a per pixel basis blooming is typically used. For this intensities of pixels are clamped against a "bloom intensity threshold". Intensites above this threshold are used to create halo light effects similar to oversatured rods in the eye. The effect is controlled by the bloom intensity, bloom strength, bloom blend and bloom size parameter.

The bloom intensity is a multiplier applied to the current "maximum intensity" of the camera. The default value is 1. To produce an overbright effect pixel requires an intensity 1 times as bright than the current camera maximum intensity.

The bloom strength is a multiplier applied to the overbright intensity beyond the bloom intensity threshold. For example if the threshold is 1 and the pixel intensity is 2 then the overbright intensity is 1 and is multiplied with the strength factor. This allows to modify the amount of intensity required to result in a strong glare. The default value is 0.25

The bloom blend is a multiplier applied to the overbright calculated for a pixel. This is typically used to blend between using bloom (1) and not using bloom (0).

Blooming usually spreads due to rods oversaturating which is a chemical process in the eye. The bloom size indicates the broadness of the blur as percentage of the screen width.

Optionally a custom tone mapping curve can be defined. The custom tone mapping curve is used if it has at least one curve point. The default custom tone mapping curve is empty.

Todo:
Add option to define render mode:
  • ermPerspective: Regular perspective rendering (default)
  • ermOrthogonal: Orthogonal rendering. fov and fov ratio are used to define the render size. or add new parameters
  • ermOmniDirection: Render 360 view. output is a cube-map. for dynamic skins no addiotnal work has to be done. for canvas render world the canvas has to have a depth of 6. if the depth 1 one the output is converted into a single image mercartor map. this is though not the default use case. => another option is outputing an equirectangular image. this works well with various texture properties and especially works well with canvas systems since it is an image with depth 1 as most other images are

Member Typedef Documentation

◆ Ref

Type holding strong reference.

Constructor & Destructor Documentation

◆ deCamera()

deCamera::deCamera ( deCameraManager manager)

Create new camera object with the given resource manager.

◆ ~deCamera()

virtual deCamera::~deCamera ( )
protectedvirtual

Clean up camera.

Note
Subclasses should set their destructor protected too to avoid users accidently deleting a reference counted object through the object pointer. Only FreeReference() is allowed to delete the object.

Member Function Documentation

◆ AddEffect()

void deCamera::AddEffect ( deEffect effect)

Adds an effect.

◆ GetAdaptionTime()

float deCamera::GetAdaptionTime ( ) const
inline

Adaption time of the eye in seconds.

◆ GetBloomBlend()

float deCamera::GetBloomBlend ( ) const
inline

Bloom blend as multiplier of intensity beyond bloom intensity.

Version
1.21

◆ GetBloomIntensity()

float deCamera::GetBloomIntensity ( ) const
inline

Bloom intensity multiplier.

Version
1.21

◆ GetBloomSize()

float deCamera::GetBloomSize ( ) const
inline

Bloom size as percentage of screen width.

Version
1.21

◆ GetBloomStrength()

float deCamera::GetBloomStrength ( ) const
inline

Bloom strength as multiplier of intensity beyond bloom intensity.

Version
1.21

◆ GetEffectAt()

deEffect* deCamera::GetEffectAt ( int  index) const

Effect at the given index.

◆ GetEffectCount()

int deCamera::GetEffectCount ( ) const

Count of effects.

◆ GetEnableGI()

bool deCamera::GetEnableGI ( ) const
inline

Enable global illumination (GI) if supported.

◆ GetEnableHDRR()

bool deCamera::GetEnableHDRR ( ) const
inline

Enable high definition range rendering (HDRR) if supported.

◆ GetExposure()

float deCamera::GetExposure ( ) const
inline

Exposure.

◆ GetFov()

float deCamera::GetFov ( ) const
inline

Vertical field of view in radians for the entire view.

◆ GetFovRatio()

float deCamera::GetFovRatio ( ) const
inline

Aspect ratio of the horizontal field of view to the vertical field of view.

◆ GetHighestIntensity()

float deCamera::GetHighestIntensity ( ) const
inline

Highest intensity the eye can adapt to.

◆ GetImageDistance()

float deCamera::GetImageDistance ( ) const
inline

Distance to the image plane.

◆ GetLayerMask() [1/2]

decLayerMask& deCamera::GetLayerMask ( )
inline

Layer mask. Call NotifyLayerMaskChanged afterwards.

◆ GetLayerMask() [2/2]

const decLayerMask& deCamera::GetLayerMask ( ) const
inline

◆ GetLLWorldNext()

deCamera* deCamera::GetLLWorldNext ( ) const
inline

Next camera in the parent world linked list.

◆ GetLLWorldPrev()

deCamera* deCamera::GetLLWorldPrev ( ) const
inline

Previous camera in the parent world linked list.

◆ GetLowestIntensity()

float deCamera::GetLowestIntensity ( ) const
inline

Lowest intensity the eye can adapt to.

◆ GetOrientation()

const decQuaternion& deCamera::GetOrientation ( ) const
inline

Orientation.

◆ GetParentWorld()

deWorld* deCamera::GetParentWorld ( ) const
inline

Parent world or NULL.

◆ GetPeerGraphic()

deBaseGraphicCamera* deCamera::GetPeerGraphic ( ) const
inline

Graphic system camera peer.

◆ GetPosition()

const decDVector& deCamera::GetPosition ( ) const
inline

Position.

◆ GetToneMapCurve()

const decCurveBezier& deCamera::GetToneMapCurve ( ) const
inline

Custom tone mapping curve or empty curve to disable.

Version
1.21

◆ GetViewDistance()

float deCamera::GetViewDistance ( ) const
inline

Viewing distance up to which world geometry is rendered.

◆ GetWhiteIntensity()

float deCamera::GetWhiteIntensity ( ) const
inline

White intensity multiplier.

Version
1.21

◆ NotifyLayerMaskChanged()

void deCamera::NotifyLayerMaskChanged ( )

Notifies the peers that the layer mask changed.

◆ RemoveAllEffects()

void deCamera::RemoveAllEffects ( )

Removes all effects.

◆ RemoveEffect()

void deCamera::RemoveEffect ( deEffect effect)

Removes an effect.

◆ ResetAdaptedIntensity()

void deCamera::ResetAdaptedIntensity ( )

Request graphic module to reset adapted intensity to optimal value.

◆ SetAdaptionTime()

void deCamera::SetAdaptionTime ( float  adaptionTime)

Set adaption time of the eye in seconds.

◆ SetBloomBlend()

void deCamera::SetBloomBlend ( float  blend)

Set bloom blend as multiplier of intensity beyond bloom intensity.

Version
1.21

◆ SetBloomIntensity()

void deCamera::SetBloomIntensity ( float  intensity)

Set bloom intensity multiplier.

Version
1.21

◆ SetBloomSize()

void deCamera::SetBloomSize ( float  size)

Bloom size as percentage of screen width.

Version
1.21

◆ SetBloomStrength()

void deCamera::SetBloomStrength ( float  strength)

Set bloom strength as multiplier of intensity beyond bloom intensity.

Version
1.21

◆ SetEnableGI()

void deCamera::SetEnableGI ( bool  enable)

Set to enable global illumination (GI) if supported.

◆ SetEnableHDRR()

void deCamera::SetEnableHDRR ( bool  enable)

Set to enable high definition range rendering (HDRR) if supported.

◆ SetExposure()

void deCamera::SetExposure ( float  exposure)

Set exposure.

◆ SetFov()

void deCamera::SetFov ( float  fov)

Set vertical field of view in radians of the entire view.

◆ SetFovRatio()

void deCamera::SetFovRatio ( float  ratio)

Set aspect ratio of the horizonral field of view to the vertical field of view.

◆ SetHighestIntensity()

void deCamera::SetHighestIntensity ( float  highestIntensity)

Set highest intensity the eye can adapt to.

◆ SetImageDistance()

void deCamera::SetImageDistance ( float  distance)

Set distance to the image plane.

◆ SetLLWorldNext()

void deCamera::SetLLWorldNext ( deCamera camera)

Set next camera in the parent world linked list.

◆ SetLLWorldPrev()

void deCamera::SetLLWorldPrev ( deCamera camera)

Set next camera in the parent world linked list.

◆ SetLowestIntensity()

void deCamera::SetLowestIntensity ( float  lowestIntensity)

Set lowest intensity the eye can adapt to.

◆ SetOrientation()

void deCamera::SetOrientation ( const decQuaternion orientation)

Set orientation.

◆ SetParentWorld()

void deCamera::SetParentWorld ( deWorld world)

Set parent world or NULL.

◆ SetPeerGraphic()

void deCamera::SetPeerGraphic ( deBaseGraphicCamera peer)

Set graphic system camera peer.

◆ SetPosition()

void deCamera::SetPosition ( const decDVector position)

Set position.

◆ SetToneMapCurve()

void deCamera::SetToneMapCurve ( const decCurveBezier curve)

Set custom tone mapping curve or empty curve to disable.

Version
1.21
Note
If enabled make sure to match the curve range to the white intensity.

◆ SetViewDistance()

void deCamera::SetViewDistance ( float  distance)

Set view distance up to which world geometry is rendered.

◆ SetWhiteIntensity()

void deCamera::SetWhiteIntensity ( float  intensity)

Set white intensity multiplier.

Version
1.21

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