#include "../Common/Common.h"
#include "../Common/GeometryUtility.h"
#define SAMPLE_FILENAME "ExportShader.fbx"
#define CGFX_SHADERFILE "xfSkyBox.cgfx"
#define HLSL_SHADERFILE "glass.fx"
#define TEXTURE_FILE "Default_reflection.dds"
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, -1, true);
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 of shader.";
sceneInfo->
mAuthor =
"ExportShader sample program.";
sceneInfo->
mComment =
"no particular comments required.";
FbxNode* lCgfxNode = CreateCube(pScene,
"CgfxCube", lCgfxTranslation);
FbxNode* lHlslNode = CreateCube(pScene,
"HlslCube", lHlslTranslation);
FbxNode* lSsslNode = CreateCube(pScene,
"SsslCube", lSsslTranslation);
return true;
}
{
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
return lCgfxMat;
}
{
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
CreateTableEntry(lTable, lProp);
return lHlslMat;
}
{
lDst.SetSemantic( pProp.
GetName() );
}
{
#define DefineProperty(name, shaderName, dataType, value) \
{ \
lProp = FbxSurfaceMaterialUtils::AddProperty(lMat, name, shaderName, dataType); \
if (lProp.IsValid()) lProp.Set(value); \
}
DefineProperty(
"Emission",
"emission",
FbxFloatDT, 0.0);
DefineProperty(
"Specular",
"specular",
FbxFloatDT, 0.2);
DefineProperty(
"SpecularIOR",
"specular_IOR",
FbxFloatDT, 1.5);
DefineProperty(
"SpecularAnisotropy",
"specular_anisotropy",
FbxFloatDT, 0.0);
DefineProperty(
"SpecularRoughness",
"specular_roughness",
FbxFloatDT, 0.4);
DefineProperty(
"SpecularRotation",
"specular_rotation",
FbxFloatDT, 0.0);
DefineProperty(
"Transmission",
"transmission",
FbxFloatDT, 0.0);
DefineProperty(
"TransmissionDepth",
"transmission_depth",
FbxFloatDT, 0.0);
DefineProperty(
"TransmissionExtraRoughness",
"transmission_extra_roughness",
FbxFloatDT, 0.0);
DefineProperty(
"TransmissionDispersion",
"transmission_dispersion",
FbxFloatDT, 0.0);
DefineProperty(
"TransmissionScatterAnisotropy",
"transmission_scatter_anisotropy",
FbxFloatDT, 0.0);
DefineProperty(
"Sheen",
"sheen",
FbxFloatDT, 0.0);
DefineProperty(
"SheenRoughness",
"sheen_roughness",
FbxFloatDT, 0.3);
DefineProperty(
"CoatAffectColor",
"coat_affect_color",
FbxFloatDT, 0.0);
DefineProperty(
"CoatRoughness",
"coat_roughness",
FbxFloatDT, 0.1);
DefineProperty(
"CoatIOR",
"coat_IOR",
FbxFloatDT, 1.5);
DefineProperty(
"CoatAffectRoughness",
"coat_affect_roughness",
FbxFloatDT, 0.0);
DefineProperty(
"CoatRotation",
"coat_rotation",
FbxFloatDT, 0.0);
DefineProperty(
"CoatAnisotropy",
"coat_anisotropy",
FbxFloatDT, 0.0);
DefineProperty(
"ThinWalled",
"thin_walled",
FbxBoolDT,
false);
DefineProperty(
"ThinFilmIOR",
"thin_film_IOR",
FbxFloatDT, 1.5);
DefineProperty(
"ThinFilmThickness",
"thin_film_thickness",
FbxFloatDT, 0.0);
DefineProperty(
"Subsurface",
"subsurface",
FbxFloatDT, 0.0);
DefineProperty(
"SubsurfaceScale",
"subsurface_scale",
FbxFloatDT, 1.0);
DefineProperty(
"SubsurfaceAnisotropy",
"subsurface_anisotropy",
FbxFloatDT, 0.0);
DefineProperty(
"Metalness",
"metalness",
FbxFloatDT, 0.0);
DefineProperty(
"DiffuseRoughness",
"diffuse_roughness",
FbxFloatDT, 0.0);
return lMat;
#undef DefineProperty
}