Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.1 KiB

  1. typedef struct
  2. {
  3. float fX, fY, fZ;
  4. float fNx, fNy, fNz;
  5. DWORD dwColor;
  6. } VERTEX;
  7. typedef struct
  8. {
  9. int iV1;
  10. int iV2;
  11. int iV3;
  12. } TRIANGLE;
  13. enum {
  14. OBJECT_TYPE_SPHERE = 0,
  15. OBJECT_TYPE_TORUS,
  16. OBJECT_TYPE_CYLINDER
  17. };
  18. class OBJECT {
  19. public:
  20. OBJECT( int rings, int sections );
  21. ~OBJECT( );
  22. int VertexCount() { return nVerts; }
  23. int TriangleCount() { return nTris; }
  24. VERTEX *VertexData() { return pVertData; }
  25. TRIANGLE *TriangleData() { return pTriData; }
  26. int NumRings() { return nRings; }
  27. int NumSections() { return nSections; }
  28. protected:
  29. int iType; // object type
  30. int alphaVal; // opacity of the object
  31. int nVerts, nTris;
  32. int nRings, nSections;
  33. VERTEX *pVertData;
  34. TRIANGLE *pTriData;
  35. };
  36. class SPHERE : public OBJECT {
  37. public:
  38. SPHERE( int rings, int sections, float fAlpha );
  39. private:
  40. void GenerateData( float fRadius );
  41. int CalcNVertices();
  42. int CalcNTriangles();
  43. };