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

  1. //**********************************************************************
  2. //  DIVE Laboratories, Inc.
  3. //  Copyright(c) 1995
  4. //  All rights reserved.
  5. //  FILE:   TRIANGLE.HPP
  6. //
  7. //  DESCRIPTION
  8. //  This file provides the function prototypes for the 
  9. //  triangleClass
  10. //
  11. //  Author: M. Doucet
  12. //
  13. //  Modification History:
  14. //  6/13/95    Created
  15. //
  16. //**********************************************************************
  17. #ifndef _TRIANGLE_HPP
  18. #define _TRIANGLE_HPP
  19.  
  20. #include "vrtypes.hpp"
  21. #include "vertex.hpp"
  22.  
  23. #ifndef AMBERRT
  24. #include "texture.hpp"
  25. #include "material.hpp"
  26. #endif
  27.  
  28. class triangleClass {
  29.  
  30. private:
  31.  
  32.     // Polygon data
  33.     //
  34.     int                     nVerts;
  35.     Vres                    A,B,C,D;             // Determinants
  36.  
  37. public:
  38.  
  39.     F3    texCoord[3];
  40.     int   rgbOverride, // Indicates that the user has supplied a specific rgb color
  41.             tcOverride;  // Indicates that the user has supplied a texture coordinate
  42.  
  43.     vertexClass *vertex[3];
  44.     vectorClass normal; 
  45.     F4             color;
  46.  
  47. #ifndef AMBERRT
  48.     textureClass *tex;
  49.     materialClass *mat;
  50.     float textureRot, textureScale;
  51.     F2    textureTrans;
  52.     int   textureMirrored;
  53.     void  rotateTexture(float rads);
  54.     void  translateTexture(F2 pos);
  55.     void  scaleTexture(float scale);
  56.     void  mirrorTexture();
  57.     void  setTexture(textureClass *t);
  58.     void  setTcOverride(int flag);
  59.     int   getTcOverride();
  60. #endif
  61.  
  62.     // Color
  63.     void setColor(F4 col);
  64.     void setRgbOverride(int flag);
  65.     int  getRgbOverride();
  66.  
  67.     // Vertex functions
  68.     //
  69.     int addVertex(vertexClass *v);
  70.     int getNumVertices();
  71.     vertexClass *getVertex(int index);
  72.     void getVertexPos(int index, V3 pos);
  73.  
  74.     // Normal and facing routines
  75.     //
  76.     void              calcDeterminants();
  77.     vectorClass *getNormal();
  78.     void              getNormal(V3 vals);
  79.     void              swapFace();
  80.     
  81.     triangleClass();
  82.     ~triangleClass();
  83. };
  84.  
  85. #endif
  86.