Пример #1
0
		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;
		}
Пример #2
0
		internal void DeleteVoxelExtension( ushort VoxelType, VoxelExtension VoxelExtension )
		{
			VoxelType VoxelTypeEntry;

			VoxelTypeEntry = VoxelTable[VoxelType]; if( VoxelTypeEntry == null ) return;
			if( VoxelTypeEntry.properties.ExtensionType == 0 ) return;
			VoxelTypeEntry.DeleteVoxelExtension( VoxelExtension );
		}
Пример #3
0
		//
		public virtual void UserAction_Activate( VoxelExtension VoxelInfo, int x, int y, int z ) { }
Пример #4
0
		public virtual void DeleteVoxelExtension( VoxelExtension VoxelExtension, bool IsUnloadingPhase = false )
		{
			if( properties.Is_HasAllocatedMemoryExtension && VoxelExtension != null )
			{
				VoxelExtension.Dispose();
				//VoxelExtension = null;
			}
		}
Пример #5
0
		internal void SetVoxelExtension( VoxelExtension Extension ) { VoxelExtension_Storage = (IVoxelExtension_Storage)Extension; }
Пример #6
0
		public void SetCube_WithExtension( uint x, uint y, uint z, byte CubeValue, VoxelExtension Extension )
		{
			uint Offset;
			Offset = ( y & ZVOXELBLOCMASK_Y )
				+ ( ( x & ZVOXELBLOCMASK_X ) * ZVOXELBLOCSIZE_Y )
				+ ( ( z & ZVOXELBLOCMASK_Z ) * ( ZVOXELBLOCSIZE_Y * ZVOXELBLOCSIZE_X ) );
			Data.Data[Offset] = CubeValue;
			Data.OtherInfos[Offset] = Extension;
		}
Пример #7
0
			public VoxelData( uint initialSize ) {
				Data = new ushort[initialSize];
				OtherInfos = new VoxelExtension[initialSize];
				SleepState = new FastBit_Array_32k();
			}
Пример #8
0
		internal ushort GetVoxelExt( int x, int y, int z, out VoxelExtension OtherInfos )
		{
			VoxelSector Sector;
			uint Offset;

			Sector = FindSector( x >> VoxelSector.ZVOXELBLOCSHIFT_X, y >> VoxelSector.ZVOXELBLOCSHIFT_Y, z >> VoxelSector.ZVOXELBLOCSHIFT_Z );

			if( Sector == null )
			{
				OtherInfos = null;
				return 0;
			}

			Offset = (uint)(( y & VoxelSector.ZVOXELBLOCMASK_Y )
				   + ( ( x & VoxelSector.ZVOXELBLOCMASK_X ) << VoxelSector.ZVOXELBLOCSHIFT_Y )
				   + ( ( z & VoxelSector.ZVOXELBLOCMASK_Z ) << ( VoxelSector.ZVOXELBLOCSHIFT_Y + VoxelSector.ZVOXELBLOCSHIFT_X ) ) );

			OtherInfos = Sector.Data.OtherInfos[Offset];
			return ( Sector.Data.Data[Offset] );
		}