diff options
author | IRIE Shinsuke <irieshinsuke@yahoo.co.jp> | 2014-01-17 11:28:53 +0400 |
---|---|---|
committer | IRIE Shinsuke <irieshinsuke@yahoo.co.jp> | 2014-01-17 11:32:45 +0400 |
commit | 6489c1f94d7bf1e83676e8eda91adf217d17926f (patch) | |
tree | d896105bf58caa34971675afbed1b22796782de1 /source/blender/gpu | |
parent | 63ccb2630385958f4f1535513e5541ba3b41bb9e (diff) |
Blender Internal: Correct GLSL preview, material using shader nodes didn't consider "Transparency" is a shader pipeline option.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 24c3291e283..3c4bfdf2bed 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1381,7 +1381,7 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi) GPU_link(mat, "set_rgb", GPU_uniform(&ma->specr), &shi->specrgb); GPU_link(mat, "shade_norm", GPU_builtin(GPU_VIEW_NORMAL), &shi->vn); - if (ma->mode & MA_TRANSP) + if (mat->alpha) GPU_link(mat, "set_value", GPU_uniform(&ma->alpha), &shi->alpha); else GPU_link(mat, "set_value", GPU_uniform(&one), &shi->alpha); @@ -1413,9 +1413,6 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) do_material_tex(shi); - if ((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP)) - GPU_material_enable_alpha(mat); - if ((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) { GPU_link(mat, "set_rgb", shi->rgb, &shr->diff); GPU_link(mat, "set_rgb_zero", &shr->spec); @@ -1488,7 +1485,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) GPU_uniform(&world->horr), &shr->combined); } - if (!((ma->mode & MA_TRANSP) && (ma->mode & MA_ZTRANSP))) { + if (!mat->alpha) { if (world && (GPU_link_changed(shr->alpha) || ma->alpha != 1.0f)) GPU_link(mat, "shade_world_mix", GPU_uniform(&world->horr), shr->combined, &shr->combined); @@ -1583,6 +1580,10 @@ GPUMaterial *GPU_material_from_blender(Scene *scene, Material *ma) mat = GPU_material_construct_begin(ma); mat->scene = scene; + /* render pipeline option */ + if (ma->mode & MA_TRANSP) + GPU_material_enable_alpha(mat); + if (!(scene->gm.flag & GAME_GLSL_NO_NODES) && ma->nodetree && ma->use_nodes) { /* create nodes */ ntreeGPUMaterialNodes(ma->nodetree, mat); |