Using KRPipelineManager::info struct to reduce number of parameters passed to KRPipelineManager::selectPipeline
This commit is contained in:
@@ -348,7 +348,16 @@ void KRLight::render(VkCommandBuffer& commandBuffer, KRCamera *pCamera, std::vec
|
||||
occlusion_test_sphere_matrix *= m_parentNode->getModelMatrix();
|
||||
}
|
||||
|
||||
if(getContext().getPipelineManager()->selectPipeline("occlusion_test", *pCamera, point_lights, directional_lights, spot_lights, 0, viewport, occlusion_test_sphere_matrix, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, renderPass, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
KRPipelineManager::PipelineInfo info{};
|
||||
std::string shader_name("occlusion_test");
|
||||
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;
|
||||
|
||||
if(getContext().getPipelineManager()->selectPipeline(info, viewport, occlusion_test_sphere_matrix, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
|
||||
GLDEBUG(glGenQueriesEXT(1, &m_occlusionQuery));
|
||||
#if TARGET_OS_IPHONE || defined(ANDROID)
|
||||
|
||||
@@ -279,36 +279,10 @@ KRPipeline *KRPipelineManager::getPipeline(const PipelineInfo &info) {
|
||||
return pPipeline;
|
||||
}
|
||||
|
||||
bool KRPipelineManager::selectPipeline(const std::string &pipeline_name, KRCamera &camera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRViewport &viewport, const Matrix4 &matModel, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color)
|
||||
bool KRPipelineManager::selectPipeline(const PipelineInfo& info, const KRViewport& viewport, const Matrix4& matModel, const Vector3& rim_color, float rim_power, const Vector4& fade_color)
|
||||
{
|
||||
PipelineInfo info{};
|
||||
info.shader_name = &pipeline_name;
|
||||
info.pCamera = &camera;
|
||||
info.point_lights = &point_lights;
|
||||
info.directional_lights = &directional_lights;
|
||||
info.spot_lights = &spot_lights;
|
||||
info.bone_count = bone_count;
|
||||
info.bDiffuseMap = bDiffuseMap;
|
||||
info.bNormalMap = bNormalMap;
|
||||
info.bSpecMap = bSpecMap;
|
||||
info.bReflectionMap = bReflectionMap;
|
||||
info.bReflectionCubeMap = bReflectionCubeMap;
|
||||
info.bLightMap = bLightMap;
|
||||
info.bDiffuseMapScale = bDiffuseMapScale;
|
||||
info.bSpecMapScale = bSpecMapScale;
|
||||
info.bNormalMapScale = bNormalMapScale;
|
||||
info.bReflectionMapScale = bReflectionMapScale;
|
||||
info.bDiffuseMapOffset = bDiffuseMapOffset;
|
||||
info.bSpecMapOffset = bDiffuseMapOffset;
|
||||
info.bNormalMapOffset = bNormalMapOffset;
|
||||
info.bReflectionMapOffset = bReflectionMapOffset;
|
||||
info.bAlphaTest = bAlphaTest;
|
||||
info.bAlphaBlend = bAlphaBlend;
|
||||
info.renderPass = renderPass;
|
||||
info.bRimColor = rim_power != 0.0f;
|
||||
|
||||
KRPipeline *pPipeline = getPipeline(info);
|
||||
return selectPipeline(camera, pPipeline, viewport, matModel, point_lights, directional_lights, spot_lights, bone_count, renderPass, rim_color, rim_power, fade_color);
|
||||
KRPipeline* pPipeline = getPipeline(info);
|
||||
return selectPipeline(*info.pCamera, pPipeline, viewport, matModel, *info.point_lights, *info.directional_lights, *info.spot_lights, info.bone_count, info.renderPass, rim_color, rim_power, fade_color);
|
||||
}
|
||||
|
||||
bool KRPipelineManager::selectPipeline(KRCamera &camera, KRPipeline *pPipeline, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color)
|
||||
|
||||
@@ -85,9 +85,8 @@ public:
|
||||
KRPipeline *getPipeline(KRSurface& surface, KRRenderPass& renderPass, const std::string& shader_name, uint32_t vertexAttributes, KRMesh::model_format_t modelFormat);
|
||||
KRPipeline* getPipeline(const PipelineInfo& info);
|
||||
bool selectPipeline(KRCamera &camera, KRPipeline *pPipeline, const KRViewport &viewport, const Matrix4 &matModel, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRNode::RenderPass &renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
|
||||
|
||||
bool selectPipeline(const std::string &pipeline_name, KRCamera &camera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, const KRViewport &viewport, const Matrix4 &matModel, bool bDiffuseMap, bool bNormalMap, bool bSpecMap, bool bReflectionMap, bool bReflectionCubeMap, bool bLightMap, bool bDiffuseMapScale,bool bSpecMapScale, bool bNormalMapScale, bool bReflectionMapScale, bool bDiffuseMapOffset, bool bSpecMapOffset, bool bNormalMapOffset, bool bReflectionMapOffset, bool bAlphaTest, bool bAlphaBlend, KRNode::RenderPass renderPass, const Vector3 &rim_color, float rim_power, const Vector4 &fade_color);
|
||||
|
||||
bool selectPipeline(const PipelineInfo& info, const KRViewport& viewport, const Matrix4& matModel, const Vector3& rim_color, float rim_power, const Vector4& fade_color);
|
||||
|
||||
size_t getPipelineHandlesUsed();
|
||||
|
||||
KRPipeline *m_active_pipeline;
|
||||
|
||||
@@ -296,8 +296,16 @@ void KRScene::render(VkCommandBuffer& commandBuffer, KROctreeNode *pOctreeNode,
|
||||
// Disable z-buffer write
|
||||
GLDEBUG(glDepthMask(GL_FALSE));
|
||||
}
|
||||
|
||||
if(getContext().getPipelineManager()->selectPipeline("occlusion_test", *pCamera, point_lights, directional_lights, spot_lights, 0, viewport, matModel, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, KRNode::RENDER_PASS_FORWARD_TRANSPARENT, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
KRPipelineManager::PipelineInfo info{};
|
||||
std::string shader_name("occlusion_test");
|
||||
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 = KRNode::RENDER_PASS_FORWARD_TRANSPARENT;
|
||||
|
||||
if(getContext().getPipelineManager()->selectPipeline(info, viewport, matModel, Vector3::Zero(), 0.0f, Vector4::Zero())) {
|
||||
GLDEBUG(glDrawArrays(GL_TRIANGLE_STRIP, 0, 14));
|
||||
m_pContext->getMeshManager()->log_draw_call(renderPass, "octree", "occlusion_test", 14);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user