3DS MAX标准文本导出格式ASE的文件结构
如果你正在寻找它的几何体存放在哪的话,事实上,这不是描述具体信息层级关系的图示,而是类似XML的一种存储规范,它具有独立标签和嵌套标签,独立标签有名称和值表,而嵌套标签不仅可以嵌套子标签记忆宝,还可以嵌套“子嵌套标签”,如此递归下去。这种格式固然带来很大的灵活性,但是非常浪费时间。需要对它们全部解套然后利用一致的算法,提供一个匹配标签名进行标签取出和迭代。
*3DSMAX_ASCIIEXPORT 200
*COMMENT "AsciiExport 版本 2.00 - Wed Sep 19 22:16:39 2007"
*SCENE {
*SCENE_FILENAME "box.max"
*SCENE_FIRSTFRAME 0
*SCENE_LASTFRAME 100
*SCENE_FRAMESPEED 30
*SCENE_TICKSPERFRAME 160
*SCENE_BACKGROUND_STATIC 0.00000000 0.00000000 0.00000000
*SCENE_AMBIENT_STATIC 0.00000000 0.00000000 0.00000000
}
第二行使用了双引号对值进行了限定,避免被分割成子单元。我们可以假设*SCENE块还可以内嵌子块,假如存在,便可将此子块作为独立单元进行递归分解。直到所有嵌套子块全部被遍历。
* QUICK NOTES * beamer
This tutorial shows how to load a .A file. An ASE file is a 3D Studio Max ASCII file that saves all the information in a text file instead of in binary.
The good thing about this is that it's easy to read in, as well as easy to change without having the software. The bad thing is that it's a HUGE file size, it takes a lot longer to read in, no other programs support it and it can't even be imported back into 3D Studio Max. I would recommend looking at this tutorial before you look at the 3DS tutorial though. That way you can e what is actually being read in.
Let me mention that the math functions above are not so important and don't need to be in this file. I wanted to show how to calculate vertex normals so your models would have some excellent lighting. You most likely have functions already that do the basics so I encourage you to just u tho. This will cut down the code significantly.
* What's An STL (Standard Template Library) Vector? *
Let me quickly explain the STL vector for tho of you who are not familiar with them.
To u a vector you must include <vector> and u the std namespace: using namespace std;
A vector is an array bad link list. It allows you to dynamically add and remove nodes.
This is a template class so it can be a list of ANY type. To create a vector of type
"int" you would say: vector<int> myIntList;
Now you can add a integer to the dynamic array by saying: myIntList.push_back(10);
or you can say: myIntList.push_back(num);. The more you push back, the larger
your array gets. You can index the vector like an array. myIntList[0] = 0;
To get rid of a node you u the pop_back() function. To clear the vector u clear().
It frees itlf so you don't need to worry about it, except if you have data
structures that need information freed from inside them, like our objects.
北京新东方网络课堂
Let's go over some of the format of the .A file. I will only address the information that we really care about for object loading. The rest is Scene stuff. I created a single box around the origin that had a texture map over it to show
the simplest and smallest amount of data.
This next block is the material block. This holds all the info on the materials.
*MATERIAL_LIST { // This is the tag for the start of the material info
*MATERIAL_COUNT 1 // This tells us how many materials there are
*MATERIAL 0 { // This is the material ID that the next data is refering too.
*MATERIAL_NAME "Material #1" // The material name
*MATERIAL_CLASS "Standard"
*MATERIAL_AMBIENT 0.1791 0.0654 0.0654
*MATERIAL_DIFFUSE 0.5373 0.1961 0.1961 // The color of the object
*MATERIAL_SPECULAR 0.9000 0.9000 0.9000
*MATERIAL_SHINE 0.2500
*MATERIAL_SHINESTRENGTH 0.0500
*MATERIAL_TRANSPARENCY 0.0000
*MATERIAL_WIRESIZE 1.0000struts
*MATERIAL_SHADING Blinn
*MATERIAL_XP_FALLOFF 0.0000
*MATERIAL_SELFILLUM 0.0000
*MATERIAL_FALLOFF In
fdfd *MATERIAL_XP_TYPE Filter
*MAP_DIFFUSE {
*MAP_NAME "Map #1"
*MAP_CLASS "Bitmap"
*MAP_SUBNO 1
*MAP_AMOUNT 1.0000
*BITMAP "texture.bmp" // This is the file name for the texture
*MAP_TYPE Screen
*UVW_U_OFFSET 0.0000 // This is the U offt for the tile
*UVW_V_OFFSET 0.0000 // This is the V offt for the tile
*UVW_U_TILING 1.0000 // This is the U tiling ratio (1 is standard)
*UVW_V_TILING 1.0000 // This is the V tiling ratio (1 is standard)
*UVW_ANGLE 0.0000
*UVW_BLUR 1.0000
*UVW_BLUR_OFFSET 0.0000
*UVW_NOUSE_AMT 1.0000
desrt是什么意思 *UVW_NOISE_SIZE 1.0000
*UVW_NOISE_LEVEL 1
*UVW_NOISE_PHASE 0.0000livelihood
*BITMAP_FILTER Pyramidal
}
}
}
*GEOMOBJECT { // This tag let's us know that objects are next
*NODE_NAME "Box01" // This is the object name
*NODE_TM {
*NODE_NAME "Box01" // Once again, this is the objects name
*INHERIT_POS 0 0 0
*INHERIT_ROT 0 0 0
*INHERIT_SCL 0 0 0
*TM_ROW0 1.0000 0.0000 0.0000iv
*TM_ROW1 0.0000 1.0000 0.0000
lower
*TM_ROW2 0.0000 0.0000 1.0000世界上最遥远的距离泰戈尔
*TM_ROW3 0.0000 0.0000 0.0000
*TM_POS 0.0000 0.0000 0.0000