diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 21:10:45 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-15 21:10:45 +0300 |
commit | 058514aa0abfbbeb87a89d863a2cdc85b5bdb5c4 (patch) | |
tree | 5eeb9adf61396e50046f53f10a77d1fbb4a397e5 /source/blender/draw/engines/workbench/workbench_opaque.c | |
parent | d4d810f817afc61618bec6f3b0a0ade5d0111d3c (diff) |
PointCloud: Initial rendering support for Workbench
Also includes outline overlays. Removes the temp overlay drawing
We make the geometry follow camera like billboards this uses less
geometry. Currently we use half octahedron for now. Goal would be
to use icospheres.
This patch also optimize the case when pointcloud has uniform radius.
However we should premultiply the radius prop by the default radius
beforehand to avoid a multiplication on CPU.
Using geometry instead of pseudo raytraced spheres is more scalable as
we can render as low as 1 or 2 triangle to a full half sphere and can
integrate easily in the render pipeline using a low amount of code.
Reviewed By: brecht
Differential Revision: https://developer.blender.org/D8301
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_opaque.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_opaque.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_opaque.c b/source/blender/draw/engines/workbench/workbench_opaque.c index 27d5b71f35c..738f4a67471 100644 --- a/source/blender/draw/engines/workbench/workbench_opaque.c +++ b/source/blender/draw/engines/workbench/workbench_opaque.c @@ -59,10 +59,10 @@ void workbench_opaque_engine_init(WORKBENCH_Data *data) }); } -void workbench_opaque_cache_init(WORKBENCH_Data *data) +void workbench_opaque_cache_init(WORKBENCH_Data *vedata) { - WORKBENCH_PassList *psl = data->psl; - WORKBENCH_PrivateData *wpd = data->stl->wpd; + WORKBENCH_PassList *psl = vedata->psl; + WORKBENCH_PrivateData *wpd = vedata->stl->wpd; DefaultTextureList *dtxl = DRW_viewport_texture_list_get(); struct GPUShader *sh; DRWShadingGroup *grp; @@ -84,31 +84,31 @@ void workbench_opaque_cache_init(WORKBENCH_Data *data) pass = psl->opaque_ps; } - for (int hair = 0; hair < 2; hair++) { - wpd->prepass[opaque][infront][hair].material_hash = BLI_ghash_ptr_new(__func__); + for (eWORKBENCH_DataType data = 0; data < WORKBENCH_DATATYPE_MAX; data++) { + wpd->prepass[opaque][infront][data].material_hash = BLI_ghash_ptr_new(__func__); - sh = workbench_shader_opaque_get(wpd, hair); + sh = workbench_shader_opaque_get(wpd, data); - wpd->prepass[opaque][infront][hair].common_shgrp = grp = DRW_shgroup_create(sh, pass); + wpd->prepass[opaque][infront][data].common_shgrp = grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); DRW_shgroup_uniform_int_copy(grp, "materialIndex", -1); DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap); - wpd->prepass[opaque][infront][hair].vcol_shgrp = grp = DRW_shgroup_create(sh, pass); + wpd->prepass[opaque][infront][data].vcol_shgrp = grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. (uses vcol) */ DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap); - sh = workbench_shader_opaque_image_get(wpd, hair, false); + sh = workbench_shader_opaque_image_get(wpd, data, false); - wpd->prepass[opaque][infront][hair].image_shgrp = grp = DRW_shgroup_create(sh, pass); + wpd->prepass[opaque][infront][data].image_shgrp = grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */ DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap); - sh = workbench_shader_opaque_image_get(wpd, hair, true); + sh = workbench_shader_opaque_image_get(wpd, data, true); - wpd->prepass[opaque][infront][hair].image_tiled_shgrp = grp = DRW_shgroup_create(sh, pass); + wpd->prepass[opaque][infront][data].image_tiled_shgrp = grp = DRW_shgroup_create(sh, pass); DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); DRW_shgroup_uniform_int_copy(grp, "materialIndex", 0); /* Default material. */ DRW_shgroup_uniform_bool_copy(grp, "useMatcap", use_matcap); |