00001 //--------------------------------------------------------------------------- 00002 // 00003 // Project: OpenWalnut ( http://www.openwalnut.org ) 00004 // 00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS 00006 // For more information see http://www.openwalnut.org/copying 00007 // 00008 // This file is part of OpenWalnut. 00009 // 00010 // OpenWalnut is free software: you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as published by 00012 // the Free Software Foundation, either version 3 of the License, or 00013 // (at your option) any later version. 00014 // 00015 // OpenWalnut is distributed in the hope that it will be useful, 00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 // GNU Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public License 00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>. 00022 // 00023 //--------------------------------------------------------------------------- 00024 00025 #ifndef WCREATECOLORARRAYSTHREAD_H 00026 #define WCREATECOLORARRAYSTHREAD_H 00027 00028 #include <vector> 00029 00030 #include "../common/WThreadedRunner.h" 00031 #include "WExportDataHandler.h" 00032 00033 /** 00034 * implements a thread that updates the fiber selection bit field 00035 */ 00036 class OWDATAHANDLER_EXPORT WCreateColorArraysThread: public WThreadedRunner // NOLINT 00037 { 00038 public: 00039 /** 00040 * default constructor 00041 * 00042 * \param left 00043 * \param right 00044 * \param vertices 00045 * \param lineStartIndexes 00046 * \param lineLengths 00047 * \param globalColors 00048 * \param localColors 00049 * \param tangents 00050 */ 00051 WCreateColorArraysThread( int left, int right, boost::shared_ptr< std::vector< float > >vertices, 00052 boost::shared_ptr< std::vector< size_t > > lineStartIndexes, 00053 boost::shared_ptr< std::vector< size_t > > lineLengths, 00054 boost::shared_ptr< std::vector< float > > globalColors, 00055 boost::shared_ptr< std::vector< float > > localColors, 00056 boost::shared_ptr< std::vector< float > > tangents ); 00057 00058 /** 00059 * destructor 00060 */ 00061 virtual ~WCreateColorArraysThread(); 00062 00063 /** 00064 * entry for the run command 00065 */ 00066 virtual void threadMain(); 00067 00068 /** 00069 * Return the value of the finished flag. 00070 * 00071 * \return true if finished 00072 */ 00073 inline bool isFinished(); 00074 00075 protected: 00076 private: 00077 00078 bool m_myThreadFinished; //!< Has the thread finished? 00079 00080 int m_left; //!< left boundary 00081 00082 int m_right; //!< right boundary 00083 00084 /** 00085 * Point vector for all fibers 00086 */ 00087 boost::shared_ptr< std::vector< float > > m_vertices; 00088 00089 /** 00090 * Point vector for tangents at each vertex, used for fake tubes 00091 */ 00092 boost::shared_ptr< std::vector< float > > m_tangents; 00093 00094 /** 00095 * Storing the global color value of the fibers for each point. 00096 */ 00097 boost::shared_ptr< std::vector< float > > m_globalColors; 00098 00099 /** 00100 * Storing the local color value of the fibers for each point. 00101 * \note it is mutable to allow getLocalColors creating it on demand. 00102 */ 00103 mutable boost::shared_ptr< std::vector< float > > m_localColors; 00104 00105 /** 00106 * Line vector that contains the start index of its first point for each line. 00107 * \warning The index returned cannot be used in the vertices array until 00108 * the number of components for each point is multiplied. 00109 */ 00110 boost::shared_ptr< std::vector< size_t > > m_lineStartIndexes; 00111 00112 /** 00113 * Line vector that contains the number of vertices for each line 00114 */ 00115 boost::shared_ptr< std::vector< size_t > > m_lineLengths; 00116 }; 00117 00118 #endif // WCREATECOLORARRAYSTHREAD_H