3ds max
经过两天的折腾,我已经受不了max了,真是太晕了。
昨天好不容易把map channel搞清楚什么意思。vertex color是0,1是regular texture,2-(MAX_MESHMAPS-1)是额外的通道 。访问的接口还不一样,0和1可以通过public member直接访问,晕。
今天在公司搞Max的材质树搞了半天,虽然导出正确了,还是不太明白。回家用understand c++一看,太清楚不过了,呵呵,这个软件真牛。
先来看Class MtlBase:
This is the base class from which materials and textures are subclassed. Methods are provided to access the name, flags, and sub-materials/maps.
材质和贴图类的纯虚基类。
看看它的声明(截掉了一部分成员函数):
再来看Class Mtl:
This is the base class for the creation of material plug-ins. This class provides methods to do things such as compute the properties of the material for a given location, return the number of sub-materials and access the properties of the material for the interactive renderer.
来看它的成员变量:
RenderData * renderData;储存
同样是纯虚类。
Class Texbmp:
This is the base class for the creation of texture map plug-ins. It provides methods for things such as calculating the color of the map for a given location, and computing a perturbation to apply to a normal for bump mapping.
唯一的成员变量:
int cacheID; // used by renderer for caching returned values
还是纯虚类。和材质相关的几个函数是:
GetName(), GetUVWSource(), GetMapChannel()
Class BitmapTex:
This class is an interface into the Bitmap texture. All methods of this class are implemented by the system.
还是纯虚类,最终的纯虚接口,它的实现子类max sdk里没有,也没有成员变量。通过GetMapName()就能得到我们想要的纹理文件名。
再来看看下面几个函数:
ISubMap::GetSubTexmap();ISubMap::NumSubTexmaps();
Mtl::GetSubMtl();Mtl::NumSubMtls();
Mtl可以得到Sub Texmap,Mtl明明就是和Texmap平级的,而且Mesh::GetMtl()返回的是Mtl *,不是MtlBase *,我就不明白了,sdk上不是写的Mtl和Texmap都是材质树的一个节点吗?如果说Texmap不是一个节点,是Mtl的一个成员,调试的结果好像不支持这个结论。
Mesh::getFaceMtlIndex()得到是全局的Mtl索引,还是和Node相关的,Mtl怎么得到自己的Index了?
再来看看MtlList,MtlLib,MtlBaseList,MtlBaseLib。
分别是全局的Mtl列表,Mtl库,MtlBase全局列表,MtlBase库。
typedef MtlBase* MtlBaseHandle;
typedef Mtl* MtlHandle;
typedef Texmap* TexmapHandle;
class MtlList : public Tab<MtlHandle>
class MtlLib : public ReferenceTarget, public MtlList
class MtlBaseList: public Tab<MtlBaseHandle>
class MtlBaseLib : public ReferenceTarget, public MtlBaseList

