First runnable render loop
This commit is contained in:
@@ -10,6 +10,7 @@ BasePassMeshProcessor::BasePassMeshProcessor(const PScene scene, Gfx::PViewport
|
||||
: MeshProcessor(scene, graphics)
|
||||
, target(viewport)
|
||||
, translucentBasePass(translucentBasePass)
|
||||
, cachedPrimitiveIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -23,7 +24,7 @@ void BasePassMeshProcessor::addMeshBatch(
|
||||
const Gfx::PRenderPass renderPass,
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PDescriptorLayout primitiveLayout,
|
||||
Array<Gfx::PDescriptorSet> descriptorSets,
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 staticMeshId)
|
||||
{
|
||||
const PMaterialAsset material = batch.material;
|
||||
@@ -42,13 +43,12 @@ void BasePassMeshProcessor::addMeshBatch(
|
||||
}
|
||||
Gfx::PRenderCommand renderCommand = graphics->createRenderCommand();
|
||||
renderCommand->setViewport(target);
|
||||
uint32 primitiveDescriptorIndex = 0;
|
||||
for(uint32 i = 0; i < batch.elements.size(); ++i)
|
||||
{
|
||||
pipelineLayout->addDescriptorLayout(2, material->getRenderMaterial()->getDescriptorLayout());
|
||||
pipelineLayout->create();
|
||||
descriptorSets[2] = material->getDescriptor();
|
||||
descriptorSets[3] = cachedPrimitiveSets[primitiveDescriptorIndex++];
|
||||
descriptorSets[3] = cachedPrimitiveSets[cachedPrimitiveIndex++];
|
||||
buildMeshDrawCommand(batch,
|
||||
// primitiveComponent,
|
||||
renderPass,
|
||||
@@ -74,6 +74,7 @@ void BasePassMeshProcessor::clearCommands()
|
||||
{
|
||||
renderCommands.clear();
|
||||
cachedPrimitiveSets.clear();
|
||||
cachedPrimitiveIndex = 0;
|
||||
}
|
||||
|
||||
BasePass::BasePass(const PScene scene, Gfx::PGraphics graphics, Gfx::PViewport viewport, PCameraActor source)
|
||||
@@ -140,7 +141,6 @@ void BasePass::beginFrame()
|
||||
uniformUpdate.size = sizeof(LightEnv);
|
||||
uniformUpdate.data = (uint8*)&scene->getLightEnvironment();
|
||||
lightUniform->updateContents(uniformUpdate);
|
||||
descriptorSets[0]->beginFrame();
|
||||
descriptorSets[0]->updateBuffer(0, lightUniform);
|
||||
descriptorSets[0]->writeChanges();
|
||||
|
||||
@@ -155,7 +155,6 @@ void BasePass::beginFrame()
|
||||
uniformUpdate.size = sizeof(ScreenToViewParameter);
|
||||
uniformUpdate.data = (uint8*)&screenToViewParams;
|
||||
screenToViewParamBuffer->updateContents(uniformUpdate);
|
||||
descriptorSets[1]->beginFrame();
|
||||
descriptorSets[1]->updateBuffer(0, viewParamBuffer);
|
||||
descriptorSets[1]->updateBuffer(1, screenToViewParamBuffer);
|
||||
descriptorSets[1]->writeChanges();
|
||||
|
||||
@@ -16,13 +16,14 @@ public:
|
||||
const Gfx::PRenderPass renderPass,
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PDescriptorLayout primitiveLayout,
|
||||
Array<Gfx::PDescriptorSet> descriptorSets,
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 staticMeshId = -1) override;
|
||||
Array<Gfx::PRenderCommand> getRenderCommands();
|
||||
void clearCommands();
|
||||
private:
|
||||
Array<Gfx::PRenderCommand> renderCommands;
|
||||
Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
uint32 cachedPrimitiveIndex;
|
||||
Gfx::PViewport target;
|
||||
uint8 translucentBasePass;
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@ void MeshProcessor::buildMeshDrawCommand(
|
||||
const Gfx::PRenderPass renderPass,
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PRenderCommand drawCommand,
|
||||
Array<Gfx::PDescriptorSet> descriptors,
|
||||
const Array<Gfx::PDescriptorSet>& descriptors,
|
||||
Gfx::PVertexShader vertexShader,
|
||||
Gfx::PControlShader controlShader,
|
||||
Gfx::PEvaluationShader evaluationShader,
|
||||
|
||||
@@ -20,7 +20,7 @@ protected:
|
||||
const Gfx::PRenderPass renderPass,
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PDescriptorLayout primitiveLayout,
|
||||
Array<Gfx::PDescriptorSet> descriptorSets,
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 staticMeshId = -1) = 0;
|
||||
void buildMeshDrawCommand(
|
||||
const MeshBatch& meshBatch,
|
||||
@@ -28,7 +28,7 @@ protected:
|
||||
const Gfx::PRenderPass renderPass,
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PRenderCommand drawCommand,
|
||||
Array<Gfx::PDescriptorSet> descriptors,
|
||||
const Array<Gfx::PDescriptorSet>& descriptors,
|
||||
Gfx::PVertexShader vertexShader,
|
||||
Gfx::PControlShader controlShader,
|
||||
Gfx::PEvaluationShader evaluationShader,
|
||||
|
||||
Reference in New Issue
Block a user