Esempio n. 1
0
        protected virtual void CalculateTransforms()
        {
            ProfilerShort.Begin("MySkinnedEntity.CalculateTransforms");

            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("Clear bones");
            foreach (var bone in Bones)
            {
                bone.Translation = Vector3.Zero;
                bone.Rotation    = Quaternion.Identity;
            }
            VRageRender.MyRenderProxy.GetRenderProfiler().StartNextBlock("Update bones");

            UpdateBones();

            VRageRender.MyRenderProxy.GetRenderProfiler().StartNextBlock("ComputeAbsoluteTransforms");
            for (int i = 0; i < Bones.Count; i++)
            {
                MyCharacterBone bone = Bones[i];
                bone.ComputeAbsoluteTransform();
                m_boneRelativeTransforms[i] = bone.ComputeBoneTransform();
                BoneAbsoluteTransforms[i]   = bone.AbsoluteTransform;
            }
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();


            ProfilerShort.End();
        }
Esempio n. 2
0
        protected virtual void CalculateTransforms(float distance)
        {
            ProfilerShort.Begin("MySkinnedEntity.CalculateTransforms");

            VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("Clear bones");
            //foreach (var bone in Bones)
            //{
            //    bone.Translation = Vector3.Zero;
            //    bone.Rotation = Quaternion.Identity;
            //}
            VRageRender.MyRenderProxy.GetRenderProfiler().StartNextBlock("Update bones");

            if (!UseNewAnimationSystem)
            {
                UpdateBones(distance);
            }

            VRageRender.MyRenderProxy.GetRenderProfiler().StartNextBlock("ComputeAbsoluteTransforms");
            var characterBones = AnimationController.CharacterBones;

            for (int i = 0; i < characterBones.Length; i++)
            {
                MyCharacterBone bone = characterBones[i];
                bone.ComputeAbsoluteTransform();
                AnimationController.BoneRelativeTransforms[i] = bone.ComputeBoneTransform();  // MOVE TO ANIM CONTROLLER
                BoneAbsoluteTransforms[i] = bone.AbsoluteTransform;
            }
            VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock();


            ProfilerShort.End();
        }