diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 22:29:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-09-23 22:29:45 +0400 |
commit | a189b71a28d3eddc6b85948ab1063be0a032cde4 (patch) | |
tree | 6b2d55b13122fa22ab6d4016a43399353fef6d9f /source/blender/blenkernel | |
parent | 120895fd240590f428fd68dda4bb4bd5c844cfc3 (diff) |
some speedup for drawing mesh in texture mode.
- only pass if the mesh has vertex colors to drawParams() rather then the mcol its self, this saves a lookup on the color.
- drawing textures in editmode with no vertex colors would still lookup vertex colors on each face, instead cache this info for all faces.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 6e17b056685..2c3ffc296ba 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -257,7 +257,7 @@ struct DerivedMesh { */ void (*drawFacesTex)(DerivedMesh *dm, int (*setDrawOptions)(struct MTFace *tface, - struct MCol *mcol, int matnr)); + int has_mcol, int matnr)); /* Draw all faces with GLSL materials * o setMaterial is called for every different material nr diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index fddd2809c47..5e462238f31 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -799,7 +799,7 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us } static void emDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -827,7 +827,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, int flag; if(drawParams) - flag= drawParams(tf, mcol, efa->mat_nr); + flag= drawParams(tf, (mcol != NULL), efa->mat_nr); else if(drawParamsMapped) flag= drawParamsMapped(userData, i); else @@ -900,7 +900,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, int flag; if(drawParams) - flag= drawParams(tf, mcol, efa->mat_nr); + flag= drawParams(tf, (mcol != NULL), efa->mat_nr); else if(drawParamsMapped) flag= drawParamsMapped(userData, i); else @@ -966,7 +966,7 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm, } } -static void emDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void emDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { emDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index afa310b0b80..707bf95f9c3 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -647,7 +647,7 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha } static void cdDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -673,7 +673,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, unsigned char *cp = NULL; if(drawParams) { - flag = drawParams(tf? &tf[i]: NULL, mcol? &mcol[i*4]: NULL, mf->mat_nr); + flag = drawParams(tf? &tf[i]: NULL, (mcol != NULL), mf->mat_nr); } else { if(index) { @@ -792,7 +792,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, int flag = 1; if(drawParams) { - flag = drawParams(tf? &tf[actualFace]: NULL, mcol? &mcol[actualFace*4]: NULL, mf[actualFace].mat_nr); + flag = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr); } else { if(index) { @@ -835,7 +835,7 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm, } } -static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 36263746228..3d3806f7c02 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -1583,7 +1583,7 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns } static void ccgDM_drawFacesTex_common(DerivedMesh *dm, - int (*drawParams)(MTFace *tface, MCol *mcol, int matnr), + int (*drawParams)(MTFace *tface, int has_mcol, int matnr), int (*drawParamsMapped)(void *userData, int index), void *userData) { @@ -1619,7 +1619,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } if(drawParams) - flag = drawParams(tf, mcol, mat_nr); + flag = drawParams(tf, (mcol != NULL), mat_nr); else if (index != ORIGINDEX_NONE) flag= (drawParamsMapped)? drawParamsMapped(userData, index): 1; else @@ -1722,7 +1722,7 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm, } } -static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, MCol *mcol, int matnr)) +static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr)) { ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL); } |