28 #include "WCreateColorArraysThread.h"
32 boost::shared_ptr< std::vector< size_t > > lineLengths,
33 boost::shared_ptr< std::vector< float > > globalColors,
34 boost::shared_ptr< std::vector< float > > localColors,
35 boost::shared_ptr< std::vector< float > > tangents ):
37 m_myThreadFinished( false ),
40 m_vertices( vertices ),
41 m_tangents( tangents ),
42 m_globalColors( globalColors ),
43 m_localColors( localColors ),
44 m_lineLengths( lineLengths )
65 for(
int i = 0; i <
m_left; ++i )
67 pc += (*m_lineLengths)[i]*3;
70 float r, g, b, rr, gg, bb;
71 float x1, x2, y1, y2, z1, z2;
72 float lastx, lasty, lastz;
73 for(
int i = m_left; i <=
m_right; ++i )
75 x1 = (*m_vertices)[pc];
76 y1 = (*m_vertices)[pc + 1];
77 z1 = (*m_vertices)[pc + 2];
78 x2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 3 ];
79 y2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 2 ];
80 z2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 1 ];
91 float norm = std::sqrt( r * r + g * g + b * b );
96 lastx = (*m_vertices)[pc] + ( (*m_vertices)[pc] - (*m_vertices)[pc + 3] );
97 lasty = (*m_vertices)[pc+ 1] + ( (*m_vertices)[pc + 1] - (*m_vertices)[pc + 4] );
98 lastz = (*m_vertices)[pc + 2] + ( (*m_vertices)[pc + 2] - (*m_vertices)[pc + 5] );
100 for(
size_t j = 0; j < m_lineLengths->at( i ); ++j )
102 rr = lastx - (*m_vertices)[pc];
103 gg = lasty - (*m_vertices)[pc + 1];
104 bb = lastz - (*m_vertices)[pc + 2];
105 lastx = (*m_vertices)[pc];
106 lasty = (*m_vertices)[pc + 1];
107 lastz = (*m_vertices)[pc + 2];
109 float norm = std::sqrt( rr * rr + gg * gg + bb * bb );
113 (*m_tangents)[pc] = rr;
114 (*m_tangents)[pc+1] = gg;
115 (*m_tangents)[pc+2] = bb;
124 (*m_localColors)[pc] = rr;
125 (*m_localColors)[pc+1] = gg;
126 (*m_localColors)[pc+2] = bb;
128 (*m_globalColors)[pc] = r;
129 (*m_globalColors)[pc+1] = g;
130 (*m_globalColors)[pc+2] = b;