Archived

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

Metus

my camera is on drugs....

Recommended Posts

well, 2 days and the camera''s still load-high on extasy... as far as I know, D3D uses the left-handed cartersian coordinate system (z increases into the screen, x increases to the right and y increases up), but since my camera''s on drugs, it''s weird: the init part:
Camera::Camera(...)
{
	{ // ----------
		D3DXMatrixIdentity(&m_rotation);
		D3DXMatrixIdentity(&m_camera);
		D3DXMatrixIdentity(&m_projection);
		D3DXMatrixIdentity(&m_translation);
	} // ----------

	m_yaw_r	= m_pitch_r = m_roll_r	= 0;

	D3DXMatrixPerspectiveLH(&m_projection, 1.25f, 1.f, 1.f, 100.f);
	core::vid::device->SetTransform(D3DTS_PROJECTION, &m_projection);
}
 
void Camera::update()
{
	D3DXMatrixTranslation(&m_translation, m_position.x, m_position.y, m_position.z);
	D3DXMatrixRotationYawPitchRoll(&m_rotation, m_yaw_r, m_pitch_r, m_roll_r);
	
	{ // -----
		D3DXMatrixTranspose(&m_rotation, &m_rotation);
	} // -----

	D3DXMatrixMultiply(&m_camera, &m_translation, &m_rotation);
	D3DXMatrixTranspose(&m_rotation, &m_rotation);	

	m_strafe.x = 1.f; m_orientation.x = 0.f; m_heading.x = 0.f;
	m_strafe.y = 0.f; m_orientation.y = 1.f; m_heading.y = 0.f;
	m_strafe.z = 0.f; m_orientation.z = 0.f; m_heading.z = 1.f;
	
	D3DXVec3TransformCoord(&m_heading,		&m_heading,		&m_rotation);
	D3DXVec3TransformCoord(&m_orientation,	&m_orientation, &m_rotation);
	D3DXVec3TransformCoord(&m_strafe,		&m_strafe,		&m_rotation);
	
	core::vid::device->SetTransform(D3DTS_VIEW, &m_camera);
}
 
are there any noticeable errors here...?

Share this post


Link to post
Share on other sites