良心资源,自己耗费一周。。。去看了文章再决定是否下载https://blog.csdn.net/qq_33228039/article/details/107695278
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-07-29 20:47 .vs
目录 0 2020-07-29 20:47 .vsWindowsFormsApp3
目录 0 2020-07-29 20:47 .vsWindowsFormsApp3v16
文件 63488 2020-07-30 18:00 .vsWindowsFormsApp3v16.suo
目录 0 2020-07-29 21:15 packages
目录 0 2020-07-29 21:15 packagesOpenTK.3.2
文件 9474 2020-04-06 06:32 packagesOpenTK.3.2.signature.p7s
目录 0 2020-07-29 21:15 packagesOpenTK.3.2content
文件 1813 2020-04-06 09:02 packagesOpenTK.3.2contentOpenTK.dll.config
目录 0 2020-07-29 21:15 packagesOpenTK.3.2lib
目录 0 2020-07-29 21:15 packagesOpenTK.3.2lib
et20
文件 5747712 2020-04-06 09:19 packagesOpenTK.3.2lib
et20OpenTK.dll
文件 9252352 2020-04-06 09:19 packagesOpenTK.3.2lib
et20OpenTK.pdb
文件 30079257 2020-04-06 09:16 packagesOpenTK.3.2lib
et20OpenTK.xml
文件 4417518 2020-07-29 21:15 packagesOpenTK.3.2OpenTK.3.2.nupkg
文件 1154 2020-07-29 20:47 WindowsFormsApp3.sln
目录 0 2020-07-30 18:00 WindowsFormsApp3
文件 189 2020-07-29 20:47 WindowsFormsApp3App.config
目录 0 2020-07-29 20:47 WindowsFormsApp3in
目录 0 2020-07-30 10:10 WindowsFormsApp3inDebug
文件 5747712 2020-04-06 09:19 WindowsFormsApp3inDebugOpenTK.dll
文件 49152 2014-07-24 07:15 WindowsFormsApp3inDebugOpenTK.GLControl.dll
文件 9252352 2020-04-06 09:19 WindowsFormsApp3inDebugOpenTK.pdb
文件 30079257 2020-04-06 09:16 WindowsFormsApp3inDebugOpenTK.xml
文件 12288 2020-07-30 17:24 WindowsFormsApp3inDebugWindowsFormsApp3.exe
文件 521 2020-07-30 10:10 WindowsFormsApp3inDebugWindowsFormsApp3.exe.config
文件 36352 2020-07-30 17:24 WindowsFormsApp3inDebugWindowsFormsApp3.pdb
文件 7466 2020-07-30 18:00 WindowsFormsApp3Form1.cs
文件 3131 2020-07-30 17:13 WindowsFormsApp3Form1.Designer.cs
文件 5817 2020-07-30 11:10 WindowsFormsApp3Form1.resx
目录 0 2020-07-29 20:47 WindowsFormsApp3obj
............此处省略25个文件信息
using System;
using System.IO;
using System.Collections.Generic;
using System.Windows.Forms;
using OpenTK;
using OpenTK.Graphics.OpenGL;
using System.Drawing;
using System.Reflection;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
//xyz坐标
struct Point3D
{
public float x;
public float y;
public float z;
};
//rgb颜色数据
struct rgb
{
public float r;
public float g;
public float b;
};
const float PI = 3.141592543f;
//存储坐标点的集合
List ls_pts=new List();
//存储颜色集合
List ls_cols=new List();
float fWidth fHeight;
//视点z坐标
float eyeZ;
//物体中心点
float centerX centerY centerZ;
//物体长度和宽度
float halfWidth halfHeight;
//平移的距离
float translateX translateY;
//旋转的角度
float rotX rotY;
//鼠标按下的位置
float downPtX downPtY;
BeginMode terrainRenderstyle = BeginMode.Points;
float tempEyeZ;
int arb;
int pt3DNum;
private void glControl1_Load(object sender EventArgs e)
{
GL.ClearColor(Color.SteelBlue); // Set color
string filepath = “F:\OpenTK\OpenTK_test\OpenTK Test\OpenTK Test\obj\Debug\view1445922.ply“;
LoadHeightMap(filepath);
}
//刷新加载
private void glControl1_Paint(object sender PaintEventArgs e)
{
GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
Matrix4 lookat = Matrix4.LookAt(0 0 6 * eyeZ 0 0 0 0 1 0);
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadMatrix(ref lookat);
GL.Translate(translateX translateY 0); //键盘平移
GL.Rotate(rotX 1 0 0);//x轴旋转
GL.Rotate(rotY 0 1 0);//y轴旋转
// GL.Scale(scal1 scal1 scal1);
GL.Translate(-centerX -centerY -centerZ);
// Render heightmap
this.RenderHeightmap();
glControl1.SwapBuffers();
}
//控件改变后刷新
private void glControl1_Resize(object sender EventArgs e)
{
fWidth = (float)Width;
fHeight = (float)Height;
GL.Viewport(0 0 Width Height);
float aspect_ratio = Width / (float)Height;
Matrix4 perpective = Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver4 aspect_ratio 1f 50000f);
GL.MatrixMode(MatrixMode.Projection);
GL.LoadMatrix(ref perpective);
return;
}
private void LoadHeightMap(string filepath)
{
float minX = 0.0f maxX = 0.0f minY = 0.0f maxY = 0.0f minZ = 0.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2020-07-29 20:47 .vs
目录 0 2020-07-29 20:47 .vsWindowsFormsApp3
目录 0 2020-07-29 20:47 .vsWindowsFormsApp3v16
文件 63488 2020-07-30 18:00 .vsWindowsFormsApp3v16.suo
目录 0 2020-07-29 21:15 packages
目录 0 2020-07-29 21:15 packagesOpenTK.3.2
文件 9474 2020-04-06 06:32 packagesOpenTK.3.2.signature.p7s
目录 0 2020-07-29 21:15 packagesOpenTK.3.2content
文件 1813 2020-04-06 09:02 packagesOpenTK.3.2contentOpenTK.dll.config
目录 0 2020-07-29 21:15 packagesOpenTK.3.2lib
目录 0 2020-07-29 21:15 packagesOpenTK.3.2lib
et20
文件 5747712 2020-04-06 09:19 packagesOpenTK.3.2lib
et20OpenTK.dll
文件 9252352 2020-04-06 09:19 packagesOpenTK.3.2lib
et20OpenTK.pdb
文件 30079257 2020-04-06 09:16 packagesOpenTK.3.2lib
et20OpenTK.xm
文件 4417518 2020-07-29 21:15 packagesOpenTK.3.2OpenTK.3.2.nupkg
文件 1154 2020-07-29 20:47 WindowsFormsApp3.sln
目录 0 2020-07-30 18:00 WindowsFormsApp3
文件 189 2020-07-29 20:47 WindowsFormsApp3App.config
目录 0 2020-07-29 20:47 WindowsFormsApp3in
目录 0 2020-07-30 10:10 WindowsFormsApp3inDebug
文件 5747712 2020-04-06 09:19 WindowsFormsApp3inDebugOpenTK.dll
文件 49152 2014-07-24 07:15 WindowsFormsApp3inDebugOpenTK.GLControl.dll
文件 9252352 2020-04-06 09:19 WindowsFormsApp3inDebugOpenTK.pdb
文件 30079257 2020-04-06 09:16 WindowsFormsApp3inDebugOpenTK.xm
文件 12288 2020-07-30 17:24 WindowsFormsApp3inDebugWindowsFormsApp3.exe
文件 521 2020-07-30 10:10 WindowsFormsApp3inDebugWindowsFormsApp3.exe.config
文件 36352 2020-07-30 17:24 WindowsFormsApp3inDebugWindowsFormsApp3.pdb
文件 7466 2020-07-30 18:00 WindowsFormsApp3Form1.cs
文件 3131 2020-07-30 17:13 WindowsFormsApp3Form1.Designer.cs
文件 5817 2020-07-30 11:10 WindowsFormsApp3Form1.resx
目录 0 2020-07-29 20:47 WindowsFormsApp3obj
............此处省略25个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)