#ifdef IOS_REF
#undef IOS_REF
#define IOS_REF (*(pManager->GetIOSettings()))
#endif
#define SAMPLE_FILENAME "ExportDocument.fbx"
{
if( !pManager )
{
FBXSDK_printf("Error: Unable to create FBX Manager!\n");
exit(1);
}
else FBXSDK_printf(
"Autodesk FBX SDK version %s\n", pManager->
GetVersion());
}
void DestroySdkObjects(
FbxManager* pManager,
bool pExitStatus)
{
if( pManager ) pManager->
Destroy();
if( pExitStatus ) FBXSDK_printf("Program Success!\n");
}
bool SaveDocument(
FbxManager* pManager,
FbxDocument* pDocument,
const char* pFilename,
int pFileFormat=-1,
bool pEmbedMedia=
false)
{
int lMajor, lMinor, lRevision;
bool lStatus = true;
{
if (!pEmbedMedia)
{
for (lFormatIndex=0; lFormatIndex<lFormatCount; lFormatIndex++)
{
{
const char *lASCII = "ascii";
if (lDesc.
Find(lASCII)>=0)
{
pFileFormat = lFormatIndex;
break;
}
}
}
}
}
{
FBXSDK_printf("Call to FbxExporter::Initialize() failed.\n");
return false;
}
FBXSDK_printf("FBX version number for this version of the FBX SDK is %d.%d.%d\n\n", lMajor, lMinor, lRevision);
lStatus = lExporter->
Export(pDocument);
return lStatus;
}
int main(int argc, char** argv)
{
bool lResult = false;
InitializeSdkObjects(lSdkManager);
const char* lSampleFileName =
NULL;
for( int i = 1; i < argc; ++i )
{
if( FBXSDK_stricmp(argv[i], "-test") == 0 ) continue;
else if( !lSampleFileName ) lSampleFileName = argv[i];
}
if( !lSampleFileName ) lSampleFileName = SAMPLE_FILENAME;
lResult = CreateDocument(lSdkManager, lDocument);
if( lResult )
{
lResult = SaveDocument(lSdkManager, lDocument, lSampleFileName);
if( !lResult ) FBXSDK_printf("\n\nAn error occurred while saving the document...\n");
}
else FBXSDK_printf("\n\nAn error occurred while creating the document...\n");
DestroySdkObjects(lSdkManager, lResult);
return 0;
}
{
int lCount;
lDocInfo->
mTitle =
"Example document";
lDocInfo->
mSubject =
"Illustrates the creation of FbxDocument with geometries, materials and lights.";
lDocInfo->
mAuthor =
"ExportDocument.exe sample program.";
lDocInfo->
mComment =
"no particular comments required.";
FbxNode* lPlane = CreatePlane(pManager,
"Plane");
CreateMatDocument(pManager, lMatDocument);
CreateLightDocument(pManager, lLightDocument);
return true;
}
{
lDocInfo->
mTitle =
"Sub document for materials";
lDocInfo->
mSubject =
"Illustrates the creation of sub-FbxDocument with materials.";
lDocInfo->
mAuthor =
"ExportDocument.exe sample program.";
lDocInfo->
mKeywords =
"Fbx material document";
lDocInfo->
mComment =
"no particular comments required.";
pMatDocument->
AddMember(CreateMaterial(pManager));
}
{
lDocInfo->
mTitle =
"Sub document for lights";
lDocInfo->
mSubject =
"Illustrates the creation of sub-FbxDocument with lights.";
lDocInfo->
mAuthor =
"ExportDocument.exe sample program.";
lDocInfo->
mComment =
"no particular comments required.";
}
{
int i;
lControlPoints[0] = lControlPoint0;
lControlPoints[1] = lControlPoint1;
lControlPoints[2] = lControlPoint2;
lControlPoints[3] = lControlPoint3;
int lPolygonVertices[] = { 0, 1, 2, 3 };
FBX_ASSERT( lUVDiffuseElement !=
NULL);
for(i = 0; i < 4; i++)
{
}
FbxString lMaterialName =
"material_for_plane";
return lNode;
}
{
lTexture->
SetName(
"Diffuse Texture");
return lTexture;
}
{
lMaterial->
Diffuse .ConnectSrcObject(CreateTexture(pManager));
return lMaterial;
}
{
switch (pType)
{
lLightName = "SpotLight";
break;
lLightName = "PointLight";
break;
lLightName = "DirectionalLight";
break;
default:
break;
}
{
}
lColor[0] = 0.0;
lColor[1] = 1.0;
lColor[2] = 0.5;
lFbxLight->
Color.Set(lColor);
return lNode;
}