Editor
Class SheetBuilder

source: C:\XIII\Editor\Classes\SheetBuilder.uc
Core.Object
   |
   +--Editor.BrushBuilder
      |
      +--Editor.SheetBuilder
Direct Known Subclasses:None

class SheetBuilder
extends Editor.BrushBuilder

//============================================================================= // SheetBuilder: Builds a simple sheet. //=============================================================================
Variables
 enum ESheetAxis
 name GroupName
 HorizBreaks, VertBreaks


Source Code


00001	//=============================================================================
00002	// SheetBuilder: Builds a simple sheet.
00003	//=============================================================================
00004	class SheetBuilder
00005		extends BrushBuilder;
00006	
00007	var() int Height, Width, HorizBreaks, VertBreaks;
00008	var() enum ESheetAxis
00009	{
00010		AX_Horizontal,
00011		AX_XAxis,
00012		AX_YAxis,
00013	} Axis;
00014	var() name GroupName;
00015	
00016	event bool Build()
00017	{
00018		local int x, y, XStep, YStep, idx, count;
00019	
00020		if( Height<=0 || Width<=0 || HorizBreaks<=0 || VertBreaks<=0 )
00021			return BadParameters();
00022	
00023		BeginBrush( false, GroupName );
00024		XStep = Width/HorizBreaks;
00025		YStep = Height/VertBreaks;
00026	
00027		count = 0;
00028		for( x = 0 ; x < HorizBreaks ; x++ )
00029		{
00030			for( y = 0 ; y < VertBreaks ; y++ )
00031			{
00032				if( Axis==AX_Horizontal )
00033				{
00034					Vertex3f(  (x*XStep)-Width/2, (y*YStep)-Height/2, 0 );
00035					Vertex3f(  (x*XStep)-Width/2, ((y+1)*YStep)-Height/2, 0 );
00036					Vertex3f(  ((x+1)*XStep)-Width/2, ((y+1)*YStep)-Height/2, 0 );
00037					Vertex3f(  ((x+1)*XStep)-Width/2, (y*YStep)-Height/2, 0 );
00038				}
00039				else if( Axis==AX_XAxis )
00040				{
00041					Vertex3f(  0, (x*XStep)-Width/2, (y*YStep)-Height/2 );
00042					Vertex3f(  0, (x*XStep)-Width/2, ((y+1)*YStep)-Height/2 );
00043					Vertex3f(  0, ((x+1)*XStep)-Width/2, ((y+1)*YStep)-Height/2 );
00044					Vertex3f(  0, ((x+1)*XStep)-Width/2, (y*YStep)-Height/2 );
00045				}
00046				else
00047				{
00048					Vertex3f(  (x*XStep)-Width/2, 0, (y*YStep)-Height/2 );
00049					Vertex3f(  (x*XStep)-Width/2, 0, ((y+1)*YStep)-Height/2 );
00050					Vertex3f(  ((x+1)*XStep)-Width/2, 0, ((y+1)*YStep)-Height/2 );
00051					Vertex3f(  ((x+1)*XStep)-Width/2, 0, (y*YStep)-Height/2 );
00052				}
00053	
00054				Poly4i(+1,count,count+1,count+2,count+3,'Sheet',0x00000108); // PF_TwoSided|PF_NotSolid.
00055				count = GetVertexCount();
00056			}
00057		}
00058	
00059		return EndBrush();
00060	}
00061	
00062	defaultproperties
00063	{
00064	     Height=256
00065	     width=256
00066	     HorizBreaks=1
00067	     VertBreaks=1
00068	     GroupName="Sheet"
00069	     BitmapFilename="BBSheet"
00070	     ToolTip="Sheet"
00071	}

End Source Code