public override int DrawBatch( int maxBlocksToDraw )
{
//ignoring maxBlocksToDraw
_count = 0;
int exCount = 0;
for ( Coords.X = Bounds.XMin; Coords.X <= Bounds.XMax && MathCommands.MaxCalculationExceptions >= exCount; ++Coords.X ) {
for ( Coords.Y = Bounds.YMin; Coords.Y <= Bounds.YMax && MathCommands.MaxCalculationExceptions >= exCount; ++Coords.Y ) {
for ( Coords.Z = Bounds.ZMin; Coords.Z <= Bounds.ZMax; ++Coords.Z ) {
try {
if ( _expression.Evaluate( _scaler.ToFuncParam( Coords.X, Bounds.XMin, Bounds.XMax ),
_scaler.ToFuncParam( Coords.Y, Bounds.YMin, Bounds.YMax ),
_scaler.ToFuncParam( Coords.Z, Bounds.ZMin, Bounds.ZMax ) ) > 0 ) //1.0 means true
{
if ( DrawOneBlock() )
++_count;
}
//if (TimeToEndBatch)
// return _count;
} catch ( Exception ) {
//the exception here is kinda of normal, for functions (especially interesting ones)
//may have eg punctured points; we just have to keep an eye on the number, since producing 10000
//exceptions in the multiclient application is not the best idea
if ( ++exCount > MathCommands.MaxCalculationExceptions ) {
Player.Message( "Drawing is interrupted: too many (>" + MathCommands.MaxCalculationExceptions +
") calculation exceptions." );
break;
}
}
}
}
}
IsDone = true;
return _count;
}