Archived

This topic is now archived and is closed to further replies.

shakazed

Rotate my camera!

Recommended Posts

Grrr, now I´ve tried to use quats to rotate my camera around it´s own axis but when I try to do this I get nothing on my screen. What am I doing wrong? I really don´t know anythiing about quats....or maybe some but I just want to get this working asap Any help appreciated!
  
void cGraphics::RenderBox(void)
{
	D3DXMATRIX matWorld;
	D3DXMatrixIdentity(&matWorld);
	m_iD3DDevice8->SetTransform(D3DTS_WORLD, &matWorld);

		
	D3DXMATRIX m_matView;
	D3DXMATRIX m_matOrientation; 
	D3DXQUATERNION qR;  

	D3DXQuaternionRotationYawPitchRoll(&qR, 0.0f, 0.0f, 0.0f);  
	D3DXMatrixAffineTransformation(&m_matOrientation, 1.25f, NULL, &qR, &D3DXVECTOR3(0.0f,0.0f,0.0f));  
	D3DXMatrixInverse( &m_matView, NULL, &m_matOrientation );  
	m_iD3DDevice8->SetTransform(D3DTS_VIEW, &m_matView);


	D3DXMATRIX matProj;
	D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4, 1.0f, 1.0f, 100.0f);
	m_iD3DDevice8->SetTransform(D3DTS_PROJECTION, &matProj);


	m_iD3DDevice8->SetTexture(0, m_iD3DBoxTexture8); //Set the texture

	m_iD3DDevice8->SetStreamSource(0, m_iD3DBoxVertBuf8, sizeof(CUSTOMVERTEX));
	m_iD3DDevice8->SetVertexShader(MY_FVF);
	m_iD3DDevice8->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0,2);
}

  

Bad Monkey Productions

Share this post


Link to post
Share on other sites