资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

包含dx绑定vb.net的词条

VB.net可以开发小型3D图形显示软件吗?

可以借助DirectX来编程。免费3D引擎可不好找,一般来说速度比不上硬件加速后的DX,尤其令人头疼的是一般都没有针对VB的文档,LZ有这方面理想的话,自己写一个吧……

为五原等地区用户提供了全套网页设计制作服务,及五原网站建设行业解决方案。主营业务为成都网站建设、成都网站制作、五原网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!

我不得不承认在VB上写DirectX的教程相当难找!如果LZ想深入研究三维图形问题,C++一定要学,就算不能用C++编程,起码要能把C++程序翻译成VB程序。

我自己学会DX编程花了两三个月(很浅)。编这样一个程序难度是有点大的。

工具:DirectX9和其针对VB的库(项目-添加引用。.NET库里DX库一般都有),VB不知道现在支不支持DX10以上的版本,不过9绝对够用了。

思路:一切3D图形都是由三角形拼成的。矩形挖掉一个圆孔可不是一个方便画的图形,我估计至少得有24个三角形。你需要记录这些点的坐标,或者干脆把它们写在文件里,到时读出来。

这是我的一个老DX程序的不完全的代码(显示一个黑乎乎的平面),不一定能编译,可以参考一下。

Imports Microsoft.DirectX '一定要~

Public Class FormMain

'Direct3D Startup

Dim d3dpp As New Direct3D.PresentParameters 'DX基本参数,例如全屏还是窗口等

Public MyDevice As Direct3D.Device ‘DX基本设备,画图就靠它。

'Matrices

Dim matWorld, matView, matProj As Matrix '世界位置矩阵,摄像机位置矩阵和透视矩阵,数学要学好啊。

'mesh

Public MyPlane as Direct3D.Mesh ’我们的物体

Public VBPlane(3) As Direct3D.CustomVertex.PositionNormalTextured '存放顶点位置的数组

#Region "DX Core"

Public Sub InitDeviceObjects()

With d3dpp ‘以下请照抄。

.Windowed = True ‘不全屏。

.SwapEffect = Direct3D.SwapEffect.Discard ’双缓冲交换效果。请百度“双缓冲”

.BackBufferFormat = Direct3D.Format.Unknown

.EnableAutoDepthStencil = True ’让DX自动管理深度缓冲

.AutoDepthStencilFormat = Direct3D.DepthFormat.D16

End With

MyDevice = New Direct3D.Device(0, Direct3D.DeviceType.Hardware, Me.Handle, Direct3D.CreateFlags.HardwareVertexProcessing, d3dpp) '创建DX设备啦!以下两句请照抄。

MyDevice.SetRenderState(Direct3D.RenderStates.ZEnable, True) ‘Z缓冲

MyDevice.SetRenderState(Direct3D.RenderStates.NormalizeNormals, True)'法线归一化,请看相关数学书籍。

End Sub

Public Sub RestoreDeviceObjects()

Dim PlaneIB() As Short = {0, 1, 3, 0, 2, 3} ’顶点索引信息。

Dim AttrTable(1) As Direct3D.AttributeRange ‘顶点分组属性表

AttrTable(0).AttributeId = 0

AttrTable(0).FaceStart = 0

AttrTable(0).FaceCount = 2 ’有两个三角形

AttrTable(0).VertexStart = 0

AttrTable(0).VertexCount = 4 ‘四个点

‘顶点坐标信息。

VBPlane(0) = New Direct3D.CustomVertex.PositionNormalTextured(-500, -500, 0, 0, 0, 1, 0, 0)

VBPlane(1) = New Direct3D.CustomVertex.PositionNormalTextured(500, -500, 0, 0, 0, 1, 1, 0)

VBPlane(2) = New Direct3D.CustomVertex.PositionNormalTextured(-500, 500, 0, 0, 0, 1, 0, 1)

VBPlane(3) = New Direct3D.CustomVertex.PositionNormalTextured(500, 500, 0, 0, 0, 1, 1, 1)

MyPlane = New Direct3D.Mesh(2, 4, Direct3D.MeshFlags.Managed, Direct3D.VertexFormats.Position + Direct3D.VertexFormats.Normal + Direct3D.VertexFormats.Texture1, MyDevice) ’创建物体

