Rendering of 3D objects.
#include <srl_scene3d.hpp>
Draw functions | |
static void | DrawSmoothMesh (Types::SmoothMesh &mesh, Types::Vector3D &light) |
Draw SRL::Types::SmoothMesh. | |
static bool | DrawMesh (Types::Mesh &mesh, const bool slaveOnly=false) |
Draw SRL::Types::Mesh. | |
static bool | DrawOrthographicMesh (Types::Mesh &mesh, uint16_t attribute) |
Draw SRL::Types::Mesh with orthographic projection. | |
Light handling functions | |
static void | SetDirectionalLight (const Types::Vector3D &direction) |
Set directional light source. | |
static void | LightInitGouraudTable (uint32_t gouraudRamOffset, uint8_t *vertexCalculationBuffer, Types::HighColor *tableStorage, uint32_t maxPolygons) |
Initialize gouraud table for light calculation with SRL::Scene3D::DrawSmoothMesh. | |
static void | LightSetGouraudTable (Types::HighColor table[32]) |
Set custom light gouraud table. | |
static void | LightSetGouraudColor (const SRL::Types::HighColor color) |
Set gouraud color of light source. | |
static void | LightSetColor (const SRL::Types::HighColor color) |
Set color of the flat light source (UseLight option) | |
static void | LightCopyGouraudTable () |
Copies gouraud table calculated by the library to VRAM. | |
Camera functions | |
static bool | IsOnScreen (const SRL::Types::Vector3D &point, const SRL::Types::Fxp size) |
Check if point/circle area is on screen. | |
static void | LookAt (const SRL::Types::Vector3D &camera, const SRL::Types::Vector3D &target, const SRL::Types::Angle roll) |
Make camera look at certain point in the 3D scene. | |
static SRL::Types::Fxp | ProjectToScreen (const SRL::Types::Vector3D &position, SRL::Types::Vector2D *result) |
Projects 3D point onto a screen from current transformation matrix. | |
static void | SetDepthDisplayLevel (const uint16_t level) |
Set value indicating how far in front of the projection surface to actually project. | |
static void | SetPerspective (Types::Angle angle) |
Set angle of the perspective projection. | |
static bool | SetWindow (Types::Vector2D &topLeft, Types::Vector2D &bottomRight, Types::Vector2D ¢er, Types::Fxp &depthLimit) |
Set window limiting the display of sprites and polygons. | |
Transformation matrix operations | |
static void | PushMatrix () |
Push current matrix onto the matrix stack. | |
static void | PushIdentityMatrix () |
Push current matrix onto the matrix stack and set identity matrix as current. | |
static void | PopMatrix () |
Pop matrix from top of the stack and set it as current. | |
static void | LoadIdentity () |
Replaces current matrix with identity matrix. | |
static void | IdentityTranslationMatrix () |
Sets identity translation matrix. | |
static void | IdentityRotationMatrix () |
Sets identity rotation matrix. | |
static void | SetMatrix (SRL::Types::Matrix &matrix) |
Set current matrix. | |
static void | GetMatrix (SRL::Types::Matrix *result) |
Get current matrix. | |
static void | InvertMatrix () |
Inverts current matrix. | |
static void | TransposeMatrix () |
Transpose current matrix (zero movement in parallel direction) | |
static void | MultiplyMatrix (SRL::Types::Matrix &matrix) |
Multiply current matrix by specified matrix. | |
static void | Rotate (const SRL::Types::Vector3D &axis, SRL::Types::Angle angle) |
Rotate current matrix around arbitrary axis by specific angle. | |
static void | RotateX (SRL::Types::Angle angle) |
Rotate current matrix around X axis by specific angle. | |
static void | RotateX (SRL::Types::Fxp sin, SRL::Types::Fxp cos) |
Rotate current matrix around X axis by specific sinus and cosine values. | |
static void | RotateY (SRL::Types::Angle angle) |
Rotate current matrix around Y axis by specific angle. | |
static void | RotateY (SRL::Types::Fxp sin, SRL::Types::Fxp cos) |
Rotate current matrix around Y axis by specific sinus and cosine values. | |
static void | RotateZ (SRL::Types::Angle angle) |
Rotate current matrix around Z axis by specific angle. | |
static void | RotateZ (SRL::Types::Fxp sin, SRL::Types::Fxp cos) |
Rotate current matrix around X axis by specific sinus and cosine values. | |
static void | Scale (SRL::Types::Fxp x, SRL::Types::Fxp y, SRL::Types::Fxp z) |
Scale current transformation matrix. | |
static void | Scale (const SRL::Types::Vector3D &scale) |
Scale current transformation matrix. | |
static void | Scale (SRL::Types::Fxp scale) |
Scale current transformation matrix. | |
static void | Translate (SRL::Types::Fxp x, SRL::Types::Fxp y, SRL::Types::Fxp z) |
Translate current transformation matrix. | |
static void | Translate (const SRL::Types::Vector3D &delta) |
Translate current transformation matrix. | |
static SRL::Types::Vector3D | TransformPoint (const SRL::Types::Vector3D &point) |
Transforms point by current transformation matrix. | |
static SRL::Types::Vector3D | TransformVector (const SRL::Types::Vector3D &point) |
Transforms direction vector by current transformation matrix. | |
|
inlinestatic |
Draw SRL::Types::Mesh.
mesh | SRL::Types::Mesh to draw |
slaveOnly | Value indicates whether processing of the SRL::Types::Mesh should be handled only on the slave CPU |
|
inlinestatic |
Draw SRL::Types::Mesh with orthographic projection.
mesh | SRL::Types::Mesh to draw |
attribute | Indicates an attribute in the SRL::Types::Mesh that will be shared by all polygons. If set to 0, each polygon is displayed using the data at the beginning of the attribute table, otherwise specified attribute data will be displayed. |
|
inlinestatic |
Draw SRL::Types::SmoothMesh.
mesh | SRL::Types::SmoothMesh to draw |
light | Light direction unit vector (This is independent of the SRL::Scene3D::SetDirectionalLight) |
|
inlinestatic |
Get current matrix.
result | Transformation matrix |
|
inlinestatic |
Check if point/circle area is on screen.
point | Point to test |
size | Size of the point |
|
inlinestatic |
Copies gouraud table calculated by the library to VRAM.
|
inlinestatic |
Initialize gouraud table for light calculation with SRL::Scene3D::DrawSmoothMesh.
gouraudRamOffset | Relative address to the first entry from which to write light gouraud data in SRL::VDP1::GetGouraudTable(). Using 0 here would mean first entry, 2 is second entry in the table, where each entry is 4 color long. |
vertexCalculationBuffer | Vertex arithmetic work buffer |
tableStorage | Work gouraud table with size of maxPolygons |
maxPolygons | Maximum number of polygons that can be processed by the light calculation |
|
inlinestatic |
Set color of the flat light source (UseLight option)
color | Light source color |
|
inlinestatic |
Set gouraud color of light source.
color | Light source color |
|
inlinestatic |
Set custom light gouraud table.
Table must contain 32 color entries from the darkest color to the brightest.
table | custom light table |
|
inlinestatic |
Make camera look at certain point in the 3D scene.
camera | Camera location |
target | Target point |
roll | Rotation around the line of sight vector |
|
inlinestatic |
Multiply current matrix by specified matrix.
matrix | Matrix to multiply current matrix with |
|
inlinestatic |
Projects 3D point onto a screen from current transformation matrix.
position | Position in world space |
result | Position on screen |
|
inlinestatic |
Rotate current matrix around arbitrary axis by specific angle.
axis | Rotation axis |
angle | Rotation angle |
|
inlinestatic |
Rotate current matrix around X axis by specific angle.
angle | Rotation angle |
|
inlinestatic |
Rotate current matrix around X axis by specific sinus and cosine values.
sin | Sinus value |
cos | Cosine value |
|
inlinestatic |
Rotate current matrix around Y axis by specific angle.
angle | Rotation angle |
|
inlinestatic |
Rotate current matrix around Y axis by specific sinus and cosine values.
sin | Sinus value |
cos | Cosine value |
|
inlinestatic |
Rotate current matrix around Z axis by specific angle.
angle | Rotation angle |
|
inlinestatic |
Rotate current matrix around X axis by specific sinus and cosine values.
sin | Sinus value |
cos | Cosine value |
|
inlinestatic |
Scale current transformation matrix.
scale | Scale factor |
|
inlinestatic |
Scale current transformation matrix.
scale | Scale factor |
|
inlinestatic |
Scale current transformation matrix.
x | Scale factor on X axis |
y | Scale factor on Y axis |
z | Scale factor on Z axis |
|
inlinestatic |
Set value indicating how far in front of the projection surface to actually project.
Function specifies the distance from the forward boundary surface to the rear boundary surface.
level | Display level. See table below for valid parameter values and image above for explanation.
|
|
inlinestatic |
Set directional light source.
direction | Light direction unit vector |
|
inlinestatic |
Set current matrix.
matrix | Transformation matrix |
|
inlinestatic |
Set angle of the perspective projection.
Perspective angle determines the angle corresponding to the width of the screen. In combination with SRL::Scene3D::SetDepthDisplayLevel and SRL::Scene3D::SetWindow projection volume can be completely determined.
angle | Perspective angle (Range 10-160 degrees) |
|
inlinestatic |
Set window limiting the display of sprites and polygons.
There can be two windows on screen at once, sprite clipping can be used to decide whether sprites are displayed inside the window or not.
Depth limit indicates maximal distance to the near projection plane.
Center point can be used to set projection center.
topLeft | Top left point on the screen |
bottomRight | Bottom right point on the screen |
center | 3D projection center (vanishing point) |
depthLimit | Maximal allowed distance from the near projection plane |
|
inlinestatic |
Transforms point by current transformation matrix.
point | Point to transform |
|
inlinestatic |
Transforms direction vector by current transformation matrix.
point | Direction vector to transform |
|
inlinestatic |
Translate current transformation matrix.
delta | Translation delta |
|
inlinestatic |
Translate current transformation matrix.
x | Translation delta on X axis |
y | Translation delta on Y axis |
z | Translation delta on Z axis |