public VoxelGfx_Tree_Straight() { Random = new LightSpeedRandom(); // Trunc starting direction : Vertical absolute. StartingDirection.Len = 1; StartingDirection.pitch = 90; StartingDirection.yaw = 90; StartingDirection.roll = 0; TruncHeight = 20; // 40 MinSubDivisionsPerNode = 1; MaxSubDivisionsPerNode = 3; RandomSubdivs = true; BrancheLen = 10; SecundaryTruncSegmentLenght = 2.5f; MaxBranchLenght = 120; FolliageLenght = 50; // 60 HasFolliage = true; }
void GenerateBigTrees( VoxelSector Sector ) { int x, z, xs, ys, zs, GenerationRadius; VoxelGfx_Tree TreeMaker = new VoxelGfx_Tree(); VoxelGfx_Tree_Straight TreeMaker_2 = new VoxelGfx_Tree_Straight(); VoxelGfx_Tree_Giant TreeMaker_3 = new VoxelGfx_Tree_Giant(); LightSpeedRandom Random = new LightSpeedRandom(); //int Seed; ushort ZoneType = 0; uint RandNum, TreeType; bool ZoneOk; xs = Sector.Pos_x << VoxelSector.ZVOXELBLOCSHIFT_X; ys = Sector.Pos_y << VoxelSector.ZVOXELBLOCSHIFT_Y; zs = Sector.Pos_z << VoxelSector.ZVOXELBLOCSHIFT_Z; //Seed = xs + 3524*ys + 234 * zs; /* Sector.SetCube(0,20,0, 2); Sector.SetCube(15,20,15, 2); return; */ GenerationRadius = 150; for( x = xs - GenerationRadius; x < xs + GenerationRadius; x++ ) for( z = zs - GenerationRadius; z < zs + GenerationRadius; z++ ) { if( ( RandNum = Random.GetNumber( (uint)(Math.Abs( x ) + ( Math.Abs( z ) << 8 ) )) ) < ( 4194304 / 3 ) ) // 6 { ZVector3f Position; Position.x = x - xs; Position.z = z - zs; Position.y = GetZoneHeight( x, z, out ZoneType ) - ys; TreeMaker.Seed = (uint)( Math.Abs( x ) * 3 + ( ( Math.Abs( z ) << 9 ) * 5 ) ); TreeMaker_2.Seed = TreeMaker.Seed; TreeType = RandNum & 7; ZoneOk = ( ZoneType == 5 ); switch( TreeType ) { case 0: case 1: case 2: if( Position.y > -128 && Position.y < 64 && ZoneOk ) TreeMaker.DrawTree( Sector, ref Position ); break; case 3: case 4: case 5: case 6: if( Position.y > -192 && Position.y < 64 && ZoneOk ) TreeMaker_2.DrawTree( Sector, ref Position ); break; case 7: if( Position.y > -1024 && Position.y < 64 && ZoneOk ) TreeMaker_3.DrawTree( Sector, ref Position ); break; } } } }
public Genesis() { int i; // char to num RandomGen = new LightSpeedRandom(); RandomGen.Init(); SaltyRandomGen = new SaltyRandomGenerator(); SaltyRandomGen.getsalt += RandomGen_getsalt; for( i = 0; i < 256; i++ ) ConvCN[i] = 0; for( i = 0; i <= 9; i++ ) ConvCN[i + '0'] = (ushort)i; for( i = 0; i < 26; i++ ) ConvCN[i + 'A'] = (ushort)( 10 + i ); for( i = 0; i < 26; i++ ) ConvCN[i + 'a'] = (ushort)( 36 + i ); }
public VoxelGfx_Tree() { // Trunc starting direction : Vertical absolute. Random = new LightSpeedRandom(); Random.Init( Seed ); StartingDirection.Len = 1; StartingDirection.pitch = 90; StartingDirection.yaw = 90; StartingDirection.roll = 0; TruncHeight = 20; // 40.0 MinSubDivisionsPerNode = 1; MaxSubDivisionsPerNode = 3; RandomSubdivs = true; BrancheLen = 10.0f; MaxBranchLenght = 80.0f; FolliageLenght = 50.0f; // 60.0 HasFolliage = true; }