#ifndef TXS_QUAD_FACE_GUARD #define TXS_QUAD_FACE_GUARD #include "TxsFace.h" #include "BareTri.h" namespace TXS { /* * The special 4-vertice case of TxsFace * The normal TxsFace only should be used for triangles */ class TxsQuadFace : public TxsFace { private: /* * The four tris that make up this possibly non-planar * quadrilat */ list slices; /* * The average plane - ie. the plane that all the slices project onto */ TxsVertex *avgVert; void calcAvgVert(); // also calculates this->normal void createTriSlices(); void calcUVPlaneAndBasis(); void calcUVPlaneBoundaryPlanes(); /* * This overrides calcEverything in TxsFace * This does: * - calcs edge planes * - calcs radial planes * - sets up UV plane */ virtual void calcEverything(TXS_REAL unitsPerPixel); virtual Plane calcEdgePlane(int iv); public: TxsQuadFace(vector *verts, TXS_REAL unitsPerPixel) : avgVert(NULL) { this->verts = *verts; this->calcEverything(unitsPerPixel); } virtual ~TxsQuadFace(); Point getPointForUV(const UVs &uv); bool intersectRay(const Point &s, const Vector &d, Point &intxOut, TXS_REAL &distOut); bool getRgbForRay(const Point &s, const Vector &d, int level, NormRGB &rgbOut); virtual Vector calcPhongNormalAt(const Point &p); }; } #endif /* TXS_QUAD_FACE_GUARD */