基本上搞明白D3DXMatrixLookAtLH
D3DXMATRIX *WINAPI D3DXMatrixLookAtLH( D3DXMATRIX *pOut,
CONST D3DXVECTOR3 *pEye,
CONST D3DXVECTOR3 *pAt,
CONST D3DXVECTOR3 *pUp
);
这个函数用来控制摄影机,用来控制视图矩阵的。
pEye眼睛的位置,观察的方向。
pAt是摄影机的前进和后退,向左或向右。向上或向下。
pUp是向上的方向。
类MatrixAnimation简化了方向观察的处理。
//矩阵动画类
namespace MatrixA{
#include <d3dx9.h>
class MatrixAnimation{
public:
MatrixAnimation();
~MatrixAnimation();
virtual HRESULT SampleScalling(); //简单缩放
virtual HRESULT CountTime(); //计算时间间隔
public:
float maxX,maxY,maxZ;
float minX,minY,minZ;
bool scalFlag;
int relTime;
int curmTime; //毫秒级时间
int initTime; //初始时间
int Rate;
bool timeFlag;
int TransI; //标识位置
LPDIRECT3DDEVICE9* m_mad3dDevice; //ma - MatrixAnimation
//控制视图成员
float eyeX,eyeY,eyeZ;
float LookAtX,LookAtY,LookAtZ;
float UpX,UpY,UpZ;
HRESULT ResetView();
HRESULT LookAtUp();
HRESULT LookAtDown();
HRESULT LookAtLeft();
HRESULT LookAtRight();
HRESULT LookAtBack();
HRESULT LookAtFront();
};
}
浙公网安备 33010602011771号