// // triangle3d.h // // An array of three point3d. // // Copyright (C) J. Belson 1999.02.07 // #ifndef _TRIANGLE3D_H_ #define _TRIANGLE3D_H_ #include "fcolour.h" #include "point3d.h" #include "vector3d.h" /// Triangle attributes enum flags { eINVISIBLE = 1<<0, eSEA = 1<<1, eLOW_GRAD = 1<<2, eMED_GRAD = 1<<3, eHIGH_GRAD = 1<<4, eSHADOW = 1<<5 }; /** * Represents a triange in 3d space */ class triangle3d { private: int state; // Information about triangle public: triangle3d(int p1, int p2, int p3); triangle3d(void) { state = 0; }; int point[3]; // Index into point array fcolour col; // Triangle base colour vector3d normal; // Normal vector void set_flag(flags f); // Manipulate flag void clear_flag(flags f); // states bool get_flag(flags f) const; // void get(int* p1, int* p2, int* p3); void set(int p1, int p2, int p3); void calculate_normal(const point3d* pnt3d); // XXX should be static to avoid bloating object size point3d find_centre(const point3d* points); void set_colour(const fcolour& col); // Get colour of this triangle void get_colour(fcolour* c); }; #endif // _TRIANGLE3D_H_