資源簡介
C#利用DirectX技術(shù)玩轉(zhuǎn).x文件,能夠進(jìn)行各種運(yùn)動操作!bin文件夾中附DirectX的dll文件

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?Microsoft.DirectX;
using?Microsoft.DirectX.Direct3D;
namespace?測試directX動畫
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????#region??定義
????????Mesh?mesh?=?null;
????????bool?pause?=?false;
????????private?Device?device?=?null;
????????Material?meshmaterials;
????????Texture[]?meshtexture;
????????private?Microsoft.DirectX.Direct3D.Font?fonts?=?null;
????????Microsoft.DirectX.Direct3D.Material[]?meshmaterials1;
????????float?angle?=?0?viewz?=?-100.0f;
????????int?position_x?position_y;
????????float?pitch?yaw?roll?=?0;
????????float?carema_x?carema_y;
????????#endregion
????????public?bool?InitializeGraphics()
????????{
????????????try
????????????{
????????????????PresentParameters?presentparams?=?new?PresentParameters();
????????????????presentparams.Windowed?=?true;//這個是在form1
????????????????presentparams.DeviceWindow?=?panel1;//這個是把圖畫弄到pannal里面
????????????????presentparams.SwapEffect?=?SwapEffect.Discard;
????????????????presentparams.EnableAutoDepthStencil?=?true;
????????????????presentparams.AutoDepthStencilFormat?=?DepthFormat.D16;
????????????????device?=?new?Device(0?DeviceType.Hardware?this?CreateFlags.SoftwareVertexProcessing?presentparams);
???????????????//?fonts?=?new?Microsoft.DirectX.Direct3D.Font(device?new?System.Drawing.Font
???????????????//(“Arial“?14.0f?Fontstyle.Bold?|?Fontstyle.Italic));
????????????????device.DeviceReset?+=?new?System.EventHandler(this.onresetDevice);
????????????????this.OnCreateDevice(device?null);
????????????????this.onresetDevice(device?null);
????????????}
????????????catch?(DirectXException)?{?return?false;?}
????????????return?true;
????????}
????????public?void?OnCreateDevice(object?sender?EventArgs?e)
????????{
????????????meshmaterials?=?new?Material();
????????????//meshmaterials.Ambient?=?System.Drawing.Color.White;
????????????//meshmaterials.Diffuse?=?System.Drawing.Color.White;
????????????//ColorValue?cv=new?ColorValue(25511);
????????????//meshmaterials.AmbientColor?=?cv;
????????????//meshmaterials.DiffuseColor?=?cv;
????????????ExtendedMaterial[]?Materials?=?null;
????????????mesh?=?Mesh.FromFile(@“..\..\car.x“?MeshFlags.RtPatches?device?out?Materials);//要載入的.x文件
????????????
????????????if?(meshtexture?==?null)//沒有網(wǎng)格紋理的話,載入??
????????????{
????????????????meshtexture?=?new?Texture[Materials.Length];
????????????????meshmaterials1?=?new?Microsoft.DirectX.Direct3D.Material[Materials.Length];
????????????????for?(int?i??=?0;?i?????????????????{
???????????????????meshmaterials1[i]?=?Materials[i].Material3D;
????????????????????meshmaterials1[i].Ambient?=?meshmaterials1[i].Diffuse;
?????????????
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2015-07-16?12:17??測試directX動畫(Example)\
?????文件?????????165??2013-05-07?19:30??測試directX動畫(Example)\app.config
?????目錄???????????0??2015-07-16?12:17??測試directX動畫(Example)\測試directX動畫\
?????文件??????524416??2015-07-07?19:54??測試directX動畫(Example)\測試directX動畫\BatNormalMap.dds
?????文件???????11207??2015-07-16?12:12??測試directX動畫(Example)\測試directX動畫\Form1.Designer.cs
?????文件????????8311??2015-07-16?12:12??測試directX動畫(Example)\測試directX動畫\Form1.cs
?????文件????????5817??2015-07-16?12:12??測試directX動畫(Example)\測試directX動畫\Form1.resx
?????文件?????1307803??2015-07-04?21:51??測試directX動畫(Example)\測試directX動畫\Pen.x
?????文件??????299627??2013-05-09?10:16??測試directX動畫(Example)\測試directX動畫\Pen1.x
?????文件?????????504??2013-05-07?19:20??測試directX動畫(Example)\測試directX動畫\Program.cs
?????目錄???????????0??2015-07-16?12:17??測試directX動畫(Example)\測試directX動畫\Properties\
?????文件????????1388??2013-05-07?19:02??測試directX動畫(Example)\測試directX動畫\Properties\AssemblyInfo.cs
?????文件????????2888??2013-05-07?19:02??測試directX動畫(Example)\測試directX動畫\Properties\Resources.Designer.cs
?????文件????????5612??2013-05-07?19:02??測試directX動畫(Example)\測試directX動畫\Properties\Resources.resx
?????文件????????1104??2013-05-07?19:02??測試directX動畫(Example)\測試directX動畫\Properties\Settings.Designer.cs
?????文件?????????249??2013-05-07?19:02??測試directX動畫(Example)\測試directX動畫\Properties\Settings.settings
?????文件?????????165??2013-05-07?19:30??測試directX動畫(Example)\測試directX動畫\app.config
?????文件???????23227??2013-05-07?16:33??測試directX動畫(Example)\測試directX動畫\arrow.x
?????文件?????1460557??2013-05-07?16:33??測試directX動畫(Example)\測試directX動畫\bat.x
?????文件?????1048704??2015-07-07?19:54??測試directX動畫(Example)\測試directX動畫\batalbedo.dds
?????文件??????480915??2013-05-07?16:33??測試directX動畫(Example)\測試directX動畫\bigship1.x
?????目錄???????????0??2015-07-16?12:17??測試directX動畫(Example)\測試directX動畫\bin\
?????目錄???????????0??2015-07-16?12:17??測試directX動畫(Example)\測試directX動畫\bin\Debug\
?????文件??????473600??2005-03-18?16:23??測試directX動畫(Example)\測試directX動畫\bin\Debug\Microsoft.DirectX.Direct3D.dll
?????文件?????2676224??2004-09-29?12:38??測試directX動畫(Example)\測試directX動畫\bin\Debug\Microsoft.DirectX.Direct3DX.dll
?????文件??????223232??2005-03-18?16:23??測試directX動畫(Example)\測試directX動畫\bin\Debug\Microsoft.DirectX.dll
?????文件???????15360??2015-07-16?12:12??測試directX動畫(Example)\測試directX動畫\bin\Debug\測試directX動畫.exe
?????文件?????????165??2013-05-07?19:30??測試directX動畫(Example)\測試directX動畫\bin\Debug\測試directX動畫.exe.config
?????文件???????32256??2015-07-16?12:12??測試directX動畫(Example)\測試directX動畫\bin\Debug\測試directX動畫.pdb
?????文件???????11600??2015-07-16?12:16??測試directX動畫(Example)\測試directX動畫\bin\Debug\測試directX動畫.vshost.exe
?????文件?????????165??2013-05-07?19:30??測試directX動畫(Example)\測試directX動畫\bin\Debug\測試directX動畫.vshost.exe.config
............此處省略31個文件信息
評論
共有 條評論