home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / shareware / crystalppc / vertex.h < prev    next >
C/C++ Source or Header  |  1998-06-08  |  2KB  |  62 lines

  1. #ifndef VERTEX_H
  2. #define VERTEX_H
  3.  
  4. #ifndef MATH3D_H
  5. #include "math3d.h"
  6. #endif
  7.  
  8. class Vertex
  9. {
  10. private:
  11.   // The following are essential to the vertex. They 'describe' it.
  12.   Vector3 vo;        // Coordinates in object space.
  13.   Vector3 v;        // Coordinates in world space.
  14.  
  15.   // The following are transient variables recalculated at specified times.
  16.   // They contain redundant information.
  17.   Vector3 vr;        // Coordinates in camera space.
  18.   int visible;        // TRUE if visible.
  19.  
  20. public:
  21.   Vertex (Vector3& v);
  22.   Vertex (float x, float y, float z);
  23.   Vertex ();
  24.   ~Vertex () { }
  25.  
  26.   void set (Vector3& v);
  27.   void set (float x, float y, float z);
  28.   float get_x () { return v.x; }
  29.   float get_y () { return v.y; }
  30.   float get_z () { return v.z; }
  31.   Vector3& get_v () { return v; }
  32.  
  33.   void set_t (Vector3& vr);
  34.   void set_t (float x, float y, float z);
  35.   float get_tx () { return vr.x; }
  36.   float get_ty () { return vr.y; }
  37.   float get_tz () { return vr.z; }
  38.   Vector3& get_tv () { return vr; }
  39.  
  40.   int is_visible () { return visible; }
  41.  
  42.   void set_o (Vector3& vo);
  43.   void set_o (float x, float y, float z);
  44.   float get_ox () { return vo.x; }
  45.   float get_oy () { return vo.y; }
  46.   float get_oz () { return vo.z; }
  47.   Vector3& get_ov () { return vo; }
  48.  
  49.   void world_to_camera (Matrix3& m_w2c, Vector3& v_w2c);
  50.   void object_to_world (Matrix3& m_o2w, Matrix3& m_w2o, Vector3& v_o2w);
  51.   void translate (Vector3& v_w2c);
  52.  
  53.   void dump ();
  54.  
  55.   void save (FILE* fp, int indent);
  56.   void load (char** buf);
  57. };
  58.  
  59.  
  60. #endif /*VERTEX_H*/
  61.  
  62.