Jo Engine  2023.08.26
Jo Sega Saturn Engine
Data Structures | Macros | Typedefs | Functions | Variables
3d.h File Reference

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_meshjo_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_meshjo_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_meshjo_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_quadjo_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...
 

Detailed Description

Jo Engine 3D basics.

Author
Johannes Fetz
Bug:
No known bugs.
Todo:
Mesh loader, Gouraud shading and advanced 3D processing

Data Structure Documentation

◆ jo_camera

struct jo_camera

Camera structure.

Data Fields
union jo_camera __unnamed__
union jo_camera __unnamed__
ANGLE z_angle

◆ jo_3d_quad

struct jo_3d_quad

Quadrilateral shape structure.

Data Fields
ATTR attribute
PDATA data

◆ jo_3d_mesh

struct jo_3d_mesh

Mesh structure.

Data Fields
PDATA data

◆ jo_camera.__unnamed__

union jo_camera.__unnamed__
Data Fields
FIXED viewpoint[XYZ]
jo_pos3D viewpoint_pos

◆ jo_camera.__unnamed__

union jo_camera.__unnamed__
Data Fields
FIXED target[XYZ]
jo_pos3D target_pos

Macro Definition Documentation

◆ JO_3D_CUBE_VERTICES

#define JO_3D_CUBE_VERTICES (   SIZE)

Cube vertice table.

◆ JO_3D_PLANE_VERTICES

#define JO_3D_PLANE_VERTICES (   SIZE)

Plane vertice table.

◆ JO_3D_TRIANGLE_VERTICES

#define JO_3D_TRIANGLE_VERTICES (   SIZE)

Triangle vertice table.

Typedef Documentation

◆ jo_vertice

Vertice structure.

Function Documentation

◆ __jo_poylgon_draw_iterator()

static __jo_force_inline void __jo_poylgon_draw_iterator ( jo_node node)
static

Internal usage for polygon display.

Warning
Don't use it

◆ jo_3d_camera_init()

static __jo_force_inline void jo_3d_camera_init ( jo_camera *const  cam)
static

Initialize the camera with default values.

Parameters
camPointer to a camera struct

◆ jo_3d_camera_look_at()

static __jo_force_inline void jo_3d_camera_look_at ( jo_camera *const  cam)
static

look at the camera

Parameters
camPointer to a camera struct

◆ jo_3d_camera_set_target()

static __jo_force_inline void jo_3d_camera_set_target ( jo_camera *const  cam,
const int  x,
const int  y,
const int  z 
)
static

Set the target of the camera (where the scene is located)

Parameters
camPointer to a camera struct
xX coord
yY coord
zZ coord

◆ jo_3d_camera_set_viewpoint()

static __jo_force_inline void jo_3d_camera_set_viewpoint ( jo_camera *const  cam,
const int  x,
const int  y,
const int  z 
)
static

Set the viewpoint of the camera (where the cameraman is)

Parameters
camPointer to a camera struct
xX coord
yY coord
zZ coord

◆ jo_3d_camera_set_z_angle()

static __jo_force_inline void jo_3d_camera_set_z_angle ( jo_camera *const  cam,
const int  angle 
)
static

Set the angle of the camera.

Parameters
camPointer to a camera struct
angleZ-angle in degree

◆ jo_3d_create_cube()

void jo_3d_create_cube ( jo_3d_quad array,
jo_vertice *const  vertices 
)

Create a cube.

Parameters
arrayAddress to a 6 jo_3d_quad allocated struct
verticesVertices coords (table of 24 (6x4) jo_vertice)

◆ jo_3d_create_mesh()

static __jo_force_inline jo_3d_mesh* jo_3d_create_mesh ( const unsigned int  quad_count)
static

Create a mesh programmatically from vertices.

Parameters
quad_countQuad count (Quad count == Polygon count)
Returns
The mesh
Remarks
The return type can be casted to (jo_3d_mesh *)

◆ jo_3d_create_mesh_from_vertices()

