Jo Engine 2026.11.1
Jo Sega Saturn Engine
Loading...
Searching...
No Matches
3d.h
Go to the documentation of this file.
1/*
2** Jo Sega Saturn Engine
3** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4** All rights reserved.
5**
6** Redistribution and use in source and binary forms, with or without
7** modification, are permitted provided that the following conditions are met:
8** * Redistributions of source code must retain the above copyright
9** notice, this list of conditions and the following disclaimer.
10** * Redistributions in binary form must reproduce the above copyright
11** notice, this list of conditions and the following disclaimer in the
12** documentation and/or other materials provided with the distribution.
13** * Neither the name of the Johannes Fetz nor the
14** names of its contributors may be used to endorse or promote products
15** derived from this software without specific prior written permission.
16**
17** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
34
35#ifndef __JO_3D_H__
36# define __JO_3D_H__
37
38#ifdef JO_COMPILE_WITH_3D_SUPPORT
39
41# define JO_3D_PLANE_VERTICES(SIZE) \
42{ \
43 { -SIZE, -SIZE, 0 }, \
44 { SIZE, -SIZE, 0 }, \
45 { SIZE, SIZE, 0 }, \
46 { -SIZE, SIZE, 0 } \
47}
48
50# define JO_3D_TRIANGLE_VERTICES(SIZE) \
51{ \
52 { -SIZE, -SIZE, 0 }, \
53 { SIZE, -SIZE, 0 }, \
54 { SIZE, SIZE, 0 } \
55}
56
58# define JO_3D_CUBE_VERTICES(SIZE) \
59{ \
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 } \
84}
85
88
90# define JO_3D_DEFAULT_PERSPECTIVE_ANGLE (90)
91
93# define JO_3D_DEFAULT_DISPLAY_LEVEL (3)
94
95/*
96** 3D model data
97*/
98
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)
109
111# define JO_3D_SINGLE_PLANE (0)
113# define JO_3D_DUAL_PLANE (1)
114
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)
125
127typedef struct
128{
129 jo_pos3D_fixed normal; // Normal vector (unit vector) used for lighting
130 unsigned short vertices[4]; // Vertex indexes
132
134typedef struct
135{
136 unsigned char plane; // JO_3D_SINGLE_PLANE or JO_3D_DUAL_PLANE
137 unsigned char sort; // JO_3D_SORT_xxx | JO_3D_USE_xxx options
138 unsigned short texture_id; // Sprite id
139 unsigned short draw_mode; // JO_VDP1_COLOR_MODE_xxx | JO_VDP1_COLOR_CALC_xxx | ...
140 unsigned short color; // RGB color or palette
141 unsigned short gouraud_table; // Gouraud table address / 8
142 unsigned short direction; // JO_VDP1_FUNCTION_xxx | flip
144
154
156typedef struct
157{
158 unsigned short first; // Index of the first polygon
159 unsigned short count; // Number of polygons
161
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)}
175
181# define JO_3D_NORMAL(X, Y, Z) {JO_FLOAT_TO_FIXED(X), JO_FLOAT_TO_FIXED(Y), JO_FLOAT_TO_FIXED(Z)}
182
189# define JO_3D_VERTICES(A, B, C, D) {(A), (B), (C), (D)}
190
192typedef struct
193{
194 union
195 {
198 };
199 union
200 {
201 jo_fixed target[3];
203 };
205} jo_camera;
206
213
215typedef struct
216{
218} jo_3d_mesh;
219
223extern jo_3d_quad *__jo_sprite_quad[JO_MAX_SPRITE];
224bool jo_3d_create_sprite_quad(const int sprite_id);
225
226
227/*
228 ██████╗ █████╗ ███╗ ███╗███████╗██████╗ █████╗
229██╔════╝██╔══██╗████╗ ████║██╔════╝██╔══██╗██╔══██╗
230██║ ███████║██╔████╔██║█████╗ ██████╔╝███████║
231██║ ██╔══██║██║╚██╔╝██║██╔══╝ ██╔══██╗██╔══██║
232╚██████╗██║ ██║██║ ╚═╝ ██║███████╗██║ ██║██║ ██║
233 ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
234
235*/
236
237/*
238** Internal usage
239*/
241extern unsigned short __jo_3d_polygon_count;
243extern unsigned short __jo_3d_vertice_count;
245extern unsigned short __jo_3d_displayed_polygon_count;
252void __jo_3d_look_at(const jo_fixed * const camera, const jo_fixed * const target, const jo_angle angle);
258void __jo_3d_translate(const jo_fixed x, const jo_fixed y, const jo_fixed z);
264void __jo_3d_scale(const jo_fixed x, const jo_fixed y, const jo_fixed z);
266# define JO_3D_AXIS_X (0)
268# define JO_3D_AXIS_Y (1)
270# define JO_3D_AXIS_Z (2)
275void __jo_3d_rotate(const int axis, const jo_angle angle);
280void __jo_3d_light(const jo_pos3D_fixed * const light);
293void jo_3d_set_front_layer(const int shift);
294
296typedef struct
297{
298 jo_fixed (*matrix)[3]; // 4 rows of 3 (the matrix of the camera and of the part)
299 unsigned short first; // First point
300 unsigned short count; // Number of points
301} jo_3d_part;
302
310bool __jo_3d_draw_parts(const jo_3d_polygon_data * const pdata, const jo_3d_part * const parts,
311 const int part_count);
312
321bool __jo_3d_draw_ranges(const jo_3d_polygon_data * const pdata, const unsigned int point_count,
322 const jo_3d_polygon_range * const ranges, const int range_count);
323
328static __jo_force_inline bool __jo_3d_draw(const jo_3d_polygon_data * const pdata)
329{
330 return (__jo_3d_draw_ranges(pdata, pdata->point_count, JO_NULL, 0));
331}
332
339static __jo_force_inline void jo_3d_camera_set_viewpoint(jo_camera * const cam, const int x, const int y, const int z)
340{
341 cam->viewpoint_pos.x = JO_MULT_BY_65536(x);
342 cam->viewpoint_pos.y = JO_MULT_BY_65536(y);
343 cam->viewpoint_pos.z = JO_MULT_BY_65536(z);
344}
345
352static __jo_force_inline void jo_3d_camera_set_target(jo_camera * const cam, const int x, const int y, const int z)
353{
354 cam->target_pos.x = JO_MULT_BY_65536(x);
355 cam->target_pos.y = JO_MULT_BY_65536(y);
356 cam->target_pos.z = JO_MULT_BY_65536(z);
357}
358
363static __jo_force_inline void jo_3d_camera_set_z_angle(jo_camera * const cam, const int angle)
364{
365 cam->z_angle = jo_DEGtoANG_int(angle);
366}
367
372{
373 jo_3d_camera_set_viewpoint(cam, 0, 0, -150);
374 jo_3d_camera_set_target(cam, 0, 0, 0);
376}
377
382{
383 __jo_3d_look_at(cam->viewpoint, cam->target, cam->z_angle);
384}
385
386/*
387███████╗████████╗ █████╗ ████████╗██╗███████╗████████╗██╗ ██████╗███████╗
388██╔════╝╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔════╝╚══██╔══╝██║██╔════╝██╔════╝
389███████╗ ██║ ███████║ ██║ ██║███████╗ ██║ ██║██║ ███████╗
390╚════██║ ██║ ██╔══██║ ██║ ██║╚════██║ ██║ ██║██║ ╚════██║
391███████║ ██║ ██║ ██║ ██║ ██║███████║ ██║ ██║╚██████╗███████║
392╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
393
394*/
395
401{
402 return (__jo_3d_polygon_count);
403}
404
410{
411 return (__jo_3d_vertice_count);
412}
413
422
423/*
424 ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ ███████╗██╗███╗ ███╗██████╗ ██╗ ███████╗
425██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ ██╔════╝██║████╗ ████║██╔══██╗██║ ██╔════╝
426██║ ██████╔╝█████╗ ███████║ ██║ █████╗ ███████╗██║██╔████╔██║██████╔╝██║ █████╗
427██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ ╚════██║██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝
428╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ ███████║██║██║ ╚═╝ ██║██║ ███████╗███████╗
429 ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝
430
431 ██████╗ ██████╗ ██╗███████╗ ██████╗████████╗
432██╔═══██╗██╔══██╗ ██║██╔════╝██╔════╝╚══██╔══╝
433██║ ██║██████╔╝ ██║█████╗ ██║ ██║
434██║ ██║██╔══██╗██ ██║██╔══╝ ██║ ██║
435╚██████╔╝██████╔╝╚█████╔╝███████╗╚██████╗ ██║
436 ╚═════╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝
437
438*/
439
448jo_3d_mesh *jo_3d_create_mesh_from_vertices_and_normals(const unsigned int quad_count, jo_vertice * const vertices, jo_vector * const normals);
449
456static __jo_force_inline jo_3d_mesh *jo_3d_create_mesh_from_vertices(const unsigned int quad_count, jo_vertice * const vertices)
457{
458 return (jo_3d_create_mesh_from_vertices_and_normals(quad_count, vertices, JO_NULL));
459}
460
466static __jo_force_inline jo_3d_mesh *jo_3d_create_mesh(const unsigned int quad_count)
467{
469}
470
482jo_3d_mesh *jo_3d_create_sphere(const int radius, const unsigned int slices, const unsigned int stacks);
483
488void jo_3d_free_mesh(const jo_3d_mesh * const mesh);
489
494void jo_3d_create_plane(jo_3d_quad * const quad, jo_vertice * const vertices);
495
500void jo_3d_create_cube(jo_3d_quad * array, jo_vertice * const vertices);
501
506void jo_3d_create_triangle(jo_3d_quad * const quad, jo_vertice * const vertices);
507
513{
514 return (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id) ? JO_NULL : __jo_sprite_quad[sprite_id]);
515}
516
520void jo_3d_free_sprite_quad(const int sprite_id);
521
522/*
523███╗ ███╗███████╗███████╗██╗ ██╗ ████████╗███████╗██╗ ██╗████████╗██╗ ██╗██████╗ ███████╗
524████╗ ████║██╔════╝██╔════╝██║ ██║ ╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝██║ ██║██╔══██╗██╔════╝
525██╔████╔██║█████╗ ███████╗███████║ ██║ █████╗ ╚███╔╝ ██║ ██║ ██║██████╔╝█████╗
526██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ██║ ██╔══╝ ██╔██╗ ██║ ██║ ██║██╔══██╗██╔══╝
527██║ ╚═╝ ██║███████╗███████║██║ ██║ ██║ ███████╗██╔╝ ██╗ ██║ ╚██████╔╝██║ ██║███████╗
528╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
529
530*/
531
537void jo_3d_set_mesh_polygon_texture(jo_3d_mesh * const mesh, const int sprite_id, const unsigned int index);
538
543void jo_3d_set_mesh_texture(jo_3d_mesh * const mesh, const int sprite_id);
544
549static __jo_force_inline void jo_3d_set_texture(jo_3d_quad * const quad, const int sprite_id)
550{
551 jo_3d_set_mesh_polygon_texture((jo_3d_mesh *)quad, sprite_id, 0);
552}
553
559void jo_3d_set_mesh_polygon_wireframe(jo_3d_mesh * const mesh, const unsigned int index, bool wireframe);
560
561/*
562 8 BITS PALETTE HANDLING
563*/
564
570static __jo_force_inline void jo_3d_set_mesh_polygon_palette(jo_3d_mesh * const mesh, const int palette_id, const unsigned int index)
571{
572 mesh->data.attributes[index].color = JO_MULT_BY_256(palette_id);
573}
574
579static __jo_force_inline void jo_3d_set_mesh_palette(jo_3d_mesh * const mesh, const int palette_id)
580{
581 for (unsigned int i = 0; i < mesh->data.polygon_count; ++i)
582 jo_3d_set_mesh_polygon_palette(mesh, palette_id, i);
583}
584
589static __jo_force_inline void jo_3d_set_palette(jo_3d_quad * const quad, const int palette_id)
590{
591 quad->attribute.color = JO_MULT_BY_256(palette_id);
592}
593
599static __jo_force_inline bool jo_3d_set_sprite_palette(const int sprite_id, const int palette_id)
600{
601 if (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id)) return (false);
602 jo_3d_set_palette(__jo_sprite_quad[sprite_id], palette_id);
603 return (true);
604}
605
611void jo_3d_set_mesh_polygon_high_speed_shrink(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
612
617void jo_3d_set_mesh_high_speed_shrink(jo_3d_mesh * const mesh, const bool enabled);
618
619/*
620███╗ ███╗███████╗███████╗██╗ ██╗ ██╗ ██╗███████╗██████╗ ████████╗██╗ ██████╗███████╗ ██╗ ███╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ██╗
621████╗ ████║██╔════╝██╔════╝██║ ██║ ██║ ██║██╔════╝██╔══██╗╚══██╔══╝██║██╔════╝██╔════╝ ██║ ████╗ ██║██╔═══██╗██╔══██╗████╗ ████║██╔══██╗██║
622██╔████╔██║█████╗ ███████╗███████║ ██║ ██║█████╗ ██████╔╝ ██║ ██║██║ █████╗ ████████╗ ██╔██╗ ██║██║ ██║██████╔╝██╔████╔██║███████║██║
623██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ╚██╗ ██╔╝██╔══╝ ██╔══██╗ ██║ ██║██║ ██╔══╝ ██╔═██╔═╝ ██║╚██╗██║██║ ██║██╔══██╗██║╚██╔╝██║██╔══██║██║
624██║ ╚═╝ ██║███████╗███████║██║ ██║ ╚████╔╝ ███████╗██║ ██║ ██║ ██║╚██████╗███████╗ ██████║ ██║ ╚████║╚██████╔╝██║ ██║██║ ╚═╝ ██║██║ ██║███████╗
625╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
626*/
627
635static __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)
636{
637 mesh->data.points[index].x = x;
638 mesh->data.points[index].y = y;
639 mesh->data.points[index].z = z;
640}
641
649static __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)
650{
651 mesh->data.polygons[index].normal.x = x;
652 mesh->data.polygons[index].normal.y = y;
653 mesh->data.polygons[index].normal.z = z;
654}
655
656/*
657███╗ ███╗███████╗███████╗██╗ ██╗ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗
658████╗ ████║██╔════╝██╔════╝██║ ██║ ██║ ██║██╔════╝ ██║ ██║╚══██╔══╝
659██╔████╔██║█████╗ ███████╗███████║ ██║ ██║██║ ███╗███████║ ██║
660██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ██║ ██║██║ ██║██╔══██║ ██║
661██║ ╚═╝ ██║███████╗███████║██║ ██║ ███████╗██║╚██████╔╝██║ ██║ ██║
662╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
663
664*/
665
671static __jo_force_inline void jo_3d_light(const int x, const int y, const int z)
672{
674
675 p.x = JO_MULT_BY_65536(x);
676 p.y = JO_MULT_BY_65536(y);
677 p.z = JO_MULT_BY_65536(z);
678 __jo_3d_light(&p);
679}
680
686void jo_3d_set_mesh_polygon_light(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
687
692void jo_3d_set_mesh_light(jo_3d_mesh * const mesh, const bool enabled);
693
698static __jo_force_inline void jo_3d_set_light(jo_3d_quad *const quad, const bool enabled)
699{
700 jo_3d_set_mesh_polygon_light((jo_3d_mesh *)quad, enabled, 0);
701}
702
703/*
704████████╗██████╗ █████╗ ███╗ ██╗███████╗██████╗ █████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ ██╗
705╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝
706 ██║ ██████╔╝███████║██╔██╗ ██║███████╗██████╔╝███████║██████╔╝█████╗ ██╔██╗ ██║██║ ╚████╔╝
707 ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██╔═══╝ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ╚██╔╝
708 ██║ ██║ ██║██║ ██║██║ ╚████║███████║██║ ██║ ██║██║ ██║███████╗██║ ╚████║╚██████╗ ██║
709 ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝
710
711*/
712
718void jo_3d_set_mesh_polygon_transparency(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
719
724void jo_3d_set_mesh_transparency(jo_3d_mesh * const mesh, const bool enabled);
725
730static __jo_force_inline void jo_3d_set_transparency(jo_3d_quad *const quad, const bool enabled)
731{
733}
734
735/******************************************************
736* SCREEN DOORS TRANSPARENCY
737*******************************************************/
738
744void jo_3d_set_mesh_polygon_screen_doors(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
745
750void jo_3d_set_mesh_screen_doors(jo_3d_mesh * const mesh, const bool enabled);
751
756static __jo_force_inline void jo_3d_set_screen_doors(jo_3d_quad *const quad, const bool enabled)
757{
759}
760
761/*
762 ██████╗ ██████╗ ██╗ ██████╗ ██████╗ ███████╗
763██╔════╝██╔═══██╗██║ ██╔═══██╗██╔══██╗██╔════╝
764██║ ██║ ██║██║ ██║ ██║██████╔╝███████╗
765██║ ██║ ██║██║ ██║ ██║██╔══██╗╚════██║
766╚██████╗╚██████╔╝███████╗╚██████╔╝██║ ██║███████║
767 ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
768
769*/
770
777void jo_3d_set_mesh_polygon_color_ex(jo_3d_mesh * const mesh, const jo_color color, const unsigned int index, bool wireframe);
778
784static __jo_force_inline void jo_3d_set_mesh_polygon_color(jo_3d_mesh * const mesh, const jo_color color, const unsigned int index)
785{
786 jo_3d_set_mesh_polygon_color_ex(mesh, color, index, false);
787}
788
793void jo_3d_set_mesh_color(jo_3d_mesh * const mesh, const jo_color color);
794
800void jo_3d_set_mesh_color_ex(jo_3d_mesh * const mesh, const jo_color color, bool wireframe);
801
806static __jo_force_inline void jo_3d_set_color(jo_3d_quad * const quad, const jo_color color)
807{
808 jo_3d_set_mesh_polygon_color((jo_3d_mesh *)quad, color, 0);
809}
810
811/*
812███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗
813████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝
814██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝
815██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗
816██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗
817╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝
818*/
819
823
827
828/*
829███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗ ██████╗ ██████╗ ████████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
830████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝ ██╔══██╗██╔═══██╗╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
831██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝ ██████╔╝██║ ██║ ██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
832██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗ ██╔══██╗██║ ██║ ██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
833██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗ ██║ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
834╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
835
836*/
837
843static __jo_force_inline void jo_3d_rotate_matrix(short x, short y, short z)
844{
845 __jo_3d_rotate(JO_3D_AXIS_X, jo_DEGtoANG_int(x));
846 __jo_3d_rotate(JO_3D_AXIS_Y, jo_DEGtoANG_int(y));
847 __jo_3d_rotate(JO_3D_AXIS_Z, jo_DEGtoANG_int(z));
848}
849
854{
855 __jo_3d_rotate(JO_3D_AXIS_X, jo_DEGtoANG_int(x));
856}
857
862{
863 __jo_3d_rotate(JO_3D_AXIS_Y, jo_DEGtoANG_int(y));
864}
865
870{
871 __jo_3d_rotate(JO_3D_AXIS_Z, jo_DEGtoANG_int(z));
872}
873
885
893
901
909
910/*
911███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗ ████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
912████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝ ╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
913██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝ ██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
914██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗ ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
915██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗ ██║ ██║ ██║██║ ██║██║ ╚████║███████║███████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
916╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
917
918*/
919
929
939
945static __jo_force_inline void jo_3d_translate_matrix(int x, int y, int z)
946{
947 __jo_3d_translate(jo_int2fixed(x), jo_int2fixed(y), jo_int2fixed(z));
948}
949
954{
955 __jo_3d_translate(jo_int2fixed(x), 0, 0);
956}
957
962{
963 __jo_3d_translate(0, jo_int2fixed(y), 0);
964}
965
970{
971 __jo_3d_translate(0, 0, jo_int2fixed(z));
972}
973
974/*
975██████╗ ██████╗ █████╗ ██╗ ██╗██╗███╗ ██╗ ██████╗
976██╔══██╗██╔══██╗██╔══██╗██║ ██║██║████╗ ██║██╔════╝
977██║ ██║██████╔╝███████║██║ █╗ ██║██║██╔██╗ ██║██║ ███╗
978██║ ██║██╔══██╗██╔══██║██║███╗██║██║██║╚██╗██║██║ ██║
979██████╔╝██║ ██║██║ ██║╚███╔███╔╝██║██║ ╚████║╚██████╔╝
980╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
981
982*/
983
988{
989 __jo_3d_draw(&quad->data);
990}
991
996{
997 __jo_3d_draw(&mesh->data);
998}
999
1009static __jo_force_inline bool jo_3d_mesh_draw_ranges(const jo_3d_mesh * const mesh, const unsigned int point_count,
1010 const jo_3d_polygon_range * const ranges, const int range_count)
1011{
1012 return (__jo_3d_draw_ranges(&mesh->data, point_count, ranges, range_count));
1013}
1014
1020{
1021 return mesh->data.polygon_count;
1022}
1023
1028{
1029 jo_3d_draw((jo_3d_quad * const)node->data.ptr);
1030}
1031
1036{
1037 jo_list_foreach(list, __jo_poylgon_draw_iterator);
1038}
1039
1044static __jo_force_inline void jo_3d_draw_array(jo_3d_quad * const array, int array_size)
1045{
1046 while (--array_size >= 0) jo_3d_draw(array + array_size);
1047}
1048
1053static __jo_force_inline bool jo_3d_draw_sprite(const int sprite_id)
1054{
1055 if (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id)) return (false);
1056 jo_3d_draw(__jo_sprite_quad[sprite_id]);
1057 return (true);
1058}
1059
1066static __jo_force_inline void jo_3d_draw_sprite_at(const int sprite_id, const int x, const int y, const int z)
1067{
1069 jo_3d_translate_matrix(x, y, z);
1070 jo_3d_draw_sprite(sprite_id);
1072}
1073
1080static __jo_force_inline void jo_3d_draw_billboard(const int sprite_id, const int x, const int y, const int z)
1081{
1082 extern jo_pos3D __jo_sprite_pos;
1083 __internal_jo_sprite_set_position3D(x, y, z);
1084 jo_sprite_draw(sprite_id, &__jo_sprite_pos, true, true);
1085}
1086
1094static __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)
1095{
1096 if (scale == 1)
1097 jo_3d_draw_billboard(sprite_id, x, y, z);
1098 else
1099 {
1100 extern jo_pos3D __jo_sprite_pos;
1101 __internal_jo_sprite_set_position3D(x, y, z);
1104 __jo_sprite_attributes.fixed_scale_x = jo_int2fixed(scale);
1105 __jo_sprite_attributes.fixed_scale_y = jo_int2fixed(scale);
1106 jo_sprite_draw(sprite_id, &__jo_sprite_pos, true, true);
1107 __jo_sprite_attributes.fixed_scale_x = previous_scale_x;
1108 __jo_sprite_attributes.fixed_scale_y = previous_scale_y;
1109 }
1110}
1111
1112/*
1113███████╗ ██████╗ █████╗ ██╗ ███████╗
1114██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
1115███████╗██║ ███████║██║ █████╗
1116╚════██║██║ ██╔══██║██║ ██╔══╝
1117███████║╚██████╗██║ ██║███████╗███████╗
1118╚══════╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝
1119
1120*/
1121
1127static __jo_force_inline void jo_3d_set_scalef(const float x, const float y, const float z)
1128{
1130}
1131
1137static __jo_force_inline void jo_3d_set_scale(const int x, const int y, const int z)
1138{
1140}
1141
1148{
1149 __jo_3d_scale(x, y, z);
1150}
1151
1158
1159/*
1160██╗ ██╗██╗███╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗███████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗
1161██║ ██║██║████╗ ██║██╔══██╗██╔═══██╗██║ ██║ ██║ ██╔══██╗██╔══██╗██╔═══██╗ ██║██╔════╝██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║
1162██║ █╗ ██║██║██╔██╗ ██║██║ ██║██║ ██║██║ █╗ ██║ ████████╗ ██████╔╝██████╔╝██║ ██║ ██║█████╗ ██║ ██║ ██║██║ ██║██╔██╗ ██║
1163██║███╗██║██║██║╚██╗██║██║ ██║██║ ██║██║███╗██║ ██╔═██╔═╝ ██╔═══╝ ██╔══██╗██║ ██║██ ██║██╔══╝ ██║ ██║ ██║██║ ██║██║╚██╗██║
1164╚███╔███╔╝██║██║ ╚████║██████╔╝╚██████╔╝╚███╔███╔╝ ██████║ ██║ ██║ ██║╚██████╔╝╚█████╔╝███████╗╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║
1165 ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
1166
1167*/
1168
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)
1180{
1181 __jo_vdp1_set_window(left, top, right, bottom, z_limit, center_x, center_y);
1182 return (true);
1183}
1184
1193
1195# define JO_3D_NEAR_WINDOW (0)
1196
1198# define JO_3D_FAR_WINDOW (1)
1199
1201# define JO_3D_FAR_WINDOW_2 (2)
1202
1206static __jo_force_inline void jo_3d_select_window(const int window)
1207{
1208 __jo_vdp1_select_window(window);
1209}
1210
1214static __jo_force_inline void jo_3d_perspective_angle(const int angle)
1215{
1216#if JO_DEBUG
1217 if (angle < 10 || angle > 160)
1218 jo_core_error("Valid angle range is 10 to 160");
1219#endif
1220 __jo_3d_set_perspective(jo_DEGtoANG_int(angle));
1221}
1222
1226static __jo_force_inline void jo_3d_display_level(const unsigned short level)
1227{
1229 __jo_vdp1_update_near_clip();
1230}
1231
1241void jo_3d_enable_dsp(const bool slave_cpu);
1242
1245
1247# define JO_3D_MAX_GUARD_BAND (512)
1250# define JO_3D_DEFAULT_GUARD_BAND (JO_3D_MAX_GUARD_BAND)
1251
1253extern int __jo_3d_guard_band;
1254
1266static __jo_force_inline void jo_3d_set_guard_band(const int pixels)
1267{
1268 __jo_3d_guard_band = pixels < 0 ? 0 : (pixels > JO_3D_MAX_GUARD_BAND ? JO_3D_MAX_GUARD_BAND : pixels);
1269}
1270
1276static __jo_force_inline void jo_3d_set_wireframe(const bool enabled)
1277{
1278 __jo_vdp1_wireframe = enabled;
1279}
1280
1285{
1286 return (__jo_vdp1_wireframe);
1287}
1288
1295static __jo_force_inline void jo_3d_set_depth_bias(const int bias)
1296{
1297 __jo_vdp1_depth_bias = bias;
1298}
1299
1304{
1305 return (__jo_vdp1_depth_bias);
1306}
1307
1308
1315
1321void jo_3d_transform_point_by(const jo_fixed (* const m)[3], const jo_pos3D_fixed * const in,
1322 jo_pos3D_fixed * const out);
1323
1331void __jo_3d_bone_matrix(jo_fixed (* const out)[3], const jo_fixed (* const parent)[3],
1332 const jo_pos3D_fixed * const pivot, const jo_angle * const angles);
1333
1336
1342
1348void jo_3d_reflect_matrix(const jo_pos3D_fixed * const normal, const jo_fixed distance);
1349
1353void jo_3d_set_mirror(const bool mirror);
1354
1363
1370bool jo_3d_is_sphere_visible(const jo_pos3D_fixed * const center, const jo_fixed radius, const jo_fixed max_distance);
1371
1379bool jo_3d_slave_is_sphere_visible(const jo_pos3D_fixed * const center, const jo_fixed radius, const jo_fixed max_distance);
1380
1382typedef struct
1383{
1384 short left;
1385 short top;
1386 short right;
1387 short bottom;
1388} jo_3d_rect;
1389
1395void jo_3d_set_view_rect(const jo_3d_rect * const rect);
1396
1402
1410int jo_3d_mesh_get_bounding_sphere(const jo_3d_mesh * const mesh, jo_pos3D_fixed * const center);
1411
1414typedef struct
1415{
1416 short nx; // Normal (Q14)
1417 short ny;
1418 short nz;
1419 short unused;
1420 int d; // n.a (a: the first vertex, whole units)
1421 short box[6]; // Box of the polygon (whole units, a margin of 1): x, y, z min, then max
1423
1434bool jo_3d_mesh_ray_hit(const jo_3d_mesh * const mesh, const jo_pos3D_fixed * const origin,
1435 const jo_pos3D_fixed * const dir, jo_fixed * const best,
1436 jo_pos3D_fixed * const normal);
1437
1444
1454bool jo_3d_mesh_ray_hit_with_planes(const jo_3d_mesh * const mesh, const jo_3d_ray_plane * const planes,
1455 const jo_pos3D_fixed * const origin, const jo_pos3D_fixed * const dir,
1456 jo_fixed * const best, jo_pos3D_fixed * const normal);
1457
1468bool jo_3d_draw_standing_sprite(const int sprite_id, const jo_pos3D_fixed * const foot, const jo_fixed width,
1469 const jo_fixed height, const jo_fixed sway, const bool flip);
1470
1478jo_3d_mesh *jo_3d_create_indexed_mesh(const unsigned int point_count, const unsigned int polygon_count);
1479
1492bool jo_3d_set_texture_subdivision(const int sprite_id);
1493
1501
1508void jo_3d_set_texture_subdivision_depth(const int sprite_id, const jo_fixed depth);
1509
1516void jo_3d_set_texture_subdivision_error(const int sprite_id, const int pixels);
1517
1526bool jo_3d_set_texture_mipmaps(const int sprite_id);
1527
1532void __jo_3d_forget_sprites_from(const int sprite_id);
1533
1538void __jo_3d_forget_tint(const jo_3d_polygon_data * const pdata);
1539
1540#ifdef JO_COMPILE_WITH_DUAL_CPU_SUPPORT
1541
1542/*
1543** 3D on the slave CPU: the slave CPU draws objects at the same time as the master CPU (for instance the ground on the
1544** slave CPU, the characters and the buildings on the master CPU). Sequence of a frame:
1545** master CPU: camera matrix, jo_3d_slave_begin(), jo_core_exec_on_slave(my_slave_function), other drawings,
1546** jo_core_wait_for_slave(), jo_3d_slave_end()
1547** slave CPU (my_slave_function): jo_3d_slave_mesh_draw() for each object (jo_3d_slave_transform_point() to cull them)
1548** The slave CPU starts with the matrix of the camera given to jo_3d_slave_begin(), it has its own (small) matrix stack
1549*/
1550
1555
1559void jo_3d_slave_set_depth_bias(const int bias);
1560
1565void jo_3d_slave_set_guard_band(const int pixels);
1566
1572
1577
1580
1587
1593void jo_3d_slave_rotate_matrix(const int x, const int y, const int z);
1594
1600void jo_3d_slave_rotate(const int axis, const jo_angle angle);
1601
1608
1616bool jo_3d_slave_mesh_draw_ranges(const jo_3d_mesh * const mesh, const unsigned int point_count,
1617 const jo_3d_polygon_range * const ranges, const int range_count);
1618
1624{
1625 return (jo_3d_slave_mesh_draw_ranges(mesh, mesh->data.point_count, JO_NULL, 0));
1626}
1627
1633
1646bool jo_3d_slave_draw_standing_sprite(const int sprite_id, const jo_pos3D_fixed * const foot,
1647 const jo_fixed width, const jo_fixed height,
1648 const jo_fixed sway, const bool flip);
1649
1655
1660
1665
1671
1677void jo_3d_slave_set_kept_commands(const int count);
1678
1679#endif /* !JO_COMPILE_WITH_DUAL_CPU_SUPPORT */
1680
1688unsigned short jo_3d_add_gouraud_tables(const jo_color * const tables, const unsigned int count);
1689
1694void __jo_3d_gouraud_pool_freed(const int sprite_id);
1695
1705void jo_3d_set_tint(const int r, const int g, const int b);
1706
1719bool jo_3d_set_mesh_environment(jo_3d_mesh * const mesh, const int sprite_id, const int tiles);
1720
1727bool jo_3d_set_mesh_polygon_environment(jo_3d_mesh * const mesh, const unsigned int index);
1728
1729#endif /* !JO_COMPILE_WITH_3D_SUPPORT */
1730
1731#endif /* !__JO_3D_H__ */
1732
1733/*
1734** END OF FILE
1735*/
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
#define JO_NULL
NULL implementation.
Definition tools.h:239
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).