--- ray/src/common/objutil.h 2020/03/30 18:28:35 2.1 +++ ray/src/common/objutil.h 2020/05/02 00:12:45 2.6 @@ -1,4 +1,4 @@ -/* RCSid $Id: objutil.h,v 2.1 2020/03/30 18:28:35 greg Exp $ */ +/* RCSid $Id: objutil.h,v 2.6 2020/05/02 00:12:45 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 */ @@ -88,6 +91,10 @@ Scene * loadOBJ(Scene *sc, const char *fspec); /* Duplicate a scene */ Scene * dupScene(const Scene *sc); +/* Transform entire scene */ +int xfScene(Scene *sc, int xac, char *xav[]); +int xfmScene(Scene *sc, const char *xfm); + /* Add a descriptive comment */ void addComment(Scene *sc, const char *comment); @@ -148,11 +155,23 @@ int changeGroup(Scene *sc, const char *gname, int changeMaterial(Scene *sc, const char *mname, int flreq, int flexc); -/* Grab texture coord's/normals from another object via ray tracing */ -#define GET_TEXTURE 01 -#define GET_NORMALS 02 -int traceSurface(Scene *sc, int flreq, int flexc, - const char *oct, int what); +/* Add a vertex to our scene */ +int addVertex(Scene *sc, double x, double y, double z); + +/* Add a texture coordinate to our scene */ +int addTexture(Scene *sc, double u, double v); + +/* Add a surface normal to our scene */ +int addNormal(Scene *sc, double xn, double yn, double zn); + +/* Set current (last) group */ +void setGroup(Scene *sc, const char *nm); + +/* Set current (last) material */ +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);