您的位置:首页 > 其它

【DX9】实现让绘制的物体旋转

2010-02-04 09:27 253 查看
下面这段代码利用了变形矩阵:

//
// spin the object:
//
D3DXMATRIX Rx, Ry;

// rotate 45 degrees on x-axis
D3DXMatrixRotationX(&Rx, 3.14f / 4.0f);

// incremement y-rotation angle each frame
static float y = 0.0f;
D3DXMatrixRotationY(&Ry, y);
y += timeDelta;

// reset angle to zero when angle reaches 2*PI
if( y >= 6.28f )
y = 0.0f;

// combine x- and y-axis rotation transformations.
D3DXMATRIX p = Rx * Ry;

Device->SetTransform(D3DTS_WORLD, &p);

记下了~
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: