void SCHEMA2SCENE.ApplyTo(Scene dstScene, Schema2SceneBuilder context) { if (!(Content is SCHEMA2NODE schema2Target)) { return; } // a skinned mesh is controlled indirectly by its bones, // so we need to create a dummy container for it: var skinnedMeshNode = dstScene.CreateNode(); skinnedMeshNode.Name = _NodeName; skinnedMeshNode.Extras = _NodeExtras; if (_MeshPoseWorldTransform.HasValue) { var dstNodes = new Node[_Joints.Count]; for (int i = 0; i < dstNodes.Length; ++i) { var(joints, inverseBindMatrix) = _Joints[i]; System.Diagnostics.Debug.Assert(!inverseBindMatrix.HasValue); dstNodes[i] = context.GetNode(joints); } #if DEBUG for (int i = 0; i < dstNodes.Length; ++i) { var(joints, inverseBindMatrix) = _Joints[i]; System.Diagnostics.Debug.Assert(dstNodes[i].WorldMatrix == joints.WorldMatrix); } #endif skinnedMeshNode.WithSkinBinding(_MeshPoseWorldTransform.Value.Matrix, dstNodes); } else { var skinnedJoints = _Joints .Select(j => (context.GetNode(j.Joint), j.InverseBindMatrix.Value)) .ToArray(); skinnedMeshNode.WithSkinBinding(skinnedJoints); } // set skeleton // var root = _Joints[0].Joint.Root; // skinnedMeshNode.Skin.Skeleton = context.GetNode(root); schema2Target.ApplyTo(skinnedMeshNode, context); Schema2SceneBuilder.SetMorphAnimation(skinnedMeshNode, this.Morphings); }
void SCHEMA2SCENE.ApplyTo(Scene dstScene, Schema2SceneBuilder context) { if (Content is SCHEMA2NODE schema2Target) { var dstNode = context.GetNode(_Node); schema2Target.ApplyTo(dstNode, context); Schema2SceneBuilder.SetMorphAnimation(dstNode, this.Morphings); System.Diagnostics.Debug.Assert(dstNode.WorldMatrix == this.GetPoseWorldMatrix(), "Transform mismatch!"); } }
void SCHEMA2SCENE.Setup(Scene dstScene, Schema2SceneBuilder context) { if (!(Content is SCHEMA2NODE schema2Target)) { return; } var dstNode = context.GetNode(_Node); schema2Target.Setup(dstNode, context); context.SetMorphAnimation(dstNode, this.Morphings); }
void SCHEMA2SCENE.Setup(Scene dstScene, Schema2SceneBuilder context) { if (!(Content is SCHEMA2NODE schema2Target)) { return; } var skinnedMeshNode = dstScene.CreateNode(); skinnedMeshNode.Name = _NodeName; if (_TargetBindMatrix.HasValue) { var dstNodes = new Node[_Joints.Count]; for (int i = 0; i < dstNodes.Length; ++i) { var(joints, inverseBindMatrix) = _Joints[i]; System.Diagnostics.Debug.Assert(!inverseBindMatrix.HasValue); dstNodes[i] = context.GetNode(joints); } #if DEBUG for (int i = 0; i < dstNodes.Length; ++i) { var(joints, inverseBindMatrix) = _Joints[i]; System.Diagnostics.Debug.Assert(dstNodes[i].WorldMatrix == joints.WorldMatrix); } #endif skinnedMeshNode.WithSkinBinding(_TargetBindMatrix.Value, dstNodes); } else { var skinnedJoints = _Joints .Select(j => (context.GetNode(j.Joints), j.InverseBindMatrix.Value)) .ToArray(); skinnedMeshNode.WithSkinBinding(skinnedJoints); } // set skeleton // var root = _Joints[0].Joint.Root; // skinnedMeshNode.Skin.Skeleton = context.GetNode(root); schema2Target.Setup(skinnedMeshNode, context); context.SetMorphAnimation(skinnedMeshNode, this.Morphings); }
void SCHEMA2SCENE.Setup(Scene dstScene, Schema2SceneBuilder context) { if (!(Content is SCHEMA2NODE schema2Target)) { return; } var dstNode = dstScene.CreateNode(); dstNode.LocalMatrix = _WorldTransform; schema2Target.Setup(dstNode, context); context.SetMorphAnimation(dstNode, this.Morphings); }