home *** CD-ROM | disk | FTP | other *** search
/ VRML Tools for 3D Cyberspace / VRML_Tools_For_3D_Cyberspace.iso / amber / include / polygon.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-01  |  2.9 KB  |  136 lines

  1. //**********************************************************************
  2. //  DIVE Laboratories, Inc.
  3. //  Copyright(c) 1995
  4. //  All rights reserved.
  5. //  FILE:   POLYGON.HPP
  6. //
  7. //  DESCRIPTION
  8. //  This file provides the function prototypes for the 
  9. //  polygonClass
  10. //
  11. //  Author: M. Doucet
  12. //
  13. //  Modification History:
  14. //  4/20/95    Created
  15. //  4/24/95 Change nVertices to numVertices
  16. //  4/27/95 Change computeNormal to calcNormal
  17. //  4/28/95 Remove calcNormal
  18. //                Add calcDeterminant() & A,B,C,D
  19. //                Add intxCheck() routines for poly-poly & poly-line
  20. //                Add D4 for R,G,B,A color values
  21. //  8/24/95 Modified intxCheck
  22. //
  23. //**********************************************************************
  24. #ifndef POLYGON_HPP
  25. #define POLYGON_HPP
  26.  
  27. #include "vrtypes.hpp"
  28. #include "vertex.hpp"
  29. #include "intxmsg.hpp"
  30.  
  31. #ifndef AMBERRT
  32. #include "material.hpp"
  33. #include "texture.hpp"
  34. #endif
  35.  
  36. class geoPrimSetClass;
  37. class geometryClass;
  38. class geometryPrivateClass;
  39. class renderStateClass;
  40.  
  41. class polygonClass {
  42.  
  43.     friend class geometryClass;
  44.     friend class geometryPrivateClass;
  45.     friend class renderStateClass;
  46.  
  47. private:
  48.  
  49.     // Polygon data
  50.     //
  51.     int                     nVerts;
  52.     Vres                   A,B,C,D;             // Determinants
  53.     int                    id;
  54.  
  55.     // Storage
  56.     void fixStorage();
  57.  
  58.     // Verification
  59.     int allCoplanar();
  60.  
  61.     materialClass *mat;
  62.  
  63.     geoPrimSetClass *triSet;
  64.     geometryClass *parent;
  65.  
  66. public:
  67.  
  68.     F3    *texCoord;
  69.     int    rgbOverride, // Indicates that the user has supplied a specific rgb color
  70.             tcOverride;  // Indicates that the user has supplied a texture coordinate
  71.  
  72.     vertexClass **vertex;
  73.     vectorClass normal; 
  74.     F4             color;
  75.     flagType    isBackSide;  //AMB90009
  76.     polygonClass *backside;
  77.  
  78. #ifndef AMBERRT
  79.     textureClass *tex;
  80.     float textureRot, textureScale;
  81.     F2    textureTrans;
  82.     int   textureMirrored;
  83.     void  rotateTexture(float rads);
  84.     void  translateTexture(F2 pos);
  85.     void  scaleTexture(float scale);
  86.     void  mirrorTexture();
  87.     void  setTexture(textureClass *t);
  88.     void  setTcOverride(int flag);
  89.     int   getTcOverride();
  90. #endif
  91.  
  92.  
  93.     // Material Functions
  94.     void setMaterial(materialClass *mat);
  95.     void setMaterial(char *name);
  96.     materialClass *getMaterial();
  97.  
  98.     // Color
  99.     void setColor(F4 col);
  100.     void getColor(F4 col);
  101.     void setRgbOverride(int flag);
  102.     int  getRgbOverride();
  103.  
  104.    // Intersection operations (poly-poly poly-line)
  105.    //
  106.    int intxCheck(polygonClass *iPoly, V3& intxPos);
  107.    int intxCheck(V3 from, V3 to);
  108.    int intxCheck(V3 from, V3 to, V3& intxPos);
  109.  
  110.     // Vertex functions
  111.     //
  112.     int addVertex(vertexClass *v);
  113.     int getNumVertices();
  114.     vertexClass *getVertex(int index);
  115.     void getVertexPos(int index, V3 pos);
  116.  
  117.     // Normal and facing routines
  118.     //
  119.     void               calcDeterminants();
  120.     vectorClass  *getNormal();
  121.     void               getNormal(V3 vals);
  122.     void               swapFace();
  123.     polygonClass *createBackFace();
  124.     
  125.     // Geo ID
  126.     //
  127.     int  getId();
  128.  
  129.     geoPrimSetClass *getTriSet();
  130.  
  131.     polygonClass();
  132.     ~polygonClass();
  133. };
  134.  
  135. #endif
  136.