MyPlane.SetVertexBufferData(VBPlane, Direct3D.LockFlags.None) ‘输入顶点坐标数据

MyPlane.SetIndexBufferData(PlaneIB, Direct3D.LockFlags.None) ‘输入索引数据

MyPlane.SetAttributeTable(AttrTable) ‘输入顶点分组属性表

End Sub

Public Sub Render() ‘调用它画图

Dim vlook As New Vector3(1, 0, 0)

Dim vPos As New Vector3(0,0,0)

Dim vUp As New Vector3(0, 0, 1)

MatView = Matrix.LookAtLH(vPos, vlook, vUp) ‘计算摄像机位置矩阵

Device.SetTransform(Direct3D.TransformType.View, MatView) ‘设置当前摄像机位置矩阵为MatView。

Dim fAspect As Single = Me.Width / Me.Height ’窗口长宽比

matProj = Matrix.PerspectiveFovLH(Math.PI / 4, fAspect, 1.0F, 10001) ‘计算透视矩阵MatProj。

MyDevice.SetTransform(Direct3D.TransformType.Projection, matProj) ‘设置当前透视矩阵为MatProj。

MyDevice.Clear(Direct3D.ClearFlags.Target + Direct3D.ClearFlags.ZBuffer, Color.Blue, 1.0F, 0) ’先刷蓝屏

MyDevice.BeginScene() ‘开始画

MatWorld = Matrix.Identity ’物体位于原点,不旋转

Device.SetTransform(Direct3D.TransformType.World, MatWorld) ’设置物体位置

Me.Mesh.DrawSubset(0) ‘画物体

MyDevice.EndScene() ’结束

MyDevice.Present() ‘显示在屏幕上

End Sub

Public Sub DeleteDeviceObjects() ’结束程序时放掉资源

MyPlane.Dispose()

MyDevice.Dispose()

End Sub

#End Region

Private Sub FormMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

DeleteDeviceObjects()

Windows.Forms.Cursor.Show()

End Sub

Private Sub FormMain_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

InitDeviceObjects()

RestoreDeviceObjects()

Windows.Forms.Cursor.Hide()

Render()

End Sub

End Class

DX9 VC++ VB NET运行库安装在哪里

你想知道的是什么呀,表示不懂。我装了DX后,要导入dll文件,我是到C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0里找的,我需要用的都在里面,而VC++ VB.NET之类的在哪儿你就不需要关心了吧,用VS就行了呢

求大神指点vb.net 怎么用SendInput来实现鼠标移动到指定位置呢?

您好,建议您使用mouse_event或者 Cursor.Position来实现。例如:

1. 您需要将鼠标移动dx, dy的位置。

Public Sub MouseMoveBy(ByVal dx As Integer, ByVal dy As Integer)

Cursor.Position = New Point(Cursor.Position.X + dx, Cursor.Position.Y + dy)

End Sub

或者

Public Sub MouseMoveBy(ByVal dx As Integer, ByVal dy As Integer)

mouse_event(0, dx, dy, 0, 0)

End Sub

2. 您需要将鼠标移动到x, y的位置

Public Sub MouseMoveTo(ByVal x As Integer, ByVal y As Integer)

Cursor.Position = New Point(x, y)

End Sub

请您试一下。

DX和NET插件是什么?

DX即DirectX(Direct eXtension,简称DX)是由微软公司创建的多媒体编程接口。由C++编程语言实现,遵循COM。被广泛使用于Microsoft Windows、Microsoft XBOX、Microsoft XBOX 360和Microsoft XBOX ONE电子游戏开发,并且只能支持这些平台。最新版本为DirectX 12,创建在最新的Windows10。

.NET插件是微软用来实现XML/Web Services/SOA(面向服务的体系结构service-oriented architecture)和敏捷性的技术。技术人员一般将微软看成一个平台厂商。微软搭建技术平台,而技术人员在这个技术平台之上创建应用系统。从这个角度,.NET也可以如下来定义:.NET是微软的新一代技术平台,为敏捷商务构建互联互通的应用系统,这些系统是基于标准的,联通的,适应变化的,稳定的和高性能的。


网页名称:包含dx绑定vb.net的词条
链接URL:http://cdkjz.cn/article/dsiidhp.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220