(continued...)

KRMesh::renderSubmesh is now private.
Added KRMesh::renderNoMaterials.
Replaced renderSubmesh loops outside KRMesh with calls to KRMesh::renderNoMaterials.
Added KRMesh::getVertexAttributes.
Call sites are now using KRMesh::getVertexAttributes and KRMesh::getModelFormat to configure the pipeline.
This commit is contained in:
2022-07-06 23:11:00 -07:00
parent 93d665b356
commit 85b7b2cd31
6 changed files with 83 additions and 63 deletions

View File

@@ -127,27 +127,28 @@ void KRAmbientZone::render(RenderInfo& ri)
bool bVisualize = ri.camera->settings.debug_display == KRRenderSettings::KRENGINE_DEBUG_DISPLAY_SIREN_AMBIENT_ZONES;
if(ri.renderPass == KRNode::RENDER_PASS_FORWARD_TRANSPARENT && bVisualize) {
Matrix4 sphereModelMatrix = getModelMatrix();
std::vector<KRMesh*> sphereModels = getContext().getMeshManager()->getModel("__sphere");
if (sphereModels.size()) {
PipelineInfo info{};
std::string shader_name("visualize_overlay");
info.shader_name = &shader_name;
info.pCamera = ri.camera;
info.point_lights = &ri.point_lights;
info.directional_lights = &ri.directional_lights;
info.spot_lights = &ri.spot_lights;
info.renderPass = ri.renderPass;
info.rasterMode = PipelineInfo::RasterMode::kAdditive;
Matrix4 sphereModelMatrix = getModelMatrix();
PipelineInfo info{};
std::string shader_name("visualize_overlay");
info.shader_name = &shader_name;
info.pCamera = ri.camera;
info.point_lights = &ri.point_lights;
info.directional_lights = &ri.directional_lights;
info.spot_lights = &ri.spot_lights;
info.renderPass = ri.renderPass;
info.rasterMode = PipelineInfo::RasterMode::kAdditive;
info.modelFormat = sphereModels[0]->getModelFormat();
info.vertexAttributes = sphereModels[0]->getVertexAttributes();
KRPipeline *pPipeline = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
pPipeline->bind(*ri.camera, ri.viewport, sphereModelMatrix, &ri.point_lights, &ri.directional_lights, &ri.spot_lights, ri.renderPass, Vector3::Zero(), 0.0f, Vector4::Zero());
KRPipeline *pPipeline = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
pPipeline->bind(*ri.camera, ri.viewport, sphereModelMatrix, &ri.point_lights, &ri.directional_lights, &ri.spot_lights, ri.renderPass, Vector3::Zero(), 0.0f, Vector4::Zero());
std::vector<KRMesh *> sphereModels = getContext().getMeshManager()->getModel("__sphere");
if(sphereModels.size()) {
for(int i=0; i < sphereModels[0]->getSubmeshCount(); i++) {
sphereModels[0]->renderSubmesh(ri.commandBuffer, i, ri.renderPass, getName(), "visualize_overlay", 1.0f);
}
}
sphereModels[0]->renderNoMaterials(ri.commandBuffer, ri.renderPass, getName(), "visualize_overlay", 1.0f);
} // sphereModels.size()
}
}