38#ifdef JO_COMPILE_WITH_3D_SUPPORT
41# define JO_3D_PLANE_VERTICES(SIZE) \
43 { -SIZE, -SIZE, 0 }, \
50# define JO_3D_TRIANGLE_VERTICES(SIZE) \
52 { -SIZE, -SIZE, 0 }, \
58# define JO_3D_CUBE_VERTICES(SIZE) \
60 { -SIZE, -SIZE, SIZE }, \
61 { SIZE, -SIZE, SIZE }, \
62 { SIZE, SIZE, SIZE }, \
63 { -SIZE, SIZE, SIZE }, \
64 { -SIZE, -SIZE, -SIZE }, \
65 { -SIZE, -SIZE, SIZE }, \
66 { -SIZE, SIZE, SIZE }, \
67 { -SIZE, SIZE, -SIZE }, \
68 { SIZE, -SIZE, -SIZE }, \
69 { -SIZE, -SIZE, -SIZE }, \
70 { -SIZE, SIZE, -SIZE }, \
71 { SIZE, SIZE, -SIZE }, \
72 { SIZE, -SIZE, SIZE }, \
73 { SIZE, -SIZE, -SIZE }, \
74 { SIZE, SIZE, -SIZE }, \
75 { SIZE, SIZE, SIZE }, \
76 { -SIZE, -SIZE, -SIZE }, \
77 { SIZE, -SIZE, -SIZE }, \
78 { SIZE, -SIZE, SIZE }, \
79 { -SIZE, -SIZE, SIZE }, \
80 { -SIZE, SIZE, SIZE }, \
81 { SIZE, SIZE, SIZE }, \
82 { SIZE, SIZE, -SIZE }, \
83 { -SIZE, SIZE, -SIZE } \
90# define JO_3D_DEFAULT_PERSPECTIVE_ANGLE (90)
93# define JO_3D_DEFAULT_DISPLAY_LEVEL (3)
100# define JO_3D_SORT_PREVIOUS (0)
102# define JO_3D_SORT_MIN (1)
104# define JO_3D_SORT_MAX (2)
106# define JO_3D_SORT_CENTER (3)
108# define JO_3D_SORT_MASK (3)
111# define JO_3D_SINGLE_PLANE (0)
113# define JO_3D_DUAL_PLANE (1)
116# define JO_3D_NO_OPTION (0)
118# define JO_3D_USE_TEXTURE (JO_VDP1_OPTION_USE_TEXTURE)
120# define JO_3D_USE_LIGHT (1 << 3)
122# define JO_3D_USE_PALETTE (1 << 5)
124# define JO_3D_NO_TEXTURE (0)
172# define JO_3D_ATTRIBUTE(PLANE, SORT, TEXTURE, COLOR, GOURAUD, DRAW_MODE, DIRECTION, OPTIONS) \
173 {(PLANE), (SORT) | JO_VDP1_DIRECTION_OPTIONS(DIRECTION) | (OPTIONS), (TEXTURE), (DRAW_MODE) | JO_VDP1_DIRECTION_DRAW_MODE(DIRECTION), \
174 (COLOR), (GOURAUD), JO_VDP1_DIRECTION_COMMAND(DIRECTION)}
181# define JO_3D_NORMAL(X, Y, Z) {JO_FLOAT_TO_FIXED(X), JO_FLOAT_TO_FIXED(Y), JO_FLOAT_TO_FIXED(Z)}
189# define JO_3D_VERTICES(A, B, C, D) {(A), (B), (C), (D)}
266# define JO_3D_AXIS_X (0)
268# define JO_3D_AXIS_Y (1)
270# define JO_3D_AXIS_Z (2)
311 const int part_count);
365 cam->
z_angle = jo_DEGtoANG_int(angle);
1046 while (--array_size >= 0)
jo_3d_draw(array + array_size);
1083 __internal_jo_sprite_set_position3D(x, y, z);
1101 __internal_jo_sprite_set_position3D(x, y, z);
1179static __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)
1195# define JO_3D_NEAR_WINDOW (0)
1198# define JO_3D_FAR_WINDOW (1)
1201# define JO_3D_FAR_WINDOW_2 (2)
1208 __jo_vdp1_select_window(window);
1217 if (angle < 10 || angle > 160)
1229 __jo_vdp1_update_near_clip();
1247# define JO_3D_MAX_GUARD_BAND (512)
1250# define JO_3D_DEFAULT_GUARD_BAND (JO_3D_MAX_GUARD_BAND)
1540#ifdef JO_COMPILE_WITH_DUAL_CPU_SUPPORT
1648 const jo_fixed sway,
const bool flip);
static __jo_force_inline void jo_3d_camera_look_at(jo_camera *const cam)
look at the camera
Definition 3d.h:381
static __jo_force_inline unsigned int jo_3d_get_displayed_polygon_count(void)
Get displayed polygon count.
Definition 3d.h:418
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.
static __jo_force_inline void jo_3d_rotate_matrix_x(short x)
Rotate 3D matrix using degree (X axis).
Definition 3d.h:853
static __jo_force_inline void jo_3d_translate_matrix(int x, int y, int z)
Translate 3D matrix.
Definition 3d.h:945
jo_3d_quad * __jo_sprite_quad[JO_MAX_SPRITE]
Sprite quads (internal engine usage).
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.
Definition 3d.h:635
unsigned short vertices[4]
Definition 3d.h:130
unsigned short texture_id
Definition 3d.h:138
int jo_3d_slave_get_max_vertices(void)
Points of the biggest object the slave CPU can draw (a bigger object is not drawn).
static __jo_force_inline void jo_3d_set_depth_bias(const int bias)
Set a depth added to the polygons and sprites drawn after this call, to sort them (the farthest are d...
Definition 3d.h:1295
void jo_3d_create_cube(jo_3d_quad *array, jo_vertice *const vertices)
Create a cube.
void jo_3d_set_view_rect(const jo_3d_rect *const rect)
The objects are seen only in a rectangle of the screen: jo_3d_is_sphere_visible() is false for the sp...
static __jo_force_inline void jo_3d_set_wireframe(const bool enabled)
Wireframe mode: the polygons and the standing sprites (distorted sprites) are drawn as their outline,...
Definition 3d.h:1276
int __jo_3d_guard_band
Guard band (internal engine usage, see jo_3d_set_guard_band()).
#define JO_3D_AXIS_Y
Y axis for __jo_3d_rotate().
Definition 3d.h:268
void __jo_3d_bone_matrix(jo_fixed(*const out)[3], const jo_fixed(*const parent)[3], const jo_pos3D_fixed *const pivot, const jo_angle *const angles)
The matrix of a bone (Internal usage, see jo_3d_model_draw_pose()): the matrix of its parent turned a...
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.
Definition 3d.h:1147
static __jo_force_inline void jo_3d_rotate_matrix_y(short y)
Rotate 3D matrix using degree (Y axis).
Definition 3d.h:861
static __jo_force_inline void jo_3d_rotate_matrix_rad_z(float z)
Rotate 3D matrix using radian (Z axis).
Definition 3d.h:905
jo_3d_polygon_data data
Definition 3d.h:210
static __jo_force_inline unsigned int jo_3d_get_polygon_count(void)
Get polygon count (visible and not visible).
Definition 3d.h:400
unsigned short first
Definition 3d.h:158
static __jo_force_inline void jo_3d_set_transparency(jo_3d_quad *const quad, const bool enabled)
Enable/Disable transparency on the quadrilateral.
Definition 3d.h:730
void __jo_3d_rotate(const int axis, const jo_angle angle)
Rotate the current matrix around an axis (Internal usage).
bool jo_3d_mesh_ray_hit(const jo_3d_mesh *const mesh, const jo_pos3D_fixed *const origin, const jo_pos3D_fixed *const dir, jo_fixed *const best, jo_pos3D_fixed *const normal)
First polygon of a mesh hit by a ray (the bullets: the walls of a building, the rooms of a level....
static __jo_force_inline void jo_3d_window_clip(const bool clip)
The 3D polygons drawn in the current window are clipped by the VDP1 to its rectangle (user clipping: ...
Definition 3d.h:1189
bool jo_3d_get_view_rect(jo_3d_rect *const rect)
The rectangle of jo_3d_set_view_rect().
void jo_3d_set_mesh_screen_doors(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable screen doors transparency on the mesh.
void jo_3d_transform_point_by(const jo_fixed(*const m)[3], const jo_pos3D_fixed *const in, jo_pos3D_fixed *const out)
Transform a point by a matrix (see jo_3d_transform_point(): the same result with the current matrix).
static __jo_force_inline void jo_3d_set_guard_band(const int pixels)
Set the guard band around the screen used by the clipping of the polygons drawn after this call.
Definition 3d.h:1266
jo_pos3D_fixed normal
Definition 3d.h:129
unsigned int point_count
Definition 3d.h:149
unsigned short __jo_3d_polygon_count
Polygon count of the current frame (Internal usage).
void jo_3d_slave_set_depth_bias(const int bias)
Change the depth bias of the objects drawn by the slave CPU (call it on the slave CPU).
short bottom
Definition 3d.h:1387
static __jo_force_inline void jo_3d_perspective_angle(const int angle)
Set the perspective angle.
Definition 3d.h:1214
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.
short top
Definition 3d.h:1385
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).
Definition 3d.h:352
static __jo_force_inline void jo_3d_rotate_matrix(short x, short y, short z)
Rotate 3D matrix using degree.
Definition 3d.h:843
static __jo_force_inline void jo_3d_translate_matrix_fixed(jo_fixed x, jo_fixed y, jo_fixed z)
Translate 3D matrix.
Definition 3d.h:935
void __jo_3d_light(const jo_pos3D_fixed *const light)
Set light direction (Internal usage).
void jo_3d_disable_dsp(void)
Stop using the SCU DSP to transform the vertices (see jo_3d_enable_dsp()).
int jo_3d_mesh_get_bounding_sphere(const jo_3d_mesh *const mesh, jo_pos3D_fixed *const center)
Bounding sphere of the points of a mesh (the sphere around their bounding box).
static __jo_force_inline jo_fixed jo_3d_get_projection_distance(void)
Get the projection distance (distance of the projection plane, in pixels).
Definition 3d.h:1359
static __jo_force_inline bool __jo_3d_draw(const jo_3d_polygon_data *const pdata)
Draw polygons using the current matrix (Internal usage).
Definition 3d.h:328
static __jo_force_inline void __jo_poylgon_draw_iterator(jo_node *node)
Internal usage for polygon display.
Definition 3d.h:1027
static __jo_force_inline void jo_3d_draw_array(jo_3d_quad *const array, int array_size)
Draw an array of quadrilateral.
Definition 3d.h:1044
jo_3d_ray_plane * jo_3d_mesh_create_ray_planes(const jo_3d_mesh *const mesh)
The planes of the polygons of a mesh for jo_3d_mesh_ray_hit_with_planes() (the rays are faster: the m...
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.
Definition 3d.h:570
void jo_3d_set_mesh_polygon_wireframe(jo_3d_mesh *const mesh, const unsigned int index, bool wireframe)
Set wireframe mode on the mesh.
jo_3d_polygon_attribute attribute
Definition 3d.h:211
bool jo_3d_is_sphere_visible(const jo_pos3D_fixed *const center, const jo_fixed radius, const jo_fixed max_distance)
Check if a sphere (in the view space) can be seen (view frustum of the screen).
static __jo_force_inline void jo_3d_translate_matrixf(float x, float y, float z)
Translate 3D matrix (using floating numbers).
Definition 3d.h:925
void jo_3d_pop_matrix(void)
Pop 3D matrix.
static __jo_force_inline void jo_3d_set_palette(jo_3d_quad *const quad, const int palette_id)
Set a palette on the quadrilateral.
Definition 3d.h:589
void jo_3d_create_triangle(jo_3d_quad *const quad, jo_vertice *const vertices)
Create a triangle.
void jo_3d_set_mesh_polygon_high_speed_shrink(jo_3d_mesh *const mesh, const bool enabled, const unsigned int index)
Enable/Disable High Speed Shrink on one polygon on the mesh.
static __jo_force_inline bool jo_3d_draw_sprite(const int sprite_id)
Draw a sprite.
Definition 3d.h:1053
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.
Definition 3d.h:579
bool jo_3d_mesh_ray_hit_with_planes(const jo_3d_mesh *const mesh, const jo_3d_ray_plane *const planes, const jo_pos3D_fixed *const origin, const jo_pos3D_fixed *const dir, jo_fixed *const best, jo_pos3D_fixed *const normal)
jo_3d_mesh_ray_hit() with the planes of the polygons of the mesh (the same result,...
bool jo_3d_draw_standing_sprite(const int sprite_id, const jo_pos3D_fixed *const foot, const jo_fixed width, const jo_fixed height, const jo_fixed sway, const bool flip)
Draw a sprite standing on the ground and facing the camera (trees, grass, characters far away....
void jo_3d_set_mesh_color(jo_3d_mesh *const mesh, const jo_color color)
Set the color on the mesh.
bool jo_3d_create_sprite_quad(const int sprite_id)
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).
Definition 3d.h:599
jo_3d_polygon_data data
Definition 3d.h:217
static __jo_force_inline void jo_3d_draw_billboard(const int sprite_id, const int x, const int y, const int z)
Draw billboard.
Definition 3d.h:1080
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.
Definition 3d.h:756
static __jo_force_inline void jo_3d_set_light(jo_3d_quad *const quad, const bool enabled)
Enable/Disable light on the quad.
Definition 3d.h:698
int jo_3d_slave_get_command_count(void)
VDP1 commands used by the slave CPU in the last frame (see jo_3d_slave_end()).
void jo_3d_get_matrix(jo_fixed *m)
Copy the current matrix.
void __jo_3d_set_perspective(const jo_angle angle)
Set perspective angle (Internal usage).
void jo_3d_slave_translate_matrix_fixed(const jo_fixed x, const jo_fixed y, const jo_fixed z)
Translate the matrix of the slave CPU (call it on the slave CPU, see jo_3d_translate_matrix_fixed()).
void jo_3d_set_texture_subdivision_depth(const int sprite_id, const jo_fixed depth)
Draw in parts (see jo_3d_set_texture_subdivision()) only the polygons of a texture whose nearest vert...
void jo_3d_slave_rotate_matrix(const int x, const int y, const int z)
Rotate the matrix of the slave CPU (call it on the slave CPU, see jo_3d_rotate_matrix()).
void jo_3d_reflect_matrix(const jo_pos3D_fixed *const normal, const jo_fixed distance)
Multiply the current matrix by a reflection through a plane (a mirror: the camera matrix of the refle...
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.
Definition 3d.h:784
void jo_3d_slave_end(void)
Add the polygons drawn by the slave CPU to the frame (call it on the master CPU, after jo_core_wait_f...
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.
static __jo_force_inline unsigned int jo_3d_get_mesh_polygon_count(jo_3d_mesh *const mesh)
Get polygon count on the mesh.
Definition 3d.h:1019
void jo_3d_free_mesh(const jo_3d_mesh *const mesh)
Free a mesh created with jo_3d_create_mesh().
static __jo_force_inline void jo_3d_restore_scale(void)
Restore default scale for every 3d model displayed after this call.
Definition 3d.h:1154
void jo_3d_set_front_layer(const int shift)
The next 3D polygons (of the master CPU) are a front layer: drawn after (over) all the other polygons...
static __jo_force_inline void jo_3d_rotate_matrix_rad_x(float x)
Rotate 3D matrix using radian (X axis).
Definition 3d.h:889
static __jo_force_inline void jo_3d_mesh_draw(jo_3d_mesh *const mesh)
Draw a mesh.
Definition 3d.h:995
static __jo_force_inline void jo_3d_translate_matrix_z(int z)
Translate 3D matrix (Z axis).
Definition 3d.h:969
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.
Definition 3d.h:1066
static __jo_force_inline void jo_3d_rotate_matrix_rad_y(float y)
Rotate 3D matrix using radian (Y axis).
Definition 3d.h:897
short box[6]
Definition 3d.h:1421
static __jo_force_inline bool jo_3d_is_wireframe(void)
Check the wireframe mode (see jo_3d_set_wireframe()).
Definition 3d.h:1284
bool jo_3d_set_texture_mipmaps(const int sprite_id)
Create smaller copies of a texture (half and quarter size, "mipmaps") used when the texture is drawn ...
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.
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).
Definition 3d.h:339
static __jo_force_inline void jo_3d_display_level(const unsigned short level)
Set the display level of the viewing volume.
Definition 3d.h:1226
void __jo_3d_scale(const jo_fixed x, const jo_fixed y, const jo_fixed z)
Scale the current matrix (Internal usage).
short nz
Definition 3d.h:1418
jo_3d_polygon_attribute * attributes
Definition 3d.h:152
bool jo_3d_set_mesh_polygon_environment(jo_3d_mesh *const mesh, const unsigned int index)
A polygon shows the environment map of its mesh (see jo_3d_set_mesh_environment()): its gouraud table...
void jo_3d_slave_begin(void)
Prepare the 3D drawing of the slave CPU (call it on the master CPU, before jo_core_exec_on_slave()).
static __jo_force_inline void jo_3d_draw(jo_3d_quad *const quad)
Draw a quadrilateral.
Definition 3d.h:987
bool __jo_3d_draw_ranges(const jo_3d_polygon_data *const pdata, const unsigned int point_count, const jo_3d_polygon_range *const ranges, const int range_count)
Draw polygons using the current matrix (Internal usage).
int jo_3d_slave_get_current_command_count(void)
Commands drawn by the slave CPU since jo_3d_slave_begin() (0 after jo_3d_slave_end()).
int jo_3d_slave_get_max_commands(void)
Commands the slave CPU can draw in a frame (the others are dropped, jo_3d_slave_mesh_draw() returns f...
void jo_3d_set_mesh_transparency(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable transparency on the mesh.
static __jo_force_inline void jo_3d_set_color(jo_3d_quad *const quad, const jo_color color)
Set the color on the quadrilateral.
Definition 3d.h:806
void jo_3d_transform_point(const jo_pos3D_fixed *const in, jo_pos3D_fixed *out)
Transform a point by the current matrix (for instance a world position into the view space,...
jo_3d_mesh * jo_3d_create_indexed_mesh(const unsigned int point_count, const unsigned int polygon_count)
Create an empty mesh made of shared points and polygons (indexes of the points).
unsigned short draw_mode
Definition 3d.h:139
static __jo_force_inline void jo_3d_rotate_matrix_rad(float x, float y, float z)
Rotate 3D matrix using radian.
Definition 3d.h:879
unsigned short count
Definition 3d.h:159
unsigned short first
Definition 3d.h:299
static __jo_force_inline jo_3d_mesh * jo_3d_create_mesh(const unsigned int quad_count)
Create a mesh programmatically from vertices.
Definition 3d.h:466
short right
Definition 3d.h:1386
void jo_3d_set_mesh_light(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable light on the mesh.
jo_pos3D_fixed * points
Definition 3d.h:148
void jo_3d_set_mesh_texture(jo_3d_mesh *const mesh, const int sprite_id)
Set a texture on the mesh.
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.
Definition 3d.h:1179
void jo_3d_slave_transform_point(const jo_pos3D_fixed *const in, jo_pos3D_fixed *out)
Transform a point by the matrix of the slave CPU (call it on the slave CPU, see jo_3d_transform_point...
bool jo_3d_set_texture_subdivision_near_only(const int sprite_id)
Like jo_3d_set_texture_subdivision(), but only the polygons that cross the near plane (or go very far...
unsigned short direction
Definition 3d.h:142
static __jo_force_inline void jo_3d_camera_init(jo_camera *const cam)
Initialize the camera with default values.
Definition 3d.h:371
void __jo_3d_gouraud_pool_freed(const int sprite_id)
Sprites freed from a sprite (see jo_sprite_free_from()): the shared sprite of the gouraud tables is d...
short nx
Definition 3d.h:1416
unsigned char sort
Definition 3d.h:137
bool jo_3d_set_mesh_environment(jo_3d_mesh *const mesh, const int sprite_id, const int tiles)
Environment map of a mesh (a reflection, like the paint of a car): its polygons set by jo_3d_set_mesh...
static __jo_force_inline void jo_3d_rotate_matrix_z(short z)
Rotate 3D matrix using degree (Z axis).
Definition 3d.h:869
bool jo_3d_slave_is_sphere_visible(const jo_pos3D_fixed *const center, const jo_fixed radius, const jo_fixed max_distance)
jo_3d_is_sphere_visible() for the slave CPU: with the rectangle of jo_3d_set_view_rect() as it was at...
int d
Definition 3d.h:1420
unsigned short color
Definition 3d.h:140
short ny
Definition 3d.h:1417
static __jo_force_inline bool jo_3d_slave_mesh_draw(const jo_3d_mesh *const mesh)
Draw a mesh on the slave CPU (call it on the slave CPU, between jo_3d_slave_begin() and jo_3d_slave_e...
Definition 3d.h:1623
jo_fixed(* __jo_3d_current_matrix(void))[3]
The current matrix (Internal usage): 4 rows of 3.
void jo_3d_slave_set_guard_band(const int pixels)
Change the guard band of the objects drawn by the slave CPU (call it on the slave CPU,...
void __jo_3d_look_at(const jo_fixed *const camera, const jo_fixed *const target, const jo_angle angle)
Multiply the current matrix by a camera matrix (Internal usage).
unsigned short gouraud_table
Definition 3d.h:141
jo_pos3D jo_vertice
Vertice structure.
Definition 3d.h:87
void jo_3d_push_matrix(void)
Push 3D matrix.
unsigned int polygon_count
Definition 3d.h:151
static __jo_force_inline void jo_3d_light(const int x, const int y, const int z)
Use a light source.
Definition 3d.h:671
void jo_3d_slave_pop_matrix(void)
Pop the matrix of the slave CPU (call it on the slave CPU, see jo_3d_pop_matrix()).
void jo_3d_free_sprite_quad(const int sprite_id)
Delete sprite quad.
static __jo_force_inline void jo_3d_draw_list(jo_list *const list)
Draw a list of quadrilateral.
Definition 3d.h:1035
void jo_3d_set_mirror(const bool mirror)
The next polygons of the master CPU are seen in a mirror: their front faces are counterclockwise on t...
bool jo_3d_slave_push_matrix(void)
Push the matrix of the slave CPU (call it on the slave CPU, see jo_3d_push_matrix()).
static __jo_force_inline void jo_3d_camera_set_z_angle(jo_camera *const cam, const int angle)
Set the angle of the camera.
Definition 3d.h:363
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.
static __jo_force_inline void jo_3d_select_window(const int window)
Select the window used by jo_3d_window() and by the next drawings.
Definition 3d.h:1206
bool jo_3d_slave_mesh_draw_ranges(const jo_3d_mesh *const mesh, const unsigned int point_count, const jo_3d_polygon_range *const ranges, const int range_count)
Draw some ranges of polygons of a mesh on the slave CPU, without copying them (see jo_3d_mesh_draw_ra...
void jo_3d_slave_set_scale_fixed(const jo_fixed x, const jo_fixed y, const jo_fixed z)
Scale the matrix of the slave CPU (call it on the slave CPU, see jo_3d_set_scale_fixed()).
void jo_3d_set_texture_subdivision_error(const int sprite_id, const int pixels)
Distortion of a texture over which its polygons are drawn in parts (see jo_3d_set_texture_subdivision...
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.
Definition 3d.h:456
jo_fixed(* matrix)[3]
Definition 3d.h:298
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.
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.
Definition 3d.h:649
static __jo_force_inline unsigned int jo_3d_get_vertices_count(void)
Get vertice count.
Definition 3d.h:409
jo_3d_polygon * polygons
Definition 3d.h:150
short left
Definition 3d.h:1384
#define JO_3D_MAX_GUARD_BAND
Biggest guard band around the screen (pixels): the coordinates of the VDP1 are limited.
Definition 3d.h:1247
#define JO_3D_AXIS_X
X axis for __jo_3d_rotate().
Definition 3d.h:266
void jo_3d_slave_rotate(const int axis, const jo_angle angle)
Rotate the matrix of the slave CPU around an axis by a precise angle (call it on the slave CPU): a sl...
static __jo_force_inline int jo_3d_get_depth_bias(void)
Get the depth added to the polygons and sprites (see jo_3d_set_depth_bias()).
Definition 3d.h:1303
static __jo_force_inline bool jo_3d_mesh_draw_ranges(const jo_3d_mesh *const mesh, const unsigned int point_count, const jo_3d_polygon_range *const ranges, const int range_count)
Draw some ranges of polygons of a mesh, without copying them (the points are transformed once).
Definition 3d.h:1009
void jo_3d_enable_dsp(const bool slave_cpu)
Transform the vertices with the SCU DSP (the third processor of the Saturn).
unsigned short count
Definition 3d.h:300
static __jo_force_inline void jo_3d_set_scalef(const float x, const float y, const float z)
Change scale using floating number.
Definition 3d.h:1127
bool jo_3d_slave_draw_standing_sprite(const int sprite_id, const jo_pos3D_fixed *const foot, const jo_fixed width, const jo_fixed height, const jo_fixed sway, const bool flip)
Draw a sprite standing on the ground and facing the camera on the slave CPU (see jo_3d_draw_standing_...
#define JO_3D_AXIS_Z
Z axis for __jo_3d_rotate().
Definition 3d.h:270
unsigned short __jo_3d_vertice_count
Vertice count of the current frame (Internal usage).
void __jo_3d_forget_tint(const jo_3d_polygon_data *const pdata)
Forget the tinted copies of the gouraud tables of a mesh: its polygons got other tables (Internal usa...
bool __jo_3d_draw_parts(const jo_3d_polygon_data *const pdata, const jo_3d_part *const parts, const int part_count)
Draw polygons whose points are in parts, each one transformed by its own matrix: the bones of a skele...
unsigned char plane
Definition 3d.h:136
void jo_3d_slave_set_kept_commands(const int count)
VDP1 commands kept for what is drawn after jo_3d_slave_end() (the weapon, the HUD): the polygons of t...
void __jo_3d_forget_sprites_from(const int sprite_id)
Forget the tiles and the smaller copies of the textures freed from a sprite (Internal usage,...
static __jo_force_inline void jo_3d_set_texture(jo_3d_quad *const quad, const int sprite_id)
Set a texture on the quadrilateral.
Definition 3d.h:549
unsigned short __jo_3d_displayed_polygon_count
Displayed polygon count of the current frame (Internal usage).
bool jo_3d_set_texture_subdivision(const int sprite_id)
Draw the polygons that use a texture in parts when they are near the camera (2 x 2 or 4 x 4 parts,...
jo_3d_mesh * jo_3d_create_sphere(const int radius, const unsigned int slices, const unsigned int stacks)
Create a sphere (UV sphere).
static __jo_force_inline void jo_3d_translate_matrix_x(int x)
Translate 3D matrix (X axis).
Definition 3d.h:953
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.
Definition 3d.h:1094
static __jo_force_inline void jo_3d_translate_matrix_y(int y)
Translate 3D matrix (Y axis).
Definition 3d.h:961
void jo_3d_set_mesh_color_ex(jo_3d_mesh *const mesh, const jo_color color, bool wireframe)
Set the color on the mesh.
static __jo_force_inline void jo_3d_set_scale(const int x, const int y, const int z)
Change scale.
Definition 3d.h:1137
void jo_3d_set_tint(const int r, const int g, const int b)
Tint the next meshes drawn by the master CPU: added to the colors of their gouraud tables (the light ...
short unused
Definition 3d.h:1419
unsigned short jo_3d_add_gouraud_tables(const jo_color *const tables, const unsigned int count)
Add gouraud tables in the VDP1 VRAM (4 colors per table, one per vertex of a polygon).
void jo_3d_create_plane(jo_3d_quad *const quad, jo_vertice *const vertices)
Create a four vertices polygon (Quadrilateral shape).
void __jo_3d_translate(const jo_fixed x, const jo_fixed y, const jo_fixed z)
Translate the current matrix (Internal usage).
void jo_3d_set_mesh_high_speed_shrink(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable High Speed Shrink on the mesh.
static __jo_force_inline jo_3d_quad * jo_3d_get_sprite_quad(const int sprite_id)
Get sprite quad.
Definition 3d.h:512
Mesh structure.
Definition 3d.h:216
Points of a mesh transformed by their own matrix (see __jo_3d_draw_parts()).
Definition 3d.h:297
Polygon (quadrilateral, a triangle repeats the last vertex).
Definition 3d.h:128
Polygon attribute.
Definition 3d.h:135
Polygon data (3D model).
Definition 3d.h:147
Range of polygons of a mesh (see jo_3d_mesh_draw_ranges()).
Definition 3d.h:157
Quadrilateral shape structure.
Definition 3d.h:209
Plane of a polygon for the rays (see jo_3d_mesh_create_ray_planes()): the normal and its distance,...
Definition 3d.h:1415
A rectangle of the screen (pixels, the edges are in it).
Definition 3d.h:1383
#define jo_core_error(...)
Definition core.h:48
jo_list_data data
Definition list.h:67
struct __jo_node jo_node
Node type.
Definition list.h:39
void * ptr
Definition list.h:59
List struct.
Definition list.h:74
#define JO_RAD_TO_ANGLE(X)
Convert a radian to jo_angle.
Definition math.h:473
#define JO_MULT_BY_256(X)
Multiply a variable by 256.
Definition math.h:111
#define JO_FLOAT_TO_FIXED(X)
Convert a float to jo_fixed.
Definition math.h:465
#define JO_MULT_BY_65536(X)
Multiply a variable by 65536.
Definition math.h:147
void jo_sprite_draw(const int sprite_id, const jo_pos3D *const pos, const bool centered_style_coordinates, const bool billboard)
(internal engine usage)
jo_sprite_attributes __jo_sprite_attributes
Current displayed sprite attribute (internal engine usage).
#define JO_NO_ZOOM
Value used to keep the original scale (1.0 in jo_fixed).
Definition sprites.h:376
Camera structure.
Definition 3d.h:193
jo_angle z_angle
Definition 3d.h:204
jo_fixed z
Definition types.h:95
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
short jo_angle
Angle.
Definition types.h:54
unsigned short jo_color
15 bits color type
Definition types.h:42
jo_fixed x
Definition types.h:93
jo_fixed y
Definition types.h:94
jo_fixed fixed_scale_y
Definition types.h:277
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:48
jo_fixed fixed_scale_x
Definition types.h:276
3D position
Definition types.h:74
3D position using fixed numbers
Definition types.h:92
Vector for 3D computation using integer.
Definition types.h:147
void __jo_vdp1_set_window(const short left, const short top, const short right, const short bottom, const short zlimit, const short center_x, const short center_y)
Set the current 3D window (internal usage).
unsigned short clip_mode
Definition vdp1_command_pipeline.h:266
#define JO_VDP1_WINDOW_IN
Draw inside the user clipping area.
Definition vdp1_command_pipeline.h:130
bool __jo_vdp1_wireframe
Wireframe mode (internal usage, see jo_3d_set_wireframe()).
jo_vdp1_window __jo_vdp1_windows[(3)]
jo_fixed __jo_vdp1_projection_distance
Projection distance in Q16.16 (internal usage, see jo_3d_perspective_angle()).
int __jo_vdp1_depth_bias
Depth added to the keys of the commands (see jo_3d_set_depth_bias()).
unsigned short __jo_vdp1_display_level
Near clipping divisor (internal usage, see jo_3d_display_level()).
int __jo_vdp1_current_window
Current 3D window (internal usage).