Fix rotation manipulators not clipping
Added new shader for clipping, also cleaned up rotation manipulator drawing code a bit. This code should be replaced by new transform manipulators soon, just keeping this working in the meanwhile.
This commit is contained in:
@@ -148,6 +148,7 @@ data_to_c_simple(shaders/gpu_shader_3D_flat_color_vert.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_3D_smooth_color_vert.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_3D_smooth_color_frag.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_3D_passthrough_vert.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_3D_clipped_uniform_color_vert.glsl SRC)
|
||||
|
||||
data_to_c_simple(shaders/gpu_shader_instance_vert.glsl SRC)
|
||||
data_to_c_simple(shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl SRC)
|
||||
|
||||
@@ -121,6 +121,7 @@ typedef enum GPUBuiltinShader {
|
||||
GPU_SHADER_3D_FLAT_COLOR,
|
||||
GPU_SHADER_3D_SMOOTH_COLOR,
|
||||
GPU_SHADER_3D_DEPTH_ONLY,
|
||||
GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR,
|
||||
/* basic image drawing */
|
||||
GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR,
|
||||
GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR,
|
||||
|
||||
@@ -74,6 +74,7 @@ extern char datatoc_gpu_shader_3D_flat_color_vert_glsl[];
|
||||
extern char datatoc_gpu_shader_3D_smooth_color_vert_glsl[];
|
||||
extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
|
||||
extern char datatoc_gpu_shader_3D_passthrough_vert_glsl[];
|
||||
extern char datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl[];
|
||||
|
||||
extern char datatoc_gpu_shader_instance_vert_glsl[];
|
||||
extern char datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl[];
|
||||
@@ -719,6 +720,8 @@ GPUShader *GPU_shader_get_builtin_shader(GPUBuiltinShader shader)
|
||||
[GPU_SHADER_3D_SMOOTH_COLOR] = { datatoc_gpu_shader_3D_smooth_color_vert_glsl,
|
||||
datatoc_gpu_shader_3D_smooth_color_frag_glsl },
|
||||
[GPU_SHADER_3D_DEPTH_ONLY] = { datatoc_gpu_shader_3D_vert_glsl, datatoc_gpu_shader_depth_only_frag_glsl },
|
||||
[GPU_SHADER_3D_CLIPPED_UNIFORM_COLOR] = { datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl,
|
||||
datatoc_gpu_shader_uniform_color_frag_glsl },
|
||||
|
||||
[GPU_SHADER_3D_GROUNDPOINT] = { datatoc_gpu_shader_3D_groundpoint_vert_glsl, datatoc_gpu_shader_point_uniform_color_frag_glsl },
|
||||
[GPU_SHADER_3D_GROUNDLINE] = { datatoc_gpu_shader_3D_passthrough_vert_glsl,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform vec4 ClipPlane;
|
||||
|
||||
#if __VERSION__ == 120
|
||||
attribute vec3 pos;
|
||||
#else
|
||||
in vec3 pos;
|
||||
#endif
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
gl_ClipDistance[0] = dot(ModelMatrix * vec4(pos, 1.0), ClipPlane);
|
||||
}
|
||||
Reference in New Issue
Block a user