#define MDL_SIZE_MAX 0x1000000
#define MDL_VERT_MAX 1000000
#define MDL_INDICE_MAX 1000000
-#define MDL_MATERIAL_MAX 500
+#define MDL_MATERIAL_MAX 32
#define MDL_NODE_MAX 4000
#define MDL_SUBMESH_MAX 8000
#define MDL_STRING_LENGTH_MAX 64
struct classtype_gate
{
u32 target;
+ v3f dims;
};
struct classtype_spawn
u32 target, target1;
};
+struct classtype_instance
+{
+ u32 pstr_file;
+};
+
+struct classtype_capsule
+{
+ float height, radius;
+};
+
+struct classtype_route_node
+{
+ u32 target, target1;
+};
+
+struct classtype_route
+{
+ u32 pstr_name;
+ u32 id_start;
+ v3f colour;
+};
+
#pragma pack(pop)
/*
return mdl_baseptr( mdl, mdl->entdata_offset ) + pnode->offset;
}
+static void mdl_link_materials( mdl_header *root, mdl_header *child )
+{
+ u32 lookup[MDL_MATERIAL_MAX];
+
+ for( int i=0; i<child->material_count; i++ )
+ {
+ mdl_material *mi = mdl_material_from_id( child, i );
+ const char *si = mdl_pstr( child, mi->pstr_name );
+
+ lookup[i] = 0;
+
+ for( int j=0; j<root->material_count; j++ )
+ {
+ mdl_material *mj = mdl_material_from_id( root, j );
+ const char *sj = mdl_pstr( root, mj->pstr_name );
+
+ if( !strcmp( si, sj ) )
+ {
+ lookup[i] = j;
+ break;
+ }
+ }
+
+ if( lookup[i] == 0 && i != 0 )
+ {
+ vg_warn( "Could not link material '%s' (not present in root model)\n",
+ si );
+ }
+ }
+
+ for( int i=0; i<child->submesh_count; i++ )
+ {
+ mdl_submesh *sm = mdl_submesh_from_id( child, i );
+ sm->material_id = lookup[sm->material_id];
+ }
+}
+
#endif