Jo Engine
2024.04.28
Jo Sega Saturn Engine
|
Jo Engine 3D basics. More...
Go to the source code of this file.
Data Structures | |
struct | jo_camera |
Camera structure. More... | |
struct | jo_3d_quad |
Quadrilateral shape structure. More... | |
struct | jo_3d_mesh |
Mesh structure. More... | |
union | jo_camera.__unnamed__ |
union | jo_camera.__unnamed__ |
Macros | |
#define | JO_3D_PLANE_VERTICES(SIZE) |
Plane vertice table. More... | |
#define | JO_3D_TRIANGLE_VERTICES(SIZE) |
Triangle vertice table. More... | |
#define | JO_3D_CUBE_VERTICES(SIZE) |
Cube vertice table. More... | |
Typedefs | |
typedef jo_pos3D | jo_vertice |
Vertice structure. More... | |
Functions | |
bool | jo_3d_create_sprite_quad (const int sprite_id) |
static __jo_force_inline void | jo_3d_camera_set_viewpoint (jo_camera *const cam, const int x, const int y, const int z) |
Set the viewpoint of the camera (where the cameraman is) More... | |
static __jo_force_inline void | jo_3d_camera_set_target (jo_camera *const cam, const int x, const int y, const int z) |
Set the target of the camera (where the scene is located) More... | |
static __jo_force_inline void | jo_3d_camera_set_z_angle (jo_camera *const cam, const int angle) |
Set the angle of the camera. More... | |
static __jo_force_inline void | jo_3d_camera_init (jo_camera *const cam) |
Initialize the camera with default values. More... | |
static __jo_force_inline void | jo_3d_camera_look_at (jo_camera *const cam) |
look at the camera More... | |
static __jo_force_inline unsigned int | jo_3d_get_polygon_count (void) |
Get polygon count (visible and not visible) More... | |
static __jo_force_inline unsigned int | jo_3d_get_vertices_count (void) |
Get vertice count. More... | |
static __jo_force_inline unsigned int | jo_3d_get_displayed_polygon_count (void) |
Get displayed polygon count. More... | |
jo_3d_mesh * | jo_3d_create_mesh_from_vertices_and_normals (const unsigned int quad_count, jo_vertice *const vertices, jo_vector *const normals) |
Create a mesh programmatically from vertices. More... | |
static __jo_force_inline jo_3d_mesh * | jo_3d_create_mesh_from_vertices (const unsigned int quad_count, jo_vertice *const vertices) |
Create a mesh programmatically from vertices. More... | |
static __jo_force_inline jo_3d_mesh * | jo_3d_create_mesh (const unsigned int quad_count) |
Create a mesh programmatically from vertices. More... | |
void | jo_3d_free_mesh (const jo_3d_mesh *const mesh) |
Free a mesh created with jo_3d_create_mesh() More... | |
void | jo_3d_create_plane (jo_3d_quad *const quad, jo_vertice *const vertices) |
Create a four vertices polygon (Quadrilateral shape) More... | |
void | jo_3d_create_cube (jo_3d_quad *array, jo_vertice *const vertices) |
Create a cube. More... | |
void | jo_3d_create_triangle (jo_3d_quad *const quad, jo_vertice *const vertices) |
Create a triangle. More... | |
static __jo_force_inline jo_3d_quad * | jo_3d_get_sprite_quad (const int sprite_id) |
Get sprite quad. More... | |
void | jo_3d_free_sprite_quad (const int sprite_id) |
Delete sprite quad. More... | |
void | jo_3d_set_mesh_polygon_texture (jo_3d_mesh *const mesh, const int sprite_id, const unsigned int index) |
Set a texture on one polygon on the mesh. More... | |
void | jo_3d_set_mesh_texture (jo_3d_mesh *const mesh, const int sprite_id) |
Set a texture on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_texture (jo_3d_quad *const quad, const int sprite_id) |
Set a texture on the quadrilateral. More... | |
void | jo_3d_set_mesh_polygon_wireframe (jo_3d_mesh *const mesh, const unsigned int index, bool wireframe) |
Set wireframe mode on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_mesh_polygon_palette (jo_3d_mesh *const mesh, const int palette_id, const unsigned int index) |
Set a palette on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_mesh_palette (jo_3d_mesh *const mesh, const int palette_id) |
Set a palette on one polygon on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_palette (jo_3d_quad *const quad, const int palette_id) |
Set a palette on the quadrilateral. More... | |
static __jo_force_inline bool | jo_3d_set_sprite_palette (const int sprite_id, const int palette_id) |
Set a palette on a sprite (3D) More... | |
static __jo_force_inline void | jo_3d_set_mesh_vertice (jo_3d_mesh *const mesh, const jo_fixed x, const jo_fixed y, const jo_fixed z, const unsigned int index) |
Set vertice position in mesh. More... | |
static __jo_force_inline void | jo_3d_set_mesh_normal (jo_3d_mesh *const mesh, const jo_fixed x, const jo_fixed y, const jo_fixed z, const unsigned int index) |
Set quad normal in mesh. More... | |
static __jo_force_inline void | jo_3d_light (const int x, const int y, const int z) |
Use a light source. More... | |
void | jo_3d_set_mesh_polygon_light (jo_3d_mesh *const mesh, const bool enabled, const unsigned int index) |
Enable/Disable light on one polygon on the mesh. More... | |
void | jo_3d_set_mesh_light (jo_3d_mesh *const mesh, const bool enabled) |
Enable/Disable light on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_light (jo_3d_quad *const quad, const bool enabled) |
Enable/Disable light on the quad. More... | |
void | jo_3d_set_mesh_polygon_transparency (jo_3d_mesh *const mesh, const bool enabled, const unsigned int index) |
Enable/Disable transparency on one polygon on the mesh. More... | |
void | jo_3d_set_mesh_transparency (jo_3d_mesh *const mesh, const bool enabled) |
Enable/Disable transparency on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_transparency (jo_3d_quad *const quad, const bool enabled) |
Enable/Disable transparency on the quadrilateral. More... | |
void | jo_3d_set_mesh_polygon_screen_doors (jo_3d_mesh *const mesh, const bool enabled, const unsigned int index) |
Enable/Disable screen doors transparency on one polygon on the mesh. More... | |
void | jo_3d_set_mesh_screen_doors (jo_3d_mesh *const mesh, const bool enabled) |
Enable/Disable screen doors transparency on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_screen_doors (jo_3d_quad *const quad, const bool enabled) |
Enable/Disable screen doors transparency on the quad. More... | |
void | jo_3d_set_mesh_polygon_color_ex (jo_3d_mesh *const mesh, const jo_color color, const unsigned int index, bool wireframe) |
Set the color on one polygon on the mesh with wireframe option. More... | |
static __jo_force_inline void | jo_3d_set_mesh_polygon_color (jo_3d_mesh *const mesh, const jo_color color, const unsigned int index) |
Set the color on one polygon on the mesh. More... | |
void | jo_3d_set_mesh_color (jo_3d_mesh *const mesh, const jo_color color) |
Set the color on the mesh. More... | |
static __jo_force_inline void | jo_3d_set_color (jo_3d_quad *const quad, const jo_color color) |
Set the color on the quadrilateral. More... | |
static __jo_force_inline void | jo_3d_push_matrix (void) |
Push 3D matrix. More... | |
static __jo_force_inline void | jo_3d_pop_matrix (void) |
Pop 3D matrix. More... | |
static __jo_force_inline void | jo_3d_rotate_matrix (short x, short y, short z) |
Rotate 3D matrix using degree. More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_x (short x) |
Rotate 3D matrix using degree (X axis) More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_y (short y) |
Rotate 3D matrix using degree (Y axis) More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_z (short z) |
Rotate 3D matrix using degree (Z axis) More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_rad (float x, float y, float z) |
Rotate 3D matrix using radian. More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_rad_x (float x) |
Rotate 3D matrix using radian (X axis) More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_rad_y (float y) |
Rotate 3D matrix using radian (Y axis) More... | |
static __jo_force_inline void | jo_3d_rotate_matrix_rad_z (float z) |
Rotate 3D matrix using radian (Z axis) More... | |
static __jo_force_inline void | jo_3d_translate_matrixf (float x, float y, float z) |
Translate 3D matrix (using floating numbers) More... | |
static __jo_force_inline void | jo_3d_translate_matrix_fixed (jo_fixed x, jo_fixed y, jo_fixed z) |
Translate 3D matrix. More... | |
static __jo_force_inline void | jo_3d_translate_matrix (int x, int y, int z) |
Translate 3D matrix. More... | |
static __jo_force_inline void | jo_3d_translate_matrix_x (int x) |
Translate 3D matrix (X axis) More... | |
static __jo_force_inline void | jo_3d_translate_matrix_y (int y) |
Translate 3D matrix (Y axis) More... | |
static __jo_force_inline void | jo_3d_translate_matrix_z (int z) |
Translate 3D matrix (Z axis) More... | |
static __jo_force_inline void | jo_3d_draw (jo_3d_quad *const quad) |
Draw a quadrilateral. More... | |
static __jo_force_inline void | jo_3d_mesh_draw (jo_3d_mesh *const mesh) |
Draw a mesh. More... | |
static __jo_force_inline unsigned int | jo_3d_get_mesh_polygon_count (jo_3d_mesh *const mesh) |
Get polygon count on the mesh. More... | |
static __jo_force_inline void | __jo_poylgon_draw_iterator (jo_node *node) |
Internal usage for polygon display. More... | |
static __jo_force_inline void | jo_3d_draw_list (jo_list *const list) |
Draw a list of quadrilateral. More... | |
static __jo_force_inline void | jo_3d_draw_array (jo_3d_quad *const array, int array_size) |
Draw an array of quadrilateral. More... | |
static __jo_force_inline bool | jo_3d_draw_sprite (const int sprite_id) |
Draw a sprite. More... | |
static __jo_force_inline void | jo_3d_draw_sprite_at (const int sprite_id, const int x, const int y, const int z) |
Draw a sprite. More... | |
static __jo_force_inline void | jo_3d_draw_billboard (const int sprite_id, const int x, const int y, const int z) |
Draw billboard. More... | |
static __jo_force_inline void | jo_3d_draw_scaled_billboard (const int sprite_id, const int x, const int y, const int z, const int scale) |
Draw billboard with a specific scale. More... | |
static __jo_force_inline void | jo_3d_set_scalef (const float x, const float y, const float z) |
Change scale using floating number. More... | |
static __jo_force_inline void | jo_3d_set_scale (const int x, const int y, const int z) |
Change scale. More... | |
static __jo_force_inline void | jo_3d_set_scale_fixed (const jo_fixed x, const jo_fixed y, const jo_fixed z) |
Change scale using fixed number. More... | |
static __jo_force_inline void | jo_3d_restore_scale (void) |
Restore default scale for every 3d model displayed after this call. More... | |
static __jo_force_inline bool | jo_3d_window (const int left, const int top, const int right, const int bottom, const int z_limit, const int center_x, const int center_y) |
Sets up a window region on the projection surface. More... | |
static __jo_force_inline void | jo_3d_perspective_angle (const int angle) |
Set the perspective angle. More... | |
static __jo_force_inline void | jo_3d_display_level (const unsigned short level) |
Set the display level of the viewing volume. More... | |
Variables | |
jo_3d_quad * | __jo_sprite_quad [JO_MAX_SPRITE] |
Sprite quads (internal engine usage) More... | |
Jo Engine 3D basics.
struct jo_camera |
union jo_camera.__unnamed__ |
Data Fields | ||
---|---|---|
FIXED | viewpoint[XYZ] | |
jo_pos3D | viewpoint_pos |
union jo_camera.__unnamed__ |
Data Fields | ||
---|---|---|
FIXED | target[XYZ] | |
jo_pos3D | target_pos |
#define JO_3D_CUBE_VERTICES | ( | SIZE | ) |
Cube vertice table.
#define JO_3D_PLANE_VERTICES | ( | SIZE | ) |
Plane vertice table.
#define JO_3D_TRIANGLE_VERTICES | ( | SIZE | ) |
Triangle vertice table.
typedef jo_pos3D jo_vertice |
Vertice structure.
|
static |
Internal usage for polygon display.
|
static |
Initialize the camera with default values.
cam | Pointer to a camera struct |
|
static |
look at the camera
cam | Pointer to a camera struct |
|
static |
Set the target of the camera (where the scene is located)
cam | Pointer to a camera struct |
x | X coord |
y | Y coord |
z | Z coord |
|
static |
Set the viewpoint of the camera (where the cameraman is)
cam | Pointer to a camera struct |
x | X coord |
y | Y coord |
z | Z coord |
|
static |
Set the angle of the camera.
cam | Pointer to a camera struct |
angle | Z-angle in degree |
void jo_3d_create_cube | ( | jo_3d_quad * | array, |
jo_vertice *const | vertices | ||
) |
Create a cube.
array | Address to a 6 jo_3d_quad allocated struct |
vertices | Vertices coords (table of 24 (6x4) jo_vertice) |
|
static |
Create a mesh programmatically from vertices.
quad_count | Quad count (Quad count == Polygon count) |
|
static |
Create a mesh programmatically from vertices.
quad_count | Quad count (Quad count == Polygon count) |
vertices | An array of jo_vertice (4 * quad_count) |
jo_3d_mesh* jo_3d_create_mesh_from_vertices_and_normals | ( | const unsigned int | quad_count, |
jo_vertice *const | vertices, | ||
jo_vector *const | normals | ||
) |
Create a mesh programmatically from vertices.
quad_count | Quad count (Quad count == Polygon count) |
vertices | An array of jo_vertice (4 * quad_count) |
normals | An array of jo_vector (quad_count) |
void jo_3d_create_plane | ( | jo_3d_quad *const | quad, |
jo_vertice *const | vertices | ||
) |
Create a four vertices polygon (Quadrilateral shape)
quad | Address to a jo_3d_quad allocated struct |
vertices | Vertices coords (table of 4 jo_vertice) |
bool jo_3d_create_sprite_quad | ( | const int | sprite_id | ) |
void jo_3d_create_triangle | ( | jo_3d_quad *const | quad, |
jo_vertice *const | vertices | ||
) |
Create a triangle.
quad | Address to a jo_3d_quad allocated struct |
vertices | Vertices coords (table of 3 jo_vertice) |
|
static |
Set the display level of the viewing volume.
level | Distance from the viewpoint and the projection surface |
|
static |
Draw a quadrilateral.
quad | Address to a jo_3d_quad allocated struct |
|
static |
Draw an array of quadrilateral.
array | Array of quadrilateral |
array_size | Size of the array |
|
static |
Draw billboard.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
|
static |
Draw a list of quadrilateral.
list | List of quadrilateral |
|
static |
Draw billboard with a specific scale.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
scale | Scale |
|
static |
Draw a sprite.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
|
static |
Draw a sprite.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
x | X coordinate |
y | Y coordinate |
z | Z coordinate |
void jo_3d_free_mesh | ( | const jo_3d_mesh *const | mesh | ) |
Free a mesh created with jo_3d_create_mesh()
mesh | The mesh to free |
void jo_3d_free_sprite_quad | ( | const int | sprite_id | ) |
Delete sprite quad.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
|
static |
Get displayed polygon count.
|
static |
Get polygon count on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
|
static |
Get polygon count (visible and not visible)
|
static |
Get sprite quad.
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
|
static |
Get vertice count.
|
static |
Use a light source.
x | X position of the light source |
y | Y position of the light source |
z | Z position of the light source |
|
static |
Draw a mesh.
mesh | Address to a jo_3d_mesh allocated struct |
|
static |
Set the perspective angle.
angle | Angle in degree (from 21 to 159) |
|
static |
Pop 3D matrix.
|
static |
Push 3D matrix.
|
static |
Restore default scale for every 3d model displayed after this call.
|
static |
Rotate 3D matrix using degree.
x | X Angle in degree |
y | Y Angle in degree |
z | Z Angle in degree |
|
static |
Rotate 3D matrix using radian.
x | X Angle in radian |
y | Y Angle in radian |
z | Z Angle in radian |
|
static |
Rotate 3D matrix using radian (X axis)
x | X Angle in radian |
|
static |
Rotate 3D matrix using radian (Y axis)
y | Y Angle in radian |
|
static |
Rotate 3D matrix using radian (Z axis)
z | Z Angle in radian |
|
static |
Rotate 3D matrix using degree (X axis)
x | X Angle in degree |
|
static |
Rotate 3D matrix using degree (Y axis)
y | Y Angle in degree |
|
static |
Rotate 3D matrix using degree (Z axis)
z | Z Angle in degree |
|
static |
Set the color on the quadrilateral.
quad | Address to a jo_3d_quad allocated struct |
color | Color |
|
static |
Enable/Disable light on the quad.
quad | Address to a jo_3d_quad allocated struct |
enabled | true to enable light support |
void jo_3d_set_mesh_color | ( | jo_3d_mesh *const | mesh, |
const jo_color | color | ||
) |
Set the color on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
color | Color |
void jo_3d_set_mesh_light | ( | jo_3d_mesh *const | mesh, |
const bool | enabled | ||
) |
Enable/Disable light on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable light support |
|
static |
Set quad normal in mesh.
mesh | Address to a jo_3d_mesh allocated struct |
x | X position |
y | Y position |
z | Z position |
index | quad index on the mesh |
|
static |
Set a palette on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
palette_id | Palette id from jo_create_palette() |
|
static |
Set the color on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
color | Color |
index | polygon index on the mesh |
void jo_3d_set_mesh_polygon_color_ex | ( | jo_3d_mesh *const | mesh, |
const jo_color | color, | ||
const unsigned int | index, | ||
bool | wireframe | ||
) |
Set the color on one polygon on the mesh with wireframe option.
mesh | Address to a jo_3d_mesh allocated struct |
color | Color |
index | polygon index on the mesh |
wireframe | True to display only the edge of polygons |
void jo_3d_set_mesh_polygon_light | ( | jo_3d_mesh *const | mesh, |
const bool | enabled, | ||
const unsigned int | index | ||
) |
Enable/Disable light on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable light support |
index | polygon index on the mesh |
|
static |
Set a palette on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
index | polygon index on the mesh |
palette_id | Palette id from jo_create_palette() |
void jo_3d_set_mesh_polygon_screen_doors | ( | jo_3d_mesh *const | mesh, |
const bool | enabled, | ||
const unsigned int | index | ||
) |
Enable/Disable screen doors transparency on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable screen doors transparency |
index | polygon index on the mesh |
void jo_3d_set_mesh_polygon_texture | ( | jo_3d_mesh *const | mesh, |
const int | sprite_id, | ||
const unsigned int | index | ||
) |
Set a texture on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
sprite_id | Sprite ID |
index | polygon index on the mesh |
void jo_3d_set_mesh_polygon_transparency | ( | jo_3d_mesh *const | mesh, |
const bool | enabled, | ||
const unsigned int | index | ||
) |
Enable/Disable transparency on one polygon on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable transparency |
index | polygon index on the mesh |
void jo_3d_set_mesh_polygon_wireframe | ( | jo_3d_mesh *const | mesh, |
const unsigned int | index, | ||
bool | wireframe | ||
) |
Set wireframe mode on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
index | polygon index on the mesh |
wireframe | True to enable wireframe mode |
void jo_3d_set_mesh_screen_doors | ( | jo_3d_mesh *const | mesh, |
const bool | enabled | ||
) |
Enable/Disable screen doors transparency on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable screen doors transparency |
void jo_3d_set_mesh_texture | ( | jo_3d_mesh *const | mesh, |
const int | sprite_id | ||
) |
Set a texture on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
sprite_id | Sprite ID |
void jo_3d_set_mesh_transparency | ( | jo_3d_mesh *const | mesh, |
const bool | enabled | ||
) |
Enable/Disable transparency on the mesh.
mesh | Address to a jo_3d_mesh allocated struct |
enabled | true to enable transparency |
|
static |
Set vertice position in mesh.
mesh | Address to a jo_3d_mesh allocated struct |
x | X position |
y | Y position |
z | Z position |
index | vertice index on the mesh (4 vertices for each quad) |
|
static |
Set a palette on the quadrilateral.
quad | Address to a jo_3d_quad allocated struct |
palette_id | Palette id from jo_create_palette() |
|
static |
Change scale.
x | X Scale |
y | Y Scale |
z | Z Scale |
|
static |
Change scale using fixed number.
x | X Scale |
y | Y Scale |
z | Z Scale |
|
static |
Change scale using floating number.
x | X Scale |
y | Y Scale |
z | Z Scale |
|
static |
Enable/Disable screen doors transparency on the quad.
quad | Address to a jo_3d_quad allocated struct |
enabled | true to enable screen doors transparency |
|
static |
Set a palette on a sprite (3D)
sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
palette_id | Palette id from jo_create_palette() |
|
static |
Set a texture on the quadrilateral.
quad | Address to a jo_3d_quad allocated struct |
sprite_id | Sprite ID |
|
static |
Enable/Disable transparency on the quadrilateral.
quad | Address to a jo_3d_quad allocated struct |
enabled | true to enable transparency |
|
static |
Translate 3D matrix.
x | X Position |
y | Y Position |
z | Z Position |
|
static |
Translate 3D matrix.
x | X Position |
y | Y Position |
z | Z Position |
|
static |
Translate 3D matrix (X axis)
x | X Position |
|
static |
Translate 3D matrix (Y axis)
y | Y Position |
|
static |
Translate 3D matrix (Z axis)
z | Z Position |
|
static |
Translate 3D matrix (using floating numbers)
x | X Position |
y | Y Position |
z | Z Position |
|
static |
Sets up a window region on the projection surface.
left | |
top | |
right | |
bottom | |
z_limit | |
center_x | |
center_y |
jo_3d_quad* __jo_sprite_quad[JO_MAX_SPRITE] |
Sprite quads (internal engine usage)