49 #include "AxisAlignedBox.h"
59 # include <OpenGL/gl.h>
66 class Feedback3DColor ;
70 #define EPS_SMOOTH_LINE_FACTOR 0.06
79 : _pos(loc[0],loc[1],loc[2]),
80 _red(loc[3]),_green(loc[4]),_blue(loc[5]),_alpha(loc[6]) {}
82 inline FLOAT x()
const {
return _pos[0] ; }
83 inline FLOAT y()
const {
return _pos[1] ; }
84 inline FLOAT z()
const {
return _pos[2] ; }
85 inline GLfloat red()
const {
return _red ; }
86 inline GLfloat green()
const {
return _green ; }
87 inline GLfloat blue()
const {
return _blue ; }
88 inline GLfloat alpha()
const {
return _alpha ; }
89 inline const Vector3& pos()
const {
return _pos ; }
93 return Feedback3DColor(x()+v.x(),y()+v.y(),z()+v.z(),red()+v.red(),green()+v.green(),blue()+v.blue(),alpha()+v.alpha()) ;
97 return Feedback3DColor(x()*f,y()*f,z()*f,red()*GLfloat(f),green()*GLfloat(f),blue()*GLfloat(f),alpha()*GLfloat(f)) ;
104 static int sizeInBuffer() {
return 7 ; }
106 friend std::ostream& operator<<(std::ostream&,
const Feedback3DColor&) ;
109 Feedback3DColor(FLOAT x, FLOAT y, FLOAT z, GLfloat r, GLfloat g, GLfloat b, GLfloat a)
110 :_pos(x,y,z), _red(r), _green(g), _blue(b), _alpha(a) {}
130 virtual const Vector3& vertex(
int)
const = 0 ;
132 virtual FLOAT Get_I_EPS(
Primitive *)
const ;
133 Vect3 VerticalProjectPointOnSupportPlane(
const Vector3 &)
const ;
134 void IntersectPrimitiveWithSupportPlane(
Primitive *,
int[],FLOAT[],Vect3 *&,Vect3 *&) ;
135 inline FLOAT Equation(
const Vect3& p) {
return p*_normal-_C ; }
137 void GetSigns(
Primitive *,
int * &,FLOAT * &,
int &,
int &,FLOAT) ;
138 FLOAT Const()
const {
return _C ; }
140 int depth()
const {
return _depth ; }
141 void setDepth(
int d)
const { _depth = d ; }
144 virtual unsigned int nbVertices()
const = 0 ;
157 virtual const Vector3& vertex(
int)
const ;
158 virtual unsigned int nbVertices()
const {
return 1 ; }
171 virtual unsigned int nbVertices()
const {
return 2 ; }
172 virtual const Vector3& vertex(
int)
const ;
188 Polygone(
const std::vector<Feedback3DColor>&) ;
191 virtual int IsAPolygon() {
return 1 ; }
193 void InitEquation(
double &,
double &,
double &,
double &) ;
196 virtual const Vector3& vertex(
int)
const ;
197 virtual unsigned int nbVertices()
const {
return _vertices.size() ; }
199 double equation(
const Vector3& p)
const ;
200 const NVector3& normal()
const {
return _normal ; }
201 double c()
const {
return _c ; }
203 FLOAT FlatFactor()
const {
return anglefactor ; }
206 virtual void initNormal() ;
207 void CheckInfoForPositionOperators() ;
210 std::vector<Feedback3DColor> _vertices ;