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:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-12-01 16:12:39 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-12-01 16:12:39 +0400
commitf6f7e270e30946d0bb3ea4d5c556c994125e590f (patch)
tree4e77f43a26d834d0eed6917ec20bfa1bdb6d9902 /source/blender/blenkernel/intern/DerivedMesh.c
parentc74f6a51b66485eb2158ad1efc79be1eca5c5949 (diff)
Slight refactor of VBO code to deal with multiple textures.
Added compareDrawSettings callback to driver mesh's callbacks which are drawing textured faces (mapped and not mapped). This new callback checks if two faces are drawing with the same settings (testures, shading etc) and if they not, flush of faces happens into ogl using glDrawArrays and next face would be drawn with it's own settings. Currently implemented compareDrawSettings is used to resolve issue from bug report only, probably there are extra places where this callback is needed, but haven't seen configuration where current logic will fail, so it should be ok. Also reordered arguments passing to drawMappedFaces DM's callbacks, so now all drawing callback are accepting list of callbacks and then userData, instead of using mixed order of callbacks and userData which was a bit confusing to work with. This commit fixes: - #26410: VBO & multitexture doesnt work - #29464: VBO enabled causes UV coruption
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.c')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 4e26078a2c5..f4092133996 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -641,8 +641,11 @@ static void emDM_foreachMappedFaceCenter(DerivedMesh *dm, void (*func)(void *use
}
/* note, material function is ignored for now. */
-static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int UNUSED(useColors), int (*setMaterial)(int, void *attribs),
- int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
+static void emDM_drawMappedFaces(DerivedMesh *dm,
+ int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r),
+ int (*setMaterial)(int, void *attribs),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+ void *userData, int UNUSED(useColors))
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditFace *efa;
@@ -809,7 +812,8 @@ static void emDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
static void emDM_drawFacesTex_common(DerivedMesh *dm,
int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
int (*drawParamsMapped)(void *userData, int index),
- void *userData)
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+ void *userData)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditMesh *em= emdm->em;
@@ -818,6 +822,8 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
EditFace *efa;
int i;
+ (void) compareDrawOptions;
+
/* always use smooth shading even for flat faces, else vertex colors wont interpolate */
glShadeModel(GL_SMOOTH);
@@ -974,19 +980,26 @@ static void emDM_drawFacesTex_common(DerivedMesh *dm,
}
}
-static void emDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
+static void emDM_drawFacesTex(DerivedMesh *dm,
+ int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+ void *userData)
{
- emDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
+ emDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
}
-static void emDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData)
+static void emDM_drawMappedFacesTex(DerivedMesh *dm,
+ int (*setDrawOptions)(void *userData, int index),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+ void *userData)
{
- emDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData);
+ emDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
}
static void emDM_drawMappedFacesGLSL(DerivedMesh *dm,
int (*setMaterial)(int, void *attribs),
- int (*setDrawOptions)(void *userData, int index), void *userData)
+ int (*setDrawOptions)(void *userData, int index),
+ void *userData)
{
EditMeshDerivedMesh *emdm= (EditMeshDerivedMesh*) dm;
EditMesh *em= emdm->em;
@@ -3168,9 +3181,14 @@ static void navmesh_drawColored(DerivedMesh *dm)
glEnable(GL_LIGHTING);
}
-static void navmesh_DM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
+static void navmesh_DM_drawFacesTex(DerivedMesh *dm,
+ int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
+ int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
+ void *userData)
{
(void) setDrawOptions;
+ (void) compareDrawOptions;
+ (void) userData;
navmesh_drawColored(dm);
}