#include <math.h>
#include "../Common/Common.h"
#define SAMPLE_FILENAME "ExportScene04.fbx"
void SetCameraPointOfInterest(
FbxNode* pCamera, 
FbxNode* pPointOfInterest);
 
void SetLightGroupDefaultPosition(
FbxNode* pLightGroup);
 
void SetLightDefaultPosition(
FbxNode* pLight, 
int pIndex);
 
void SetMarkerDefaultPosition(
FbxNode* pMarker);
 
void SetCamera1DefaultPosition(
FbxNode* pCamera);
 
void SetCamera2DefaultPosition(
FbxNode* pCamera);
 
int main(int argc, char** argv)
{
    bool lResult;
    
    InitializeSdkObjects(lSdkManager, lScene);
    
    lResult = CreateScene(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;
}
{
    FbxNode* lLightGroup = CreateLightGroup(pScene, 
"LightGroup");
 
    FbxNode* lMarker = CreateMarker(pScene, 
"Marker");
 
    FbxNode* lCamera1 = CreateCamera(pScene, 
"Camera1");
 
    FbxNode* lCamera2 = CreateCamera(pScene, 
"Camera2");
 
    SetCameraPointOfInterest(lCamera1, lMarker);
    SetCameraPointOfInterest(lCamera2, lCamera1);
    SetLightGroupDefaultPosition(lLightGroup);
    SetMarkerDefaultPosition(lMarker);
    SetCamera1DefaultPosition(lCamera1);
    SetCamera2DefaultPosition(lCamera2);
    
        
        
        
    
    
    AnimateLightGroup(lLightGroup, lAnimLayer);
    AnimateCamera(lCamera1, lAnimLayer);
    return true;
}
{
    int i;
    for(i = 0; i < 6; i++)
    {
        lLightName = pName;
        lLightName += "-Light";
        lLightName += i;
        lNode = CreateLight(pScene, lLightName.
Buffer());
 
    }
    for (i = 0; i < 6; i++)
    {
    }
    return lGroup;
}
{
    return lNode;
}
{
    return lNode;
}
{
    
    return lNode;
}
void SetCameraPointOfInterest(
FbxNode* pCamera, 
FbxNode* pPointOfInterest)
 
{
    
}
void SetLightGroupDefaultPosition(
FbxNode* pLightGroup)
 
{
    int i;
    {
        SetLightDefaultPosition(pLightGroup->
GetChild(i), i);
 
    }
}
void SetLightDefaultPosition(
FbxNode* pLight, 
int pIndex)
 
{
    
    
    {
    };
    if (light)
    {
        light->
Color.Set(lColor[pIndex % 6]);
 
    }
}
void SetMarkerDefaultPosition(
FbxNode* pMarker)
 
{
    
}
void SetCamera1DefaultPosition(
FbxNode* pCamera)
 
{
    FbxVector4 lDefaultPointOfInterest(1.0, 100.0, -300.0);
 
}
void SetCamera2DefaultPosition(
FbxNode* pCamera)
 
{
}
{
    int i;
    int lKeyIndex = 0;
    {
        AnimateLight(pLightGroup->
GetChild(i), i, pAnimLayer);
 
    }
    
    pLightGroup->
LclRotation.GetCurveNode(pAnimLayer, 
true);
 
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
    }
}
{
    int i, j;
    int lKeyIndex = 0;
    
    
    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);
 
    }
    
    {
        
        double lValue;
        for (i = 0; i < 8; i++)
        {
            lValue = cos((((double)i) + (((double)pIndex) * 60.0)) * 72.0);
            lKeyIndex = lCurve->
KeyAdd(lTime);
 
            lCurve->
KeySetValue(lKeyIndex, 
float((lValue - 0.4) * 30.0));
 
            lKeyIndex = lConeCurve->
KeyAdd(lTime);
 
            lConeCurve->
KeySetValue(lKeyIndex, 
float((2.0 - (lValue + 1.0)) * 45.0));
 
        }
        
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lConeCurve->
KeyAdd(lTime);
 
    }
    
    {
        {
        };
        
        light->
Color.GetCurveNode(pAnimLayer, 
true);
 
        if (lCurveA[0] && lCurveA[1] && lCurveA[2])
        {
            for (i = 0; i < 24; i++)
            {
                j = i + pIndex;
                while (j > 5)
                {
                    j -= 6;
                }
                lKeyIndex = lCurveA[0]->
KeyAdd(lTime);
 
                lCurveA[0]->
KeySetValue(lKeyIndex, (
float)lColor[j][0]);
 
                lKeyIndex = lCurveA[1]->
KeyAdd(lTime);
 
                lCurveA[1]->
KeySetValue(lKeyIndex, (
float)lColor[j][1]);
 
                lKeyIndex = lCurveA[2]->
KeyAdd(lTime);
 
                lCurveA[2]->
KeySetValue(lKeyIndex, (
float)lColor[j][2]);
 
            }
        }
    }
}
{
    int lKeyIndex = 0;
    
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lCurve->
KeySet(lKeyIndex, lTime, 200.0);
 
    }
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lCurve->
KeySet(lKeyIndex, lTime, 300.0);
 
    }
    
    
    if (lCurve)
    {
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lKeyIndex = lCurve->
KeyAdd(lTime);
 
        lCurve->
KeySet(lKeyIndex, lTime, 2*360.0);
 
    }    
}