Exemple #1
0
 void MeshDatabase::WriteStream(
     const Stream& stream,
     const void* dst, Metal::NativeFormat::Enum dstFormat, size_t dstStride, size_t dstSize) const
 {
     const auto& sourceData = stream.GetSourceData();
     auto stride = sourceData.GetStride();
     CopyVertexData(
         dst, dstFormat, dstStride, dstSize,
         sourceData.GetData(), sourceData.GetFormat(), stride, sourceData.GetDataSize(),
         (unsigned)_unifiedVertexCount, 
         stream.GetVertexMap(), sourceData.GetProcessingFlags());
 }
void CFBXLoader::SetupNode(FbxNode* pNode, std::string parentName)
{
	if(!pNode)
		return ;

	FBX_MESH_NODE meshNode;

	meshNode.name = pNode->GetName();
	meshNode.parentName = parentName;

	ZeroMemory( &meshNode.elements, sizeof(MESH_ELEMENTS) );

	FbxMesh* lMesh = pNode->GetMesh();	

	if(lMesh)
	{
		const int lVertexCount = lMesh->GetControlPointsCount();

		if (lVertexCount>0)
		{
			// 頂点があるならノードにコピー
			CopyVertexData(lMesh, &meshNode);
		}
	}

	// マテリアル
	const int lMaterialCount = pNode->GetMaterialCount();
	for(int i=0;i<lMaterialCount;i++)
	{
		FbxSurfaceMaterial* mat = pNode->GetMaterial(i);
		if(!mat)
			continue;

		FBX_MATERIAL_NODE destMat;
		CopyMatrialData(mat, &destMat);

		meshNode.m_materialArray.push_back(destMat);
	}

	//
	ComputeNodeMatrix(pNode, &meshNode);

	m_meshNodeArray.push_back(meshNode);

	const int lCount = pNode->GetChildCount();
	for (int i = 0; i < lCount; i++)
	{
		SetupNode(pNode->GetChild(i), meshNode.name);
	}
}