diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-23 14:35:10 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-23 14:56:39 +0300 |
commit | 55f122264c7faeedb4cdb1b3d1038ac3af28f6f2 (patch) | |
tree | f87c7fdfed0e599dc7130e1cae8f19b21a2e42f3 /source/blender/draw/modes/object_mode.c | |
parent | 0cbbcac23e47a686519b89c9cac7b2df2e4a4458 (diff) |
3D Grid: Fix grid passing through objects too much
For this we need to add a bias depending on the viewing angle.
But increasing the hardness of the test make float precision issues in
the mesh transformation more prominent (actual geometry is far below the
surface). So to solve this issue we use a more subdivided grid mesh
8x8 quads instead of 1 triangle.
Diffstat (limited to 'source/blender/draw/modes/object_mode.c')
-rw-r--r-- | source/blender/draw/modes/object_mode.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 934b9ada99f..3ae0bec77b2 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1042,7 +1042,7 @@ static void OBJECT_cache_init(void *vedata) DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND; psl->grid = DRW_pass_create("Infinite Grid Pass", state); - struct GPUBatch *quad = DRW_cache_fullscreen_quad_get(); + struct GPUBatch *geom = DRW_cache_grid_get(); static float mat[4][4]; unit_m4(mat); @@ -1058,7 +1058,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); DRW_shgroup_uniform_vec2(grp, "viewportSize", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); - DRW_shgroup_call_add(grp, quad, mat); + DRW_shgroup_call_add(grp, geom, mat); grp = DRW_shgroup_create(e_data.grid_sh, psl->grid); DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.grid_flag, 1); @@ -1066,7 +1066,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.grid_axes, 1); DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); - DRW_shgroup_call_add(grp, quad, mat); + DRW_shgroup_call_add(grp, geom, mat); grp = DRW_shgroup_create(e_data.grid_sh, psl->grid); DRW_shgroup_uniform_int(grp, "gridFlag", &e_data.zpos_flag, 1); @@ -1074,7 +1074,7 @@ static void OBJECT_cache_init(void *vedata) DRW_shgroup_uniform_vec3(grp, "planeAxes", e_data.zplane_axes, 1); DRW_shgroup_uniform_block(grp, "globalsBlock", globals_ubo); DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth); - DRW_shgroup_call_add(grp, quad, mat); + DRW_shgroup_call_add(grp, geom, mat); } for (int i = 0; i < 2; ++i) { |