static __jo_force_inline jo_3d_mesh* jo_3d_create_mesh_from_vertices ( const unsigned int  quad_count,
jo_vertice *const  vertices 
)
static

Create a mesh programmatically from vertices.

Parameters
quad_countQuad count (Quad count == Polygon count)
verticesAn array of jo_vertice (4 * quad_count)
Returns
The mesh
Remarks
The return type can be casted to (jo_3d_mesh *)

◆ jo_3d_create_mesh_from_vertices_and_normals()

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.

Parameters
quad_countQuad count (Quad count == Polygon count)
verticesAn array of jo_vertice (4 * quad_count)
normalsAn array of jo_vector (quad_count)
Returns
The mesh
Remarks
The return type can be casted to (jo_3d_mesh *)

◆ jo_3d_create_plane()

void jo_3d_create_plane ( jo_3d_quad *const  quad,
jo_vertice *const  vertices 
)

Create a four vertices polygon (Quadrilateral shape)

Parameters
quadAddress to a jo_3d_quad allocated struct
verticesVertices coords (table of 4 jo_vertice)

◆ jo_3d_create_sprite_quad()

bool jo_3d_create_sprite_quad ( const int  sprite_id)

◆ jo_3d_create_triangle()

void jo_3d_create_triangle ( jo_3d_quad *const  quad,
jo_vertice *const  vertices 
)

Create a triangle.

Parameters
quadAddress to a jo_3d_quad allocated struct
verticesVertices coords (table of 3 jo_vertice)

◆ jo_3d_display_level()

static __jo_force_inline void jo_3d_display_level ( const unsigned short  level)
static

Set the display level of the viewing volume.

Parameters
levelDistance from the viewpoint and the projection surface

◆ jo_3d_draw()

static __jo_force_inline void jo_3d_draw ( jo_3d_quad *const  quad)
static

Draw a quadrilateral.

Parameters
quadAddress to a jo_3d_quad allocated struct

◆ jo_3d_draw_array()

static __jo_force_inline void jo_3d_draw_array ( jo_3d_quad *const  array,
int  array_size 
)
static

Draw an array of quadrilateral.

Parameters
arrayArray of quadrilateral
array_sizeSize of the array

◆ jo_3d_draw_billboard()

static __jo_force_inline void jo_3d_draw_billboard ( const int  sprite_id,
const int  x,
const int  y,
const int  z 
)
static

Draw billboard.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
xX coordinate
yY coordinate
zZ coordinate

◆ jo_3d_draw_list()

static __jo_force_inline void jo_3d_draw_list ( jo_list *const  list)
static

Draw a list of quadrilateral.

Parameters
listList of quadrilateral

◆ jo_3d_draw_scaled_billboard()

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 
)
static

Draw billboard with a specific scale.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
xX coordinate
yY coordinate
zZ coordinate
scaleScale

◆ jo_3d_draw_sprite()

static __jo_force_inline bool jo_3d_draw_sprite ( const int  sprite_id)
static

Draw a sprite.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
Returns
true if succeeded otherwise false

◆ jo_3d_draw_sprite_at()

static __jo_force_inline void jo_3d_draw_sprite_at ( const int  sprite_id,
const int  x,
const int  y,
const int  z 
)
static

Draw a sprite.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
xX coordinate
yY coordinate
zZ coordinate

◆ jo_3d_free_mesh()

void jo_3d_free_mesh ( const jo_3d_mesh *const  mesh)

Free a mesh created with jo_3d_create_mesh()

Parameters
meshThe mesh to free

◆ jo_3d_free_sprite_quad()

void jo_3d_free_sprite_quad ( const int  sprite_id)

Delete sprite quad.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()

◆ jo_3d_get_displayed_polygon_count()

static __jo_force_inline unsigned int jo_3d_get_displayed_polygon_count ( void  )
static

Get displayed polygon count.

Warning
This function must be called after display polygons
Returns
polygon count

◆ jo_3d_get_mesh_polygon_count()

