27 #include "WCreateColorArraysThread.h"
31 boost::shared_ptr< std::vector< size_t > > lineStartIndexes,
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_lineStartIndexes( lineStartIndexes ),
45 m_lineLengths( lineLengths )
71 for(
int i = 0; i <
m_left; ++i )
73 pc += (*m_lineLengths)[i]*3;
76 float r, g, b, rr, gg, bb;
77 float x1, x2, y1, y2, z1, z2;
78 float lastx, lasty, lastz;
79 for(
int i = m_left; i <=
m_right; ++i )
81 x1 = (*m_vertices)[pc];
82 y1 = (*m_vertices)[pc + 1];
83 z1 = (*m_vertices)[pc + 2];
84 x2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 3 ];
85 y2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 2 ];
86 z2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 1 ];
97 float norm = sqrt( r * r + g * g + b * b );
102 lastx = (*m_vertices)[pc] + ( (*m_vertices)[pc] - (*m_vertices)[pc + 3] );
103 lasty = (*m_vertices)[pc+ 1] + ( (*m_vertices)[pc + 1] - (*m_vertices)[pc + 4] );
104 lastz = (*m_vertices)[pc + 2] + ( (*m_vertices)[pc + 2] - (*m_vertices)[pc + 5] );
106 for(
size_t j = 0; j < m_lineLengths->at( i ); ++j )
108 rr = lastx - (*m_vertices)[pc];
109 gg = lasty - (*m_vertices)[pc + 1];
110 bb = lastz - (*m_vertices)[pc + 2];
111 lastx = (*m_vertices)[pc];
112 lasty = (*m_vertices)[pc + 1];
113 lastz = (*m_vertices)[pc + 2];
115 float norm = sqrt( rr * rr + gg * gg + bb * bb );
119 (*m_tangents)[pc] = rr;
120 (*m_tangents)[pc+1] = gg;
121 (*m_tangents)[pc+2] = bb;
130 (*m_localColors)[pc] = rr;
131 (*m_localColors)[pc+1] = gg;
132 (*m_localColors)[pc+2] = bb;
134 (*m_globalColors)[pc] = r;
135 (*m_globalColors)[pc+1] = g;
136 (*m_globalColors)[pc+2] = b;