[Bf-blender-cvs] [4ee5307] master: Dim down default (no) material for cycles so it matches default material in blender internal

Antony Riakiotakis noreply at git.blender.org
Mon Dec 1 16:21:12 CET 2014


Commit: 4ee53074aa951c42b0fb0899cd6376d124992304
Author: Antony Riakiotakis
Date:   Mon Dec 1 16:20:48 2014 +0100
Branches: master
https://developer.blender.org/rB4ee53074aa951c42b0fb0899cd6376d124992304

Dim down default (no) material for cycles so it matches default material
in blender internal

===================================================================

M	source/blender/gpu/intern/gpu_draw.c
M	source/blender/makesdna/DNA_brush_types.h

===================================================================

diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 0034b1c..6e3fc76 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -1389,7 +1389,8 @@ 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, const Object *ob, const int new_shading_nodes)
+static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat, const int gamma, const Object *ob, const int new_shading_nodes, 
+                                  const bool dimdown)
 {
 	if (bmat->mode & MA_SHLESS) {
 		copy_v3_v3(smat->diff, &bmat->r);
@@ -1409,10 +1410,15 @@ static void gpu_material_to_fixed(GPUMaterialFixed *smat, const Material *bmat,
 		smat->spec[3] = 1.0;
 		smat->hard= CLAMPIS(bmat->har, 0, 128);
 		
+		if (dimdown) {
+			mul_v3_fl(smat->diff, 0.8f);
+			mul_v3_fl(smat->spec, 0.5f);
+		}
+		
 		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);
@@ -1514,7 +1520,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, ob, new_shading_nodes);
+			gpu_material_to_fixed(&GMS.matbuf[0], &defmaterial, 0, ob, new_shading_nodes, true);
 
 			/* do material 1 too, for displists! */
 			memcpy(&GMS.matbuf[1], &GMS.matbuf[0], sizeof(GPUMaterialFixed));
@@ -1544,7 +1550,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, ob, new_shading_nodes);
+				gpu_material_to_fixed(&GMS.matbuf[a], ma, gamma, ob, new_shading_nodes, false);
 
 				if (GMS.use_alpha_pass && ((ma->mode & MA_TRANSP) || (new_shading_nodes && ma->alpha != 1.0f))) {
 					GMS.matbuf[a].diff[3]= ma->alpha;
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index b14861f..2fce2be 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -102,7 +102,7 @@ typedef struct Brush {
 	char vertexpaint_tool;  /* active vertex/weight paint blend mode (poorly named) */
 	char imagepaint_tool;   /* active image paint tool */
 	char mask_tool;         /* enum BrushMaskTool, only used if sculpt_tool is SCULPT_TOOL_MASK */
-
+	
 	float autosmooth_factor;
 
 	float crease_pinch_factor;




More information about the Bf-blender-cvs mailing list