protected override void CheckScene(FbxScene scene) { base.CheckScene(scene); FbxScene origScene = CreateScene(FbxManager); Assert.IsNotNull(origScene); // Retrieve the mesh from each scene FbxMesh origMesh = origScene.GetRootNode().GetChild(0).GetMesh(); FbxMesh importMesh = scene.GetRootNode().GetChild(0).GetMesh(); // get the layers FbxLayer origLayer = origMesh.GetLayer(0 /* default layer */); FbxLayer importLayer = importMesh.GetLayer(0 /* default layer */); // Check UVs var origUVElement = origLayer.GetUVs(); var importUVElement = importLayer.GetUVs(); Assert.AreEqual(origUVElement.GetMappingMode(), importUVElement.GetMappingMode()); Assert.AreEqual(origUVElement.GetReferenceMode(), importUVElement.GetReferenceMode()); var origUVElementArray = origUVElement.GetDirectArray(); var importUVElementArray = importUVElement.GetDirectArray(); Assert.AreEqual(origUVElementArray.GetCount(), importUVElementArray.GetCount()); for (int i = 0; i < origUVElementArray.GetCount(); i++) { Assert.AreEqual(origUVElementArray.GetAt(i), importUVElementArray.GetAt(i)); } var origUVElementIndex = origUVElement.GetIndexArray(); var importUVElementIndex = origUVElement.GetIndexArray(); Assert.AreEqual(origUVElementIndex.GetCount(), importUVElementIndex.GetCount()); for (int i = 0; i < origUVElementIndex.GetCount(); i++) { Assert.AreEqual(origUVElementIndex.GetAt(i), importUVElementIndex.GetAt(i)); } // Check material and texture var origNode = origScene.GetRootNode().GetChild(0); int origMatIndex = origNode.GetMaterialIndex(m_materialName); Assert.GreaterOrEqual(origMatIndex, 0); var origMaterial = origNode.GetMaterial(origMatIndex); Assert.IsNotNull(origMaterial); var importNode = scene.GetRootNode().GetChild(0); int importMatIndex = importNode.GetMaterialIndex(m_materialName); Assert.GreaterOrEqual(importMatIndex, 0); var importMaterial = importNode.GetMaterial(importMatIndex); Assert.IsNotNull(importMaterial); // TODO: Add ability to Downcast the material to an FbxSurfacePhong. Property[] materialProperties = { new Property(FbxSurfaceMaterial.sDiffuse, PropertyType.Color), new Property(FbxSurfaceMaterial.sEmissive, PropertyType.Color), new Property(FbxSurfaceMaterial.sAmbient, PropertyType.Double3), new Property(FbxSurfaceMaterial.sSpecular, PropertyType.Double3), new Property(FbxSurfaceMaterial.sBumpFactor, PropertyType.Double) }; FbxProperty origMaterialDiffuseProperty = null; FbxProperty importMaterialDiffuseProperty = null; foreach (var prop in materialProperties) { FbxProperty origProp = origMaterial.FindProperty(prop.name); Assert.IsNotNull(origProp); Assert.IsTrue(origProp.IsValid()); FbxProperty importProp = importMaterial.FindProperty(prop.name); Assert.IsNotNull(importProp); Assert.IsTrue(importProp.IsValid()); switch (prop.type) { case PropertyType.Color: Assert.AreEqual(origProp.GetFbxColor(), importProp.GetFbxColor()); break; case PropertyType.Double3: Assert.AreEqual(origProp.GetFbxDouble3(), importProp.GetFbxDouble3()); break; case PropertyType.Double: Assert.AreEqual(origProp.GetDouble(), importProp.GetDouble()); break; default: break; } if (prop.name.Equals(FbxSurfaceMaterial.sDiffuse)) { origMaterialDiffuseProperty = origProp; importMaterialDiffuseProperty = importProp; } } Assert.IsNotNull(origMaterialDiffuseProperty); Assert.IsNotNull(importMaterialDiffuseProperty); var origTexture = origMaterialDiffuseProperty.FindSrcObject(FbxSurfaceMaterial.sDiffuse + "_Texture"); Assert.IsNotNull(origTexture); var importTexture = importMaterialDiffuseProperty.FindSrcObject(FbxSurfaceMaterial.sDiffuse + "_Texture"); Assert.IsNotNull(importTexture); // TODO: Trying to Downcast the texture to an FbxFileTexture returns a null value, // need to figure out how to fix this so we can access the texture properties. /*Assert.AreEqual (origTexture.GetFileName (), importTexture.GetFileName ()); * Assert.AreEqual (origTexture.GetTextureUse (), importTexture.GetTextureUse ()); * Assert.AreEqual (origTexture.GetMappingType (), importTexture.GetMappingType ());*/ }