Summary

The geCamera object is responsible for handling projection and transformation support for rendering a scene from a given viewpoint.

Overview

The geCamera object manages the relationship between world space, camera space, and screen space. It is responsible for converting between these coordinate systems. It also comprises field of view information used in rendering a 3D scene to the screen.

Definitions

World space World space is a 3D right handed coordinate system. Most of the Genesis3D APIs operate on parameters given in world space. Collision APIs and other world APIs that yield locational information all give their results in world space.
Camera space Camera space is an intermediate 3D coordinate system that the engine uses in the process of projecting geometry to screen space.
Screen space Screen space is a left handed coordinate system.

 

Reference

void geCamera_ConvertModelToCamera(const geXForm3d MXForm, geXForm3d *CXForm)

Description: Do not use this API.

Parameters:

MXForm Transform to convert from
CXForm Transform to convert to

Returns: void

geCamera *geCamera_Create(geFloat FOV, const geRect *Rect)

Description: Creates a camera

Parameters:

FOV This parameter allows you to configure the field of view of the camera. A setting of 2.0 corresponds to a 90 degree field of view.
Rect Screen space rectangle that the camera will project to. This parameter allows to select regions on the screen will be rendered to if you render using this camera.

Returns: A valid geCamera object on success, NULL on failure.

Remarks: You can use this to render multiple views to the screen at a time by creating multiple cameras with different screen rects. In between geEngine_BeginFrame and geEngine_EndFrame, you can render the world multiple times, through different cameras. If you render the world through two different cameras that have different screen rects, you will get two different views of the world rendered to the screen in a single frame.

void geCamera_Destroy(geCamera *Camera)

Description: Destroys a camera

Parameters:

Camera The camera to destroy

Returns: void

void geCamera_GetClippingRect(const geCamera *Camera, geRect *Rect)

Description: Gets the current screen rect of a camera

Parameters:

Camera A camera
Rect Destination rect to store the current screen rect of the camera

Returns: void

void geCamera_GetLocalXForm(const geCamera *Camera, geXForm3d *XForm)

Description: Gets the current transform for the camera

Parameters:

Camera A camera
XForm Result to store transform in

Returns: void

void geCamera_Project(const geCamera *Camera, const geVec3d *PointInCameraSpace, geVec3d *ProjectedPoint)

Description: Projects a point in camera space to a point in screen space.

Parameters:

Camera A camera
PointInCameraSpace Point to project
ProjectedPoint Point projected into screen space

Returns: void

Remarks: See the discussion in the overview on world space vs. camera space vs. screen space.

void geCamera_ScreenPointToWorld(const geCamera *Camera, int32 ScreenX, int32 ScreenY, geVec3d *Vector)

Description: Generates a unit vector in the direction of the camera, looking towards the given screen X and Y coordinates.

Parameters:

Camera A camera
ScreenX X coordinate in screen space
ScreenY Y coordinate in screen space
Vector Output unit vector

Returns: void

Remarks: This API is useful for selecting objects in world space via screen space coordinates. Given a set of screen coordinates, use this API to get a normalized vector in the direction of that screen point. Scale the vector by an arbitrary amount, and use this to calculate an end point from the current camera translation. Take the current camera translation, and that end point, and use geWorld_Collision to collide against objects. This will allow you to accurately point to objects in 3D space using mouse coordinates.

void geCamera_SetAttributes(geCamera *Camera, geFloat FOV, const geRect *Rect)

Description: Sets the field of view and screen rect on a camera

Parameters:

Camera A camera
FOV New field of view setting for the camera
Rect New screen rect for the camera

Returns: void

Remarks: See geCamera_Create for a discussion of the FOV and Rect parameters.

void geCamera_(const geCamera *Camera)

Description:

Parameters:

Camera A camera
   

Returns: void