Example #1
0
        public Terrain()
        {
            MapWidth   = Config.GetInstance().iMapDefaultWidth - 1;
            MapHeight  = Config.GetInstance().iMapDefaultHeight - 1;
            MinHeight  = Config.GetInstance().minheight;
            MaxHeight  = Config.GetInstance().maxheight;
            Map        = new double[HeightMapWidth, HeightMapHeight];
            FeatureMap = new Unit[MapWidth, MapHeight];

            InitMap(MinHeight);
            LogFile.GetInstance().WriteLine("HeightMap() " + HeightMapWidth + " " + HeightMapHeight);

            texturestages = new List <MapTextureStage>();
            texturestages.Add(new MapTextureStage());

            //texturestages = Sm3Persistence.GetInstance().LoadTextureStages(TdfParser.FromFile("maps/Whakamatunga_Riri.sm3").RootSection.SubSection("map/terrain"));
            //Sm3Persistence.GetInstance().LoadHeightMap(TdfParser.FromFile("maps/Whakamatunga_Riri.sm3").RootSection.SubSection("map/terrain"));

            renderableheightmap   = new RenderableHeightMap(this, Map, SquareSize, SquareSize, texturestages);
            renderableallfeatures = new RenderableAllFeatures(this);
            // water must be last, otherwise you cant see through it ;-)
            renderablewater = new RenderableWater(new Vector3(), new Vector2(HeightMapWidth * SquareSize, HeightMapHeight * SquareSize));
            // minimap last, covers everything else
            renderableminimap = new RenderableMinimap(this, renderableheightmap);

            //OnTerrainModified();
        }
Example #2
0
        public RenderableMinimap(Terrain parent, RenderableHeightMap renderableheightmap)  // note could upgrade this to use Isomething later, but Terrain works for now
        {
            this.parent = parent;
            this.renderableheightmap = renderableheightmap;

            Gl.glGenTextures(1, out minimaptexture);

            RendererSdl.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(RenderableMinimap_WriteNextFrameEvent);
        }