diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-11-21 16:07:25 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-11-21 16:07:38 +0300 |
commit | 9124ecb16b220d3222214859ec4b1d67e6313bcc (patch) | |
tree | 4cc83f011f60c43f42326f0a89aed5a84e255315 /source/blender/gpu/intern/gpu_draw.c | |
parent | 419c2723d39f969ce3cf67b4960612e9d3fa03a1 (diff) |
Cycles: support for specular color in solid shading mode, available in
the material panel.
Patch by Phillipp Oeser (D62) with some minor modifications, thanks!
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 622e7b5ce9e..0034b1c0d11 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -1391,7 +1391,7 @@ static struct GPUMaterialState { /* fixed function material, alpha handed by caller */ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob, const int new_shading_nodes) { - if (new_shading_nodes || bmat->mode & MA_SHLESS) { + if (bmat->mode & MA_SHLESS) { copy_v3_v3(smat->diff, &bmat->r); smat->diff[3]= 1.0; @@ -1401,6 +1401,19 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, zero_v4(smat->spec); smat->hard= 0; } + else if (new_shading_nodes) { + copy_v3_v3(smat->diff, &bmat->r); + smat->diff[3]= 1.0; + + copy_v3_v3(smat->spec, &bmat->specr); + smat->spec[3] = 1.0; + smat->hard= CLAMPIS(bmat->har, 0, 128); + + if (gamma) { + linearrgb_to_srgb_v3_v3(smat->diff, smat->diff); + linearrgb_to_srgb_v3_v3(smat->spec, smat->spec); + } + } else { mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */ |