【发布时间】:2010-11-09 22:15:03
【问题描述】:
这两段伪代码有什么区别?
// Multiplying a matrix by the difference between each frame
float difference = current - previous; // Time since previous frame
float angle = difference / 500;
matrix rotation;
rotation.RotateX(angle);
rotation.RotateY(angle);
worldMatrix *= rotation; // Note multiply
// Multiplying a matrix by the difference between current and start
float difference = current - start; // Time since first frame
float angle = difference / 500;
matrix rotation;
rotation.RotateX(angle);
rotation.RotateY(angle);
worldMatrix = rotation; // Note assignment
每段代码之间只有很小的差异,但会导致很大的视觉差异。输入如下所示:
第 1 帧:旋转 = 1 弧度
世界矩阵 *= 旋转;
第 2 帧:旋转 = 1 弧度
世界矩阵 *= 旋转;
等等……第 1 帧:旋转 = 1 弧度
worldMatrix = 旋转;
第 2 帧:旋转 = 2 弧度
worldMatrix = 旋转;
等等……
【问题讨论】:
标签: math opengl 3d matrix direct3d