更新时间:2023-11-20 19:49:22
XNA SpriteBatch 在 Client Space 中工作.其中向上"是 Y-,而不是 Y+(如笛卡尔空间、投影空间以及大多数人通常为他们的世界空间选择的空间).这使得旋转显示为顺时针(不像在笛卡尔空间中那样逆时针).旋转产生的实际坐标是相同的.
The XNA SpriteBatch works in Client Space. Where "up" is Y-, not Y+ (as in Cartesian space, projection space, and what most people usually select for their world space). This makes the rotation appear as clockwise (not counter-clockwise as it would in Cartesian space). The actual coordinates the rotation is producing are the same.
旋转是相对的,因此它们不会真正从任何指定位置开始".
Rotations are relative, so they don't really "start" from any specified position.
如果您正在使用诸如 sin
或 cos
或 atan2
之类的数学函数,那么绝对角度总是从X+轴为零弧度,正旋转方向向Y+旋转.
If you are using maths functions like sin
or cos
or atan2
, then absolute angles always start from the X+ axis as zero radians, and the positive rotation direction rotates towards Y+.
SpriteBatch
的操作顺序如下所示:
The order of operations of SpriteBatch
looks something like this:
SourceRectangle
)相同.SpriteBatch.Begin
中的矩阵SourceRectangle
).SpriteBatch.Begin
这会将精灵放置在客户端空间中.
This places the sprite in Client Space.
最后,将矩阵应用于每个批次,以将该客户空间转换为 GPU 使用的投影空间.(投影空间从视口左下角的 (-1,-1) 到右上角的 (1,1).)
Finally a matrix is applied to each batch to transform that Client Space into the Projection Space used by the GPU. (Projection space is from (-1,-1) at the bottom left of the viewport, to (1,1) in the top right.)