public static void ApplyMaterialParameters(OpenGL gl, ExtShaderProgram esp, Material m) { var p = esp.Program; var prms = esp.Parameters as IMaterialShaderParameters; var amb = m.Ambient; var diff = m.Diffuse; var spec = m.Specular; var shini = m.Shininess; var emit = m.Emission; if (prms.AmbientId != null && amb != null) { p.SetUniform3(gl, prms.AmbientId, amb.R, amb.G, amb.B); } if (prms.DiffuseId != null && diff != null) { p.SetUniform3(gl, prms.DiffuseId, diff.R, diff.G, diff.B); } if (prms.SpecularId != null && spec != null) { p.SetUniform3(gl, prms.SpecularId, spec.R, spec.G, spec.B); } if (prms.EmissionId != null && emit != null) { p.SetUniform3(gl, prms.EmissionId, emit.R, emit.G, emit.B); } if (prms.ShininessId != null) { p.SetUniform1(gl, prms.ShininessId, shini); } }
public static void ApplySingleLightParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, vec3 lp) { var prms = esp.Parameters as ISingleLightParameters; var p = esp.Program; // Set the light position. if (prms.LightPositionId != null) p.SetUniform3(gl, prms.LightPositionId, lp.x, lp.y, lp.z); }
public static void ApplyMVPNParameter(OpenGL gl, ExtShaderProgram esp, Projection pr, ModelView mv, Normal nrml) { var prms = esp.Parameters as IMVPNParameters; var p = esp.Program; // Set the matrices. p.SetUniformMatrix4(gl, prms.ProjectionMatrixId, pr.ToArray()); p.SetUniformMatrix4(gl, prms.ModelviewMatrixId, mv.ToArray()); p.SetUniformMatrix3(gl, prms.NormalMatrixId, nrml.ToArray()); }
public static void ApplySingleLightParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, vec3 lp) { var prms = esp.Parameters as ISingleLightParameters; var p = esp.Program; // Set the light position. if (prms.LightPositionId != null) { p.SetUniform3(gl, prms.LightPositionId, lp.x, lp.y, lp.z); } }
public static void ApplyTransformableParameters(OpenGL gl, ExtShaderProgram esp, mat4 m) { var prms = esp.Parameters as ITransformableParameters; var p = esp.Program; // Set the transformation matrix. if (prms.TransformationMatrixId != null) { p.SetUniformMatrix4(gl, prms.TransformationMatrixId, m.to_array()); } }
public static void ApplyMaterialParameters(OpenGL gl, ExtShaderProgram esp, Material m) { var p = esp.Program; var prms = esp.Parameters as IMaterialShaderParameters; var amb = m.Ambient; var diff = m.Diffuse; var spec = m.Specular; var shini = m.Shininess; var emit = m.Emission; if (prms.AmbientId != null && amb != null) p.SetUniform3(gl, prms.AmbientId, amb.R, amb.G, amb.B); if (prms.DiffuseId != null && diff != null) p.SetUniform3(gl, prms.DiffuseId, diff.R, diff.G, diff.B); if (prms.SpecularId != null && spec != null) p.SetUniform3(gl, prms.SpecularId, spec.R, spec.G, spec.B); if (prms.EmissionId != null && emit != null) p.SetUniform3(gl, prms.EmissionId, emit.R, emit.G, emit.B); if (prms.ShininessId != null) p.SetUniform1(gl, prms.ShininessId, shini); }
public static void ApplyTransArrayParameters(OpenGL gl, ExtShaderProgram esp, mat4[] mats) { var prms = esp.Parameters as ITransformableParameters; var p = esp.Program; // Set the transformation matrix. if (prms.TransformationMatrixId != null) { var m = new float[mats.Length][]; for (int i = 0; i < mats.Length; i++) { var mat = mats[i]; m[i] = new float[16]; m[i] = mat.to_array(); } throw new NotImplementedException(); //p.set //p.SetUniformMatrix4(gl, prms.TransformationMatrixId, m); } }
public void ApplyTransformableParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, GlmNet.mat4 m) { ParameterAppliers.JOG.ApplyTransformableParameters(gl, esp, m); }
public void ApplyTransformableParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, GlmNet.mat4[] m) { throw new NotImplementedException(); }
public void ApplyMVPNParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, Scene.Projection pr, Scene.ModelView mv, Scene.Normal nrml) { ParameterAppliers.JOG.ApplyMVPNParameter(gl, esp, pr, mv, nrml); }
public void ApplySingleLightParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, GlmNet.vec3 lp) { ParameterAppliers.JOG.ApplySingleLightParameters(gl, esp, lp); }
public void ApplyMaterialParameters(SharpGL.OpenGL gl, ExtShaderProgram esp, ModelComponents.Material m) { ParameterAppliers.JOG.ApplyMaterialParameters(gl, esp, m); }
public static void ApplyTransformableParameters(OpenGL gl, ExtShaderProgram esp, mat4 m) { var prms = esp.Parameters as ITransformableParameters; var p = esp.Program; // Set the transformation matrix. if (prms.TransformationMatrixId != null) p.SetUniformMatrix4(gl, prms.TransformationMatrixId, m.to_array()); }
public void ApplyAll(SharpGL.OpenGL gl, ExtShaderProgram esp, Material mat = null, Projection pr = null, ModelView mv = null, Normal nrml = null) { }