audio&island
[carveJwlIkooP6JGAAIwe30JlM.git] / model.h
diff --git a/model.h b/model.h
index 9788dc1446c080aaf15f71a00beee5fb1b163c8d..430ed26d7425d684670bddeb0931a9b9b45039de 100644 (file)
--- a/model.h
+++ b/model.h
@@ -22,16 +22,6 @@ struct model
        marker_count;
 };
 
-struct sdf_primative
-{
-   v4f origin;   /* xyz, yaw */
-   /* Cone: 
-       x  base scale
-       y  height 
-   */
-   v4f info;
-};
-
 struct submodel
 {
    u32 indice_start,
@@ -40,19 +30,15 @@ struct submodel
        vertex_count;
    
    boxf bbx;
-   v3f pivot;
-   sdf_primative sdf;
-
-   enum esdf_type
-   {
-      k_sdf_none = 0,
-      k_sdf_cone,
-      k_sdf_sphere,
-      k_sdf_box
-   }
-   sdf_type;
-
+   v3f pivot; /* same as co? */
+   v4f q;
    char name[32];
+   char material[32];
+};
+
+struct classtype_gate
+{
+   u32 target;
 };
 
 struct model_marker
@@ -60,6 +46,8 @@ struct model_marker
    v3f co;
    v4f q;
    v3f s;
+   u32 classtype;
+   u32 offset;
    char name[32];
 };
 
@@ -78,12 +66,6 @@ struct glmesh
    u32 indice_count;
 };
 
-#define VERTEX_STANDARD_ATTRIBUTES                    \
-       "layout (location=0) in vec3 a_co;"                \
-   "layout (location=1) in vec3 a_norm;"              \
-   "layout (location=2) in vec4 a_colour;"            \
-   "layout (location=3) in vec2 a_uv;"
-
 static void mesh_upload( glmesh *mesh,
       model_vert *verts, u32 vert_count,
       u32 *indices, u32 indice_count )
@@ -172,6 +154,12 @@ static u32 *submodel_indice_data( model *mdl, submodel *sub )
    return model_indice_base(mdl) + sub->indice_start;
 }
 
+static void *get_entdata_raw( model *mdl, model_marker *marker )
+{
+   return ((void *)(model_indice_base(mdl) + mdl->indice_count)) + 
+      marker->offset;
+}
+
 static submodel *submodel_get( model *mdl, const char *name )
 {
    for( int i=0; i<mdl->layer_count; i++ )
@@ -203,6 +191,13 @@ static void submodel_draw( submodel *sm )
    mesh_drawn( sm->indice_start, sm->indice_count );
 }
 
+static void model_unpack_submodel( model *model, glmesh *mesh, submodel *sm )
+{
+   mesh_upload( mesh, 
+         model_vertex_base( model ) + sm->vertex_start, sm->vertex_count,
+         model_indice_base( model ) + sm->indice_start, sm->indice_count );
+}
+
 static void model_unpack( model *model, glmesh *mesh )
 {
    u32 offset = model_get_submodel( model, 0 )->vertex_count;