【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);
记下了~
//
// 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);
记下了~
相关文章推荐
- 实现立体状物体的旋转展示
- 【Unity快速实现小功能】实现物体绕轴旋转
- unity实现鼠标让物体绕世界Y轴旋转_C#
- [原创]unity3D学习【功能实现】之二:图片的旋转/2d物体的旋转
- css3-transform-matrix 即矩阵实现物体旋转、缩放、移动效果
- 在MFC中,运用轨迹球算法实现鼠标旋转物体
- OpenGL绘制简单场景,实现旋转缩放平移和灯光效果
- GDI+绘制矩形,并且实现可旋转、缩放、移动功能(基于MFC对话框)
- 实现物体的左右旋转
- Android开发:ImageView上绘制旋转圆环(透明度不同的旋转圆环,利用canvas.drawArc实现)
- 一行代码实现一个物体保持面向另一个物体(旋转) .
- Unity 3D 中实现对物体 位置(position) 旋转(rotation) 大小(scale) 的全面控制
- unity中通过收拾实现物体旋转和放大缩小
- three.js实现围绕某物体旋转
- ImageView上绘制旋转圆环(透明度不同的旋转圆环,利用canvas.drawArc实现) .
- css效果实现一个物体的旋转小demo
- Unity3d物体模型(实现旋转缩放平移自动旋转)
- unity 3d中简单巧妙的实现拖动鼠标旋转物体
- 实现物体绕不同轴旋转,并可以外部调用的函数
- Unity3D实现点击物体旋转