From dbd5524970eddd4170d0b37461648523f4ce5cd9 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 27 Sep 2010 07:01:08 +0000 Subject: [PATCH] show material hardness in solid shaded mode --- source/blender/gpu/intern/gpu_draw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 289f9fe5e8b..b7698dd3031 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -874,6 +874,7 @@ void GPU_free_images_anim(void) typedef struct GPUMaterialFixed { float diff[4]; float spec[4]; + int hard; } GPUMaterialFixed; static struct GPUMaterialState { @@ -921,7 +922,8 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, smat->spec[1]= bmat->spec * bmat->specg; smat->spec[2]= bmat->spec * bmat->specb; smat->spec[3]= 1.0; /* always 1 */ - + 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); @@ -1104,6 +1106,7 @@ int GPU_enable_material(int nr, void *attribs) /* or do fixed function opengl material */ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, GMS.matbuf[nr].diff); glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, GMS.matbuf[nr].spec); + glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, GMS.matbuf[nr].hard); } /* set (alpha) blending mode */