--- ray/src/common/objutil.h 2020/04/18 17:10:33 2.4 +++ ray/src/common/objutil.h 2020/05/02 00:21:13 2.7 @@ -1,4 +1,4 @@ -/* RCSid $Id: objutil.h,v 2.4 2020/04/18 17:10:33 greg Exp $ */ +/* RCSid $Id: objutil.h,v 2.7 2020/05/02 00:21:13 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 */ @@ -151,6 +154,24 @@ int changeGroup(Scene *sc, const char *gname, /* Change material for the indicated faces */ int changeMaterial(Scene *sc, const char *mname, int flreq, int flexc); + +/* 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, returning index */ +int addTexture(Scene *sc, double u, double v); + +/* Add a surface normal to our scene, returning index */ +int addNormal(Scene *sc, double xn, double yn, double zn); + +/* Set current group (sc->lastgrp) to given ID */ +void setGroup(Scene *sc, const char *nm); + +/* 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);