示例#1
0
void pgCamera::SetDimension(const MtVector2 &v2Dimension)
{
	BtFloat width = v2Dimension.x;
	BtFloat height = v2Dimension.y;

	BtFloat fieldOfView = m_camera.FieldOfView();
	BtFloat nearPlane = m_camera.NearPlane();
	BtFloat farPlane = m_camera.FarPlane();
	m_camera = RsCamera(nearPlane, farPlane, width / height, RsViewport(0, 0, (BtU32)width, (BtU32)height), fieldOfView);
	m_camera.SetDimension(v2Dimension);
	m_camera.SetPerspective(BtTrue);
}
RsCamera::RsCamera()
{
	m_nearPlane   = 0.1f;
	m_farPlane    = 1000.0f;
	m_fieldOfView = MtDegreesToRadians( 60.0f );

	m_v3Position = MtVector3(0, 0, 0);	
	m_m3Orientation.SetIdentity();

	m_viewport = RsViewport( 0, 0, 0, 0 );
	m_aspect = 0;
	m_isPerspective = BtTrue;

	m_width = 0;
	m_height = 0;
}
示例#3
0
void pgCamera::Init()
{
	BtFloat width = (BtFloat)RsUtil::GetWidth();
	BtFloat height = (BtFloat)RsUtil::GetHeight();

	m_camera = RsCamera(0.1f, 10000.0f, width / height, RsViewport(0, 0, (BtU32)width, (BtU32)height), MtDegreesToRadians(60.0f));
	m_camera.SetDimension(RsUtil::GetDimension());
	m_camera.SetPerspective(BtTrue);

	m_cameraData.m_v3Position = MtVector3(0, 0, 0);
	m_cameraData.m_m3Rotation.SetIdentity();

	m_speed = 100.0f;
	m_cameraData.m_pitch = 0;
	m_cameraData.m_yaw = 0;
	m_isFlyCam = BtTrue;
}
示例#4
0
void SbPaint::SetupRenderToTexture()
{
	// Make a new render target
	RsRenderTarget *pRenderTarget = RsUtil::GetNewRenderTarget();

	// Set the render target name
	pRenderTarget->SetName( "painting" );

	// Make a new render target
	RsCamera camera( (BtFloat)m_width, (BtFloat)m_height, 0.01f, 10000.0f, RsViewport(0, 0, m_width, m_height) );

	// Update the camera
	camera.Update();

	// Set the texture
    RsTexture *pTexture = m_pRenderTarget->GetTexture(0);
    pRenderTarget->SetTexture( pTexture );

	// Set the camera
	pRenderTarget->SetCamera(camera);

	// Clear the render target
	if( m_isClear )
	{
		m_isClear = BtFalse;
	
		pRenderTarget->SetCleared( BtTrue );
	}
	else
	{
		pRenderTarget->SetCleared( BtFalse );
	}

	// Clear the z buffer
	pRenderTarget->SetZCleared( BtFalse );

	// Clear the screen to black
	pRenderTarget->SetClearColour( RsColour::WhiteColour() );
	
	// Apply this render target
	pRenderTarget->Apply();
}