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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-18 16:42:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2012-12-18 16:42:13 +0400
commit1d9271cdd7797b69c1fbb13a5e0be4285479d00d (patch)
tree5360b9c860c29f428bc250d971ec0cfdf70cb069 /source/blender/editors/space_view3d/drawmesh.c
parent6030b08cafdebfa3a386bc12afb172d258d0ee81 (diff)
Fix #33599: VBO textured draw mode did not update correctly when an image filepath
was changed to an invalid one. Also fixed Object Color not being displayed correctly with VBO's. The way it has to clear the VBO buffers here is quite poor though and slow, we really need textures and materials in the depsgraph to do this quicker.
Diffstat (limited to 'source/blender/editors/space_view3d/drawmesh.c')
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 0ecde350b00..e36654323fd 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -415,14 +415,14 @@ static void draw_textured_end(void)
static DMDrawOption draw_tface__set_draw_legacy(MTFace *tface, int has_mcol, int matnr)
{
Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
- int validtexture = 0;
+ int invalidtexture = 0;
if (ma && (ma->game.flag & GEMAT_INVISIBLE))
return DM_DRAW_OPTION_SKIP;
- validtexture = set_draw_settings_cached(0, tface, ma, Gtexdraw);
+ invalidtexture = set_draw_settings_cached(0, tface, ma, Gtexdraw);
- if (tface && validtexture) {
+ if (tface && invalidtexture) {
glColor3ub(0xFF, 0x00, 0xFF);
return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
}
@@ -457,25 +457,14 @@ static DMDrawOption draw_mcol__set_draw_legacy(MTFace *UNUSED(tface), int has_mc
return DM_DRAW_OPTION_NO_MCOL;
}
-static DMDrawOption draw_tface__set_draw(MTFace *tface, int has_mcol, int matnr)
+static DMDrawOption draw_tface__set_draw(MTFace *UNUSED(tface), int UNUSED(has_mcol), int matnr)
{
Material *ma = give_current_material(Gtexdraw.ob, matnr + 1);
if (ma && (ma->game.flag & GEMAT_INVISIBLE)) return 0;
- if (tface && set_draw_settings_cached(0, tface, ma, Gtexdraw)) {
- return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
- }
- else if (tface && (tface->mode & TF_OBCOL)) {
- return DM_DRAW_OPTION_NO_MCOL; /* Don't set color */
- }
- else if (!has_mcol) {
- /* XXX: this return value looks wrong (and doesn't match comment) */
- return DM_DRAW_OPTION_NORMAL; /* Don't set color */
- }
- else {
- return DM_DRAW_OPTION_NORMAL; /* Set color from mcol */
- }
+ /* always use color from mcol, as set in update_tface_color_layer */
+ return DM_DRAW_OPTION_NORMAL;
}
static void update_tface_color_layer(DerivedMesh *dm)
@@ -517,11 +506,11 @@ static void update_tface_color_layer(DerivedMesh *dm)
finalCol[i * 4 + j].r = 255;
}
}
- else if (tface && (tface->mode & TF_OBCOL)) {
+ else if (ma && (ma->shade_flag & MA_OBCOLOR)) {
for (j = 0; j < 4; j++) {
- finalCol[i * 4 + j].b = FTOCHAR(Gtexdraw.obcol[0]);
- finalCol[i * 4 + j].g = FTOCHAR(Gtexdraw.obcol[1]);
- finalCol[i * 4 + j].r = FTOCHAR(Gtexdraw.obcol[2]);
+ finalCol[i * 4 + j].b = Gtexdraw.obcol[0];
+ finalCol[i * 4 + j].g = Gtexdraw.obcol[1];
+ finalCol[i * 4 + j].r = Gtexdraw.obcol[2];
}
}
else if (!mcol) {