![]() |
Jo Engine 2026.11.6
Jo Sega Saturn Engine
|
Jo Engine 3D basics. More...
Go to the source code of this file.
Data Structures | |
| struct | jo_3d_polygon |
| Polygon (quadrilateral, a triangle repeats the last vertex). More... | |
| struct | jo_3d_polygon_attribute |
| Polygon attribute. More... | |
| struct | jo_3d_polygon_data |
| Polygon data (3D model). More... | |
| struct | jo_3d_polygon_range |
| Range of polygons of a mesh (see jo_3d_mesh_draw_ranges()). More... | |
| struct | jo_camera |
| Camera structure. More... | |
| struct | __jo_may_alias |
| Quadrilateral shape structure. More... | |
| struct | jo_3d_mesh |
| Mesh structure. More... | |
| struct | jo_3d_part |
| Points of a mesh transformed by their own matrix (see __jo_3d_draw_parts()). More... | |
| struct | jo_3d_rect |
| A rectangle of the screen (pixels, the edges are in it). More... | |
| struct | jo_3d_ray_plane |
| Plane of a polygon for the rays (see jo_3d_mesh_create_ray_planes()): the normal and its distance, without the vertices (the models are in the slow work RAM). More... | |
Macros | |
| #define | JO_3D_PLANE_VERTICES(SIZE) |
| Plane vertice table. | |
| #define | JO_3D_TRIANGLE_VERTICES(SIZE) |
| Triangle vertice table. | |
| #define | JO_3D_CUBE_VERTICES(SIZE) |
| Cube vertice table. | |
| #define | JO_3D_QUAD_VERTEX_COUNT |
| Vertex count of a quad (jo_3d_create_mesh_from_vertices() takes 4 vertices for each quad). | |
| #define | JO_3D_DEFAULT_PERSPECTIVE_ANGLE |
| Default perspective angle in degree (see jo_3d_perspective_angle()). | |
| #define | JO_3D_DEFAULT_DISPLAY_LEVEL |
| Default display level (see jo_3d_display_level()). | |
| #define | JO_3D_SORT_PREVIOUS |
| Polygon sort: same depth as the previous polygon. | |
| #define | JO_3D_SORT_MIN |
| Polygon sort: depth of the nearest vertex. | |
| #define | JO_3D_SORT_MAX |
| Polygon sort: depth of the farthest vertex. | |
| #define | JO_3D_SORT_CENTER |
| Polygon sort: average depth of the 4 vertices. | |
| #define | JO_3D_SORT_MASK |
| Polygon sort mask. | |
| #define | JO_3D_SINGLE_PLANE |
| Polygon hidden when seen from the back. | |
| #define | JO_3D_DUAL_PLANE |
| Polygon always displayed. | |
| #define | JO_3D_NO_OPTION |
| Polygon option: no option. | |
| #define | JO_3D_USE_TEXTURE |
| Polygon option: textured polygon. | |
| #define | JO_3D_USE_LIGHT |
| Polygon option: lighting (see jo_3d_light()). | |
| #define | JO_3D_USE_PALETTE |
| Polygon option: the color is a palette (no lighting). | |
| #define | JO_3D_NO_TEXTURE |
| No texture. | |
| #define | JO_3D_ATTRIBUTE(PLANE, SORT, TEXTURE, COLOR, GOURAUD, DRAW_MODE, DIRECTION, OPTIONS) |
| Polygon attribute initializer. | |
| #define | JO_3D_NORMAL(X, Y, Z) |
| Polygon normal initializer. | |
| #define | JO_3D_VERTICES(A, B, C, D) |
| Polygon vertices initializer. | |
| #define | JO_3D_AXIS_X |
| X axis for __jo_3d_rotate(). | |
| #define | JO_3D_AXIS_Y |
| Y axis for __jo_3d_rotate(). | |
| #define | JO_3D_AXIS_Z |
| Z axis for __jo_3d_rotate(). | |
| #define | JO_3D_NEAR_WINDOW |
| Near window (default) for jo_3d_select_window(). | |
| #define | JO_3D_FAR_WINDOW |
| Far window for jo_3d_select_window(). | |
| #define | JO_3D_FAR_WINDOW_2 |
| Second far window for jo_3d_select_window() (a second mirror). | |
| #define | JO_3D_LAYER_WINDOW |
| Window of the transparency layer (see jo/transparency.h): selected by jo_3d_transparency_begin(). | |
| #define | JO_3D_MAX_GUARD_BAND |
| Biggest guard band around the screen (pixels): the coordinates of the VDP1 are limited. | |
| #define | JO_3D_DEFAULT_GUARD_BAND |
| Default guard band around the screen (pixels, see jo_3d_set_guard_band()): only the polygons that go very far outside of the screen are clipped by the CPU. | |
| #define | JO_3D_FADE_LEVELS |
| Levels of the fade (the color calculation ratios 1 to 3 of the sprites, see jo_vdp2_set_sprite_blend_ratios()). | |
| #define | JO_3D_FADE_LEVEL_SHIFT |
| Bit of the level in the color code of a sprite (sprite type 3: its color calculation bits 12 and 11). | |
Typedefs | |
| typedef jo_pos3D | jo_vertice |
| Vertice structure. | |
| typedef struct __jo_may_alias | jo_3d_quad |
| Quadrilateral shape structure. | |
Functions | |
| static __jo_force_inline void | jo_3d_set_quad_vertices (jo_vertice *const vertices, const jo_vertice *const center, const jo_vertice *const right, const jo_vertice *const down) |
| Fill the 4 vertices of a quad (a parallelogram) from its center and 2 half edges, in the order of JO_3D_PLANE_VERTICES(): center - right - down, center + right - down, center + right + down, center - right + down. | |
| bool | jo_3d_create_sprite_quad (const int sprite_id) |
| 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). | |
| 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_scale (const jo_fixed x, const jo_fixed y, const jo_fixed z) |
| Scale the current matrix (Internal usage). | |
| void | __jo_3d_rotate (const int axis, const jo_angle angle) |
| Rotate the current matrix around an axis (Internal usage). | |
| void | __jo_3d_light (const jo_pos3D_fixed *const light) |
| Set light direction (Internal usage). | |
| void | __jo_3d_set_perspective (const jo_angle angle) |
| Set perspective angle (Internal usage). | |
| 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, sorted among themselves with the depth divided by 2^shift (a rear-view mirror: its content is far away, but in front of the view of the camera; draw a background first). | |
| bool | __jo_3d_draw_ranges_from (const jo_3d_polygon_data *const pdata, const unsigned int first_point, const unsigned int point_count, const jo_3d_polygon_range *const ranges, const int range_count) |
| Draw polygons using the current matrix (Internal usage). | |
| 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) |
| static __jo_force_inline bool | __jo_3d_draw (const jo_3d_polygon_data *const pdata) |
| Draw polygons using the current matrix (Internal usage). | |
| 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). | |
| 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). | |
| static __jo_force_inline void | jo_3d_camera_set_z_angle (jo_camera *const cam, const int angle) |
| Set the angle of the camera. | |
| static __jo_force_inline void | jo_3d_camera_init (jo_camera *const cam) |
| Initialize the camera with default values. | |
| static __jo_force_inline void | jo_3d_camera_look_at (jo_camera *const cam) |
| look at the camera | |
| static __jo_force_inline unsigned int | jo_3d_get_polygon_count (void) |
| Get polygon count (visible and not visible). | |
| static __jo_force_inline unsigned int | jo_3d_get_vertices_count (void) |
| Get vertice count. | |
| static __jo_force_inline unsigned int | jo_3d_get_displayed_polygon_count (void) |
| Get displayed polygon 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. | |
| 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. | |
| static __jo_force_inline jo_3d_mesh * | jo_3d_create_mesh (const unsigned int quad_count) |
| Create a mesh programmatically from vertices. | |
| jo_3d_mesh * | jo_3d_create_sphere (const int radius, const unsigned int slices, const unsigned int stacks) |
| Create a sphere (UV sphere). | |
| void | jo_3d_free_mesh (const jo_3d_mesh *const mesh) |
| Free a mesh created with jo_3d_create_mesh(). | |
| void | jo_3d_create_plane (jo_3d_quad *const quad, jo_vertice *const vertices) |
| Create a four vertices polygon (Quadrilateral shape). | |
| void | jo_3d_create_cube (jo_3d_quad *array, jo_vertice *const vertices) |
| Create a cube. | |
| void | jo_3d_create_triangle (jo_3d_quad *const quad, jo_vertice *const vertices) |
| Create a triangle. | |
| static __jo_force_inline jo_3d_quad * | jo_3d_get_sprite_quad (const int sprite_id) |
| Get sprite quad. | |
| void | jo_3d_free_sprite_quad (const int sprite_id) |
| Delete sprite quad. | |
| 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. | |
| void | jo_3d_set_mesh_polygon_texture_bank (jo_3d_mesh *const mesh, const int sprite_id, const jo_palette *const palette, const int bank, const unsigned int index) |
| Set a texture of 16 colors on one polygon, its colors taken in a bank of 16 colors of a palette (in place of its color lookup table): a polygon of the palette lighting (see jo_3d_set_palette_light()), or opaque over the half transparent water (the MSB of the colors of the palette cleared), or the same texture in other colors. | |
| void | jo_3d_set_mesh_polygon_texture_palette (jo_3d_mesh *const mesh, const int sprite_id, const jo_palette *const palette, const unsigned int index) |
| Set a texture of 256 colors on one polygon, its colors taken in a palette (its pixel value n: the color n of the palette): opaque over a see-through bottom where the MSB of the colors is cleared, see jo_vdp2_blend_rgb_sprites_only(). | |
| 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 void | jo_3d_set_texture (jo_3d_quad *const quad, const int sprite_id) |
| Set a texture on the quadrilateral. | |
| void | jo_3d_set_mesh_polygon_wireframe (jo_3d_mesh *const mesh, const unsigned int index, bool wireframe) |
| Set wireframe mode on the mesh. | |
| 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. | |
| 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. | |
| static __jo_force_inline void | jo_3d_set_palette (jo_3d_quad *const quad, const int palette_id) |
| Set a palette on the quadrilateral. | |
| 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). | |
| 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. | |
| void | jo_3d_set_mesh_high_speed_shrink (jo_3d_mesh *const mesh, const bool enabled) |
| Enable/Disable High Speed Shrink on the mesh. | |
| void | jo_3d_set_high_speed_shrink (const bool enabled) |
| High speed shrink for every textured polygon drawn from now on (models, meshes, levels), whatever their own setting (default: on); can be changed at any time (a scene, a view). | |
| 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. | |
| 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. | |
| static __jo_force_inline void | jo_3d_light (const int x, const int y, const int z) |
| Use a light source. | |
| static __jo_force_inline void | jo_3d_light_fixed (const jo_fixed x, const jo_fixed y, const jo_fixed z) |
| Use a light source: its direction as a unit vector. | |
| void | jo_3d_set_palette_light (const int levels, const int stride) |
| Palette lighting (the light of jo_3d_light() without the RGB colors: the only lighting of the 640 and 704 pixels modes): a lit polygon of a palette color (or a texture of 16 colors with a color bank) takes the shade of its light, its color code + shade * stride (shade 0 = the darkest). | |
| 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. | |
| void | jo_3d_set_mesh_light (jo_3d_mesh *const mesh, const bool enabled) |
| Enable/Disable light on the mesh. | |
| static __jo_force_inline void | jo_3d_set_light (jo_3d_quad *const quad, const bool enabled) |
| Enable/Disable light on the quad. | |
| 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. | |
| 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_transparency (jo_3d_quad *const quad, const bool enabled) |
| Enable/Disable transparency on the quadrilateral. | |
| 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. | |
| void | jo_3d_set_mesh_screen_doors (jo_3d_mesh *const mesh, const bool enabled) |
| Enable/Disable screen doors transparency on the mesh. | |
| 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. | |
| void | jo_3d_set_mesh_polygon_gouraud (jo_3d_mesh *const mesh, const unsigned short table, const unsigned int index) |
| Give a gouraud table to one polygon of the mesh (the color of each of its 4 vertices is added to its color). | |
| unsigned short | jo_3d_set_mesh_gouraud (jo_3d_mesh *const mesh, const jo_color *const tables) |
| Gouraud shading of the whole mesh: one table of 4 colors per polygon (a color per vertex, in the order of the vertices of the polygon), added to the VRAM (see jo_3d_add_gouraud_tables()). | |
| 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_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. | |
| void | jo_3d_set_mesh_color (jo_3d_mesh *const mesh, const jo_color color) |
| Set the color on the mesh. | |
| 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_color (jo_3d_quad *const quad, const jo_color color) |
| Set the color on the quadrilateral. | |
| void | jo_3d_push_matrix (void) |
| Push 3D matrix. | |
| void | jo_3d_pop_matrix (void) |
| Pop 3D matrix. | |
| static __jo_force_inline void | jo_3d_rotate_matrix (short x, short y, short z) |
| Rotate 3D matrix using degree. | |
| static __jo_force_inline void | jo_3d_rotate_matrix_x (short x) |
| Rotate 3D matrix using degree (X axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_y (short y) |
| Rotate 3D matrix using degree (Y axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_z (short z) |
| Rotate 3D matrix using degree (Z axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_rad (float x, float y, float z) |
| Rotate 3D matrix using radian. | |
| static __jo_force_inline void | jo_3d_rotate_matrix_rad_x (float x) |
| Rotate 3D matrix using radian (X axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_rad_y (float y) |
| Rotate 3D matrix using radian (Y axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_rad_z (float z) |
| Rotate 3D matrix using radian (Z axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_angle (const jo_angle x, const jo_angle y, const jo_angle z) |
| Rotate 3D matrix using jo_angle (0x10000 = 360 degrees: a fraction of degree, no float). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_angle_x (const jo_angle x) |
| Rotate 3D matrix using jo_angle (X axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_angle_y (const jo_angle y) |
| Rotate 3D matrix using jo_angle (Y axis). | |
| static __jo_force_inline void | jo_3d_rotate_matrix_angle_z (const jo_angle z) |
| Rotate 3D matrix using jo_angle (Z axis). | |
| static __jo_force_inline void | jo_3d_translate_matrixf (float x, float y, float z) |
| Translate 3D matrix (using floating numbers). | |
| static __jo_force_inline void | jo_3d_translate_matrix_fixed (jo_fixed x, jo_fixed y, jo_fixed z) |
| Translate 3D matrix. | |
| static __jo_force_inline void | jo_3d_translate_matrix (int x, int y, int z) |
| Translate 3D matrix. | |
| static __jo_force_inline void | jo_3d_translate_matrix_x (int x) |
| Translate 3D matrix (X axis). | |
| static __jo_force_inline void | jo_3d_translate_matrix_y (int y) |
| Translate 3D matrix (Y axis). | |
| static __jo_force_inline void | jo_3d_translate_matrix_z (int z) |
| Translate 3D matrix (Z axis). | |
| static __jo_force_inline void | jo_3d_draw (jo_3d_quad *const quad) |
| Draw a quadrilateral. | |
| static __jo_force_inline void | jo_3d_mesh_draw (jo_3d_mesh *const mesh) |
| Draw a mesh. | |
| 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). | |
| static __jo_force_inline void | jo_3d_add_polygon_range (jo_3d_polygon_range *const ranges, int *const range_count, const int first, const int count) |
| Add polygons to a list of ranges (see jo_3d_mesh_draw_ranges()): joined to the last range when they follow it. | |
| static __jo_force_inline unsigned int | jo_3d_get_mesh_polygon_count (jo_3d_mesh *const mesh) |
| Get polygon count on the mesh. | |
| static __jo_force_inline void | __jo_poylgon_draw_iterator (jo_node *node) |
| Internal usage for polygon display. | |
| static __jo_force_inline void | jo_3d_draw_list (jo_list *const list) |
| Draw a list of quadrilateral. | |
| static __jo_force_inline void | jo_3d_draw_array (jo_3d_quad *const array, int array_size) |
| Draw an array of quadrilateral. | |
| static __jo_force_inline bool | jo_3d_draw_sprite (const int sprite_id) |
| Draw a sprite. | |
| 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. | |
| static __jo_force_inline void | jo_3d_draw_billboard (const int sprite_id, const int x, const int y, const int z) |
| Draw 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) |
| Draw billboard with a specific scale. | |
| static __jo_force_inline void | jo_3d_set_scalef (const float x, const float y, const float z) |
| Change scale using floating number. | |
| static __jo_force_inline void | jo_3d_set_scale (const int x, const int y, const int z) |
| Change scale. | |
| 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. | |
| static __jo_force_inline void | jo_3d_restore_scale (void) |
| Scale of 1 (nothing changes): the scale of jo_3d_set_scale() is in the current matrix, jo_3d_pop_matrix() restores the matrix before it (jo_3d_push_matrix(), jo_3d_set_scale(), draw, jo_3d_pop_matrix()). | |
| 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. | |
| 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: a mirror, a rear-view mirror, a view of a split screen), or not (default: the whole screen). | |
| 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. | |
| static __jo_force_inline void | jo_3d_set_windows_apart (const bool apart) |
| The windows do not overlap (a split screen: a view per player in its window): the commands of each window are drawn together, window after window (window 0 first), sorted by depth in their window; else (default) the commands of all the windows are sorted together by depth (a mirror in the view: its window over the other one). | |
| static __jo_force_inline void | jo_3d_perspective_angle (const int angle) |
| Set the perspective angle. | |
| static __jo_force_inline void | jo_3d_set_perspective (const jo_angle angle) |
| Set the perspective angle using jo_angle (a fraction of degree, as slPerspective() of the SGL). | |
| static __jo_force_inline void | jo_3d_display_level (const unsigned short level) |
| Set the display level of the viewing volume. | |
| void | jo_3d_enable_dsp (const bool slave_cpu) |
| Transform the vertices with the SCU DSP (the third processor of the Saturn). | |
| void | jo_3d_disable_dsp (void) |
| Stop using the SCU DSP to transform the vertices (see jo_3d_enable_dsp()). | |
| 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. | |
| 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, in one color; the normal and scaled sprites (a HUD for instance) are drawn as they are. | |
| static __jo_force_inline bool | jo_3d_is_wireframe (void) |
| Check the wireframe mode (see jo_3d_set_wireframe()). | |
| 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 drawn first). | |
| 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()). | |
| 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, after jo_3d_camera_look_at() or the rotations and translations of the camera). | |
| 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). | |
| void | jo_3d_slave_select_window (const int window) |
| Select the window of the next drawings of the slave CPU (call it on the slave CPU; jo_3d_slave_begin() selects the window of the master CPU, see jo_3d_select_window()). | |
| void | jo_3d_get_matrix (jo_fixed *m) |
| Copy the current 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 reflected view). | |
| 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 the screen. | |
| static __jo_force_inline jo_fixed | jo_3d_get_projection_distance (void) |
| Get the projection distance (distance of the projection plane, in pixels). | |
| 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). | |
| 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 jo_3d_slave_begin() (the master CPU can change it while the slave CPU draws) | |
| 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 spheres outside of it (the camera is in a building: the outside is seen only through its door, see jo_cells_outside_view()). | |
| bool | jo_3d_get_view_rect (jo_3d_rect *const rect) |
| The rectangle of jo_3d_set_view_rect(). | |
| 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). | |
| 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...). | |
| 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 most polygons are rejected by their plane). | |
| 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, faster) | |
| 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...). | |
| bool | jo_3d_set_sprite_fade (const int sprite_id, const jo_palette *const palette, const int bank) |
| A standing sprite that fades with the distance (see jo_3d_set_fade_distances()): its 16 colors copied in a bank of a palette, used beyond the start of the fade. | |
| void | jo_3d_set_fade_distances (const jo_fixed start, const jo_fixed end) |
| The distances of the fade of the standing sprites (see jo_3d_set_sprite_fade()): opaque up to start, then JO_3D_FADE_LEVELS levels more and more transparent up to end (beyond: the most transparent; don't draw them). | |
| 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). | |
| 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, each part with its tile of the texture). | |
| bool | jo_3d_set_texture_subdivision_fine (const int sprite_id) |
| Add finer tiles to the tiles of a texture (see jo_3d_set_texture_subdivision()): 8 x 8 and 16 x 16 tiles, for the parts of its polygons cut in 4 x 4 parts that cross the near plane, go very far outside of the screen, are big and partly out of the screen, or still distorted by the perspective. The last tile of a part through the near plane, or with its lines pulled in to the screen (VDP1 time), is drawn whole on what is seen of it (the VDP1 can't start a texture at any column): its texture is squeezed by up to a tile, 8 texels of a 32 x 32 texture with the 4 x 4 tiles, 2 with the 16 x 16 tiles. For a texture magnified near the camera (texels of more than about 10 pixels: a texture of a few texels on a big wall, a big floor). | |
| 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 outside of the screen) are drawn in parts: a model already cut in small quads when it was made keeps its quads as they are, the parts of a quad next to a whole quad overlapped it. | |
| 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 vertex is nearer than a depth: the ground next to the camera, where its texture slides the most (farther, the parts cost CPU time for little). | |
| 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()): a pattern with straight lines (a tiled floor) shows the distortion more, the lines bend where a part meets a whole polygon. | |
| void | jo_3d_set_fewer_parts (const bool enabled) |
| Draw the polygons in parts only where it is needed to draw them at all (see jo_3d_set_texture_subdivision()): the polygons that cross the near plane, and those beyond the guard band in 2 x 2 parts only (see jo_3d_set_guard_band(); a bigger guard band keeps them few); not for the perspective of their texture, nor the big ones mostly out of the screen (the VDP1 draws their pixels out of the screen too). | |
| 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 small. | |
| bool | jo_3d_set_texture_mipmap_copies (const int sprite_id, const int half_id, const int levels) |
| Give a texture its smaller copies made beforehand (see jo_3d_set_texture_mipmaps()): for the textures it can't reduce itself (256 colors: their palette is chosen per polygon), or reduced better by a tool (the averages in the colors of the palette, a mean color searched among 255 at the loading took seconds). | |
| 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()). | |
| 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). | |
| 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, see jo_3d_set_guard_band()). | |
| 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_slave_push_matrix (void) |
| Push the matrix of the slave CPU (call it on the slave CPU, see jo_3d_push_matrix()). | |
| 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_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_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_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 slow turn (a big wheel, a fan) moves by less than a degree per frame. | |
| 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()). | |
| 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_ranges()). | |
| bool | __jo_3d_slave_draw_ranges_from (const jo_3d_mesh *const mesh, const unsigned int first_point, const unsigned int point_count, const jo_3d_polygon_range *const ranges, const int range_count) |
| jo_3d_slave_mesh_draw_ranges() with the points of the ranges known (see __jo_3d_draw_ranges_from()) | |
| 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_end()). | |
| int | jo_3d_slave_get_command_count (void) |
| VDP1 commands used by the slave CPU in the last frame (see jo_3d_slave_end()). | |
| 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_sprite()). | |
| void | jo_3d_slave_set_fade_distances (const jo_fixed start, const jo_fixed end) |
| The distances of the fade of the standing sprites of the slave CPU (see jo_3d_set_fade_distances()), until the next jo_3d_slave_begin() (call it on the slave CPU). | |
| 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 false). | |
| int | jo_3d_slave_get_max_vertices (void) |
| Points of the biggest object the slave CPU can draw (a bigger object is not drawn). | |
| 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_for_slave()). | |
| 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 the slave CPU don't take them. Without it, a frame full of polygons left no room for the HUD (and JO_DEBUG stopped the game: "Too many
VDP1 commands in a frame"). | |
| 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_free_gouraud_tables (const unsigned short adr, const unsigned int count) |
| Give back gouraud tables of jo_3d_add_gouraud_tables() (jo_3d_free_model() gives back the tables of a model). | |
| 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 of a lamp on a character, see jo_3d_point_lights_sample()), jo_3d_set_tint(0, 0, 0) to stop. | |
| unsigned short | jo_3d_get_tint (void) |
| The tint of the master CPU, packed (see jo_3d_set_tint()): 5 bits per component (signed, steps of 2), 0: none. | |
| void | jo_3d_set_packed_tint (const unsigned short tint) |
| Tint the next meshes drawn by the master CPU (see jo_3d_set_tint()). | |
| void | jo_3d_slave_set_tint (const unsigned short tint) |
| Tint the next meshes drawn by the slave CPU (call it on the slave CPU). | |
| void | jo_3d_prepare_tint (const jo_3d_mesh *const mesh) |
| Make the tinted copy of the gouraud tables of a mesh for the current tint of the master CPU (see jo_3d_set_tint()), for the slave CPU to draw it with this tint (jo_3d_slave_set_tint()). | |
| 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_polygon_environment() show a tile of a picture of the surroundings, the tile of the direction of their normal in the view. The picture is cut in tiles x tiles tiles: the tile (i, j) is for the normals that point to the left (i = 0) or to the right (i = tiles - 1), up (j = 0) or down (j = tiles - 1): a sphere seen from the front (a "matcap"). The reflection moves on the object when the camera or the object turns. | |
| 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 tints the reflection (16: the picture as it is). | |
Variables | |
| jo_3d_quad ** | __jo_sprite_quad |
| Sprite quads (internal engine usage): a quad per sprite, the table allocated with the first quad (JO_NULL: none). | |
| unsigned short | __jo_3d_polygon_count |
| Polygon count of the current frame (Internal usage). | |
| unsigned short | __jo_3d_vertice_count |
| Vertice count of the current frame (Internal usage). | |
| unsigned short | __jo_3d_displayed_polygon_count |
| Displayed polygon count of the current frame (Internal usage). | |
| int | __jo_3d_guard_band |
| Guard band (internal engine usage, see jo_3d_set_guard_band()). | |
Jo Engine 3D basics.
| struct jo_3d_polygon |
Polygon (quadrilateral, a triangle repeats the last vertex).
| Data Fields | ||
|---|---|---|
| jo_pos3D_fixed | normal | |
| unsigned short | vertices[4] | |
| struct jo_3d_polygon_attribute |
| struct jo_3d_polygon_data |
Polygon data (3D model).
| Data Fields | ||
|---|---|---|
| jo_3d_polygon_attribute * | attributes | |
| unsigned int | point_count | |
| jo_pos3D_fixed * | points | |
| unsigned int | polygon_count | |
| jo_3d_polygon * | polygons | |
| struct jo_3d_polygon_range |
| struct __jo_may_alias |
Quadrilateral shape structure.
Keyboard data.
Light gun data (Internal usage, see jo_get_input_gun_position()).
Pointing peripheral data (mouse).
Analog peripheral data (racing wheel, mission stick, 3D pad).
| Data Fields | ||
|---|---|---|
| jo_3d_polygon_attribute | attribute | |
| unsigned char | code | |
| unsigned char | condition | |
| jo_3d_polygon_data | data | |
| unsigned short | data | |
| unsigned char | id | |
| unsigned char | light | |
| unsigned char | modifiers | |
| unsigned short | pull | |
| unsigned short | push | |
| unsigned int | reserved[3] | |
| unsigned char | reserved1[3] | |
| unsigned int | reserved2[2] | |
| unsigned char | size | |
| unsigned char | w | |
| short | x | |
| unsigned char | x | |
| short | y | |
| unsigned char | y | |
| unsigned char | z | |
| struct jo_3d_mesh |
Mesh structure.
| Data Fields | ||
|---|---|---|
| jo_3d_polygon_data | data | |
| struct jo_3d_part |
Points of a mesh transformed by their own matrix (see __jo_3d_draw_parts()).
| Data Fields | ||
|---|---|---|
| unsigned short | count | |
| unsigned short | first | |
| jo_fixed(* | matrix)[3] | |
| struct jo_3d_rect |
| struct jo_3d_ray_plane |
Plane of a polygon for the rays (see jo_3d_mesh_create_ray_planes()): the normal and its distance, without the vertices (the models are in the slow work RAM).
| Data Fields | ||
|---|---|---|
| short | box[6] | |
| int | d | |
| short | nx | |
| short | ny | |
| short | nz | |
| short | unused | |
| #define JO_3D_ATTRIBUTE | ( | PLANE, | |
| SORT, | |||
| TEXTURE, | |||
| COLOR, | |||
| GOURAUD, | |||
| DRAW_MODE, | |||
| DIRECTION, | |||
| OPTIONS ) |
Polygon attribute initializer.
| PLANE | JO_3D_SINGLE_PLANE or JO_3D_DUAL_PLANE |
| SORT | JO_3D_SORT_xxx |
| TEXTURE | Sprite id (JO_3D_NO_TEXTURE) |
| COLOR | RGB color or palette |
| GOURAUD | Gouraud table address / 8 (JO_VDP1_NO_GOURAUD) |
| DRAW_MODE | JO_VDP1_COLOR_MODE_xxx | JO_VDP1_COLOR_CALC_xxx | ... |
| DIRECTION | JO_VDP1_SPRITE_NO_FLIP, JO_VDP1_POLYGON, etc |
| OPTIONS | JO_3D_USE_xxx (JO_3D_NO_OPTION) |
| #define JO_3D_AXIS_X |
X axis for __jo_3d_rotate().
| #define JO_3D_AXIS_Y |
Y axis for __jo_3d_rotate().
| #define JO_3D_AXIS_Z |
Z axis for __jo_3d_rotate().
| #define JO_3D_CUBE_VERTICES | ( | SIZE | ) |
Cube vertice table.
| #define JO_3D_DEFAULT_DISPLAY_LEVEL |
Default display level (see jo_3d_display_level()).
| #define JO_3D_DEFAULT_GUARD_BAND |
Default guard band around the screen (pixels, see jo_3d_set_guard_band()): only the polygons that go very far outside of the screen are clipped by the CPU.
| #define JO_3D_DEFAULT_PERSPECTIVE_ANGLE |
Default perspective angle in degree (see jo_3d_perspective_angle()).
| #define JO_3D_DUAL_PLANE |
Polygon always displayed.
| #define JO_3D_FADE_LEVEL_SHIFT |
Bit of the level in the color code of a sprite (sprite type 3: its color calculation bits 12 and 11).
| #define JO_3D_FADE_LEVELS |
Levels of the fade (the color calculation ratios 1 to 3 of the sprites, see jo_vdp2_set_sprite_blend_ratios()).
| #define JO_3D_FAR_WINDOW |
Far window for jo_3d_select_window().
| #define JO_3D_FAR_WINDOW_2 |
Second far window for jo_3d_select_window() (a second mirror).
| #define JO_3D_LAYER_WINDOW |
Window of the transparency layer (see jo/transparency.h): selected by jo_3d_transparency_begin().
| #define JO_3D_MAX_GUARD_BAND |
Biggest guard band around the screen (pixels): the coordinates of the VDP1 are limited.
| #define JO_3D_NEAR_WINDOW |
Near window (default) for jo_3d_select_window().
| #define JO_3D_NO_OPTION |
Polygon option: no option.
| #define JO_3D_NO_TEXTURE |
No texture.
| #define JO_3D_NORMAL | ( | X, | |
| Y, | |||
| Z ) |
Polygon normal initializer.
| X | Normal X (float) |
| Y | Normal Y (float) |
| Z | Normal Z (float) |
| #define JO_3D_PLANE_VERTICES | ( | SIZE | ) |
Plane vertice table.
| #define JO_3D_QUAD_VERTEX_COUNT |
Vertex count of a quad (jo_3d_create_mesh_from_vertices() takes 4 vertices for each quad).
| #define JO_3D_SINGLE_PLANE |
Polygon hidden when seen from the back.
| #define JO_3D_SORT_CENTER |
Polygon sort: average depth of the 4 vertices.
| #define JO_3D_SORT_MASK |
Polygon sort mask.
| #define JO_3D_SORT_MAX |
Polygon sort: depth of the farthest vertex.
| #define JO_3D_SORT_MIN |
Polygon sort: depth of the nearest vertex.
| #define JO_3D_SORT_PREVIOUS |
Polygon sort: same depth as the previous polygon.
| #define JO_3D_TRIANGLE_VERTICES | ( | SIZE | ) |
Triangle vertice table.
| #define JO_3D_USE_LIGHT |
Polygon option: lighting (see jo_3d_light()).
| #define JO_3D_USE_PALETTE |
Polygon option: the color is a palette (no lighting).
| #define JO_3D_USE_TEXTURE |
Polygon option: textured polygon.
| #define JO_3D_VERTICES | ( | A, | |
| B, | |||
| C, | |||
| D ) |
Polygon vertices initializer.
| A | First vertex index |
| B | Second vertex index |
| C | Third vertex index |
| D | Fourth vertex index (same as C for a triangle) |
| typedef struct __jo_may_alias jo_3d_quad |
Quadrilateral shape structure.
| typedef jo_pos3D jo_vertice |
Vertice structure.
|
static |
Draw polygons using the current matrix (Internal usage).
| pdata | Polygon data (vertices, polygons and attributes) |
| 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 ) |
| bool __jo_3d_draw_ranges_from | ( | const jo_3d_polygon_data *const | pdata, |
| const unsigned int | first_point, | ||
| const unsigned int | point_count, | ||
| const jo_3d_polygon_range *const | ranges, | ||
| const int | range_count ) |
Draw polygons using the current matrix (Internal usage).
| pdata | Polygon data (vertices, polygons and attributes) |
| point_count | Number of points transformed (the first ones of pdata) |
| ranges | Ranges of polygons drawn (JO_NULL: all the polygons) |
| range_count | Number of ranges |
Draw some ranges of polygons whose points are known: only the points from first_point to point_count - 1 are transformed (see jo_3d_mesh_draw_ranges(); the chunks of the cells)
| first_point | First point used by the polygons of the ranges (none before it) |
| void __jo_3d_light | ( | const jo_pos3D_fixed *const | light | ) |
Set light direction (Internal usage).
| light | Light direction (unit vector) in the current matrix space |
| 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).
| camera | Camera position (x, y, z) |
| target | Point looked at by the camera (x, y, z) |
| angle | Rotation around the view axis |
| void __jo_3d_rotate | ( | const int | axis, |
| const jo_angle | angle ) |
Rotate the current matrix around an axis (Internal usage).
| axis | JO_3D_AXIS_X, JO_3D_AXIS_Y or JO_3D_AXIS_Z |
| angle | Rotation angle (0x10000 = 360 degrees) |
Scale the current matrix (Internal usage).
| x | Horizontal scale (JO_FIXED_1 = no scale) |
| y | Vertical scale (JO_FIXED_1 = no scale) |
| z | Depth scale (JO_FIXED_1 = no scale) |
| void __jo_3d_set_perspective | ( | const jo_angle | angle | ) |
Set perspective angle (Internal usage).
| angle | Horizontal field of view (0x4000 = 90 degrees) |
| bool __jo_3d_slave_draw_ranges_from | ( | const jo_3d_mesh *const | mesh, |
| const unsigned int | first_point, | ||
| const unsigned int | point_count, | ||
| const jo_3d_polygon_range *const | ranges, | ||
| const int | range_count ) |
jo_3d_slave_mesh_draw_ranges() with the points of the ranges known (see __jo_3d_draw_ranges_from())
Translate the current matrix (Internal usage).
| x | Horizontal translation |
| y | Vertical translation |
| z | Depth translation |
|
static |
Internal usage for polygon display.
| 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).
| tables | Colors (4 per table), or JO_NULL to only reserve the memory (black) |
| count | Table count |
|
static |
Add polygons to a list of ranges (see jo_3d_mesh_draw_ranges()): joined to the last range when they follow it.
| ranges | Ranges (room for one more) |
| range_count | Number of ranges (updated) |
| first | First polygon |
| count | Number of polygons (0 or less: nothing added) |
|
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) |
| 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).
| point_count | Point count |
| polygon_count | Polygon count |
|
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) |
| jo_3d_mesh * jo_3d_create_sphere | ( | const int | radius, |
| const unsigned int | slices, | ||
| const unsigned int | stacks ) |
Create a sphere (UV sphere).
| radius | Radius |
| slices | Number of vertical slices (around the Y axis, 3 minimum) |
| stacks | Number of horizontal stacks (from the top to the bottom, 2 minimum) |
| 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) |
| void jo_3d_disable_dsp | ( | void | ) |
Stop using the SCU DSP to transform the vertices (see jo_3d_enable_dsp()).
|
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 |
| 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...).
| sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga(), jo_sprite_add_bin(), etc |
| foot | Position of the bottom center of the sprite (world space, Q16.16) |
| width | Width (world units, Q16.16) |
| height | Height (world units, Q16.16) |
| sway | Horizontal offset of the top of the sprite (world units, Q16.16): wind |
| flip | Horizontal flip |
| void jo_3d_enable_dsp | ( | const bool | slave_cpu | ) |
Transform the vertices with the SCU DSP (the third processor of the Saturn).
| slave_cpu | false: for the objects drawn by the master CPU (jo_3d_mesh_draw(), etc), true: for the objects drawn by the slave CPU (jo_3d_slave_mesh_draw()) |
| void jo_3d_free_gouraud_tables | ( | const unsigned short | adr, |
| const unsigned int | count ) |
Give back gouraud tables of jo_3d_add_gouraud_tables() (jo_3d_free_model() gives back the tables of a model).
| adr | Address / 8 returned by jo_3d_add_gouraud_tables() |
| count | Table count given to jo_3d_add_gouraud_tables() |
| 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 the depth added to the polygons and sprites (see jo_3d_set_depth_bias()).
|
static |
Get displayed polygon count.
| void jo_3d_get_matrix | ( | jo_fixed * | m | ) |
Copy the current matrix.
| m | Output: 12 values, 4 rows of 3 values. Rows 0 to 2: the rotation (m[2], m[5], m[8] is the direction of the view in the world when the matrix only has the rotations of the camera), row 3: the translation |
|
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 the projection distance (distance of the projection plane, in pixels).
|
static |
Get sprite quad.
| sprite_id | Sprite Id returned by jo_sprite_add(), jo_sprite_add_tga() or jo_sprite_add_image_pack() |
| unsigned short jo_3d_get_tint | ( | void | ) |
The tint of the master CPU, packed (see jo_3d_set_tint()): 5 bits per component (signed, steps of 2), 0: none.
|
static |
Get vertice count.
| bool jo_3d_get_view_rect | ( | jo_3d_rect *const | rect | ) |
The rectangle of jo_3d_set_view_rect().
| rect | The rectangle (output) |
| 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).
| center | Center of the sphere in the view space (see jo_3d_transform_point()) |
| radius | Radius (Q16.16) |
| max_distance | Farthest distance (Q16.16) |
|
static |
Check the wireframe mode (see jo_3d_set_wireframe()).
|
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 |
Use a light source: its direction as a unit vector.
| x | X of the direction (Q16.16) |
| y | Y of the direction (Q16.16) |
| z | Z of the direction (Q16.16) |
| 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 most polygons are rejected by their plane).
| mesh | Mesh (its polygons don't change) |
|
static |
Draw a mesh.
| mesh | Address to a jo_3d_mesh allocated struct |
|
static |
Draw some ranges of polygons of a mesh, without copying them (the points are transformed once).
| mesh | Mesh |
| point_count | Number of points used by these polygons (the first points of the mesh are transformed). With all the points of the mesh, the points used by a few polygons are searched (only these ones are transformed); with fewer points, they are all transformed (the caller knows the points of its ranges) |
| ranges | Ranges of polygons |
| range_count | Number of ranges |
| 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).
| mesh | Mesh |
| center | Center of the sphere (output, in the space of the mesh, whole units) |
| 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...).
| mesh | Mesh |
| origin | Origin (in the space of the mesh) |
| dir | Direction (unit vector, in the space of the mesh) |
| best | Distance of the nearest hit (Q16.16): give the length of the ray, updated when a nearer polygon is hit |
| normal | Normal of the polygon hit (in the space of the mesh): updated |
| 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, faster)
| mesh | Mesh |
| planes | The planes of the mesh (see jo_3d_mesh_create_ray_planes()), JO_NULL: without them |
| origin | Origin (in the space of the mesh) |
| dir | Direction (unit vector, in the space of the mesh) |
| best | Distance of the nearest hit (Q16.16): give the length of the ray, updated when a nearer polygon is hit |
| normal | Normal of the polygon hit (in the space of the mesh): updated |
|
static |
Set the perspective angle.
| angle | Angle in degree (from 10 to 160) |
| void jo_3d_pop_matrix | ( | void | ) |
Pop 3D matrix.
| void jo_3d_prepare_tint | ( | const jo_3d_mesh *const | mesh | ) |
Make the tinted copy of the gouraud tables of a mesh for the current tint of the master CPU (see jo_3d_set_tint()), for the slave CPU to draw it with this tint (jo_3d_slave_set_tint()).
| mesh | Mesh |
| void jo_3d_push_matrix | ( | void | ) |
Push 3D 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 reflected view).
| normal | Normal of the plane (unit vector, world space) |
| distance | The plane is n.p = distance (world units, Q16.16) |
|
static |
Scale of 1 (nothing changes): the scale of jo_3d_set_scale() is in the current matrix, jo_3d_pop_matrix() restores the matrix before it (jo_3d_push_matrix(), jo_3d_set_scale(), draw, jo_3d_pop_matrix()).
|
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 jo_angle (0x10000 = 360 degrees: a fraction of degree, no float).
| x | X Angle |
| y | Y Angle |
| z | Z Angle |
|
static |
Rotate 3D matrix using jo_angle (X axis).
| x | X Angle (0x10000 = 360 degrees) |
|
static |
Rotate 3D matrix using jo_angle (Y axis).
| y | Y Angle (0x10000 = 360 degrees) |
|
static |
Rotate 3D matrix using jo_angle (Z axis).
| z | Z Angle (0x10000 = 360 degrees) |
|
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 |
Select the window used by jo_3d_window() and by the next drawings.
| window | JO_3D_NEAR_WINDOW, JO_3D_FAR_WINDOW, JO_3D_FAR_WINDOW_2 or JO_3D_LAYER_WINDOW |
|
static |
Set the color on the quadrilateral.
| quad | Address to a jo_3d_quad allocated struct |
| color | Color |
|
static |
Set a depth added to the polygons and sprites drawn after this call, to sort them (the farthest are drawn first).
| bias | Depth (units). For instance, in a first person game the world is drawn with a positive bias and the weapon without bias: the weapon is always over the world, even when a wall is nearer than the weapon |
The distances of the fade of the standing sprites (see jo_3d_set_sprite_fade()): opaque up to start, then JO_3D_FADE_LEVELS levels more and more transparent up to end (beyond: the most transparent; don't draw them).
| start | Depth of the start (world units, Q16.16) |
| end | Depth of the end (world units, Q16.16); end <= start: no fade (the default) |
| void jo_3d_set_fewer_parts | ( | const bool | enabled | ) |
Draw the polygons in parts only where it is needed to draw them at all (see jo_3d_set_texture_subdivision()): the polygons that cross the near plane, and those beyond the guard band in 2 x 2 parts only (see jo_3d_set_guard_band(); a bigger guard band keeps them few); not for the perspective of their texture, nor the big ones mostly out of the screen (the VDP1 draws their pixels out of the screen too).
| enabled | true: fewer parts (the CPU time of the parts saved), false: the default |
| 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, sorted among themselves with the depth divided by 2^shift (a rear-view mirror: its content is far away, but in front of the view of the camera; draw a background first).
| shift | The depth is divided by 2^shift (the sort keys of the layer stay small: 1 + z / 2^shift), -1: the normal sort again |
|
static |
Set the guard band around the screen used by the clipping of the polygons drawn after this call.
| pixels | Distance outside of the screen (0 to JO_3D_MAX_GUARD_BAND pixels). A polygon that goes further is clipped by the CPU (at the edges of the screen), a polygon that stays inside is drawn by the VDP1 as it is |
| void jo_3d_set_high_speed_shrink | ( | const bool | enabled | ) |
High speed shrink for every textured polygon drawn from now on (models, meshes, levels), whatever their own setting (default: on); can be changed at any time (a scene, a view).
| enabled | true: all of them, false: back to their own setting (jo_3d_set_mesh_high_speed_shrink(), the materials JO_3D_MATERIAL_HIGH_SPEED_SHRINK): a texture whose details of one texel must stay sharp far away (a small text) |
|
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_color_ex | ( | jo_3d_mesh *const | mesh, |
| const jo_color | color, | ||
| bool | wireframe ) |
Set the color on the mesh.
| mesh | Address to a jo_3d_mesh allocated struct |
| color | Color |
| wireframe | True to enable wireframe mode |
| 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_polygon_environment() show a tile of a picture of the surroundings, the tile of the direction of their normal in the view. The picture is cut in tiles x tiles tiles: the tile (i, j) is for the normals that point to the left (i = 0) or to the right (i = tiles - 1), up (j = 0) or down (j = tiles - 1): a sphere seen from the front (a "matcap"). The reflection moves on the object when the camera or the object turns.
| mesh | Mesh (the normals of its polygons are computed) |
| sprite_id | The picture (RGB, its width / tiles a multiple of 8 pixels) |
| tiles | Tiles on a side (4 to 8: more tiles, a smoother reflection on round objects) |
| unsigned short jo_3d_set_mesh_gouraud | ( | jo_3d_mesh *const | mesh, |
| const jo_color *const | tables ) |
Gouraud shading of the whole mesh: one table of 4 colors per polygon (a color per vertex, in the order of the vertices of the polygon), added to the VRAM (see jo_3d_add_gouraud_tables()).
| mesh | Address to a jo_3d_mesh allocated struct |
| tables | Colors: 4 per polygon (JO_COLOR_SATURN_RGB(16, 16, 16): the color of the polygon unchanged; the gouraud shading doesn't saturate: a component over 31 wraps around to the dark) |
| void jo_3d_set_mesh_high_speed_shrink | ( | jo_3d_mesh *const | mesh, |
| const bool | enabled ) |
Enable/Disable High Speed Shrink on the mesh.
| mesh | Address to a jo_3d_mesh allocated struct |
| enabled | true to enable High Speed Shrink |
| 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 |
| 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 tints the reflection (16: the picture as it is).
| mesh | Mesh |
| index | Polygon |
| void jo_3d_set_mesh_polygon_gouraud | ( | jo_3d_mesh *const | mesh, |
| const unsigned short | table, | ||
| const unsigned int | index ) |
Give a gouraud table to one polygon of the mesh (the color of each of its 4 vertices is added to its color).
| mesh | Address to a jo_3d_mesh allocated struct |
| table | Address / 8 of the table (see jo_3d_add_gouraud_tables()), JO_VDP1_NO_GOURAUD: no gouraud shading |
| index | polygon index on the mesh |
| 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.
| mesh | Address to a jo_3d_mesh allocated struct |
| enabled | true to enable High Speed Shrink |
| index | polygon index on the mesh |
| 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_texture_bank | ( | jo_3d_mesh *const | mesh, |
| const int | sprite_id, | ||
| const jo_palette *const | palette, | ||
| const int | bank, | ||
| const unsigned int | index ) |
Set a texture of 16 colors on one polygon, its colors taken in a bank of 16 colors of a palette (in place of its color lookup table): a polygon of the palette lighting (see jo_3d_set_palette_light()), or opaque over the half transparent water (the MSB of the colors of the palette cleared), or the same texture in other colors.
| mesh | Address to a jo_3d_mesh allocated struct |
| sprite_id | Sprite ID (16 colors: jo_sprite_add_4bits_lut(), jo_sprite_add_image_4bits_lut()) |
| palette | Palette (jo_create_palette()) |
| bank | Bank of 16 colors in the palette: 0 to 15 (the pixel of index i: the color bank * 16 + i of the palette) |
| index | polygon index on the mesh |
| void jo_3d_set_mesh_polygon_texture_palette | ( | jo_3d_mesh *const | mesh, |
| const int | sprite_id, | ||
| const jo_palette *const | palette, | ||
| const unsigned int | index ) |
Set a texture of 256 colors on one polygon, its colors taken in a palette (its pixel value n: the color n of the palette): opaque over a see-through bottom where the MSB of the colors is cleared, see jo_vdp2_blend_rgb_sprites_only().
| mesh | Address to a jo_3d_mesh allocated struct |
| sprite_id | Sprite ID (256 colors: jo_sprite_add_8bits_image(), jo_level_add_textures8()) |
| palette | Palette (jo_create_palette(), see jo_level_set_textures8_palette()) |
| 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) |
| 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 the screen.
| mirror | true in a reflected view (see jo_3d_reflect_matrix()), false after it |
| void jo_3d_set_packed_tint | ( | const unsigned short | tint | ) |
Tint the next meshes drawn by the master CPU (see jo_3d_set_tint()).
| tint | Packed tint (see jo_3d_get_tint()), 0: none |
|
static |
Set a palette on the quadrilateral.
| quad | Address to a jo_3d_quad allocated struct |
| palette_id | Palette id from jo_create_palette() |
| void jo_3d_set_palette_light | ( | const int | levels, |
| const int | stride ) |
Palette lighting (the light of jo_3d_light() without the RGB colors: the only lighting of the 640 and 704 pixels modes): a lit polygon of a palette color (or a texture of 16 colors with a color bank) takes the shade of its light, its color code + shade * stride (shade 0 = the darkest).
| levels | Shades of each color (2 to 32; 0 = off, the default) |
| stride | Color codes between 2 shades of a color (the count of jo_palette_set_light_shades(): the same for all the lit palette polygons) |
|
static |
Set the perspective angle using jo_angle (a fraction of degree, as slPerspective() of the SGL).
| angle | Angle (0x10000 = 360 degrees) from JO_DEG_TO_ANGLE(10) to JO_DEG_TO_ANGLE(160) |
|
static |
Fill the 4 vertices of a quad (a parallelogram) from its center and 2 half edges, in the order of JO_3D_PLANE_VERTICES(): center - right - down, center + right - down, center + right + down, center - right + down.
| vertices | The 4 vertices to fill (for instance a part of the table given to jo_3d_create_mesh_from_vertices()) |
| center | Center of the quad |
| right | Half of the edge from the first vertex to the second one (the top edge of the texture, left to right) |
| down | Half of the edge from the first vertex to the fourth one (the left edge of the texture, top to bottom) |
|
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 |
| bool jo_3d_set_sprite_fade | ( | const int | sprite_id, |
| const jo_palette *const | palette, | ||
| const int | bank ) |
A standing sprite that fades with the distance (see jo_3d_set_fade_distances()): its 16 colors copied in a bank of a palette, used beyond the start of the fade.
| sprite_id | A 16 colors texture with its color lookup table (jo_sprite_add_image_4bits_lut()); its smaller copies too |
| palette | Palette of the bank (jo_create_palette()); JO_NULL: the sprite no longer fades |
| bank | Bank of 16 colors in the palette: 1 to 15 (its colors bank * 16 + 1 to bank * 16 + 15 of the palette) |
|
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 |
| bool jo_3d_set_texture_mipmap_copies | ( | const int | sprite_id, |
| const int | half_id, | ||
| const int | levels ) |
Give a texture its smaller copies made beforehand (see jo_3d_set_texture_mipmaps()): for the textures it can't reduce itself (256 colors: their palette is chosen per polygon), or reduced better by a tool (the averages in the colors of the palette, a mean color searched among 255 at the loading took seconds).
| sprite_id | Texture |
| half_id | The copy of half size (width and height), added after the texture; the copy of quarter size: the sprite after it |
| levels | 1: the half size only, 2: the half and quarter sizes |
| 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 small.
| sprite_id | Texture (RGB sprite, width multiple of 16: half size, of 32: quarter size too) |
| 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, each part with its tile of the texture).
| sprite_id | Texture (RGB, 256 colors or 16 colors sprite, width multiple of 16: 2 x 2 tiles, of 32: 4 x 4 tiles too; a 256 colors tile is drawn with the bank of the polygon: its palette) |
| 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 vertex is nearer than a depth: the ground next to the camera, where its texture slides the most (farther, the parts cost CPU time for little).
| sprite_id | Texture (see jo_3d_set_texture_subdivision()) |
| depth | Depth in the view space (fixed), 0: all the polygons (default) |
| 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()): a pattern with straight lines (a tiled floor) shows the distortion more, the lines bend where a part meets a whole polygon.
| sprite_id | Texture (see jo_3d_set_texture_subdivision()) |
| pixels | Distortion (pixels on the screen, 1 to 255), 0: the default (8). 4: the lines of a tiled floor stay straight; about 1 ms more for each CPU in a room of a level (more polygons drawn in parts) |
| bool jo_3d_set_texture_subdivision_fine | ( | const int | sprite_id | ) |
Add finer tiles to the tiles of a texture (see jo_3d_set_texture_subdivision()): 8 x 8 and 16 x 16 tiles, for the parts of its polygons cut in 4 x 4 parts that cross the near plane, go very far outside of the screen, are big and partly out of the screen, or still distorted by the perspective. The last tile of a part through the near plane, or with its lines pulled in to the screen (VDP1 time), is drawn whole on what is seen of it (the VDP1 can't start a texture at any column): its texture is squeezed by up to a tile, 8 texels of a 32 x 32 texture with the 4 x 4 tiles, 2 with the 16 x 16 tiles. For a texture magnified near the camera (texels of more than about 10 pixels: a texture of a few texels on a big wall, a big floor).
| sprite_id | Texture (RGB, 256 colors or 16 colors sprite, width and height multiples of 16) |
| 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 outside of the screen) are drawn in parts: a model already cut in small quads when it was made keeps its quads as they are, the parts of a quad next to a whole quad overlapped it.
| sprite_id | Texture (see jo_3d_set_texture_subdivision()) |
| 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 of a lamp on a character, see jo_3d_point_lights_sample()), jo_3d_set_tint(0, 0, 0) to stop.
| r | Red added (gouraud units, -31 to 31, steps of 2) |
| g | Green added |
| b | Blue added |
|
static |
Enable/Disable transparency on the quadrilateral.
| quad | Address to a jo_3d_quad allocated struct |
| enabled | true to enable transparency |
| 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 spheres outside of it (the camera is in a building: the outside is seen only through its door, see jo_cells_outside_view()).
| rect | Rectangle (left > right: nothing is seen, but the spheres around the camera), JO_NULL: the whole screen |
|
static |
The windows do not overlap (a split screen: a view per player in its window): the commands of each window are drawn together, window after window (window 0 first), sorted by depth in their window; else (default) the commands of all the windows are sorted together by depth (a mirror in the view: its window over the other one).
| apart | true: the windows drawn one after the other |
|
static |
Wireframe mode: the polygons and the standing sprites (distorted sprites) are drawn as their outline, in one color; the normal and scaled sprites (a HUD for instance) are drawn as they are.
| enabled | true: wireframe, false: normal drawing |
| 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()).
| 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_sprite()).
| sprite_id | Sprite Id |
| foot | Position of the bottom center of the sprite (world space, Q16.16) |
| width | Width (world units, Q16.16) |
| height | Height (world units, Q16.16) |
| sway | Horizontal offset of the top of the sprite (world units, Q16.16): wind |
| flip | Horizontal flip |
| 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_for_slave()).
| int jo_3d_slave_get_command_count | ( | void | ) |
VDP1 commands used by the slave CPU in the last frame (see jo_3d_slave_end()).
| 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 false).
| int jo_3d_slave_get_max_vertices | ( | void | ) |
Points of the biggest object the slave CPU can draw (a bigger object is not drawn).
| 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 jo_3d_slave_begin() (the master CPU can change it while the slave CPU draws)
| center | Center of the sphere in the view space (see jo_3d_slave_transform_point()) |
| radius | Radius (Q16.16) |
| max_distance | Farthest distance (Q16.16) |
|
static |
Draw a mesh on the slave CPU (call it on the slave CPU, between jo_3d_slave_begin() and jo_3d_slave_end()).
| mesh | Mesh (1024 points at most, JO_3D_SLAVE_MAX_VERTICES) |
| 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_ranges()).
| mesh | Mesh |
| point_count | Number of points used by these polygons (1024 at most) |
| ranges | Ranges of polygons |
| range_count | Number of ranges |
| 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()).
| 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()).
| 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 slow turn (a big wheel, a fan) moves by less than a degree per frame.
| axis | JO_3D_AXIS_X, JO_3D_AXIS_Y or JO_3D_AXIS_Z |
| angle | Angle (jo_angle: 65536 = 360 degrees) |
| 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()).
| x | X angle (degrees) |
| y | Y angle (degrees) |
| z | Z angle (degrees) |
| void jo_3d_slave_select_window | ( | const int | window | ) |
Select the window of the next drawings of the slave CPU (call it on the slave CPU; jo_3d_slave_begin() selects the window of the master CPU, see jo_3d_select_window()).
| window | JO_3D_NEAR_WINDOW, JO_3D_FAR_WINDOW, JO_3D_FAR_WINDOW_2 or JO_3D_LAYER_WINDOW |
| 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).
| bias | Depth (see jo_3d_set_depth_bias()) |
The distances of the fade of the standing sprites of the slave CPU (see jo_3d_set_fade_distances()), until the next jo_3d_slave_begin() (call it on the slave CPU).
| start | Depth of the start (world units, Q16.16) |
| end | Depth of the end (world units, Q16.16); end <= start: no fade |
| 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, see jo_3d_set_guard_band()).
| pixels | Distance outside of the screen (0 to JO_3D_MAX_GUARD_BAND) |
| 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 the slave CPU don't take them. Without it, a frame full of polygons left no room for the HUD (and JO_DEBUG stopped the game: "Too many VDP1 commands in a frame").
| count | Commands (0 by default) |
Scale the matrix of the slave CPU (call it on the slave CPU, see jo_3d_set_scale_fixed()).
| x | X scale (Q16.16) |
| y | Y scale (Q16.16) |
| z | Z scale (Q16.16) |
| void jo_3d_slave_set_tint | ( | const unsigned short | tint | ) |
Tint the next meshes drawn by the slave CPU (call it on the slave CPU).
| tint | Packed tint (see jo_3d_get_tint()), 0: none |
| 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()).
| in | Point |
| out | Transformed point (output) |
Translate the matrix of the slave CPU (call it on the slave CPU, see jo_3d_translate_matrix_fixed()).
| x | X (Q16.16) |
| y | Y (Q16.16) |
| z | Z (Q16.16) |
| 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, after jo_3d_camera_look_at() or the rotations and translations of the camera).
| in | Point |
| out | Transformed point (output) |
| void jo_3d_transform_point_by | ( | const jo_fixed(*) | 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).
| m | Matrix: 4 rows of 3 (the 3 axes, then the translation), for instance the matrix of a bone (see jo_3d_bone_callback) |
| in | Point |
| out | Transformed point (output) |
|
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 |
|
static |
The 3D polygons drawn in the current window are clipped by the VDP1 to its rectangle (user clipping: a mirror, a rear-view mirror, a view of a split screen), or not (default: the whole screen).
| clip | true: clipped to the rectangle of jo_3d_window() |
|
extern |
Displayed polygon count of the current frame (Internal usage).
|
extern |
Guard band (internal engine usage, see jo_3d_set_guard_band()).
|
extern |
Polygon count of the current frame (Internal usage).
|
extern |
Vertice count of the current frame (Internal usage).
|
extern |
Sprite quads (internal engine usage): a quad per sprite, the table allocated with the first quad (JO_NULL: none).