24,853
社区成员
发帖
与我相关
我的任务
分享static auto y {0.0f}; //y 就是旋转的角度, 会变化
IDirect3DDevice *device; //设备D3DXMATRIX y_rot {};
D3DXMatrixRotationY(&y_rot, y);
const D3DXMATRIX &world {y_rot};
device->SetTransform(D3DTS_WORLD, &world);D3DXVECTOR3 pos(0.0f, 0.0f, -5.0f);
D3DXVECTOR3 target(0.0f, 0.0f, 0.0f);
D3DXVECTOR up(0.0f, 1.0f, 0.0f);
D3DXMATRIX view {};
D3DXMatrixLookAtLH(&view, &pos, &target, &up);
device->SetTransform(D3DTS_VIEW, &view);
D3DXMATRIX proj {};
D3DXMatrixPerspectiveFovLH(&proj, D3DX_PI / 2.0f, static_cast<float>(window_width / window_height), 1.0f, 100.0f);
device->SetTransform(D3DTS_PROJECTION, &projection);