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_materials.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_materials.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_materials.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index d6d3ff8610b..e04063c4487 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -162,7 +162,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, Object *ob, int mat_nr, eV3DShadingColorType color_type, - bool hair, + eWORKBENCH_DataType datatype, bool *r_transp) { Image *ima = NULL; @@ -180,7 +180,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, switch (color_type) { case V3D_SHADING_TEXTURE_COLOR: { - return workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, sampler, hair); + return workbench_image_setup_ex(wpd, ob, mat_nr, ima, iuser, sampler, datatype); } case V3D_SHADING_MATERIAL_COLOR: { /* For now, we use the same ubo for material and object coloring but with different indices. @@ -191,7 +191,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, Material *ma = workbench_object_material_get(ob, mat_nr); const bool transp = wpd->shading.xray_alpha < 1.0f || ma->a < 1.0f; - WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][hair]; + WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][datatype]; if (r_transp && transp) { *r_transp = true; @@ -216,7 +216,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, } case V3D_SHADING_VERTEX_COLOR: { const bool transp = wpd->shading.xray_alpha < 1.0f; - DRWShadingGroup *grp = wpd->prepass[transp][infront][hair].vcol_shgrp; + DRWShadingGroup *grp = wpd->prepass[transp][infront][datatype].vcol_shgrp; return grp; } default: { @@ -231,7 +231,7 @@ DRWShadingGroup *workbench_material_setup_ex(WORKBENCH_PrivateData *wpd, workbench_material_ubo_data(wpd, ob, NULL, &wpd->material_ubo_data_curr[mat_id], color_type); const bool transp = wpd->shading.xray_alpha < 1.0f || ob->color[3] < 1.0f; - DRWShadingGroup *grp = wpd->prepass[transp][infront][hair].common_shgrp; + DRWShadingGroup *grp = wpd->prepass[transp][infront][datatype].common_shgrp; if (resource_changed) { grp = DRW_shgroup_create_sub(grp); DRW_shgroup_uniform_block(grp, "material_block", wpd->material_ubo_curr); @@ -251,7 +251,7 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd, Image *ima, ImageUser *iuser, eGPUSamplerState sampler, - bool hair) + eWORKBENCH_DataType datatype) { GPUTexture *tex = NULL, *tex_tile_data = NULL; @@ -275,7 +275,7 @@ DRWShadingGroup *workbench_image_setup_ex(WORKBENCH_PrivateData *wpd, const bool infront = (ob->dtx & OB_DRAWXRAY) != 0; const bool transp = wpd->shading.xray_alpha < 1.0f; - WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][hair]; + WORKBENCH_Prepass *prepass = &wpd->prepass[transp][infront][datatype]; DRWShadingGroup **grp_tex = NULL; /* A hashmap stores image shgroups to pack all similar drawcalls together. */ |