diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-07-14 17:48:23 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-07-14 17:48:23 +0300 |
commit | 107e34407d0ae4120cc7a12fdb208986a0b47d8e (patch) | |
tree | ad19f330d4caa5d60d994b7bec9c1e2067e3bd75 /source/blender/blenkernel/intern/pbvh.c | |
parent | 1b8b9063f8d086b51f7e2b0ee9ca640903283cb1 (diff) |
Display optimizations part 1.
This patch changes the way we draw meshes by introducing
indexed drawing. This makes it possible to easily
upload and rearrange faces ad lib according to any criteria.
Currently we use material sorting but textured sorting and
hiding will be added to optimize textured drawing and skip
per face testing.
It also adds support for vertex buffers for subsurf
modifiers (Except from GLSL drawing), making drawing of
subsurf much faster without need for bogus modifiers.
Tests show that we gain approximately 20-25% performance
by that for solid mode drawing with up to 50% gains for
material drawing. Textured drawing should also have a
small performance gain, but more substantial optimizations
are possible there.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D1406
Diffstat (limited to 'source/blender/blenkernel/intern/pbvh.c')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index 361557633cb..e5e36b24a46 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -1679,6 +1679,7 @@ void BKE_pbvh_raycast_project_ray_root( typedef struct { DMSetMaterial setMaterial; bool wireframe; + bool fast; } PBVHNodeDrawData; void BKE_pbvh_node_draw(PBVHNode *node, void *data_v) @@ -1705,7 +1706,8 @@ void BKE_pbvh_node_draw(PBVHNode *node, void *data_v) if (!(node->flag & PBVH_FullyHidden)) { GPU_draw_pbvh_buffers(node->draw_buffers, data->setMaterial, - data->wireframe); + data->wireframe, + data->fast); } } @@ -1775,9 +1777,9 @@ static void pbvh_node_check_diffuse_changed(PBVH *bvh, PBVHNode *node) } void BKE_pbvh_draw(PBVH *bvh, float (*planes)[4], float (*face_nors)[3], - DMSetMaterial setMaterial, bool wireframe) + DMSetMaterial setMaterial, bool wireframe, bool fast) { - PBVHNodeDrawData draw_data = {setMaterial, wireframe}; + PBVHNodeDrawData draw_data = {setMaterial, wireframe, fast}; PBVHNode **nodes; int a, totnode; |