[Bf-blender-cvs] [f90272b650a] tmp-workbench-rewrite2: clip planes (w.i.p.)
Miguel Pozo
noreply at git.blender.org
Tue Oct 18 20:06:11 CEST 2022
Commit: f90272b650a7c92b2b98281c6c94e2b860d7a8ce
Author: Miguel Pozo
Date: Mon Oct 17 13:05:53 2022 +0200
Branches: tmp-workbench-rewrite2
https://developer.blender.org/rBf90272b650a7c92b2b98281c6c94e2b860d7a8ce
clip planes (w.i.p.)
===================================================================
M source/blender/draw/engines/workbench/workbench_engine.cc
===================================================================
diff --git a/source/blender/draw/engines/workbench/workbench_engine.cc b/source/blender/draw/engines/workbench/workbench_engine.cc
index 0de83b2c560..f6c7b600aae 100644
--- a/source/blender/draw/engines/workbench/workbench_engine.cc
+++ b/source/blender/draw/engines/workbench/workbench_engine.cc
@@ -53,8 +53,9 @@ class Instance {
DRWState cull_state;
DRWState clip_state;
+ Vector<float4> clip_planes = {};
+
eContextObjectMode ob_mode;
- eGPUShaderConfig clip_mode;
View3DShading shading;
@@ -91,8 +92,14 @@ class Instance {
reset_taa = true;
}
clip_state = new_clip_state;
- /* TODO(pragma37): Shouldn't clip_state be enough ? */
- clip_mode = context->sh_cfg;
+
+ clip_planes.clear();
+ if (clip_state & DRW_STATE_CLIP_PLANES) {
+ int plane_len = (RV3D_LOCK_FLAGS(rv3d) & RV3D_BOXCLIP) ? 4 : 6;
+ for (auto i : IndexRange(plane_len)) {
+ clip_planes.append(rv3d->clip[i]);
+ }
+ }
if (rv3d && rv3d->rflag & RV3D_GPULIGHT_UPDATE) {
reset_taa = true;
@@ -516,6 +523,10 @@ class Instance {
{
resources.color_tx.acquire(int2(resources.depth_tx.size()), GPU_RGBA16F);
+ if (!clip_planes.is_empty()) {
+ view.set_clip_planes(clip_planes);
+ }
+
opaque_ps.draw_prepass(manager, view, resources.depth_tx);
// transparent_ps.draw_prepass(manager, view, resources.depth_tx);
// volume_ps.draw_prepass(manager, view, resources.depth_tx);
More information about the Bf-blender-cvs
mailing list