/// <summary>
        /// Executes the post processing step on the given imported data.
        /// </summary>
        public void Execute(Scene scene)
        {
            // Check for an existent root node to proceed
            Debug.Assert(scene.RootNode != null);

            // recursively convert all the nodes
            ProcessNode(scene.RootNode, Matrix.Identity);

            // process the meshes accordingly
            foreach (var mesh in scene.Meshes)
            {
                ProcessMesh(mesh);
            }

            // process the materials accordingly
            foreach (var mat in scene.Materials)
            {
                ProcessMaterial(mat);
            }

            // transform all animation channels as well
            foreach (var anim in scene.Animations)
            {
                foreach (var nodeAnim in anim.Channels)
                {
                    ProcessAnimation(nodeAnim);
                }
            }
        }
Example #2
0
 public static List<FbxMesh> Load(string path, Device device, out Scene scene)
 {
     byte[] input;
     using (var stream = new FileStream(path, FileMode.Open))
     {
         input = new byte[stream.Length];
         stream.Read(input, 0, (int)stream.Length);
     }
     bool isBinary = false;
     List<Token> tokens;
     if (Encoding.ASCII.GetString(input, 0, 18) == "Kaydara FBX Binary")
     {
         isBinary = true;
         BinaryTokenizer.TokenizeBinary(out tokens, input, input.Length);
     }
     else
     {
         Tokenizer.Tokenize(out tokens, input);
     }
     var parser = new Parser(tokens, isBinary);
     var settings = ImporterSettings.Default;
     var doc = new Document(parser, settings);
     FbxConverter.ConvertToScene(out scene, doc);
     var result = new List<FbxMesh>();
     foreach (var assimpMesh in scene.Meshes)
     {
         var mat = scene.Materials[assimpMesh.MaterialIndex];
         var fbxMesh = new FbxMesh(assimpMesh, mat, device, path);
         result.Add(fbxMesh);
     }
     return result;
 }
 public void Execute(Scene scene)
 {
     foreach (var mesh in scene.Meshes)
     {
         ProcessMesh(mesh);
     }
 }
Example #4
0
 public void SetUp()
 {
     var assimpNetimporter = new Assimp.AssimpContext();
     Assimp.LogStream.IsVerboseLoggingEnabled = true;
     var logger = new Assimp.ConsoleLogStream();
     logger.Attach();
     assimpNetScene = assimpNetimporter.ImportFile(filename);
     logger.Detach();
     var assimpSharpImporter = new AssimpSharp.XFile.XFileImporter();
     assimpSharpScene = new AssimpSharp.Scene();
     assimpSharpImporter.InternReadFile(filename, assimpSharpScene);
 }
 public void Execute(Scene scene)
 {
 }