mesh
[vrtris] / src / cmesh.h
index 4531d0b..2039e10 100644 (file)
@@ -33,9 +33,9 @@ int cmesh_init(struct cmesh *cm);
 void cmesh_destroy(struct cmesh *cm);
 
 void cmesh_clear(struct cmesh *cm);
-void cmesh_copy(struct cmesh *cmdest, struct cmesh *cmsrc);
+int cmesh_clone(struct cmesh *cmdest, struct cmesh *cmsrc);
 
-void cmesh_set_name(struct cmesh *cm, const char *name);
+int cmesh_set_name(struct cmesh *cm, const char *name);
 const char *cmesh_name(struct cmesh *cm);
 
 int cmesh_has_attrib(struct cmesh *cm, int attr);
@@ -46,8 +46,10 @@ int cmesh_indexed(struct cmesh *cm);
  */
 float *cmesh_set_attrib(struct cmesh *cm, int attr, int nelem, unsigned int num,
                const float *vdata);
-float *cmesh_attrib(struct cmesh *cm, int attr);       /* invalidates VBO */
+float *cmesh_attrib(struct cmesh *cm, int attr);                       /* invalidates VBO */
 const float *cmesh_attrib_ro(struct cmesh *cm, int attr);      /* doesn't invalidate */
+float *cmesh_attrib_at(struct cmesh *cm, int attr, int idx);
+const float *cmesh_attrib_at_ro(struct cmesh *cm, int attr, int idx);
 int cmesh_attrib_count(struct cmesh *cm, int attr);
 
 /* indices can be 0, in which case only memory is allocated
@@ -61,18 +63,18 @@ int cmesh_index_count(struct cmesh *cm);
 int get_poly_count(struct cmesh *cm);
 
 /* attr can be -1 to invalidate all attributes */
-void cmesh_invalidate_attrib(struct cmesh *cm, int attr);
-void cmesh_invalidate_index(struct cmesh *cm);
+void cmesh_invalidate_vbo(struct cmesh *cm, int attr);
+void cmesh_invalidate_ibo(struct cmesh *cm);
 
 int cmesh_append(struct cmesh *cmdest, struct cmesh *cmsrc);
 
 /* immediate-mode style mesh construction interface */
 int cmesh_vertex(struct cmesh *cm, float x, float y, float z);
-int cmesh_normal(struct cmesh *cm, float nx, float ny, float nz);
-int cmesh_tangent(struct cmesh *cm, float tx, float ty, float tz);
-int cmesh_texcoord(struct cmesh *cm, float u, float v, float w);
-int cmesh_boneweights(struct cmesh *cm, float w1, float w2, float w3, float w4);
-int cmesh_boneidx(struct cmesh *cm, int idx1, int idx2, int idx3, int idx4);
+void cmesh_normal(struct cmesh *cm, float nx, float ny, float nz);
+void cmesh_tangent(struct cmesh *cm, float tx, float ty, float tz);
+void cmesh_texcoord(struct cmesh *cm, float u, float v, float w);
+void cmesh_boneweights(struct cmesh *cm, float w1, float w2, float w3, float w4);
+void cmesh_boneidx(struct cmesh *cm, int idx1, int idx2, int idx3, int idx4);
 
 /* dir_xform can be null, in which case it's calculated from xform */
 void cmesh_apply_xform(struct cmesh *cm, float *xform, float *dir_xform);