Go to the documentation of this file.
4 #ifndef tools_sg_tessellate
5 #define tools_sg_tessellate
15 #include "../S_STRING"
32 mem::increment(s_class().c_str());
37 mem::decrement(s_class().c_str());
50 mem::increment(s_class().c_str());
54 if(&a_from==
this)
return *
this;
83 #include "../S_STRING"
87 #include "../glutess/glutess"
99 mem::increment(s_class().c_str());
119 mem::decrement(s_class().c_str());
125 mem::increment(s_class().c_str());
137 if(&a_from==
this)
return *
this;
146 double* pos = (
double*)a_contour;
147 for(
size_t i=0;i<a_npt;i++,pos+=3) {
166 tess_prim& prim = *(
self.m_prims->back());
179 double* vertex = (
double*)a_vertex;
180 self.
m_coords->push_back(
float(vertex[0]));
181 self.m_coords->push_back(
float(vertex[1]));
182 self.m_coords->push_back(
float(vertex[2]));
190 tess_prim& prim = *(
self.m_prims->back());
197 float* data = vec_data<float>(prim.
m_coords);
202 self.m_out <<
"tools::sg::tessellate::end_cbk : "
203 <<
" add_triangles failed."
209 self.m_out <<
"tools::sg::tessellate::end_cbk : "
210 <<
" add_triangle_strip failed."
217 self.m_out <<
"tools::sg::tessellate::end_cbk : "
218 <<
" add_triangle_fan failed."
223 self.m_out <<
"tools::sg::tessellate::end_cbk : "
224 <<
" mode " << prim.
m_mode <<
" not yet treated."
230 self.m_out <<
"tools::sg::tessellate::end_cbk :"
231 <<
" primitive anomaly."
232 <<
" num points " << num
233 <<
" mode " << prim.
m_mode
234 <<
" (TRIANGLES=4, STRIP=5, FAN=6)."
236 float* pos = vec_data<float>(prim.
m_coords);
237 for(
size_t ipt=0;ipt<num;ipt++) {
238 self.m_out <<
" " << ipt <<
" :"
294 virtual bool project(
float&,
float&,
float&,
float&) {
return true;}
295 virtual bool add_point(
float,
float,
float,
float) {
return false;}
297 float,
float,
float,
float) {
return false;}
299 float,
float,
float,
float) {
return false;}
300 virtual bool add_line(
float,
float,
float,
float,
float,
float,
float,
float,
301 float,
float,
float,
float,
float,
float,
float,
float) {
306 float a_p2x,
float a_p2y,
float a_p2z,
float,
307 float a_p3x,
float a_p3y,
float a_p3z,
float){
309 float vx = a_p2x-a_p1x;
310 float vy = a_p2y-a_p1y;
311 float vz = a_p2z-a_p1z;
313 float wx = a_p3x-a_p2x;
314 float wy = a_p3y-a_p2y;
315 float wz = a_p3z-a_p2z;
320 float cx = vy*wz-vz*wy;
321 float cy = vz*wx-vx*wz;
322 float cz = vx*wy-vy*wx;
324 float len = (float)::sqrt(cx*cx + cy*cy + cz*cz);
374 virtual bool add_triangle(
float a_p1x,
float a_p1y,
float a_p1z,
float a_p1w,
375 float,
float,
float,
float,
376 float a_p2x,
float a_p2y,
float a_p2z,
float a_p2w,
377 float,
float,
float,
float,
378 float a_p3x,
float a_p3y,
float a_p3z,
float a_p3w,
379 float,
float,
float,
float){
381 a_p2x,a_p2y,a_p2z,a_p2w,
382 a_p3x,a_p3y,a_p3z,a_p3w);
386 (void)a_x;(void)a_y;(void)a_z;
390 float a_nx,
float a_ny,
float a_nz) {
391 (void)a_x;(void)a_y;(void)a_z;(void)a_w;
392 (void)a_nx;(void)a_ny;(void)a_nz;
396 float a_nx,
float a_ny,
float a_nz,
397 float a_r,
float a_g,
float a_b,
float a_a) {
398 (void)a_x;(void)a_y;(void)a_z;(void)a_w;
399 (void)a_nx;(void)a_ny;(void)a_nz;
400 (void)a_r;(void)a_g;(void)a_b;(void)a_a;
404 float a_bnx,
float a_bny,
float a_bnz,
405 float a_ex,
float a_ey,
float a_ez,
float a_ew,
406 float a_enx,
float a_eny,
float a_enz) {
407 (void)a_bx;(void)a_by;(void)a_bz;(void)a_bw;
408 (void)a_bnx;(void)a_bny;(void)a_bnz;
409 (void)a_ex;(void)a_ey;(void)a_ez;(void)a_ew;
410 (void)a_enx;(void)a_eny;(void)a_enz;
414 float a_bnx,
float a_bny,
float a_bnz,
415 float a_br,
float a_bg,
float a_bb,
float a_ba,
416 float a_ex,
float a_ey,
float a_ez,
float a_ew,
417 float a_enx,
float a_eny,
float a_enz,
418 float a_er,
float a_eg,
float a_eb,
float a_ea){
419 (void)a_bx;(void)a_by;(void)a_bz;(void)a_bw;
420 (void)a_bnx;(void)a_bny;(void)a_bnz;
421 (void)a_br;(void)a_bg;(void)a_bb;(void)a_ba;
422 (void)a_ex;(void)a_ey;(void)a_ez;(void)a_ew;
423 (void)a_enx;(void)a_eny;(void)a_enz;
424 (void)a_er;(void)a_eg;(void)a_eb;(void)a_ea;
428 float a_p1x,
float a_p1y,
float a_p1z,
float a_p1w,
429 float a_n1x,
float a_n1y,
float a_n1z,
430 float a_p2x,
float a_p2y,
float a_p2z,
float a_p2w,
431 float a_n2x,
float a_n2y,
float a_n2z,
432 float a_p3x,
float a_p3y,
float a_p3z,
float a_p3w,
433 float a_n3x,
float a_n3y,
float a_n3z) {
435 a_p2x,a_p2y,a_p2z,a_p2w,
436 a_p3x,a_p3y,a_p3z,a_p3w);
440 (void)a_n1x;(void)a_n1y;(void)a_n1z;
441 (void)a_n2x;(void)a_n2y;(void)a_n2z;
442 (void)a_n3x;(void)a_n3y;(void)a_n3z;
446 float a_p1x,
float a_p1y,
float a_p1z,
float a_p1w,
447 float a_n1x,
float a_n1y,
float a_n1z,
448 float a_r1,
float a_g1,
float a_b1,
float a_a1,
449 float a_p2x,
float a_p2y,
float a_p2z,
float a_p2w,
450 float a_n2x,
float a_n2y,
float a_n2z,
451 float a_r2,
float a_g2,
float a_b2,
float a_a2,
452 float a_p3x,
float a_p3y,
float a_p3z,
float a_p3w,
453 float a_n3x,
float a_n3y,
float a_n3z,
454 float a_r3,
float a_g3,
float a_b3,
float a_a3){
457 a_p2x,a_p2y,a_p2z,a_p2w,
459 a_p3x,a_p3y,a_p3z,a_p3w,
460 a_r3,a_g3,a_b3,a_a3);
464 (void)a_n1x;(void)a_n1y;(void)a_n1z;
465 (void)a_n2x;(void)a_n2y;(void)a_n2z;
466 (void)a_n3x;(void)a_n3y;(void)a_n3z;
470 add_prm(std::ostream& a_out,std::vector<float>& a_norms)
#define GLU_TESS_WINDING_POSITIVE
GLUAPI void GLUAPIENTRY gluTessCallback(GLUtesselator *tess, GLUenum which, _GLUfuncptr CallBackFunc)
#define GLU_TESS_COMBINE_DATA
GLUAPI void GLUAPIENTRY gluTessBeginPolygon(GLUtesselator *tess, GLUvoid *data)
#define TOOLS_SCLASS(a_name)
GLUAPI void GLUAPIENTRY gluTessBeginContour(GLUtesselator *tess)
#define GLU_TESS_ERROR_DATA
#define tools_vforit(a__T, a__v, a__it)
#define GLU_TESS_END_DATA
GLUAPI void GLUAPIENTRY gluTessEndContour(GLUtesselator *tess)
#define GLU_TESS_BEGIN_DATA
GLUAPI void GLUAPIENTRY gluDeleteTess(GLUtesselator *tess)
GLUAPI void GLUAPIENTRY gluTessEndPolygon(GLUtesselator *tess)
GLUAPI GLUtesselator *GLUAPIENTRY gluNewTess(void)
GLUAPI void GLUAPIENTRY gluTessProperty(GLUtesselator *tess, GLUenum which, GLUdouble data)
#define GLU_TESS_VERTEX_DATA
#define GLU_TESS_WINDING_RULE