本文整理汇总了C++中VertexShader::Activate方法的典型用法代码示例。如果您正苦于以下问题:C++ VertexShader::Activate方法的具体用法?C++ VertexShader::Activate怎么用?C++ VertexShader::Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VertexShader
的用法示例。
在下文中一共展示了VertexShader::Activate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Pulse
void Engine::Pulse()
{
this->window_->Pulse();
F32 clearColour[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
for (auto& rt : this->renderTargetViews_)
ImmediateContext->ClearRenderTargetView(rt, clearColour);
ImmediateContext->ClearDepthStencilView(
this->depthStencilView_, D3D11_CLEAR_DEPTH|D3D11_CLEAR_STENCIL, 1.0f, 0);
ID3D11ShaderResourceView* views[2] = {};
ImmediateContext->PSSetSamplers(0, 1, &this->samplerState_.p);
ImmediateContext->PSSetShaderResources(0, 2, views);
// Activate g-buffer render targets
ImmediateContext->OMSetRenderTargets(
this->renderTargetViews_.size() - 1,
reinterpret_cast<ID3D11RenderTargetView**>(
&this->renderTargetViews_[1].p),
this->depthStencilView_);
auto freeCamera = static_cast<FreeCamera*>(this->camera_.get());
freeCamera->Update();
vertexShader.Activate();
gridPixelShader.Activate();
floorMesh.Draw();
// Draw rotating gizmo
pixelShader.Activate();
auto seconds = this->timer_.GetSeconds();
gizmoMesh.SetPositionAngle(Vec3(1,1,1), Quat(Vec3(0, seconds, 0)));
gizmoMesh.Draw();
// Draw stationary gizmo
gizmoMesh.SetPositionAngle(Vec3(0,1,0), Quat());
gizmoMesh.Draw();
// Activate backbuffer
ImmediateContext->OMSetRenderTargets(
1, &this->renderTargetViews_[0].p, this->depthStencilView_);
ImmediateContext->PSSetShaderResources(0, this->renderTargetResourceViews_.size(),
reinterpret_cast<ID3D11ShaderResourceView**>(this->renderTargetResourceViews_.data()));
// Draw composite view to backbuffer
this->SetDepthEnabled(false);
identityVertexShader.Activate();
compositePixelShader.Activate();
screenMesh.SetScale(1.0f);
screenMesh.SetPosition(Vec3(0.0f, 0.0f, 0.0f));
screenMesh.Draw();
// Draw the source views on top
texturePixelShader.Activate();
for (U32 i = 0; i < this->renderTargetResourceViews_.size(); i++)
{
ImmediateContext->PSSetShaderResources(0, 1, &this->renderTargetResourceViews_[i].p);
screenMesh.SetScale(0.25f);
screenMesh.SetPosition(Vec3(-3.0f + i * 2.0f, 3.0f, 0.0f));
screenMesh.Draw();
}
this->SetDepthEnabled(true);
SwapChain->Present(0, 0);
this->frameCount_++;
if (this->fpsTimer_.GetSeconds() > 5)
{
LogInfo("FPS: %.01f", this->frameCount_ / this->fpsTimer_.GetSeconds());
this->fpsTimer_.Restart();
this->frameCount_ = 0;
}
}