static __jo_force_inline unsigned int jo_3d_get_mesh_polygon_count ( jo_3d_mesh *const  mesh)
static

Get polygon count on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
Returns
polygon count

◆ jo_3d_get_polygon_count()

static __jo_force_inline unsigned int jo_3d_get_polygon_count ( void  )
static

Get polygon count (visible and not visible)

Warning
This function must be called after display polygons
Returns
polygon count

◆ jo_3d_get_sprite_quad()

static __jo_force_inline jo_3d_quad* jo_3d_get_sprite_quad ( const int  sprite_id)
static

Get sprite quad.

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
Returns
Sprite quad

◆ jo_3d_get_vertices_count()

static __jo_force_inline unsigned int jo_3d_get_vertices_count ( void  )
static

Get vertice count.

Warning
This function must be called after display polygons
Returns
vertice count

◆ jo_3d_light()

static __jo_force_inline void jo_3d_light ( const int  x,
const int  y,
const int  z 
)
static

Use a light source.

Parameters
xX position of the light source
yY position of the light source
zZ position of the light source

◆ jo_3d_mesh_draw()

static __jo_force_inline void jo_3d_mesh_draw ( jo_3d_mesh *const  mesh)
static

Draw a mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct

◆ jo_3d_perspective_angle()

static __jo_force_inline void jo_3d_perspective_angle ( const int  angle)
static

Set the perspective angle.

Parameters
angleAngle in degree (from 21 to 159)

◆ jo_3d_pop_matrix()

static __jo_force_inline void jo_3d_pop_matrix ( void  )
static

Pop 3D matrix.

◆ jo_3d_push_matrix()

static __jo_force_inline void jo_3d_push_matrix ( void  )
static

Push 3D matrix.

◆ jo_3d_restore_scale()

static __jo_force_inline void jo_3d_restore_scale ( void  )
static

Restore default scale for every 3d model displayed after this call.

◆ jo_3d_rotate_matrix()

static __jo_force_inline void jo_3d_rotate_matrix ( short  x,
short  y,
short  z 
)
static

Rotate 3D matrix using degree.

Parameters
xX Angle in degree
yY Angle in degree
zZ Angle in degree

◆ jo_3d_rotate_matrix_rad()

static __jo_force_inline void jo_3d_rotate_matrix_rad ( float  x,
float  y,
float  z 
)
static

Rotate 3D matrix using radian.

Parameters
xX Angle in radian
yY Angle in radian
zZ Angle in radian

◆ jo_3d_rotate_matrix_rad_x()

static __jo_force_inline void jo_3d_rotate_matrix_rad_x ( float  x)
static

Rotate 3D matrix using radian (X axis)

Parameters
xX Angle in radian

◆ jo_3d_rotate_matrix_rad_y()

static __jo_force_inline void jo_3d_rotate_matrix_rad_y ( float  y)
static

Rotate 3D matrix using radian (Y axis)

Parameters
yY Angle in radian

◆ jo_3d_rotate_matrix_rad_z()

static __jo_force_inline void jo_3d_rotate_matrix_rad_z ( float  z)
static

Rotate 3D matrix using radian (Z axis)

Parameters
zZ Angle in radian

◆ jo_3d_rotate_matrix_x()

static __jo_force_inline void jo_3d_rotate_matrix_x ( short  x)
static

Rotate 3D matrix using degree (X axis)

Parameters
xX Angle in degree

◆ jo_3d_rotate_matrix_y()

static __jo_force_inline void jo_3d_rotate_matrix_y ( short  y)
static

Rotate 3D matrix using degree (Y axis)

Parameters
yY Angle in degree

◆ jo_3d_rotate_matrix_z()

static __jo_force_inline void jo_3d_rotate_matrix_z ( short  z)
static

Rotate 3D matrix using degree (Z axis)

Parameters
zZ Angle in degree

◆ jo_3d_set_color()

static __jo_force_inline void jo_3d_set_color ( jo_3d_quad *const  quad,
const jo_color  color 
)
static

Set the color on the quadrilateral.

Parameters
quadAddress to a jo_3d_quad allocated struct
colorColor

◆ jo_3d_set_light()

static __jo_force_inline void jo_3d_set_light ( jo_3d_quad *const  quad,
const bool  enabled 
)
static

Enable/Disable light on the quad.

Parameters
quadAddress to a jo_3d_quad allocated struct
enabledtrue to enable light support

◆ jo_3d_set_mesh_color()

void jo_3d_set_mesh_color ( jo_3d_mesh *const  mesh,
const jo_color  color 
)

Set the color on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
colorColor

◆ jo_3d_set_mesh_light()

void jo_3d_set_mesh_light ( jo_3d_mesh *const  mesh,
const bool  enabled 
)

Enable/Disable light on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable light support

◆ jo_3d_set_mesh_normal()

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 
)
static

Set quad normal in mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
xX position
yY position
zZ position
indexquad index on the mesh

◆ jo_3d_set_mesh_palette()

static __jo_force_inline void jo_3d_set_mesh_palette ( jo_3d_mesh *const  mesh,
const int  palette_id 
)
static

Set a palette on one polygon on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
palette_idPalette id from jo_create_palette()

◆ jo_3d_set_mesh_polygon_color()

static __jo_force_inline void jo_3d_set_mesh_polygon_color ( jo_3d_mesh *const  mesh,
const jo_color  color,
const unsigned int  index 
)
static

Set the color on one polygon on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
colorColor
indexpolygon index on the mesh

◆ jo_3d_set_mesh_polygon_color_ex()

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.

Parameters
meshAddress to a jo_3d_mesh allocated struct
colorColor
indexpolygon index on the mesh
wireframeTrue to display only the edge of polygons

◆ jo_3d_set_mesh_polygon_light()

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.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable light support
indexpolygon index on the mesh

◆ jo_3d_set_mesh_polygon_palette()

static __jo_force_inline void jo_3d_set_mesh_polygon_palette ( jo_3d_mesh *const  mesh,
const int  palette_id,
const unsigned int  index 
)
static

Set a palette on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
indexpolygon index on the mesh
palette_idPalette id from jo_create_palette()

◆ jo_3d_set_mesh_polygon_screen_doors()

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.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable screen doors transparency
indexpolygon index on the mesh

◆ jo_3d_set_mesh_polygon_texture()

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.

Parameters
meshAddress to a jo_3d_mesh allocated struct
sprite_idSprite ID
indexpolygon index on the mesh

◆ jo_3d_set_mesh_polygon_transparency()

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.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable transparency
indexpolygon index on the mesh

◆ jo_3d_set_mesh_polygon_wireframe()

void jo_3d_set_mesh_polygon_wireframe ( jo_3d_mesh *const  mesh,
const unsigned int  index,
bool  wireframe 
)

Set wireframe mode on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
indexpolygon index on the mesh
wireframeTrue to enable wireframe mode

◆ jo_3d_set_mesh_screen_doors()

void jo_3d_set_mesh_screen_doors ( jo_3d_mesh *const  mesh,
const bool  enabled 
)

Enable/Disable screen doors transparency on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable screen doors transparency

◆ jo_3d_set_mesh_texture()

void jo_3d_set_mesh_texture ( jo_3d_mesh *const  mesh,
const int  sprite_id 
)

Set a texture on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
sprite_idSprite ID

◆ jo_3d_set_mesh_transparency()

void jo_3d_set_mesh_transparency ( jo_3d_mesh *const  mesh,
const bool  enabled 
)

Enable/Disable transparency on the mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
enabledtrue to enable transparency

◆ jo_3d_set_mesh_vertice()

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 
)
static

Set vertice position in mesh.

Parameters
meshAddress to a jo_3d_mesh allocated struct
xX position
yY position
zZ position
indexvertice index on the mesh (4 vertices for each quad)

◆ jo_3d_set_palette()

static __jo_force_inline void jo_3d_set_palette ( jo_3d_quad *const  quad,
const int  palette_id 
)
static

