91# define __JO_MODEL_H__
93#ifdef JO_COMPILE_WITH_3D_SUPPORT
96# define JO_3D_MODEL_VERSION (1)
102# define JO_3D_MATERIAL_DUAL_PLANE (1 << 0)
104# define JO_3D_MATERIAL_SORT_MIN (1 << 1)
106# define JO_3D_MATERIAL_SORT_MAX (1 << 2)
109# define JO_3D_MATERIAL_SORT_PREVIOUS (JO_3D_MATERIAL_SORT_MIN | JO_3D_MATERIAL_SORT_MAX)
111# define JO_3D_MATERIAL_GOURAUD (1 << 3)
113# define JO_3D_MATERIAL_HALF_TRANSPARENT (1 << 4)
115# define JO_3D_MATERIAL_SCREEN_DOORS (1 << 5)
117# define JO_3D_MATERIAL_LIGHT (1 << 6)
119# define JO_3D_MATERIAL_FLIP_H (1 << 7)
121# define JO_3D_MATERIAL_FLIP_V (1 << 8)
123# define JO_3D_MATERIAL_END_CODES (1 << 9)
125# define JO_3D_MATERIAL_MIPMAPS (1 << 10)
127# define JO_3D_MATERIAL_SUBDIVISION (1 << 11)
130# define JO_3D_MATERIAL_SUBDIVISION_NEAR (1 << 12)
133# define JO_3D_MATERIAL_HIGH_SPEED_SHRINK (1 << 13)
135# define JO_3D_MATERIAL_USER(N) (1 << (16 + (N)))
163# define JO_3D_MAX_BONES (32)
165# define JO_3D_BONE_NO_GROUP (0xFFFF)
167# define JO_3D_ANIMATION_LOOP (1 << 0)
169# define JO_3D_ANIMATION_TICKS_PER_SECOND (60)
193# define JO_3D_MORPH_LOOP (1 << 0)
195# define JO_3D_MORPH_NORMALS (256)
211# define JO_3D_SKIN_ONE (32768)
350 const unsigned int material_flags);
352#ifdef JO_COMPILE_WITH_FS_SUPPORT
355# define JO_3D_MODEL_POOL_MAX_BLOCKS (256)
380 const unsigned int bytes);
527 const jo_3d_pose *
const other,
const int weight);
552 const unsigned int hidden_bones);
jo_3d_polygon_data data
Definition 3d.h:249
static __jo_force_inline void jo_3d_mesh_draw(jo_3d_mesh *const mesh)
Draw a mesh.
Definition 3d.h:1181
unsigned int polygon_count
Definition 3d.h:181
Mesh structure.
Definition 3d.h:248
Polygon data (3D model).
Definition 3d.h:177
#define jo_core_error(...)
Definition core.h:47
void * data
Definition entity.h:19
const char * name
Definition entity.h:9
unsigned int skin_count
Definition model.h:278
unsigned int normal_count
Definition model.h:251
jo_3d_model_group * groups
Definition model.h:258
short parent
Definition model.h:176
void jo_3d_set_neutral_gouraud_skipped(const bool skipped)
The next models created or loaded draw without gouraud only the polygons whose 4 gouraud colors leave...
int jo_3d_model_loaded_texture(const char *const name)
Get the sprite id of a texture already loaded by the models (embedded in a model, or loaded by jo_3d_...
bool morph_normals
Definition model.h:271
void jo_3d_set_unique_gouraud_tables(const bool unique)
The next models created or loaded get a gouraud table per polygon, in the order of the polygons (defa...
char name[16]
Definition model.h:183
const unsigned char * morph_data
Definition model.h:268
static __jo_force_inline const unsigned short * jo_3d_model_gouraud_colors(const jo_3d_model *const model)
The gouraud colors of a model as they were loaded: a game that writes its gouraud tables again (a lig...
Definition model.h:332
unsigned char other
Definition model.h:219
void(*) jo_3d_bone_callback(const int bone, void *const param, const jo_fixed(*const matrix)[3])
Called by jo_3d_model_draw_pose() after each bone is drawn, with the matrix of the bone (the program ...
Definition model.h:238
jo_3d_model * jo_3d_model_pool_read(jo_3d_model_pool *const pool, jo_file *const file, const unsigned int size)
Read the next model of a file (the content of a JOM file, see jo_3d_create_model_in_place()) into a p...
void jo_3d_model_free_textures_from(const int sprite_id)
Free the sprites added since a sprite (the textures of the models loaded since, their tiles and small...
void jo_3d_set_uniform_gouraud_skipped(const bool skipped)
The next models created or loaded draw without gouraud the polygons whose 4 gouraud colors are the sa...
jo_pos3D_fixed pivot
Definition model.h:177
jo_3d_mesh * mesh
Definition model.h:243
unsigned int offset
Definition model.h:207
unsigned short subdivision_error
Definition model.h:146
jo_pos3D_fixed center
Definition model.h:244
int jo_3d_model_find_morph(const jo_3d_model *const model, const char *const name)
Find a vertex animation of a model.
char name[16]
Definition model.h:155
unsigned int texture_count
Definition model.h:249
jo_pos3D_fixed * normals
Definition model.h:252
void jo_3d_model_pool_init(jo_3d_model_pool *const pool, const unsigned int block_size, const unsigned int bytes)
Start a pool of models.
unsigned char g
Definition model.h:142
bool jo_3d_model_is_animation(const jo_3d_model *const model, const int animation, const char *const name)
Check if an animation is the one jo_3d_model_find_animation() finds for a name (faster: the name of t...
bool single_block
Definition model.h:284
unsigned short * polygon_materials
Definition model.h:248
unsigned short duplicate
Definition model.h:205
void jo_3d_free_model(jo_3d_model *const model)
Free a model (the textures stay loaded).
unsigned int left
Definition model.h:365
unsigned int bone_count
Definition model.h:259
unsigned short gouraud_tables
Definition model.h:255
char name[16]
Definition model.h:140
unsigned int group_count
Definition model.h:257
unsigned short flags
Definition model.h:204
void jo_3d_model_set_hidden_bones(const unsigned int mask)
Bones not drawn by the next jo_3d_model_draw_pose() (a hat shot off the head of a character: its bone...
jo_3d_bone * bones
Definition model.h:260
bool jo_3d_slave_model_draw_morph(const jo_3d_model *const model, const int morph, const int time)
jo_3d_model_draw_morph() on the slave CPU (call it on the slave CPU: its own buffer,...
jo_3d_polygon_data * morph_draw[2]
Definition model.h:272
unsigned short key_ticks
Definition model.h:185
int jo_3d_model_find_bone(const jo_3d_model *const model, const char *const name)
Find a bone of a model.
unsigned short first_polygon
Definition model.h:158
jo_angle angles[(32)][3]
Definition model.h:228
unsigned int animation_count
Definition model.h:263
jo_3d_animation * animations
Definition model.h:264
bool jo_3d_model_use_fast_memory(jo_3d_model *const model)
Move what the drawing of a model reads for each vertex, polygon and bone (its points,...
unsigned short group
Definition model.h:175
jo_pos3D_fixed root
Definition model.h:227
void jo_3d_model_draw_pose(const jo_3d_model *const model, const jo_3d_pose *const pose, const jo_3d_bone_callback callback, void *const param)
Draw a model with a skeleton with the current matrix.
unsigned int offset
Definition model.h:189
unsigned short point
Definition model.h:217
jo_fixed radius
Definition model.h:245
signed char * bone_children
Definition model.h:261
jo_3d_model * jo_3d_create_model_from_memory(const unsigned char *const data, const unsigned int size)
Create a model from the content of a JOM file.
jo_3d_model * jo_3d_create_model_in_place(const unsigned char *const data, const unsigned int size)
Create a model that uses the content of a JOM file in place (like jo_3d_load_model(): the points,...
void * file
Definition model.h:280
unsigned int block_size
Definition model.h:368
jo_3d_morph * morphs
Definition model.h:267
static __jo_force_inline void jo_3d_model_draw(const jo_3d_model *const model)
Draw a model with the current matrix.
Definition model.h:626
unsigned char * block
Definition model.h:364
char name[16]
Definition model.h:174
unsigned short first_point
Definition model.h:156
unsigned short reserved
Definition model.h:221
const unsigned char * animation_data
Definition model.h:265
unsigned int flags
Definition model.h:148
bool jo_3d_model_set_environment(jo_3d_model *const model, const int sprite_id, const int tiles, const unsigned int material_flags)
Environment map on the polygons of a model whose material has a flag (the paint and the glass of a ca...
const jo_3d_skin_point * skin
Definition model.h:279
const unsigned short * jo_3d_model_file_gouraud_colors(const void *const data, const unsigned int polygon_count)
The gouraud colors of the polygons in the content of a JOM file ("GOUR" chunk).
void jo_3d_model_draw_morph(const jo_3d_model *const model, const int morph, const int time)
Draw a model with the current matrix, its points at a time of a vertex animation (the 2 frames around...
#define JO_3D_MODEL_POOL_MAX_BLOCKS
Maximum of memory blocks of a pool of models.
Definition model.h:355
void jo_3d_pose_blend(const jo_3d_model *const model, jo_3d_pose *const pose, const jo_3d_pose *const other, const int weight)
Blend 2 poses (a smooth change of animation).
#define JO_3D_MAX_BONES
Bones of a model at most (jo_3d_pose).
Definition model.h:163
jo_3d_material * materials
Definition model.h:247
unsigned short duplicate
Definition model.h:187
unsigned int morph_frame_size
Definition model.h:269
unsigned char bone
Definition model.h:218
int jo_3d_model_texture(const char *const filename)
Get the sprite id of a texture of the models (loaded the first time: a texture shared by several mode...
void jo_3d_morph_normal(const int index, jo_pos3D_fixed *const normal)
Direction of a normal of the vertex animations (the frames give the normal of each polygon as one byt...
char name[16]
Definition model.h:201
unsigned char r
Definition model.h:141
int jo_3d_model_morph_duration(const jo_3d_model *const model, const int morph)
Duration of a vertex animation.
jo_3d_model * jo_3d_load_model(const char *const filename)
Load a model (JOM file) from the current directory of the CD.
int jo_3d_model_find_animation(const jo_3d_model *const model, const char *const name)
Find an animation of a model.
unsigned char * blocks[(256)]
Definition model.h:370
unsigned char b
Definition model.h:143
unsigned short polygon_count
Definition model.h:159
bool file_not_owned
Definition model.h:282
unsigned int bytes_left
Definition model.h:366
unsigned short frame_count
Definition model.h:202
unsigned short morph_shift
Definition model.h:270
int * textures
Definition model.h:250
const unsigned char * jo_3d_model_find_chunk(const void *const data, const char *const tag, unsigned int *const size)
Find a chunk in the content of a JOM file (a chunk of the program too: the loader skips the chunks it...
void * fast_block
Definition model.h:286
unsigned short gouraud_table_count
Definition model.h:256
const jo_3d_model_group * jo_3d_model_find_group(const jo_3d_model *const model, const char *const name)
Find a group of a model.
unsigned short * corner_normals
Definition model.h:253
unsigned short frame_ticks
Definition model.h:203
void jo_3d_slave_model_draw_pose(const jo_3d_model *const model, const jo_3d_pose *const pose, const jo_3d_bone_callback callback, void *const param, const unsigned int hidden_bones)
Draw a model with a skeleton in a pose on the slave CPU (call it on the slave CPU,...
short texture
Definition model.h:145
unsigned short key_count
Definition model.h:184
int jo_3d_model_animation_duration(const jo_3d_model *const model, const int animation)
Duration of an animation.
unsigned int material_count
Definition model.h:246
void jo_3d_model_get_pose(const jo_3d_model *const model, const int animation, int time, jo_3d_pose *const pose)
Pose of a skeleton at a time of an animation (the keys are interpolated).
unsigned char shine
Definition model.h:144
unsigned short point_count
Definition model.h:157
jo_pos3D_fixed * vertex_colors
Definition model.h:254
int block_count
Definition model.h:369
void jo_3d_model_pool_free(jo_3d_model_pool *const pool)
Free the memory blocks of a pool (after its models: jo_3d_free_model()).
unsigned int morph_count
Definition model.h:266
unsigned int user
Definition model.h:149
unsigned short flags
Definition model.h:186
unsigned short weight
Definition model.h:220
Animation of a skeleton (the same layout as the file: 28 bytes).
Definition model.h:182
Bone of a rigid skeleton (the same layout as the file: 32 bytes).
Definition model.h:173
Material of a model (the same layout as the file: 32 bytes).
Definition model.h:139
3D model loaded from a JOM file
Definition model.h:242
Group of a model: OBJ o or g (the same layout as the file: 24 bytes).
Definition model.h:154
Models read one after the other from a file (the parts of a level) into big memory blocks,...
Definition model.h:363
Vertex animation (morph targets: the position of each point at each frame, the same layout as the fil...
Definition model.h:200
Pose of a skeleton: the angles of the bones (see jo_3d_model_get_pose() and jo_3d_model_draw_pose()).
Definition model.h:226
A point of a skeleton that follows 2 bones (the same layout as the file: 8 bytes): drawn by the bone ...
Definition model.h:216
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
short jo_angle
Angle.
Definition types.h:65
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:59
File definition.
Definition types.h:311
3D position using fixed numbers
Definition types.h:103