diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 10:34:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-10-02 10:34:04 +0400 |
commit | db1b74654bc7e268a310a75c64cdee5b53358001 (patch) | |
tree | 4e33b6c57abfe08f771b37bc7d65f307876e0a78 /source/blender | |
parent | 734b7b969db315f5ab548b5a8104fc35f29d0f51 (diff) |
- spec hardness was missing redraw update
- missed rna rename in image ui
- use BLI_math functions in gpu_draw.c (no functional changes)
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 32 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 2 |
2 files changed, 10 insertions, 24 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index af92ecbb44b..e8701793e5d 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -903,9 +903,7 @@ static struct GPUMaterialState { static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma) { if (bmat->mode & MA_SHLESS) { - smat->diff[0]= bmat->r; - smat->diff[1]= bmat->g; - smat->diff[2]= bmat->b; + copy_v3_v3(smat->diff, &bmat->r); smat->diff[3]= 1.0; if(gamma) { @@ -913,14 +911,10 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, } } else { - smat->diff[0]= (bmat->ref + bmat->emit) * bmat->r; - smat->diff[1]= (bmat->ref + bmat->emit) * bmat->g; - smat->diff[2]= (bmat->ref + bmat->emit) * bmat->b; + madd_v3_v3fl(smat->diff, &bmat->r, bmat->ref + bmat->emit); smat->diff[3]= 1.0; /* caller may set this to bmat->alpha */ - smat->spec[0]= bmat->spec * bmat->specr; - smat->spec[1]= bmat->spec * bmat->specg; - smat->spec[2]= bmat->spec * bmat->specb; + madd_v3_v3fl(smat->spec, &bmat->specr, bmat->spec); smat->spec[3]= 1.0; /* always 1 */ smat->hard= CLAMPIS(bmat->har, 0, 128); @@ -1049,14 +1043,10 @@ int GPU_enable_material(int nr, void *attribs) memset(&GMS, 0, sizeof(GMS)); - diff[0]= (defmaterial.ref+defmaterial.emit)*defmaterial.r; - diff[1]= (defmaterial.ref+defmaterial.emit)*defmaterial.g; - diff[2]= (defmaterial.ref+defmaterial.emit)*defmaterial.b; + madd_v3_v3fl(diff, &defmaterial.r, defmaterial.ref + defmaterial.emit); diff[3]= 1.0; - spec[0]= defmaterial.spec*defmaterial.specr; - spec[1]= defmaterial.spec*defmaterial.specg; - spec[2]= defmaterial.spec*defmaterial.specb; + madd_v3_v3fl(spec, &defmaterial.specr, defmaterial.spec); spec[3]= 1.0; glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, diff); @@ -1269,14 +1259,14 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 if(la->type==LA_SUN) { /* sun lamp */ - VECCOPY(direction, base->object->obmat[2]); + copy_v3_v3(direction, base->object->obmat[2]); direction[3]= 0.0; glLightfv(GL_LIGHT0+count, GL_POSITION, direction); } else { /* other lamps with attenuation */ - VECCOPY(position, base->object->obmat[3]); + copy_v3_v3(position, base->object->obmat[3]); position[3]= 1.0f; glLightfv(GL_LIGHT0+count, GL_POSITION, position); @@ -1286,9 +1276,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 if(la->type==LA_SPOT) { /* spot lamp */ - direction[0]= -base->object->obmat[2][0]; - direction[1]= -base->object->obmat[2][1]; - direction[2]= -base->object->obmat[2][2]; + negate_v3_v3(direction, base->object->obmat[2]); glLightfv(GL_LIGHT0+count, GL_SPOT_DIRECTION, direction); glLightf(GL_LIGHT0+count, GL_SPOT_CUTOFF, la->spotsize/2.0); glLightf(GL_LIGHT0+count, GL_SPOT_EXPONENT, 128.0*la->spotblend); @@ -1298,9 +1286,7 @@ int GPU_scene_object_lights(Scene *scene, Object *ob, int lay, float viewmat[][4 } /* setup energy */ - energy[0]= la->energy*la->r; - energy[1]= la->energy*la->g; - energy[2]= la->energy*la->b; + madd_v3_v3fl(energy, &la->r, la->energy); energy[3]= 1.0; glLightfv(GL_LIGHT0+count, GL_DIFFUSE, energy); diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 229fbb91187..bf4a958eeb4 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -1383,7 +1383,7 @@ static void rna_def_material_specularity(StructRNA *srna) RNA_def_property_int_sdna(prop, NULL, "har"); RNA_def_property_range(prop, 1, 511); RNA_def_property_ui_text(prop, "Specular Hardness", ""); - RNA_def_property_update(prop, 0, "rna_Material_update"); + RNA_def_property_update(prop, 0, "rna_Material_draw_update"); prop= RNA_def_property(srna, "specular_ior", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "refrac"); |