Overlays: Use common_view_lib.glsl
This removes ModelViewProjectionMatrix usage
This commit is contained in:
@@ -1038,18 +1038,23 @@ struct GPUShader *volume_velocity_shader_get(bool use_needle)
|
||||
COMMON_Shaders *sh_data = &g_shaders[GPU_SHADER_CFG_DEFAULT];
|
||||
if (use_needle) {
|
||||
if (sh_data->volume_velocity_needle_sh == NULL) {
|
||||
sh_data->volume_velocity_needle_sh = DRW_shader_create(
|
||||
sh_data->volume_velocity_needle_sh = DRW_shader_create_with_lib(
|
||||
datatoc_volume_velocity_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_flat_color_frag_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
"#define USE_NEEDLE");
|
||||
}
|
||||
return sh_data->volume_velocity_needle_sh;
|
||||
}
|
||||
else {
|
||||
if (sh_data->volume_velocity_sh == NULL) {
|
||||
sh_data->volume_velocity_sh = DRW_shader_create(
|
||||
datatoc_volume_velocity_vert_glsl, NULL, datatoc_gpu_shader_flat_color_frag_glsl, NULL);
|
||||
sh_data->volume_velocity_sh = DRW_shader_create_with_lib(
|
||||
datatoc_volume_velocity_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_flat_color_frag_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
NULL);
|
||||
}
|
||||
return sh_data->volume_velocity_sh;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
* Not needed for constant color. */
|
||||
|
||||
extern char datatoc_common_globals_lib_glsl[];
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
extern char datatoc_edit_curve_overlay_loosevert_vert_glsl[];
|
||||
extern char datatoc_edit_curve_overlay_normals_vert_glsl[];
|
||||
extern char datatoc_edit_curve_overlay_handle_vert_glsl[];
|
||||
@@ -124,8 +125,10 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
|
||||
|
||||
if (!sh_data->wire_normals_sh) {
|
||||
sh_data->wire_normals_sh = GPU_shader_create_from_arrays({
|
||||
.vert =
|
||||
(const char *[]){sh_cfg_data->lib, datatoc_edit_curve_overlay_normals_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_curve_overlay_normals_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, NULL},
|
||||
});
|
||||
@@ -133,8 +136,10 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
|
||||
|
||||
if (!sh_data->overlay_edge_sh) {
|
||||
sh_data->overlay_edge_sh = GPU_shader_create_from_arrays({
|
||||
.vert =
|
||||
(const char *[]){sh_cfg_data->lib, datatoc_edit_curve_overlay_handle_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_curve_overlay_handle_vert_glsl,
|
||||
NULL},
|
||||
.geom = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_edit_curve_overlay_handle_geom_glsl,
|
||||
@@ -148,6 +153,7 @@ static void EDIT_CURVE_engine_init(void *UNUSED(vedata))
|
||||
sh_data->overlay_vert_sh = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_curve_overlay_loosevert_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_gpu_shader_point_varying_color_frag_glsl, NULL},
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include "draw_mode_engines.h"
|
||||
|
||||
extern char datatoc_common_globals_lib_glsl[];
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
|
||||
extern char datatoc_edit_lattice_overlay_loosevert_vert_glsl[];
|
||||
extern char datatoc_edit_lattice_overlay_frag_glsl[];
|
||||
@@ -152,6 +153,7 @@ static void EDIT_LATTICE_engine_init(void *vedata)
|
||||
sh_data->overlay_vert = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_edit_lattice_overlay_loosevert_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_common_globals_lib_glsl,
|
||||
|
||||
@@ -198,6 +198,7 @@ static void EDIT_MESH_engine_init(void *vedata)
|
||||
sh_data->weight_face = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_weight_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_common_globals_lib_glsl,
|
||||
@@ -290,24 +291,20 @@ static void EDIT_MESH_engine_init(void *vedata)
|
||||
.defs = (const char *[]){sh_cfg_data->def, NULL},
|
||||
});
|
||||
|
||||
MEM_freeN(lib);
|
||||
|
||||
/* Mesh Analysis */
|
||||
sh_data->mesh_analysis_face = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_edit_mesh_overlay_mesh_analysis_vert_glsl,
|
||||
NULL},
|
||||
.vert = (const char *[]){lib, datatoc_edit_mesh_overlay_mesh_analysis_vert_glsl, NULL},
|
||||
.frag = (const char *[]){datatoc_edit_mesh_overlay_mesh_analysis_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, "#define FACE_COLOR\n", NULL},
|
||||
});
|
||||
sh_data->mesh_analysis_vertex = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_edit_mesh_overlay_mesh_analysis_vert_glsl,
|
||||
NULL},
|
||||
.vert = (const char *[]){lib, datatoc_edit_mesh_overlay_mesh_analysis_vert_glsl, NULL},
|
||||
.frag = (const char *[]){datatoc_edit_mesh_overlay_mesh_analysis_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, "#define VERTEX_COLOR\n", NULL},
|
||||
});
|
||||
|
||||
MEM_freeN(lib);
|
||||
|
||||
sh_data->depth = DRW_shader_create_3d_depth_only(draw_ctx->sh_cfg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -468,12 +468,18 @@ static void OBJECT_engine_init(void *vedata)
|
||||
"#define DEPTH_BACK " STRINGIFY(OB_EMPTY_IMAGE_DEPTH_BACK) "\n");
|
||||
|
||||
sh_data->object_empty_image = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib, datatoc_object_empty_image_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_object_empty_image_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_object_empty_image_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, empty_image_defs, NULL},
|
||||
});
|
||||
sh_data->object_empty_image_wire = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib, datatoc_object_empty_image_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_object_empty_image_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_object_empty_image_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, "#define USE_WIRE\n", empty_image_defs, NULL},
|
||||
});
|
||||
|
||||
@@ -126,8 +126,10 @@ static void overlay_engine_init(void *vedata)
|
||||
if (!sh_data->face_orientation) {
|
||||
/* Face orientation */
|
||||
sh_data->face_orientation = GPU_shader_create_from_arrays({
|
||||
.vert =
|
||||
(const char *[]){sh_cfg_data->lib, datatoc_overlay_face_orientation_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_overlay_face_orientation_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_overlay_face_orientation_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, NULL},
|
||||
});
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "BKE_node.h"
|
||||
|
||||
#include "BLI_string_utils.h"
|
||||
|
||||
/* If builtin shaders are needed */
|
||||
#include "GPU_shader.h"
|
||||
#include "GPU_texture.h"
|
||||
@@ -39,6 +41,7 @@
|
||||
#include "DEG_depsgraph_query.h"
|
||||
|
||||
extern char datatoc_common_globals_lib_glsl[];
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
extern char datatoc_paint_texture_vert_glsl[];
|
||||
extern char datatoc_paint_texture_frag_glsl[];
|
||||
extern char datatoc_paint_wire_vert_glsl[];
|
||||
@@ -132,26 +135,31 @@ static void PAINT_TEXTURE_engine_init(void *UNUSED(vedata))
|
||||
if (!e_data.fallback_sh) {
|
||||
e_data.fallback_sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
|
||||
e_data.image_sh = DRW_shader_create_with_lib(datatoc_paint_texture_vert_glsl,
|
||||
NULL,
|
||||
datatoc_paint_texture_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
NULL);
|
||||
char *lib = BLI_string_joinN(datatoc_common_globals_lib_glsl, datatoc_common_view_lib_glsl);
|
||||
|
||||
e_data.image_sh = DRW_shader_create_with_lib(
|
||||
datatoc_paint_texture_vert_glsl, NULL, datatoc_paint_texture_frag_glsl, lib, NULL);
|
||||
|
||||
e_data.image_masking_sh = DRW_shader_create_with_lib(datatoc_paint_texture_vert_glsl,
|
||||
NULL,
|
||||
datatoc_paint_texture_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
lib,
|
||||
"#define TEXTURE_PAINT_MASK\n");
|
||||
|
||||
e_data.wire_overlay_shader = DRW_shader_create_with_lib(datatoc_paint_wire_vert_glsl,
|
||||
NULL,
|
||||
datatoc_paint_wire_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
lib,
|
||||
"#define VERTEX_MODE\n");
|
||||
|
||||
e_data.face_overlay_shader = DRW_shader_create(
|
||||
datatoc_paint_face_vert_glsl, NULL, datatoc_gpu_shader_uniform_color_frag_glsl, NULL);
|
||||
e_data.face_overlay_shader = DRW_shader_create_with_lib(
|
||||
datatoc_paint_face_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_uniform_color_frag_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
NULL);
|
||||
|
||||
MEM_freeN(lib);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ extern char datatoc_paint_wire_vert_glsl[];
|
||||
extern char datatoc_paint_wire_frag_glsl[];
|
||||
extern char datatoc_paint_vert_frag_glsl[];
|
||||
extern char datatoc_common_globals_lib_glsl[];
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
|
||||
extern char datatoc_gpu_shader_uniform_color_frag_glsl[];
|
||||
|
||||
@@ -115,12 +116,16 @@ static void PAINT_VERTEX_engine_init(void *UNUSED(vedata))
|
||||
|
||||
if (!sh_data->face_select_overlay) {
|
||||
sh_data->by_mode[VERTEX_MODE].color_face = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib, datatoc_paint_vertex_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_vertex_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_paint_vertex_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, NULL},
|
||||
});
|
||||
sh_data->by_mode[WEIGHT_MODE].color_face = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_paint_weight_vert_glsl,
|
||||
NULL},
|
||||
@@ -131,13 +136,17 @@ static void PAINT_VERTEX_engine_init(void *UNUSED(vedata))
|
||||
});
|
||||
|
||||
sh_data->face_select_overlay = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib, datatoc_paint_face_vert_glsl, NULL},
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_face_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_gpu_shader_uniform_color_frag_glsl, NULL},
|
||||
.defs = (const char *[]){sh_cfg_data->def, NULL},
|
||||
});
|
||||
sh_data->vert_select_overlay = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_wire_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_paint_vert_frag_glsl, NULL},
|
||||
@@ -152,6 +161,7 @@ static void PAINT_VERTEX_engine_init(void *UNUSED(vedata))
|
||||
sh_data->by_mode[i].wire_overlay = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_wire_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_paint_wire_frag_glsl, NULL},
|
||||
@@ -160,6 +170,7 @@ static void PAINT_VERTEX_engine_init(void *UNUSED(vedata))
|
||||
sh_data->by_mode[i].wire_select_overlay = GPU_shader_create_from_arrays({
|
||||
.vert = (const char *[]){sh_cfg_data->lib,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
datatoc_paint_wire_vert_glsl,
|
||||
NULL},
|
||||
.frag = (const char *[]){datatoc_paint_wire_frag_glsl, NULL},
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "BKE_pointcache.h"
|
||||
|
||||
#include "BLI_string_utils.h"
|
||||
|
||||
#include "GPU_shader.h"
|
||||
|
||||
#include "draw_common.h"
|
||||
@@ -39,6 +41,7 @@
|
||||
extern char datatoc_particle_strand_vert_glsl[];
|
||||
extern char datatoc_particle_strand_frag_glsl[];
|
||||
extern char datatoc_common_globals_lib_glsl[];
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
|
||||
/* *********** LISTS *********** */
|
||||
|
||||
@@ -86,23 +89,23 @@ typedef struct PARTICLE_PrivateData {
|
||||
static void particle_engine_init(void *UNUSED(vedata))
|
||||
{
|
||||
if (!e_data.strands_shader) {
|
||||
e_data.strands_shader = DRW_shader_create_with_lib(datatoc_particle_strand_vert_glsl,
|
||||
NULL,
|
||||
datatoc_particle_strand_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
"");
|
||||
char *lib = BLI_string_joinN(datatoc_common_globals_lib_glsl, datatoc_common_view_lib_glsl);
|
||||
|
||||
e_data.strands_shader = DRW_shader_create_with_lib(
|
||||
datatoc_particle_strand_vert_glsl, NULL, datatoc_particle_strand_frag_glsl, lib, "");
|
||||
|
||||
e_data.strands_weight_shader = DRW_shader_create_with_lib(datatoc_particle_strand_vert_glsl,
|
||||
NULL,
|
||||
datatoc_particle_strand_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
lib,
|
||||
"#define USE_WEIGHT");
|
||||
|
||||
e_data.points_shader = DRW_shader_create_with_lib(datatoc_particle_strand_vert_glsl,
|
||||
NULL,
|
||||
datatoc_particle_strand_frag_glsl,
|
||||
datatoc_common_globals_lib_glsl,
|
||||
lib,
|
||||
"#define USE_POINTS");
|
||||
MEM_freeN(lib);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "draw_common.h"
|
||||
#include "draw_mode_engines.h"
|
||||
|
||||
extern char datatoc_common_view_lib_glsl[];
|
||||
extern char datatoc_sculpt_mask_vert_glsl[];
|
||||
extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[];
|
||||
|
||||
@@ -111,8 +112,11 @@ static void SCULPT_engine_init(void *vedata)
|
||||
UNUSED_VARS(txl, fbl, stl);
|
||||
|
||||
if (!e_data.shader_mask) {
|
||||
e_data.shader_mask = DRW_shader_create(
|
||||
datatoc_sculpt_mask_vert_glsl, NULL, datatoc_gpu_shader_3D_smooth_color_frag_glsl, NULL);
|
||||
e_data.shader_mask = DRW_shader_create_with_lib(datatoc_sculpt_mask_vert_glsl,
|
||||
NULL,
|
||||
datatoc_gpu_shader_3D_smooth_color_frag_glsl,
|
||||
datatoc_common_view_lib_glsl,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
/* Draw Curve Handles */
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -9,11 +8,11 @@ flat out int vertFlag;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pos_4d = vec4(pos, 1.0);
|
||||
gl_Position = ModelViewProjectionMatrix * pos_4d;
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
vertFlag = data;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Draw Curve Vertices */
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform vec2 viewportSize;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -22,10 +22,10 @@ void main()
|
||||
finalColor = colorVertex;
|
||||
}
|
||||
|
||||
vec4 pos_4d = vec4(pos, 1.0);
|
||||
gl_Position = ModelViewProjectionMatrix * pos_4d;
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
gl_PointSize = sizeVertex * 2.0;
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* Draw Curve Normals */
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform float normalSize;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -18,10 +18,10 @@ void main()
|
||||
final_pos += normalSize * rad * (flip * nor - tan);
|
||||
}
|
||||
|
||||
vec4 final_pos_4d = vec4(final_pos, 1.0);
|
||||
gl_Position = ModelViewProjectionMatrix * final_pos_4d;
|
||||
vec3 world_pos = point_object_to_world(final_pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * final_pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
/* Draw Lattice Vertices */
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform vec2 viewportSize;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -27,7 +27,8 @@ void main()
|
||||
{
|
||||
clipCase = 0;
|
||||
|
||||
vec4 pPos = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
vec4 pPos = point_world_to_ndc(world_pos);
|
||||
|
||||
/* only vertex position 0 is used */
|
||||
eData1 = eData2 = vec4(1e10);
|
||||
@@ -39,6 +40,6 @@ void main()
|
||||
gl_Position = pPos;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform ivec4 dataMask = ivec4(0xFF);
|
||||
|
||||
in vec3 pos;
|
||||
@@ -10,13 +10,14 @@ flat out vec4 faceColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
ivec4 data_m = data & dataMask;
|
||||
|
||||
faceColor = EDIT_MESH_face_color(data_m.x);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -14,10 +13,11 @@ out vec4 weightColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
weightColor = vec4(weight_color.rgb, 1.0);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
uniform mat4 ModelMatrixInverse;
|
||||
|
||||
@@ -25,10 +24,14 @@ flat out vec4 v2;
|
||||
|
||||
void main()
|
||||
{
|
||||
v1 = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 n = normalize(normal_object_to_view(nor));
|
||||
v2 = v1 + ProjectionMatrix * vec4(n * normalSize, 0.0);
|
||||
vec3 n = normalize(normal_object_to_world(nor));
|
||||
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
|
||||
v1 = point_world_to_ndc(world_pos);
|
||||
v2 = point_world_to_ndc(world_pos + n * normalSize);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform float aspectX;
|
||||
uniform float aspectY;
|
||||
uniform float size;
|
||||
@@ -21,8 +21,9 @@ out vec2 texCoord_interp;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 pos_4d = vec4((pos + offset) * (size * vec2(aspectX, aspectY)), 0.0, 1.0);
|
||||
gl_Position = ModelViewProjectionMatrix * pos_4d;
|
||||
vec3 pos = vec3((pos + offset) * (size * vec2(aspectX, aspectY)), 0.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
#ifdef USE_WIRE
|
||||
gl_Position.z -= 1e-5;
|
||||
finalColor = vec4(color, 1.0);
|
||||
@@ -32,6 +33,6 @@ void main()
|
||||
#endif
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@ void main()
|
||||
pPos.z -= 1e-3;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance(world_pos).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -7,14 +6,16 @@ in vec4 nor; /* select flag on the 4th component */
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
/* Don't draw faces that are selected. */
|
||||
if (nor.w > 0.0) {
|
||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
else {
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec2 u; /* active uv map */
|
||||
@@ -17,7 +16,8 @@ out vec2 masking_uv_interp;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
uv_interp = u;
|
||||
|
||||
@@ -26,6 +26,6 @@ void main()
|
||||
#endif
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -17,11 +16,12 @@ vec3 srgb_to_linear_attr(vec3 c)
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
finalColor = srgb_to_linear_attr(c);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in float weight;
|
||||
@@ -9,12 +8,13 @@ out vec2 weight_interp; /* (weight, alert) */
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
/* Separate actual weight and alerts for independent interpolation */
|
||||
weight_interp = max(vec2(weight, -weight), 0.0);
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -16,7 +15,8 @@ void main()
|
||||
bool is_select = false;
|
||||
bool is_hidden = false;
|
||||
#endif
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
/* Add offset in Z to avoid zfighting and render selected wires on top. */
|
||||
/* TODO scale this bias using znear and zfar range. */
|
||||
gl_Position.z -= (is_select ? 2e-4 : 1e-4);
|
||||
@@ -46,6 +46,6 @@ void main()
|
||||
finalColor.a = nor.w;
|
||||
|
||||
#ifdef USE_WORLD_CLIP_PLANES
|
||||
world_clip_planes_calc_clip_distance((ModelMatrix * vec4(pos, 1.0)).xyz);
|
||||
world_clip_planes_calc_clip_distance(world_pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
in vec4 finalColor;
|
||||
#ifdef USE_POINTS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
in vec3 pos;
|
||||
in float color;
|
||||
@@ -47,7 +47,8 @@ vec3 weight_to_rgb(float weight)
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
#ifdef USE_WEIGHT
|
||||
finalColor = vec4(weight_to_rgb(color), 1.0);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform float maskOpacity;
|
||||
|
||||
in vec3 pos;
|
||||
@@ -9,7 +10,8 @@ out vec4 finalColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
|
||||
float mask = 1.0 - (msk * maskOpacity);
|
||||
finalColor = vec4(mask, mask, mask, 1.0);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
uniform mat4 ModelMatrix;
|
||||
|
||||
uniform sampler3D velocityX;
|
||||
uniform sampler3D velocityY;
|
||||
@@ -109,5 +109,6 @@ void main()
|
||||
pos += (((gl_VertexID % 2) == 1) ? velocity : vec3(0.0)) * displaySize * voxel_size;
|
||||
#endif
|
||||
|
||||
gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0);
|
||||
vec3 world_pos = point_object_to_world(pos);
|
||||
gl_Position = point_world_to_ndc(world_pos);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user