Ejemplo n.º 1
0
        public EditorLayer(SceneLayer layer)
        {
            this.Layer = layer;

            TileChunksTextures = new Texture[DivideRoundUp(this.Layer.Height, TILES_CHUNK_SIZE)][];
            for (int i = 0; i < TileChunksTextures.Length; ++i)
            {
                TileChunksTextures[i] = new Texture[DivideRoundUp(this.Layer.Width, TILES_CHUNK_SIZE)];
            }

            SelectedTiles      = new PointsMap(this.Layer.Width, this.Layer.Height);
            TempSelectionTiles = new PointsMap(this.Layer.Width, this.Layer.Height);
        }
        public EditorLayer(SceneLayer layer)
        {
            this.Layer = layer;

            chunks = new ChunkVBO[DivideRoundUp(this.Layer.Height, TILES_CHUNK_SIZE)][];
            for (int i = 0; i < chunks.Length; ++i)
            {
                chunks[i] = new ChunkVBO[DivideRoundUp(this.Layer.Width, TILES_CHUNK_SIZE)];
                for (int j = 0; j < chunks[i].Length; ++j)
                {
                    // We can use the same buffers because we fill each chunk at a time
                    chunks[i][j]           = new ChunkVBO();
                    chunks[i][j].Vertices  = new Vertices(verticesBuffer);
                    chunks[i][j].TexCoords = new TexCoords(textCoordsBuffer, TILE_SIZE, TILE_SIZE * 0x400);
                }
            }

            selectedChunks = new ChunkVBO[DivideRoundUp(this.Layer.Height, TILES_CHUNK_SIZE)][];
            for (int i = 0; i < selectedChunks.Length; ++i)
            {
                selectedChunks[i] = new ChunkVBO[DivideRoundUp(this.Layer.Width, TILES_CHUNK_SIZE)];
                for (int j = 0; j < selectedChunks[i].Length; ++j)
                {
                    selectedChunks[i][j]               = new ChunkVBO();
                    selectedChunks[i][j].Vertices      = new Vertices(verticesBuffer);
                    selectedChunks[i][j].TexCoords     = new TexCoords(textCoordsBuffer, TILE_SIZE, TILE_SIZE * 0x400);
                    selectedChunks[i][j].SelectIndices = new Indices(indicesBuffer);
                }
            }

            selectedOOB               = new ChunkVBO();
            selectedOOB.TexCoords     = new TexCoords(null, TILE_SIZE, TILE_SIZE * 0x400);
            selectedOOB.Vertices      = new Vertices(null);
            selectedOOB.SelectIndices = new Indices(null);

            SelectedTiles      = new PointsMap(this.Layer.Width, this.Layer.Height);
            TempSelectionTiles = new PointsMap(this.Layer.Width, this.Layer.Height);
        }