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@gmail.com>2015-11-27 04:29:57 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2015-11-27 23:56:08 +0300
commitbafccb00dec6d882c580102aa4d0b0889c898154 (patch)
treed73b986ca6ceeb55f9fd5c483a6de322ae96347e /source/blender/editors/space_view3d/drawmesh.c
parentd3612cfca89e91cf7638fcec5b373db90715436f (diff)
OpenGL: fix cycles texture draw mode not respecting double sided lighting.
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c69
1 files changed, 35 insertions, 34 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 93e9910a28b..728890a6dbc 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -1138,6 +1138,8 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
if (ob->transflag & OB_NEG_SCALE) glFrontFace(GL_CW);
else glFrontFace(GL_CCW);
+ Mesh *me = ob->data;
+
if ((v3d->flag2 & V3D_SHADELESS_TEX) &&
((v3d->drawtype == OB_TEXTURE) || (ob->mode & OB_MODE_TEXTURE_PAINT)))
{
@@ -1145,52 +1147,51 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d,
}
else {
glEnable(GL_LIGHTING);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, (me->flag & ME_TWOSIDED) ? GL_TRUE : GL_FALSE);
}
- {
- Mesh *me = ob->data;
- TexMatCallback data = {scene, ob, me, dm};
- bool (*set_face_cb)(void *, int);
- bool picking = (G.f & G_PICKSEL) != 0;
-
- /* face hiding callback depending on mode */
- if (ob == scene->obedit)
- set_face_cb = tex_mat_set_face_editmesh_cb;
- else if (draw_flags & DRAW_FACE_SELECT)
- set_face_cb = tex_mat_set_face_mesh_cb;
- else
- set_face_cb = NULL;
-
- /* test if we can use glsl */
- bool glsl = (v3d->drawtype == OB_MATERIAL) && !picking;
+ TexMatCallback data = {scene, ob, me, dm};
+ bool (*set_face_cb)(void *, int);
+ bool picking = (G.f & G_PICKSEL) != 0;
+
+ /* face hiding callback depending on mode */
+ if (ob == scene->obedit)
+ set_face_cb = tex_mat_set_face_editmesh_cb;
+ else if (draw_flags & DRAW_FACE_SELECT)
+ set_face_cb = tex_mat_set_face_mesh_cb;
+ else
+ set_face_cb = NULL;
- GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
+ /* test if we can use glsl */
+ bool glsl = (v3d->drawtype == OB_MATERIAL) && !picking;
- if (glsl || picking) {
- /* draw glsl or solid */
- dm->drawMappedFacesMat(dm,
- tex_mat_set_material_cb,
- set_face_cb, &data);
- }
- else {
- float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
+ GPU_begin_object_materials(v3d, rv3d, scene, ob, glsl, NULL);
- /* draw textured */
- glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, zero);
- glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, zero);
- glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
+ if (glsl || picking) {
+ /* draw glsl or solid */
+ dm->drawMappedFacesMat(dm,
+ tex_mat_set_material_cb,
+ set_face_cb, &data);
+ }
+ else {
+ float zero[4] = {0.0f, 0.0f, 0.0f, 0.0f};
- dm->drawMappedFacesMat(dm,
- tex_mat_set_texture_cb,
- set_face_cb, &data);
- }
+ /* draw textured */
+ glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, zero);
+ glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, zero);
+ glMateriali(GL_FRONT_AND_BACK, GL_SHININESS, 0);
- GPU_end_object_materials();
+ dm->drawMappedFacesMat(dm,
+ tex_mat_set_texture_cb,
+ set_face_cb, &data);
}
+ GPU_end_object_materials();
+
/* reset opengl state */
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_TEXTURE_2D);
+ glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_FALSE);
glDisable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D, 0);
glFrontFace(GL_CCW);