home *** CD-ROM | disk | FTP | other *** search
/ Game Level Design / GLDesign.bin / Software / UnrealEngine2Runtime / UE2Runtime-22262001_Demo.exe / Editor / Classes / SheetBuilder.uc < prev    next >
Text File  |  2003-10-22  |  2KB  |  73 lines

  1. //=============================================================================
  2. // SheetBuilder: Builds a simple sheet.
  3. //=============================================================================
  4. class SheetBuilder
  5.     extends BrushBuilder;
  6.  
  7. var() int Height, Width, HorizBreaks, VertBreaks;
  8. var() enum ESheetAxis
  9. {
  10.     AX_Horizontal,
  11.     AX_XAxis,
  12.     AX_YAxis,
  13. } Axis;
  14. var() name GroupName;
  15.  
  16. event bool Build()
  17. {
  18.     local int x, y, XStep, YStep, count;
  19.  
  20.     if( Height<=0 || Width<=0 || HorizBreaks<=0 || VertBreaks<=0 )
  21.         return BadParameters();
  22.  
  23.     BeginBrush( false, GroupName );
  24.     XStep = Width/HorizBreaks;
  25.     YStep = Height/VertBreaks;
  26.  
  27.     count = 0;
  28.     for( x = 0 ; x < HorizBreaks ; x++ )
  29.     {
  30.         for( y = 0 ; y < VertBreaks ; y++ )
  31.         {
  32.             if( Axis==AX_Horizontal )
  33.             {
  34.                 Vertex3f(  (x*XStep)-Width/2, (y*YStep)-Height/2, 0 );
  35.                 Vertex3f(  (x*XStep)-Width/2, ((y+1)*YStep)-Height/2, 0 );
  36.                 Vertex3f(  ((x+1)*XStep)-Width/2, ((y+1)*YStep)-Height/2, 0 );
  37.                 Vertex3f(  ((x+1)*XStep)-Width/2, (y*YStep)-Height/2, 0 );
  38.             }
  39.             else if( Axis==AX_XAxis )
  40.             {
  41.                 Vertex3f(  0, (x*XStep)-Width/2, (y*YStep)-Height/2 );
  42.                 Vertex3f(  0, (x*XStep)-Width/2, ((y+1)*YStep)-Height/2 );
  43.                 Vertex3f(  0, ((x+1)*XStep)-Width/2, ((y+1)*YStep)-Height/2 );
  44.                 Vertex3f(  0, ((x+1)*XStep)-Width/2, (y*YStep)-Height/2 );
  45.             }
  46.             else
  47.             {
  48.                 Vertex3f(  (x*XStep)-Width/2, 0, (y*YStep)-Height/2 );
  49.                 Vertex3f(  (x*XStep)-Width/2, 0, ((y+1)*YStep)-Height/2 );
  50.                 Vertex3f(  ((x+1)*XStep)-Width/2, 0, ((y+1)*YStep)-Height/2 );
  51.                 Vertex3f(  ((x+1)*XStep)-Width/2, 0, (y*YStep)-Height/2 );
  52.             }
  53.  
  54.             Poly4i(+1,count,count+1,count+2,count+3,'Sheet',0x00000108); // PF_TwoSided|PF_NotSolid.
  55.             count = GetVertexCount();
  56.         }
  57.     }
  58.  
  59.     return EndBrush();
  60. }
  61.  
  62. defaultproperties
  63. {
  64.     Height=256
  65.     Width=256
  66.     HorizBreaks=1
  67.     VertBreaks=1
  68.     Axis=SHEETAXIS_FloorCeiling
  69.     GroupName=Sheet
  70.     BitmapFilename="BBSheet"
  71.     ToolTip="Sheet"
  72. }
  73.