Camera

Properties available through the ObjectData (data) field of an Object when the ObjectType is kCamera. A camera object could be defined as an eye looking at your scene. Based on the LensType applied to the camera the behavior of that eye will change. In addition, cameras can optionally use a FrameBuffer. This type of structure allow you to redirect the camera output to multiple render targets. When using a frame buffer you can draw offscreen and store the render result to existing texture(s). This approach is usually used for post processing effects, deferred rendering and more...

See Also

Static Variables


Name Description
object Reference to the Object holding the current Camera data.
framebuffer FrameBuffer reference attached to the current Camera (if any).
frustum Contain information about each frustum planes used at runtime to clip Object out of the Camera FOV.
view_matrix A 4x4 matrix containing the view matrix of the Camera.

Variables


Name

Description

lens_type The type of lens the active Camera is using.
fov Field of view of the camera in degrees ranging from 1 to 180.
zoom Scane the projection matrix of the active Camera (used only when the LensType is set to kOrthographic).
clip_start Distance of the near clipping plane.
clip_end Distance of the far clipping plane.
ortho_preset OrthoPreset method to use for the active orthographic projection of the Camera.
projection_matrix 4x4 matrix that stores the active Camera projection matrix.

Functions


Name

Description

UpdateProjection Force the projection_matrix to be updated.
UpdateFrustum Manually update the Camera frustum.
AddFrameBuffer Creates a new FrameBuffer object and return its pointer.
RemoveFrameBuffer Destroy the FrameBuffer attached to the current Camera (if any).

LensType


Constant values that represent the type of lens that can be applied to a camera object.

  • kPerspective: This type of lens represents how you view things in the real world; taking in consideration the distance of the object making them appears smaller as they fade into distance.
  • kOrthographic: In orthographic mode objects always keep their actual size regardless of the view angle and distance applied on the camera.
  • kProjection: Override the Camera projection upate and specify your own projection matrix.

Example

-- Print the value associated to the orthographic camera lens type:
print( "The value of kOrthographic is " .. Camera.LensType.kOrthographic )

OrthoPreset

Constant values enumerating the default methods available when using an kOrthographic Camera LensType.

  • kScreenRatio: This type of orthographic projection uses the active screen ratio to calculate the projection matrix of the Camera. This is the mode that the View 3d is using when entering Ortho. mode.
  • kFullscreen2d: Ideal for rendering pixel accurate 2d interface, HUD or GUI (such as the NRGeditor). This preset gives you a 1/1 pixel ratio over the active screen width and height.
  • kManualQuad: Allows you to setup the coordinate of the orthographic quad.

Events


Callbacks Description
OnDraw Triggered when the Camera is ready to draw.
OnDisplay Called right after the Camera is done drawing.
OnBegin Occurs when the Camera is ready to draw into its FrameBuffer.
OnEnd Triggered just before the Camera is done drawing with its active FrameBuffer.




NRG - API 2022.2.380740 - Wed Jun 8 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA