home *** CD-ROM | disk | FTP | other *** search
- //**********************************************************************
- // DIVE Laboratories, Inc.
- // Copyright(c) 1995
- // All rights reserved.
- // FILE: POLYGON.HPP
- //
- // DESCRIPTION
- // This file provides the function prototypes for the
- // polygonClass
- //
- // Author: M. Doucet
- //
- // Modification History:
- // 4/20/95 Created
- // 4/24/95 Change nVertices to numVertices
- // 4/27/95 Change computeNormal to calcNormal
- // 4/28/95 Remove calcNormal
- // Add calcDeterminant() & A,B,C,D
- // Add intxCheck() routines for poly-poly & poly-line
- // Add D4 for R,G,B,A color values
- // 8/24/95 Modified intxCheck
- //
- //**********************************************************************
- #ifndef POLYGON_HPP
- #define POLYGON_HPP
-
- #include "vrtypes.hpp"
- #include "vertex.hpp"
- #include "intxmsg.hpp"
-
- #ifndef AMBERRT
- #include "material.hpp"
- #include "texture.hpp"
- #endif
-
- class geoPrimSetClass;
- class geometryClass;
- class geometryPrivateClass;
- class renderStateClass;
-
- class polygonClass {
-
- friend class geometryClass;
- friend class geometryPrivateClass;
- friend class renderStateClass;
-
- private:
-
- // Polygon data
- //
- int nVerts;
- Vres A,B,C,D; // Determinants
- int id;
-
- // Storage
- void fixStorage();
-
- // Verification
- int allCoplanar();
-
- materialClass *mat;
-
- geoPrimSetClass *triSet;
- geometryClass *parent;
-
- public:
-
- F3 *texCoord;
- int rgbOverride, // Indicates that the user has supplied a specific rgb color
- tcOverride; // Indicates that the user has supplied a texture coordinate
-
- vertexClass **vertex;
- vectorClass normal;
- F4 color;
- flagType isBackSide; //AMB90009
- polygonClass *backside;
-
- #ifndef AMBERRT
- textureClass *tex;
- float textureRot, textureScale;
- F2 textureTrans;
- int textureMirrored;
- void rotateTexture(float rads);
- void translateTexture(F2 pos);
- void scaleTexture(float scale);
- void mirrorTexture();
- void setTexture(textureClass *t);
- void setTcOverride(int flag);
- int getTcOverride();
- #endif
-
-
- // Material Functions
- void setMaterial(materialClass *mat);
- void setMaterial(char *name);
- materialClass *getMaterial();
-
- // Color
- void setColor(F4 col);
- void getColor(F4 col);
- void setRgbOverride(int flag);
- int getRgbOverride();
-
- // Intersection operations (poly-poly poly-line)
- //
- int intxCheck(polygonClass *iPoly, V3& intxPos);
- int intxCheck(V3 from, V3 to);
- int intxCheck(V3 from, V3 to, V3& intxPos);
-
- // Vertex functions
- //
- int addVertex(vertexClass *v);
- int getNumVertices();
- vertexClass *getVertex(int index);
- void getVertexPos(int index, V3 pos);
-
- // Normal and facing routines
- //
- void calcDeterminants();
- vectorClass *getNormal();
- void getNormal(V3 vals);
- void swapFace();
- polygonClass *createBackFace();
-
- // Geo ID
- //
- int getId();
-
- geoPrimSetClass *getTriSet();
-
- polygonClass();
- ~polygonClass();
- };
-
- #endif
-