コード例 #1
0
ファイル: VoxelType.cs プロジェクト: d3x0r/Voxelarium
		public VoxelType()
		{
			VoxelTypeManager = null;
			MainTexture = null;
			//OpenGl_TextureRef = 0;
			GameEnv = null;
		}
コード例 #2
0
ファイル: VoxelRef.cs プロジェクト: d3x0r/Voxelarium
		internal VoxelRef( VoxelWorld world, VoxelTypeManager vtm, byte x = 0, byte y = 0, byte z = 0, VoxelSector Sector = null, ushort VoxelType = 0 )
		{
			this.x = x;
			this.y = y;
			this.z = z;
			this.wx = ( Sector.Pos_x << VoxelSector.ZVOXELBLOCSHIFT_X )+ x;
			this.wy = ( Sector.Pos_y << VoxelSector.ZVOXELBLOCSHIFT_Y )+y;
			this.wz = ( Sector.Pos_z << VoxelSector.ZVOXELBLOCSHIFT_Z )+z;
			this.Sector = Sector;
			this.Offset = ( (uint)x << VoxelSector.ZVOXELBLOCSHIFT_Y )  + y + ((uint)z << ( VoxelSector.ZVOXELBLOCSHIFT_X+VoxelSector.ZVOXELBLOCSHIFT_Y));
			this.World = world;
			this.Type = vtm[VoxelType];
			VoxelTypeManager = vtm;
			VoxelExtension = null;
		}
コード例 #3
0
ファイル: genesis.cs プロジェクト: d3x0r/Voxelarium
		public bool LoadTemplateImages( VoxelTypeManager voxelTypeManager )
		{
			this.voxelTypeManager = voxelTypeManager;
			string MiscDirectory, FileName;
			MiscDirectory = VoxelGlobalSettings.COMPILEOPTION_DATAFILESPATH + "/Misc" ;

			FileName = MiscDirectory + "/tmplt_1.dat";
			if( ( Template_1 = new Bitmap( FileName ) ) == null ) return false;
			Canva_1.SetSize( 256, 256 );
			Canva_1.GetFromBitmap( Template_1 );

			FileName = MiscDirectory + "/tmplt_2.dat";
			if( ( Template_2 = new Bitmap( FileName ) ) == null ) return false;
			Canva_2.SetSize( 256, 256 );
			Canva_2.GetFromBitmap( Template_2 );

			FileName = MiscDirectory + "/tmplt_3_1.dat";
			if( ( Template_3_1 = new Bitmap( FileName ) ) == null ) return false;
			Canva_3_1.SetSize( 1024, 1024 );
			Canva_3_1.GetFromBitmap( Template_3_1 );

			FileName = MiscDirectory + "/tmplt_3_2.dat";
			if( ( Template_3_2 = new Bitmap( FileName ) ) == null ) return false;
			Canva_3_2.SetSize( 1024, 1024 );
			Canva_3_2.GetFromBitmap( Template_3_2, true, 1 ); // r=2 b=0 g=1

			FileName = MiscDirectory + "/tmplt_3_3.dat";
			if( ( Template_3_3 = new Bitmap( FileName ) ) == null ) return false;
			Canva_3_3.SetSize( 1024, 1024 );
			Canva_3_3.GetFromBitmap( Template_3_3, true, 0 );

			FileName = MiscDirectory + "/sect_1.dat";
			T3dTemplate_1.SetNotStandardSize();
			T3dTemplate_1.SetVoxelTypeManager( voxelTypeManager );
			T3dTemplate_1.Load( 0, FileName );

			FileName = MiscDirectory + "/sect_2.dat";
			T3dTemplate_2.SetNotStandardSize();
			T3dTemplate_2.SetVoxelTypeManager( voxelTypeManager );
			T3dTemplate_2.Load( 0, FileName );

			FileName = MiscDirectory + "/Vegetation_1.dat";
			Template_Vegetation_1.SetNotStandardSize();
			Template_Vegetation_1.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_1.Load( 0, FileName );
			Template_Vegetation_1.Subst( 32767 + 2, 234 );
			//Template_Vegetation_1.Subst(71, 32767+21);

			FileName = MiscDirectory + "/Vegetation_2.dat";
			Template_Vegetation_2.SetNotStandardSize();
			Template_Vegetation_2.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_2.Load( 0, FileName );
			Template_Vegetation_2.Subst( 1, 234 );
			Template_Vegetation_2.Subst( 2, 71 );

			FileName = MiscDirectory + "/Vegetation_3.dat";
			Template_Vegetation_3.SetNotStandardSize();
			Template_Vegetation_3.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_3.Load( 0, FileName );
			Template_Vegetation_3.Subst( 1, 234 );
			Template_Vegetation_3.Subst( 2, 71 );


			TreeTable[0] = Template_Vegetation_1;
			TreeTable[1] = Template_Vegetation_2;
			TreeTable[2] = Template_Vegetation_3;


			// Tools for ringmap manipulation.
			/*
			  int Ring=5;
			  int Shift = 3;
			  ZoneMap_Shift(ZoneMap_New, 128, 128, "const char * ZoneMap_New[]=", Ring, Shift, "Out_1.txt");
			  ZoneMap_Shift(RingNum, 128, 128, "const char * RingNum[]=", Ring, Shift, "Out_2.txt",'5',2);
			  ZoneMap_Shift(HeightMap_New, 32, 32, "const char * HeightMap_New[] =", Ring, Shift, "Out_3.txt");
			*/

			//ZoneMap_ChangeSize(ZoneMap_New,64,64,"const char * ZoneMap_New[]=",128,128,'B',"Out_1.txt");
			//ZoneMap_ChangeSize(RingNum    ,64,64,"const char * RingNum[]="    ,128,128,'B',"Out_2.txt");
			//ZoneMap_ChangeSize(HeightMap_New    ,32,32,"const char * HeightMap_New[] ="    ,128,128,'0',"Out_3.txt");






			return ( true );
		}
