Assets/Scripts/MarchingCubesJob.cs
/// <summary>
/// Gets the densities for the voxel at a position
/// </summary>
/// <param name="localPosition">Voxel's local position</param>
/// <returns>The densities of that voxel</returns>
Gets the densities for the voxel at a position
Gets the densities for the voxel at a position
[MethodImpl(MethodImplOptions.AggressiveInlining)]
        private VoxelCorners<float> GetDensities(int3 localPosition)
        {
            VoxelCorners<float> densities = new VoxelCorners<float>();
            for (int i = 0; i < 8; i++)
            {
                int3 voxelCorner = localPosition + LookupTables.CubeCorners[i];
                int densityIndex = voxelCorner.x * (chunkSize + 1) * (chunkSize + 1) + voxelCorner.y * (chunkSize + 1) + voxelCorner.z;
                densities[i] = this.densities[densityIndex];
            }
            return densities;
        }
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ] private VoxelCorners < float > GetDensities ( int3 localPosition ) { VoxelCorners < float > densities = new VoxelCorners < float > ( ) ; for ( int i = 0 ; i < 8 ; i ++ ) { int3 voxelCorner = localPosition + LookupTables . CubeCorners [ i ] ; int densityIndex = voxelCorner . x * ( chunkSize + 1 ) * ( chunkSize + 1 ) + voxelCorner . y * ( chunkSize + 1 ) + voxelCorner . z ; densities [ i ] = this . densities [ densityIndex ] ; } return densities ; }
Gets the densities for the voxel at a position
Gets the densities for the voxel at a position
The densities of that voxel
The densities of that voxel
localPosition
int3
Voxel's local position
Voxel ' s local position