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
This commit is contained in:
@@ -255,7 +255,11 @@ struct DerivedMesh {
|
||||
*/
|
||||
void (*drawFacesTex)(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(struct MTFace *tface,
|
||||
int has_mcol, int matnr));
|
||||
int has_mcol, int matnr),
|
||||
int (*compareDrawOptions)(void *userData,
|
||||
int cur_index,
|
||||
int next_index),
|
||||
void *userData);
|
||||
|
||||
/* Draw all faces with GLSL materials
|
||||
* o setMaterial is called for every different material nr
|
||||
@@ -280,9 +284,11 @@ struct DerivedMesh {
|
||||
void (*drawMappedFaces)(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(void *userData, int index,
|
||||
int *drawSmooth_r),
|
||||
void *userData, int useColors,
|
||||
int (*setMaterial)(int, void *attribs),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index));
|
||||
int (*compareDrawOptions)(void *userData,
|
||||
int cur_index,
|
||||
int next_index),
|
||||
void *userData, int useColors);
|
||||
|
||||
/* Draw mapped faces using MTFace
|
||||
* o Drawing options too complicated to enumerate, look at code.
|
||||
@@ -290,6 +296,9 @@ struct DerivedMesh {
|
||||
void (*drawMappedFacesTex)(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(void *userData,
|
||||
int index),
|
||||
int (*compareDrawOptions)(void *userData,
|
||||
int cur_index,
|
||||
int next_index),
|
||||
void *userData);
|
||||
|
||||
/* Draw mapped faces with GLSL materials
|
||||
@@ -299,7 +308,8 @@ struct DerivedMesh {
|
||||
*/
|
||||
void (*drawMappedFacesGLSL)(DerivedMesh *dm,
|
||||
int (*setMaterial)(int, void *attribs),
|
||||
int (*setDrawOptions)(void *userData, int index), void *userData);
|
||||
int (*setDrawOptions)(void *userData, int index),
|
||||
void *userData);
|
||||
|
||||
/* Draw mapped edges as lines
|
||||
* o Only if !setDrawOptions or setDrawOptions(userData, mapped-edge)
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -647,6 +647,7 @@ static void cdDM_drawFacesColored(DerivedMesh *dm, int useTwoSided, unsigned cha
|
||||
static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
|
||||
int (*drawParamsMapped)(void *userData, int index),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
|
||||
@@ -771,24 +772,18 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
}
|
||||
|
||||
if( !GPU_buffer_legacy(dm) ) {
|
||||
/* warning!, this logic is incorrect, see bug [#27175]
|
||||
* firstly, there are no checks for changes in context, such as texface image.
|
||||
* secondly, drawParams() sets the GL context, so checking if there is a change
|
||||
* from lastFlag is too late once glDrawArrays() runs, since drawing the arrays
|
||||
* will use the modified, OpenGL settings.
|
||||
*
|
||||
* However its tricky to fix this without duplicating the internal logic
|
||||
* of drawParams(), perhaps we need an argument like...
|
||||
* drawParams(..., keep_gl_state_but_return_when_changed) ?.
|
||||
*
|
||||
* We could also just disable VBO's here, since texface may be deprecated - campbell.
|
||||
*/
|
||||
|
||||
int tottri = dm->drawObject->tot_triangle_point/3;
|
||||
int next_actualFace= dm->drawObject->triangle_to_mface[0];
|
||||
|
||||
glShadeModel( GL_SMOOTH );
|
||||
lastFlag = 0;
|
||||
for(i = 0; i < dm->drawObject->tot_triangle_point/3; i++) {
|
||||
int actualFace = dm->drawObject->triangle_to_mface[i];
|
||||
for(i = 0; i < tottri; i++) {
|
||||
int actualFace = next_actualFace;
|
||||
int flag = 1;
|
||||
int flush = 0;
|
||||
|
||||
if(i != tottri-1)
|
||||
next_actualFace= dm->drawObject->triangle_to_mface[i+1];
|
||||
|
||||
if(drawParams) {
|
||||
flag = drawParams(tf? &tf[actualFace]: NULL, (mcol != NULL), mf[actualFace].mat_nr);
|
||||
@@ -804,27 +799,36 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
if(drawParamsMapped)
|
||||
flag = drawParamsMapped(userData, actualFace);
|
||||
}
|
||||
if( flag != lastFlag ) {
|
||||
if( startFace < i ) {
|
||||
if( lastFlag != 0 ) { /* if the flag is 0 it means the face is hidden or invisible */
|
||||
if (lastFlag==1 && col)
|
||||
GPU_color_switch(1);
|
||||
else
|
||||
GPU_color_switch(0);
|
||||
glDrawArrays(GL_TRIANGLES,startFace*3,(i-startFace)*3);
|
||||
}
|
||||
|
||||
/* flush buffer if current triangle isn't drawable or it's last triangle */
|
||||
flush= !flag || i == tottri - 1;
|
||||
|
||||
if(!flush && compareDrawOptions) {
|
||||
int next_orig= (index==NULL) ? next_actualFace : index[next_actualFace];
|
||||
|
||||
if(orig==ORIGINDEX_NONE || next_orig==ORIGINDEX_NONE) {
|
||||
flush= 1;
|
||||
} else {
|
||||
/* also compare draw options and flush buffer if they're different
|
||||
need for face selection highlight in edit mode */
|
||||
flush|= compareDrawOptions(userData, orig, next_orig) == 0;
|
||||
}
|
||||
lastFlag = flag;
|
||||
startFace = i;
|
||||
}
|
||||
}
|
||||
if( startFace < dm->drawObject->tot_triangle_point/3 ) {
|
||||
if( lastFlag != 0 ) { /* if the flag is 0 it means the face is hidden or invisible */
|
||||
if (lastFlag==1 && col)
|
||||
GPU_color_switch(1);
|
||||
else
|
||||
GPU_color_switch(0);
|
||||
glDrawArrays(GL_TRIANGLES, startFace*3, dm->drawObject->tot_triangle_point - startFace*3);
|
||||
|
||||
if(flush) {
|
||||
int first= startFace*3;
|
||||
int count= (i-startFace+(flag ? 1 : 0))*3; /* Add one to the length if we're drawing at the end of the array */
|
||||
|
||||
if(count) {
|
||||
if (col)
|
||||
GPU_color_switch(1);
|
||||
else
|
||||
GPU_color_switch(0);
|
||||
|
||||
glDrawArrays(GL_TRIANGLES, first, count);
|
||||
}
|
||||
|
||||
startFace = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -834,13 +838,19 @@ static void cdDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
}
|
||||
}
|
||||
|
||||
static void cdDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
|
||||
static void cdDM_drawFacesTex(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
|
||||
cdDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
|
||||
}
|
||||
|
||||
static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index))
|
||||
static void cdDM_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 useColors)
|
||||
{
|
||||
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
|
||||
MVert *mv = cddm->mvert;
|
||||
@@ -1009,9 +1019,12 @@ static void cdDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *us
|
||||
}
|
||||
}
|
||||
|
||||
static void cdDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData)
|
||||
static void cdDM_drawMappedFacesTex(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(void *userData, int index),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData);
|
||||
cdDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
|
||||
}
|
||||
|
||||
static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int a, int index, int vert, int smoothnormal)
|
||||
@@ -1058,7 +1071,10 @@ static void cddm_draw_attrib_vertex(DMVertexAttribs *attribs, MVert *mvert, int
|
||||
glVertex3fv(mvert[index].co);
|
||||
}
|
||||
|
||||
static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData)
|
||||
static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
||||
int (*setMaterial)(int, void *attribs),
|
||||
int (*setDrawOptions)(void *userData, int index),
|
||||
void *userData)
|
||||
{
|
||||
CDDerivedMesh *cddm = (CDDerivedMesh*) dm;
|
||||
GPUVertexAttribs gattribs;
|
||||
@@ -1348,7 +1364,7 @@ static void cdDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, vo
|
||||
glShadeModel(GL_FLAT);
|
||||
}
|
||||
|
||||
static void cdDM_drawFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs))
|
||||
static void cdDM_drawFacesGLSL(DerivedMesh *dm,int (*setMaterial)(int, void *attribs))
|
||||
{
|
||||
dm->drawMappedFacesGLSL(dm, setMaterial, NULL, NULL);
|
||||
}
|
||||
|
@@ -1368,7 +1368,11 @@ static void ccgDM_drawFacesSolid(DerivedMesh *dm, float (*partial_redraw_planes)
|
||||
}
|
||||
|
||||
/* Only used by non-editmesh types */
|
||||
static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm, int (*setMaterial)(int, void *attribs), int (*setDrawOptions)(void *userData, int index), void *userData) {
|
||||
static void ccgDM_drawMappedFacesGLSL(DerivedMesh *dm,
|
||||
int (*setMaterial)(int, void *attribs),
|
||||
int (*setDrawOptions)(void *userData, int index),
|
||||
void *userData)
|
||||
{
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
GPUVertexAttribs gattribs;
|
||||
@@ -1725,6 +1729,7 @@ static void ccgDM_drawFacesColored(DerivedMesh *dm, int UNUSED(useTwoSided), uns
|
||||
static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
int (*drawParams)(MTFace *tface, int has_mcol, int matnr),
|
||||
int (*drawParamsMapped)(void *userData, int index),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
@@ -1735,6 +1740,8 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
int i, totface, flag, gridSize = ccgSubSurf_getGridSize(ss);
|
||||
int gridFaces = gridSize - 1;
|
||||
|
||||
(void) compareDrawOptions;
|
||||
|
||||
ccgdm_pbvh_update(ccgdm);
|
||||
|
||||
if(!mcol)
|
||||
@@ -1865,14 +1872,20 @@ static void ccgDM_drawFacesTex_common(DerivedMesh *dm,
|
||||
}
|
||||
}
|
||||
|
||||
static void ccgDM_drawFacesTex(DerivedMesh *dm, int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr))
|
||||
static void ccgDM_drawFacesTex(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(MTFace *tface, int has_mcol, int matnr),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, NULL);
|
||||
ccgDM_drawFacesTex_common(dm, setDrawOptions, NULL, compareDrawOptions, userData);
|
||||
}
|
||||
|
||||
static void ccgDM_drawMappedFacesTex(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index), void *userData)
|
||||
static void ccgDM_drawMappedFacesTex(DerivedMesh *dm,
|
||||
int (*setDrawOptions)(void *userData, int index),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index),
|
||||
void *userData)
|
||||
{
|
||||
ccgDM_drawFacesTex_common(dm, NULL, setDrawOptions, userData);
|
||||
ccgDM_drawFacesTex_common(dm, NULL, setDrawOptions, compareDrawOptions, userData);
|
||||
}
|
||||
|
||||
static void ccgDM_drawUVEdges(DerivedMesh *dm)
|
||||
@@ -1908,8 +1921,12 @@ static void ccgDM_drawUVEdges(DerivedMesh *dm)
|
||||
}
|
||||
}
|
||||
|
||||
static void ccgDM_drawMappedFaces(DerivedMesh *dm, int (*setDrawOptions)(void *userData, int index, int *drawSmooth_r), void *userData, int useColors, int (*setMaterial)(int, void *attribs),
|
||||
int (*compareDrawOptions)(void *userData, int cur_index, int next_index)) {
|
||||
static void ccgDM_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 useColors)
|
||||
{
|
||||
CCGDerivedMesh *ccgdm = (CCGDerivedMesh*) dm;
|
||||
CCGSubSurf *ss = ccgdm->ss;
|
||||
MCol *mcol= NULL;
|
||||
|
@@ -180,7 +180,7 @@ static void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm)
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
/* dull unselected faces so as not to get in the way of seeing color */
|
||||
glColor4ub(96, 96, 96, 64);
|
||||
dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, (void*)me);
|
||||
dm->drawMappedFacesTex(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, (void*)me);
|
||||
|
||||
glDisable(GL_BLEND);
|
||||
}
|
||||
@@ -629,6 +629,21 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
|
||||
ddm->release(ddm);
|
||||
}
|
||||
|
||||
static int compareDrawOptions(void *userData, int cur_index, int next_index)
|
||||
{
|
||||
Mesh *me= (Mesh*) userData;
|
||||
MFace *mf= CustomData_get_layer(&me->fdata, CD_MFACE);
|
||||
MTFace *tf= CustomData_get_layer(&me->fdata, CD_MTFACE);
|
||||
|
||||
if(mf[cur_index].mat_nr != mf[next_index].mat_nr)
|
||||
return 0;
|
||||
|
||||
if(tf[cur_index].tpage != tf[next_index].tpage)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, DerivedMesh *dm, int draw_flags)
|
||||
{
|
||||
Mesh *me= ob->data;
|
||||
@@ -649,26 +664,26 @@ void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
|
||||
data.has_mcol= CustomData_has_layer(&me->edit_mesh->fdata, CD_MCOL);
|
||||
data.has_mtface= CustomData_has_layer(&me->edit_mesh->fdata, CD_MTFACE);
|
||||
|
||||
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, &data);
|
||||
dm->drawMappedFacesTex(dm, draw_em_tf_mapped__set_draw, NULL, &data);
|
||||
}
|
||||
else if(draw_flags & DRAW_FACE_SELECT) {
|
||||
if(ob->mode & OB_MODE_WEIGHT_PAINT)
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me, 1, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me, 1);
|
||||
else
|
||||
dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, me);
|
||||
dm->drawMappedFacesTex(dm, me->mface ? draw_tface_mapped__set_draw : NULL, NULL, me);
|
||||
}
|
||||
else {
|
||||
if(GPU_buffer_legacy(dm)) {
|
||||
if (draw_flags & DRAW_DYNAMIC_PAINT_PREVIEW)
|
||||
dm->drawFacesTex(dm, draw_mcol__set_draw_legacy);
|
||||
dm->drawFacesTex(dm, draw_mcol__set_draw_legacy, NULL, NULL);
|
||||
else
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw_legacy);
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw_legacy, NULL, NULL);
|
||||
}
|
||||
else {
|
||||
if(!CustomData_has_layer(&dm->faceData,CD_TEXTURE_MCOL))
|
||||
add_tface_color_layer(dm);
|
||||
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw);
|
||||
dm->drawFacesTex(dm, draw_tface__set_draw, compareDrawOptions, ob->data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -806,7 +821,7 @@ void draw_mesh_textured(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *o
|
||||
int useColors= 1;
|
||||
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions,
|
||||
ob->data, useColors, GPU_enable_material, NULL);
|
||||
GPU_enable_material, NULL, ob->data, useColors);
|
||||
}
|
||||
else {
|
||||
Mesh *me= ob->data;
|
||||
|
@@ -2372,7 +2372,7 @@ static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned
|
||||
data.cols[2] = actCol;
|
||||
data.efa_act = efa_act;
|
||||
|
||||
dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions);
|
||||
dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions, &data, 0);
|
||||
}
|
||||
|
||||
static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index)
|
||||
@@ -2782,7 +2782,7 @@ static void draw_em_fancy(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
|
||||
glEnable(GL_LIGHTING);
|
||||
glFrontFace((ob->transflag&OB_NEG_SCALE)?GL_CW:GL_CCW);
|
||||
|
||||
finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL);
|
||||
finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, NULL, 0);
|
||||
|
||||
glFrontFace(GL_CCW);
|
||||
glDisable(GL_LIGHTING);
|
||||
@@ -3032,7 +3032,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
/* weight paint in solid mode, special case. focus on making the weights clear
|
||||
* rather than the shading, this is also forced in wire view */
|
||||
GPU_enable_material(0, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me->mface, 1);
|
||||
|
||||
bglPolygonOffset(rv3d->dist, 1.0);
|
||||
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
|
||||
@@ -3084,7 +3084,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
dm->drawMappedFaces(dm, NULL, NULL, 1, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, NULL, GPU_enable_material, NULL, NULL, 1);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
@@ -3156,7 +3156,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, me->mface, 1);
|
||||
glDisable(GL_COLOR_MATERIAL);
|
||||
glDisable(GL_LIGHTING);
|
||||
|
||||
@@ -3164,10 +3164,10 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
}
|
||||
else if(ob->mode & (OB_MODE_VERTEX_PAINT|OB_MODE_TEXTURE_PAINT)) {
|
||||
if(me->mcol)
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, NULL, 1);
|
||||
else {
|
||||
glColor3f(1.0f, 1.0f, 1.0f);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, GPU_enable_material, NULL, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6859,7 +6859,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh
|
||||
cpack(0);
|
||||
|
||||
if (facecol) {
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, (void*)(intptr_t) 1, 0);
|
||||
|
||||
if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
|
||||
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
|
||||
@@ -6870,7 +6870,7 @@ static void bbs_mesh_solid_EM(Scene *scene, View3D *v3d, Object *ob, DerivedMesh
|
||||
}
|
||||
|
||||
} else {
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, GPU_enable_material, NULL, (void*) 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6910,8 +6910,8 @@ static void bbs_mesh_solid(Scene *scene, Object *ob)
|
||||
|
||||
glColor3ub(0, 0, 0);
|
||||
|
||||
if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, me, 0, GPU_enable_material, NULL);
|
||||
else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material, NULL);
|
||||
if((me->editflag & ME_EDIT_PAINT_MASK)) dm->drawMappedFaces(dm, bbs_mesh_solid_hide__setDrawOpts, GPU_enable_material, NULL, me, 0);
|
||||
else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, GPU_enable_material, NULL, me, 0);
|
||||
|
||||
dm->release(dm);
|
||||
}
|
||||
@@ -6969,7 +6969,7 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
|
||||
DerivedMesh *dm = mesh_get_derived_final(scene, ob, scene->customdata_mask);
|
||||
glColor3ub(0, 0, 0);
|
||||
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, me, 0, GPU_enable_material, NULL);
|
||||
dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0);
|
||||
|
||||
|
||||
bbs_obmode_mesh_verts(ob, dm, 1);
|
||||
@@ -7035,7 +7035,7 @@ static void draw_object_mesh_instance(Scene *scene, View3D *v3d, RegionView3D *r
|
||||
GPU_end_object_materials();
|
||||
}
|
||||
else if(edm)
|
||||
edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material, NULL);
|
||||
edm->drawMappedFaces(edm, NULL, GPU_enable_material, NULL, NULL, 0);
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
}
|
||||
|
@@ -896,7 +896,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
|
||||
//ms.m_pDerivedMesh->drawMappedFacesTex(ms.m_pDerivedMesh, CheckTexfaceDM, mcol);
|
||||
current_blmat_nr = current_polymat->GetMaterialIndex();
|
||||
current_image = current_polymat->GetBlenderImage();
|
||||
ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM);
|
||||
ms.m_pDerivedMesh->drawFacesTex(ms.m_pDerivedMesh, CheckTexDM, NULL, NULL);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user