diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-11-27 23:28:36 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2015-12-06 21:35:15 +0300 |
commit | 9821fe6dc25b7a7fc50754d2c3c66b731631ce9f (patch) | |
tree | ab6de8abb068eeb9415e8f3d347d85f6d40cadc1 | |
parent | 82191b102fba685b0dbb70c1bffd4dafc8c538b6 (diff) |
OpenGL: move two sided lighting check into GPU material code.
Differential Revision: https://developer.blender.org/D1645
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index 31b9c07cdec..78a420f02f4 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -49,6 +49,7 @@ #include "DNA_lamp_types.h" #include "DNA_material_types.h" +#include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_node_types.h" @@ -1427,6 +1428,7 @@ static struct GPUMaterialState { float (*gviewcamtexcofac); bool backface_culling; + bool two_sided_lighting; GPUBlendMode *alphablend; GPUBlendMode alphablend_fixed[FIXEDMAT]; @@ -1567,6 +1569,10 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GMS.backface_culling = (v3d->flag2 & V3D_BACKFACE_CULLING) != 0; + GMS.two_sided_lighting = false; + if (ob && ob->type == OB_MESH) + GMS.two_sided_lighting = (((Mesh*)ob->data)->flag & ME_TWOSIDED) != 0; + GMS.gob = ob; GMS.gscene = scene; GMS.is_opensubdiv = use_opensubdiv; @@ -1878,6 +1884,7 @@ void GPU_end_object_materials(void) GMS.matbuf = NULL; GMS.gmatbuf = NULL; GMS.alphablend = NULL; + GMS.two_sided_lighting = false; /* resetting the texture matrix after the scaling needed for tiled textures */ if (GTS.tilemode) { |