Implement KRNode::RenderInfo
Use KRNode::RenderInfo to reduce render related argument counts and pass KRSurface through render functions. Refactor render functions to use KRNode::RenderInfo
This commit is contained in:
@@ -118,29 +118,29 @@ void KRAmbientZone::setZone(const std::string &zone)
|
||||
m_zone = zone;
|
||||
}
|
||||
|
||||
void KRAmbientZone::render(VkCommandBuffer& commandBuffer, KRCamera *pCamera, std::vector<KRPointLight *> &point_lights, std::vector<KRDirectionalLight *> &directional_lights, std::vector<KRSpotLight *>&spot_lights, const KRViewport &viewport, KRNode::RenderPass renderPass)
|
||||
void KRAmbientZone::render(RenderInfo& ri)
|
||||
{
|
||||
if(m_lod_visible <= LOD_VISIBILITY_PRESTREAM) return;
|
||||
|
||||
KRNode::render(commandBuffer, pCamera, point_lights, directional_lights, spot_lights, viewport, renderPass);
|
||||
KRNode::render(ri);
|
||||
|
||||
bool bVisualize = pCamera->settings.debug_display == KRRenderSettings::KRENGINE_DEBUG_DISPLAY_SIREN_AMBIENT_ZONES;
|
||||
bool bVisualize = ri.camera->settings.debug_display == KRRenderSettings::KRENGINE_DEBUG_DISPLAY_SIREN_AMBIENT_ZONES;
|
||||
|
||||
if(renderPass == KRNode::RENDER_PASS_FORWARD_TRANSPARENT && bVisualize) {
|
||||
if(ri.renderPass == KRNode::RENDER_PASS_FORWARD_TRANSPARENT && bVisualize) {
|
||||
Matrix4 sphereModelMatrix = getModelMatrix();
|
||||
|
||||
KRPipelineManager::PipelineInfo info{};
|
||||
std::string shader_name("visualize_overlay");
|
||||
info.shader_name = &shader_name;
|
||||
info.pCamera = pCamera;
|
||||
info.point_lights = &point_lights;
|
||||
info.directional_lights = &directional_lights;
|
||||
info.spot_lights = &spot_lights;
|
||||
info.renderPass = renderPass;
|
||||
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;
|
||||
|
||||
KRPipeline *pPipeline = getContext().getPipelineManager()->getPipeline(info);
|
||||
KRPipeline *pPipeline = getContext().getPipelineManager()->getPipeline(*ri.surface, info);
|
||||
|
||||
if(getContext().getPipelineManager()->selectPipeline(*pCamera, pPipeline, viewport, sphereModelMatrix, &point_lights, &directional_lights, &spot_lights, 0, renderPass, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
if(getContext().getPipelineManager()->selectPipeline(*ri.surface, *ri.camera, pPipeline, ri.viewport, sphereModelMatrix, &ri.point_lights, &ri.directional_lights, &ri.spot_lights, 0, ri.renderPass, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
|
||||
// Enable additive blending
|
||||
GLDEBUG(glEnable(GL_BLEND));
|
||||
@@ -157,7 +157,7 @@ void KRAmbientZone::render(VkCommandBuffer& commandBuffer, KRCamera *pCamera, st
|
||||
std::vector<KRMesh *> sphereModels = getContext().getMeshManager()->getModel("__sphere");
|
||||
if(sphereModels.size()) {
|
||||
for(int i=0; i < sphereModels[0]->getSubmeshCount(); i++) {
|
||||
sphereModels[0]->renderSubmesh(commandBuffer, i, renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
sphereModels[0]->renderSubmesh(ri.commandBuffer, i, ri.renderPass, getName(), "visualize_overlay", 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user