The SGADE Documentation

the SGADE The Socrates Gameboy Advance Development Engine

The SGADE is a development library for the Nintendo Gameboy Advance. It's free for all uses and is distributed without guarantees. For more information visit the SGADE page.


Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

SoCamera

Camera for rendering 3D primitives. More...

Files

file  SoCamera.c
file  SoCamera.h

Data Structures

struct  SoCamera
 Used to render 3D stuff. More...


Functions

void SoCameraInitialize (SoCamera *a_This)
 Initializes a camera.

void SoCameraForward (SoCamera *a_This, sofixedpoint a_Amount)
 Forwards the camera by the given fixed point amount.

void SoCameraRight (SoCamera *a_This, sofixedpoint a_Amount)
 Moves the camera to the right by the given fixed point amount.

void SoCameraUp (SoCamera *a_This, sofixedpoint a_Amount)
 Moves the camera up by the given fixed point amount.

void SoCameraSetPitch (SoCamera *a_This, s32 a_Angle)
 Sets the pitch of the camera. A full circle is 256 degrees.

void SoCameraSetYaw (SoCamera *a_This, s32 a_Angle)
 Sets the yaw of the camera. A full circle is 256 degrees.

void SoCameraSetRoll (SoCamera *a_This, s32 a_Angle)
 Sets the roll of the camera. A full circle is 256 degrees.

void SoCameraSetTranslation (SoCamera *a_This, sofixedpoint a_X, sofixedpoint a_Y, sofixedpoint a_Z)
 Sets the translate of the camera.

void SoCameraDrawMesh (SoCamera *a_This, SoMesh *a_Mesh)
 Draws the given mesh into the current buffer.

void SoCameraSetFarAndNearPlaneClippingEnable (SoCamera *a_This, bool a_Enable)
 Enables or disables clipping of polygons against the far and near planes.

void SoCameraSetFrustumSidePlanesClippingEnable (SoCamera *a_This, bool a_Enable)

Detailed Description

Camera for rendering 3D primitives.

This file contains the definitions of the camera class. Cameras are used to project and render 3 dimensional primitives onto the GBA screen.


Function Documentation

void SoCameraDrawMesh SoCamera   a_This,
SoMesh   a_Mesh
 

Draws the given mesh into the current buffer.

Parameters:
a_This  This pointer
a_Mesh  Mesh that should be drawn

Todo:
Make this method independent from the SoMode4Rasterizer

This function transforms the given mesh from object space to camera space, performs clipping if neccesary and requested, then transforms it to screenspace, and then draws it using the correct functions (texture, non-textured, etc.).

void SoCameraForward SoCamera   a_This,
sofixedpoint    a_Amount
 

Forwards the camera by the given fixed point amount.

Parameters:
a_This  This pointer
a_Amount  Fixed point amount to move forward with
If you need backwards movement just give a negative amount.

void SoCameraInitialize SoCamera   a_This
 

Initializes a camera.

Parameters:
a_This  This Pointer

Todo:
Fix hardcoded projection plane distance. Make this adjustable.

Initializes the given camera. It resets its transform. It enables near- and far-plane clipping. Enables frustum side-plane clipping. Initializes some internal structures.

void SoCameraRight SoCamera   a_This,
sofixedpoint    a_Amount
 

Moves the camera to the right by the given fixed point amount.

Parameters:
a_This  This pointer
a_Amount  Fixed point amount to move right with
If you need movement to the left just give a negative amount.

void SoCameraSetFarAndNearPlaneClippingEnable SoCamera   a_This,
bool    a_Enable
 

Enables or disables clipping of polygons against the far and near planes.

Parameters:
a_This  This pointer
a_Enable  true to enable, false to disable
By default far and near plane clipping is enabled. However, if you know that the mesh you are about to render is fully in between those two planes (and hence doesn't need clipping) you should disable this clipping to get a speedup.

void SoCameraSetFrustumSidePlanesClippingEnable SoCamera   a_This,
bool    a_Enable
 

\ Enables or disables clipping of polygons against the frustum side planes.

Parameters:
a_This  This pointer
a_Enable  true to enable, false to disable
By default frustum side plane clipping is enabled. However, if you know that the mesh you are about to render is fully in between those four planes (and hence doesn't need clipping) you should disable this clipping to get a speedup.

void SoCameraSetPitch SoCamera   a_This,
s32    a_Angle
 

Sets the pitch of the camera. A full circle is 256 degrees.

Parameters:
a_This  This pointer
a_Angle  Angle

void SoCameraSetRoll SoCamera   a_This,
s32    a_Angle
 

Sets the roll of the camera. A full circle is 256 degrees.

Parameters:
a_This  This pointer
a_Angle  Angle

void SoCameraSetTranslation SoCamera   a_This,
sofixedpoint    a_X,
sofixedpoint    a_Y,
sofixedpoint    a_Z
 

Sets the translate of the camera.

Parameters:
a_This  This pointer
a_X  Fixed point X-part of the translate
a_Y  Fixed point Y-part of the translate
a_Z  Fixed point Z-part of the translate

void SoCameraSetYaw SoCamera   a_This,
s32    a_Angle
 

Sets the yaw of the camera. A full circle is 256 degrees.

Parameters:
a_This  This pointer
a_Angle  Angle

void SoCameraUp SoCamera   a_This,
sofixedpoint    a_Amount
 

Moves the camera up by the given fixed point amount.

Parameters:
a_This  This pointer
a_Amount  Fixed point amount to move up with
If you need downwards movement just give a negative amount.


Copyright 2002 by the SGADE authors. See SoLicense.h or Visit the SGADE page for more information.