29 #include "WCreateColorArraysThread.h"
33 std::shared_ptr< std::vector< size_t > > lineLengths,
34 std::shared_ptr< std::vector< float > > globalColors,
35 std::shared_ptr< std::vector< float > > localColors,
36 std::shared_ptr< std::vector< float > > tangents ):
38 m_myThreadFinished( false ),
41 m_vertices( vertices ),
42 m_tangents( tangents ),
43 m_globalColors( globalColors ),
44 m_localColors( localColors ),
45 m_lineLengths( lineLengths )
66 for(
int i = 0; i <
m_left; ++i )
68 pc += (*m_lineLengths)[i]*3;
71 float r, g, b, rr, gg, bb;
72 float x1, x2, y1, y2, z1, z2;
73 float lastx, lasty, lastz;
76 x1 = (*m_vertices)[pc];
77 y1 = (*m_vertices)[pc + 1];
78 z1 = (*m_vertices)[pc + 2];
79 x2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 3 ];
80 y2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 2 ];
81 z2 = (*m_vertices)[pc + (*m_lineLengths)[i] * 3 - 1 ];
92 float norm = std::sqrt( r * r + g * g + b * b );
100 lastx = (*m_vertices)[pc] + ( (*m_vertices)[pc] - (*m_vertices)[pc + 3] );
101 lasty = (*m_vertices)[pc+ 1] + ( (*m_vertices)[pc + 1] - (*m_vertices)[pc + 4] );
102 lastz = (*m_vertices)[pc + 2] + ( (*m_vertices)[pc + 2] - (*m_vertices)[pc + 5] );
106 rr = lastx - (*m_vertices)[pc];
107 gg = lasty - (*m_vertices)[pc + 1];
108 bb = lastz - (*m_vertices)[pc + 2];
109 lastx = (*m_vertices)[pc];
110 lasty = (*m_vertices)[pc + 1];
111 lastz = (*m_vertices)[pc + 2];
113 float norm = std::sqrt( rr * rr + gg * gg + bb * bb );
120 (*m_tangents)[pc] = rr;
121 (*m_tangents)[pc+1] = gg;
122 (*m_tangents)[pc+2] = bb;
131 (*m_localColors)[pc] = rr;
132 (*m_localColors)[pc+1] = gg;
133 (*m_localColors)[pc+2] = bb;
135 (*m_globalColors)[pc] = r;
136 (*m_globalColors)[pc+1] = g;
137 (*m_globalColors)[pc+2] = b;
std::shared_ptr< const std::vector< float > > m_vertices
Point vector for all fibers.
virtual void threadMain()
entry for the run command
bool m_myThreadFinished
Has the thread finished?
std::shared_ptr< std::vector< float > > m_tangents
Point vector for tangents at each vertex, used for fake tubes.
std::shared_ptr< std::vector< float > > m_globalColors
Storing the global color value of the fibers for each point.
WCreateColorArraysThread(int left, int right, std::shared_ptr< std::vector< float > >vertices, std::shared_ptr< std::vector< size_t > > lineLengths, std::shared_ptr< std::vector< float > > globalColors, std::shared_ptr< std::vector< float > > localColors, std::shared_ptr< std::vector< float > > tangents)
default constructor
std::shared_ptr< const std::vector< size_t > > m_lineLengths
Line vector that contains the number of vertices for each line.
std::shared_ptr< std::vector< float > > m_localColors
Storing the local color value of the fibers for each point.
bool isFinished()
Return the value of the finished flag.
int m_right
right boundary
virtual ~WCreateColorArraysThread()
destructor
Base class for all classes needing to be executed in a separate thread.