+void SGCloudField::clear(void) {
+#if 0
+ list_of_Cloud::iterator iCloud;
+ for( iCloud = theField.begin() ; iCloud != theField.end() ; iCloud++ ) {
+ delete iCloud->aCloud;
+ }
+ theField.clear();
+ // force a recompute of density on first redraw
+ last_density = 0.0;
+ // true to come back in set density after layer is built
+ draw_in_3d = true;
+#endif
+}
+
+// use a table or else we see poping when moving the slider...
+static int densTable[][10] = {
+ {0,0,0,0,0,0,0,0,0,0},
+ {1,0,0,0,0,0,0,0,0,0},
+ {1,0,0,0,1,0,0,0,0,0},
+ {1,0,0,0,1,0,0,1,0,0}, // 30%
+ {1,0,1,0,1,0,0,1,0,0},
+ {1,0,1,0,1,0,1,1,0,0}, // 50%
+ {1,0,1,0,1,0,1,1,0,1},
+ {1,0,1,1,1,0,1,1,0,1}, // 70%
+ {1,1,1,1,1,0,1,1,0,1},
+ {1,1,1,1,1,0,1,1,1,1}, // 90%
+ {1,1,1,1,1,1,1,1,1,1}
+};
+
+// set the visible flag depending on density
+void SGCloudField::applyDensity(void) {
+#if 0
+ int row = (int) (density / 10.0);
+ int col = 0;
+ sgBox fieldBox;
+
+ list_of_Cloud::iterator iCloud;
+ for( iCloud = theField.begin() ; iCloud != theField.end() ; iCloud++ ) {
+ if(++col > 9)
+ col = 0;
+ if( densTable[row][col] ) {
+ iCloud->visible = true;
+ fieldBox.extend( *iCloud->aCloud->getCenter() );
+ } else
+ iCloud->visible = false;
+ }
+ last_density = density;
+ draw_in_3d = ( theField.size() != 0);
+ sgVec3 center;
+ sgSubVec3( center, fieldBox.getMax(), fieldBox.getMin() );
+ sgScaleVec3( center, 0.5f );
+ center[1] = 0.0f;
+ field_sphere.setCenter( center );
+ field_sphere.setRadius( fieldSize * 0.5f * 1.414f );
+#endif
+}
+