--- ray/src/common/objutil.h 2020/05/01 18:55:34 2.5 +++ ray/src/common/objutil.h 2020/06/23 19:29:40 2.8 @@ -1,4 +1,4 @@ -/* RCSid $Id: objutil.h,v 2.5 2020/05/01 18:55:34 greg Exp $ */ +/* RCSid $Id: objutil.h,v 2.8 2020/06/23 19:29:40 greg Exp $ */ /* * Declarations for .OBJ file utility * @@ -23,6 +23,9 @@ struct Face; /* forward declaration */ +typedef int VNDX[3]; /* vertex indices (point,map,normal) */ + +/* Structure to hold vertex indices and link back to face list */ typedef struct { int vid; /* vertex id */ int tid; /* texture id */ @@ -95,6 +98,9 @@ int xfmScene(Scene *sc, const char *xfm); /* Add a descriptive comment */ void addComment(Scene *sc, const char *comment); +/* Find index for comment containing the given string (starting from n) */ +int findComment(Scene *sc, const char *match, int n); + /* Clear comments */ void clearComments(Scene *sc); @@ -152,20 +158,23 @@ int changeGroup(Scene *sc, const char *gname, int changeMaterial(Scene *sc, const char *mname, int flreq, int flexc); -/* Add a vertex to our scene */ +/* Add a vertex to our scene, returning index */ int addVertex(Scene *sc, double x, double y, double z); -/* Add a texture coordinate to our scene */ +/* Add a texture coordinate to our scene, returning index */ int addTexture(Scene *sc, double u, double v); -/* Add a surface normal to our scene */ +/* Add a surface normal to our scene, returning index */ int addNormal(Scene *sc, double xn, double yn, double zn); -/* Set current (last) group */ +/* Set current group (sc->lastgrp) to given ID */ void setGroup(Scene *sc, const char *nm); -/* Set current (last) material */ +/* Set current material (sc->lastmat) to given ID */ void setMaterial(Scene *sc, const char *nm); + +/* Add a new face to our scene, using current group and material */ +Face * addFace(Scene *sc, VNDX vid[], int nv); /* Free a scene */ void freeScene(Scene *sc);