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
00065 class SoDistributeAction : public SoAction
00066 {
00067 SO_ACTION_HEADER(SoDistributeAction);
00068
00069 public:
00073 enum DistributeMethod
00074 {
00075 ROUND_ROBIN,
00076 TRIANGLE_COUNT
00077 };
00078
00082 SoDistributeAction();
00083
00087 #ifndef HIDDEN_FROM_DOC
00088 virtual ~SoDistributeAction();
00089 #endif // HIDDEN_FROM_DOC
00090
00095 void setDistributeMethod( DistributeMethod distribMethod );
00096
00100 DistributeMethod getDistributeMethod();
00101
00102 private:
00103
00104 static void initClass();
00105 static void exitClass();
00106
00111 void setInitialWeight ( uint32_t initWeight );
00112
00117 void setAverageWeight( uint32_t newAverage );
00118
00122 uint32_t getAverageWeight();
00123
00127 uint32_t getCurrentRUId();
00128
00132 void setCurrentRUId( uint32_t currentRenderUnitId );
00133
00134
00138 void setRUIdWeight( uint32_t renderUnitId, uint32_t weight );
00139
00143 uint32_t getRUIdWeight( uint32_t renderUnitId );
00144
00148 uint32_t setCurRUIdWeight( uint32_t weight );
00149
00153 uint32_t getRemainingWeight();
00154
00158 void setRemainingWeight( uint32_t weight );
00159
00163 uint32_t getBruteForceRUId();
00164
00165 private:
00166
00173 void beginTraversal( SoNode* node );
00174
00175 private:
00176
00177 DistributeMethod m_distributeMethod;
00178 uint32_t m_averageWeight;
00179 uint32_t m_currentRenderUnitId;
00180 uint32_t* m_weightAssigned;
00181 uint32_t m_initialWeight;
00182 uint32_t m_remainingWeight;
00183
00184 void resetParam();
00185 uint32_t getNextRUId();
00186 };
00187
00188
00189
00190 inline void
00191 SoDistributeAction::setDistributeMethod( SoDistributeAction::DistributeMethod distribMethod )
00192 {
00193 m_distributeMethod = distribMethod;
00194 }
00195
00196 inline SoDistributeAction::DistributeMethod
00197 SoDistributeAction::getDistributeMethod()
00198 {
00199 return m_distributeMethod;
00200 }
00201
00202 inline uint32_t
00203 SoDistributeAction::getAverageWeight()
00204 {
00205 return m_averageWeight;
00206 }
00207
00208 inline void
00209 SoDistributeAction::setAverageWeight( uint32_t newAverage )
00210 {
00211 m_averageWeight = newAverage;
00212 }
00213
00214 inline uint32_t
00215 SoDistributeAction::getCurrentRUId()
00216 {
00217 return m_currentRenderUnitId;
00218 }
00219
00220 inline void
00221 SoDistributeAction::setCurrentRUId( uint32_t currentRenderUnitId )
00222 {
00223 m_currentRenderUnitId = currentRenderUnitId;
00224 }
00225
00226 inline uint32_t
00227 SoDistributeAction::getRemainingWeight()
00228 {
00229 return m_remainingWeight;
00230 }
00231
00232 inline void
00233 SoDistributeAction::setRemainingWeight( uint32_t weight )
00234 {
00235 m_remainingWeight = weight;
00236 }
00237
00238 #endif // SO_DISTRIBUTE_ACTION
00239
00240
00241
00242
00243