本文整理汇总了C++中IScene::GetCurrentCamera方法的典型用法代码示例。如果您正苦于以下问题:C++ IScene::GetCurrentCamera方法的具体用法?C++ IScene::GetCurrentCamera怎么用?C++ IScene::GetCurrentCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScene
的用法示例。
在下文中一共展示了IScene::GetCurrentCamera方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: applyWorldMatrices
void CEffectFileDirectX::applyWorldMatrices()
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
CBaseCamera* pCamera = pScene->GetCurrentCamera();
if (pCamera)
{
const Matrix4* pWorld = &(CGlobals::GetEffectManager()->GetWorldTransform());
const Matrix4* pView = &(CGlobals::GetEffectManager()->GetViewTransform());
const Matrix4* pProj = &(CGlobals::GetEffectManager()->GetProjTransform());
Matrix4 ViewProj;
// set the world matrix
if (isMatrixUsed(k_worldMatrix))
{
setMatrix(k_worldMatrix, pWorld);
}
// set the world inverse matrix
if (isMatrixUsed(k_worldInverseMatrix))
{
Matrix4 mWorldInverse;
mWorldInverse = pWorld->inverse();
setMatrix(k_worldInverseMatrix, &mWorldInverse);
}
// set the world view matrix
if (isMatrixUsed(k_worldViewMatrix))
{
Matrix4 mWorldView;
ParaMatrixMultiply(&mWorldView, pWorld, pView);
setMatrix(k_worldViewMatrix, &mWorldView);
}
// set the world view projection matrix
if (isMatrixUsed(k_worldViewProjMatrix))
{
ParaMatrixMultiply(&ViewProj, pView, pProj);
Matrix4 mWorldViewProj;
ParaMatrixMultiply(&mWorldViewProj, pWorld, &ViewProj);
setMatrix(k_worldViewProjMatrix, &mWorldViewProj);
}
}
}
示例2: applyCameraMatrices
void CEffectFileDirectX::applyCameraMatrices()
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
CBaseCamera* pCamera = pScene->GetCurrentCamera();
if (pCamera)
{
const Matrix4* pWorld = &(CGlobals::GetEffectManager()->GetWorldTransform());
const Matrix4* pView = &(CGlobals::GetEffectManager()->GetViewTransform());
const Matrix4* pProj = &(CGlobals::GetEffectManager()->GetProjTransform());
Matrix4 ViewProj;
// set the world matrix
if (isMatrixUsed(k_worldMatrix))
{
setMatrix(k_worldMatrix, pWorld);
}
// set the world inverse matrix
if (isMatrixUsed(k_worldInverseMatrix))
{
Matrix4 mWorldInverse;
mWorldInverse = pWorld->inverse();
setMatrix(k_worldInverseMatrix, &mWorldInverse);
}
// set the world view matrix
if (isMatrixUsed(k_worldViewMatrix))
{
Matrix4 mWorldView;
ParaMatrixMultiply(&mWorldView, pWorld, pView);
setMatrix(k_worldViewMatrix, &mWorldView);
}
// set the combined matrix
if (isMatrixUsed(k_viewProjMatrix))
{
ParaMatrixMultiply(&ViewProj, pView, pProj);
setMatrix(k_viewProjMatrix, &ViewProj);
}
// set the world view projection matrix
if (isMatrixUsed(k_worldViewProjMatrix))
{
if(!isMatrixUsed(k_viewProjMatrix))
ParaMatrixMultiply(&ViewProj, pView, pProj);
Matrix4 mWorldViewProj;
ParaMatrixMultiply(&mWorldViewProj, pWorld, &ViewProj);
setMatrix(k_worldViewProjMatrix, &mWorldViewProj);
}
// set the view matrix
if (isMatrixUsed(k_viewMatrix))
{
setMatrix(k_viewMatrix, pView);
}
// set the projection matrix
if (isMatrixUsed(k_projMatrix))
{
setMatrix(k_projMatrix, pProj);
}
// set the tex world view projection matrix
if (CGlobals::GetEffectManager()->IsUsingShadowMap() && isMatrixUsed(k_TexWorldViewProjMatrix))
{
Matrix4 mTex;
ParaMatrixMultiply(&mTex, pWorld, CGlobals::GetEffectManager()->GetTexViewProjMatrix());
setMatrix(k_TexWorldViewProjMatrix, &mTex);
}
// set the world camera position
if (isParameterUsed(k_cameraPos))
{
Vector3 vEye = pCamera->GetRenderEyePosition() - pScene->GetRenderOrigin();
setParameter(k_cameraPos, &Vector4(vEye.x,vEye.y, vEye.z, 1.0f));
}
// set the world camera facing vector
if (isParameterUsed(k_cameraFacing))
{
setParameter(k_cameraFacing, &pCamera->GetWorldAhead());
}
//// set the matrix used by sky boxes
//if (isMatrixUsed(k_skyBoxMatrix))
//{
// setMatrix(k_skyBoxMatrix, &pCamera->skyBoxMatrix());
//}
/*cVector4 camDistances(
pCamera->nearPlane(),
pCamera->farPlane(),
pCamera->viewDistance(),
pCamera->invFarPlane());
if (isParameterUsed(k_cameraDistances))
{
setParameter(k_cameraDistances, &camDistances);
}*/
}
}
示例3:
void ParaEngine::CEffectFileOpenGL::applyCameraMatrices()
{
IScene* pScene = CGlobals::GetEffectManager()->GetScene();
CBaseCamera* pCamera = pScene->GetCurrentCamera();
if (pCamera)
{
const Matrix4* pWorld = &(CGlobals::GetEffectManager()->GetWorldTransform());
const Matrix4* pView = &(CGlobals::GetEffectManager()->GetViewTransform());
const Matrix4* pProj = &(CGlobals::GetEffectManager()->GetProjTransform());
Matrix4 ViewProj;
// set the world matrix
if (isMatrixUsed(k_worldMatrix))
{
setMatrix(k_worldMatrix, pWorld);
}
// set the world inverse matrix
if (isMatrixUsed(k_worldInverseMatrix))
{
Matrix4 mWorldInverse;
mWorldInverse = pWorld->inverse();
setMatrix(k_worldInverseMatrix, &mWorldInverse);
}
// set the world view matrix
if (isMatrixUsed(k_worldViewMatrix))
{
Matrix4 mWorldView;
ParaMatrixMultiply(&mWorldView, pWorld, pView);
setMatrix(k_worldViewMatrix, &mWorldView);
}
// set the combined matrix
if (isMatrixUsed(k_viewProjMatrix))
{
ParaMatrixMultiply(&ViewProj, pView, pProj);
setMatrix(k_viewProjMatrix, &ViewProj);
}
// set the world view projection matrix
if (isMatrixUsed(k_worldViewProjMatrix))
{
if (!isMatrixUsed(k_viewProjMatrix))
ParaMatrixMultiply(&ViewProj, pView, pProj);
Matrix4 mWorldViewProj;
ParaMatrixMultiply(&mWorldViewProj, pWorld, &ViewProj);
setMatrix(k_worldViewProjMatrix, &mWorldViewProj);
}
// set the view matrix
if (isMatrixUsed(k_viewMatrix))
{
setMatrix(k_viewMatrix, pView);
}
// set the projection matrix
if (isMatrixUsed(k_projMatrix))
{
setMatrix(k_projMatrix, pProj);
}
// set the tex world view projection matrix
if (CGlobals::GetEffectManager()->IsUsingShadowMap() && isMatrixUsed(k_TexWorldViewProjMatrix))
{
Matrix4 mTex;
ParaMatrixMultiply(&mTex, pWorld, CGlobals::GetEffectManager()->GetTexViewProjMatrix());
setMatrix(k_TexWorldViewProjMatrix, &mTex);
}
// set the world camera position
if (isParameterUsed(k_cameraPos))
{
Vector3 vEye = pCamera->GetRenderEyePosition() - pScene->GetRenderOrigin();
setParameter(k_cameraPos, &vEye);
}
// set the world camera facing vector
if (isParameterUsed(k_cameraFacing))
{
Vector3 v = pCamera->GetWorldAhead();
setParameter(k_cameraFacing, &v);
}
}
}