示例#1
0
        private void CreateTerrainBtnClick(object sender, EventArgs e)
        {
            using (var dlg = new CreateTerrainDlg(Globals.ResourceRoot.LocalPath))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    TerrainGob terrain   = TerrainGob.Create(dlg.TerrainName, dlg.HeightMapPath, dlg.CellSize);
                    var        xformable = terrain.As <ITransformable>();
                    xformable.Translation = new Vec3F(-dlg.CellSize * (dlg.HmapCols - 1) / 2.0f, 0.0f, -dlg.CellSize * (dlg.HmapRows - 1) / 2.0f);
                    xformable.UpdateTransform();

                    ApplicationUtil.Insert(GameContext,
                                           GameContext.RootGameObjectFolder,
                                           terrain,
                                           "Add Terrain",
                                           null);
                }
            }
        }
        private void CreateTerrainBtnClick(object sender, EventArgs e)
        {
            using (var dlg = new CreateTerrainDlg(Globals.ResourceRoot.LocalPath))
            {
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {                   
                    TerrainGob terrain = TerrainGob.Create(dlg.TerrainName, dlg.HeightMapPath, dlg.CellSize);
                    var xformable = terrain.As<ITransformable>();
                    xformable.Translation = new Vec3F(-dlg.CellSize * (dlg.HmapCols-1) / 2.0f, 0.0f, -dlg.CellSize * (dlg.HmapRows-1) / 2.0f);
                    xformable.UpdateTransform();

                    ApplicationUtil.Insert(GameContext,
                        GameContext.RootGameObjectFolder,
                        terrain,
                        "Add Terrain",
                        null);
                }
            }
        
        }