コード例 #1
0
/*
* SetFOV
* @author Rigardt de Vries
* @param _fFOV			file of view
* @return void
*/
void 
CCamera::SetFOV(float32 _fFOV)
{
	m_fFOV = _fFOV;

	ResetMatrices();
}
コード例 #2
0
/*
* SetClipPlanes
* @author Rigardt de Vries
* @param _fNear		the near clip plane
* @param _fFar		the far clip plane
* @return void
*/
void 
CCamera::SetClipPlanes(float32 _fNear, float32 _fFar)
{
	m_fNear = _fNear;
	m_fFar = _fFar;

	ResetMatrices();
}
コード例 #3
0
/*
* Initialise
* @author Rigardt de Vries
* @param _pViewPort		owning viewport
* @param _fFOV			field of view
* @param _eMode			camera mode
* @param _fNearClip		near clip plane
* @param _fFarClip		far clip plane
* @param _uiID			camera ID
* @return bool
*/
bool
CCamera::Initialise(CViewport* _pViewport, float32 _fFOV, 
				float32 _fNearClip, float32 _fFarClip, uint32 _uiID)
{
	if (!_pViewport)
	{
		return (false);
	}

	m_pViewport = _pViewport;

	m_fFar = _fFarClip;
	m_fNear = _fNearClip;
	m_fFOV = _fFOV;
	m_uiID = _uiID;

	ResetMatrices();

	return (true);
}
コード例 #4
0
void NsRendererOGL3::BeginDraw(NsCamera * pCamera)
{
	glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );

	glClearDepth(1);

	glColorMask( GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE );

	glEnable( GL_DEPTH_TEST );
	glDepthMask( GL_TRUE );
	glDepthFunc( GL_LESS );

	glFrontFace( GL_CCW );
	glEnable( GL_CULL_FACE );
	glCullFace( GL_BACK );

	glPolygonMode( GL_FRONT, GL_FILL );

	ResetMatrices();

	NsMatrix4  projectionMatrix;
	projectionMatrix.BuildPerspectiveLH(
		pCamera->fovY,
		pCamera->aspect,
		pCamera->nearZ,
		pCamera->farZ
	);
	SetProjectionMatrix( projectionMatrix );

	NsMatrix4  viewMatrix(
		BuildLookAtMatrixLH(
			pCamera->viewOrigin,
			pCamera->GetLookDirection(),
			pCamera->GetUp()
	));

	SetViewMatrix( viewMatrix );
}