ImageVerifierCode 换一换
格式:DOCX , 页数:71 ,大小:57.04KB ,
资源ID:10961622      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10961622.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(三维演示系统吕雪松.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

三维演示系统吕雪松.docx

1、三维演示系统吕雪松program Surface;uses Forms, SysUtils, frmGLMDI in frmGLMDI.pas frmGL, Mesh in Mesh.pas, TextureGL in TextureGL.pas, frmMain in frmMain.pas MainForm, frmDEMCollection in frmDEMCollection.pas DEMCollectionForm, Global in Global.pas;$R *.RESbegin sSysPath := ExtractFilePath(Application.ExeName

2、); Application.Initialize; Application.CreateForm(TMainForm, MainForm); Application.Run;end.unit frmMain;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Menus, frmGLMDI, mesh, opengl, frmDEMCollection, StdCtrls;type TMainForm = class(TForm) MainMenu1

3、: TMainMenu; N5: TMenuItem; Grayface1: TMenuItem; N8: TMenuItem; N9: TMenuItem; N13: TMenuItem; N14: TMenuItem; N15: TMenuItem; OpenDialog1: TOpenDialog; SaveDialog1: TSaveDialog; N20: TMenuItem; N21: TMenuItem; N23: TMenuItem; N24: TMenuItem; procedure N24Click(Sender: TObject); procedure N26Click(

4、Sender: TObject); procedure N30Click(Sender: TObject); procedure N31Click(Sender: TObject); procedure N8Click(Sender: TObject); procedure N9Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N15Click(Sender

5、: TObject); procedure N1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private Private declarations public Public declarations GLChild : TfrmGL; end;var MainForm: TMainForm;implementation$R *.dfmprocedure TMainForm.N24Click(Sender: TObject);begin Close;end;procedure TMainForm.N26Clic

6、k(Sender: TObject);begin/ GLChild := TfrmGL.Create(Application, );end;procedure TMainForm.N30Click(Sender: TObject);begin TileMode := tbVertical; Tile;end;procedure TMainForm.N31Click(Sender: TObject);begin Cascade;end;procedure TMainForm.N8Click(Sender: TObject);begin if MDIChildCount 0 then begin

7、GLChild.MyMesh.MeshConfig.mode:= gl_triangles; InvalidateRect(GLChild.Handle, nil, False); end;end;procedure TMainForm.N9Click(Sender: TObject);begin if MDIChildCount 0 then begin GLChild.MyMesh.MeshConfig.mode:= gl_Line_loop; InvalidateRect(GLChild.Handle, nil, False); end;end;procedure TMainForm.N

8、16Click(Sender: TObject);begin end;procedure TMainForm.N21Click(Sender: TObject);begin with TDEMCollectionForm.Create(nil) do begin ShowModal; if ListView1.ItemIndex = 0 then begin if GLChild nil then GLChild.Free; GLChild := TfrmGL.Create(Application, ListView1.Selected.SubItems0, ListView1.Selecte

9、d.SubItems1); end; Free; end;end;procedure TMainForm.N14Click(Sender: TObject);begin if MDIChildCount 0 then begin glEnable(GL_LIGHTING); InvalidateRect(GLChild.Handle, nil, False); end;end;procedure TMainForm.N15Click(Sender: TObject);begin if MDIChildCount 0 then begin glDisable(GL_LIGHTING); Inva

10、lidateRect(GLChild.Handle, nil, False); end;end;procedure TMainForm.N1Click(Sender: TObject);begin if (MDIChildCount 0) and (not Assigned(GLChild.MyMesh.Root) then begin GLChild.MyMesh.BuildTree; end;end;procedure TMainForm.FormCreate(Sender: TObject);beginend;end.unit frmDEMCollection;interfaceuses

11、 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ComCtrls, global, StdCtrls;type TDEMCollectionForm = class(TForm) ListView1: TListView; Button1: TButton; procedure Button1Click(Sender: TObject); private Private declarations public Public declarations constructor

12、Create(AOwner : TComponent); procedure LoadDEMCollection(sPath : string); end;implementation$R *.dfm TDEMCollectionForm constructor TDEMCollectionForm.Create(AOwner: TComponent);begin inherited; LoadDEMCollection(sSysPath);end;procedure TDEMCollectionForm.LoadDEMCollection(sPath : string);var F : Te

13、xtFile; sBuf : string; Item : TListItem;begin AssignFile(F, sPath + dem.ini); Reset(F); Readln(F); while not Eof(F) do begin ReadLn(F, sBuf); Item := ListView1.Items.Add; Item.Caption := GetStrItem(sBuf, ,1); Item.SubItems.Add(GetStrItem(sBuf,2); Item.SubItems.Add(GetStrItem(sBuf,3); end; CloseFile(

14、F);end;procedure TDEMCollectionForm.Button1Click(Sender: TObject);begin Close;end;end./BoogeMan BoogeSoftyandex.ru /unit frmGLMDI;interfaceuses Windows, Messages, Classes, Graphics, Forms, Controls, SysUtils, OpenGL, Mesh, Menus, StdCtrls, Dialogs, ExtCtrls, ComCtrls, Buttons;const BUFSIZE = 512;typ

15、e TfrmGL = class(TForm) procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer); procedure FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure FormMouseDown(Sen

16、der: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure FormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean); procedure N14Click(Sender: TObject); procedure N15Click(Sender: TObject); procedure N11Click(Sender: TObject); procedure N12Click(S

17、ender: TObject); procedure N7Click(Sender: TObject); procedure Grayface2Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure FormMouseWheelDown(Sender: TObject; Shift: TShiftState; MousePos: TPoint; var Handled: Boolean); procedure FormMouseWheelUp(Sender: TObject; Shift: TShiftStat

18、e; MousePos: TPoint; var Handled: Boolean); procedure Button1Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private DC: HDC; hrc: HGLRC; mDown : Boolean; bRBtnDown : Boolean; procedure Init; procedure SetDCPixelFormat; protected procedure WMPaint(var Msg: TWM

19、Paint); message WM_PAINT; public MyMesh : TGeo3DMesh; viewP : array 0.3 of GLint; constructor Create(AOwner : TComponent; sDem, sIMG : string); destructor Destroy;override; procedure ZoomIn; procedure ZoomOut; function DoSelect(X,Y : integer) : integer; end;var frmGL: TfrmGL; Anglex,Angley,angle, dL

20、ength : GLfloat; xm,ym : Integer;implementationuses frmMain;$R *.DFM=软桷栲腓玎鲨procedure TfrmGL.Init;begin glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHT0); glenable (GL_COLOR_MATERIAL); gldisable (GL_NORMALIZE);end;procedure TfrmGL.WMPaint(var Msg: TWMPaint);var ps : TPaintStruct;begin BeginPaint (Handle,

21、ps); glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT); glPushMatrix; glRotatef (Anglex, 1.0,0.0 , 0.0); glRotatef (Angley, 0.0,1.0 , 0.0); MyMesh.Draw; / glPopMatrix; SwapBuffers (DC); EndPaint (Handle, ps);end;procedure TfrmGL.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);begi

