Bootstrap

2024年大数据最全DirectX12(D3D12)基础教程(十七)—,2024年最新一年后斩获腾讯T3

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

1、必须要了解这里变换的真实含义。其实这里的变换即指线性代数意义上的变换,也指动画效果意义上的变换,最终在数学、程序、美工三者之间,达成了一种近乎完美的一致,那就是变换被定义或表达为三种基本变换的复合:缩放、旋转、位移。这三种变换无论在数学推导上,还是在程序表达上,还是在美工建模上都具有简单性、易理解性、易表达性!至于为什么是这三种基本变换,大家可以去复习下3D数学的相关基础知识即可明白,本文就不赘述了。

2、对于骨骼的一组完整的变换,比如人体走动的动作中的大腿与小腿间的关节的变换,往往不可能在一帧中就变换完毕,否则这个动作就会因为缺乏中间过程而显得“异常生硬”。所以这些完整变换过程,往往被按照一定的时间间隔切分为一组连续的变换数组,而被切分的每一个时刻点的一组变换数据就被称为骨骼动画的一个“关键帧(Keyframes)”(大多数情况下关键帧是指所有关节点在同一时间点的全部变换)。一般情况下关键帧都是按照均匀的时间间隔做切分的。在Assimp中就将这些针对每一个关节的关键帧数组都统一存储在aiScene对象中aiAnimation对象的aiNodeAnim子对象数组中。

struct aiScene
{
//......
    /\*\* The number of animations in the scene. \*/
    unsigned int mNumAnimations;

    /\*\* The array of animations.
 \*
 \* All animations imported from the given file are listed here.
 \* The array is mNumAnimations in size.
 \*/
    C_STRUCT aiAnimation\*\* mAnimations;
//......
};

struct aiAnimation {
    /\*\* The name of the animation. If the modeling package this data was
 \* exported from does support only a single animation channel, this
 \* name is usually empty (length is zero). \*/
    C_STRUCT aiString mName;

    /\*\* Duration of the animation in ticks. \*/
    double mDuration;

    /\*\* Ticks per second. 0 if not specified in the imported file \*/
    double mTicksPerSecond;

    /\*\* The number of bone animation channels. Each channel affects
 \* a single node. \*/
    unsigned int mNumChannels;

    /\*\* The node animation channels. Each channel affects a single node.
 \* The array is mNumChannels in size. \*/
    C_STRUCT aiNodeAnim\*\* mChannels;
//......
}

struct aiNodeAnim {
    /\*\* The name of the node affected by this animation. The node
 \* must exist and it must be unique.\*/
    C_STRUCT aiString mNodeName;

    /\*\* The number of position keys \*/
    unsigned int mNumPositionKeys;

    /\*\* The position keys of this animation channel. Positions are
 \* specified as 3D vector. The array is mNumPositionKeys in size.
 \*
 \* If there are position keys, there will also be at least one
 \* scaling and one rotation key.\*/
    C_STRUCT aiVectorKey\* mPositionKeys;

    /\*\* The number of rotation keys \*/
    unsigned int mNumRotationKeys;

    /\*\* The rotation keys of this animation channel. Rotations are
 \* given as quaternions, which are 4D vectors. The array is
 \* mNumRotationKeys in size.
 \*
 \* If there are rotation keys, there will also be at least one
 \* scaling and one position key. \*/
    C_STRUCT aiQuatKey\* mRotationKeys;

    /\*\*
;