#include "../Common/Common.h"
#include "Thumbnail.h"
#define SAMPLE_FILENAME "ExportScene01.fbx"
void AddThumbnailToScene(
FbxScene* pScene);
 
int main(int argc, char** argv)
{
    bool lResult;
    
    InitializeSdkObjects(lSdkManager, lScene);
    
    lResult = CreateScene(lSdkManager, lScene);
    if(lResult == false)
    {
        FBXSDK_printf("\n\nAn error occurred while creating the scene...\n");
        DestroySdkObjects(lSdkManager, lResult);
        return 0;
    }
    
    
    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 = SaveScene(lSdkManager, lScene, lSampleFileName);
    if(lResult == false)
    {
        FBXSDK_printf("\n\nAn error occurred while saving the scene...\n");
        DestroySdkObjects(lSdkManager, lResult);
        return 0;
    }
    
    DestroySdkObjects(lSdkManager, lResult);
    return 0;
}
{
    
    sceneInfo->
mTitle = 
"Example scene";
 
    sceneInfo->
mSubject = 
"Illustrates the creation and animation of a deformed cylinder.";
 
    sceneInfo->
mAuthor = 
"ExportScene01.exe sample program.";
 
    sceneInfo->
mComment = 
"no particular comments required.";
 
    
    
    AddThumbnailToScene(pScene);
    FbxNode* lPatch = CreatePatch(pScene, 
"Patch");
 
    FbxNode* lSkeletonRoot = CreateSkeleton(pScene, 
"Skeleton");
 
    
    
    LinkPatchToSkeleton(pScene, lPatch, lSkeletonRoot);
    StoreBindPose(pScene, lPatch);
    StoreRestPose(pScene, lSkeletonRoot);
    
    AnimateSkeleton(pScene, lSkeletonRoot);
    return true;
}
{
    
    int i;
    for (i = 0; i < 7; i++) 
    {
        double lRadius = 15.0;
        double lSegmentLength = 20.0;
        lVector4[4*i + 0].
Set(lRadius, 0.0, (i-3)*lSegmentLength);
 
        lVector4[4*i + 1].
Set(0.0, -lRadius, (i-3)*lSegmentLength);
 
        lVector4[4*i + 2].
Set(-lRadius, 0.0, (i-3)*lSegmentLength);
 
        lVector4[4*i + 3].
Set(0.0, lRadius, (i-3)*lSegmentLength);
 
    }
    
    
    return lNode;
}
{
    
    lRootName += "Root";
    
    lLimbNodeName1 += "LimbNode1";
    lSkeletonLimbNodeAttribute1->
Size.
Set(1.0);
 
    
    lLimbNodeName2 += "LimbNode2";
    lSkeletonLimbNodeAttribute2->
Size.
Set(1.0);
 
    
    lSkeletonRoot->
AddChild(lSkeletonLimbNode1);
 
    lSkeletonLimbNode1->
AddChild(lSkeletonLimbNode2);
 
    return lSkeletonRoot;
}
{
    int i, j;
    
    for(i=0; i<4; ++i)
        for(j=0; j<4; ++j)
    
    lClusterToLimbNode1->
SetLink(lLimbNode1);
 
    for (i =1; i<6; ++i)
        for (j=0; j<4; ++j)
    
    lClusterToLimbNode2->
SetLink(lLimbNode2);
 
    for (i=3; i<7; ++i)
        for (j=0; j<4; ++j)
    
    
    
    
}
{
    int lKeyIndex = 0;
    
    lAnimStackName = "Bend on 2 sides";
        
        
        
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
    
    lAnimStackName = "Bend and turn around";
        
        
        
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
}
void AddThumbnailToScene(
FbxScene* pScene)
 
{
    {
    }
}
{
    
    
    
    
    
    
    
    int                       i, j;
    {
        int lSkinCount=0;
        int lClusterCount=0;
        {
        default:
            break;
            
            
            for(i=0; i<lSkinCount; ++i)
            {
            }
            break;
        }
        
        if (lClusterCount)
        {
            
            for (i=0; i<lSkinCount; ++i)
            {
                for (j=0; j<lClusterCount; ++j)
                {
                    AddNodeRecursively(lClusteredFbxNodes, lClusterNode);
                }
            }
            
            lClusteredFbxNodes.
Add(pPatch);
 
        }
    }
    
    if (lClusteredFbxNodes.GetCount())
    {
        
        
        for (i=0; i<lClusteredFbxNodes.GetCount(); i++)
        {
            lPose->
Add(lKFbxNode, lBindMatrix);
 
        }
        
    }
}
{
    
    
    
    
    
    
    
    lT.
Set(10.0, 10.0, 10.0);
 
    lTransformMatrix.
SetTRS(lT, lR, lS);
 
    
    lKFbxNode = pSkeletonRoot;
    lPose->
Add(lKFbxNode, lTransformMatrix, 
false );
 
    
    
    
    lTransformMatrix.
SetTRS(lT, lR, lS);
 
    
    lPose->
Add(lKFbxNode, lTransformMatrix, 
true );
 
    
    
    lTransformMatrix.
SetTRS(lT, lR, lS);
 
    
    lPose->
Add(lKFbxNode, lTransformMatrix, 
true );
 
    
}
{
    if (pNode)
    {
        AddNodeRecursively(pNodeArray, pNode->
GetParent());
 
        if (pNodeArray.
Find(pNode) == -1)
 
        {
            
        }
    }
}
{
    memcpy((
double*)pXMatrix, &pMatrix.
mData[0][0], 
sizeof(pMatrix.
mData));
 
}