Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-07 22:22:48 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-12-07 22:22:48 +0300
commit82ddfbf99fc0776a7fe439b81cf71bab87ceaaf9 (patch)
treefb1eda53eeeab12b093f5178693923b606708b05 /source/blender/gpu
parent4ca2581b77112c488938f0a2dc226042e0390b71 (diff)
parentfc69c54c4ce810e6236eaa45017130f27ba3f1e2 (diff)
Sculpt Branch:
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r24889:25180
Diffstat (limited to 'source/blender/gpu')
-rw-r--r--source/blender/gpu/intern/gpu_draw.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 75e8073aafd..c2cf4dfa9fd 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -34,6 +34,8 @@
#include "GL/glew.h"
+#include "BLI_math.h"
+
#include "DNA_image_types.h"
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
@@ -856,6 +858,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GPUMaterial *gpumat;
GPUBlendMode blendmode;
int a;
+ int gamma = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT;
/* initialize state */
memset(&GMS, 0, sizeof(GMS));
@@ -930,6 +933,7 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GMS.matbuf[a][0][0]= ma->r;
GMS.matbuf[a][0][1]= ma->g;
GMS.matbuf[a][0][2]= ma->b;
+ if(gamma) linearrgb_to_srgb_v3_v3(&GMS.matbuf[a][0][0], &GMS.matbuf[a][0][0]);
} else {
GMS.matbuf[a][0][0]= (ma->ref+ma->emit)*ma->r;
GMS.matbuf[a][0][1]= (ma->ref+ma->emit)*ma->g;
@@ -939,6 +943,11 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O
GMS.matbuf[a][1][1]= ma->spec*ma->specg;
GMS.matbuf[a][1][2]= ma->spec*ma->specb;
GMS.matbuf[a][1][3]= 1.0;
+
+ if(gamma) {
+ linearrgb_to_srgb_v3_v3(&GMS.matbuf[a][0][0], &GMS.matbuf[a][0][0]);
+ linearrgb_to_srgb_v3_v3(&GMS.matbuf[a][1][0], &GMS.matbuf[a][1][0]);
+ }
}
blendmode = (ma->alpha == 1.0f)? GPU_BLEND_SOLID: GPU_BLEND_ALPHA;