Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/externals/g4tools/include/tools/sg/tex_rect

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /externals/g4tools/include/tools/sg/tex_rect (Version 11.3.0) and /externals/g4tools/include/tools/sg/tex_rect (Version 11.1.1)


  1 // Copyright (C) 2010, Guy Barrand. All rights      1 // Copyright (C) 2010, Guy Barrand. All rights reserved.
  2 // See the file tools.license for terms.            2 // See the file tools.license for terms.
  3                                                     3 
  4 #ifndef tools_sg_tex_rect                           4 #ifndef tools_sg_tex_rect
  5 #define tools_sg_tex_rect                           5 #define tools_sg_tex_rect
  6                                                     6 
  7 // node to render an RGB tools::img_byte with       7 // node to render an RGB tools::img_byte with ::glTexImage2D.
  8                                                     8 
  9 //#define TOOLS_SG_TEX_RECT_DEBUG                   9 //#define TOOLS_SG_TEX_RECT_DEBUG
 10                                                    10 
 11 #include "node"                                    11 #include "node"
 12 #include "render_action"                           12 #include "render_action"
 13 #include "pick_action"                             13 #include "pick_action"
 14 #include "bbox_action"                             14 #include "bbox_action"
 15 #include "event_action"                            15 #include "event_action"
 16 #include "render_manager"                          16 #include "render_manager"
 17 #include "gstos"                                   17 #include "gstos"
 18 #include "base_tex"                                18 #include "base_tex"
 19                                                    19 
 20 #include "../pointer"                              20 #include "../pointer"
 21 #include "../num2s"                                21 #include "../num2s"
 22                                                    22 
 23 namespace tools {                                  23 namespace tools {
 24 namespace sg {                                     24 namespace sg {
 25                                                    25 
 26 class tex_rect : public node, public gstos, pu     26 class tex_rect : public node, public gstos, public base_tex {
 27   TOOLS_NODE_NO_CAST(tex_rect,tools::sg::tex_r     27   TOOLS_NODE_NO_CAST(tex_rect,tools::sg::tex_rect,node)
 28 public:                                            28 public:
 29   virtual void* cast(const std::string& a_clas     29   virtual void* cast(const std::string& a_class) const {
 30     {if(void* p = cmp_cast<tex_rect>(this,a_cl     30     {if(void* p = cmp_cast<tex_rect>(this,a_class)) return p;}
 31     {if(void* p = base_tex::cast(a_class)) ret     31     {if(void* p = base_tex::cast(a_class)) return p;}
 32     return parent::cast(a_class);                  32     return parent::cast(a_class);
 33   }                                                33   }
 34 public:                                            34 public:
 35   sf<bool> show_border;                            35   sf<bool> show_border;
 36   sf<float> height;                                36   sf<float> height;
 37 public:                                            37 public:
 38   virtual const desc_fields& node_desc_fields(     38   virtual const desc_fields& node_desc_fields() const {
 39     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::tex     39     TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::tex_rect)
 40     static const desc_fields s_v(parent::node_     40     static const desc_fields s_v(parent::node_desc_fields(),6, //WARNING : take care of count.
 41       TOOLS_ARG_FIELD_DESC(img),                   41       TOOLS_ARG_FIELD_DESC(img),
 42       TOOLS_ARG_FIELD_DESC(back_color),            42       TOOLS_ARG_FIELD_DESC(back_color),
 43       TOOLS_ARG_FIELD_DESC(expand),                43       TOOLS_ARG_FIELD_DESC(expand),
 44       TOOLS_ARG_FIELD_DESC(limit),                 44       TOOLS_ARG_FIELD_DESC(limit),
 45       TOOLS_ARG_FIELD_DESC(show_border),           45       TOOLS_ARG_FIELD_DESC(show_border),
 46       TOOLS_ARG_FIELD_DESC(height)                 46       TOOLS_ARG_FIELD_DESC(height)
 47     );                                             47     );
 48     return s_v;                                    48     return s_v;
 49   }                                                49   }
 50 private:                                           50 private:
 51   void add_fields(){                               51   void add_fields(){
 52     add_field(&img);                               52     add_field(&img);
 53     add_field(&back_color);                        53     add_field(&back_color);
 54     add_field(&expand);                            54     add_field(&expand);
 55     add_field(&limit);                             55     add_field(&limit);
 56     add_field(&show_border);                       56     add_field(&show_border);
 57     add_field(&height);                            57     add_field(&height);
 58   }                                                58   }
 59 public:                                            59 public:
 60   virtual void render(render_action& a_action)     60   virtual void render(render_action& a_action) {
 61 #ifdef TOOLS_SG_TEX_RECT_DEBUG                     61 #ifdef TOOLS_SG_TEX_RECT_DEBUG
 62     a_action.out() << "tools::tex_rect::render     62     a_action.out() << "tools::tex_rect::render : begin : 001 : " << std::endl;
 63 #endif                                             63 #endif
 64                                                    64 
 65     //NOTE : we draw border (show_border is tr     65     //NOTE : we draw border (show_border is true) and background even if
 66     //       gen_texture() failed.                 66     //       gen_texture() failed.
 67                                                    67 
 68     if(touched()) {                                68     if(touched()) {
 69 #ifdef TOOLS_SG_TEX_RECT_DEBUG                     69 #ifdef TOOLS_SG_TEX_RECT_DEBUG
 70       a_action.out() << "tools::tex_rect::rend     70       a_action.out() << "tools::tex_rect::render : touched." << std::endl;
 71 #endif                                             71 #endif
 72       update_sg(a_action.out());                   72       update_sg(a_action.out());
 73       reset_touched();                             73       reset_touched();
 74     }                                              74     }
 75     if(m_img.is_empty()) {                         75     if(m_img.is_empty()) {
 76 #ifdef TOOLS_SG_TEX_RECT_DEBUG                     76 #ifdef TOOLS_SG_TEX_RECT_DEBUG
 77       a_action.out() << "tools::tex_rect::rend     77       a_action.out() << "tools::tex_rect::render : m_img is empty." << std::endl;
 78 #endif                                             78 #endif
 79       return;                                      79       return;
 80     }                                              80     }
 81                                                    81 
 82 #ifdef TOOLS_SG_TEX_RECT_DEBUG                     82 #ifdef TOOLS_SG_TEX_RECT_DEBUG
 83     a_action.out() << "tools::tex_rect::render     83     a_action.out() << "tools::tex_rect::render : have a m_img. get_tex_id ..." << std::endl;
 84 #endif                                             84 #endif
 85                                                    85 
 86     unsigned int _id = get_tex_id(a_action.out     86     unsigned int _id = get_tex_id(a_action.out(),a_action.render_manager(),m_img,nearest.value());
 87                                                    87 
 88 #ifdef TOOLS_SG_TEX_RECT_DEBUG                     88 #ifdef TOOLS_SG_TEX_RECT_DEBUG
 89     a_action.out() << "tools::tex_rect::render     89     a_action.out() << "tools::tex_rect::render : get_tex_id : " << _id << "." << std::endl;
 90 #endif                                             90 #endif
 91                                                    91 
 92     const state& state = a_action.state();         92     const state& state = a_action.state();
 93                                                    93 
 94     //image must be 2^n,2^m in size !              94     //image must be 2^n,2^m in size !
 95     // exa : 128x64                                95     // exa : 128x64
 96                                                    96 
 97     f12 xyzs;                                      97     f12 xyzs;
 98                                                    98 
 99     if(show_border.value()) {                      99     if(show_border.value()) {
100 #ifdef TOOLS_SG_TEX_RECT_DEBUG                    100 #ifdef TOOLS_SG_TEX_RECT_DEBUG
101       a_action.out() << "tools::tex_rect::rend    101       a_action.out() << "tools::tex_rect::render : show_border." << std::endl;
102 #endif                                            102 #endif
103       f12 nms;                                    103       f12 nms;
104       _front(xyzs,nms,0.01f);                     104       _front(xyzs,nms,0.01f);
105                                                   105 
106       a_action.color4f(1,0,0,1);                  106       a_action.color4f(1,0,0,1);
107       a_action.line_width(4);                     107       a_action.line_width(4);
108                                                   108 
109       a_action.draw_vertex_array(gl::line_loop    109       a_action.draw_vertex_array(gl::line_loop(),12,xyzs);
110                                                   110 
111       //pushes back the filled polygons to avo    111       //pushes back the filled polygons to avoid z-fighting with lines
112       a_action.set_polygon_offset(true);          112       a_action.set_polygon_offset(true);
113                                                   113 
114       a_action.color4f(state.m_color);            114       a_action.color4f(state.m_color);
115       a_action.line_width(state.m_line_width);    115       a_action.line_width(state.m_line_width);
116     }                                             116     }
117                                                   117 
118 #ifdef TOOLS_SG_TEX_RECT_DEBUG                    118 #ifdef TOOLS_SG_TEX_RECT_DEBUG
119     a_action.out() << "tools::tex_rect::render    119     a_action.out() << "tools::tex_rect::render : draw back face." << std::endl;
120 #endif                                            120 #endif
121                                                   121 
122     //draw a back face pointing toward negativ    122     //draw a back face pointing toward negative z :
123    {a_action.color4f(back_color.value());         123    {a_action.color4f(back_color.value());
124     f18 tris,nms;                                 124     f18 tris,nms;
125     _tris(tris,nms);                              125     _tris(tris,nms);
126     a_action.draw_vertex_normal_array(gl::tria    126     a_action.draw_vertex_normal_array(gl::triangles(),18,tris,nms);
127     a_action.color4f(state.m_color);}             127     a_action.color4f(state.m_color);}
128                                                   128 
129     if(_id) {                                     129     if(_id) {
130 #ifdef TOOLS_SG_TEX_RECT_DEBUG                    130 #ifdef TOOLS_SG_TEX_RECT_DEBUG
131       a_action.out() << "tools::tex_rect::rend    131       a_action.out() << "tools::tex_rect::render : draw_vertex_normal_array_texture." << std::endl;
132 #endif                                            132 #endif
133       f12 nms;                                    133       f12 nms;
134       _front(xyzs,nms);                           134       _front(xyzs,nms);
135       float tcs[8];                               135       float tcs[8];
136       set_tcs(tcs);                               136       set_tcs(tcs);
137       a_action.draw_vertex_normal_array_textur    137       a_action.draw_vertex_normal_array_texture(gl::triangle_fan(),12,xyzs,nms,_id,tcs);
138     }                                             138     }
139     a_action.set_polygon_offset(state.m_GL_POL    139     a_action.set_polygon_offset(state.m_GL_POLYGON_OFFSET_FILL);
140   }                                               140   }
141   virtual void pick(pick_action& a_action) {      141   virtual void pick(pick_action& a_action) {
142     if(touched()) {                               142     if(touched()) {
143       update_sg(a_action.out());                  143       update_sg(a_action.out());
144       reset_touched();                            144       reset_touched();
145     }                                             145     }
146     if(m_img.is_empty()) return;                  146     if(m_img.is_empty()) return;
147     f12 xyzs,nms;                                 147     f12 xyzs,nms;
148     _front(xyzs,nms);                             148     _front(xyzs,nms);
149     a_action.add__primitive(*this,gl::triangle    149     a_action.add__primitive(*this,gl::triangle_fan(),12,xyzs,true);
150   }                                               150   }
151                                                   151 
152   virtual void bbox(bbox_action& a_action) {      152   virtual void bbox(bbox_action& a_action) {
153     if(touched()) {                               153     if(touched()) {
154       update_sg(a_action.out());                  154       update_sg(a_action.out());
155       reset_touched();                            155       reset_touched();
156     }                                             156     }
157     if(m_img.is_empty()) return;                  157     if(m_img.is_empty()) return;
158     f12 xyzs,nms;                                 158     f12 xyzs,nms;
159     _front(xyzs,nms);                             159     _front(xyzs,nms);
160     a_action.add_points(12,xyzs);                 160     a_action.add_points(12,xyzs);
161   }                                               161   }
162 public:                                           162 public:
163   virtual bool intersect_value(std::ostream&,i    163   virtual bool intersect_value(std::ostream&,intersect_type,const line<vec3f>& a_line,std::string& a_s) const {
164     // a_line is in local world coordinate.       164     // a_line is in local world coordinate.
165                                                   165 
166     const img_byte& _img = img.value();           166     const img_byte& _img = img.value();
167     if(_img.is_empty()) {a_s.clear();return fa    167     if(_img.is_empty()) {a_s.clear();return false;}
168                                                   168 
169     float aspect = float(_img.width())/float(_    169     float aspect = float(_img.width())/float(_img.height());
170     float h2 = height.value()*0.5f;               170     float h2 = height.value()*0.5f;
171     float w2 = aspect*h2;                         171     float w2 = aspect*h2;
172                                                   172 
173     plane<vec3f> plane(vec3f(w2,h2,0),vec3f(-w    173     plane<vec3f> plane(vec3f(w2,h2,0),vec3f(-w2,h2,0),vec3f(-w2,-h2,0));
174     vec3f p;                                      174     vec3f p;
175     if(!plane.intersect(a_line,p)) {a_s.clear(    175     if(!plane.intersect(a_line,p)) {a_s.clear();return false;}
176                                                   176 
177     float imw = (float)_img.width();              177     float imw = (float)_img.width();
178     float imh = (float)_img.height();             178     float imh = (float)_img.height();
179                                                   179 
180     //image coordinates :                         180     //image coordinates :
181     int ix = int((imw*p.x()/w2+imw)*0.5f);        181     int ix = int((imw*p.x()/w2+imw)*0.5f);
182     int iy = int((imh*p.y()/h2+imh)*0.5f);        182     int iy = int((imh*p.y()/h2+imh)*0.5f);
183                                                   183 
184     //rgb of pixel :                              184     //rgb of pixel :
185     std::vector<unsigned char> pixel;             185     std::vector<unsigned char> pixel;
186     if((ix<0)||(iy<0)||!_img.pixel(ix,iy,pixel    186     if((ix<0)||(iy<0)||!_img.pixel(ix,iy,pixel)) {a_s.clear();return false;}
187                                                   187 
188     a_s.clear();                                  188     a_s.clear();
189     for(unsigned int ipix=0;ipix<pixel.size();    189     for(unsigned int ipix=0;ipix<pixel.size();ipix++) {
190       if(ipix) a_s += " ";                        190       if(ipix) a_s += " ";
191       if(!numas<float>(float(pixel[ipix])/255.    191       if(!numas<float>(float(pixel[ipix])/255.0f,a_s)){}
192     }                                             192     }
193                                                   193 
194     return true;                                  194     return true;
195   }                                               195   }
196 public:                                           196 public:
197   tex_rect()                                      197   tex_rect()
198   :parent()                                       198   :parent()
199   ,base_tex()                                     199   ,base_tex()
200   ,show_border(false)                             200   ,show_border(false)
201   ,height(1)                                      201   ,height(1)
202   {                                               202   {
203     add_fields();                                 203     add_fields();
204   }                                               204   }
205   virtual ~tex_rect(){}                           205   virtual ~tex_rect(){}
206 public:                                           206 public:
207   tex_rect(const tex_rect& a_from)                207   tex_rect(const tex_rect& a_from)
208   :parent(a_from)                                 208   :parent(a_from)
209   ,gstos(a_from)                                  209   ,gstos(a_from)
210   ,base_tex(a_from)                               210   ,base_tex(a_from)
211   ,show_border(a_from.show_border)                211   ,show_border(a_from.show_border)
212   ,height(a_from.height)                          212   ,height(a_from.height)
213   {                                               213   {
214     add_fields();                                 214     add_fields();
215   }                                               215   }
216   tex_rect& operator=(const tex_rect& a_from){    216   tex_rect& operator=(const tex_rect& a_from){
217     parent::operator=(a_from);                    217     parent::operator=(a_from);
218     gstos::operator=(a_from);                     218     gstos::operator=(a_from);
219     base_tex::operator=(a_from);                  219     base_tex::operator=(a_from);
220     if(&a_from==this) return *this;               220     if(&a_from==this) return *this;
221     show_border = a_from.show_border;             221     show_border = a_from.show_border;
222     height = a_from.height;                       222     height = a_from.height;
223     return *this;                                 223     return *this;
224   }                                               224   }
225 public:                                           225 public:
226                                                   226 
227   //const img_byte& rendered_img() const {retu    227   //const img_byte& rendered_img() const {return m_img;}
228                                                   228 
229   void rendered_size(std::ostream& a_out,unsig    229   void rendered_size(std::ostream& a_out,unsigned int& a_w,unsigned int& a_h) {
230     update_sg(a_out);                             230     update_sg(a_out);
231     reset_touched();                              231     reset_touched();
232     a_w = m_img.width();                          232     a_w = m_img.width();
233     a_h = m_img.height();                         233     a_h = m_img.height();
234   }                                               234   }
235                                                   235 
236 protected:                                        236 protected:
237   //virtual //NOTE : virtual for diaporama nod    237   //virtual //NOTE : virtual for diaporama node. (but warning with clang -g4flags).
238   void update_sg(std::ostream& a_out) {           238   void update_sg(std::ostream& a_out) {
239     clean_gstos(); //must reset for all render    239     clean_gstos(); //must reset for all render_manager.
240     if(height.value()<=0) {                       240     if(height.value()<=0) {
241       m_img.make_empty();                         241       m_img.make_empty();
242       return;                                     242       return;
243     }                                             243     }
244     base_tex::_update_sg_(a_out);                 244     base_tex::_update_sg_(a_out);
245   }                                               245   }
246 protected:                                        246 protected:
247                                                   247 
248   typedef float f12[12];                          248   typedef float f12[12];
249   void _front(f12& front,f12& nms,float a_epsi    249   void _front(f12& front,f12& nms,float a_epsil = 0.0f) { //[12]
250     float aspect = float(img.value().width())/    250     float aspect = float(img.value().width())/float(img.value().height());
251     float h2 = height*0.5f;                       251     float h2 = height*0.5f;
252     float w2 = aspect*h2;                         252     float w2 = aspect*h2;
253                                                   253 
254     h2 += a_epsil;                                254     h2 += a_epsil;
255     w2 += a_epsil;                                255     w2 += a_epsil;
256                                                   256 
257     front[0] = -w2;                               257     front[0] = -w2;
258     front[1] = -h2;                               258     front[1] = -h2;
259     front[2] =  0;                                259     front[2] =  0;
260                                                   260 
261     front[3] =  w2;                               261     front[3] =  w2;
262     front[4] = -h2;                               262     front[4] = -h2;
263     front[5] =  0;                                263     front[5] =  0;
264                                                   264 
265     front[6] =  w2;                               265     front[6] =  w2;
266     front[7] =  h2;                               266     front[7] =  h2;
267     front[8] =  0;                                267     front[8] =  0;
268                                                   268 
269     front[ 9] = -w2;                              269     front[ 9] = -w2;
270     front[10] =  h2;                              270     front[10] =  h2;
271     front[11] =  0;                               271     front[11] =  0;
272                                                   272 
273     nms[0] = 0;                                   273     nms[0] = 0;
274     nms[1] = 0;                                   274     nms[1] = 0;
275     nms[2] = 1;                                   275     nms[2] = 1;
276                                                   276 
277     nms[3] = 0;                                   277     nms[3] = 0;
278     nms[4] = 0;                                   278     nms[4] = 0;
279     nms[5] = 1;                                   279     nms[5] = 1;
280                                                   280 
281     nms[6] = 0;                                   281     nms[6] = 0;
282     nms[7] = 0;                                   282     nms[7] = 0;
283     nms[8] = 1;                                   283     nms[8] = 1;
284                                                   284 
285     nms[9] = 0;                                   285     nms[9] = 0;
286     nms[10] = 0;                                  286     nms[10] = 0;
287     nms[11] = 1;                                  287     nms[11] = 1;
288   }                                               288   }
289                                                   289 
290   void _back(f12& back) { //[12]                  290   void _back(f12& back) { //[12]
291     float aspect = float(img.value().width())/    291     float aspect = float(img.value().width())/float(img.value().height());
292     float h2 = height*0.5f;                       292     float h2 = height*0.5f;
293     float w2 = aspect*h2;                         293     float w2 = aspect*h2;
294     float d2 = 0;                                 294     float d2 = 0;
295                                                   295 
296     back[0] =  w2;back[ 1] = -h2;back[ 2] = d2    296     back[0] =  w2;back[ 1] = -h2;back[ 2] = d2;
297     back[3] = -w2;back[ 4] = -h2;back[ 5] = d2    297     back[3] = -w2;back[ 4] = -h2;back[ 5] = d2;
298     back[6] = -w2;back[ 7] =  h2;back[ 8] = d2    298     back[6] = -w2;back[ 7] =  h2;back[ 8] = d2;
299     back[9] =  w2;back[10] =  h2;back[11] = d2    299     back[9] =  w2;back[10] =  h2;back[11] = d2;
300   }                                               300   }
301                                                   301 
302   typedef float f18[18];                          302   typedef float f18[18];
303   void _tris(f18& tris,f18& nms){                 303   void _tris(f18& tris,f18& nms){
304     f12 back;                                     304     f12 back;
305     _back(back);                                  305     _back(back);
306                                                   306 
307     tris[0] = back[0];                            307     tris[0] = back[0];
308     tris[1] = back[1];                            308     tris[1] = back[1];
309     tris[2] = back[2];                            309     tris[2] = back[2];
310                                                   310 
311     tris[3] = back[3];                            311     tris[3] = back[3];
312     tris[4] = back[4];                            312     tris[4] = back[4];
313     tris[5] = back[5];                            313     tris[5] = back[5];
314                                                   314 
315     tris[6] = back[6];                            315     tris[6] = back[6];
316     tris[7] = back[7];                            316     tris[7] = back[7];
317     tris[8] = back[8];                            317     tris[8] = back[8];
318     //                                            318     //
319     tris[9]  = back[6];                           319     tris[9]  = back[6];
320     tris[10] = back[7];                           320     tris[10] = back[7];
321     tris[11] = back[8];                           321     tris[11] = back[8];
322                                                   322 
323     tris[12] = back[9];                           323     tris[12] = back[9];
324     tris[13] = back[10];                          324     tris[13] = back[10];
325     tris[14] = back[11];                          325     tris[14] = back[11];
326                                                   326 
327     tris[15] = back[0];                           327     tris[15] = back[0];
328     tris[16] = back[1];                           328     tris[16] = back[1];
329     tris[17] = back[2];                           329     tris[17] = back[2];
330                                                   330 
331     ///////////////////// back                    331     ///////////////////// back
332     nms[0] = 0;                                   332     nms[0] = 0;
333     nms[1] = 0;                                   333     nms[1] = 0;
334     nms[2] = -1;                                  334     nms[2] = -1;
335                                                   335 
336     nms[3] = 0;                                   336     nms[3] = 0;
337     nms[4] = 0;                                   337     nms[4] = 0;
338     nms[5] = -1;                                  338     nms[5] = -1;
339                                                   339 
340     nms[6] = 0;                                   340     nms[6] = 0;
341     nms[7] = 0;                                   341     nms[7] = 0;
342     nms[8] = -1;                                  342     nms[8] = -1;
343     //                                            343     //
344     nms[9]  = 0;                                  344     nms[9]  = 0;
345     nms[10] = 0;                                  345     nms[10] = 0;
346     nms[11] = -1;                                 346     nms[11] = -1;
347                                                   347 
348     nms[12] = 0;                                  348     nms[12] = 0;
349     nms[13] = 0;                                  349     nms[13] = 0;
350     nms[14] = -1;                                 350     nms[14] = -1;
351                                                   351 
352     nms[15] = 0;                                  352     nms[15] = 0;
353     nms[16] = 0;                                  353     nms[16] = 0;
354     nms[17] = -1;                                 354     nms[17] = -1;
355   }                                               355   }
356 };                                                356 };
357                                                   357 
358 }}                                                358 }}
359                                                   359 
360 #endif                                            360 #endif