g4tools  5.4.0
tessellate
Go to the documentation of this file.
1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
2 // See the file tools.license for terms.
3 
4 #ifndef tools_sg_tessellate
5 #define tools_sg_tessellate
6 
7 //#include "../tessellate"
8 
9 #include <vector>
10 
11 #include "../glprims"
12 
13 #ifdef TOOLS_MEM
14 #include "../mem"
15 #include "../S_STRING"
16 #endif
17 
18 namespace tools {
19 namespace sg {
20 class tess_prim {
21 #ifdef TOOLS_MEM
23 #endif
24 public:
26  :m_mode(gl::triangles())
27  ,m_size(0)
28  ,m_pos_coords(0)
29  ,m_pos_norms(0)
30  {
31 #ifdef TOOLS_MEM
32  mem::increment(s_class().c_str());
33 #endif
34  }
35  virtual ~tess_prim(){
36 #ifdef TOOLS_MEM
37  mem::decrement(s_class().c_str());
38 #endif
39  }
40 public:
41  tess_prim(const tess_prim& a_from)
42  :m_mode(a_from.m_mode)
43  ,m_coords(a_from.m_coords)
44  ,m_norms(a_from.m_norms)
45  ,m_size(a_from.m_size)
46  ,m_pos_coords(a_from.m_pos_coords)
47  ,m_pos_norms(a_from.m_pos_norms)
48  {
49 #ifdef TOOLS_MEM
50  mem::increment(s_class().c_str());
51 #endif
52  }
53  tess_prim& operator=(const tess_prim& a_from){
54  if(&a_from==this) return *this;
55  m_mode = a_from.m_mode;
56  m_coords = a_from.m_coords;
57  m_norms = a_from.m_norms;
58  m_size = a_from.m_size;
59  m_pos_coords = a_from.m_pos_coords;
60  m_pos_norms = a_from.m_pos_norms;
61  return *this;
62  }
63 public:
65  std::vector<float> m_coords;
66  std::vector<float> m_norms;
67  //for gsto :
68  size_t m_size;
69  typedef size_t bufpos;
72 };
73 }}
74 
75 #include "../vdata"
76 #include "../forit"
77 #include "primitive_visitor"
78 
79 #include <ostream>
80 #include <cmath> //sqrt
81 
82 #ifdef TOOLS_MEM
83 #include "../S_STRING"
84 #include "../mem"
85 #endif
86 
87 #include "../glutess/glutess"
88 
89 namespace tools {
90 namespace sg {
91 
92 class tessellate {
93 #ifdef TOOLS_MEM
95 #endif
96 public:
97  tessellate(std::ostream& a_out):m_out(a_out),m_tobj(0) {
98 #ifdef TOOLS_MEM
99  mem::increment(s_class().c_str());
100 #endif
101  m_tobj = gluNewTess();
107  //set winding rule to positive => no holes
109  //m_out << "tools::sg::tessellate::tessellate :"
110  // << " GL_TRIANGLE_STRIP " << GL_TRIANGLE_STRIP
111  // << " GL_TRIANGLE_FAN " << GL_TRIANGLE_FAN
112  // << " GL_TRIANGLES " << GL_TRIANGLES
113  // << std::endl;
114  }
115  virtual ~tessellate(){
117  _clear();
118 #ifdef TOOLS_MEM
119  mem::decrement(s_class().c_str());
120 #endif
121  }
122 public:
123  tessellate(const tessellate& a_from):m_out(a_from.m_out),m_tobj(0) {
124 #ifdef TOOLS_MEM
125  mem::increment(s_class().c_str());
126 #endif
127  m_tobj = gluNewTess();
133  //set winding rule to positive => no holes
135  }
136  tessellate& operator=(const tessellate& a_from){
137  if(&a_from==this) return *this;
138  _clear();
139  return *this;
140  }
141 public:
142  typedef std::vector<tess_prim*> prims_t;
143  void do_it(size_t a_npt,const double* a_contour,prims_t& a_prims){
146  double* pos = (double*)a_contour;
147  for(size_t i=0;i<a_npt;i++,pos+=3) {
148  ::gluTessVertex(m_tobj,pos,pos);
149  }
151  a_prims.clear();
152  m_prims = &a_prims;
154  ::gluTessEndPolygon(m_tobj); //trigger callbacks and fill a_prims.
155  }
156 
157  void clear(){_clear();}
158 protected:
159 
160  typedef _GLUfuncptr Func;
161 
162  static void GLUAPIENTRY begin_cbk(GLUenum a_which,void* a_this) {
163  tessellate& self = *((tessellate*)a_this);
164 
165  self.m_prims->push_back(new tess_prim());
166  tess_prim& prim = *(self.m_prims->back());
167  prim.m_mode = a_which;
168  prim.m_coords.reserve(12); //4 points.
169  prim.m_norms.reserve(12);
170 
171  self.m_coords = &prim.m_coords;
172 
173  //::printf("tools::sg::tessellate::begin_cbk : %d : STRIP %d FAN %d TRIS %d\n",
174  // a_which,GL_TRIANGLE_STRIP,GL_TRIANGLE_FAN,GL_TRIANGLES);
175  }
176 
177  static void GLUAPIENTRY vertex_cbk(void* a_vertex,void* a_this) {
178  tessellate& self = *((tessellate*)a_this);
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]));
183  }
184 
185  typedef float _vec3f[3];
186 
187  static void GLUAPIENTRY end_cbk(void* a_this){
188  tessellate& self = *((tessellate*)a_this);
189 
190  tess_prim& prim = *(self.m_prims->back());
191 
192  //self.m_out << "tools::sg::tessellate::end_cbk : "
193  // << prim.m_coords.size()/3 << std::endl;
194 
195  add_prm aprm(self.m_out,prim.m_norms);
196 
197  float* data = vec_data<float>(prim.m_coords);
198 
199  bool ok = true;
200  if(prim.m_mode==gl::triangles()) {
201  if(!aprm.add_triangles(prim.m_coords.size(),data,false)) {
202  self.m_out << "tools::sg::tessellate::end_cbk : "
203  << " add_triangles failed."
204  << std::endl;
205  ok = false;
206  }
207  } else if(prim.m_mode==gl::triangle_strip()) {
208  if(!aprm.add_triangle_strip(prim.m_coords.size(),data,false)){
209  self.m_out << "tools::sg::tessellate::end_cbk : "
210  << " add_triangle_strip failed."
211  << std::endl;
212  ok = false;
213  }
214 
215  } else if(prim.m_mode==gl::triangle_fan()) {
216  if(!aprm.add_triangle_fan(prim.m_coords.size(),data,false)) {
217  self.m_out << "tools::sg::tessellate::end_cbk : "
218  << " add_triangle_fan failed."
219  << std::endl;
220  ok = false;
221  }
222  } else {
223  self.m_out << "tools::sg::tessellate::end_cbk : "
224  << " mode " << prim.m_mode << " not yet treated."
225  << std::endl;
226  ok = false;
227  }
228  if(!ok) {
229  size_t num = prim.m_coords.size();
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)."
235  << std::endl;
236  float* pos = vec_data<float>(prim.m_coords);
237  for(size_t ipt=0;ipt<num;ipt++) {
238  self.m_out << " " << ipt << " :"
239  << " " << *(pos+0)
240  << " " << *(pos+1)
241  << " " << *(pos+2)
242  << std::endl;
243  pos += 3;
244  }
245  prim.m_coords.clear();
246  prim.m_norms.clear();
247  }
248  }
249 
250  static void GLUAPIENTRY combine_cbk(double a_coords[3],
251  void* /*a_vertex_data*/[4],
252  float /*a_weight*/[4],
253  void** a_data_out,
254  void* a_this) {
255  tessellate& self = *((tessellate*)a_this);
256  double* v = self.add_combine_vec3d(a_coords[0],a_coords[1],a_coords[2]);
257  //if(!v) ???
258  *a_data_out = v;
259  }
260 
261  static void GLUAPIENTRY error_cbk(GLUenum,void*) {
262  //const GLubyte* estring = gluErrorString(aErrorCode);
263  //::fprintf(stderr, "Tessellation Error: %s\n", estring);
264  //SbTessContour* This = (SbTessContour*)aThis;
265  //This->setError(true);
266  }
267 
268  double* add_combine_vec3d(double a_x,double a_y,double a_z) {
269  double* v = 0;
271  v = new double[3];
272  m_combine_trids.push_back(v);
273  } else {
275  }
277 
278  v[0] = a_x;
279  v[1] = a_y;
280  v[2] = a_z;
281 
282  return v;
283  }
284 
285  void _clear() {
286  tools_vforit(double*,m_combine_trids,it) delete [] *it;
287  m_combine_trids.clear();
289  }
290 
291 protected:
292  class add_prm : public primitive_visitor {
293  protected:
294  virtual bool project(float&,float&,float&,float&) {return true;}
295  virtual bool add_point(float,float,float,float) {return false;}
296  virtual bool add_point(float,float,float,float,
297  float,float,float,float) {return false;}
298  virtual bool add_line(float,float,float,float,
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) {
302  return false;
303  }
304 
305  virtual bool add_triangle(float a_p1x,float a_p1y,float a_p1z,float,
306  float a_p2x,float a_p2y,float a_p2z,float,
307  float a_p3x,float a_p3y,float a_p3z,float){
308 
309  float vx = a_p2x-a_p1x;
310  float vy = a_p2y-a_p1y;
311  float vz = a_p2z-a_p1z;
312 
313  float wx = a_p3x-a_p2x;
314  float wy = a_p3y-a_p2y;
315  float wz = a_p3z-a_p2z;
316 
317  // vx wx
318  // vy ^ wy
319  // vz wz
320  float cx = vy*wz-vz*wy;
321  float cy = vz*wx-vx*wz;
322  float cz = vx*wy-vy*wx;
323 
324  float len = (float)::sqrt(cx*cx + cy*cy + cz*cz);
325  if(!len) {
326  //m_out << "tools::sg::tessellate::add_prm : null normal."
327  // << std::endl;
328  } else {
329  cx /= len;
330  cy /= len;
331  cz /= len;
332  }
333 
334  if(m_mode==gl::triangles()) {
335 
336  m_norms.push_back(cx);
337  m_norms.push_back(cy);
338  m_norms.push_back(cz);
339 
340  m_norms.push_back(cx);
341  m_norms.push_back(cy);
342  m_norms.push_back(cz);
343 
344  m_norms.push_back(cx);
345  m_norms.push_back(cy);
346  m_norms.push_back(cz);
347 
348  } else if( (m_mode==gl::triangle_strip()) ||
349  (m_mode==gl::triangle_fan()) ){
350 
351  if(m_norms.empty()) { //startup : three vertices.
352  m_norms.push_back(cx);
353  m_norms.push_back(cy);
354  m_norms.push_back(cz);
355 
356  m_norms.push_back(cx);
357  m_norms.push_back(cy);
358  m_norms.push_back(cz);
359 
360  m_norms.push_back(cx);
361  m_norms.push_back(cy);
362  m_norms.push_back(cz);
363 
364  } else { //one vertex :
365  m_norms.push_back(cx);
366  m_norms.push_back(cy);
367  m_norms.push_back(cz);
368  }
369  }
370 
371  return true;
372  }
373 
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){
380  return add_prm::add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
381  a_p2x,a_p2y,a_p2z,a_p2w,
382  a_p3x,a_p3y,a_p3z,a_p3w);
383  }
384 
385  virtual bool project_normal(float& a_x,float& a_y,float& a_z) {
386  (void)a_x;(void)a_y;(void)a_z;
387  return true;
388  }
389  virtual bool add_point_normal(float a_x,float a_y,float a_z,float a_w,
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;
393  return false;
394  }
395  virtual bool add_point_normal(float a_x,float a_y,float a_z,float a_w,
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;
401  return false;
402  }
403  virtual bool add_line_normal(float a_bx,float a_by,float a_bz,float a_bw,
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;
411  return false;
412  }
413  virtual bool add_line_normal(float a_bx,float a_by,float a_bz,float a_bw,
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;
425  return false;
426  }
427  virtual bool add_triangle_normal(
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) {
434  add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
435  a_p2x,a_p2y,a_p2z,a_p2w,
436  a_p3x,a_p3y,a_p3z,a_p3w);
437  //m_this.m_triangles.add_normal(a_n1x,a_n1y,a_n1z);
438  //m_this.m_triangles.add_normal(a_n2x,a_n2y,a_n2z);
439  //m_this.m_triangles.add_normal(a_n3x,a_n3y,a_n3z);
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;
443  return true;
444  }
445  virtual bool add_triangle_normal(
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){
455  add_triangle(a_p1x,a_p1y,a_p1z,a_p1w,
456  a_r1,a_g1,a_b1,a_a1,
457  a_p2x,a_p2y,a_p2z,a_p2w,
458  a_r2,a_g2,a_b2,a_a2,
459  a_p3x,a_p3y,a_p3z,a_p3w,
460  a_r3,a_g3,a_b3,a_a3);
461  //m_this.m_triangles.add_normal(a_n1x,a_n1y,a_n1z);
462  //m_this.m_triangles.add_normal(a_n2x,a_n2y,a_n2z);
463  //m_this.m_triangles.add_normal(a_n3x,a_n3y,a_n3z);
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;
467  return true;
468  }
469  public:
470  add_prm(std::ostream& a_out,std::vector<float>& a_norms)
471  :m_out(a_out)
472  ,m_norms(a_norms)
473  {}
474  virtual ~add_prm(){}
475  public:
476  add_prm(const add_prm& a_from):primitive_visitor(a_from),m_out(a_from.m_out),m_norms(a_from.m_norms) {}
477  add_prm& operator=(const add_prm& a_from){
479  return *this;
480  }
481  protected:
482  std::ostream& m_out;
483  public:
484  std::vector<float>& m_norms;
485  };
486 
487 
488 protected:
489  std::ostream& m_out;
491  std::vector<float>* m_coords;
492  std::vector<double*> m_combine_trids;
495 };
496 
497 /*
498 class tessellate_factory {
499 #ifdef TOOLS_MEM
500  TOOLS_SCLASS(tools::sg::tessellate_factory);
501 #endif
502 public:
503  tessellate_factory(){
504 #ifdef TOOLS_MEM
505  mem::increment(s_class().c_str());
506 #endif
507  }
508  virtual ~tessellate_factory(){
509 #ifdef TOOLS_MEM
510  mem::decrement(s_class().c_str());
511 #endif
512  }
513 public:
514  tessellate_factory(const tessellate_factory& a_from) {
515 #ifdef TOOLS_MEM
516  mem::increment(s_class().c_str());
517 #endif
518  }
519  tessellate_factory& operator=(const tessellate_factory&){
520  return *this;
521  }
522 public:
523  virtual tessellate* create(std::ostream& a_out) {
524  return new tessellate(a_out);
525  }
526 };
527 */
528 
529 }}
530 
531 #endif
532 
tools::sg::tessellate::m_prims
prims_t * m_prims
Definition: tessellate:494
tools::sg::tessellate::add_prm::~add_prm
virtual ~add_prm()
Definition: tessellate:474
GLU_TESS_WINDING_POSITIVE
#define GLU_TESS_WINDING_POSITIVE
Definition: _glu:39
_GLUfuncptr
void(* _GLUfuncptr)()
Definition: _glu:49
tools::sg::tessellate::Func
_GLUfuncptr Func
Definition: tessellate:160
primitive_visitor
tools::sg::tessellate::add_prm::m_norms
std::vector< float > & m_norms
Definition: tessellate:484
tools::sg::tessellate::add_prm::add_prm
add_prm(const add_prm &a_from)
Definition: tessellate:476
tools::sg::tessellate::add_prm::add_triangle_normal
virtual bool add_triangle_normal(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float a_n1x, float a_n1y, float a_n1z, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float a_n2x, float a_n2y, float a_n2z, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float a_n3x, float a_n3y, float a_n3z)
Definition: tessellate:427
tools::gl::triangles
mode_t triangles()
Definition: glprims:20
gluTessCallback
GLUAPI void GLUAPIENTRY gluTessCallback(GLUtesselator *tess, GLUenum which, _GLUfuncptr CallBackFunc)
Definition: glutess:269
GLU_TESS_COMBINE_DATA
#define GLU_TESS_COMBINE_DATA
Definition: _glu:31
tools::sg::tessellate::tessellate
tessellate(const tessellate &a_from)
Definition: tessellate:123
tools::sg::tessellate::add_combine_vec3d
double * add_combine_vec3d(double a_x, double a_y, double a_z)
Definition: tessellate:268
tools::sg::tess_prim::~tess_prim
virtual ~tess_prim()
Definition: tessellate:35
tools::sg::tessellate::~tessellate
virtual ~tessellate()
Definition: tessellate:115
tools::sg::tessellate::m_combine_trids_num
size_t m_combine_trids_num
Definition: tessellate:493
tools::sg::tess_prim::m_size
size_t m_size
Definition: tessellate:68
tools::sg::tessellate::m_coords
std::vector< float > * m_coords
Definition: tessellate:491
tools::gl::triangle_fan
mode_t triangle_fan()
Definition: glprims:22
gluTessBeginPolygon
GLUAPI void GLUAPIENTRY gluTessBeginPolygon(GLUtesselator *tess, GLUvoid *data)
Definition: glutess:455
tools::sg::tessellate::prims_t
std::vector< tess_prim * > prims_t
Definition: tessellate:142
GLUAPIENTRY
#define GLUAPIENTRY
Definition: _glu:48
tools::sg::tessellate::m_tobj
GLUtesselator * m_tobj
Definition: tessellate:490
tools::sg::tessellate::add_prm::add_line
virtual bool add_line(float, float, float, float, float, float, float, float)
Definition: tessellate:298
tools::sg::tessellate::combine_cbk
static void GLUAPIENTRY combine_cbk(double a_coords[3], void *[4], float[4], void **a_data_out, void *a_this)
Definition: tessellate:250
tools::sg::primitive_visitor::add_triangle_strip
bool add_triangle_strip(size_t a_floatn, const float *a_xyzs, bool a_stop=false)
Definition: primitive_visitor:282
tools::sg::tessellate::add_prm::add_line_normal
virtual bool add_line_normal(float a_bx, float a_by, float a_bz, float a_bw, float a_bnx, float a_bny, float a_bnz, float a_ex, float a_ey, float a_ez, float a_ew, float a_enx, float a_eny, float a_enz)
Definition: tessellate:403
tools::sg::tessellate::add_prm::add_point
virtual bool add_point(float, float, float, float, float, float, float, float)
Definition: tessellate:296
tools::sg::tessellate::error_cbk
static void GLUAPIENTRY error_cbk(GLUenum, void *)
Definition: tessellate:261
tools::sg::tessellate::m_out
std::ostream & m_out
Definition: tessellate:489
tools::sg::tessellate::add_prm
Definition: tessellate:292
TOOLS_SCLASS
#define TOOLS_SCLASS(a_name)
Definition: S_STRING:41
tools::sg::tess_prim::operator=
tess_prim & operator=(const tess_prim &a_from)
Definition: tessellate:53
tools::sg::tessellate::add_prm::add_line_normal
virtual bool add_line_normal(float a_bx, float a_by, float a_bz, float a_bw, float a_bnx, float a_bny, float a_bnz, float a_br, float a_bg, float a_bb, float a_ba, float a_ex, float a_ey, float a_ez, float a_ew, float a_enx, float a_eny, float a_enz, float a_er, float a_eg, float a_eb, float a_ea)
Definition: tessellate:413
gluTessBeginContour
GLUAPI void GLUAPIENTRY gluTessBeginContour(GLUtesselator *tess)
Definition: glutess:469
tools::sg::tessellate::add_prm::add_line
virtual bool add_line(float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float)
Definition: tessellate:300
GLU_TESS_ERROR_DATA
#define GLU_TESS_ERROR_DATA
Definition: _glu:30
tools::gl::triangle_strip
mode_t triangle_strip()
Definition: glprims:21
tools::sg::tessellate::add_prm::add_triangle
virtual bool add_triangle(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float, float, float, float, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float, float, float, float, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float, float, float, float)
Definition: tessellate:374
tools::sg::tessellate::begin_cbk
static void GLUAPIENTRY begin_cbk(GLUenum a_which, void *a_this)
Definition: tessellate:162
tools::sg::primitive_visitor::operator=
primitive_visitor & operator=(const primitive_visitor &)
Definition: primitive_visitor:61
tools::sg::tess_prim::m_pos_coords
bufpos m_pos_coords
Definition: tessellate:70
GLUtesselator
Definition: _tess:27
tools::sg::tessellate::add_prm::add_prm
add_prm(std::ostream &a_out, std::vector< float > &a_norms)
Definition: tessellate:470
tools::sg::primitive_visitor::m_mode
gl::mode_t m_mode
Definition: primitive_visitor:2134
tools::sg::tessellate::add_prm::add_triangle
virtual bool add_triangle(float a_p1x, float a_p1y, float a_p1z, float, float a_p2x, float a_p2y, float a_p2z, float, float a_p3x, float a_p3y, float a_p3z, float)
Definition: tessellate:305
gluTessVertex
#define gluTessVertex
Definition: rename:13
tools::sg::tess_prim::m_norms
std::vector< float > m_norms
Definition: tessellate:66
tools_vforit
#define tools_vforit(a__T, a__v, a__it)
Definition: forit:13
tools::sg::tessellate::do_it
void do_it(size_t a_npt, const double *a_contour, prims_t &a_prims)
Definition: tessellate:143
tools::gl::mode_t
unsigned char mode_t
Definition: glprims:14
tools::sg::tessellate::add_prm::operator=
add_prm & operator=(const add_prm &a_from)
Definition: tessellate:477
tools::sg::tessellate::m_combine_trids
std::vector< double * > m_combine_trids
Definition: tessellate:492
tools::sg::primitive_visitor::add_triangle_fan
bool add_triangle_fan(size_t a_floatn, const float *a_xyzs, bool a_stop=false)
Definition: primitive_visitor:74
GLU_TESS_END_DATA
#define GLU_TESS_END_DATA
Definition: _glu:29
tools
inlined C code : ///////////////////////////////////
Definition: aida_ntuple:26
gluTessEndContour
GLUAPI void GLUAPIENTRY gluTessEndContour(GLUtesselator *tess)
Definition: glutess:486
GLU_TESS_BEGIN_DATA
#define GLU_TESS_BEGIN_DATA
Definition: _glu:27
gluDeleteTess
GLUAPI void GLUAPIENTRY gluDeleteTess(GLUtesselator *tess)
Definition: glutess:160
tools::sg::tessellate::clear
void clear()
Definition: tessellate:157
tools::sg::tess_prim::tess_prim
tess_prim(const tess_prim &a_from)
Definition: tessellate:41
tools::sg::tessellate::add_prm::add_point_normal
virtual bool add_point_normal(float a_x, float a_y, float a_z, float a_w, float a_nx, float a_ny, float a_nz)
Definition: tessellate:389
gluTessEndPolygon
GLUAPI void GLUAPIENTRY gluTessEndPolygon(GLUtesselator *tess)
Definition: glutess:493
tools::sg::tessellate::add_prm::add_triangle_normal
virtual bool add_triangle_normal(float a_p1x, float a_p1y, float a_p1z, float a_p1w, float a_n1x, float a_n1y, float a_n1z, float a_r1, float a_g1, float a_b1, float a_a1, float a_p2x, float a_p2y, float a_p2z, float a_p2w, float a_n2x, float a_n2y, float a_n2z, float a_r2, float a_g2, float a_b2, float a_a2, float a_p3x, float a_p3y, float a_p3z, float a_p3w, float a_n3x, float a_n3y, float a_n3z, float a_r3, float a_g3, float a_b3, float a_a3)
Definition: tessellate:445
tools::sg::tessellate::tessellate
tessellate(std::ostream &a_out)
Definition: tessellate:97
tools::sg::tessellate::vertex_cbk
static void GLUAPIENTRY vertex_cbk(void *a_vertex, void *a_this)
Definition: tessellate:177
tools::sg::tessellate::add_prm::add_point
virtual bool add_point(float, float, float, float)
Definition: tessellate:295
tools::sg::tess_prim::m_pos_norms
bufpos m_pos_norms
Definition: tessellate:71
tools::sg::tessellate::_clear
void _clear()
Definition: tessellate:285
tools::sg::tess_prim::tess_prim
tess_prim()
Definition: tessellate:25
tools::sg::tessellate::add_prm::project
virtual bool project(float &, float &, float &, float &)
Definition: tessellate:294
tools::sg::tessellate::end_cbk
static void GLUAPIENTRY end_cbk(void *a_this)
Definition: tessellate:187
tools::sg::tessellate::add_prm::m_out
std::ostream & m_out
Definition: tessellate:482
gluNewTess
GLUAPI GLUtesselator *GLUAPIENTRY gluNewTess(void)
Definition: glutess:59
tools::sg::tessellate::operator=
tessellate & operator=(const tessellate &a_from)
Definition: tessellate:136
tools::sg::tessellate::add_prm::project_normal
virtual bool project_normal(float &a_x, float &a_y, float &a_z)
Definition: tessellate:385
tools::sg::tessellate::_vec3f
float _vec3f[3]
Definition: tessellate:185
tools::sg::tess_prim::bufpos
size_t bufpos
Definition: tessellate:69
gluTessProperty
GLUAPI void GLUAPIENTRY gluTessProperty(GLUtesselator *tess, GLUenum which, GLUdouble data)
Definition: glutess:168
tools::sg::tessellate::add_prm::add_point_normal
virtual bool add_point_normal(float a_x, float a_y, float a_z, float a_w, float a_nx, float a_ny, float a_nz, float a_r, float a_g, float a_b, float a_a)
Definition: tessellate:395
GLU_TESS_VERTEX_DATA
#define GLU_TESS_VERTEX_DATA
Definition: _glu:28
tools::sg::primitive_visitor
Definition: primitive_visitor:20
GLU_TESS_WINDING_RULE
#define GLU_TESS_WINDING_RULE
Definition: _glu:34
GLUenum
unsigned int GLUenum
Definition: _glu:14
tools::sg::tess_prim
Definition: tessellate:20
tools::sg::primitive_visitor::add_triangles
bool add_triangles(size_t a_floatn, const float *a_xyzs, bool a_stop=false)
Definition: primitive_visitor:341
tools::sg::tess_prim::m_mode
gl::mode_t m_mode
Definition: tessellate:64
tools::sg::tess_prim::m_coords
std::vector< float > m_coords
Definition: tessellate:65
tools::sg::tessellate
Definition: tessellate:92