Beispiel #1
0
        private void UpdateCharacterSkeleton()
        {
            if (!m_sentSkeletonMessage)
            {
                m_sentSkeletonMessage = true;
                var skeletonDescription = new MySkeletonBoneDescription[m_character.Bones.Count];

                for (int i = 0; i < m_character.Bones.Count; i++)
                {
                    skeletonDescription[i].Parent = -1;
                    if (m_character.Bones[i].Parent != null)
                    {
                        for (int j = 0; j < m_character.Bones.Count; j++)
                        {
                            if (m_character.Bones[j].Name == m_character.Bones[i].Parent.Name)
                            {
                                skeletonDescription[i].Parent = j;
                                break;
                            }
                        }
                    }

                    if (m_character.Bones[i].Parent != null)
                    {
                        Debug.Assert(skeletonDescription[i].Parent > -1, "Can't find bone with parent name!");
                    }

                    skeletonDescription[i].SkinTransform = m_character.Bones[i].SkinTransform;
                }

                VRageRender.MyRenderProxy.SetCharacterSkeleton(RenderObjectIDs[0], skeletonDescription, Model.Animations.Skeleton.ToArray());
            }
        }
        private void UpdateCharacterSkeleton()
        {
            if (!m_sentSkeletonMessage)
            {
                m_sentSkeletonMessage = true;
                var characterBones      = m_skinnedEntity.AnimationController.CharacterBones;
                var skeletonDescription = new MySkeletonBoneDescription[characterBones.Length];

                for (int i = 0; i < characterBones.Length; i++)
                {
                    if (characterBones[i].Parent == null)
                    {
                        skeletonDescription[i].Parent = -1;
                    }
                    else
                    {
                        skeletonDescription[i].Parent = characterBones[i].Parent.Index;
                    }

                    skeletonDescription[i].SkinTransform = characterBones[i].SkinTransform;
                }

                MyRenderProxy.SetCharacterSkeleton(RenderObjectIDs[0], skeletonDescription, Model.Animations.Skeleton.ToArray());
            }
        }
        internal void SetSkeleton(MySkeletonBoneDescription[] hierarchy, int[] skeletonIndices)
        {
            m_skeletonHierarchy = hierarchy;
            m_skeletonIndices = skeletonIndices;

            m_skinTransforms = new Matrix[m_skeletonHierarchy.Length];
            m_absoluteTransforms = new Matrix[m_skeletonHierarchy.Length];

            Owner.MarkRenderDirty();
        }
Beispiel #4
0
 private void UpdateCharacterSkeleton()
 {
     if (!this.m_sentSkeletonMessage)
     {
         this.m_sentSkeletonMessage = true;
         MyCharacterBone[]           characterBones = this.m_skinnedEntity.AnimationController.CharacterBones;
         MySkeletonBoneDescription[] skeletonBones  = new MySkeletonBoneDescription[characterBones.Length];
         int index = 0;
         while (true)
         {
             if (index >= characterBones.Length)
             {
                 MyRenderProxy.SetCharacterSkeleton(base.RenderObjectIDs[0], skeletonBones, base.Model.Animations.Skeleton.ToArray());
                 break;
             }
             skeletonBones[index].Parent        = (characterBones[index].Parent != null) ? characterBones[index].Parent.Index : -1;
             skeletonBones[index].SkinTransform = characterBones[index].SkinTransform;
             index++;
         }
     }
 }
        private void UpdateCharacterSkeleton()
        {
            if (!m_sentSkeletonMessage)
            {
                m_sentSkeletonMessage = true;
                var characterBones = m_skinnedEntity.AnimationController.CharacterBones;
                var skeletonDescription = new MySkeletonBoneDescription[characterBones.Length];

                for (int i = 0; i < characterBones.Length; i++)
                {
                    if (characterBones[i].Parent == null)
                        skeletonDescription[i].Parent = -1;
                    else
                        skeletonDescription[i].Parent = characterBones[i].Parent.Index;

                    skeletonDescription[i].SkinTransform = characterBones[i].SkinTransform;
                }

                MyRenderProxy.SetCharacterSkeleton(RenderObjectIDs[0], skeletonDescription, Model.Animations.Skeleton.ToArray());
            }
        }
        public static void SetCharacterSkeleton(
            uint characterID,
            MySkeletonBoneDescription[] skeletonBones,
            int[] skeletonIndices
            )
        {
            var message = MessagePool.Get<MyRenderMessageSetCharacterSkeleton>(MyRenderMessageEnum.SetCharacterSkeleton);

            message.CharacterID = characterID;
            message.SkeletonBones = skeletonBones;
            message.SkeletonIndices = skeletonIndices;

            EnqueueMessage(message);
        }