本文整理汇总了C++中CLight::GetDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ CLight::GetDirection方法的具体用法?C++ CLight::GetDirection怎么用?C++ CLight::GetDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLight
的用法示例。
在下文中一共展示了CLight::GetDirection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RenderChunks
//------------------------------------------------------------------------
// isRenderTerrainBuffer : true 이면 m_pTerrainSurf 버퍼에 지형을 출력한다.
// isRenderDeptBuffer : true 이면 깊이버퍼에 깊이값을 저장한다.
// [2011/2/28 jjuiddong]
//------------------------------------------------------------------------
void CChunkManager::RenderChunks(BOOL isRenderTerrainBuffer, BOOL isRenderDeptBuffer)
{
LPDIRECT3DSURFACE9 pOldBackBuffer = NULL;
LPDIRECT3DSURFACE9 pOldZBuffer = NULL;
if (isRenderTerrainBuffer)
{
g_pDevice->GetRenderTarget(0, &pOldBackBuffer);
//g_pDevice->GetDepthStencilSurface(&pOldZBuffer);
g_pDevice->SetRenderTarget(0, m_pTerrainSurf);
//g_pDevice->SetDepthStencilSurface(m_pZ);
g_pDevice->Clear(0L, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0L);
}
m_pShader->Begin();
Matrix44 mWVP;
g_Camera.GetViewProjMatrix(&mWVP);
m_pShader->SetMatrix("mWVP", mWVP);
Matrix44 mWVPB = mWVP * m_mScaleBias;
m_pShader->SetMatrix("mWVPB", mWVPB);
// 광원방향
CLight *pLight = m_pTerrain->GetLight();
Vector3 lightPos = pLight->GetDirection();
D3DXVECTOR4 v(lightPos.x, lightPos.y, lightPos.z, -0.3f); // -0.3f 환경광의 강도
m_pShader->SetVector( "vLightDir", v);
// 시점
Vector3 eyePos = g_Camera.GetPosition();
m_pShader->SetVector( "vEyePos", eyePos);
for (int i=0; i < m_ChunkSize; ++i)
m_pChunk[ i].Render(m_pShader, 0);
// g_pDevice->SetRenderTarget(0, m_pTerrainDepthSurf);
// g_pDevice->Clear(0L, NULL, D3DCLEAR_TARGET, 0x00, 1.0f, 0L);
m_pShader->End();
m_pWater->Render();
if (isRenderDeptBuffer)
{
// g_pDevice->SetRenderTarget(0, m_pTerrainDepthSurf);
// g_pDevice->Clear(0L, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0x00, 1.0f, 0L);
//
// for (int i=0; i < m_ChunkSize; ++i)
// m_pChunk[ i].Render(m_pShader, 1);
}
if (isRenderTerrainBuffer)
{
g_pDevice->SetRenderTarget(0, pOldBackBuffer);
//g_pDevice->SetDepthStencilSurface(pOldZBuffer);
pOldBackBuffer->Release();
//pOldZBuffer->Release();
}
}
示例2:
void
Moose::Graphics::UniformLights::SetData(int index, CLight & l, COglRenderer & r )
{
enabled[index].SetData(l.IsEnabled());
diffuse[index].SetData(&l.GetDiffuseColor());
ambient[index].SetData(&l.GetAmbientColor());
specular[index].SetData(&l.GetSpecularColor());
position[index].SetData(&l.GetPosition());
direction[index].SetData(&l.GetDirection());
halfVector[index].SetData((r.GetCurrentCamera()->GetPosition()-l.GetPosition()).GetNormalized());
spotAngle[index].SetData(l.GetSpotAngle());
spotExponent[index].SetData(l.GetSpotExponent());
constantAttenuation[index].SetData(l.GetConstantAttenuation());
linearAttenuation[index].SetData(l.GetLinearAttenuation());
quadraticAttenuation[index].SetData(l.GetQuadraticAttenuation());
}