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:
Diffstat (limited to 'source/blender/editors/space_view3d/drawobject.c')
-rw-r--r--source/blender/editors/space_view3d/drawobject.c66
1 files changed, 49 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 2ab33669e4a..b4ccea71aa2 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -2077,6 +2077,28 @@ static int draw_dm_faces_sel__setDrawOptions(void *userData, int index, int *UNU
return 0;
}
+static int draw_dm_faces_sel__compareDrawOptions(void *userData, int index, int next_index)
+{
+ struct { unsigned char *cols[3]; EditFace *efa_act; } * data = userData;
+ EditFace *efa = EM_get_face_for_index(index);
+ EditFace *next_efa = EM_get_face_for_index(next_index);
+ unsigned char *col, *next_col;
+
+ if(efa == next_efa)
+ return 1;
+
+ if(efa == data->efa_act || next_efa == data->efa_act)
+ return 0;
+
+ col = data->cols[(efa->f&SELECT)?1:0];
+ next_col = data->cols[(next_efa->f&SELECT)?1:0];
+
+ if(col[3]==0 || next_col[3]==0)
+ return 0;
+
+ return col == next_col;
+}
+
/* also draws the active face */
static void draw_dm_faces_sel(DerivedMesh *dm, unsigned char *baseCol, unsigned char *selCol, unsigned char *actCol, EditFace *efa_act)
{
@@ -2086,7 +2108,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);
+ dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, &data, 0, GPU_enable_material, draw_dm_faces_sel__compareDrawOptions);
}
static int draw_dm_creases__setDrawOptions(void *UNUSED(userData), int index)
@@ -2496,7 +2518,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);
+ finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, NULL, 0, GPU_enable_material, NULL);
glFrontFace(GL_CCW);
glDisable(GL_LIGHTING);
@@ -2725,7 +2747,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);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
bglPolygonOffset(rv3d->dist, 1.0);
glDepthMask(0); // disable write in zbuffer, selected edge wires show better
@@ -2805,7 +2827,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);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, me->mface, 1, GPU_enable_material, NULL);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHTING);
@@ -2813,10 +2835,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);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 1, GPU_enable_material, NULL);
else {
glColor3f(1.0f, 1.0f, 1.0f);
- dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material);
+ dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions, NULL, 0, GPU_enable_material, NULL);
}
}
}
@@ -2891,7 +2913,18 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
Object *obedit= scene->obedit;
Mesh *me= ob->data;
EditMesh *em= me->edit_mesh;
- int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha;
+ int do_alpha_pass= 0, drawlinked= 0, retval= 0, glsl, check_alpha, i;
+
+ /* If we are drawing shadows and any of the materials don't cast a shadow,
+ * then don't draw the object */
+ if (v3d->flag2 & V3D_RENDER_SHADOW) {
+ for(i=0; i<ob->totcol; ++i) {
+ Material *ma= give_current_material(ob, i);
+ if (ma && !(ma->mode & MA_SHADBUF)) {
+ return 1;
+ }
+ }
+ }
if(obedit && ob!=obedit && ob->data==obedit->data) {
if(ob_get_key(ob) || ob_get_key(obedit));
@@ -6165,8 +6198,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
}
/* draw code for smoke */
- if((md = modifiers_findByType(ob, eModifierType_Smoke)))
- {
+ if((md = modifiers_findByType(ob, eModifierType_Smoke))) {
SmokeModifierData *smd = (SmokeModifierData *)md;
// draw collision objects
@@ -6501,7 +6533,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);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*)(intptr_t) 1, 0, GPU_enable_material, NULL);
if(check_ob_drawface_dot(scene, v3d, ob->dt)) {
glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE));
@@ -6512,7 +6544,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);
+ dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, (void*) 0, 0, GPU_enable_material, NULL);
}
}
@@ -6541,8 +6573,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);
- else dm->drawMappedFaces(dm, bbs_mesh_solid__setDrawOpts, me, 0, GPU_enable_material);
+ 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);
dm->release(dm);
}
@@ -6558,7 +6590,6 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
switch( ob->type) {
case OB_MESH:
- {
if(ob->mode & OB_MODE_EDIT) {
Mesh *me= ob->data;
EditMesh *em= me->edit_mesh;
@@ -6592,8 +6623,9 @@ void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Objec
EM_free_index_arrays();
}
- else bbs_mesh_solid(scene, ob);
- }
+ else {
+ bbs_mesh_solid(scene, ob);
+ }
break;
case OB_CURVE:
case OB_SURF:
@@ -6649,7 +6681,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);
+ edm->drawMappedFaces(edm, NULL, NULL, 0, GPU_enable_material, NULL);
glDisable(GL_LIGHTING);
}