Set a palette on the quadrilateral.

Parameters
quadAddress to a jo_3d_quad allocated struct
palette_idPalette id from jo_create_palette()

◆ jo_3d_set_scale()

static __jo_force_inline void jo_3d_set_scale ( const int  x,
const int  y,
const int  z 
)
static

Change scale.

Parameters
xX Scale
yY Scale
zZ Scale

◆ jo_3d_set_scale_fixed()

static __jo_force_inline void jo_3d_set_scale_fixed ( const jo_fixed  x,
const jo_fixed  y,
const jo_fixed  z 
)
static

Change scale using fixed number.

Parameters
xX Scale
yY Scale
zZ Scale

◆ jo_3d_set_scalef()

static __jo_force_inline void jo_3d_set_scalef ( const float  x,
const float  y,
const float  z 
)
static

Change scale using floating number.

Parameters
xX Scale
yY Scale
zZ Scale

◆ jo_3d_set_screen_doors()

static __jo_force_inline void jo_3d_set_screen_doors ( jo_3d_quad *const  quad,
const bool  enabled 
)
static

Enable/Disable screen doors transparency on the quad.

Parameters
quadAddress to a jo_3d_quad allocated struct
enabledtrue to enable screen doors transparency

◆ jo_3d_set_sprite_palette()

static __jo_force_inline bool jo_3d_set_sprite_palette ( const int  sprite_id,
const int  palette_id 
)
static

Set a palette on a sprite (3D)

Parameters
sprite_idSprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack()
palette_idPalette id from jo_create_palette()
Returns
true if succeeded otherwise false

◆ jo_3d_set_texture()

static __jo_force_inline void jo_3d_set_texture ( jo_3d_quad *const  quad,
const int  sprite_id 
)
static

Set a texture on the quadrilateral.

Parameters
quadAddress to a jo_3d_quad allocated struct
sprite_idSprite ID

◆ jo_3d_set_transparency()

static __jo_force_inline void jo_3d_set_transparency ( jo_3d_quad *const  quad,
const bool  enabled 
)
static

Enable/Disable transparency on the quadrilateral.

Parameters
quadAddress to a jo_3d_quad allocated struct
enabledtrue to enable transparency

◆ jo_3d_translate_matrix()

static __jo_force_inline void jo_3d_translate_matrix ( int  x,
int  y,
int  z 
)
static

Translate 3D matrix.

Parameters
xX Position
yY Position
zZ Position

◆ jo_3d_translate_matrix_fixed()

static __jo_force_inline void jo_3d_translate_matrix_fixed ( jo_fixed  x,
jo_fixed  y,
jo_fixed  z 
)
static

Translate 3D matrix.

Parameters
xX Position
yY Position
zZ Position

◆ jo_3d_translate_matrix_x()

static __jo_force_inline void jo_3d_translate_matrix_x ( int  x)
static

Translate 3D matrix (X axis)

Parameters
xX Position

◆ jo_3d_translate_matrix_y()

static __jo_force_inline void jo_3d_translate_matrix_y ( int  y)
static

Translate 3D matrix (Y axis)

Parameters
yY Position

◆ jo_3d_translate_matrix_z()

static __jo_force_inline void jo_3d_translate_matrix_z ( int  z)
static

Translate 3D matrix (Z axis)

Parameters
zZ Position

◆ jo_3d_translate_matrixf()

static __jo_force_inline void jo_3d_translate_matrixf ( float  x,
float  y,
float  z 
)
static

Translate 3D matrix (using floating numbers)

Parameters
xX Position
yY Position
zZ Position

◆ jo_3d_window()

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 
)
static

Sets up a window region on the projection surface.

Parameters
left
top
right
bottom
z_limit
center_x
center_y
Returns
false if Failed

Variable Documentation

◆ __jo_sprite_quad

jo_3d_quad* __jo_sprite_quad[JO_MAX_SPRITE]

Sprite quads (internal engine usage)

Warning
MC Hammer: don't touch this