X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=model.h;fp=model.h;h=cfd7e64a222a2416d6f3e6207a19944c19e7d029;hb=93790b71d3a89724255dc73239e38c08ad4bbac7;hp=ae19f6f090d57848ff97fdb9d8f9df2533377a6e;hpb=8d336ea2cde7c596296dbaf0d3ce27a82c6c6cf0;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/model.h b/model.h index ae19f6f..cfd7e64 100644 --- a/model.h +++ b/model.h @@ -5,7 +5,7 @@ #pragma once #define MDL_VERSION_MIN 101 -#define MDL_VERSION_NR 105 +#define MDL_VERSION_NR 106 enum mdl_shader{ k_shader_standard = 0, @@ -124,7 +124,15 @@ static void mdl_transform_mul( mdl_transform *a, mdl_transform *b, v3_mul( a->s, b->s, d->s ); } -struct mdl_material +struct mdl_file +{ + u32 pstr_path, + pack_offset, + pack_size; +}; + +#if (MDL_VERSION_MIN <= 105) +struct mdl_material_v105 { u32 pstr_name, shader, @@ -138,6 +146,27 @@ struct mdl_material tex_none0, tex_none1; }; +#endif + +struct mdl_material +{ + u32 pstr_name, + shader, + flags, + surface_prop; + + union + { + struct + { + u32 offset, size; + /* -> vg_msg containing KV properties */ + } + kvs; + void *compiled; /* -> shader specific structure for render */ + } + props; +}; struct mdl_bone { @@ -212,13 +241,6 @@ struct mdl_mesh armature_id; }; -struct mdl_file -{ - u32 pstr_path, - pack_offset, - pack_size; -}; - struct mdl_texture { mdl_file file; @@ -299,6 +321,7 @@ void mdl_fread_pack_file( mdl_context *mdl, mdl_file *info, void *dst ); int mdl_load_animation_block( mdl_context *mdl, void *lin_alloc ); int mdl_load_metadata_block( mdl_context *mdl, void *lin_alloc ); int mdl_load_mesh_block( mdl_context *mdl, void *lin_alloc ); +int mdl_load_materials( mdl_context *mdl, void *lin_alloc ); /* load mesh */ void mdl_async_load_glmesh( mdl_context *mdl, glmesh *mesh, u32 *fixup_table );