Form1.cs
上传用户:lslight
上传日期:2022-01-10
资源大小:14248k
文件大小:3k
源码类别:

DirextX编程

开发平台:

C#

  1. ////////////////////////////////////////////////////////////////////////
  2. //      ■■■■     ■■■■■       ■■■■       ■       ■      //
  3. //    ■                 ■         ■               ■       ■      //
  4. //    ■                 ■         ■    ■■■     ■       ■      //
  5. //    ■                 ■         ■       ■      ■       ■      //
  6. //      ■■■■         ■           ■■■■         ■■■■       //
  7. // Copyright (c) 三峡大学水利与环境学院 肖泽云. All rights reserved.  //
  8. ////////////////////////////////////////////////////////////////////////
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Data;
  13. using System.Drawing;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace 三维控件测试程序
  17. {
  18.     public partial class Form1 : Form
  19.     {
  20.         public Form1()
  21.         {
  22.             InitializeComponent();
  23.             //指定地形图的高度图路径
  24.             xSceneControl1.heightMapPath = Application.StartupPath + "\heightMap.BMP";
  25.             //指定地形贴图
  26.             xSceneControl1.texturePath = Application.StartupPath + "\colorMap.jpg";
  27.             xSceneControl1.InitializeDirect3D();
  28.             xSceneControl1.Render();
  29.         }
  30.         private void button1_Click(object sender, EventArgs e)
  31.         {
  32.             string heightMapPath = Application.StartupPath + "\heightMap.BMP";
  33.             //指定地形贴图
  34.             string texturePath = Application.StartupPath + "\colorMap.jpg";
  35.             
  36.             xSceneControl1.BuildTerrain(heightMapPath, texturePath);
  37.             /*
  38.             xSceneControl1.heightMapPath = @"G:MusicTerrainViewer_14TerrainViewermapssthelens257.png";
  39.             xSceneControl1.texturePath = xSceneControl1.heightMapPath;
  40.             xSceneControl1.InitializeDirect3D();
  41.             xSceneControl1.Render();
  42.              */ 
  43.         }
  44.         private void lastViewButton_Click(object sender, EventArgs e)
  45.         {
  46.             xSceneControl1.LastScene();
  47.         }
  48.         private void nextSceneButton_Click(object sender, EventArgs e)
  49.         {
  50.             xSceneControl1.NextScene();
  51.         }
  52.         private void topViewButton_Click(object sender, EventArgs e)
  53.         {
  54.             xSceneControl1.TopView();
  55.         }
  56.         private void leftViewButton_Click(object sender, EventArgs e)
  57.         {
  58.             xSceneControl1.LeftView();
  59.         }
  60.         private void frontViewButton_Click(object sender, EventArgs e)
  61.         {
  62.             xSceneControl1.FrontView();
  63.         }
  64.     }
  65. }