diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-25 21:00:49 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-25 21:00:49 +0300 |
commit | 53f6a31c4de18fb3db8cdd34c0f9b0495319183f (patch) | |
tree | ca030111dfd5e213e0377b9273d2a4fc9d725fd1 /source/blender/editors | |
parent | 17e3f905e13f6424258668c8c15f248d56e60cc1 (diff) |
GPU Buffers:
This commit begins implementation of the idea about hidden face
separation outlined in
http://code.blender.org/2015/06/optimizing-blenders-real-time-mesh-
We split hidden and visible faces to different parts of the triangle
buffer.
Mapped drawing will now skip iterating through hidden polys.
Of course the final target, when all derived mesh types use
VBO sorting, is to skip checking for hide flag per face
completely. All faces will be pre-sorted anyway and we'll
be able to draw them with one draw call.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_view3d/drawmesh.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c index ea1e3178bd0..6085f0c4483 100644 --- a/source/blender/editors/space_view3d/drawmesh.c +++ b/source/blender/editors/space_view3d/drawmesh.c @@ -194,7 +194,7 @@ void draw_mesh_face_select(RegionView3D *rv3d, Mesh *me, DerivedMesh *dm, bool d 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->drawMappedFaces(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, NULL, (void *)me, 0); + dm->drawMappedFaces(dm, draw_mesh_face_select__drawFaceOptsInv, NULL, NULL, (void *)me, DM_DRAW_SKIP_HIDDEN); glDisable(GL_BLEND); } @@ -959,7 +959,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d else if (draw_flags & DRAW_FACE_SELECT) { if (ob->mode & OB_MODE_WEIGHT_PAINT) dm->drawMappedFaces(dm, wpaint__setSolidDrawOptions_facemask, GPU_enable_material, NULL, me, - DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH); + DM_DRAW_USE_COLORS | DM_DRAW_ALWAYS_SMOOTH | DM_DRAW_SKIP_HIDDEN); else { drawTFace_userData userData; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 147c714fee4..fee68057646 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -3063,7 +3063,7 @@ static void draw_dm_faces_sel(BMEditMesh *em, DerivedMesh *dm, unsigned char *ba /* double lookup */ data.orig_index_mp_to_orig = DM_get_poly_data_layer(dm, CD_ORIGINDEX); - dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, NULL, draw_dm_faces_sel__compareDrawOptions, &data, 0); + dm->drawMappedFaces(dm, draw_dm_faces_sel__setDrawOptions, NULL, draw_dm_faces_sel__compareDrawOptions, &data, DM_DRAW_SKIP_HIDDEN); } static DMDrawOption draw_dm_creases__setDrawOptions(void *userData, int index) @@ -3763,7 +3763,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, /* use the cageDM since it always overlaps the editmesh faces */ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); cageDM->drawMappedFaces(cageDM, draw_em_fancy__setFaceOpts, - GPU_enable_material, NULL, me->edit_btmesh, 0); + GPU_enable_material, NULL, me->edit_btmesh, DM_DRAW_SKIP_HIDDEN); glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); } else if (check_object_draw_texture(scene, v3d, dt)) { @@ -3787,7 +3787,7 @@ static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d, glEnable(GL_LIGHTING); glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW); - finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, me->edit_btmesh, 0); + finalDM->drawMappedFaces(finalDM, draw_em_fancy__setFaceOpts, GPU_enable_material, NULL, me->edit_btmesh, DM_DRAW_SKIP_HIDDEN); glFrontFace(GL_CCW); glDisable(GL_LIGHTING); @@ -8445,7 +8445,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, cpack(0); if (use_faceselect) { - dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, NULL, NULL, em->bm, 0); + dm->drawMappedFaces(dm, bbs_mesh_solid__setSolidDrawOptions, NULL, NULL, em->bm, DM_DRAW_SKIP_HIDDEN); if (check_ob_drawface_dot(scene, v3d, ob->dt)) { glPointSize(UI_GetThemeValuef(TH_FACEDOT_SIZE)); @@ -8457,7 +8457,7 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d, } else { - dm->drawMappedFaces(dm, bbs_mesh_mask__setSolidDrawOptions, NULL, NULL, em->bm, DM_DRAW_SKIP_SELECT); + dm->drawMappedFaces(dm, bbs_mesh_mask__setSolidDrawOptions, NULL, NULL, em->bm, DM_DRAW_SKIP_SELECT | DM_DRAW_SKIP_HIDDEN); } } @@ -8501,7 +8501,7 @@ static void bbs_mesh_solid_verts(Scene *scene, Object *ob) DM_update_materials(dm, ob); - dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, 0); + dm->drawMappedFaces(dm, bbs_mesh_solid_hide2__setDrawOpts, GPU_enable_material, NULL, me, DM_DRAW_SKIP_HIDDEN); bbs_obmode_mesh_verts(ob, dm, 1); bm_vertoffs = me->totvert + 1; |