FbxSDK官网文档阅读总结

FbxSDK官网文档地址 :传送门


原文
Normally, an FBX application needs only one SDK manager object.
Most FBX applications need only one scene. But if, for example, you wish to load (i.e., import) several FBX files 
into memory and work with them all at the same time, you can create a separate scene for each file.

你的应用程序中只需要维护一个 FbxManager 对象即可。

每加载一个fbx文件,你都要为其创建一个 FbxScene 对象。也即,fbx文件与 FbxScene 对象一一对应。


原文
The second parameter of Create() is an optional name for the object. You can specify any name as a string: 
the name does not need to be unique. You can also specify an empty string. Examples:
// Create a scene object named My Scene
KFbxScene* myScene = KFbxScene::Create(mySdkManager, "My Scene");
 
// Create a node object named My Own Node
KFbxNode* myNode = KFbxNode::Create (myScene, "My Own Node");
 
// Create a mesh object named My Very Own Mesh
KFbxMesh* myMesh = KFbxMesh::Create (myScene, "My Very Own Mesh");
 
// Create a camera object with no name
KFbxCamera* myCamera = KFbxCamera::Create (myScene, "");

Because the names of FBX objects need not be unique, you cannot simply “get” an FBX object by specifying its name. 
But you can write code to enumerate all the objects in a scene that have a specified name.

Fbx对象的 Create 函数的第二个参数是可选的,它表示该对象的名字。

对象的名字并不要求是全局唯一的。所以,你不能根据名字 get 得到某一个Fbx对象,你得到的可能是很多个Fbx对象。


原文
Consider an application with two FBX scenes in memory, scene1 and scene2. If an object has been created with scene1 
as the first parameter, and then scene2 is exported, the object will not be exported. 
If the object has been created with the SDK manager as the first parameter, then the object will not be exported 
when either scene1 or scene2 is exported.
FbxCamera* myCamera = FbxCamera::Create (myScene, "");
此时, myCamera 隶属于 myScene ,当 myScene 导出时, myCamera 也会被导出。

FbxMesh* myMesh = FbxMesh::Create (mySdkManager, "");

此时,myMesh隶属于 mySdkManager ,myMesh 永远不会被导出。

In FBX SDK, a mesh can have multiple layers. A layer (class KFbxLayer) is a container 
for a layer element (class KFbxLayerElement) that will affect how the mesh will be rendered.
Note : Unless you need more than one layer (for some advanced purpose), always use layer 0 and 
only layer 0. MotionBuilder, FBX for QuickTime, and the FBX plug-ins for 3ds Max and 
Maya only process normals and materials stored in layer 0.
一个mesh对象含有若干个layer容器对象。每个layer容器里面又包含若干个layer元素。

一般情况下你使用且仅使用容器中的0号元素。FBX插件把法线数据和材质数据存储在0号元素内。


原文
To support multiple elements of each type, a layer element contains an array of elements. What is stored in each 
element of the array depends upon the layer element type. This array is called DirectArray. DirectArray is actually 
a lookup table, indexed by element number.
If you need an additional level of indirection to the elements of a DirectArray, you can use IndexArray, 
an array of index numbers to DirectArray.
For example, in the CubeCreator tutorial program, here is how we use the DirectArray and IndexArray for normals:
1)We need normals to specify which way each polygon (face) of the cube is facing.
2)We need to store six normals (representing Up, Down, Left, Right, Front, and Back): so the DirectArray for this 
  element type must have six array elements.
3)We must apply the same normal to all four vertices of each cube face. So we use a 24-element IndexArray to 
  map the six normals to the 24 vertices.

每个layer对象中都维护了一个元素数组,数组中存储的内容由layer的类型决定,这个数组就叫 DirectArray 。

IndexArray 是另外一种数组,它存储的内容是 DirectArray 的下标序号。

例如,一个立方体有6个面,每个面有一个法线,在它的法线layer中的 DirectArray 中就存储了6个法线数据,例如下面这种存储形式:

{ 法线Up,法线Down,法线Left,法线Right,法线Front,法线Back }

在提取顶点数据时,除了顶点坐标,还有顶点法线等数据,立方体有24个顶点,就需要有24个法线数据。

在法线layer的 IndexArray 中就提供了所需的24个法线数据,实际上 IndexArray 中存储的是 DirectArray 的下标序号(每个面的4个顶点引用同一个法线数据),

例如下面这种存储形式:

{法线1,法线1,法线1,法线1,法线2,法线2,法线2,法线2,法线3,...}







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值