예제 #1
0
        /// <summary>
        /// Clear all stored data for this drawTerrain, getting rid of all textures and other loaded things.
        /// </summary>
        public void Clear()
        {
            textureManager?.Dispose();
            loadedTerrainTiles.Clear();
            terrainTiles.Clear();

            textureManager = new TerrainTextureManager(terrtexPath, device, messageDelegate);
            SetTerrainReduction();
            DiscardVertexBuffers();
        }
예제 #2
0
        /// <summary>
        /// Constructor. This will pre-calculate all needed vertices
        /// </summary>
        /// <param name="tile">The tile (parsed .t-file)</param>
        /// <param name="textureManager">The manager for the textures</param>
        /// <param name="locationTranslator">The translator for mapping 3D tile-based coordinates to quasi-2D locations</param>
        public TerrainTile2D(Tile tile, TerrainTextureManager textureManager, Translate3Dto2D locationTranslator)
        {
            this.textureManager     = textureManager;
            this.locationTranslator = locationTranslator;
            this.TileSize           = tile.Size;

            this.snappedTileX = tile.TileX;
            this.snappedTileZ = tile.TileZ;
            TileName.Snap(ref snappedTileX, ref snappedTileZ, zoomFromInt[this.TileSize]);

            verticesFull = CreateVerticesFromTile(tile);
        }
예제 #3
0
        /// <summary>
        /// Clear all stored data for this drawTerrain, getting rid of all textures and other loaded things.
        /// </summary>
        public void Clear()
        {
            vertexDeclaration?.Dispose();
            textureManager?.Dispose();
            loadedTerrainTiles.Clear();
            terrainTiles.Clear();

            vertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);
            textureManager    = new TerrainTextureManager(terrtexPath, device, messageDelegate);
            SetTerrainReduction();
            DiscardVertexBuffers();
        }
예제 #4
0
        /// <summary>
        /// Load some basic content (regular XNA method), mainly just initialization.
        /// This does not load tiles nor textures (because those are only loaded on demand, depending on visual area).
        /// </summary>
        /// <param name="graphicsDevice">The graphsics device used for XNA drawing, and also texture importing</param>
        public void LoadContent(GraphicsDevice graphicsDevice)
        {
            this.device = graphicsDevice;
            basicEffect = new BasicEffect(this.device, null)
            {
                TextureEnabled = true,
                World          = Matrix.Identity
            };
            this.vertexDeclaration = new VertexDeclaration(device, VertexPositionTexture.VertexElements);

            textureManager = new TerrainTextureManager(this.terrtexPath, this.device, this.messageDelegate);

            DiscardVertexBuffers();
        }