void InitProgram(ShaderBuildinHelper shaderBuildinHelper) { if (shaderBuildinHelper == null) { Debug.Log("ShaderBuildinHelper is null"); return; } clearProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/ClearShader")); colorProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/ColorShader")); backgroundProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BackgroundShader")); displayProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayShader")); displayBloomProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayBloomShader")); displayShadingProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayShadingShader")); displayBloomShadingProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DisplayBloomShadingShader")); bloomPrefilterProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomPrefilterShader")); bloomBlurProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomBlurShader")); bloomFinalProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/BloomFinalShader")); splatProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/SplatShader")); advectionProgram = new FluidProgram(supportLinearFiltering?shaderBuildinHelper.GetShaderByName("Custom/Fluid/AdvectionShader"):shaderBuildinHelper.GetShaderByName("Custom/Fluid/AdvectionManualFilteringShader")); divergenceProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/DivergenceShader")); curlProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/CurlShader")); vorticityProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/VorticityShader")); pressureProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/PressureShader")); gradienSubtractProgram = new FluidProgram(shaderBuildinHelper.GetShaderByName("Custom/Fluid/GradientSubtractShader")); }
public FluidCtrl(RenderTexture target, Texture2D _ditheringTexture, ShaderBuildinHelper _shaderBuildinHelper) { ditheringTexture = _ditheringTexture; shaderBuildinHelper = _shaderBuildinHelper; if (ditheringTexture == null) { ditheringTexture = Resources.Load("Fluid/LDR_RGB1_0") as Texture2D; } renderTarget = target; if (target == null) { return; } InitFramebuffers(renderTarget); InitProgram(shaderBuildinHelper); }