コード例 #4
0
ファイル: InternalGenesis.cs プロジェクト: d3x0r/Voxelarium
		public bool LoadTemplateImages( VoxelTypeManager voxelTypeManager, ref int start_percent, ref int start_step, ref int start_steps )
		{
			this.voxelTypeManager = voxelTypeManager;
			string MiscDirectory, FileName;
			start_steps += 10;
			//Log.log( "long time loading Templates..." );
			MiscDirectory = VoxelGlobalSettings.COMPILEOPTION_DATAFILESPATH + "Misc";

			FileName = MiscDirectory + "/tmplt_1.dat";
			if( ( Template_1 = Display.LoadBitmap( 0, FileName ) ) == null ) return false;
			Canva_1.SetSize( 256, 256 );
			Canva_1.GetFromBitmap( Template_1 );
			start_percent = ( ++start_step * 100 ) / start_steps;
			//Log.log( "long time loading Templates 2..." );

			FileName = MiscDirectory + "/tmplt_2.dat";
			if( ( Template_2 = Display.LoadBitmap( 0, FileName ) ) == null ) return false;
			Canva_2.SetSize( 256, 256 );
			Canva_2.GetFromBitmap( Template_2 );
			start_percent = ( ++start_step * 100 ) / start_steps;

			//Log.log( "long time loading Templates 3..." );
			FileName = MiscDirectory + "/tmplt_3_1.dat";
			if( ( Template_3_1 = Display.LoadBitmap( 0, FileName ) ) == null ) return false;
			Canva_3_1.SetSize( 1024, 1024 );
			Canva_3_1.GetFromBitmap( Template_3_1 );

			//Log.log( "long time loading Templates 4..." );
			start_percent = ( ++start_step * 100 ) / start_steps;
			FileName = MiscDirectory + "/tmplt_3_2.dat";
			if( ( Template_3_2 = Display.LoadBitmap( 0, FileName ) ) == null ) return false;
			Canva_3_2.SetSize( 1024, 1024 );
			Canva_3_2.GetFromBitmap( Template_3_2, true, 1 ); // r=2 b=0 g=1
			start_percent = ( ++start_step * 100 ) / start_steps;

			//Log.log( "long time loading Templates 5..." );
			FileName = MiscDirectory + "/tmplt_3_3.dat";
			if( ( Template_3_3 = Display.LoadBitmap( 0, FileName ) ) == null ) return false;
			Canva_3_3.SetSize( 1024, 1024 );
			Canva_3_3.GetFromBitmap( Template_3_3, true, 0 );
			start_percent = ( ++start_step * 100 ) / start_steps;

			FileName = MiscDirectory + "/sect_1f.dat";
			T3dTemplate_1.SetNotStandardSize();
			T3dTemplate_1.SetVoxelTypeManager( voxelTypeManager );
			T3dTemplate_1.Load( 0, FileName );
			start_percent = ( ++start_step * 100 ) / start_steps;

			FileName = MiscDirectory + "/sect_2.dat";
			T3dTemplate_2.SetNotStandardSize();
			T3dTemplate_2.SetVoxelTypeManager( voxelTypeManager );
			T3dTemplate_2.Load( 0, FileName );
			start_percent = ( ++start_step * 100 ) / start_steps;

			FileName = MiscDirectory + "/Vegetation_1.dat";
			Template_Vegetation_1.SetNotStandardSize();
			Template_Vegetation_1.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_1.Load( 0, FileName );
			Template_Vegetation_1.Subst( 32767 + 2, 234 );
			//Template_Vegetation_1.Subst(71, 32767+21);
			start_percent = ( ++start_step * 100 ) / start_steps;

			FileName = MiscDirectory + "/Vegetation_2.dat";
			Template_Vegetation_2.SetNotStandardSize();
			Template_Vegetation_2.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_2.Load( 0, FileName );
			Template_Vegetation_2.Subst( 1, 234 );
			Template_Vegetation_2.Subst( 2, 71 );
			start_percent = ( ++start_step * 100 ) / start_steps;

			FileName = MiscDirectory + "/Vegetation_3.dat";
			Template_Vegetation_3.SetNotStandardSize();
			Template_Vegetation_3.SetVoxelTypeManager( voxelTypeManager );
			Template_Vegetation_3.Load( 0, FileName );
			Template_Vegetation_3.Subst( 1, 234 );
			Template_Vegetation_3.Subst( 2, 71 );
			start_percent = ( ++start_step * 100 ) / start_steps;


			TreeTable[0] = Template_Vegetation_1;
			TreeTable[1] = Template_Vegetation_2;
			TreeTable[2] = Template_Vegetation_3;

			return ( true );
		}
