public override void Update(RenderContext renderContext) { renderContext.SetShader(sp); renderContext.SetShaderParamTexture(Textureparam, Tex); renderContext.SetShaderParam(Shininess, 16.0f); renderContext.SetShaderParam(SpecularLevel, 256.0f); }
public void UpdateMaterial(RenderContext rc) { foreach (KeyValuePair<string, ParamPair> k in _list) { IShaderParam shaderparam; if ((shaderparam = _sp.GetShaderParam(k.Key)) != null) { if(k.Value.ParamInfo.Type == typeof(int)) rc.SetShaderParam(shaderparam, (int)k.Value.Value); else if (k.Value.ParamInfo.Type == typeof(float)) rc.SetShaderParam(shaderparam, (float)k.Value.Value); else if (k.Value.ParamInfo.Type == typeof(float2)) rc.SetShaderParam(shaderparam, (float2)k.Value.Value); else if (k.Value.ParamInfo.Type == typeof(float3)) rc.SetShaderParam(shaderparam, (float3)k.Value.Value); else if (k.Value.ParamInfo.Type == typeof(float4)) rc.SetShaderParam(shaderparam, (float4)k.Value.Value); else if (k.Value.ParamInfo.Type == typeof(float4x4)) rc.SetShaderParam(shaderparam, (float4x4)k.Value.Value); } } }