home | login | register | DMCA | contacts | help | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z


my bookshelf | genres | recommend | rating of books | rating of authors | reviews | new | | collections | | | add
fantasy
space fantasy
fantasy is horrors
heroic
prose
  military
  child
  russian
detective
  action
  child
  ironical
  historical
  political
western
adventure
adventure (child)
child's stories
love
religion
antique
Scientific literature
biography
business
home pets
animals
art
history
computers
linguistics
mathematics
religion
home_garden
sport
technique
publicism
philosophy
chemistry
close

Loading...


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();

}


Getting mouse data | DirectX 8 Programming Tutorial | Cleaning up







Loading...