资源简介
运用C#、opengl做的三维纹理映射,比较有参考价值,希望对大家有帮助
代码片段和文件信息
// 3D visualisation tool demonstrates use of Managed DirectX 9.0c and C#.
// Copyright (C) 2005 Igor Stjepanovic
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not write to the Free Software
// Foundation Inc. 59 Temple Place - Suite 330 Boston MA 02111-1307 USA.
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX.DirectInput;
namespace Brisbane
{
public class WinForm : System.Windows.Forms.Form
{
private int GRID_WIDTH = 79; // grid width
private int GRID_HEIGHT = 88; // grid height
private Microsoft.DirectX.Direct3D.Device device = null; // device object
private Microsoft.DirectX.DirectInput.Device keyb = null; // keyboard
private float angleZ = 0f; // POV Z
private float angleX = 0f; // POV X
private float[] heightData; // array storing our height data
private int[] indices; // indices array
private IndexBuffer ib = null;
private VertexBuffer vb = null;
private Texture tex = null;
//Points (Vertices)
public struct dVertex
{
public float x;
public float y;
public float z;
}
//Created Triangles vv# are the vertex pointers
public struct dTriangle
{
public long vv0;
public long vv1;
public long vv2;
}
private System.ComponentModel.Container components = null;
public WinForm()
{
InitialiseComponent();
this.Setstyle(Controlstyles.AllPaintingInWmPaint | Controlstyles.Opaque true);
}
///
/// Initialise Device Vertex Buffer Index Buffer and load Texture
///
public void InitialiseDevice()
{
// define parameters for our Device object
PresentParameters presentParams = new PresentParameters();
presentParams.Windowed = true;
presentParams.SwapEffect = SwapEffect.Discard;
presentParams.EnableAutoDepthStencil = true;
presentParams.AutoDepthStencilFormat = DepthFormat.D16;
// declare the Device object
device = new Microsoft
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 961 2005-09-19 11:05 3d_terrain_visualisation.sln
文件 15635 2005-09-19 11:06 3d_terrain_visualisation\3d_terrain_visualisation.cs
文件 4937 2005-09-19 12:32 3d_terrain_visualisation\3d_terrain_visualisation.csproj
文件 621 2005-09-19 12:32 3d_terrain_visualisation\3d_terrain_visualisation.csproj.user
文件 75330 2005-03-30 09:17 3d_terrain_visualisation\bin\Release\1946.jpg
文件 89475 2005-03-30 09:07 3d_terrain_visualisation\bin\Release\2001.jpg
文件 24576 2005-09-19 12:32 3d_terrain_visualisation\bin\Release\3d_terrain_visualisation.exe
文件 5632 2005-04-09 03:13 3d_terrain_visualisation\bin\Release\3d_terrain_visualisation.vshost.exe
文件 146987 2005-03-25 14:23 3d_terrain_visualisation\bin\Release\M15.txt
文件 89246 2005-03-25 19:21 3d_terrain_visualisation\bin\Release\ubd.jpg
文件 1311 2005-09-19 11:08 3d_terrain_visualisation\Properties\AssemblyInfo.cs
文件 3531 2005-09-19 11:05 3d_terrain_visualisation\Properties\Resources.Designer.cs
文件 5612 2005-09-19 11:04 3d_terrain_visualisation\Properties\Resources.resx
文件 1149 2005-09-19 11:05 3d_terrain_visualisation\Properties\Settings.Designer.cs
文件 249 2005-09-19 11:04 3d_terrain_visualisation\Properties\Settings.settings
评论
共有 条评论