22、n If Key = VK_ESCAPE then Close else if Key = 38 then ZoomOut else if Key = 40 then ZoomIn;end;procedure TfrmGL.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);begin If mdown then begin anglex:=anglex+(y-ym); angley:=angley+(x-xm); InvalidateRect(Handle, nil, False); end; if bRBtnD

23、own then begin gluLookAt(xm - x)/500, (y - ym)/500, 0,(xm - x)/500,(y - ym)/500,-100,0,1,0); InvalidateRect(Handle, nil, false); end;/ DoSelect(X, Y); xm:=x;ym:=y;end;procedure TfrmGL.FormMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin if Button = mbLeft then

24、begin mdown := false; end else if Button = mbRight then begin bRBtnDown := FALSE; end;end;procedure TfrmGL.FormMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);begin if Button = mbLeft then begin mdown:=true; end else if Button = mbRight then begin bRBtnDown := TRU

25、E; end; xm:=x; ym:=y;end;procedure TfrmGL.SetDCPixelFormat;var nPixelFormat: Integer; pfd: TPixelFormatDescriptor;begin FillChar(pfd, SizeOf(pfd), 0); pfd.dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER; nPixelFormat := ChoosePixelFormat(DC, pfd); SetPixelFormat(DC, nPixelFor

26、mat, pfd);end;procedure TfrmGL.FormCanResize(Sender: TObject; var NewWidth, NewHeight: Integer; var Resize: Boolean);begin glViewPort (0, 0, ClientWidth, ClientHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity; gluPerspective(50.0, ClientWidth / ClientHeight, 0.01, 5000.0); glMatrixMode(GL_MODELV

27、IEW); glLoadIdentity; glTranslatef(0.0, 0.3, -1.0); InvalidateRect(Handle, nil, False); glFogi(GL_FOG_MODE, GL_exp2); glFogfv(GL_FOG_COLOR, color);/ glFogf(GL_FOG_START,25);/ glFogf(GL_FOG_END ,55); glFogf(GL_FOG_DENSITY, 0.020); glEnable (GL_FOG); glenable(GL_COLOR_MATERIAL); glEnable(GL_LIGHT0); g

28、lEnable(GL_CULL_FACE);end;procedure TfrmGL.N14Click(Sender: TObject);begin glEnable(GL_LIGHTING); InvalidateRect(Handle, nil, False);end;procedure TfrmGL.N15Click(Sender: TObject);begin gldisable(GL_LIGHTING); InvalidateRect(Handle, nil, False);end;procedure TfrmGL.N11Click(Sender: TObject);begin My

29、Mesh.MeshConfig.smt:=true; InvalidateRect(Handle, nil, False);end;procedure TfrmGL.N12Click(Sender: TObject);begin MyMesh.MeshConfig.smt:=false; InvalidateRect(Handle, nil, False);end;procedure TfrmGL.N7Click(Sender: TObject);begin glenable (GL_COLOR_MATERIAL); InvalidateRect(Handle, nil, False);end;procedure TfrmGL.Grayface2Click(Sender: TObject);begin glColor3f(0.5,0.5,0.5); gldisable (GL_COLOR_MATERIAL); InvalidateRect(Handle, nil, False);end;procedure TfrmGL.N3Click(Sender: TObject);begin Close;end;procedure Tfrm

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1