Jo Engine  2024.04.28
Jo Sega Saturn Engine
3d.h
Go to the documentation of this file.
1 /*
2 ** Jo Sega Saturn Engine
3 ** Copyright (c) 2012-2024, 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 */
36 #ifndef __JO_3D_H__
37 # define __JO_3D_H__
38 
39 #ifdef JO_COMPILE_WITH_3D_SUPPORT
40 
42 # define JO_3D_PLANE_VERTICES(SIZE) \
43 { \
44  { -SIZE, -SIZE, 0 }, \
45  { SIZE, -SIZE, 0 }, \
46  { SIZE, SIZE, 0 }, \
47  { -SIZE, SIZE, 0 } \
48 }
49 
51 # define JO_3D_TRIANGLE_VERTICES(SIZE) \
52 { \
53  { -SIZE, -SIZE, 0 }, \
54  { SIZE, -SIZE, 0 }, \
55  { SIZE, SIZE, 0 } \
56 }
57 
59 # define JO_3D_CUBE_VERTICES(SIZE) \
60 { \
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  { -SIZE, SIZE, -SIZE } \
85 }
86 
89 
91 typedef struct
92 {
93  union
94  {
95  FIXED viewpoint[XYZ];
96  jo_pos3D viewpoint_pos;
97  };
98  union
99  {
100  FIXED target[XYZ];
101  jo_pos3D target_pos;
102  };
103  ANGLE z_angle;
104 } jo_camera;
105 
107 typedef struct
108 {
109  PDATA data;
110  ATTR attribute;
111 } jo_3d_quad;
112 
114 typedef struct
115 {
116  PDATA data;
117 } jo_3d_mesh;
118 
122 extern jo_3d_quad *__jo_sprite_quad[JO_MAX_SPRITE];
123 bool jo_3d_create_sprite_quad(const int sprite_id);
124 
125 #if JO_COMPILE_USING_SGL
126 
127 /*
128  ██████╗ █████╗ ███╗ ███╗███████╗██████╗ █████╗
129 ██╔════╝██╔══██╗████╗ ████║██╔════╝██╔══██╗██╔══██╗
130 ██║ ███████║██╔████╔██║█████╗ ██████╔╝███████║
131 ██║ ██╔══██║██║╚██╔╝██║██╔══╝ ██╔══██╗██╔══██║
132 ╚██████╗██║ ██║██║ ╚═╝ ██║███████╗██║ ██║██║ ██║
133  ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝
134 
135 */
136 
143 static __jo_force_inline void jo_3d_camera_set_viewpoint(jo_camera * const cam, const int x, const int y, const int z)
144 {
145  cam->viewpoint_pos.x = JO_MULT_BY_65536(x);
146  cam->viewpoint_pos.y = JO_MULT_BY_65536(y);
147  cam->viewpoint_pos.z = JO_MULT_BY_65536(z);
148 }
149 
156 static __jo_force_inline void jo_3d_camera_set_target(jo_camera * const cam, const int x, const int y, const int z)
157 {
158  cam->target_pos.x = JO_MULT_BY_65536(x);
159  cam->target_pos.y = JO_MULT_BY_65536(y);
160  cam->target_pos.z = JO_MULT_BY_65536(z);
161 }
162 
167 static __jo_force_inline void jo_3d_camera_set_z_angle(jo_camera * const cam, const int angle)
168 {
169  cam->z_angle = jo_DEGtoANG_int(angle);
170 }
171 
176 {
177  jo_3d_camera_set_viewpoint(cam, 0, 0, -150);
178  jo_3d_camera_set_target(cam, 0, 0, 0);
179  jo_3d_camera_set_z_angle(cam, 0);
180 }
181 
186 {
187  slLookAt(cam->viewpoint, cam->target, cam->z_angle);
188 }
189 
190 /*
191 ███████╗████████╗ █████╗ ████████╗██╗███████╗████████╗██╗ ██████╗███████╗
192 ██╔════╝╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔════╝╚══██╔══╝██║██╔════╝██╔════╝
193 ███████╗ ██║ ███████║ ██║ ██║███████╗ ██║ ██║██║ ███████╗
194 ╚════██║ ██║ ██╔══██║ ██║ ██║╚════██║ ██║ ██║██║ ╚════██║
195 ███████║ ██║ ██║ ██║ ██║ ██║███████║ ██║ ██║╚██████╗███████║
196 ╚══════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
197 
198 */
199 
205 {
206  extern Uint16 TotalPolygons;
207  return TotalPolygons;
208 }
209 
215 {
216  extern Uint16 TotalVertices;
217  return TotalVertices;
218 }
219 
225 {
226  extern Uint16 DispPolygons;
227  return DispPolygons;
228 }
229 
230 /*
231  ██████╗██████╗ ███████╗ █████╗ ████████╗███████╗ ███████╗██╗███╗ ███╗██████╗ ██╗ ███████╗
232 ██╔════╝██╔══██╗██╔════╝██╔══██╗╚══██╔══╝██╔════╝ ██╔════╝██║████╗ ████║██╔══██╗██║ ██╔════╝
233 ██║ ██████╔╝█████╗ ███████║ ██║ █████╗ ███████╗██║██╔████╔██║██████╔╝██║ █████╗
234 ██║ ██╔══██╗██╔══╝ ██╔══██║ ██║ ██╔══╝ ╚════██║██║██║╚██╔╝██║██╔═══╝ ██║ ██╔══╝
235 ╚██████╗██║ ██║███████╗██║ ██║ ██║ ███████╗ ███████║██║██║ ╚═╝ ██║██║ ███████╗███████╗
236  ╚═════╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚══════╝╚══════╝
237 
238  ██████╗ ██████╗ ██╗███████╗ ██████╗████████╗
239 ██╔═══██╗██╔══██╗ ██║██╔════╝██╔════╝╚══██╔══╝
240 ██║ ██║██████╔╝ ██║█████╗ ██║ ██║
241 ██║ ██║██╔══██╗██ ██║██╔══╝ ██║ ██║
242 ╚██████╔╝██████╔╝╚█████╔╝███████╗╚██████╗ ██║
243  ╚═════╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝
244 
245 */
246 
254 jo_3d_mesh *jo_3d_create_mesh_from_vertices_and_normals(const unsigned int quad_count, jo_vertice * const vertices, jo_vector * const normals);
255 
262 static __jo_force_inline jo_3d_mesh *jo_3d_create_mesh_from_vertices(const unsigned int quad_count, jo_vertice * const vertices)
263 {
264  return (jo_3d_create_mesh_from_vertices_and_normals(quad_count, vertices, JO_NULL));
265 }
266 
272 static __jo_force_inline jo_3d_mesh *jo_3d_create_mesh(const unsigned int quad_count)
273 {
275 }
276 
280 void jo_3d_free_mesh(const jo_3d_mesh * const mesh);
281 
286 void jo_3d_create_plane(jo_3d_quad * const quad, jo_vertice * const vertices);
287 
292 void jo_3d_create_cube(jo_3d_quad * array, jo_vertice * const vertices);
293 
298 void jo_3d_create_triangle(jo_3d_quad * const quad, jo_vertice * const vertices);
299 
305 {
306  return (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id) ? JO_NULL : __jo_sprite_quad[sprite_id]);
307 }
308 
312 void jo_3d_free_sprite_quad(const int sprite_id);
313 
314 /*
315 ███╗ ███╗███████╗███████╗██╗ ██╗ ████████╗███████╗██╗ ██╗████████╗██╗ ██╗██████╗ ███████╗
316 ████╗ ████║██╔════╝██╔════╝██║ ██║ ╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝██║ ██║██╔══██╗██╔════╝
317 ██╔████╔██║█████╗ ███████╗███████║ ██║ █████╗ ╚███╔╝ ██║ ██║ ██║██████╔╝█████╗
318 ██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ██║ ██╔══╝ ██╔██╗ ██║ ██║ ██║██╔══██╗██╔══╝
319 ██║ ╚═╝ ██║███████╗███████║██║ ██║ ██║ ███████╗██╔╝ ██╗ ██║ ╚██████╔╝██║ ██║███████╗
320 ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
321 
322 */
323 
329 void jo_3d_set_mesh_polygon_texture(jo_3d_mesh * const mesh, const int sprite_id, const unsigned int index);
330 
335 void jo_3d_set_mesh_texture(jo_3d_mesh * const mesh, const int sprite_id);
336 
341 static __jo_force_inline void jo_3d_set_texture(jo_3d_quad * const quad, const int sprite_id)
342 {
343  jo_3d_set_mesh_polygon_texture((jo_3d_mesh *)quad, sprite_id, 0);
344 }
345 
351 void jo_3d_set_mesh_polygon_wireframe(jo_3d_mesh * const mesh, const unsigned int index, bool wireframe);
352 
353 /*
354  8 BITS PALETTE HANDLING
355 */
356 
362 static __jo_force_inline void jo_3d_set_mesh_polygon_palette(jo_3d_mesh * const mesh, const int palette_id, const unsigned int index)
363 {
364  mesh->data.attbl[index].colno = JO_MULT_BY_256(palette_id);
365 }
366 
371 static __jo_force_inline void jo_3d_set_mesh_palette(jo_3d_mesh * const mesh, const int palette_id)
372 {
373  for (unsigned int i = 0; i < mesh->data.nbPolygon; ++i)
374  jo_3d_set_mesh_polygon_palette(mesh, palette_id, i);
375 }
376 
381 static __jo_force_inline void jo_3d_set_palette(jo_3d_quad * const quad, const int palette_id)
382 {
383  quad->attribute.colno = JO_MULT_BY_256(palette_id);
384 }
385 
391 static __jo_force_inline bool jo_3d_set_sprite_palette(const int sprite_id, const int palette_id)
392 {
393  if (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id)) return (false);
394  jo_3d_set_palette(__jo_sprite_quad[sprite_id], palette_id);
395  return (true);
396 }
397 
398 /*
399 ███╗ ███╗███████╗███████╗██╗ ██╗ ██╗ ██╗███████╗██████╗ ████████╗██╗ ██████╗███████╗ ██╗ ███╗ ██╗ ██████╗ ██████╗ ███╗ ███╗ █████╗ ██╗
400 ████╗ ████║██╔════╝██╔════╝██║ ██║ ██║ ██║██╔════╝██╔══██╗╚══██╔══╝██║██╔════╝██╔════╝ ██║ ████╗ ██║██╔═══██╗██╔══██╗████╗ ████║██╔══██╗██║
401 ██╔████╔██║█████╗ ███████╗███████║ ██║ ██║█████╗ ██████╔╝ ██║ ██║██║ █████╗ ████████╗ ██╔██╗ ██║██║ ██║██████╔╝██╔████╔██║███████║██║
402 ██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ╚██╗ ██╔╝██╔══╝ ██╔══██╗ ██║ ██║██║ ██╔══╝ ██╔═██╔═╝ ██║╚██╗██║██║ ██║██╔══██╗██║╚██╔╝██║██╔══██║██║
403 ██║ ╚═╝ ██║███████╗███████║██║ ██║ ╚████╔╝ ███████╗██║ ██║ ██║ ██║╚██████╗███████╗ ██████║ ██║ ╚████║╚██████╔╝██║ ██║██║ ╚═╝ ██║██║ ██║███████╗
404 ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝
405 */
406 
414 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)
415 {
416  mesh->data.pntbl[index][0] = x;
417  mesh->data.pntbl[index][1] = y;
418  mesh->data.pntbl[index][2] = z;
419 }
420 
428 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)
429 {
430  mesh->data.pltbl[index].norm[0] = x;
431  mesh->data.pltbl[index].norm[1] = y;
432  mesh->data.pltbl[index].norm[2] = z;
433 }
434 
435 /*
436 ███╗ ███╗███████╗███████╗██╗ ██╗ ██╗ ██╗ ██████╗ ██╗ ██╗████████╗
437 ████╗ ████║██╔════╝██╔════╝██║ ██║ ██║ ██║██╔════╝ ██║ ██║╚══██╔══╝
438 ██╔████╔██║█████╗ ███████╗███████║ ██║ ██║██║ ███╗███████║ ██║
439 ██║╚██╔╝██║██╔══╝ ╚════██║██╔══██║ ██║ ██║██║ ██║██╔══██║ ██║
440 ██║ ╚═╝ ██║███████╗███████║██║ ██║ ███████╗██║╚██████╔╝██║ ██║ ██║
441 ╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
442 
443 */
444 
450 static __jo_force_inline void jo_3d_light(const int x, const int y, const int z)
451 {
452  FIXED p[XYZ];
453  p[X] = JO_MULT_BY_65536(x);
454  p[Y] = JO_MULT_BY_65536(y);
455  p[Z] = JO_MULT_BY_65536(z);
456  slLight(p);
457 }
458 
464 void jo_3d_set_mesh_polygon_light(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
465 
470 void jo_3d_set_mesh_light(jo_3d_mesh * const mesh, const bool enabled);
471 
476 static __jo_force_inline void jo_3d_set_light(jo_3d_quad *const quad, const bool enabled)
477 {
478  jo_3d_set_mesh_polygon_light((jo_3d_mesh *)quad, enabled, 0);
479 }
480 
481 /*
482 ████████╗██████╗ █████╗ ███╗ ██╗███████╗██████╗ █████╗ ██████╗ ███████╗███╗ ██╗ ██████╗██╗ ██╗
483 ╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝
484  ██║ ██████╔╝███████║██╔██╗ ██║███████╗██████╔╝███████║██████╔╝█████╗ ██╔██╗ ██║██║ ╚████╔╝
485  ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██╔═══╝ ██╔══██║██╔══██╗██╔══╝ ██║╚██╗██║██║ ╚██╔╝
486  ██║ ██║ ██║██║ ██║██║ ╚████║███████║██║ ██║ ██║██║ ██║███████╗██║ ╚████║╚██████╗ ██║
487  ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝
488 
489 */
490 
496 void jo_3d_set_mesh_polygon_transparency(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
497 
502 void jo_3d_set_mesh_transparency(jo_3d_mesh * const mesh, const bool enabled);
503 
508 static __jo_force_inline void jo_3d_set_transparency(jo_3d_quad *const quad, const bool enabled)
509 {
510  jo_3d_set_mesh_polygon_transparency((jo_3d_mesh *)quad, enabled, 0);
511 }
512 
513 /******************************************************
514 * SCREEN DOORS TRANSPARENCY
515 *******************************************************/
516 
522 void jo_3d_set_mesh_polygon_screen_doors(jo_3d_mesh * const mesh, const bool enabled, const unsigned int index);
523 
528 void jo_3d_set_mesh_screen_doors(jo_3d_mesh * const mesh, const bool enabled);
529 
534 static __jo_force_inline void jo_3d_set_screen_doors(jo_3d_quad *const quad, const bool enabled)
535 {
536  jo_3d_set_mesh_polygon_screen_doors((jo_3d_mesh *)quad, enabled, 0);
537 }
538 
539 /*
540  ██████╗ ██████╗ ██╗ ██████╗ ██████╗ ███████╗
541 ██╔════╝██╔═══██╗██║ ██╔═══██╗██╔══██╗██╔════╝
542 ██║ ██║ ██║██║ ██║ ██║██████╔╝███████╗
543 ██║ ██║ ██║██║ ██║ ██║██╔══██╗╚════██║
544 ╚██████╗╚██████╔╝███████╗╚██████╔╝██║ ██║███████║
545  ╚═════╝ ╚═════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝
546 
547 */
548 
555 void jo_3d_set_mesh_polygon_color_ex(jo_3d_mesh * const mesh, const jo_color color, const unsigned int index, bool wireframe);
556 
562 static __jo_force_inline void jo_3d_set_mesh_polygon_color(jo_3d_mesh * const mesh, const jo_color color, const unsigned int index)
563 {
564  jo_3d_set_mesh_polygon_color_ex(mesh, color, index, false);
565 }
566 
571 void jo_3d_set_mesh_color(jo_3d_mesh * const mesh, const jo_color color);
572 
577 static __jo_force_inline void jo_3d_set_color(jo_3d_quad * const quad, const jo_color color)
578 {
579  jo_3d_set_mesh_polygon_color((jo_3d_mesh *)quad, color, 0);
580 }
581 
582 /*
583 ███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗
584 ████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝
585 ██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝
586 ██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗
587 ██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗
588 ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝
589 */
590 
594 {
595  slPushMatrix();
596 }
597 
601 {
602  slPopMatrix();
603 }
604 
605 /*
606 ███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗ ██████╗ ██████╗ ████████╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
607 ████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝ ██╔══██╗██╔═══██╗╚══██╔══╝██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
608 ██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝ ██████╔╝██║ ██║ ██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
609 ██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗ ██╔══██╗██║ ██║ ██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
610 ██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗ ██║ ██║╚██████╔╝ ██║ ██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
611 ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
612 
613 */
614 
620 static __jo_force_inline void jo_3d_rotate_matrix(short x, short y, short z)
621 {
622  slRotX(jo_DEGtoANG_int(x));
623  slRotY(jo_DEGtoANG_int(y));
624  slRotZ(jo_DEGtoANG_int(z));
625 }
626 
631 {
632  slRotX(jo_DEGtoANG_int(x));
633 }
634 
639 {
640  slRotY(jo_DEGtoANG_int(y));
641 }
642 
647 {
648  slRotZ(jo_DEGtoANG_int(z));
649 }
650 
656 static __jo_force_inline void jo_3d_rotate_matrix_rad(float x, float y, float z)
657 {
658  slRotX(RADtoANG(x));
659  slRotY(RADtoANG(y));
660  slRotZ(RADtoANG(z));
661 }
662 
667 {
668  slRotX(RADtoANG(x));
669 }
670 
675 {
676  slRotY(RADtoANG(y));
677 }
678 
683 {
684  slRotZ(RADtoANG(z));
685 }
686 
687 /*
688 ███╗ ███╗ █████╗ ████████╗██████╗ ██╗██╗ ██╗ ████████╗██████╗ █████╗ ███╗ ██╗███████╗██╗ █████╗ ████████╗██╗ ██████╗ ███╗ ██╗
689 ████╗ ████║██╔══██╗╚══██╔══╝██╔══██╗██║╚██╗██╔╝ ╚══██╔══╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ ██╔══██╗╚══██╔══╝██║██╔═══██╗████╗ ██║
690 ██╔████╔██║███████║ ██║ ██████╔╝██║ ╚███╔╝ ██║ ██████╔╝███████║██╔██╗ ██║███████╗██║ ███████║ ██║ ██║██║ ██║██╔██╗ ██║
691 ██║╚██╔╝██║██╔══██║ ██║ ██╔══██╗██║ ██╔██╗ ██║ ██╔══██╗██╔══██║██║╚██╗██║╚════██║██║ ██╔══██║ ██║ ██║██║ ██║██║╚██╗██║
692 ██║ ╚═╝ ██║██║ ██║ ██║ ██║ ██║██║██╔╝ ██╗ ██║ ██║ ██║██║ ██║██║ ╚████║███████║███████╗██║ ██║ ██║ ██║╚██████╔╝██║ ╚████║
693 ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
694 
695 */
696 
702 static __jo_force_inline void jo_3d_translate_matrixf(float x, float y, float z)
703 {
704  slTranslate(toFIXED(x), toFIXED(y), toFIXED(z));
705 }
706 
713 {
714  slTranslate(x, y, z);
715 }
716 
722 static __jo_force_inline void jo_3d_translate_matrix(int x, int y, int z)
723 {
724  slTranslate(jo_int2fixed(x), jo_int2fixed(y), jo_int2fixed(z));
725 }
726 
731 {
732  slTranslate(jo_int2fixed(x), 0, 0);
733 }
734 
739 {
740  slTranslate(0, jo_int2fixed(y), 0);
741 }
742 
747 {
748  slTranslate(0, 0, jo_int2fixed(z));
749 }
750 
751 /*
752 ██████╗ ██████╗ █████╗ ██╗ ██╗██╗███╗ ██╗ ██████╗
753 ██╔══██╗██╔══██╗██╔══██╗██║ ██║██║████╗ ██║██╔════╝
754 ██║ ██║██████╔╝███████║██║ █╗ ██║██║██╔██╗ ██║██║ ███╗
755 ██║ ██║██╔══██╗██╔══██║██║███╗██║██║██║╚██╗██║██║ ██║
756 ██████╔╝██║ ██║██║ ██║╚███╔███╔╝██║██║ ╚████║╚██████╔╝
757 ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝
758 
759 */
760 
764 static __jo_force_inline void jo_3d_draw(jo_3d_quad *const quad)
765 {
766  slPutPolygon(&quad->data);
767 }
768 
773 {
774  slPutPolygon(&mesh->data);
775 }
776 
782 {
783  return mesh->data.nbPolygon;
784 }
785 
790 {
791  jo_3d_draw((jo_3d_quad * const)node->data.ptr);
792 }
793 
797 static __jo_force_inline void jo_3d_draw_list(jo_list *const list)
798 {
800 }
801 
806 static __jo_force_inline void jo_3d_draw_array(jo_3d_quad * const array, int array_size)
807 {
808  while (--array_size >= 0) jo_3d_draw(array + array_size);
809 }
810 
815 static __jo_force_inline bool jo_3d_draw_sprite(const int sprite_id)
816 {
817  if (__jo_sprite_quad[sprite_id] == JO_NULL && !jo_3d_create_sprite_quad(sprite_id)) return (false);
818  jo_3d_draw(__jo_sprite_quad[sprite_id]);
819  return (true);
820 }
821 
828 static __jo_force_inline void jo_3d_draw_sprite_at(const int sprite_id, const int x, const int y, const int z)
829 {
831  jo_3d_translate_matrix(x, y, z);
832  jo_3d_draw_sprite(sprite_id);
834 }
835 
842 static __jo_force_inline void jo_3d_draw_billboard(const int sprite_id, const int x, const int y, const int z)
843 {
844  extern jo_pos3D __jo_sprite_pos;
846  jo_sprite_draw(sprite_id, &__jo_sprite_pos, true, true);
847 }
848 
856 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)
857 {
858  if (scale == 1)
859  jo_3d_draw_billboard(sprite_id, x, y, z);
860  else
861  {
862  extern jo_pos3D __jo_sprite_pos;
864  jo_fixed previous_scale_x = __jo_sprite_attributes.fixed_scale_x;
865  jo_fixed previous_scale_y = __jo_sprite_attributes.fixed_scale_y;
868  jo_sprite_draw(sprite_id, &__jo_sprite_pos, true, true);
869  __jo_sprite_attributes.fixed_scale_x = previous_scale_x;
870  __jo_sprite_attributes.fixed_scale_y = previous_scale_y;
871  }
872 }
873 
874 /*
875 ███████╗ ██████╗ █████╗ ██╗ ███████╗
876 ██╔════╝██╔════╝██╔══██╗██║ ██╔════╝
877 ███████╗██║ ███████║██║ █████╗
878 ╚════██║██║ ██╔══██║██║ ██╔══╝
879 ███████║╚██████╗██║ ██║███████╗███████╗
880 ╚══════╝ ╚═════╝╚═╝ ╚═╝╚══════╝╚══════╝
881 
882 */
883 
889 static __jo_force_inline void jo_3d_set_scalef(const float x, const float y, const float z)
890 {
891  slScale(toFIXED(x), toFIXED(y), toFIXED(z));
892 }
893 
899 static __jo_force_inline void jo_3d_set_scale(const int x, const int y, const int z)
900 {
902 }
903 
909 static __jo_force_inline void jo_3d_set_scale_fixed(const jo_fixed x, const jo_fixed y, const jo_fixed z)
910 {
911  slScale(x, y, z);
912 }
913 
917 {
918  slScale(JO_NO_ZOOM, JO_NO_ZOOM, JO_NO_ZOOM);
919 }
920 
921 /*
922 ██╗ ██╗██╗███╗ ██╗██████╗ ██████╗ ██╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ██╗███████╗ ██████╗████████╗██╗ ██████╗ ███╗ ██╗
923 ██║ ██║██║████╗ ██║██╔══██╗██╔═══██╗██║ ██║ ██║ ██╔══██╗██╔══██╗██╔═══██╗ ██║██╔════╝██╔════╝╚══██╔══╝██║██╔═══██╗████╗ ██║
924 ██║ █╗ ██║██║██╔██╗ ██║██║ ██║██║ ██║██║ █╗ ██║ ████████╗ ██████╔╝██████╔╝██║ ██║ ██║█████╗ ██║ ██║ ██║██║ ██║██╔██╗ ██║
925 ██║███╗██║██║██║╚██╗██║██║ ██║██║ ██║██║███╗██║ ██╔═██╔═╝ ██╔═══╝ ██╔══██╗██║ ██║██ ██║██╔══╝ ██║ ██║ ██║██║ ██║██║╚██╗██║
926 ╚███╔███╔╝██║██║ ╚████║██████╔╝╚██████╔╝╚███╔███╔╝ ██████║ ██║ ██║ ██║╚██████╔╝╚█████╔╝███████╗╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║
927  ╚══╝╚══╝ ╚═╝╚═╝ ╚═══╝╚═════╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚════╝ ╚══════╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝
928 
929 */
930 
941 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)
942 {
943  return slWindow(left, top, right, bottom, z_limit, center_x, center_y) != 0;
944 }
945 
949 static __jo_force_inline void jo_3d_perspective_angle(const int angle)
950 {
951 #if JO_DEBUG
952  if (angle < 10 || angle > 160)
953  jo_core_error("Valid angle range is 10 to 160");
954 #endif
955  slPerspective(jo_DEGtoANG_int(angle));
956 }
957 
961 static __jo_force_inline void jo_3d_display_level(const unsigned short level)
962 {
963  slZdspLevel(level);
964 }
965 
966 #endif
967 
968 #endif /* !JO_COMPILE_WITH_3D_SUPPORT */
969 
970 #endif /* !__JO_3D_H__ */
971 
972 /*
973 ** END OF FILE
974 */
jo_3d_display_level
static __jo_force_inline void jo_3d_display_level(const unsigned short level)
Set the display level of the viewing volume.
Definition: 3d.h:961
jo_vector
Vector for 3D computation using integer.
Definition: types.h:142
jo_3d_set_palette
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:381
jo_3d_rotate_matrix
static __jo_force_inline void jo_3d_rotate_matrix(short x, short y, short z)
Rotate 3D matrix using degree.
Definition: 3d.h:620
jo_3d_set_transparency
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:508
jo_3d_get_polygon_count
static __jo_force_inline unsigned int jo_3d_get_polygon_count(void)
Get polygon count (visible and not visible)
Definition: 3d.h:204
jo_3d_rotate_matrix_rad_x
static __jo_force_inline void jo_3d_rotate_matrix_rad_x(float x)
Rotate 3D matrix using radian (X axis)
Definition: 3d.h:666
jo_3d_get_displayed_polygon_count
static __jo_force_inline unsigned int jo_3d_get_displayed_polygon_count(void)
Get displayed polygon count.
Definition: 3d.h:224
jo_3d_light
static __jo_force_inline void jo_3d_light(const int x, const int y, const int z)
Use a light source.
Definition: 3d.h:450
jo_3d_camera_look_at
static __jo_force_inline void jo_3d_camera_look_at(jo_camera *const cam)
look at the camera
Definition: 3d.h:185
jo_core_error
#define jo_core_error(...)
Definition: core.h:45
jo_3d_translate_matrix_y
static __jo_force_inline void jo_3d_translate_matrix_y(int y)
Translate 3D matrix (Y axis)
Definition: 3d.h:738
jo_3d_translate_matrix_fixed
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:712
jo_3d_translate_matrixf
static __jo_force_inline void jo_3d_translate_matrixf(float x, float y, float z)
Translate 3D matrix (using floating numbers)
Definition: 3d.h:702
jo_3d_set_mesh_screen_doors
void jo_3d_set_mesh_screen_doors(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable screen doors transparency on the mesh.
jo_3d_translate_matrix
static __jo_force_inline void jo_3d_translate_matrix(int x, int y, int z)
Translate 3D matrix.
Definition: 3d.h:722
jo_3d_rotate_matrix_x
static __jo_force_inline void jo_3d_rotate_matrix_x(short x)
Rotate 3D matrix using degree (X axis)
Definition: 3d.h:630
jo_3d_set_mesh_texture
void jo_3d_set_mesh_texture(jo_3d_mesh *const mesh, const int sprite_id)
Set a texture on the mesh.
jo_3d_set_mesh_normal
static __jo_force_inline void jo_3d_set_mesh_normal(jo_3d_mesh *const mesh, const jo_fixed x, const jo_fixed y, const jo_fixed z, const unsigned int index)
Set quad normal in mesh.
Definition: 3d.h:428
__jo_sprite_attributes
jo_sprite_attributes __jo_sprite_attributes
Current displayed sprite attribute (internal engine usage)
jo_3d_set_mesh_vertice
static __jo_force_inline void jo_3d_set_mesh_vertice(jo_3d_mesh *const mesh, const jo_fixed x, const jo_fixed y, const jo_fixed z, const unsigned int index)
Set vertice position in mesh.
Definition: 3d.h:414
jo_3d_set_sprite_palette
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:391
jo_3d_set_mesh_polygon_light
void jo_3d_set_mesh_polygon_light(jo_3d_mesh *const mesh, const bool enabled, const unsigned int index)
Enable/Disable light on one polygon on the mesh.
jo_3d_camera_set_viewpoint
static __jo_force_inline void jo_3d_camera_set_viewpoint(jo_camera *const cam, const int x, const int y, const int z)
Set the viewpoint of the camera (where the cameraman is)
Definition: 3d.h:143
jo_3d_translate_matrix_z
static __jo_force_inline void jo_3d_translate_matrix_z(int z)
Translate 3D matrix (Z axis)
Definition: 3d.h:746
jo_3d_camera_init
static __jo_force_inline void jo_3d_camera_init(jo_camera *const cam)
Initialize the camera with default values.
Definition: 3d.h:175
jo_DEGtoANG_int
static __jo_force_inline ANGLE jo_DEGtoANG_int(const int deg)
Replacement for DEGtoANG using interger.
Definition: math.h:650
jo_vertice
jo_pos3D jo_vertice
Vertice structure.
Definition: 3d.h:88
JO_MULT_BY_65536
#define JO_MULT_BY_65536(X)
Multiply a variable by 65536.
Definition: math.h:138
jo_3d_set_mesh_light
void jo_3d_set_mesh_light(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable light on the mesh.
jo_3d_draw_list
static __jo_force_inline void jo_3d_draw_list(jo_list *const list)
Draw a list of quadrilateral.
Definition: 3d.h:797
jo_3d_create_mesh
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:272
jo_3d_camera_set_target
static __jo_force_inline void jo_3d_camera_set_target(jo_camera *const cam, const int x, const int y, const int z)
Set the target of the camera (where the scene is located)
Definition: 3d.h:156
jo_3d_rotate_matrix_rad_z
static __jo_force_inline void jo_3d_rotate_matrix_rad_z(float z)
Rotate 3D matrix using radian (Z axis)
Definition: 3d.h:682
jo_3d_create_mesh_from_vertices
static __jo_force_inline jo_3d_mesh * jo_3d_create_mesh_from_vertices(const unsigned int quad_count, jo_vertice *const vertices)
Create a mesh programmatically from vertices.
Definition: 3d.h:262
jo_sprite_draw
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_3d_set_light
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:476
JO_MULT_BY_256
#define JO_MULT_BY_256(X)
Multiply a variable by 256.
Definition: math.h:108
jo_sprite_attributes::fixed_scale_y
jo_fixed fixed_scale_y
Definition: types.h:272
__jo_node::data
jo_list_data data
Definition: list.h:67
jo_color
unsigned short jo_color
15 bits color type
Definition: types.h:42
jo_camera::z_angle
ANGLE z_angle
Definition: 3d.h:103
jo_3d_rotate_matrix_rad_y
static __jo_force_inline void jo_3d_rotate_matrix_rad_y(float y)
Rotate 3D matrix using radian (Y axis)
Definition: 3d.h:674
jo_3d_rotate_matrix_y
static __jo_force_inline void jo_3d_rotate_matrix_y(short y)
Rotate 3D matrix using degree (Y axis)
Definition: 3d.h:638
jo_3d_mesh_draw
static __jo_force_inline void jo_3d_mesh_draw(jo_3d_mesh *const mesh)
Draw a mesh.
Definition: 3d.h:772
JO_NULL
#define JO_NULL
NULL implementation.
Definition: tools.h:175
__jo_force_inline
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition: types.h:39
jo_fixed
int jo_fixed
Fixed point Q16.16 number.
Definition: types.h:49
jo_3d_get_vertices_count
static __jo_force_inline unsigned int jo_3d_get_vertices_count(void)
Get vertice count.
Definition: 3d.h:214
jo_3d_translate_matrix_x
static __jo_force_inline void jo_3d_translate_matrix_x(int x)
Translate 3D matrix (X axis)
Definition: 3d.h:730
jo_3d_draw_sprite_at
static __jo_force_inline void jo_3d_draw_sprite_at(const int sprite_id, const int x, const int y, const int z)
Draw a sprite.
Definition: 3d.h:828
jo_3d_window
static __jo_force_inline bool jo_3d_window(const int left, const int top, const int right, const int bottom, const int z_limit, const int center_x, const int center_y)
Sets up a window region on the projection surface.
Definition: 3d.h:941
jo_int2fixed
static __jo_force_inline jo_fixed jo_int2fixed(const int x)
Convert int to jo engine fixed.
Definition: math.h:415
jo_3d_create_plane
void jo_3d_create_plane(jo_3d_quad *const quad, jo_vertice *const vertices)
Create a four vertices polygon (Quadrilateral shape)
jo_list_foreach
static __jo_force_inline void jo_list_foreach(jo_list *const list, jo_node_callback callback)
Iterate on the list.
Definition: list.h:221
jo_3d_quad::attribute
ATTR attribute
Definition: 3d.h:110
jo_3d_draw_sprite
static __jo_force_inline bool jo_3d_draw_sprite(const int sprite_id)
Draw a sprite.
Definition: 3d.h:815
jo_3d_create_sprite_quad
bool jo_3d_create_sprite_quad(const int sprite_id)
jo_3d_create_cube
void jo_3d_create_cube(jo_3d_quad *array, jo_vertice *const vertices)
Create a cube.
jo_3d_set_scale
static __jo_force_inline void jo_3d_set_scale(const int x, const int y, const int z)
Change scale.
Definition: 3d.h:899
jo_list
List struct.
Definition: list.h:74
jo_camera
Camera structure.
Definition: 3d.h:92
jo_3d_set_mesh_polygon_transparency
void jo_3d_set_mesh_polygon_transparency(jo_3d_mesh *const mesh, const bool enabled, const unsigned int index)
Enable/Disable transparency on one polygon on the mesh.
jo_3d_quad
Quadrilateral shape structure.
Definition: 3d.h:108
jo_3d_mesh::data
PDATA data
Definition: 3d.h:116
jo_3d_mesh
Mesh structure.
Definition: 3d.h:115
jo_3d_set_screen_doors
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:534
jo_3d_set_mesh_polygon_color_ex
void jo_3d_set_mesh_polygon_color_ex(jo_3d_mesh *const mesh, const jo_color color, const unsigned int index, bool wireframe)
Set the color on one polygon on the mesh with wireframe option.
jo_pos3D
3D position
Definition: types.h:69
jo_3d_free_sprite_quad
void jo_3d_free_sprite_quad(const int sprite_id)
Delete sprite quad.
jo_3d_free_mesh
void jo_3d_free_mesh(const jo_3d_mesh *const mesh)
Free a mesh created with jo_3d_create_mesh()
__jo_node
Node struct.
Definition: list.h:66
jo_3d_quad::data
PDATA data
Definition: 3d.h:109
jo_3d_get_mesh_polygon_count
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:781
jo_3d_set_mesh_palette
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:371
jo_3d_push_matrix
static __jo_force_inline void jo_3d_push_matrix(void)
Push 3D matrix.
Definition: 3d.h:593
jo_3d_restore_scale
static __jo_force_inline void jo_3d_restore_scale(void)
Restore default scale for every 3d model displayed after this call.
Definition: 3d.h:916
jo_3d_pop_matrix
static __jo_force_inline void jo_3d_pop_matrix(void)
Pop 3D matrix.
Definition: 3d.h:600
jo_3d_set_texture
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:341
jo_sprite_attributes::fixed_scale_x
jo_fixed fixed_scale_x
Definition: types.h:271
jo_3d_create_triangle
void jo_3d_create_triangle(jo_3d_quad *const quad, jo_vertice *const vertices)
Create a triangle.
jo_3d_draw_billboard
static __jo_force_inline void jo_3d_draw_billboard(const int sprite_id, const int x, const int y, const int z)
Draw billboard.
Definition: 3d.h:842
__jo_sprite_quad
jo_3d_quad * __jo_sprite_quad[JO_MAX_SPRITE]
Sprite quads (internal engine usage)
jo_3d_set_mesh_transparency
void jo_3d_set_mesh_transparency(jo_3d_mesh *const mesh, const bool enabled)
Enable/Disable transparency on the mesh.
__internal_jo_sprite_set_position3D
static __jo_force_inline void __internal_jo_sprite_set_position3D(const int x, const int y, const int z)
Internal usage don't use it.
Definition: sprites.h:69
jo_3d_get_sprite_quad
static __jo_force_inline jo_3d_quad * jo_3d_get_sprite_quad(const int sprite_id)
Get sprite quad.
Definition: 3d.h:304
jo_3d_set_mesh_color
void jo_3d_set_mesh_color(jo_3d_mesh *const mesh, const jo_color color)
Set the color on the mesh.
jo_3d_set_mesh_polygon_texture
void jo_3d_set_mesh_polygon_texture(jo_3d_mesh *const mesh, const int sprite_id, const unsigned int index)
Set a texture on one polygon on the mesh.
jo_3d_set_mesh_polygon_palette
static __jo_force_inline void jo_3d_set_mesh_polygon_palette(jo_3d_mesh *const mesh, const int palette_id, const unsigned int index)
Set a palette on the mesh.
Definition: 3d.h:362
jo_3d_set_scale_fixed
static __jo_force_inline void jo_3d_set_scale_fixed(const jo_fixed x, const jo_fixed y, const jo_fixed z)
Change scale using fixed number.
Definition: 3d.h:909
jo_3d_draw_array
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:806
jo_3d_create_mesh_from_vertices_and_normals
jo_3d_mesh * jo_3d_create_mesh_from_vertices_and_normals(const unsigned int quad_count, jo_vertice *const vertices, jo_vector *const normals)
Create a mesh programmatically from vertices.
jo_3d_set_color
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:577
jo_3d_set_mesh_polygon_color
static __jo_force_inline void jo_3d_set_mesh_polygon_color(jo_3d_mesh *const mesh, const jo_color color, const unsigned int index)
Set the color on one polygon on the mesh.
Definition: 3d.h:562
jo_3d_draw_scaled_billboard
static __jo_force_inline void jo_3d_draw_scaled_billboard(const int sprite_id, const int x, const int y, const int z, const int scale)
Draw billboard with a specific scale.
Definition: 3d.h:856
jo_3d_rotate_matrix_rad
static __jo_force_inline void jo_3d_rotate_matrix_rad(float x, float y, float z)
Rotate 3D matrix using radian.
Definition: 3d.h:656
jo_3d_rotate_matrix_z
static __jo_force_inline void jo_3d_rotate_matrix_z(short z)
Rotate 3D matrix using degree (Z axis)
Definition: 3d.h:646
jo_list_data::ptr
void * ptr
Definition: list.h:59
jo_3d_camera_set_z_angle
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:167
jo_3d_set_scalef
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:889
jo_3d_draw
static __jo_force_inline void jo_3d_draw(jo_3d_quad *const quad)
Draw a quadrilateral.
Definition: 3d.h:764
jo_3d_set_mesh_polygon_wireframe
void jo_3d_set_mesh_polygon_wireframe(jo_3d_mesh *const mesh, const unsigned int index, bool wireframe)
Set wireframe mode on the mesh.
jo_3d_set_mesh_polygon_screen_doors
void jo_3d_set_mesh_polygon_screen_doors(jo_3d_mesh *const mesh, const bool enabled, const unsigned int index)
Enable/Disable screen doors transparency on one polygon on the mesh.
JO_NO_ZOOM
#define JO_NO_ZOOM
Value used to keep the original scale.
Definition: sprites.h:314
jo_3d_perspective_angle
static __jo_force_inline void jo_3d_perspective_angle(const int angle)
Set the perspective angle.
Definition: 3d.h:949
__jo_poylgon_draw_iterator
static __jo_force_inline void __jo_poylgon_draw_iterator(jo_node *node)
Internal usage for polygon display.
Definition: 3d.h:789