本文整理汇总了C++中QuadTree::getObjectsToDraw方法的典型用法代码示例。如果您正苦于以下问题:C++ QuadTree::getObjectsToDraw方法的具体用法?C++ QuadTree::getObjectsToDraw怎么用?C++ QuadTree::getObjectsToDraw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuadTree
的用法示例。
在下文中一共展示了QuadTree::getObjectsToDraw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FirstRenderCall
void FirstRenderCall()
{
//THIS IS THE START OF THE FIRST RENDERCALL
HRESULT hr;
float clearColor[] = { 0, 0, 0, 1 };
//float whiteColor[] = { 1, 1, 1, 1 };
//float grayColor[] = { 0.5, 0.5, 0.5 , 1 };
//clear all the RTV
gDeviceContext->ClearRenderTargetView(deferredViews[0], clearColor);
gDeviceContext->ClearRenderTargetView(deferredViews[1], clearColor);
gDeviceContext->ClearRenderTargetView(deferredViews[2], clearColor);
gDeviceContext->ClearRenderTargetView(deferredViews[3], clearColor);
gDeviceContext->ClearRenderTargetView(deferredViews[4], clearColor);
//clear depthbuffer
gDeviceContext->ClearDepthStencilView(gDepthBuffer, D3D11_CLEAR_DEPTH, 1, 0);
//get all the object in the part of the quad tree that the camera is in (must be used)
objectsToDraw = quadTree.getObjectsToDraw(WorldCamera.getCameraPos());
//does viewfustrum culling on the objects gathered from the quadtree (does not have to be used)
//objectsToDraw = WorldCamera.doFustrumCulling(objectsToDraw);
//set the OutputMerger to use the 5 RTV
gDeviceContext->OMSetRenderTargets(5, deferredViews, gDepthBuffer);
//enable the shaders
gDeviceContext->VSSetShader(vDeferredShader, NULL, 0);
gDeviceContext->GSSetShader(gGeometryShader, NULL, 0);
gDeviceContext->PSSetShader(pDeferredShader, NULL, 0);
//gDeviceContext->PSSetConstantBuffers(0, 1, &worldSpaceBuffer); //give the worldSpaceBuffer to the PixelShader
gDeviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); //set the topology
gDeviceContext->IASetInputLayout(gVertexLayout); //set the input layout
gDeviceContext->Draw(nrOfVertexDrawn, 0);
//renders all the individual objects and stores their values in the RTVs
for (int i = 0; i < objectsToDraw.size(); i++)
{
if (objectsToDraw.at(i) != nullptr)
{
Render(*objectsToDraw.at(i));
}
}
//FIRST RENDER CALL DONE
}