Beispiel #1
0
void FBXSceneImporter::read_node(FbxNode* pNode)
{
	for (int i = 0; i < pNode->GetNodeAttributeCount(); i++)
	{
		FbxNodeAttribute* pAttribute = pNode->GetNodeAttributeByIndex(i);
		FbxNodeAttribute::EType attribute_type = pAttribute->GetAttributeType();

		if (attribute_type == FbxNodeAttribute::eMesh)
		{
			FbxMesh* pMesh = (FbxMesh*)pAttribute;
			read_mesh(pNode, pMesh);
		}
		else if (attribute_type == FbxNodeAttribute::eLight)
		{
			FbxLight* pLight = (FbxLight*)pAttribute;
			read_light(pNode, pLight);
		}
		else if (attribute_type == FbxNodeAttribute::eCamera)
		{
			FbxCamera* pCamera = (FbxCamera*)pAttribute;
			read_camera(pNode, pCamera);
		}
	}

	int materialCount = pNode->GetSrcObjectCount<FbxSurfaceMaterial>();

	// Recursively print the children.
	for (int j = 0; j < pNode->GetChildCount(); j++)
	{
		read_node(pNode->GetChild(j));
	}

}
Beispiel #2
0
void SDLReader::read_sdl(Scene &scene, string file_object, string file_camera, string file_light, string file_plane)
{
  Camera *camera = read_camera(file_camera);
  scene.set_camera(camera);
  Material *material;
  Light *light = read_light(file_light, &material, scene);
  scene.add_light(light);
  Mesh *mesh = read_object(file_object, material);
  scene.add_mesh(mesh);
  if(file_plane.size() == 0) 
	return;
  Plane *plane = read_plane(file_plane);
  scene.set_plane(plane);
}