Core.Object | +--Editor.BrushBuilder | +--Editor.CubeBuilder
Width,
Breadth
name
GroupName
bool
Hollow
float
WallThickness
void
BuildCube(int Direction, float dx, float dy, float dz)
00001 //============================================================================= 00002 // CubeBuilder: Builds a 3D cube brush. 00003 //============================================================================= 00004 class CubeBuilder 00005 expands BrushBuilder; 00006 00007 var() float Height, Width, Breadth; 00008 var() float WallThickness; 00009 var() name GroupName; 00010 var() bool Hollow; 00011 00012 function BuildCube( int Direction, float dx, float dy, float dz ) 00013 { 00014 local int n,i,j,k; 00015 n = GetVertexCount(); 00016 00017 for( i=-1; i<2; i+=2 ) 00018 for( j=-1; j<2; j+=2 ) 00019 for( k=-1; k<2; k+=2 ) 00020 Vertex3f( i*dx/2, j*dy/2, k*dz/2 ); 00021 00022 Poly4i(Direction,n+0,n+1,n+3,n+2); 00023 Poly4i(Direction,n+2,n+3,n+7,n+6); 00024 Poly4i(Direction,n+6,n+7,n+5,n+4); 00025 Poly4i(Direction,n+4,n+5,n+1,n+0); 00026 Poly4i(Direction,n+3,n+1,n+5,n+7); 00027 Poly4i(Direction,n+0,n+2,n+6,n+4); 00028 } 00029 00030 event bool Build() 00031 { 00032 if( Height<=0 || Width<=0 || Breadth<=0 ) 00033 return BadParameters(); 00034 if( Hollow && (Height<=WallThickness || Width<=WallThickness || Breadth<=WallThickness) ) 00035 return BadParameters(); 00036 00037 BeginBrush( false, GroupName ); 00038 BuildCube( +1, Height, Width, Breadth ); 00039 if( Hollow ) 00040 BuildCube( -1, Height-WallThickness, Width-WallThickness, Breadth-WallThickness ); 00041 return EndBrush(); 00042 } 00043 00044 defaultproperties 00045 { 00046 Height=256.000000 00047 Width=256.000000 00048 Breadth=256.000000 00049 WallThickness=16.000000 00050 GroupName=Cube 00051 }