Книга: DirectX 8 Programming Tutorial
Using the data
Using the data
In our Render3D function, we use the data that we have retrieved from the keyboard and mouse to alter the scene. The Render3D function is shown below:
void CGame::Render3D() {
//Render our 3D objects
D3DXMATRIX matEarth, matScale, matRotate, matEarthRoll, matEarthMove;
float rMouseSpeed = 20.0f;
//If left mouse button is down, stop the earth from rotating
if (m_nMouseLeft == 1) {
m_rRotate = 0.0f;
}
//If right mouse button is down, start the earth rotating at default speed
if (m_nMouseRight == 1) {
m_rRotate = 2.0f;
}
m_rAngle += m_rRotate;
//Create the transformation matrices
D3DXMatrixRotationY(&matRotate, D3DXToRadian(m_rAngle));
D3DXMatrixScaling(&matScale, m_rScale, m_rScale, m_rScale);
D3DXMatrixRotationYawPitchRoll(&matEarthRoll, 0.0f, 0.0f, D3DXToRadian(23.44f));
D3DXMatrixTranslation(&matEarthMove, (m_nMouseX / rMouseSpeed), –(m_nMouseY / rMouseSpeed), 0.0f);
D3DXMatrixMultiply(&matEarth, &matScale, &matRotate);
D3DXMatrixMultiply(&matEarth, &matEarth, &matEarthRoll);
D3DXMatrixMultiply(&matEarth, &matEarth, &matEarthMove);
//Render our objects
m_pD3DDevice->SetTransform(D3DTS_WORLD, &matEarth);
m_dwTotalPolygons += m_pSphere->Render();
}
- Data Binding Using the GridView Control
- Testing the Project
- Using X
- Managing Files with the Shell
- Piping Data
- Using backup and restore to move the DHCP database to a new server
- Информация заголовочной страницы (Database header)
- Database dialect
- 4.4.4 The Dispatcher
- DATABASE CACHE SIZE
- About the author
- Chapter 7. The state machine