diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-05 18:10:35 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-05 18:10:35 +0300 |
commit | b067a85aa3a67baca561641609b11e9d37f6f228 (patch) | |
tree | 05bf4b38e44728c11f91304ab34efc2ee0d1e593 /source/blender/gpu/intern/gpu_draw.c | |
parent | 01b7299bdb9ac1643a3053b3b6b34ac6c62f10ab (diff) |
Todo item:
Object color option now is incorporated in preview render, and
in display in 3D window.
Note that Object-color is "modulating" the render result, it just
multiplies... which is very limited for practical use. This was
added for Apricot game project. The original meaning however was
to replace diffuse only... so specular and light work still correct.
ALso made header for properties editor start on top, to reflect
default (report in tracker).
Diffstat (limited to 'source/blender/gpu/intern/gpu_draw.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index e54002a85db..5763cd958d0 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -901,7 +901,7 @@ static struct GPUMaterialState { } GMS = {NULL}; /* fixed function material, alpha handed by caller */ -static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma) +static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob) { if (bmat->mode & MA_SHLESS) { copy_v3_v3(smat->diff, &bmat->r); @@ -915,6 +915,9 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, mul_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */ + if(bmat->shade_flag & MA_OBCOLOR) + mul_v3_v3(smat->diff, ob->col); + mul_v3_v3fl(smat->spec, &bmat->specr, bmat->spec); smat->spec[3]= 1.0; /* always 1 */ smat->hard= CLAMPIS(bmat->har, 0, 128); @@ -979,7 +982,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O /* no materials assigned? */ if(ob->totcol==0) { - gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0); + gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob); /* do material 1 too, for displists! */ memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed)); @@ -1009,7 +1012,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O } else { /* fixed function opengl materials */ - gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma); + gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma, ob); blendmode = (ma->alpha == 1.0f)? GPU_BLEND_SOLID: GPU_BLEND_ALPHA; if(do_alpha_pass && GMS.alphapass) |