コード例 #5
0
ファイル: InventoryBox.cs プロジェクト: d3x0r/Voxelarium
		//internal virtual ushort GetVoxelType() { return ( activeEntry.VoxelType ); }
		//internal virtual int GetQuantity() { return ( activeEntry.Quantity ); }
		internal virtual void SetVoxelTypeManager( VoxelTypeManager VoxelTypeManager ) { this.VoxelTypeManager = VoxelTypeManager; }
コード例 #6
0
ファイル: VoxelSector.cs プロジェクト: d3x0r/Voxelarium
		public VoxelSector( VoxelSector Sector )
		{
			uint DataSize;
			DataSize = Sector.DataSize;
			Data = new VoxelData( ZVOXELBLOCKCOUNT );

			for( int i = 0; i < DataSize; i++ )
			{
				Data.Data[i] = Sector.Data.Data[i];
			}

			VoxelTypeManager = null;
			Next = Pred = GlobalList_Next = GlobalList_Pred = null;
			Handle_x = Sector.Handle_x;
			Handle_y = Sector.Handle_y;
			Handle_z = Sector.Handle_z;
			Pos_x = Sector.Pos_x;
			Pos_y = Sector.Pos_y;
			Pos_z = Sector.Pos_z;
			Size_x = Sector.Size_x;
			Size_y = Sector.Size_y;
			Size_z = Sector.Size_z;

			Flag_Void_Regular = Sector.Flag_Void_Regular;
			Flag_Void_Transparent = Sector.Flag_Void_Transparent;
			Flag_Render_Dirty = Sector.Flag_Render_Dirty;

			Flag_HighPriorityRefresh = Sector.Flag_HighPriorityRefresh;
			Flag_IsVisibleAtLastRendering = Sector.Flag_IsVisibleAtLastRendering;
			Flag_DeletePending = Sector.Flag_DeletePending;
			Flag_NeedFullCulling = Sector.Flag_NeedFullCulling;
			Flag_KeepInMemory = Sector.Flag_KeepInMemory;
			Flag_IsModified = Sector.Flag_IsModified;
			Flag_IsSlowGeneration = Sector.Flag_IsSlowGeneration;
			Flag_IsActiveVoxels = Sector.Flag_IsActiveVoxels;
			Flag_IsActiveLowRefresh = Sector.Flag_IsActiveLowRefresh;
			Flag_NotStandardSize = Sector.Flag_NotStandardSize;
			Flag_NeedSortedRendering = Sector.Flag_NeedSortedRendering;
			PartialCulling = Sector.PartialCulling;

			RefreshWaitCount = Sector.RefreshWaitCount;
			LowRefresh_Mask = Sector.LowRefresh_Mask;
		}
コード例 #7
0
ファイル: VoxelSector.cs プロジェクト: d3x0r/Voxelarium
		void DefaultInit()
		{

			if( RelativeVoxelOffsets_Unwrapped[1] == 0 )
			{
				// these should have been done in-line... but forgot; and it became long serial code 
				{
					int n, f;
					for( n = 0; n < 6; n++ )
						for( f = 0; f < 9; f++ )
							RelativeVoxelOffset_Fixups[(int)VoxelFaceGroups[n, f]] |= (FACEDRAW_Operations)( 1 << n );
				}

				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT] = OffsetDelta( -1, 0, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT] = OffsetDelta( 1, 0, 0 );

				// x not on bound, y not on bound.
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.ABOVE] = OffsetDelta( 0, 1, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BELOW] = OffsetDelta( 0, -1, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_ABOVE] = OffsetDelta( -1, 1, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_BELOW] = OffsetDelta( -1, -1, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE] = OffsetDelta( 1, 1, 0 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_BELOW] = OffsetDelta( 1, -1, 0 );

				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.AHEAD] = OffsetDelta( 0, 0, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BEHIND] = OffsetDelta( 0, 0, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.AHEAD_LEFT] = OffsetDelta( -1, 0, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.AHEAD_RIGHT] = OffsetDelta( 1, 0, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BEHIND_LEFT] = OffsetDelta( -1, 0, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BEHIND_RIGHT] = OffsetDelta( 1, 0, -1 );

				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.ABOVE_AHEAD] = OffsetDelta( 0, 1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.ABOVE_BEHIND] = OffsetDelta( 0, 1, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BELOW_AHEAD] = OffsetDelta( 0, -1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.BELOW_BEHIND] = OffsetDelta( 0, -1, -1 );

				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_ABOVE_AHEAD] = OffsetDelta( -1, 1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_BELOW_AHEAD] = OffsetDelta( -1, -1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE_AHEAD] = OffsetDelta( 1, 1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_BELOW_AHEAD] = OffsetDelta( 1, -1, 1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_ABOVE_BEHIND] = OffsetDelta( -1, 1, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.LEFT_BELOW_BEHIND] = OffsetDelta( -1, -1, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE_BEHIND] = OffsetDelta( 1, 1, -1 );
				RelativeVoxelOffsets_Unwrapped[(int)RelativeVoxelOrds.RIGHT_BELOW_BEHIND] = OffsetDelta( 1, -1, -1 );

				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT] = OffsetDeltaWrapped( -1, 0, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT] = OffsetDeltaWrapped( 1, 0, 0 );
				// x not on bound, y not on bound.
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.ABOVE] = OffsetDeltaWrapped( 0, 1, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BELOW] = OffsetDeltaWrapped( 0, -1, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_ABOVE] = OffsetDeltaWrapped( -1, 1, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_BELOW] = OffsetDeltaWrapped( -1, -1, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE] = OffsetDeltaWrapped( 1, 1, 0 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_BELOW] = OffsetDeltaWrapped( 1, -1, 0 );

				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.AHEAD] = OffsetDeltaWrapped( 0, 0, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BEHIND] = OffsetDeltaWrapped( 0, 0, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.AHEAD_LEFT] = OffsetDeltaWrapped( -1, 0, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.AHEAD_RIGHT] = OffsetDeltaWrapped( 1, 0, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BEHIND_LEFT] = OffsetDeltaWrapped( -1, 0, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BEHIND_RIGHT] = OffsetDeltaWrapped( 1, 0, -1 );

				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.ABOVE_AHEAD] = OffsetDeltaWrapped( 0, 1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.ABOVE_BEHIND] = OffsetDeltaWrapped( 0, 1, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BELOW_AHEAD] = OffsetDeltaWrapped( 0, -1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.BELOW_BEHIND] = OffsetDeltaWrapped( 0, -1, -1 );

				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_ABOVE_AHEAD] = OffsetDeltaWrapped( -1, 1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_BELOW_AHEAD] = OffsetDeltaWrapped( -1, -1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE_AHEAD] = OffsetDeltaWrapped( 1, 1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_BELOW_AHEAD] = OffsetDeltaWrapped( 1, -1, 1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_ABOVE_BEHIND] = OffsetDeltaWrapped( -1, 1, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.LEFT_BELOW_BEHIND] = OffsetDeltaWrapped( -1, -1, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_ABOVE_BEHIND] = OffsetDeltaWrapped( 1, -1, -1 );
				RelativeVoxelOffsets_Wrapped[(int)RelativeVoxelOrds.RIGHT_BELOW_BEHIND] = OffsetDeltaWrapped( 1, -1, -1 );


			}
			VoxelTypeManager = null;
			Size_x = ZVOXELBLOCSIZE_X;
			Size_y = ZVOXELBLOCSIZE_Y;
			Size_z = ZVOXELBLOCSIZE_Z;
			Handle_x = Handle_y = Handle_z = 0;

			DataSize = (uint)( Size_x * Size_y * Size_z );
			//DisplayData = null;
			//Data        = new VoxelData();
			//FaceCulling = new int [DataSize];
			//OtherInfos  = new uint[DataSize];
			//TempInfos   = new ushort[DataSize];

			Next = null;
			Pred = null;
			GlobalList_Next = null;
			GlobalList_Pred = null;

			InitSector();

			SectorsInMemory++;
		}
