Presence of Layered Textures no longer disables texture import from FBX files
--HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4032
This commit is contained in:
@@ -436,6 +436,10 @@ void LoadMesh(std::vector<KRResource *> &resources, KFbxGeometryConverter *pGeom
|
|||||||
lKFbxDouble1 =((KFbxSurfacePhong *) pMaterial)->Shininess;
|
lKFbxDouble1 =((KFbxSurfacePhong *) pMaterial)->Shininess;
|
||||||
new_material->setShininess(lKFbxDouble1.Get());
|
new_material->setShininess(lKFbxDouble1.Get());
|
||||||
|
|
||||||
|
// ShininessFactor
|
||||||
|
lKFbxDouble1 =((KFbxSurfacePhong *) pMaterial)->SpecularFactor;
|
||||||
|
double specular_factor = lKFbxDouble1.Get();
|
||||||
|
|
||||||
// Display the Reflectivity
|
// Display the Reflectivity
|
||||||
//lKFbxDouble1 =((KFbxSurfacePhong *) pMaterial)->ReflectionFactor;
|
//lKFbxDouble1 =((KFbxSurfacePhong *) pMaterial)->ReflectionFactor;
|
||||||
} else if(pMaterial->GetClassId().Is(KFbxSurfaceLambert::ClassId) ) {
|
} else if(pMaterial->GetClassId().Is(KFbxSurfaceLambert::ClassId) ) {
|
||||||
@@ -466,62 +470,64 @@ void LoadMesh(std::vector<KRResource *> &resources, KFbxGeometryConverter *pGeom
|
|||||||
// Diffuse Map Texture
|
// Diffuse Map Texture
|
||||||
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sDiffuse);
|
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sDiffuse);
|
||||||
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
||||||
printf("Error! Layered textures not supported.\n");
|
printf("Warning! Layered textures not supported.\n");
|
||||||
} else {
|
}
|
||||||
int texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
|
||||||
if(texture_count > 1) {
|
int texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
||||||
printf("Error! Multiple diffuse textures not supported.\n");
|
if(texture_count > 1) {
|
||||||
} else if(texture_count == 1) {
|
printf("Error! Multiple diffuse textures not supported.\n");
|
||||||
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
} else if(texture_count == 1) {
|
||||||
assert(!pTexture->GetSwapUV());
|
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
||||||
assert(pTexture->GetCroppingTop() == 0);
|
assert(!pTexture->GetSwapUV());
|
||||||
assert(pTexture->GetCroppingLeft() == 0);
|
assert(pTexture->GetCroppingTop() == 0);
|
||||||
assert(pTexture->GetCroppingRight() == 0);
|
assert(pTexture->GetCroppingLeft() == 0);
|
||||||
assert(pTexture->GetCroppingBottom() == 0);
|
assert(pTexture->GetCroppingRight() == 0);
|
||||||
assert(pTexture->GetWrapModeU() == KFbxTexture::eREPEAT);
|
assert(pTexture->GetCroppingBottom() == 0);
|
||||||
assert(pTexture->GetWrapModeV() == KFbxTexture::eREPEAT);
|
assert(pTexture->GetWrapModeU() == KFbxTexture::eREPEAT);
|
||||||
assert(pTexture->GetRotationU() == 0.0f);
|
assert(pTexture->GetWrapModeV() == KFbxTexture::eREPEAT);
|
||||||
assert(pTexture->GetRotationV() == 0.0f);
|
assert(pTexture->GetRotationU() == 0.0f);
|
||||||
assert(pTexture->GetRotationW() == 0.0f);
|
assert(pTexture->GetRotationV() == 0.0f);
|
||||||
|
assert(pTexture->GetRotationW() == 0.0f);
|
||||||
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
assert(pTexture->GetScaleU() == 1.0f);
|
||||||
if(pFileTexture) {
|
assert(pTexture->GetScaleV() == 1.0f);
|
||||||
new_material->setDiffuseMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
|
||||||
}
|
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
||||||
|
if(pFileTexture) {
|
||||||
|
new_material->setDiffuseMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Specular Map Texture
|
// Specular Map Texture
|
||||||
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sSpecular);
|
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sSpecular);
|
||||||
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
||||||
printf("Error! Layered textures not supported.\n");
|
printf("Warning! Layered textures not supported.\n");
|
||||||
} else {
|
}
|
||||||
int texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
||||||
if(texture_count > 1) {
|
if(texture_count > 1) {
|
||||||
printf("Error! Multiple specular textures not supported.\n");
|
printf("Error! Multiple specular textures not supported.\n");
|
||||||
} else if(texture_count == 1) {
|
} else if(texture_count == 1) {
|
||||||
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
||||||
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
||||||
if(pFileTexture) {
|
if(pFileTexture) {
|
||||||
new_material->setSpecularMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
new_material->setSpecularMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normal Map Texture
|
// Normal Map Texture
|
||||||
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sNormalMap);
|
pProperty = pMaterial->FindProperty(KFbxSurfaceMaterial::sNormalMap);
|
||||||
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
if(pProperty.GetSrcObjectCount(KFbxLayeredTexture::ClassId) > 0) {
|
||||||
printf("Error! Layered textures not supported.\n");
|
printf("Warning! Layered textures not supported.\n");
|
||||||
} else {
|
}
|
||||||
int texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
|
||||||
if(texture_count > 1) {
|
texture_count = pProperty.GetSrcObjectCount(KFbxTexture::ClassId);
|
||||||
printf("Error! Multiple normal map textures not supported.\n");
|
if(texture_count > 1) {
|
||||||
} else if(texture_count == 1) {
|
printf("Error! Multiple normal map textures not supported.\n");
|
||||||
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
} else if(texture_count == 1) {
|
||||||
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
KFbxTexture* pTexture = KFbxCast <KFbxTexture> (pProperty.GetSrcObject(KFbxTexture::ClassId,0));
|
||||||
if(pFileTexture) {
|
KFbxFileTexture *pFileTexture = KFbxCast<KFbxFileTexture>(pTexture);
|
||||||
new_material->setNormalMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
if(pFileTexture) {
|
||||||
}
|
new_material->setNormalMap(KRResource::GetFileBase(pFileTexture->GetFileName()), KRVector2(pTexture->GetScaleU(), pTexture->GetScaleV()), KRVector2(pTexture->GetTranslationU(), pTexture->GetTranslationV()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user