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
path: root/source
diff options
context:
space:
mode:
authorNicholas Bishop <nicholasbishop@gmail.com>2012-03-07 01:21:22 +0400
committerNicholas Bishop <nicholasbishop@gmail.com>2012-03-07 01:21:22 +0400
commit2fd7a56526a356a984e5c03354834bd7ada94014 (patch)
treef4921d82eaba38671efb08577f1e96caa854147b /source
parentef67172587af7afa81998ab0103742b58a4b25eb (diff)
Fix textured-mode drawing in editmode.
It's currently not respecting the material color, probably since the BMesh merge. There are a couple problems, both involving "dummy" variables taking the place of actual MTFace/MCol data. Code review: http://codereview.appspot.com/5753050/
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c27
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c3
2 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index fa60ae42bac..717f6d5e9fa 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -789,14 +789,13 @@ static void emDM_drawFacesTex_common(
float (*vertexNos)[3]= bmdm->vertexNos;
BMFace *efa;
MLoopUV *luv[3], dummyluv = {{0}};
- MLoopCol *lcol[3], dummylcol = {0};
+ MLoopCol *lcol[3] = {NULL}, dummylcol = {0};
int i, has_vcol = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL);
int has_uv = CustomData_has_layer(&bm->pdata, CD_MTEXPOLY);
(void) compareDrawOptions;
luv[0] = luv[1] = luv[2] = &dummyluv;
- lcol[0] = lcol[1] = lcol[2] = &dummylcol;
dummylcol.a = dummylcol.r = dummylcol.g = dummylcol.b = 255;
@@ -838,32 +837,38 @@ static void emDM_drawFacesTex_common(
bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
glTexCoord2fv(luv[0]->uv);
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ if (lcol[0])
+ glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
glTexCoord2fv(luv[1]->uv);
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ if (lcol[1])
+ glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
glTexCoord2fv(luv[2]->uv);
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ if (lcol[2])
+ glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
}
else {
bmdm_get_tri_tex(bm, ls, luv, lcol, has_uv, has_vcol);
glTexCoord2fv(luv[0]->uv);
- glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
+ if (lcol[0])
+ glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
glNormal3fv(vertexNos[BM_elem_index_get(ls[0]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[0]->v)]);
glTexCoord2fv(luv[1]->uv);
- glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
+ if (lcol[1])
+ glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
glNormal3fv(vertexNos[BM_elem_index_get(ls[1]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[1]->v)]);
glTexCoord2fv(luv[2]->uv);
- glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
+ if (lcol[2])
+ glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
glNormal3fv(vertexNos[BM_elem_index_get(ls[2]->v)]);
glVertex3fv(vertexCos[BM_elem_index_get(ls[2]->v)]);
}
@@ -907,21 +912,18 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
- else glColor3ub(0, 0, 0);
glVertex3fv(ls[0]->v->co);
if (luv[1])
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
- else glColor3ub(0, 0, 0);
glVertex3fv(ls[1]->v->co);
if (luv[2])
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
- else glColor3ub(0, 0, 0);
glVertex3fv(ls[2]->v->co);
}
else {
@@ -931,7 +933,6 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[0]->uv);
if (lcol[0])
glColor3ub(lcol[0]->b, lcol[0]->g, lcol[0]->r);
- else glColor3ub(0, 0, 0);
glNormal3fv(ls[0]->v->no);
glVertex3fv(ls[0]->v->co);
@@ -939,7 +940,6 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[1]->uv);
if (lcol[1])
glColor3ub(lcol[1]->b, lcol[1]->g, lcol[1]->r);
- else glColor3ub(0, 0, 0);
glNormal3fv(ls[1]->v->no);
glVertex3fv(ls[1]->v->co);
@@ -947,7 +947,6 @@ static void emDM_drawFacesTex_common(
glTexCoord2fv(luv[2]->uv);
if (lcol[2])
glColor3ub(lcol[2]->b, lcol[2]->g, lcol[2]->r);
- else glColor3ub(0, 0, 0);
glNormal3fv(ls[2]->v->no);
glVertex3fv(ls[2]->v->co);
}
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index f41846f3378..9ad7a196113 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -571,7 +571,8 @@ static int draw_em_tf_mapped__set_draw(void *userData, int index)
ME_MTEXFACE_CPY(&mtf, tpoly);
}
- return draw_tface__set_draw_legacy(&mtf, data->has_mcol, matnr);
+ return draw_tface__set_draw_legacy(data->has_mtface ? &mtf : NULL,
+ data->has_mcol, matnr);
}
}