コード例 #8
0
ファイル: VoxelSector.cs プロジェクト: d3x0r/Voxelarium
		public void SetVoxelTypeManager( VoxelTypeManager VoxelTypeManager ) { this.VoxelTypeManager = VoxelTypeManager; }
コード例 #9
0
ファイル: VoxelWorld.cs プロジェクト: d3x0r/Voxelarium
		internal void SetVoxelTypeManager( VoxelTypeManager Manager, ref int percent, ref int step, ref int steps )
		{
			VoxelTypeManager = Manager;
			if( !nogui )
				Manager.LoadTexturesToAtlas( TextureAtlas, ref percent, ref step, ref steps );
		}
コード例 #10
0
ファイル: VoxelWorld.cs プロジェクト: d3x0r/Voxelarium
		public VoxelWorld( bool nogui, VoxelGameEnvironment GameEnv )
		{
			uint i;
			this.nogui = nogui;
			this.GameEnv = GameEnv;
			Display.OnInvalidate += Display_OnInvalidate;
			SectorEjectList = new SectorRingList( 256 * 256 * 32/*65536*/);
			if( !nogui )
				TextureAtlas = new TextureAtlas( 32, 64 );

			SectorTable = new VoxelSector[TableSize];

			for( i = 0; i < TableSize; i++ ) SectorTable[i] = null;

			SectorList = null;
			UniverseNum = 1;
			VoxelTypeManager = null;
		}