KRPipeline::getPipeline now accepts a struct to reduce argument count

This commit is contained in:
2022-04-04 00:52:32 -07:00
parent 56abe4425f
commit de5d6e64aa
2 changed files with 149 additions and 91 deletions

View File

@@ -51,11 +51,39 @@ class KRCamera;
class KRPipelineManager : public KRContextObject {
public:
typedef struct {
const std::string* shader_name;
KRCamera* pCamera;
const std::vector<KRPointLight*>* point_lights;
const std::vector<KRDirectionalLight*>* directional_lights;
const std::vector<KRSpotLight*>* spot_lights;
int bone_count;
bool bDiffuseMap : 1;
bool bNormalMap : 1;
bool bSpecMap : 1;
bool bReflectionMap : 1;
bool bReflectionCubeMap : 1;
bool bLightMap : 1;
bool bDiffuseMapScale : 1;
bool bSpecMapScale : 1;
bool bNormalMapScale : 1;
bool bReflectionMapScale : 1;
bool bDiffuseMapOffset : 1;
bool bSpecMapOffset : 1;
bool bNormalMapOffset : 1;
bool bReflectionMapOffset : 1;
bool bAlphaTest : 1;
bool bAlphaBlend : 1;
bool bRimColor : 1;
KRNode::RenderPass renderPass;
} PipelineInfo;
KRPipelineManager(KRContext &context);
virtual ~KRPipelineManager();
KRPipeline* get(const char* szKey);
KRPipeline *getPipeline(KRSurface& surface, KRRenderPass& renderPass, const std::string& shader_name, uint32_t vertexAttributes, KRMesh::model_format_t modelFormat);
KRPipeline* getPipeline(const PipelineInfo& info);
KRPipeline *getPipeline(const std::string &pipeline_name, KRCamera *pCamera, const std::vector<KRPointLight *> &point_lights, const std::vector<KRDirectionalLight *> &directional_lights, const std::vector<KRSpotLight *>&spot_lights, int bone_count, 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, bool bRimColor = false);
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);