modular stuffs
[carveJwlIkooP6JGAAIwe30JlM.git] / model.h
diff --git a/model.h b/model.h
index 05790c655d204ed18668b8e1b101c4f03cba2989..fffd26d111228c8661989f7291208afec53d5b48 100644 (file)
--- a/model.h
+++ b/model.h
@@ -7,14 +7,15 @@
 
 #include "common.h"
 
-
 enum mdl_shader
 {
    k_shader_standard                = 0,
    k_shader_standard_cutout         = 1,
    k_shader_terrain_blend           = 2,
    k_shader_standard_vertex_blend   = 3,
-   k_shader_water                   = 4
+   k_shader_water                   = 4,
+   k_shader_invisible               = 5,
+   k_shader_boundary                = 6
 };
 
 enum mdl_surface_prop
@@ -28,10 +29,12 @@ enum mdl_surface_prop
 
 enum material_flag
 {
-   k_material_flag_skate_surface    = 0x1,
+   k_material_flag_skate_target     = 0x1,
    k_material_flag_collision        = 0x2,
    k_material_flag_grow_grass       = 0x4,
-   k_material_flag_grind_surface    = 0x8
+   k_material_flag_grindable        = 0x8,
+   k_material_flag_invisible        = 0x10,
+   k_material_flag_boundary         = 0x20
 };
 
 #pragma pack(push,1)
@@ -150,7 +153,7 @@ struct mdl_mesh
    u32 submesh_start,
        submesh_count,
        pstr_name,
-       flags,
+       entity_id,    /* upper 16 bits: type, lower 16 bits: index */
        armature_id;
 };
 
@@ -164,7 +167,7 @@ struct mdl_file
 struct mdl_texture
 {
    mdl_file file;
-   u32 type;
+   u32 glname;
 };
 
 struct mdl_array
@@ -239,9 +242,15 @@ VG_STATIC u32 mdl_query_array_size( mdl_array *arr )
       return 0;
 }
 
+VG_STATIC const char *mdl_pstr( mdl_context *mdl, u32 pstr );
 VG_STATIC 
 void mdl_fread_pack_file( mdl_context *mdl, mdl_file *info, void *dst )
 {
+   if( !info->pack_size ){
+      vg_warn( "path: %s\n", mdl_pstr( mdl, info->pstr_path ) );
+      vg_fatal_exit_loop( "Packed file is only a header; it is not packed" );
+   }
+
    fseek( mdl->file, mdl->pack_base_offset+info->pack_offset, SEEK_SET );
    u64 l = fread( dst, info->pack_size, 1, mdl->file );
 
@@ -340,13 +349,6 @@ VG_STATIC int mdl_load_animation_block( mdl_context *mdl, void *lin_alloc )
    return mdl_load_array( mdl, &mdl->keyframes, "mdl_keyframe", lin_alloc );
 }
 
-#if 0
-VG_STATIC int mdl_load_pack_block( mdl_context *mdl, void *lin_alloc )
-{
-   return mdl_load_array( mdl, &mdl->pack, "pack", lin_alloc );
-}
-#endif
-
 /*
  * if calling mdl_open, and the file does not exist, the game will fatal quit
  */