[原创]MilkShape3D(*.ms3d) C++ Directx9 Loader

苦逼热狗

路边通讯社社长
VIP
注册
2002-10-12
消息
47,114
荣誉分数
2,376
声望点数
393
DirectX9 MS3D loader with animation
Downloaded from CFC中文网 - 加拿大 - 渥太华
Created and Modified by Wei Chen.

Notice:

I found a OpenGL version of this loader which was a milkshape viewer from chUmbaLum sOft. The license says the following:

------------
Copyright ?2003 Mete Ciragan, chUmbaLum sOft

This software is provided 'as-is', without any expressed or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution.

------------
You can find chUmbaLum sOft here: chUmbaLum sOft

This is a c++ library I directly rip off from my Game Development Course Term Project. Some of functions or variables might be useless, since entire project was implemented in a rush.
I hope, that people find way to optimize this, and willing to share the code, by e-mail torune@hotmail.com :-)


Usage example, loading:


ModelLoader = new Loader(g_pd3dDevice);
ModelLoader->MilkShape3D = new CMS3DFile();
ModelLoader->MilkShape3D->LoadFromFile("ms3dfile");
ModelLoader->Loadup(ModelLoader->MilkShape3D);


Rendering function:

ModelLoader->Draw();

Setting time:
ModelLoader->SetTime(ftime);


I hope it's usefull to some people :-)

-Wei Chen
 

附件

  • 1.jpg
    1.jpg
    27.5 KB · 查看: 345
  • 2.jpg
    2.jpg
    45.4 KB · 查看: 342
  • 4.jpg
    4.jpg
    24.5 KB · 查看: 343
  • 5.jpg
    5.jpg
    24.6 KB · 查看: 346
  • ms3ddx9loader.zip
    ms3ddx9loader.zip
    12.8 KB · 查看: 163
Development Environment:
Windows XP Professional Edition SP2
Visual Studio 2005 Standard Edition
DirectX SDK (August 2007)

Pre-compiled version can be download from
RapidShare: 1-Click Webhosting

INSTRUCTION:
In order to run the executable, please pass in a ms3d file as argument to run. and make sure actions.txt is in the same folder as executable file.
ie: BabyStep.exe dwarf1.ms3d

Animation Handling
The program contains a basic control system. There is a file named actions.txt in the same directory as the program, which contains all required information for different actions. For instance, there is a jump animation is located between frame 112 and 126. We would like to assign key 1 to the jump action. The information that we store to actions.txt will be “1 49 112 126”, which “1” is the mouse action, “49” is the decimal value of key stroke 1, “112” is the start frame of the action, and “126” is the finish frame of the action.​
There are also 2 extra functions that need to be mentioned. Wireframe fill mode can be activate/deactivate by pressing ‘W’ button, which is just simply switch the render state of the device between solids and wireframe. ‘F’ button will toggle file material or default material rendering for the model. You also can use left or right button on the mouse to control the view. Use left button to rotate the model and right one for translating the model, the codes are adapted from our Assignment solution.​
 
后退
顶部