예제 #1
0
파일: TestCube.cs 프로젝트: Genae/VoxelECS
        private void Init()
        {
            _oldSlice   = Slice;
            _collection = new MaterialCollection();
            var go = new GameObject("map");

            _cloud = new ChunkCloud(_collection, go.transform);
            _cloud.StartBatch();
            for (var x = -300; x < 300; x++)
            {
                for (var y = 0; y < 3; y++)
                {
                    for (var z = -300; z < 300; z++)
                    {
                        _cloud.SetVoxel(TransparentMaterial, new Vector3Int(x, y, z));
                    }
                }
            }
            for (var x = -1; x < 1; x++)
            {
                for (var y = -1; y < 1; y++)
                {
                    for (var z = -1; z < 1; z++)
                    {
                        _cloud.SetVoxel(OpaqueMaterial, new Vector3Int(x, y, z));
                    }
                }
            }
            _cloud.FinishBatch();
        }
예제 #2
0
파일: World.cs 프로젝트: Genae/VoxelEngine
        public World(MaterialCollection materialCollection)
        {
            _materialCollection = materialCollection;
            var go = new GameObject("map");

            SolidChunks        = new ChunkCloud(materialCollection, go.transform);
            FluidChunks        = new FluidChunkCloud(materialCollection, go.transform);
            FluidUpdater       = go.AddComponent <FluidUpdaterCloud>();
            FluidUpdater.World = this;
        }
예제 #3
0
        public void TestRenderIsInvisibleInside()
        {
            var collection = new MaterialCollection();
            var go         = new GameObject("map");
            var cloud      = new ChunkCloud(collection, go.transform);

            var start = new Vector3Int(-1, -1, -1);
            var end   = new Vector3Int(1, 1, 1);

            for (var x = start.x; x < end.x; x++)
            {
                for (var y = start.y; y < end.y; y++)
                {
                    for (var z = start.z; z < end.z; z++)
                    {
                        cloud.SetVoxel("glass", new Vector3Int(x, y, z));
                    }
                }
            }
            CheckBlockEmpty(start, end);
        }
예제 #4
0
        public void TestRenderIsVisibleFromAllSides()
        {
            var collection = new MaterialCollection();
            var go         = new GameObject("map");
            var cloud      = new ChunkCloud(collection, go.transform);

            cloud.StartBatch();
            var start = new Vector3Int(-30, -30, -30);
            var end   = new Vector3Int(30, 30, 30);

            for (var x = start.x; x < end.x; x++)
            {
                for (var y = start.y; y < end.y; y++)
                {
                    for (var z = start.z; z < end.z; z++)
                    {
                        cloud.SetVoxel("glass", new Vector3Int(x, y, z));
                    }
                }
            }
            cloud.FinishBatch();
            CheckBlockRendered(start, end);
        }