コード例 #1
0
    public VoxelChunk NewChunk(Transform ChunkContainer, Vector3 vPos, int iSize = 27)
    {
        GameObject ChunkObject = new GameObject(vPos.ToString(), typeof(MeshRenderer), typeof(MeshFilter), typeof(MeshCollider), typeof(VoxelChunk));

        ChunkObject.transform.parent = ChunkContainer;
        ChunkObject.GetComponent <MeshRenderer>().material = _DefaultMaterial;
        ChunkObject.transform.localScale    = ChunkContainer.localScale;
        ChunkObject.transform.localPosition = vPos;
        ChunkObject.transform.rotation      = ChunkContainer.rotation;

        VoxelChunk Chunk = ChunkObject.GetComponent <VoxelChunk>();

        Chunk._SizeZ = iSize;
        Chunk.Init();
        //RenderTexture[,,] Neighbours = GetNeighbours(Chunk);
        //CreateEmptyVolume(Chunk.DensityVolume, Neighbours, iSize);
        //CreateEmptyVolume(Chunk.DensityVolume,32);
        return(Chunk);
    }