当前位置: 首页>>代码示例>>C++>>正文


C++ GeometryPtr::Execute方法代码示例

本文整理汇总了C++中GeometryPtr::Execute方法的典型用法代码示例。如果您正苦于以下问题:C++ GeometryPtr::Execute方法的具体用法?C++ GeometryPtr::Execute怎么用?C++ GeometryPtr::Execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeometryPtr的用法示例。


在下文中一共展示了GeometryPtr::Execute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: DrawScene

void SDFShadowDemo::DrawScene()
{
    m_pRender->pImmPipeline->ClearBuffers(Colors::LightSteelBlue);

    //for (auto i = 0; i < m_vGeoms.size(); ++i)
    //{
    //	auto pData = m_pRender->pImmPipeline->MapResource(m_constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0);
    //	auto pBuffer = (CBufferType*)pData.pData;
    //	pBuffer->mat = m_vMats[i] * m_worldMat * m_viewMat * m_projMat;
    //	m_pRender->pImmPipeline->UnMapResource(m_constantBuffer, 0);
    //	m_pRender->pImmPipeline->ApplyPipelineResources();

    //	m_vGeoms[i]->Execute(m_pRender->pImmPipeline);
    //}

    ShaderStageStateDX11 vsState;
    vsState.ShaderProgram.SetState(m_vsID);
    m_pRender->pImmPipeline->VertexShaderStage.DesiredState = vsState;

    auto pData = m_pRender->pImmPipeline->MapResource(m_constantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0);
    auto pBuffer = (CBufferType*)pData.pData;
    pBuffer->matWorld = m_worldMat;
    pBuffer->matViewProj = m_viewMat * m_projMat;
    pBuffer->matViewProjInverse = (m_viewMat * m_projMat).Inverse();
    pBuffer->screenParams = Vector4f(static_cast<f32>(mClientWidth), static_cast<f32>(mClientHeight), 0.0f, 0.0f);
    pBuffer->SDFParams = m_sdfParams;
    pBuffer->SDFOrigin = m_sdfOrigin;
    pBuffer->cameraPos = m_cameraPos;
    m_pRender->pImmPipeline->UnMapResource(m_constantBuffer, 0);

    auto resource = m_pRender->GetResourceByIndex(m_constantBuffer->m_iResource);

    ShaderStageStateDX11 psState;
    psState.ShaderProgram.SetState(m_psID);
    psState.SamplerStates.SetState(0, m_pRender->GetSamplerState(m_samplerID).Get());
    psState.ShaderResourceViews.SetState(0, m_pRender->GetShaderResourceViewByIndex(m_SDFTex3D->m_iResourceSRV).GetSRV());
    psState.ConstantBuffers.SetState(0, (ID3D11Buffer*)resource->GetResource());
    m_pRender->pImmPipeline->PixelShaderStage.DesiredState = psState;

    m_pRender->pImmPipeline->ApplyPipelineResources();
    m_pQuad->Execute(m_pRender->pImmPipeline);

    m_pRender->Present(MainWnd(), 0);
}
开发者ID:CaptainJH,项目名称:forward,代码行数:44,代码来源:source.cpp


注:本文中的GeometryPtr::Execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。