protected void setDefaultShaderState(SSMainShaderProgram pgm) { if (pgm != null) { pgm.Activate(); pgm.UniObjectWorldTransform = this.worldMat; pgm.SetupTextures(); } }
protected void setDefaultShaderState(SSMainShaderProgram pgm) { if (pgm != null) { pgm.Activate(); pgm.UniObjectWorldTransform = this.worldMat; pgm.UniReceivesShadow = renderState.receivesShadows; pgm.UniSpriteOffsetAndSize(0f, 0f, 1f, 1f); pgm.SetupTextures(textureMaterial); } }
protected void setDefaultShaderState(SSMainShaderProgram pgm, SSRenderConfig config) { if (pgm != null) { pgm.Activate(); pgm.UniObjectWorldTransform = this.worldMat; pgm.UniReceivesShadow = renderState.receivesShadows; pgm.UniSpriteOffsetAndSize(0f, 0f, 1f, 1f); pgm.UniShowWireframes = (config.drawWireframeMode == WireframeMode.GLSL_SinglePass); pgm.SetupTextures(textureMaterial); } }
private void configureDrawShader(SSRenderConfig renderConfig, SSMainShaderProgram pgm) { if (pgm != null) { pgm.Activate(); pgm.UniPoissonSamplingEnabled = renderConfig.usePoissonSampling; if (renderConfig.usePoissonSampling) { pgm.UniNumPoissonSamples = renderConfig.numPoissonSamples; } } }
protected void configureDrawShader(SSRenderConfig renderConfig, SSMainShaderProgram pgm) { if (pgm == null) { return; } pgm.Activate(); pgm.UniNumShadowMaps = c_numberOfSplits; if (renderConfig.usePoissonSampling) { pgm.UniPoissonScaling = m_poissonScaling; } pgm.UniShadowMapVPs = m_shadowViewProjBiasMatrices; pgm.UniPssmSplits = m_viewSplits; }
private void configureDrawShader(ref SSRenderConfig renderConfig, SSMainShaderProgram pgm, Matrix4[] vp) { if (pgm == null) { return; } pgm.Activate(); pgm.UniNumShadowMaps = 1; if (renderConfig.usePoissonSampling) { Vector2[] poissonScales = { new Vector2(1f) }; pgm.UniPoissonScaling = poissonScales; } pgm.UniShadowMapVPs = vp; }
private void _renderSetupGLSL(SSRenderConfig renderConfig, SSMainShaderProgram shaderPgm, SSMeshOBJSubsetData subset) { // Step 1: setup GL rendering modes... // GL.Enable(EnableCap.Lighting); // GL.Enable(EnableCap.Blend); // GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); // GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); // Step 2: setup our material mode and paramaters... if (renderConfig.drawingShadowMap) { // assume SSObject.Render has setup our materials properly for the shadowmap Pass // TODO: find a better way to do this! return; } SSColorMaterial.applyColorMaterial(subset.colorMaterial); if (shaderPgm == null) { SSShaderProgram.DeactivateAll(); // fixed function single-texture if (subset.textureMaterial.diffuseTex != null) { GL.ActiveTexture(TextureUnit.Texture0); GL.Enable(EnableCap.Texture2D); GL.BindTexture(TextureTarget.Texture2D, subset.textureMaterial.diffuseTex.TextureID); } } else { shaderPgm.Activate(); shaderPgm.SetupTextures(subset.textureMaterial); } }
private void _renderSetupGLSL(SSRenderConfig renderConfig, SSMainShaderProgram shaderPgm, SSMeshOBJSubsetData subset) { // Step 1: setup GL rendering modes... // GL.Enable(EnableCap.Lighting); // GL.Enable(EnableCap.Blend); // GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); // GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); // Step 2: setup our material mode and paramaters... if (renderConfig.drawingShadowMap) { // assume SSObject.Render has setup our materials properly for the shadowmap Pass // TODO: find a better way to do this! return; } if (shaderPgm == null) { SSShaderProgram.DeactivateAll (); // fixed function single-texture if (subset.TextureMaterial.diffuseTex != null) { GL.ActiveTexture(TextureUnit.Texture0); GL.Enable(EnableCap.Texture2D); GL.BindTexture(TextureTarget.Texture2D, subset.TextureMaterial.diffuseTex.TextureID); } } else { shaderPgm.Activate(); shaderPgm.SetupTextures(subset.TextureMaterial); } }
private void _renderSetupGLSL(ref SSRenderConfig renderConfig, SSMeshOBJSubsetData subset) { // Step 1: setup GL rendering modes... GL.Enable(EnableCap.CullFace); // GL.Enable(EnableCap.Lighting); // GL.Enable(EnableCap.Blend); // GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha); // GL.PixelStore(PixelStoreParameter.UnpackAlignment, 1); // Step 2: setup our material mode and paramaters... GL.Color3(System.Drawing.Color.White); // clear the vertex color to white.. SSMainShaderProgram shaderPgm = renderConfig.BaseShader; if (renderConfig.drawingShadowMap) { // assume SSObject.Render has setup our materials properly for the shadowmap Pass // TODO: find a better way to do this! return; } if (shaderPgm == null) { SSShaderProgram.DeactivateAll(); GL.Disable(EnableCap.CullFace); // fixed function single-texture GL.Disable(EnableCap.Texture2D); if (subset.diffuseTexture != null) { GL.ActiveTexture(TextureUnit.Texture0); GL.Enable(EnableCap.Texture2D); GL.BindTexture(TextureTarget.Texture2D, subset.diffuseTexture.TextureID); } } else { // activate GLSL shader shaderPgm.Activate(); // bind our texture-images to GL texture-units // http://adriangame.blogspot.com/2010/05/glsl-multitexture-checklist.html // these texture-unit assignments are hard-coded in the shader setup GL.ActiveTexture(TextureUnit.Texture0); if (subset.diffuseTexture != null) { GL.BindTexture(TextureTarget.Texture2D, subset.diffuseTexture.TextureID); shaderPgm.u_DiffTexEnabled = true; } else { GL.BindTexture(TextureTarget.Texture2D, 0); shaderPgm.u_DiffTexEnabled = false; } GL.ActiveTexture(TextureUnit.Texture1); if (subset.specularTexture != null) { GL.BindTexture(TextureTarget.Texture2D, subset.specularTexture.TextureID); shaderPgm.u_SpecTexEnabled = true; } else { GL.BindTexture(TextureTarget.Texture2D, 0); shaderPgm.u_SpecTexEnabled = false; } GL.ActiveTexture(TextureUnit.Texture2); if (subset.ambientTexture != null) { GL.BindTexture(TextureTarget.Texture2D, subset.ambientTexture.TextureID); shaderPgm.u_AmbTexEnabled = true; } else { GL.BindTexture(TextureTarget.Texture2D, 0); shaderPgm.u_AmbTexEnabled = false; } GL.ActiveTexture(TextureUnit.Texture3); if (subset.bumpTexture != null) { GL.BindTexture(TextureTarget.Texture2D, subset.bumpTexture.TextureID); shaderPgm.u_BumpTexEnabled = true; } else { GL.BindTexture(TextureTarget.Texture2D, 0); shaderPgm.u_BumpTexEnabled = false; } // reset to texture-unit 0 to be friendly.. GL.ActiveTexture(TextureUnit.Texture0); } }
protected void configureDrawShader(SSRenderConfig renderConfig, SSMainShaderProgram pgm) { if (pgm == null) return; pgm.Activate(); pgm.UniNumShadowMaps = c_numberOfSplits; if (renderConfig.usePoissonSampling) { pgm.UniPoissonScaling = m_poissonScaling; } pgm.UniShadowMapVPs = m_shadowViewProjBiasMatrices; pgm.UniPssmSplits = m_viewSplits; }
private void configureDrawShader(ref SSRenderConfig renderConfig, SSMainShaderProgram pgm, Matrix4[] vp) { if (pgm == null) return; pgm.Activate (); pgm.UniNumShadowMaps = 1; if (renderConfig.usePoissonSampling) { Vector2[] poissonScales = { new Vector2 (1f) }; pgm.UniPoissonScaling = poissonScales; } pgm.UniShadowMapVPs = vp; }
protected void setDefaultShaderState(SSMainShaderProgram pgm, SSRenderConfig config) { if (pgm != null) { pgm.Activate(); pgm.UniObjectWorldTransform = this.worldMat; pgm.UniReceivesShadow = renderState.receivesShadows; pgm.UniSpriteOffsetAndSize(0f, 0f, 1f, 1f); pgm.UniShowWireframes = (config.drawWireframeMode == WireframeMode.GLSL_SinglePass); pgm.UniLighted = renderState.lighted; pgm.SetupTextures(textureMaterial); } }