00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef SO_DISTRIBUTE_ACTION
00026 #define SO_DISTRIBUTE_ACTION
00027
00028 #include <Inventor/actions/SoSubAction.h>
00029
00063 class SoDistributeAction : public SoAction
00064 {
00065 SO_ACTION_HEADER(SoDistributeAction);
00066
00067 public:
00071 enum DistributeMethod
00072 {
00073 ROUND_ROBIN,
00074 TRIANGLE_COUNT
00075 };
00076
00080 SoDistributeAction();
00081
00085 #ifndef HIDDEN_FROM_DOC
00086 virtual ~SoDistributeAction();
00087 #endif // HIDDEN_FROM_DOC
00088
00093 void setDistributeMethod( DistributeMethod distribMethod );
00094
00098 DistributeMethod getDistributeMethod();
00099
00100 private:
00101
00102 static void initClass();
00103 static void exitClass();
00104
00109 void setInitialWeight ( uint32_t initWeight );
00110
00115 void setAverageWeight( uint32_t newAverage );
00116
00120 uint32_t getAverageWeight();
00121
00125 uint32_t getCurrentRUId();
00126
00130 void setCurrentRUId( uint32_t currentRenderUnitId );
00131
00132
00136 void setRUIdWeight( uint32_t renderUnitId, uint32_t weight );
00137
00141 uint32_t getRUIdWeight( uint32_t renderUnitId );
00142
00146 uint32_t setCurRUIdWeight( uint32_t weight );
00147
00151 uint32_t getRemainingWeight();
00152
00156 void setRemainingWeight( uint32_t weight );
00157
00161 uint32_t getBruteForceRUId();
00162
00163 private:
00164
00171 void beginTraversal( SoNode* node );
00172
00173 private:
00174
00175 DistributeMethod m_distributeMethod;
00176 uint32_t m_averageWeight;
00177 uint32_t m_currentRenderUnitId;
00178 uint32_t* m_weightAssigned;
00179 uint32_t m_initialWeight;
00180 uint32_t m_remainingWeight;
00181
00182 void resetParam();
00183 uint32_t getNextRUId();
00184 };
00185
00186
00187
00188 inline void
00189 SoDistributeAction::setDistributeMethod( SoDistributeAction::DistributeMethod distribMethod )
00190 {
00191 m_distributeMethod = distribMethod;
00192 }
00193
00194 inline SoDistributeAction::DistributeMethod
00195 SoDistributeAction::getDistributeMethod()
00196 {
00197 return m_distributeMethod;
00198 }
00199
00200 inline uint32_t
00201 SoDistributeAction::getAverageWeight()
00202 {
00203 return m_averageWeight;
00204 }
00205
00206 inline void
00207 SoDistributeAction::setAverageWeight( uint32_t newAverage )
00208 {
00209 m_averageWeight = newAverage;
00210 }
00211
00212 inline uint32_t
00213 SoDistributeAction::getCurrentRUId()
00214 {
00215 return m_currentRenderUnitId;
00216 }
00217
00218 inline void
00219 SoDistributeAction::setCurrentRUId( uint32_t currentRenderUnitId )
00220 {
00221 m_currentRenderUnitId = currentRenderUnitId;
00222 }
00223
00224 inline uint32_t
00225 SoDistributeAction::getRemainingWeight()
00226 {
00227 return m_remainingWeight;
00228 }
00229
00230 inline void
00231 SoDistributeAction::setRemainingWeight( uint32_t weight )
00232 {
00233 m_remainingWeight = weight;
00234 }
00235
00236 #endif // SO_DISTRIBUTE_ACTION
00237
00238
00239
00240
00241