lib3d.h

#ifndef lib3d_h
#define lib3d_h

#define  MAX_LINES    10

class Point3D
{
 public:
 short      x;
 short    y;
 short    z;
};

class Line3D
{
 public:
 Line3D();
 Line3D(short x1, short y1, short z1, short x2, short y2, short z2);
 Point3D    p1;
 Point3D    p2;
};

class Scene3D
{
 public:
 Scene3D();
 void CreateScene(short resX, short resY, TVout* pTVout);
 void UpdateDisplay();
 void AddLine(Line3D line);
 void AddCube(short cX, short cY, short cZ, short edgeLen);
 void AddSphere(float r, Point3D c);
 void SetVAngle(float vNew);
 void SetHAngle(float hNew);

 private:
 TVout*    pTV;
 Line3D    lines[MAX_LINES];        // all the lines in a 3D wireframe model
 short       iNumLines;
 short    mv;        // middle vertically
 short    mh;        // the horizontal middle

 float    h;        // the angles
 float    v;         

 float    cosh;        // precalculated trig values for xyztox and xyztoy functions
 float    sinh;
 float    cosv;
 float    sinv;        

 int xyztox(short x, short y, short z);
 int xyztoy(short x, short y, short z);
 void UpdateConsts();
};

#endif

3 thoughts on “lib3d.h

Leave a Reply

Your email address will not be published. Required fields are marked *