コード例 #1
0
ファイル: ColladaHelper.cs プロジェクト: 0000duck/CoreRender
        public static List <Mesh> GetMeshes(CoreCollada.Collada file, CoreCollada.Node parent = null, float[] parentTransform = null, string path = "")
        {
            var result = new List <Mesh>();
            var nodes  = (parent != null) ? parent.Nodes : file.LibraryVisualScenes[0].Nodes;

            if (parentTransform == null)
            {
                /*parentTransform = (file.Asset.Unit.Meter != 1) ?
                 *  new float[] { file.Asset.Unit.Meter , file.Asset.Unit.Meter , file.Asset.Unit.Meter }.ScalingMatrix()
                 *  : new float[] { }.IdentityMatrix();*/
                parentTransform = new float[] { }.IdentityMatrix();
            }

            foreach (var node in nodes)
            {
                var transform = (node.MatrixValue != null) ?
                                node.MatrixValue.TransposeMatrix().MatrixProduct(parentTransform)
                    : parentTransform;

                if (node.InstanceGeometry != null)
                {
                    result.AddRange(GetStaticMeshes(file, node, transform, path));
                }

                if (node.InstanceController != null)
                {
                    result.AddRange(GetSkinnedMeshes(file, node, transform, path));
                }

                result.AddRange(GetMeshes(file, node, transform, path));
            }

            return(result);
        }
コード例 #2
0
ファイル: ColladaHelper.cs プロジェクト: 0000duck/CoreRender
        private static List <SkinnedMesh> GetSkinnedMeshes(CoreCollada.Collada file, CoreCollada.Node node, float[] transform = null, string path = "")
        {
            var result = new List <SkinnedMesh>();

            if (transform == null)
            {
                transform = new float[] { }
            }