本文整理汇总了C++中IVideoDriver::clearDepthStencil方法的典型用法代码示例。如果您正苦于以下问题:C++ IVideoDriver::clearDepthStencil方法的具体用法?C++ IVideoDriver::clearDepthStencil怎么用?C++ IVideoDriver::clearDepthStencil使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IVideoDriver
的用法示例。
在下文中一共展示了IVideoDriver::clearDepthStencil方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generateShadowMap
void CPointLightNode::generateShadowMap(ICameraNode* viewCamera)
{
ITextureManager* tmgr = ITextureManager::getInstance();
if (mCastShadow)
{
if (!mShadowMapTexture)
{
std::string name = "_point_shadow_map_";
name += getId();
mShadowMapTexture = tmgr->createTextureCube(name, mShadowMapWidth,
ETBT_SHADER_RESOURCE | ETBT_RENDER_TARGET, nullptr, 1, EGF_R32_FLOAT);
}
ICameraNode* camera = mSceneManager->getActiveCameraNode();
camera->setPerspectiveProjection(true);
XMFLOAT3 pos = getAbsolutePosition();
camera->setPosition(pos);
camera->setFovAngle(XM_PIDIV2);
camera->setNearZ(0.1f);
camera->setFarZ(mLightData.Range);
camera->setAspectRatio(1.0f);
//const
const static XMFLOAT3 looks[] = {
XMFLOAT3(1.0f, 0, 0), //+x
XMFLOAT3(-1.0f, 0, 0), //-x
XMFLOAT3(0, 1.0f, 0), //+y
XMFLOAT3(0, -1.0f, 0), //-y
XMFLOAT3(0, 0, 1.0f), //+z
XMFLOAT3(0, 0, -1.0f) //-z
};
const static XMFLOAT3 ups[] = {
XMFLOAT3(0.0f, 1.0f, 0.0f), // +X
XMFLOAT3(0.0f, 1.0f, 0.0f), // -X
XMFLOAT3(0.0f, 0.0f, -1.0f), // +Y
XMFLOAT3(0.0f, 0.0f, +1.0f), // -Y
XMFLOAT3(0.0f, 1.0f, 0.0f), // +Z
XMFLOAT3(0.0f, 1.0f, 0.0f) // -Z
};
IVideoDriver* driver = mSceneManager->getVideoDriver();
IDepthStencilSurface* pDepthStencilSurface = tmgr->getTempDepthStencilSurface(
mShadowMapWidth, mShadowMapWidth, 32, 0);
driver->setPipelineUsage(EPU_POINT_SHADOW_MAP);
for (u32 i = 0; i < 6; i++)
{
camera->look(looks[i], ups[i]);
camera->updateAbsoluteTransformation();
IRenderTarget* pRenderTarget = mShadowMapTexture->getRenderTarget(i);
driver->setRenderTargetAndDepthStencil(pRenderTarget, pDepthStencilSurface);
const f32 clearColor[] = { 1000.0f, 1000.0f, 1000.0f, 1000.0f };
pRenderTarget->clear(clearColor);
driver->clearDepthStencil(1.0f, 0);
mSceneManager->drawShadowMap(this);
}
tmgr->releaseTempDepthStencilSurface(pDepthStencilSurface);
}
}