Пример #1
0
        // pass a pointer to a heightmap
        // when rendered, x pos will be multiplied by xscale, and y points by yscale
        public RenderableHeightMap(TerrainView terrainview, TerrainModel terrainmodel, int xscale, int yscale )
        {
            this.terrainmodel = terrainmodel;
            this.terrainview = terrainview;

            this.heightmap = terrainmodel.Map;
            width = heightmap.GetLength(0) - 1;
            height = heightmap.GetLength(1) - 1;
            this.xscale = xscale;
            this.yscale = yscale;

            //maptexturestageviews = terrainview.maptexturestageviews;
            maptexturestagemodels = terrainmodel.texturestages;
            //    foreach (MapTextureStageView maptexturestageview in maptexturestageviews)
              //  {
            //    viewbymodel.Add( maptexturestageview.maptexturestagemodel, maptexturestageview );
            //}

            CacheChunkTextureStageUsage();
            normalsperquad = new Vector3[width, height];
            terrain_HeightmapInPlaceEdited(0, 0, width - 1, height - 1);
            RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(Render);
            terrainmodel.HeightmapInPlaceEdited += new TerrainModel.HeightmapInPlaceEditedHandler(terrain_HeightmapInPlaceEdited);
            terrainmodel.TerrainModified += new TerrainModel.TerrainModifiedHandler(terrain_TerrainModified);
            terrainmodel.BlendmapInPlaceEdited += new TerrainModel.BlendmapInPlaceEditedHandler(terrain_BlendmapInPlaceEdited);
        }
Пример #2
0
        // pass a pointer to a heightmap
        // when rendered, x pos will be multiplied by xscale, and y points by yscale
        public RenderableHeightMap(TerrainView terrainview, TerrainModel terrainmodel, int xscale, int yscale)
        {
            this.terrainmodel = terrainmodel;
            this.terrainview  = terrainview;

            this.heightmap = terrainmodel.Map;
            width          = heightmap.GetLength(0) - 1;
            height         = heightmap.GetLength(1) - 1;
            this.xscale    = xscale;
            this.yscale    = yscale;

            //maptexturestageviews = terrainview.maptexturestageviews;
            maptexturestagemodels = terrainmodel.texturestages;
            //    foreach (MapTextureStageView maptexturestageview in maptexturestageviews)
            //  {
            //    viewbymodel.Add( maptexturestageview.maptexturestagemodel, maptexturestageview );
            //}

            CacheChunkTextureStageUsage();
            normalsperquad = new Vector3[width, height];
            terrain_HeightmapInPlaceEdited(0, 0, width - 1, height - 1);
            RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(Render);
            terrainmodel.HeightmapInPlaceEdited += new TerrainModel.HeightmapInPlaceEditedHandler(terrain_HeightmapInPlaceEdited);
            terrainmodel.TerrainModified        += new TerrainModel.TerrainModifiedHandler(terrain_TerrainModified);
            terrainmodel.BlendmapInPlaceEdited  += new TerrainModel.BlendmapInPlaceEditedHandler(terrain_BlendmapInPlaceEdited);
        }
Пример #3
0
 public WorldView(WorldModel worldmodel)
 {
     LogFile.WriteLine("WorldView(" + worldmodel + ")");
     this.worldmodel = worldmodel;
     graphics        = GraphicsHelperFactory.GetInstance();
     terrainview     = new TerrainView(worldmodel.terrainmodel);
     RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(WorldView_WriteNextFrameEvent);
 }
Пример #4
0
 public WorldView( WorldModel worldmodel )
 {
     LogFile.WriteLine( "WorldView(" + worldmodel + ")" );
     this.worldmodel = worldmodel;
     graphics = GraphicsHelperFactory.GetInstance();
     terrainview = new TerrainView( worldmodel.terrainmodel );
     RendererFactory.GetInstance().WriteNextFrameEvent += new WriteNextFrameCallback(WorldView_WriteNextFrameEvent);
 }