コード例 #1
0
        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 normals
            CheckFbxElementVector4(origLayer.GetNormals(), importLayer.GetNormals());

            // Check binormals
            CheckFbxElementVector4(origLayer.GetBinormals(), importLayer.GetBinormals());

            // Check tangents
            CheckFbxElementVector4(origLayer.GetTangents(), importLayer.GetTangents());

            // Check vertex colors
            var origVertexColorElement   = origLayer.GetVertexColors();
            var importVertexColorElement = importLayer.GetVertexColors();

            Assert.AreEqual(origVertexColorElement.GetMappingMode(), importVertexColorElement.GetMappingMode());
            Assert.AreEqual(origVertexColorElement.GetReferenceMode(), importVertexColorElement.GetReferenceMode());

            var origVertexColorElementArray   = origVertexColorElement.GetDirectArray();
            var importVertexColorElementArray = importVertexColorElement.GetDirectArray();

            Assert.AreEqual(origVertexColorElementArray.GetCount(), importVertexColorElementArray.GetCount());

            for (int i = 0; i < origVertexColorElementArray.GetCount(); i++)
            {
                Assert.AreEqual(origVertexColorElementArray.GetAt(i), importVertexColorElementArray.GetAt(i));
            }

            // 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));
            }
        }