diff options
-rw-r--r-- | modules/snap_context/bgl_ext.py | 10 | ||||
-rw-r--r-- | modules/snap_context/mesh_drawing.py | 7 |
2 files changed, 4 insertions, 13 deletions
diff --git a/modules/snap_context/bgl_ext.py b/modules/snap_context/bgl_ext.py index 46ce3186..f8dbff09 100644 --- a/modules/snap_context/bgl_ext.py +++ b/modules/snap_context/bgl_ext.py @@ -128,13 +128,3 @@ def bgl_Buffer_reshape(buf, shape): del c_buf del c_tmp_buf del tmp_buf - - -def get_clip_planes(rv3d): - #(int)(&((struct RegionView3D *)0)->rflag) == 842 - #(int)(&((struct RegionView3D *)0)->clip) == 464 - rv3d_ptr = rv3d.as_pointer() - rflag = ctypes.c_short.from_address(rv3d_ptr + 842).value - if rflag & 4: # RV3D_CLIPPING - clip = (6 * (4 * ctypes.c_float)).from_address(rv3d_ptr + 464) - return bgl.Buffer(bgl.GL_FLOAT, (6, 4), clip) diff --git a/modules/snap_context/mesh_drawing.py b/modules/snap_context/mesh_drawing.py index dc6619a0..14e358a8 100644 --- a/modules/snap_context/mesh_drawing.py +++ b/modules/snap_context/mesh_drawing.py @@ -21,7 +21,7 @@ import bmesh import numpy as np from mathutils import Matrix -from .bgl_ext import VoidBufValue, np_array_as_bgl_Buffer, bgl_Buffer_reshape, get_clip_planes +from .bgl_ext import VoidBufValue, np_array_as_bgl_Buffer, bgl_Buffer_reshape from .utils_shader import Shader @@ -502,8 +502,9 @@ def gpu_Indices_restore_state(): def gpu_Indices_use_clip_planes(rv3d, value): - planes = get_clip_planes(rv3d) - if planes: + if rv3d.use_clip_planes: + planes = bgl.Buffer(bgl.GL_FLOAT, (6, 4), rv3d.clip_planes) + _store_current_shader_state(PreviousGLState) bgl.glUseProgram(GPU_Indices_Mesh.shader.program) bgl.glUniform1i(GPU_Indices_Mesh.unif_use_clip_planes, value) |