module `snap_context`: Fix `gpu_Indices_use_clip_planes`
This commit is contained in:
parent
d98d1dc3d8
commit
b119529556
|
@ -205,7 +205,7 @@ class SnapContext():
|
|||
self.update_all()
|
||||
|
||||
def add_obj(self, obj, matrix):
|
||||
matrix = matrix.freeze()
|
||||
matrix = matrix.copy()
|
||||
snap_obj = self._get_snap_obj_by_obj(obj)
|
||||
if not snap_obj:
|
||||
self.snap_objects.append(_SnapObjectData([obj], matrix))
|
||||
|
|
|
@ -504,13 +504,13 @@ def gpu_Indices_restore_state():
|
|||
def gpu_Indices_use_clip_planes(rv3d, value):
|
||||
planes = get_clip_planes(rv3d)
|
||||
if planes:
|
||||
_store_current_shader_state()
|
||||
_store_current_shader_state(PreviousGLState)
|
||||
bgl.glUseProgram(GPU_Indices_Mesh.shader.program)
|
||||
bgl.glUniform1i(GPU_Indices_Mesh.unif_use_clip_planes, value)
|
||||
|
||||
bgl.glUniform4fv(GPU_Indices_Mesh.unif_clip_plane, 4, planes)
|
||||
|
||||
_restore_shader_state()
|
||||
_restore_shader_state(PreviousGLState)
|
||||
|
||||
|
||||
def gpu_Indices_set_ProjectionMatrix(P):
|
||||
|
|
|
@ -16,10 +16,9 @@ void main()
|
|||
if (use_clip_planes) {
|
||||
vec4 g_pos = MV * vec4(pos, 1.0);
|
||||
|
||||
clip_distance[0] = dot(clip_plane[0], g_pos);
|
||||
clip_distance[1] = dot(clip_plane[1], g_pos);
|
||||
clip_distance[2] = dot(clip_plane[2], g_pos);
|
||||
clip_distance[3] = dot(clip_plane[3], g_pos);
|
||||
for (int i = 0; i != 4; i++) {
|
||||
clip_distance[i] = dot(clip_plane[i], g_pos);
|
||||
}
|
||||
}
|
||||
|
||||
primitive_id_var = primitive_id;
|
||||
|
|
Loading…
Reference in New Issue