Esempio n. 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;
		}
Esempio n. 2
0
		void AddVoxelType( int TypeNum, VoxelType VoxelType )
		{
			VoxelTable[TypeNum] = VoxelType;
			VoxelType.VoxelTypeManager = this;
			//ActiveTable.Set( TypeNum, VoxelType.properties.Is_Active );
		}
Esempio n. 3
0
		internal bool LoadVoxelTypes( bool nogui )
		{
			Log.log( "Here we start to do magic to get voxel types..." );
			ushort i;
			VoxelType VoxelType;

			i = 0;
			VoxelType = new VoxelType_Void();
			VoxelType.SetProperties( new VoxelProperties( 0 ) );
			AddVoxelType( i++, VoxelType );

			for( ; i < 300; i++ )
			{
				VoxelProperties props = VoxelProperties.Load( i );
				if( Compiler.LoadVoxelCode( props, props.Type ) )
				{
					VoxelType = Compiler.LoadExtendedVoxelType( props, props.Type );
					VoxelType.ExtensionType = Compiler.LoadExtendedVoxelExtension( props.Type );
					if( VoxelType.ExtensionType != null )
						props.Is_HasAllocatedMemoryExtension = true;
				}
				else
					VoxelType = null;
				if( VoxelType == null )
					VoxelType = new VoxelType();

				VoxelType.SetProperties( props );

				VoxelType.SetGameEnv( GameEnv );
				VoxelType.SetManager( this );
				bool success = false;
				if( ( ( VoxelType.properties.DrawInfo & (byte)VoxelGlobalSettings.ZVOXEL_DRAWINFO_SHADER ) != 0 ) )
				{
					if( ( ( VoxelType.properties.DrawInfo & (byte)VoxelGlobalSettings.ZVOXEL_DRAWINFO_DECAL ) != 0 ) )
						success = VoxelType.LoadTexture();
					else
						success = true;
				}
				else if( !nogui )
				{
					success = VoxelType.LoadTexture();
					if( !success )
						Log.log( "Fatal error : Missing texture for " + i );
				}
				if( success )
				{
					AddVoxelType( i, VoxelType );
					LoadedTexturesCount++;
				}
			}
			return true;
		}