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:
authorCampbell Barton <ideasman42@gmail.com>2013-04-13 22:11:27 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-04-13 22:11:27 +0400
commite1c9353c94b1bf02c0a30bf248c26634e0682a8f (patch)
tree2be133e5838cc41b68647046af6db79f2a62b181
parent4d1e8cec1a7384750a2598064538d49cd82b6a88 (diff)
code cleanup: more minor changes for editmesh face drawing.
-rw-r--r--source/blender/blenkernel/intern/editderivedmesh.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 744edb37e5b..bd8a9ba3d04 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -809,6 +809,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
struct BMLoop *(*looptris)[3] = em->looptris;
float (*vertexCos)[3] = bmdm->vertexCos;
float (*vertexNos)[3] = bmdm->vertexNos;
+ float (*polyNos)[3] = bmdm->polyNos;
BMFace *efa;
MLoopUV *luv[3], dummyluv = {{0}};
MLoopCol *lcol[3] = {NULL} /* , dummylcol = {0} */;
@@ -856,12 +857,12 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
if (draw_option != DM_DRAW_OPTION_SKIP) {
+ if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
+ if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
+
glBegin(GL_TRIANGLES);
if (!drawSmooth) {
- glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
-
- if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
- if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
+ glNormal3fv(polyNos[BM_elem_index_get(efa)]);
glTexCoord2fv(luv[0]->uv);
if (has_vcol) glColor3ubv((const GLubyte *)&(lcol[0]->r));
@@ -876,9 +877,6 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
glVertex3fv(vertexCos[BM_elem_index_get(ltri[2]->v)]);
}
else {
- if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
- if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
-
glTexCoord2fv(luv[0]->uv);
if (has_vcol) glColor3ubv((const GLubyte *)&(lcol[0]->r));
glNormal3fv(vertexNos[BM_elem_index_get(ltri[0]->v)]);
@@ -924,13 +922,13 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
if (draw_option != DM_DRAW_OPTION_SKIP) {
+ if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
+ if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
+
glBegin(GL_TRIANGLES);
if (!drawSmooth) {
glNormal3fv(efa->no);
- if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
- if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
-
glTexCoord2fv(luv[0]->uv);
if (has_vcol) glColor3ubv((const GLubyte *)&(lcol[0]->r));
glVertex3fv(ltri[0]->v->co);
@@ -944,9 +942,6 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
glVertex3fv(ltri[2]->v->co);
}
else {
- if (has_uv) bmdm_get_tri_uv(ltri, luv, cd_loop_uv_offset);
- if (has_vcol) bmdm_get_tri_col(ltri, lcol, cd_loop_color_offset);
-
glTexCoord2fv(luv[0]->uv);
if (has_vcol) glColor3ubv((const GLubyte *)&(lcol[0]->r));
glNormal3fv(ltri[0]->v->no);
@@ -1034,6 +1029,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
struct BMLoop *(*looptris)[3] = em->looptris;
float (*vertexCos)[3] = bmdm->vertexCos;
float (*vertexNos)[3] = bmdm->vertexNos;
+ float (*polyNos)[3] = bmdm->polyNos;
BMFace *efa;
DMVertexAttribs attribs;
GPUVertexAttribs gattribs;
@@ -1069,7 +1065,7 @@ static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
if (do_draw) {
glBegin(GL_TRIANGLES);
if (!drawSmooth) {
- if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+ if (vertexCos) glNormal3fv(polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
emdm_pass_attrib_vertex_glsl(&attribs, ltri[0], 0);
@@ -1168,6 +1164,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
struct BMLoop *(*looptris)[3] = em->looptris;
float (*vertexCos)[3] = bmdm->vertexCos;
float (*vertexNos)[3] = bmdm->vertexNos;
+ float (*polyNos)[3] = bmdm->polyNos;
BMFace *efa;
DMVertexAttribs attribs = {{{0}}};
GPUVertexAttribs gattribs;
@@ -1201,7 +1198,7 @@ static void emDM_drawMappedFacesMat(DerivedMesh *dm,
/* face */
glBegin(GL_TRIANGLES);
if (!drawSmooth) {
- if (vertexCos) glNormal3fv(bmdm->polyNos[BM_elem_index_get(efa)]);
+ if (vertexCos) glNormal3fv(polyNos[BM_elem_index_get(efa)]);
else glNormal3fv(efa->no);
emdm_pass_attrib_vertex_mat(&attribs, ltri[0], 0);