Cleanup: DRW: Make all shader resource snake case
This make sure that the DRW folder is compliant to our codestyle. Pull Request: https://projects.blender.org/blender/blender/pulls/137673
This commit is contained in:
committed by
Clément Foucault
parent
ad49181f90
commit
3f11d16501
@@ -28,12 +28,12 @@ void Instance::antialiasing_init()
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM);
|
||||
pass.shader_set(ShaderCache::get().antialiasing[2].get());
|
||||
pass.bind_texture("blendTex", &this->color_tx);
|
||||
pass.bind_texture("colorTex", &this->color_tx);
|
||||
pass.bind_texture("revealTex", &this->reveal_tx);
|
||||
pass.push_constant("doAntiAliasing", false);
|
||||
pass.push_constant("onlyAlpha", this->draw_wireframe);
|
||||
pass.push_constant("viewportMetrics", metrics);
|
||||
pass.bind_texture("blend_tx", &this->color_tx);
|
||||
pass.bind_texture("color_tx", &this->color_tx);
|
||||
pass.bind_texture("reveal_tx", &this->reveal_tx);
|
||||
pass.push_constant("do_anti_aliasing", false);
|
||||
pass.push_constant("only_alpha", this->draw_wireframe);
|
||||
pass.push_constant("viewport_metrics", metrics);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
return;
|
||||
}
|
||||
@@ -69,10 +69,10 @@ void Instance::antialiasing_init()
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR);
|
||||
pass.shader_set(ShaderCache::get().antialiasing[0].get());
|
||||
pass.bind_texture("colorTex", &this->color_tx);
|
||||
pass.bind_texture("revealTex", &this->reveal_tx);
|
||||
pass.push_constant("viewportMetrics", metrics);
|
||||
pass.push_constant("lumaWeight", luma_weight);
|
||||
pass.bind_texture("color_tx", &this->color_tx);
|
||||
pass.bind_texture("reveal_tx", &this->reveal_tx);
|
||||
pass.push_constant("viewport_metrics", metrics);
|
||||
pass.push_constant("luma_weight", luma_weight);
|
||||
pass.clear_color(float4(0.0f));
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
@@ -82,10 +82,10 @@ void Instance::antialiasing_init()
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR);
|
||||
pass.shader_set(ShaderCache::get().antialiasing[1].get());
|
||||
pass.bind_texture("edgesTex", &this->smaa_edge_tx);
|
||||
pass.bind_texture("areaTex", &this->smaa_area_tx);
|
||||
pass.bind_texture("searchTex", &this->smaa_search_tx);
|
||||
pass.push_constant("viewportMetrics", metrics);
|
||||
pass.bind_texture("edges_tx", &this->smaa_edge_tx);
|
||||
pass.bind_texture("area_tx", &this->smaa_area_tx);
|
||||
pass.bind_texture("search_tx", &this->smaa_search_tx);
|
||||
pass.push_constant("viewport_metrics", metrics);
|
||||
pass.clear_color(float4(0.0f));
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
@@ -95,12 +95,12 @@ void Instance::antialiasing_init()
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM);
|
||||
pass.shader_set(ShaderCache::get().antialiasing[2].get());
|
||||
pass.bind_texture("blendTex", &this->smaa_weight_tx);
|
||||
pass.bind_texture("colorTex", &this->color_tx);
|
||||
pass.bind_texture("revealTex", &this->reveal_tx);
|
||||
pass.push_constant("doAntiAliasing", true);
|
||||
pass.push_constant("onlyAlpha", this->draw_wireframe);
|
||||
pass.push_constant("viewportMetrics", metrics);
|
||||
pass.bind_texture("blend_tx", &this->smaa_weight_tx);
|
||||
pass.bind_texture("color_tx", &this->color_tx);
|
||||
pass.bind_texture("reveal_tx", &this->reveal_tx);
|
||||
pass.push_constant("do_anti_aliasing", true);
|
||||
pass.push_constant("only_alpha", this->draw_wireframe);
|
||||
pass.push_constant("viewport_metrics", metrics);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,11 +406,11 @@ tLayer *grease_pencil_layer_cache_add(Instance *inst,
|
||||
pass.init();
|
||||
pass.state_set(state);
|
||||
pass.shader_set(ShaderCache::get().layer_blend.get());
|
||||
pass.push_constant("blendMode", int(layer.blend_mode));
|
||||
pass.push_constant("blendOpacity", layer_opacity);
|
||||
pass.bind_texture("colorBuf", &inst->color_layer_tx);
|
||||
pass.bind_texture("revealBuf", &inst->reveal_layer_tx);
|
||||
pass.bind_texture("maskBuf", (is_masked) ? &inst->mask_tx : &inst->dummy_tx);
|
||||
pass.push_constant("blend_mode", int(layer.blend_mode));
|
||||
pass.push_constant("blend_opacity", layer_opacity);
|
||||
pass.bind_texture("color_buf", &inst->color_layer_tx);
|
||||
pass.bind_texture("reveal_buf", &inst->reveal_layer_tx);
|
||||
pass.bind_texture("mask_buf", (is_masked) ? &inst->mask_tx : &inst->dummy_tx);
|
||||
pass.state_stencil(0xFF, 0xFF, 0xFF);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
@@ -418,7 +418,7 @@ tLayer *grease_pencil_layer_cache_add(Instance *inst,
|
||||
/* We cannot do custom blending on Multi-Target frame-buffers.
|
||||
* Workaround by doing 2 passes. */
|
||||
pass.state_set((state & ~DRW_STATE_BLEND_MUL) | DRW_STATE_BLEND_ADD_FULL);
|
||||
pass.push_constant("blendMode", 999);
|
||||
pass.push_constant("blend_mode", 999);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -444,14 +444,14 @@ tLayer *grease_pencil_layer_cache_add(Instance *inst,
|
||||
|
||||
pass.state_set(state);
|
||||
pass.shader_set(ShaderCache::get().geometry.get());
|
||||
pass.bind_texture("gpSceneDepthTexture", depth_tex);
|
||||
pass.bind_texture("gpMaskTexture", mask_tex);
|
||||
pass.push_constant("gpNormal", tgp_ob->plane_normal);
|
||||
pass.push_constant("gpStrokeOrder3d", tgp_ob->is_drawmode3d);
|
||||
pass.push_constant("gpVertexColorOpacity", vert_col_opacity);
|
||||
pass.bind_texture("gp_scene_depth_tx", depth_tex);
|
||||
pass.bind_texture("gp_mask_tx", mask_tex);
|
||||
pass.push_constant("gp_normal", tgp_ob->plane_normal);
|
||||
pass.push_constant("gp_stroke_order3d", tgp_ob->is_drawmode3d);
|
||||
pass.push_constant("gp_vertex_color_opacity", vert_col_opacity);
|
||||
|
||||
pass.bind_texture("gpFillTexture", inst->dummy_tx);
|
||||
pass.bind_texture("gpStrokeTexture", inst->dummy_tx);
|
||||
pass.bind_texture("gp_fill_tx", inst->dummy_tx);
|
||||
pass.bind_texture("gp_stroke_tx", inst->dummy_tx);
|
||||
|
||||
/* If random color type, need color by layer. */
|
||||
float4 gpl_color;
|
||||
@@ -460,9 +460,9 @@ tLayer *grease_pencil_layer_cache_add(Instance *inst,
|
||||
grease_pencil_layer_random_color_get(ob, layer, gpl_color);
|
||||
gpl_color[3] = 1.0f;
|
||||
}
|
||||
pass.push_constant("gpLayerTint", gpl_color);
|
||||
pass.push_constant("gp_layer_tint", gpl_color);
|
||||
|
||||
pass.push_constant("gpLayerOpacity", layer_alpha);
|
||||
pass.push_constant("gp_layer_opacity", layer_alpha);
|
||||
pass.state_stencil(0xFF, 0xFF, 0xFF);
|
||||
}
|
||||
|
||||
|
||||
@@ -247,9 +247,9 @@ void Instance::begin_sync()
|
||||
pass.init();
|
||||
pass.state_set(DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS);
|
||||
pass.shader_set(ShaderCache::get().depth_merge.get());
|
||||
pass.bind_texture("depthBuf", &this->depth_tx);
|
||||
pass.push_constant("strokeOrder3d", &this->is_stroke_order_3d);
|
||||
pass.push_constant("gpModelMatrix", &this->object_bound_mat);
|
||||
pass.bind_texture("depth_buf", &this->depth_tx);
|
||||
pass.push_constant("stroke_order3d", &this->is_stroke_order_3d);
|
||||
pass.push_constant("gp_model_matrix", &this->object_bound_mat);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
{
|
||||
@@ -462,12 +462,12 @@ tObject *Instance::object_sync_do(Object *ob, ResourceHandle res_handle)
|
||||
|
||||
pass.bind_ubo("gp_lights", lights_ubo);
|
||||
pass.bind_ubo("gp_materials", ubo_mat);
|
||||
pass.bind_texture("gpFillTexture", tex_fill);
|
||||
pass.bind_texture("gpStrokeTexture", tex_stroke);
|
||||
pass.push_constant("gpMaterialOffset", mat_ofs);
|
||||
pass.bind_texture("gp_fill_tx", tex_fill);
|
||||
pass.bind_texture("gp_stroke_tx", tex_stroke);
|
||||
pass.push_constant("gp_material_offset", mat_ofs);
|
||||
/* Since we don't use the sbuffer in GPv3, this is always 0. */
|
||||
pass.push_constant("gpStrokeIndexOffset", 0.0f);
|
||||
pass.push_constant("viewportSize", float2(draw_ctx->viewport_size_get()));
|
||||
pass.push_constant("gp_stroke_index_offset", 0.0f);
|
||||
pass.push_constant("viewport_size", float2(draw_ctx->viewport_size_get()));
|
||||
|
||||
const VArray<int> stroke_materials = *attributes.lookup_or_default<int>(
|
||||
"material_index", bke::AttrDomain::Curve, 0);
|
||||
@@ -522,11 +522,11 @@ tObject *Instance::object_sync_do(Object *ob, ResourceHandle res_handle)
|
||||
ubo_mat = new_ubo_mat;
|
||||
}
|
||||
if (new_tex_fill) {
|
||||
pass.bind_texture("gpFillTexture", new_tex_fill);
|
||||
pass.bind_texture("gp_fill_tx", new_tex_fill);
|
||||
tex_fill = new_tex_fill;
|
||||
}
|
||||
if (new_tex_stroke) {
|
||||
pass.bind_texture("gpStrokeTexture", new_tex_stroke);
|
||||
pass.bind_texture("gp_stroke_tx", new_tex_stroke);
|
||||
tex_stroke = new_tex_stroke;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ PassSimple &Instance::vfx_pass_create(
|
||||
pass.init();
|
||||
pass.state_set(state);
|
||||
pass.shader_set(sh);
|
||||
pass.bind_texture("colorBuf", vfx_swapchain_.current().color_tx, sampler);
|
||||
pass.bind_texture("revealBuf", vfx_swapchain_.current().reveal_tx, sampler);
|
||||
pass.bind_texture("color_buf", vfx_swapchain_.current().color_tx, sampler);
|
||||
pass.bind_texture("reveal_buf", vfx_swapchain_.current().reveal_tx, sampler);
|
||||
|
||||
vfx_swapchain_.swap();
|
||||
|
||||
@@ -107,13 +107,13 @@ void Instance::vfx_blur_sync(BlurShaderFxData *fx, Object *ob, tObject *tgp_ob)
|
||||
if (blur_size[0] > 0.0f) {
|
||||
auto &grp = vfx_pass_create("Fx Blur H", state, sh, tgp_ob);
|
||||
grp.push_constant("offset", float2(blur_size[0] * c, blur_size[0] * s));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
if (blur_size[1] > 0.0f) {
|
||||
auto &grp = vfx_pass_create("Fx Blur V", state, sh, tgp_ob);
|
||||
grp.push_constant("offset", float2(-blur_size[1] * s, blur_size[1] * c));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
@@ -124,8 +124,8 @@ void Instance::vfx_colorize_sync(ColorizeShaderFxData *fx, Object * /*ob*/, tObj
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Colorize", state, sh, tgp_ob);
|
||||
grp.push_constant("lowColor", float3(fx->low_color));
|
||||
grp.push_constant("highColor", float3(fx->high_color));
|
||||
grp.push_constant("low_color", float3(fx->low_color));
|
||||
grp.push_constant("high_color", float3(fx->high_color));
|
||||
grp.push_constant("factor", fx->factor);
|
||||
grp.push_constant("mode", fx->mode);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
@@ -141,9 +141,9 @@ void Instance::vfx_flip_sync(FlipShaderFxData *fx, Object * /*ob*/, tObject *tgp
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Flip", state, sh, tgp_ob);
|
||||
grp.push_constant("axisFlip", float2(axis_flip));
|
||||
grp.push_constant("waveOffset", float2(0.0f, 0.0f));
|
||||
grp.push_constant("swirlRadius", 0.0f);
|
||||
grp.push_constant("axis_flip", float2(axis_flip));
|
||||
grp.push_constant("wave_offset", float2(0.0f, 0.0f));
|
||||
grp.push_constant("swirl_radius", 0.0f);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -172,11 +172,11 @@ void Instance::vfx_rim_sync(RimShaderFxData *fx, Object *ob, tObject *tgp_ob)
|
||||
{
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Rim H", state, sh, tgp_ob);
|
||||
grp.push_constant("blurDir", float2(blur_size[0] * vp_size_inv[0], 0.0f));
|
||||
grp.push_constant("uvOffset", float2(offset));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.push_constant("maskColor", float3(fx->mask_rgb));
|
||||
grp.push_constant("isFirstPass", true);
|
||||
grp.push_constant("blur_dir", float2(blur_size[0] * vp_size_inv[0], 0.0f));
|
||||
grp.push_constant("uv_offset", float2(offset));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.push_constant("mask_color", float3(fx->mask_rgb));
|
||||
grp.push_constant("is_first_pass", true);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -202,19 +202,19 @@ void Instance::vfx_rim_sync(RimShaderFxData *fx, Object *ob, tObject *tgp_ob)
|
||||
zero_v2(offset);
|
||||
|
||||
auto &grp = vfx_pass_create("Fx Rim V", state, sh, tgp_ob);
|
||||
grp.push_constant("blurDir", float2(0.0f, blur_size[1] * vp_size_inv[1]));
|
||||
grp.push_constant("uvOffset", float2(offset));
|
||||
grp.push_constant("rimColor", float3(fx->rim_rgb));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.push_constant("blendMode", fx->mode);
|
||||
grp.push_constant("isFirstPass", false);
|
||||
grp.push_constant("blur_dir", float2(0.0f, blur_size[1] * vp_size_inv[1]));
|
||||
grp.push_constant("uv_offset", float2(offset));
|
||||
grp.push_constant("rim_color", float3(fx->rim_rgb));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.push_constant("blend_mode", fx->mode);
|
||||
grp.push_constant("is_first_pass", false);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
if (fx->mode == eShaderFxRimMode_Overlay) {
|
||||
/* We cannot do custom blending on multi-target frame-buffers.
|
||||
* Workaround by doing 2 passes. */
|
||||
grp.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
|
||||
grp.push_constant("blendMode", 999);
|
||||
grp.push_constant("blend_mode", 999);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
@@ -261,11 +261,11 @@ void Instance::vfx_pixelize_sync(PixelShaderFxData *fx, Object *ob, tObject *tgp
|
||||
GPUSamplerState::default_sampler();
|
||||
|
||||
auto &grp = vfx_pass_create("Fx Pixelize X", state, sh, tgp_ob, sampler);
|
||||
grp.push_constant("targetPixelSize", float2(pixsize_uniform));
|
||||
grp.push_constant("targetPixelOffset", float2(ob_center));
|
||||
grp.push_constant("accumOffset", float2(pixel_size[0], 0.0f));
|
||||
grp.push_constant("target_pixel_size", float2(pixsize_uniform));
|
||||
grp.push_constant("target_pixel_offset", float2(ob_center));
|
||||
grp.push_constant("accum_offset", float2(pixel_size[0], 0.0f));
|
||||
int samp_count = (pixel_size[0] / vp_size_inv[0] > 3.0) ? 2 : 1;
|
||||
grp.push_constant("sampCount", (use_antialiasing ? samp_count : 0));
|
||||
grp.push_constant("samp_count", (use_antialiasing ? samp_count : 0));
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -274,10 +274,10 @@ void Instance::vfx_pixelize_sync(PixelShaderFxData *fx, Object *ob, tObject *tgp
|
||||
GPUSamplerState::default_sampler();
|
||||
copy_v2_fl2(pixsize_uniform, vp_size_inv[0], pixel_size[1]);
|
||||
auto &grp = vfx_pass_create("Fx Pixelize Y", state, sh, tgp_ob, sampler);
|
||||
grp.push_constant("targetPixelSize", float2(pixsize_uniform));
|
||||
grp.push_constant("accumOffset", float2(0.0f, pixel_size[1]));
|
||||
grp.push_constant("target_pixel_size", float2(pixsize_uniform));
|
||||
grp.push_constant("accum_offset", float2(0.0f, pixel_size[1]));
|
||||
int samp_count = (pixel_size[1] / vp_size_inv[1] > 3.0) ? 2 : 1;
|
||||
grp.push_constant("sampCount", (use_antialiasing ? samp_count : 0));
|
||||
grp.push_constant("samp_count", (use_antialiasing ? samp_count : 0));
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
@@ -364,15 +364,15 @@ void Instance::vfx_shadow_sync(ShadowShaderFxData *fx, Object *ob, tObject *tgp_
|
||||
{
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Shadow H", state, sh, tgp_ob);
|
||||
grp.push_constant("blurDir", float2(blur_dir));
|
||||
grp.push_constant("waveDir", float2(wave_dir));
|
||||
grp.push_constant("waveOffset", float2(wave_ofs));
|
||||
grp.push_constant("wavePhase", wave_phase);
|
||||
grp.push_constant("uvRotX", float2(uv_mat[0]));
|
||||
grp.push_constant("uvRotY", float2(uv_mat[1]));
|
||||
grp.push_constant("uvOffset", float2(uv_mat[3]));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.push_constant("isFirstPass", true);
|
||||
grp.push_constant("blur_dir", float2(blur_dir));
|
||||
grp.push_constant("wave_dir", float2(wave_dir));
|
||||
grp.push_constant("wave_offset", float2(wave_ofs));
|
||||
grp.push_constant("wave_phase", wave_phase);
|
||||
grp.push_constant("uv_rot_x", float2(uv_mat[0]));
|
||||
grp.push_constant("uv_rot_y", float2(uv_mat[1]));
|
||||
grp.push_constant("uv_offset", float2(uv_mat[3]));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[0])));
|
||||
grp.push_constant("is_first_pass", true);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -387,14 +387,14 @@ void Instance::vfx_shadow_sync(ShadowShaderFxData *fx, Object *ob, tObject *tgp_
|
||||
{
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL;
|
||||
auto &grp = vfx_pass_create("Fx Shadow V", state, sh, tgp_ob);
|
||||
grp.push_constant("shadowColor", float4(fx->shadow_rgba));
|
||||
grp.push_constant("blurDir", float2(blur_dir));
|
||||
grp.push_constant("waveOffset", float2(wave_ofs));
|
||||
grp.push_constant("uvRotX", float2(uv_mat[0]));
|
||||
grp.push_constant("uvRotY", float2(uv_mat[1]));
|
||||
grp.push_constant("uvOffset", float2(uv_mat[3]));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.push_constant("isFirstPass", false);
|
||||
grp.push_constant("shadow_color", float4(fx->shadow_rgba));
|
||||
grp.push_constant("blur_dir", float2(blur_dir));
|
||||
grp.push_constant("wave_offset", float2(wave_ofs));
|
||||
grp.push_constant("uv_rot_x", float2(uv_mat[0]));
|
||||
grp.push_constant("uv_rot_y", float2(uv_mat[1]));
|
||||
grp.push_constant("uv_offset", float2(uv_mat[3]));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, blur_size[1])));
|
||||
grp.push_constant("is_first_pass", false);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
@@ -425,11 +425,11 @@ void Instance::vfx_glow_sync(GlowShaderFxData *fx, Object * /*ob*/, tObject *tgp
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Glow H", state, sh, tgp_ob);
|
||||
grp.push_constant("offset", float2(fx->blur[0] * c, fx->blur[0] * s));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, fx->blur[0])));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, fx->blur[0])));
|
||||
grp.push_constant("threshold", float4(ref_col));
|
||||
grp.push_constant("glowColor", float4(fx->glow_color));
|
||||
grp.push_constant("glowUnder", use_glow_under);
|
||||
grp.push_constant("firstPass", true);
|
||||
grp.push_constant("glow_color", float4(fx->glow_color));
|
||||
grp.push_constant("glow_under", use_glow_under);
|
||||
grp.push_constant("first_pass", true);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
state = DRW_STATE_WRITE_COLOR;
|
||||
@@ -460,11 +460,11 @@ void Instance::vfx_glow_sync(GlowShaderFxData *fx, Object * /*ob*/, tObject *tgp
|
||||
{
|
||||
auto &grp = vfx_pass_create("Fx Glow V", state, sh, tgp_ob);
|
||||
grp.push_constant("offset", float2(-fx->blur[1] * s, fx->blur[1] * c));
|
||||
grp.push_constant("sampCount", max_ii(1, min_ii(fx->samples, fx->blur[0])));
|
||||
grp.push_constant("samp_count", max_ii(1, min_ii(fx->samples, fx->blur[0])));
|
||||
grp.push_constant("threshold", float4{-1.0f, -1.0f, -1.0f, -1.0});
|
||||
grp.push_constant("glowColor", float4{1.0f, 1.0f, 1.0f, fx->glow_color[3]});
|
||||
grp.push_constant("firstPass", false);
|
||||
grp.push_constant("blendMode", fx->blend_mode);
|
||||
grp.push_constant("glow_color", float4{1.0f, 1.0f, 1.0f, fx->glow_color[3]});
|
||||
grp.push_constant("first_pass", false);
|
||||
grp.push_constant("blend_mode", fx->blend_mode);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
@@ -515,11 +515,11 @@ void Instance::vfx_wave_sync(WaveShaderFxData *fx, Object *ob, tObject *tgp_ob)
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Wave", state, sh, tgp_ob);
|
||||
grp.push_constant("axisFlip", float2(1.0f, 1.0f));
|
||||
grp.push_constant("waveDir", float2(wave_dir));
|
||||
grp.push_constant("waveOffset", float2(wave_ofs));
|
||||
grp.push_constant("wavePhase", wave_phase);
|
||||
grp.push_constant("swirlRadius", 0.0f);
|
||||
grp.push_constant("axis_flip", float2(1.0f, 1.0f));
|
||||
grp.push_constant("wave_dir", float2(wave_dir));
|
||||
grp.push_constant("wave_offset", float2(wave_ofs));
|
||||
grp.push_constant("wave_phase", wave_phase);
|
||||
grp.push_constant("swirl_radius", 0.0f);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -559,11 +559,11 @@ void Instance::vfx_swirl_sync(SwirlShaderFxData *fx, Object * /*ob*/, tObject *t
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR;
|
||||
auto &grp = vfx_pass_create("Fx Flip", state, sh, tgp_ob);
|
||||
grp.push_constant("axisFlip", float2(1.0f, 1.0f));
|
||||
grp.push_constant("waveOffset", float2(0.0f, 0.0f));
|
||||
grp.push_constant("swirlCenter", float2(swirl_center));
|
||||
grp.push_constant("swirlAngle", fx->angle);
|
||||
grp.push_constant("swirlRadius", radius);
|
||||
grp.push_constant("axis_flip", float2(1.0f, 1.0f));
|
||||
grp.push_constant("wave_offset", float2(0.0f, 0.0f));
|
||||
grp.push_constant("swirl_center", float2(swirl_center));
|
||||
grp.push_constant("swirl_angle", fx->angle);
|
||||
grp.push_constant("swirl_radius", radius);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -626,13 +626,13 @@ void Instance::vfx_sync(Object *ob, tObject *tgp_ob)
|
||||
|
||||
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_MUL;
|
||||
auto &grp = vfx_pass_create("GPencil Object Compose", state, sh, tgp_ob);
|
||||
grp.push_constant("isFirstPass", true);
|
||||
grp.push_constant("is_first_pass", true);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
/* We cannot do custom blending on multi-target frame-buffers.
|
||||
* Workaround by doing 2 passes. */
|
||||
grp.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
|
||||
grp.push_constant("isFirstPass", false);
|
||||
grp.push_constant("is_first_pass", false);
|
||||
grp.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
this->use_object_fb = true;
|
||||
|
||||
@@ -12,8 +12,8 @@ void main()
|
||||
{
|
||||
#if SMAA_STAGE == 0
|
||||
/* Detect edges in color and revealage buffer. */
|
||||
out_edges = SMAALumaEdgeDetectionPS(uvs, offset, colorTex);
|
||||
out_edges = max(out_edges, SMAALumaEdgeDetectionPS(uvs, offset, revealTex));
|
||||
out_edges = SMAALumaEdgeDetectionPS(uvs, offset, color_tx);
|
||||
out_edges = max(out_edges, SMAALumaEdgeDetectionPS(uvs, offset, reveal_tx));
|
||||
/* Discard if there is no edge. */
|
||||
if (dot(out_edges, float2(1.0f, 1.0f)) == 0.0f) {
|
||||
discard;
|
||||
@@ -22,17 +22,17 @@ void main()
|
||||
|
||||
#elif SMAA_STAGE == 1
|
||||
out_weights = SMAABlendingWeightCalculationPS(
|
||||
uvs, pixcoord, offset, edgesTex, areaTex, searchTex, float4(0));
|
||||
uvs, pixcoord, offset, edges_tx, area_tx, search_tx, float4(0));
|
||||
|
||||
#elif SMAA_STAGE == 2
|
||||
/* Resolve both buffers. */
|
||||
if (doAntiAliasing) {
|
||||
out_color = SMAANeighborhoodBlendingPS(uvs, offset[0], colorTex, blendTex);
|
||||
out_reveal = SMAANeighborhoodBlendingPS(uvs, offset[0], revealTex, blendTex);
|
||||
if (do_anti_aliasing) {
|
||||
out_color = SMAANeighborhoodBlendingPS(uvs, offset[0], color_tx, blend_tx);
|
||||
out_reveal = SMAANeighborhoodBlendingPS(uvs, offset[0], reveal_tx, blend_tx);
|
||||
}
|
||||
else {
|
||||
out_color = texture(colorTex, uvs);
|
||||
out_reveal = texture(revealTex, uvs);
|
||||
out_color = texture(color_tx, uvs);
|
||||
out_reveal = texture(reveal_tx, uvs);
|
||||
}
|
||||
|
||||
/* Revealage, how much light passes through. */
|
||||
@@ -42,7 +42,7 @@ void main()
|
||||
/* Add the alpha. */
|
||||
out_color.a = 1.0f - out_reveal.a;
|
||||
|
||||
if (onlyAlpha) {
|
||||
if (only_alpha) {
|
||||
/* Special case in wire-frame X-ray mode. */
|
||||
out_color = float4(0.0f);
|
||||
out_reveal.rgb = out_reveal.aaa;
|
||||
|
||||
@@ -15,10 +15,13 @@
|
||||
#define MODE_DIVIDE 5
|
||||
#define MODE_HARDLIGHT_SECOND_PASS 999
|
||||
|
||||
void blend_mode_output(
|
||||
int blend_mode, float4 color, float opacity, out float4 frag_color, out float4 frag_revealage)
|
||||
void blend_mode_output(int blending_mode,
|
||||
float4 color,
|
||||
float opacity,
|
||||
out float4 frag_color,
|
||||
out float4 frag_revealage)
|
||||
{
|
||||
switch (blend_mode) {
|
||||
switch (blending_mode) {
|
||||
case MODE_REGULAR:
|
||||
/* Reminder: Blending func is pre-multiply alpha blend
|
||||
* `(dst.rgba * (1 - src.a) + src.rgb)`. */
|
||||
|
||||
@@ -8,8 +8,8 @@ FRAGMENT_SHADER_CREATE_INFO(gpencil_depth_merge)
|
||||
|
||||
void main()
|
||||
{
|
||||
float depth = textureLod(depthBuf, gl_FragCoord.xy / float2(textureSize(depthBuf, 0)), 0).r;
|
||||
if (strokeOrder3d) {
|
||||
float depth = textureLod(depth_buf, gl_FragCoord.xy / float2(textureSize(depth_buf, 0)), 0).r;
|
||||
if (stroke_order3d) {
|
||||
gl_FragDepth = depth;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -14,5 +14,5 @@ void main()
|
||||
float x = -1.0f + float((v & 1) << 2);
|
||||
float y = -1.0f + float((v & 2) << 1);
|
||||
gl_Position = drw_view().winmat *
|
||||
(drw_view().viewmat * (gpModelMatrix * float4(x, y, 0.0f, 1.0f)));
|
||||
(drw_view().viewmat * (gp_model_matrix * float4(x, y, 0.0f, 1.0f)));
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ float3 gpencil_lighting()
|
||||
/* Lambertian falloff */
|
||||
if (type != GP_LIGHT_TYPE_AMBIENT) {
|
||||
L /= sqrt(L_len_sqr);
|
||||
vis *= clamp(dot(gpNormal, L), 0.0f, 1.0f);
|
||||
vis *= clamp(dot(gp_normal, L), 0.0f, 1.0f);
|
||||
}
|
||||
light_accum += vis * gp_lights[i]._color;
|
||||
}
|
||||
@@ -55,13 +55,13 @@ void main()
|
||||
float4 col;
|
||||
if (flag_test(gp_interp_flat.mat_flag, GP_STROKE_TEXTURE_USE)) {
|
||||
bool premul = flag_test(gp_interp_flat.mat_flag, GP_STROKE_TEXTURE_PREMUL);
|
||||
col = texture_read_as_linearrgb(gpStrokeTexture, premul, gp_interp.uv);
|
||||
col = texture_read_as_linearrgb(gp_stroke_tx, premul, gp_interp.uv);
|
||||
}
|
||||
else if (flag_test(gp_interp_flat.mat_flag, GP_FILL_TEXTURE_USE)) {
|
||||
bool use_clip = flag_test(gp_interp_flat.mat_flag, GP_FILL_TEXTURE_CLIP);
|
||||
float2 uvs = (use_clip) ? clamp(gp_interp.uv, 0.0f, 1.0f) : gp_interp.uv;
|
||||
bool premul = flag_test(gp_interp_flat.mat_flag, GP_FILL_TEXTURE_PREMUL);
|
||||
col = texture_read_as_linearrgb(gpFillTexture, premul, uvs);
|
||||
col = texture_read_as_linearrgb(gp_fill_tx, premul, uvs);
|
||||
}
|
||||
else if (flag_test(gp_interp_flat.mat_flag, GP_FILL_GRADIENT_USE)) {
|
||||
bool radial = flag_test(gp_interp_flat.mat_flag, GP_FILL_GRADIENT_RADIAL);
|
||||
@@ -76,22 +76,22 @@ void main()
|
||||
|
||||
/* Composite all other colors on top of texture color.
|
||||
* Everything is pre-multiply by `col.a` to have the stencil effect. */
|
||||
fragColor = col * gp_interp.color_mul + col.a * gp_interp.color_add;
|
||||
frag_color = col * gp_interp.color_mul + col.a * gp_interp.color_add;
|
||||
|
||||
fragColor.rgb *= gpencil_lighting();
|
||||
frag_color.rgb *= gpencil_lighting();
|
||||
|
||||
fragColor *= gpencil_stroke_round_cap_mask(gp_interp_flat.sspos.xy,
|
||||
gp_interp_flat.sspos.zw,
|
||||
gp_interp_flat.aspect,
|
||||
gp_interp_noperspective.thickness.x,
|
||||
gp_interp_noperspective.hardness);
|
||||
frag_color *= gpencil_stroke_round_cap_mask(gp_interp_flat.sspos.xy,
|
||||
gp_interp_flat.sspos.zw,
|
||||
gp_interp_flat.aspect,
|
||||
gp_interp_noperspective.thickness.x,
|
||||
gp_interp_noperspective.hardness);
|
||||
|
||||
/* To avoid aliasing artifacts, we reduce the opacity of small strokes. */
|
||||
fragColor *= smoothstep(0.0f, 1.0f, gp_interp_noperspective.thickness.y);
|
||||
frag_color *= smoothstep(0.0f, 1.0f, gp_interp_noperspective.thickness.y);
|
||||
|
||||
/* Holdout materials. */
|
||||
if (flag_test(gp_interp_flat.mat_flag, GP_STROKE_HOLDOUT | GP_FILL_HOLDOUT)) {
|
||||
revealColor = fragColor.aaaa;
|
||||
revealColor = frag_color.aaaa;
|
||||
}
|
||||
else {
|
||||
/* NOT holdout materials.
|
||||
@@ -99,19 +99,19 @@ void main()
|
||||
* Note that we are limited to mono-chromatic alpha blending here
|
||||
* because of the blend equation and the limit of 1 color target
|
||||
* when using custom color blending. */
|
||||
revealColor = float4(0.0f, 0.0f, 0.0f, fragColor.a);
|
||||
revealColor = float4(0.0f, 0.0f, 0.0f, frag_color.a);
|
||||
|
||||
if (fragColor.a < 0.001f) {
|
||||
if (frag_color.a < 0.001f) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
float2 fb_size = max(float2(textureSize(gpSceneDepthTexture, 0).xy),
|
||||
float2(textureSize(gpMaskTexture, 0).xy));
|
||||
float2 fb_size = max(float2(textureSize(gp_scene_depth_tx, 0).xy),
|
||||
float2(textureSize(gp_mask_tx, 0).xy));
|
||||
float2 uvs = gl_FragCoord.xy / fb_size;
|
||||
/* Manual depth test */
|
||||
float scene_depth = texture(gpSceneDepthTexture, uvs).r;
|
||||
float scene_depth = texture(gp_scene_depth_tx, uvs).r;
|
||||
if (gl_FragCoord.z > scene_depth) {
|
||||
discard;
|
||||
return;
|
||||
@@ -119,7 +119,7 @@ void main()
|
||||
|
||||
/* FIXME(fclem): Grrr. This is bad for performance but it's the easiest way to not get
|
||||
* depth written where the mask obliterate the layer. */
|
||||
float mask = texture(gpMaskTexture, uvs).r;
|
||||
float mask = texture(gp_mask_tx, uvs).r;
|
||||
if (mask < 0.001f) {
|
||||
discard;
|
||||
return;
|
||||
|
||||
@@ -13,15 +13,15 @@ void main()
|
||||
float4 color;
|
||||
|
||||
/* Remember, this is associated alpha (aka. pre-multiply). */
|
||||
color.rgb = textureLod(colorBuf, screen_uv, 0).rgb;
|
||||
color.rgb = textureLod(color_buf, screen_uv, 0).rgb;
|
||||
/* Stroke only render mono-chromatic revealage. We convert to alpha. */
|
||||
color.a = 1.0f - textureLod(revealBuf, screen_uv, 0).r;
|
||||
color.a = 1.0f - textureLod(reveal_buf, screen_uv, 0).r;
|
||||
|
||||
float mask = textureLod(maskBuf, screen_uv, 0).r;
|
||||
mask *= blendOpacity;
|
||||
float mask = textureLod(mask_buf, screen_uv, 0).r;
|
||||
mask *= blend_opacity;
|
||||
|
||||
fragColor = float4(1.0f, 0.0f, 1.0f, 1.0f);
|
||||
frag_color = float4(1.0f, 0.0f, 1.0f, 1.0f);
|
||||
fragRevealage = float4(1.0f, 0.0f, 1.0f, 1.0f);
|
||||
|
||||
blend_mode_output(blendMode, color, mask, fragColor, fragRevealage);
|
||||
blend_mode_output(blend_mode, color, mask, frag_color, fragRevealage);
|
||||
}
|
||||
|
||||
@@ -9,5 +9,5 @@ FRAGMENT_SHADER_CREATE_INFO(gpencil_mask_invert)
|
||||
void main()
|
||||
{
|
||||
/* Blend mode does the inversion. */
|
||||
fragRevealage = fragColor = float4(1.0f);
|
||||
fragRevealage = frag_color = float4(1.0f);
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@ void gpencil_color_output(float4 stroke_col, float4 vert_col, float vert_strengt
|
||||
{
|
||||
/* Mix stroke with other colors. */
|
||||
float4 mixed_col = stroke_col;
|
||||
mixed_col.rgb = mix(mixed_col.rgb, vert_col.rgb, vert_col.a * gpVertexColorOpacity);
|
||||
mixed_col.rgb = mix(mixed_col.rgb, gpLayerTint.rgb, gpLayerTint.a);
|
||||
mixed_col.a *= vert_strength * gpLayerOpacity;
|
||||
mixed_col.rgb = mix(mixed_col.rgb, vert_col.rgb, vert_col.a * gp_vertex_color_opacity);
|
||||
mixed_col.rgb = mix(mixed_col.rgb, gp_layer_tint.rgb, gp_layer_tint.a);
|
||||
mixed_col.a *= vert_strength * gp_layer_opacity;
|
||||
/**
|
||||
* This is what the fragment shader looks like.
|
||||
* out = col * gp_interp.color_mul + col.a * gp_interp.color_add.
|
||||
@@ -39,10 +39,10 @@ void main()
|
||||
float3 vert_N;
|
||||
|
||||
int4 ma1 = floatBitsToInt(texelFetch(gp_pos_tx, gpencil_stroke_point_id() * 3 + 1));
|
||||
gpMaterial gp_mat = gp_materials[ma1.x + gpMaterialOffset];
|
||||
gpMaterial gp_mat = gp_materials[ma1.x + gp_material_offset];
|
||||
gpMaterialFlag gp_flag = gpMaterialFlag(floatBitsToUint(gp_mat._flag));
|
||||
|
||||
gl_Position = gpencil_vertex(float4(viewportSize, 1.0f / viewportSize),
|
||||
gl_Position = gpencil_vertex(float4(viewport_size, 1.0f / viewport_size),
|
||||
gp_flag,
|
||||
gp_mat._alignment_rot,
|
||||
gp_interp.pos,
|
||||
@@ -70,7 +70,7 @@ void main()
|
||||
|
||||
gp_interp_flat.mat_flag = gp_flag & ~GP_FILL_FLAGS;
|
||||
|
||||
if (gpStrokeOrder3d) {
|
||||
if (gp_stroke_order3d) {
|
||||
/* Use the fragment depth (see fragment shader). */
|
||||
gp_interp_flat.depth = -1.0f;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ void main()
|
||||
/* Use the index of the point as depth.
|
||||
* This means the stroke can overlap itself. */
|
||||
float point_index = float(ma1.z);
|
||||
gp_interp_flat.depth = (point_index + gpStrokeIndexOffset + 2.0f) * 0.0000002f;
|
||||
gp_interp_flat.depth = (point_index + gp_stroke_index_offset + 2.0f) * 0.0000002f;
|
||||
}
|
||||
else {
|
||||
/* Use the index of first point of the stroke as depth.
|
||||
@@ -87,7 +87,7 @@ void main()
|
||||
* We offset by one so that the fill can be overlapped by its stroke.
|
||||
* The offset is ok since we pad the strokes data because of adjacency infos. */
|
||||
float stroke_index = float(ma1.y);
|
||||
gp_interp_flat.depth = (stroke_index + gpStrokeIndexOffset + 2.0f) * 0.0000002f;
|
||||
gp_interp_flat.depth = (stroke_index + gp_stroke_index_offset + 2.0f) * 0.0000002f;
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -123,19 +123,19 @@ void main()
|
||||
gpencil_color_output(fill_col, fcol_decode, 1.0f, gp_mat._fill_texture_mix);
|
||||
|
||||
gp_interp_flat.mat_flag = gp_flag & GP_FILL_FLAGS;
|
||||
gp_interp_flat.mat_flag |= uint(ma1.x + gpMaterialOffset) << GPENCIl_MATID_SHIFT;
|
||||
gp_interp_flat.mat_flag |= uint(ma1.x + gp_material_offset) << GPENCIl_MATID_SHIFT;
|
||||
|
||||
gp_interp.uv = float2x2(gp_mat.fill_uv_rot_scale.xy, gp_mat.fill_uv_rot_scale.zw) * uv1.xy +
|
||||
gp_mat._fill_uv_offset;
|
||||
|
||||
if (gpStrokeOrder3d) {
|
||||
if (gp_stroke_order3d) {
|
||||
/* Use the fragment depth (see fragment shader). */
|
||||
gp_interp_flat.depth = -1.0f;
|
||||
}
|
||||
else {
|
||||
/* Use the index of first point of the stroke as depth. */
|
||||
float stroke_index = float(ma1.y);
|
||||
gp_interp_flat.depth = (stroke_index + gpStrokeIndexOffset + 1.0f) * 0.0000002f;
|
||||
gp_interp_flat.depth = (stroke_index + gp_stroke_index_offset + 1.0f) * 0.0000002f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,16 +17,16 @@ float gaussian_weight(float x)
|
||||
|
||||
void main()
|
||||
{
|
||||
if (isFirstPass) {
|
||||
if (is_first_pass) {
|
||||
/* Blend mode is multiply. */
|
||||
fragColor.rgb = fragRevealage.rgb = texture(revealBuf, screen_uv).rgb;
|
||||
fragColor.a = fragRevealage.a = 1.0f;
|
||||
frag_color.rgb = fragRevealage.rgb = texture(reveal_buf, screen_uv).rgb;
|
||||
frag_color.a = fragRevealage.a = 1.0f;
|
||||
}
|
||||
else {
|
||||
/* Blend mode is additive. */
|
||||
fragRevealage = float4(0.0f);
|
||||
fragColor.rgb = texture(colorBuf, screen_uv).rgb;
|
||||
fragColor.a = 0.0f;
|
||||
frag_color.rgb = texture(color_buf, screen_uv).rgb;
|
||||
frag_color.a = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,28 +45,28 @@ void main()
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(colorBuf, screen_uv);
|
||||
fragRevealage = texture(revealBuf, screen_uv);
|
||||
frag_color = texture(color_buf, screen_uv);
|
||||
fragRevealage = texture(reveal_buf, screen_uv);
|
||||
|
||||
float luma = dot(fragColor.rgb, float3(0.2126f, 0.7152f, 0.723f));
|
||||
float luma = dot(frag_color.rgb, float3(0.2126f, 0.7152f, 0.723f));
|
||||
|
||||
/* No blending. */
|
||||
switch (mode) {
|
||||
case MODE_GRAYSCALE:
|
||||
fragColor.rgb = mix(fragColor.rgb, float3(luma), factor);
|
||||
frag_color.rgb = mix(frag_color.rgb, float3(luma), factor);
|
||||
break;
|
||||
case MODE_SEPIA:
|
||||
fragColor.rgb = mix(fragColor.rgb, sepia_mat * fragColor.rgb, factor);
|
||||
frag_color.rgb = mix(frag_color.rgb, sepia_mat * frag_color.rgb, factor);
|
||||
break;
|
||||
case MODE_DUOTONE:
|
||||
fragColor.rgb = luma * ((luma <= factor) ? lowColor : highColor);
|
||||
frag_color.rgb = luma * ((luma <= factor) ? low_color : high_color);
|
||||
break;
|
||||
case MODE_CUSTOM:
|
||||
fragColor.rgb = mix(fragColor.rgb, luma * lowColor, factor);
|
||||
frag_color.rgb = mix(frag_color.rgb, luma * low_color, factor);
|
||||
break;
|
||||
case MODE_TRANSPARENT:
|
||||
default:
|
||||
fragColor.rgb *= factor;
|
||||
frag_color.rgb *= factor;
|
||||
fragRevealage.rgb = mix(float3(1.0f), fragRevealage.rgb, factor);
|
||||
break;
|
||||
}
|
||||
@@ -76,24 +76,24 @@ void main()
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 pixel_size = 1.0f / float2(textureSize(revealBuf, 0).xy);
|
||||
float2 pixel_size = 1.0f / float2(textureSize(reveal_buf, 0).xy);
|
||||
float2 ofs = offset * pixel_size;
|
||||
|
||||
fragColor = float4(0.0f);
|
||||
frag_color = float4(0.0f);
|
||||
fragRevealage = float4(0.0f);
|
||||
|
||||
/* No blending. */
|
||||
float weight_accum = 0.0f;
|
||||
for (int i = -sampCount; i <= sampCount; i++) {
|
||||
float x = float(i) / float(sampCount);
|
||||
for (int i = -samp_count; i <= samp_count; i++) {
|
||||
float x = float(i) / float(samp_count);
|
||||
float weight = gaussian_weight(x);
|
||||
weight_accum += weight;
|
||||
float2 uv = screen_uv + ofs * x;
|
||||
fragColor.rgb += texture(colorBuf, uv).rgb * weight;
|
||||
fragRevealage.rgb += texture(revealBuf, uv).rgb * weight;
|
||||
frag_color.rgb += texture(color_buf, uv).rgb * weight;
|
||||
fragRevealage.rgb += texture(reveal_buf, uv).rgb * weight;
|
||||
}
|
||||
|
||||
fragColor /= weight_accum;
|
||||
frag_color /= weight_accum;
|
||||
fragRevealage /= weight_accum;
|
||||
}
|
||||
|
||||
@@ -101,46 +101,46 @@ void main()
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 uv = (screen_uv - 0.5f) * axisFlip + 0.5f;
|
||||
float2 uv = (screen_uv - 0.5f) * axis_flip + 0.5f;
|
||||
|
||||
/* Wave deform. */
|
||||
float wave_time = dot(uv, waveDir.xy);
|
||||
uv += sin(wave_time + wavePhase) * waveOffset;
|
||||
float wave_time = dot(uv, wave_dir.xy);
|
||||
uv += sin(wave_time + wave_phase) * wave_offset;
|
||||
/* Swirl deform. */
|
||||
if (swirlRadius > 0.0f) {
|
||||
float2 tex_size = float2(textureSize(colorBuf, 0).xy);
|
||||
float2 pix_coord = uv * tex_size - swirlCenter;
|
||||
if (swirl_radius > 0.0f) {
|
||||
float2 tex_size = float2(textureSize(color_buf, 0).xy);
|
||||
float2 pix_coord = uv * tex_size - swirl_center;
|
||||
float dist = length(pix_coord);
|
||||
float percent = clamp((swirlRadius - dist) / swirlRadius, 0.0f, 1.0f);
|
||||
float theta = percent * percent * swirlAngle;
|
||||
float percent = clamp((swirl_radius - dist) / swirl_radius, 0.0f, 1.0f);
|
||||
float theta = percent * percent * swirl_angle;
|
||||
float s = sin(theta);
|
||||
float c = cos(theta);
|
||||
float2x2 rot = float2x2(float2(c, -s), float2(s, c));
|
||||
uv = (rot * pix_coord + swirlCenter) / tex_size;
|
||||
uv = (rot * pix_coord + swirl_center) / tex_size;
|
||||
}
|
||||
|
||||
fragColor = texture(colorBuf, uv);
|
||||
fragRevealage = texture(revealBuf, uv);
|
||||
frag_color = texture(color_buf, uv);
|
||||
fragRevealage = texture(reveal_buf, uv);
|
||||
}
|
||||
|
||||
#elif defined(GLOW)
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 pixel_size = 1.0f / float2(textureSize(revealBuf, 0).xy);
|
||||
float2 pixel_size = 1.0f / float2(textureSize(reveal_buf, 0).xy);
|
||||
float2 ofs = offset * pixel_size;
|
||||
|
||||
fragColor = float4(0.0f);
|
||||
frag_color = float4(0.0f);
|
||||
fragRevealage = float4(0.0f);
|
||||
|
||||
float weight_accum = 0.0f;
|
||||
for (int i = -sampCount; i <= sampCount; i++) {
|
||||
float x = float(i) / float(sampCount);
|
||||
for (int i = -samp_count; i <= samp_count; i++) {
|
||||
float x = float(i) / float(samp_count);
|
||||
float weight = gaussian_weight(x);
|
||||
weight_accum += weight;
|
||||
float2 uv = screen_uv + ofs * x;
|
||||
float3 col = texture(colorBuf, uv).rgb;
|
||||
float3 rev = texture(revealBuf, uv).rgb;
|
||||
float3 col = texture(color_buf, uv).rgb;
|
||||
float3 rev = texture(reveal_buf, uv).rgb;
|
||||
if (threshold.x > -1.0f) {
|
||||
if (threshold.y > -1.0f) {
|
||||
if (any(greaterThan(abs(col - float3(threshold)), float3(threshold.w)))) {
|
||||
@@ -153,33 +153,33 @@ void main()
|
||||
}
|
||||
}
|
||||
}
|
||||
fragColor.rgb += col * weight;
|
||||
frag_color.rgb += col * weight;
|
||||
fragRevealage.rgb += (1.0f - rev) * weight;
|
||||
}
|
||||
|
||||
if (weight_accum > 0.0f) {
|
||||
fragColor *= glowColor.rgbb / weight_accum;
|
||||
frag_color *= glow_color.rgbb / weight_accum;
|
||||
fragRevealage = fragRevealage / weight_accum;
|
||||
}
|
||||
fragRevealage = 1.0f - fragRevealage;
|
||||
|
||||
if (glowUnder) {
|
||||
if (firstPass) {
|
||||
if (glow_under) {
|
||||
if (first_pass) {
|
||||
/* In first pass we copy the revealage buffer in the alpha channel.
|
||||
* This let us do the alpha under in second pass. */
|
||||
float3 original_revealage = texture(revealBuf, screen_uv).rgb;
|
||||
float3 original_revealage = texture(reveal_buf, screen_uv).rgb;
|
||||
fragRevealage.a = clamp(dot(original_revealage.rgb, float3(0.333334f)), 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
/* Recover original revealage. */
|
||||
fragRevealage.a = texture(revealBuf, screen_uv).a;
|
||||
fragRevealage.a = texture(reveal_buf, screen_uv).a;
|
||||
}
|
||||
}
|
||||
|
||||
if (!firstPass) {
|
||||
fragColor.a = clamp(1.0f - dot(fragRevealage.rgb, float3(0.333334f)), 0.0f, 1.0f);
|
||||
fragRevealage.a *= glowColor.a;
|
||||
blend_mode_output(blendMode, fragColor, fragRevealage.a, fragColor, fragRevealage);
|
||||
if (!first_pass) {
|
||||
frag_color.a = clamp(1.0f - dot(fragRevealage.rgb, float3(0.333334f)), 0.0f, 1.0f);
|
||||
fragRevealage.a *= glow_color.a;
|
||||
blend_mode_output(blend_mode, frag_color, fragRevealage.a, frag_color, fragRevealage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,12 +190,12 @@ void main()
|
||||
/* Blur revealage buffer. */
|
||||
fragRevealage = float4(0.0f);
|
||||
float weight_accum = 0.0f;
|
||||
for (int i = -sampCount; i <= sampCount; i++) {
|
||||
float x = float(i) / float(sampCount);
|
||||
for (int i = -samp_count; i <= samp_count; i++) {
|
||||
float x = float(i) / float(samp_count);
|
||||
float weight = gaussian_weight(x);
|
||||
weight_accum += weight;
|
||||
float2 uv = screen_uv + blurDir * x + uvOffset;
|
||||
float3 col = texture(revealBuf, uv).rgb;
|
||||
float2 uv = screen_uv + blur_dir * x + uv_offset;
|
||||
float3 col = texture(reveal_buf, uv).rgb;
|
||||
if (any(not(equal(float2(0.0f), floor(uv))))) {
|
||||
col = float3(0.0f);
|
||||
}
|
||||
@@ -203,26 +203,26 @@ void main()
|
||||
}
|
||||
fragRevealage /= weight_accum;
|
||||
|
||||
if (isFirstPass) {
|
||||
if (is_first_pass) {
|
||||
/* In first pass we copy the reveal buffer. This let us do alpha masking in second pass. */
|
||||
fragColor = texture(revealBuf, screen_uv);
|
||||
frag_color = texture(reveal_buf, screen_uv);
|
||||
/* Also add the masked color to the reveal buffer. */
|
||||
float3 col = texture(colorBuf, screen_uv).rgb;
|
||||
if (all(lessThan(abs(col - maskColor), float3(0.05f)))) {
|
||||
fragColor = float4(1.0f);
|
||||
float3 col = texture(color_buf, screen_uv).rgb;
|
||||
if (all(lessThan(abs(col - mask_color), float3(0.05f)))) {
|
||||
frag_color = float4(1.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Pre-multiply by foreground alpha (alpha mask). */
|
||||
float mask = 1.0f -
|
||||
clamp(dot(float3(0.333334f), texture(colorBuf, screen_uv).rgb), 0.0f, 1.0f);
|
||||
clamp(dot(float3(0.333334f), texture(color_buf, screen_uv).rgb), 0.0f, 1.0f);
|
||||
|
||||
/* fragRevealage is blurred shadow. */
|
||||
float rim = clamp(dot(float3(0.333334f), fragRevealage.rgb), 0.0f, 1.0f);
|
||||
|
||||
float4 color = float4(rimColor, 1.0f);
|
||||
float4 color = float4(rim_color, 1.0f);
|
||||
|
||||
blend_mode_output(blendMode, color, rim * mask, fragColor, fragRevealage);
|
||||
blend_mode_output(blend_mode, color, rim * mask, frag_color, fragRevealage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,11 +232,11 @@ float2 compute_uvs(float x)
|
||||
{
|
||||
float2 uv = screen_uv;
|
||||
/* Transform UV (loc, rot, scale) */
|
||||
uv = uv.x * uvRotX + uv.y * uvRotY + uvOffset;
|
||||
uv += blurDir * x;
|
||||
uv = uv.x * uv_rot_x + uv.y * uv_rot_y + uv_offset;
|
||||
uv += blur_dir * x;
|
||||
/* Wave deform. */
|
||||
float wave_time = dot(uv, waveDir.xy);
|
||||
uv += sin(wave_time + wavePhase) * waveOffset;
|
||||
float wave_time = dot(uv, wave_dir.xy);
|
||||
uv += sin(wave_time + wave_phase) * wave_offset;
|
||||
return uv;
|
||||
}
|
||||
|
||||
@@ -245,12 +245,12 @@ void main()
|
||||
/* Blur revealage buffer. */
|
||||
fragRevealage = float4(0.0f);
|
||||
float weight_accum = 0.0f;
|
||||
for (int i = -sampCount; i <= sampCount; i++) {
|
||||
float x = float(i) / float(sampCount);
|
||||
for (int i = -samp_count; i <= samp_count; i++) {
|
||||
float x = float(i) / float(samp_count);
|
||||
float weight = gaussian_weight(x);
|
||||
weight_accum += weight;
|
||||
float2 uv = compute_uvs(x);
|
||||
float3 col = texture(revealBuf, uv).rgb;
|
||||
float3 col = texture(reveal_buf, uv).rgb;
|
||||
if (any(not(equal(float2(0.0f), floor(uv))))) {
|
||||
col = float3(1.0f);
|
||||
}
|
||||
@@ -259,22 +259,22 @@ void main()
|
||||
fragRevealage /= weight_accum;
|
||||
|
||||
/* No blending in first pass, alpha over pre-multiply in second pass. */
|
||||
if (isFirstPass) {
|
||||
if (is_first_pass) {
|
||||
/* In first pass we copy the reveal buffer. This let us do alpha under in second pass. */
|
||||
fragColor = texture(revealBuf, screen_uv);
|
||||
frag_color = texture(reveal_buf, screen_uv);
|
||||
}
|
||||
else {
|
||||
/* fragRevealage is blurred shadow. */
|
||||
float shadow_fac = 1.0f - clamp(dot(float3(0.333334f), fragRevealage.rgb), 0.0f, 1.0f);
|
||||
/* Pre-multiply by foreground revealage (alpha under). */
|
||||
float3 original_revealage = texture(colorBuf, screen_uv).rgb;
|
||||
float3 original_revealage = texture(color_buf, screen_uv).rgb;
|
||||
shadow_fac *= clamp(dot(float3(0.333334f), original_revealage), 0.0f, 1.0f);
|
||||
/* Modulate by opacity */
|
||||
shadow_fac *= shadowColor.a;
|
||||
shadow_fac *= shadow_color.a;
|
||||
/* Apply shadow color. */
|
||||
fragColor.rgb = mix(float3(0.0f), shadowColor.rgb, shadow_fac);
|
||||
frag_color.rgb = mix(float3(0.0f), shadow_color.rgb, shadow_fac);
|
||||
/* Alpha over (mask behind the shadow). */
|
||||
fragColor.a = shadow_fac;
|
||||
frag_color.a = shadow_fac;
|
||||
|
||||
fragRevealage.rgb = original_revealage * (1.0f - shadow_fac);
|
||||
/* Replace the whole revealage buffer. */
|
||||
@@ -286,21 +286,21 @@ void main()
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 pixel = floor((screen_uv - targetPixelOffset) / targetPixelSize);
|
||||
float2 uv = (pixel + 0.5f) * targetPixelSize + targetPixelOffset;
|
||||
float2 pixel = floor((screen_uv - target_pixel_offset) / target_pixel_size);
|
||||
float2 uv = (pixel + 0.5f) * target_pixel_size + target_pixel_offset;
|
||||
|
||||
fragColor = float4(0.0f);
|
||||
frag_color = float4(0.0f);
|
||||
fragRevealage = float4(0.0f);
|
||||
|
||||
for (int i = -sampCount; i <= sampCount; i++) {
|
||||
float x = float(i) / float(sampCount + 1);
|
||||
float2 uv_ofs = uv + accumOffset * 0.5f * x;
|
||||
fragColor += texture(colorBuf, uv_ofs);
|
||||
fragRevealage += texture(revealBuf, uv_ofs);
|
||||
for (int i = -samp_count; i <= samp_count; i++) {
|
||||
float x = float(i) / float(samp_count + 1);
|
||||
float2 uv_ofs = uv + accum_offset * 0.5f * x;
|
||||
frag_color += texture(color_buf, uv_ofs);
|
||||
fragRevealage += texture(reveal_buf, uv_ofs);
|
||||
}
|
||||
|
||||
fragColor /= float(sampCount) * 2.0f + 1.0f;
|
||||
fragRevealage /= float(sampCount) * 2.0f + 1.0f;
|
||||
frag_color /= float(samp_count) * 2.0f + 1.0f;
|
||||
fragRevealage /= float(samp_count) * 2.0f + 1.0f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
# define SMAA_STAGE 1
|
||||
# define SMAA_PRESET_HIGH
|
||||
# define SMAA_NO_DISCARD
|
||||
# define SMAA_RT_METRICS viewportMetrics
|
||||
# define SMAA_RT_METRICS viewport_metrics
|
||||
# define SMAA_LUMA_WEIGHT float4(1.0f, 1.0f, 1.0f, 1.0f)
|
||||
#endif
|
||||
|
||||
@@ -52,23 +52,23 @@ GPU_SHADER_CREATE_INFO(gpencil_geometry)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("GP_LIGHT")
|
||||
TYPEDEF_SOURCE("gpencil_defines.hh")
|
||||
SAMPLER(2, FLOAT_2D, gpFillTexture)
|
||||
SAMPLER(3, FLOAT_2D, gpStrokeTexture)
|
||||
SAMPLER(4, DEPTH_2D, gpSceneDepthTexture)
|
||||
SAMPLER(5, FLOAT_2D, gpMaskTexture)
|
||||
SAMPLER(2, FLOAT_2D, gp_fill_tx)
|
||||
SAMPLER(3, FLOAT_2D, gp_stroke_tx)
|
||||
SAMPLER(4, DEPTH_2D, gp_scene_depth_tx)
|
||||
SAMPLER(5, FLOAT_2D, gp_mask_tx)
|
||||
UNIFORM_BUF_FREQ(4, gpMaterial, gp_materials[GPENCIL_MATERIAL_BUFFER_LEN], BATCH)
|
||||
UNIFORM_BUF_FREQ(3, gpLight, gp_lights[GPENCIL_LIGHT_BUFFER_LEN], BATCH)
|
||||
PUSH_CONSTANT(float2, viewportSize)
|
||||
PUSH_CONSTANT(float2, viewport_size)
|
||||
/* Per Object */
|
||||
PUSH_CONSTANT(float3, gpNormal)
|
||||
PUSH_CONSTANT(bool, gpStrokeOrder3d)
|
||||
PUSH_CONSTANT(int, gpMaterialOffset)
|
||||
PUSH_CONSTANT(float3, gp_normal)
|
||||
PUSH_CONSTANT(bool, gp_stroke_order3d)
|
||||
PUSH_CONSTANT(int, gp_material_offset)
|
||||
/* Per Layer */
|
||||
PUSH_CONSTANT(float, gpVertexColorOpacity)
|
||||
PUSH_CONSTANT(float4, gpLayerTint)
|
||||
PUSH_CONSTANT(float, gpLayerOpacity)
|
||||
PUSH_CONSTANT(float, gpStrokeIndexOffset)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(float, gp_vertex_color_opacity)
|
||||
PUSH_CONSTANT(float4, gp_layer_tint)
|
||||
PUSH_CONSTANT(float, gp_layer_opacity)
|
||||
PUSH_CONSTANT(float, gp_stroke_index_offset)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, revealColor)
|
||||
VERTEX_OUT(gpencil_geometry_iface)
|
||||
VERTEX_OUT(gpencil_geometry_flat_iface)
|
||||
@@ -89,14 +89,14 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_layer_blend)
|
||||
DO_STATIC_COMPILATION()
|
||||
SAMPLER(0, FLOAT_2D, colorBuf)
|
||||
SAMPLER(1, FLOAT_2D, revealBuf)
|
||||
SAMPLER(2, FLOAT_2D, maskBuf)
|
||||
PUSH_CONSTANT(int, blendMode)
|
||||
PUSH_CONSTANT(float, blendOpacity)
|
||||
SAMPLER(0, FLOAT_2D, color_buf)
|
||||
SAMPLER(1, FLOAT_2D, reveal_buf)
|
||||
SAMPLER(2, FLOAT_2D, mask_buf)
|
||||
PUSH_CONSTANT(int, blend_mode)
|
||||
PUSH_CONSTANT(float, blend_opacity)
|
||||
/* Reminder: This is considered SRC color in blend equations.
|
||||
* Same operation on all buffers. */
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, fragRevealage)
|
||||
FRAGMENT_SOURCE("gpencil_layer_blend_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
@@ -104,7 +104,7 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_mask_invert)
|
||||
DO_STATIC_COMPILATION()
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, fragRevealage)
|
||||
FRAGMENT_SOURCE("gpencil_mask_invert_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
@@ -112,9 +112,9 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_depth_merge)
|
||||
DO_STATIC_COMPILATION()
|
||||
PUSH_CONSTANT(float4x4, gpModelMatrix)
|
||||
PUSH_CONSTANT(bool, strokeOrder3d)
|
||||
SAMPLER(0, DEPTH_2D, depthBuf)
|
||||
PUSH_CONSTANT(float4x4, gp_model_matrix)
|
||||
PUSH_CONSTANT(bool, stroke_order3d)
|
||||
SAMPLER(0, DEPTH_2D, depth_buf)
|
||||
VERTEX_SOURCE("gpencil_depth_merge_vert.glsl")
|
||||
FRAGMENT_SOURCE("gpencil_depth_merge_frag.glsl")
|
||||
DEPTH_WRITE(DepthWrite::ANY)
|
||||
@@ -135,21 +135,21 @@ GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_antialiasing)
|
||||
DEFINE("SMAA_GLSL_3")
|
||||
DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics")
|
||||
DEFINE_VALUE("SMAA_RT_METRICS", "viewport_metrics")
|
||||
DEFINE("SMAA_PRESET_HIGH")
|
||||
DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(lumaWeight, lumaWeight, lumaWeight, 0.0f)")
|
||||
DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(luma_weight, luma_weight, luma_weight, 0.0f)")
|
||||
DEFINE("SMAA_NO_DISCARD")
|
||||
VERTEX_OUT(gpencil_antialiasing_iface)
|
||||
PUSH_CONSTANT(float4, viewportMetrics)
|
||||
PUSH_CONSTANT(float, lumaWeight)
|
||||
PUSH_CONSTANT(float4, viewport_metrics)
|
||||
PUSH_CONSTANT(float, luma_weight)
|
||||
VERTEX_SOURCE("gpencil_antialiasing_vert.glsl")
|
||||
FRAGMENT_SOURCE("gpencil_antialiasing_frag.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_0)
|
||||
DEFINE_VALUE("SMAA_STAGE", "0")
|
||||
SAMPLER(0, FLOAT_2D, colorTex)
|
||||
SAMPLER(1, FLOAT_2D, revealTex)
|
||||
SAMPLER(0, FLOAT_2D, color_tx)
|
||||
SAMPLER(1, FLOAT_2D, reveal_tx)
|
||||
FRAGMENT_OUT(0, float2, out_edges)
|
||||
ADDITIONAL_INFO(gpencil_antialiasing)
|
||||
DO_STATIC_COMPILATION()
|
||||
@@ -157,9 +157,9 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_1)
|
||||
DEFINE_VALUE("SMAA_STAGE", "1")
|
||||
SAMPLER(0, FLOAT_2D, edgesTex)
|
||||
SAMPLER(1, FLOAT_2D, areaTex)
|
||||
SAMPLER(2, FLOAT_2D, searchTex)
|
||||
SAMPLER(0, FLOAT_2D, edges_tx)
|
||||
SAMPLER(1, FLOAT_2D, area_tx)
|
||||
SAMPLER(2, FLOAT_2D, search_tx)
|
||||
FRAGMENT_OUT(0, float4, out_weights)
|
||||
ADDITIONAL_INFO(gpencil_antialiasing)
|
||||
DO_STATIC_COMPILATION()
|
||||
@@ -167,14 +167,14 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_antialiasing_stage_2)
|
||||
DEFINE_VALUE("SMAA_STAGE", "2")
|
||||
SAMPLER(0, FLOAT_2D, colorTex)
|
||||
SAMPLER(1, FLOAT_2D, revealTex)
|
||||
SAMPLER(2, FLOAT_2D, blendTex)
|
||||
PUSH_CONSTANT(float, mixFactor)
|
||||
PUSH_CONSTANT(float, taaAccumulatedWeight)
|
||||
PUSH_CONSTANT(bool, doAntiAliasing)
|
||||
PUSH_CONSTANT(bool, onlyAlpha)
|
||||
/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */
|
||||
SAMPLER(0, FLOAT_2D, color_tx)
|
||||
SAMPLER(1, FLOAT_2D, reveal_tx)
|
||||
SAMPLER(2, FLOAT_2D, blend_tx)
|
||||
PUSH_CONSTANT(float, mix_factor)
|
||||
PUSH_CONSTANT(float, taa_accumulated_weight)
|
||||
PUSH_CONSTANT(bool, do_anti_aliasing)
|
||||
PUSH_CONSTANT(bool, only_alpha)
|
||||
/* Reminder: Blending func is `fragRevealage * DST + frag_color`. */
|
||||
FRAGMENT_OUT_DUAL(0, float4, out_color, SRC_0)
|
||||
FRAGMENT_OUT_DUAL(0, float4, out_reveal, SRC_1)
|
||||
ADDITIONAL_INFO(gpencil_antialiasing)
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_common)
|
||||
SAMPLER(0, FLOAT_2D, colorBuf)
|
||||
SAMPLER(1, FLOAT_2D, revealBuf)
|
||||
SAMPLER(0, FLOAT_2D, color_buf)
|
||||
SAMPLER(1, FLOAT_2D, reveal_buf)
|
||||
/* Reminder: This is considered SRC color in blend equations.
|
||||
* Same operation on all buffers. */
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, fragRevealage)
|
||||
FRAGMENT_SOURCE("gpencil_vfx_frag.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -30,7 +30,7 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_composite)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("COMPOSITE")
|
||||
PUSH_CONSTANT(bool, isFirstPass)
|
||||
PUSH_CONSTANT(bool, is_first_pass)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -38,8 +38,8 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_colorize)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("COLORIZE")
|
||||
PUSH_CONSTANT(float3, lowColor)
|
||||
PUSH_CONSTANT(float3, highColor)
|
||||
PUSH_CONSTANT(float3, low_color)
|
||||
PUSH_CONSTANT(float3, high_color)
|
||||
PUSH_CONSTANT(float, factor)
|
||||
PUSH_CONSTANT(int, mode)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
@@ -50,7 +50,7 @@ GPU_SHADER_CREATE_INFO(gpencil_fx_blur)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("BLUR")
|
||||
PUSH_CONSTANT(float2, offset)
|
||||
PUSH_CONSTANT(int, sampCount)
|
||||
PUSH_CONSTANT(int, samp_count)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -58,13 +58,13 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_transform)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("TRANSFORM")
|
||||
PUSH_CONSTANT(float2, axisFlip)
|
||||
PUSH_CONSTANT(float2, waveDir)
|
||||
PUSH_CONSTANT(float2, waveOffset)
|
||||
PUSH_CONSTANT(float, wavePhase)
|
||||
PUSH_CONSTANT(float2, swirlCenter)
|
||||
PUSH_CONSTANT(float, swirlAngle)
|
||||
PUSH_CONSTANT(float, swirlRadius)
|
||||
PUSH_CONSTANT(float2, axis_flip)
|
||||
PUSH_CONSTANT(float2, wave_dir)
|
||||
PUSH_CONSTANT(float2, wave_offset)
|
||||
PUSH_CONSTANT(float, wave_phase)
|
||||
PUSH_CONSTANT(float2, swirl_center)
|
||||
PUSH_CONSTANT(float, swirl_angle)
|
||||
PUSH_CONSTANT(float, swirl_radius)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -72,13 +72,13 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_glow)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("GLOW")
|
||||
PUSH_CONSTANT(float4, glowColor)
|
||||
PUSH_CONSTANT(float4, glow_color)
|
||||
PUSH_CONSTANT(float2, offset)
|
||||
PUSH_CONSTANT(int, sampCount)
|
||||
PUSH_CONSTANT(int, samp_count)
|
||||
PUSH_CONSTANT(float4, threshold)
|
||||
PUSH_CONSTANT(bool, firstPass)
|
||||
PUSH_CONSTANT(bool, glowUnder)
|
||||
PUSH_CONSTANT(int, blendMode)
|
||||
PUSH_CONSTANT(bool, first_pass)
|
||||
PUSH_CONSTANT(bool, glow_under)
|
||||
PUSH_CONSTANT(int, blend_mode)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -86,13 +86,13 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_rim)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("RIM")
|
||||
PUSH_CONSTANT(float2, blurDir)
|
||||
PUSH_CONSTANT(float2, uvOffset)
|
||||
PUSH_CONSTANT(float3, rimColor)
|
||||
PUSH_CONSTANT(float3, maskColor)
|
||||
PUSH_CONSTANT(int, sampCount)
|
||||
PUSH_CONSTANT(int, blendMode)
|
||||
PUSH_CONSTANT(bool, isFirstPass)
|
||||
PUSH_CONSTANT(float2, blur_dir)
|
||||
PUSH_CONSTANT(float2, uv_offset)
|
||||
PUSH_CONSTANT(float3, rim_color)
|
||||
PUSH_CONSTANT(float3, mask_color)
|
||||
PUSH_CONSTANT(int, samp_count)
|
||||
PUSH_CONSTANT(int, blend_mode)
|
||||
PUSH_CONSTANT(bool, is_first_pass)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -100,16 +100,16 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_shadow)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("SHADOW")
|
||||
PUSH_CONSTANT(float4, shadowColor)
|
||||
PUSH_CONSTANT(float2, uvRotX)
|
||||
PUSH_CONSTANT(float2, uvRotY)
|
||||
PUSH_CONSTANT(float2, uvOffset)
|
||||
PUSH_CONSTANT(float2, blurDir)
|
||||
PUSH_CONSTANT(float2, waveDir)
|
||||
PUSH_CONSTANT(float2, waveOffset)
|
||||
PUSH_CONSTANT(float, wavePhase)
|
||||
PUSH_CONSTANT(int, sampCount)
|
||||
PUSH_CONSTANT(bool, isFirstPass)
|
||||
PUSH_CONSTANT(float4, shadow_color)
|
||||
PUSH_CONSTANT(float2, uv_rot_x)
|
||||
PUSH_CONSTANT(float2, uv_rot_y)
|
||||
PUSH_CONSTANT(float2, uv_offset)
|
||||
PUSH_CONSTANT(float2, blur_dir)
|
||||
PUSH_CONSTANT(float2, wave_dir)
|
||||
PUSH_CONSTANT(float2, wave_offset)
|
||||
PUSH_CONSTANT(float, wave_phase)
|
||||
PUSH_CONSTANT(int, samp_count)
|
||||
PUSH_CONSTANT(bool, is_first_pass)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -117,10 +117,10 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(gpencil_fx_pixelize)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("PIXELIZE")
|
||||
PUSH_CONSTANT(float2, targetPixelSize)
|
||||
PUSH_CONSTANT(float2, targetPixelOffset)
|
||||
PUSH_CONSTANT(float2, accumOffset)
|
||||
PUSH_CONSTANT(int, sampCount)
|
||||
PUSH_CONSTANT(float2, target_pixel_size)
|
||||
PUSH_CONSTANT(float2, target_pixel_offset)
|
||||
PUSH_CONSTANT(float2, accum_offset)
|
||||
PUSH_CONSTANT(int, samp_count)
|
||||
ADDITIONAL_INFO(gpencil_fx_common)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -72,10 +72,10 @@ class AntiAliasing : Overlay {
|
||||
pass.shader_set(res.shaders->anti_aliasing.get());
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.bind_texture("depthTex", &res.depth_tx);
|
||||
pass.bind_texture("colorTex", &res.overlay_tx);
|
||||
pass.bind_texture("lineTex", &res.line_tx);
|
||||
pass.push_constant("doSmoothLines", do_smooth_lines);
|
||||
pass.bind_texture("depth_tx", &res.depth_tx);
|
||||
pass.bind_texture("color_tx", &res.overlay_tx);
|
||||
pass.bind_texture("line_tx", &res.line_tx);
|
||||
pass.push_constant("do_smooth_lines", do_smooth_lines);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ class Armatures : Overlay {
|
||||
sub.state_set(transparent_state | DRW_STATE_CULL_FRONT, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_envelope_fill.get());
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
sub.push_constant("isDistance", true);
|
||||
sub.push_constant("is_distance", true);
|
||||
opaque_.envelope_distance = ⊂
|
||||
}
|
||||
if (use_wire_alpha) {
|
||||
@@ -186,7 +186,7 @@ class Armatures : Overlay {
|
||||
sub.state_set(transparent_state | DRW_STATE_CULL_FRONT, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_envelope_fill.get());
|
||||
sub.push_constant("alpha", wire_alpha);
|
||||
sub.push_constant("isDistance", true);
|
||||
sub.push_constant("is_distance", true);
|
||||
transparent_.envelope_distance = ⊂
|
||||
}
|
||||
else {
|
||||
@@ -278,7 +278,7 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.shape_outline");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_shape_outline.get());
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.bind_texture("depth_tx", depth_tex);
|
||||
sub.push_constant("alpha", wire_alpha * 0.6f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
transparent_.shape_outline = ⊂
|
||||
@@ -300,7 +300,7 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.shape_wire");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_shape_wire.get());
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.bind_texture("depth_tx", depth_tex);
|
||||
sub.push_constant("alpha", wire_alpha * 0.6f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
sub.push_constant("use_arrow_drawing", false);
|
||||
@@ -323,7 +323,7 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("transparent.shape_wire_strip");
|
||||
sub.state_set(default_state | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_shape_wire_strip.get());
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.bind_texture("depth_tx", depth_tex);
|
||||
sub.push_constant("alpha", wire_alpha * 0.6f);
|
||||
sub.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
sub.push_constant("use_arrow_drawing", false);
|
||||
@@ -376,7 +376,7 @@ class Armatures : Overlay {
|
||||
auto &sub = armature_ps_.sub("opaque.envelope_fill");
|
||||
sub.state_set(default_state | DRW_STATE_CULL_BACK, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->armature_envelope_fill.get());
|
||||
sub.push_constant("isDistance", false);
|
||||
sub.push_constant("is_distance", false);
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
opaque_.envelope_fill = ⊂
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ class Background : Overlay {
|
||||
bg_ps_.shader_set(res.shaders->background_fill.get());
|
||||
bg_ps_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
bg_ps_.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
bg_ps_.bind_texture("colorBuffer", &res.color_render_tx);
|
||||
bg_ps_.bind_texture("depthBuffer", &res.depth_tx);
|
||||
bg_ps_.push_constant("colorOverride", color_override);
|
||||
bg_ps_.push_constant("bgType", background_type);
|
||||
bg_ps_.bind_texture("color_buffer", &res.color_render_tx);
|
||||
bg_ps_.bind_texture("depth_buffer", &res.depth_tx);
|
||||
bg_ps_.push_constant("color_override", color_override);
|
||||
bg_ps_.push_constant("bg_type", background_type);
|
||||
bg_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -603,11 +603,11 @@ class Cameras : Overlay {
|
||||
PassMain &pass = is_foreground ?
|
||||
(use_view_transform ? foreground_scene_ps_ : foreground_ps_) :
|
||||
(use_view_transform ? background_scene_ps_ : background_ps_);
|
||||
pass.bind_texture("imgTexture", tex);
|
||||
pass.push_constant("imgPremultiplied", use_alpha_premult);
|
||||
pass.push_constant("imgAlphaBlend", true);
|
||||
pass.push_constant("isCameraBackground", true);
|
||||
pass.push_constant("depthSet", true);
|
||||
pass.bind_texture("img_tx", tex);
|
||||
pass.push_constant("img_premultiplied", use_alpha_premult);
|
||||
pass.push_constant("img_alpha_blend", true);
|
||||
pass.push_constant("is_camera_background", true);
|
||||
pass.push_constant("depth_set", true);
|
||||
pass.push_constant("ucolor", color_premult_alpha);
|
||||
ResourceHandle res_handle = manager.resource_handle(mat);
|
||||
pass.draw(res.shapes.quad_solid.get(), res_handle, select_id.get());
|
||||
|
||||
@@ -69,16 +69,16 @@ class Curves : Overlay {
|
||||
DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->curve_edit_line.get());
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
sub.bind_texture("weight_tx", &res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", false);
|
||||
sub.push_constant("use_grease_pencil", false);
|
||||
edit_curves_lines_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Handles");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->curve_edit_handles.get());
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("curve_handle_display", int(state.overlay.handle_display));
|
||||
edit_curves_handles_ = ⊂
|
||||
}
|
||||
{
|
||||
@@ -87,11 +87,11 @@ class Curves : Overlay {
|
||||
DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->curve_edit_points.get());
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
sub.push_constant("doStrokeEndpoints", false);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.bind_texture("weight_tx", &res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", false);
|
||||
sub.push_constant("use_grease_pencil", false);
|
||||
sub.push_constant("do_stroke_endpoints", false);
|
||||
sub.push_constant("curve_handle_display", int(state.overlay.handle_display));
|
||||
edit_curves_points_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ class Curves : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->legacy_curve_edit_wires.get());
|
||||
sub.push_constant("normalSize", 0.0f);
|
||||
sub.push_constant("normal_size", 0.0f);
|
||||
edit_legacy_curve_wires_ = ⊂
|
||||
}
|
||||
if (show_normals) {
|
||||
@@ -118,7 +118,7 @@ class Curves : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->legacy_curve_edit_normals.get());
|
||||
sub.push_constant("normalSize", state.overlay.normals_length);
|
||||
sub.push_constant("normal_size", state.overlay.normals_length);
|
||||
sub.push_constant("use_hq_normals", use_hq_normals);
|
||||
edit_legacy_curve_normals_ = ⊂
|
||||
}
|
||||
@@ -129,8 +129,8 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub("Handles");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->legacy_curve_edit_handles.get());
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("show_curve_handles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curve_handle_display", int(state.overlay.handle_display));
|
||||
sub.push_constant("alpha", 1.0f);
|
||||
edit_legacy_curve_handles_ = ⊂
|
||||
}
|
||||
@@ -139,10 +139,10 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub("Points");
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->legacy_curve_edit_points.get());
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
sub.push_constant("doStrokeEndpoints", false);
|
||||
sub.push_constant("show_curve_handles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curve_handle_display", int(state.overlay.handle_display));
|
||||
sub.push_constant("use_grease_pencil", false);
|
||||
sub.push_constant("do_stroke_endpoints", false);
|
||||
edit_legacy_curve_points_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -157,8 +157,8 @@ class Curves : Overlay {
|
||||
auto &sub = pass.sub(name);
|
||||
sub.state_set(drw_state, state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->legacy_curve_edit_handles.get());
|
||||
sub.push_constant("showCurveHandles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curveHandleDisplay", int(state.overlay.handle_display));
|
||||
sub.push_constant("show_curve_handles", state.overlay.handle_display != CURVE_HANDLE_NONE);
|
||||
sub.push_constant("curve_handle_display", int(state.overlay.handle_display));
|
||||
sub.push_constant("alpha", alpha);
|
||||
return ⊂
|
||||
};
|
||||
|
||||
@@ -316,11 +316,11 @@ class Empties : Overlay {
|
||||
char depth_mode = state.is_depth_only_drawing ? char(OB_EMPTY_IMAGE_DEPTH_DEFAULT) :
|
||||
ob->empty_image_depth;
|
||||
PassMain::Sub &pass = create_subpass(state, *ob, use_alpha_blend, mat, res);
|
||||
pass.bind_texture("imgTexture", tex);
|
||||
pass.push_constant("imgPremultiplied", use_alpha_premult);
|
||||
pass.push_constant("imgAlphaBlend", use_alpha_blend);
|
||||
pass.push_constant("isCameraBackground", false);
|
||||
pass.push_constant("depthSet", depth_mode != OB_EMPTY_IMAGE_DEPTH_DEFAULT);
|
||||
pass.bind_texture("img_tx", tex);
|
||||
pass.push_constant("img_premultiplied", use_alpha_premult);
|
||||
pass.push_constant("img_alpha_blend", use_alpha_blend);
|
||||
pass.push_constant("is_camera_background", false);
|
||||
pass.push_constant("depth_set", depth_mode != OB_EMPTY_IMAGE_DEPTH_DEFAULT);
|
||||
pass.push_constant("ucolor", float4(ob->color));
|
||||
ResourceHandle res_handle = manager.resource_handle(mat);
|
||||
pass.draw(res.shapes.quad_solid.get(), res_handle, select_id.get());
|
||||
|
||||
@@ -161,21 +161,22 @@ class Fluids : Overlay {
|
||||
DRW_smoke_ensure_velocity(fmd);
|
||||
|
||||
PassSimple::Sub &sub = *sub_pass;
|
||||
sub.bind_texture("velocityX", fds->tex_velocity_x);
|
||||
sub.bind_texture("velocityY", fds->tex_velocity_y);
|
||||
sub.bind_texture("velocityZ", fds->tex_velocity_z);
|
||||
sub.push_constant("displaySize", fds->vector_scale);
|
||||
sub.push_constant("slicePosition", fds->slice_depth);
|
||||
sub.push_constant("cellSize", float3(fds->cell_size));
|
||||
sub.push_constant("domainOriginOffset", float3(fds->p0));
|
||||
sub.push_constant("adaptiveCellOffset", int3(fds->res_min));
|
||||
sub.push_constant("sliceAxis", slice_axis);
|
||||
sub.push_constant("scaleWithMagnitude", bool(fds->vector_scale_with_magnitude));
|
||||
sub.push_constant("isCellCentered", (fds->vector_field == FLUID_DOMAIN_VECTOR_FIELD_FORCE));
|
||||
sub.bind_texture("velocity_x", fds->tex_velocity_x);
|
||||
sub.bind_texture("velocity_y", fds->tex_velocity_y);
|
||||
sub.bind_texture("velocity_z", fds->tex_velocity_z);
|
||||
sub.push_constant("display_size", fds->vector_scale);
|
||||
sub.push_constant("slice_position", fds->slice_depth);
|
||||
sub.push_constant("cell_size", float3(fds->cell_size));
|
||||
sub.push_constant("domain_origin_offset", float3(fds->p0));
|
||||
sub.push_constant("adaptive_cell_offset", int3(fds->res_min));
|
||||
sub.push_constant("slice_axis", slice_axis);
|
||||
sub.push_constant("scale_with_magnitude", bool(fds->vector_scale_with_magnitude));
|
||||
sub.push_constant("is_cell_centered",
|
||||
(fds->vector_field == FLUID_DOMAIN_VECTOR_FIELD_FORCE));
|
||||
if (fds->vector_draw_type == VECTOR_DRAW_MAC) {
|
||||
sub.push_constant("drawMACX", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_X));
|
||||
sub.push_constant("drawMACY", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Y));
|
||||
sub.push_constant("drawMACZ", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Z));
|
||||
sub.push_constant("draw_macx", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_X));
|
||||
sub.push_constant("draw_macy", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Y));
|
||||
sub.push_constant("draw_macz", (fds->vector_draw_mac_components & VECTOR_DRAW_MAC_Z));
|
||||
}
|
||||
sub.push_constant("in_select_id", int(sel_id.get()));
|
||||
sub.draw_procedural(GPU_PRIM_LINES, 1, total_lines * 2, -1, res_handle);
|
||||
@@ -194,7 +195,7 @@ class Fluids : Overlay {
|
||||
DRW_fluid_ensure_flags(fmd);
|
||||
|
||||
sub_pass = grid_lines_flags_ps_;
|
||||
sub_pass->bind_texture("flagTexture", fds->tex_flags);
|
||||
sub_pass->bind_texture("flag_tx", fds->tex_flags);
|
||||
break;
|
||||
case FLUID_GRIDLINE_COLOR_TYPE_RANGE:
|
||||
if (fds->use_coba && (fds->coba_field != FLUID_DOMAIN_FIELD_FLAGS)) {
|
||||
@@ -202,12 +203,12 @@ class Fluids : Overlay {
|
||||
DRW_fluid_ensure_range_field(fmd);
|
||||
|
||||
sub_pass = grid_lines_range_ps_;
|
||||
sub_pass->bind_texture("flagTexture", fds->tex_flags);
|
||||
sub_pass->bind_texture("fieldTexture", fds->tex_range_field);
|
||||
sub_pass->push_constant("lowerBound", fds->gridlines_lower_bound);
|
||||
sub_pass->push_constant("upperBound", fds->gridlines_upper_bound);
|
||||
sub_pass->push_constant("rangeColor", float4(fds->gridlines_range_color));
|
||||
sub_pass->push_constant("cellFilter", int(fds->gridlines_cell_filter));
|
||||
sub_pass->bind_texture("flag_tx", fds->tex_flags);
|
||||
sub_pass->bind_texture("field_tx", fds->tex_range_field);
|
||||
sub_pass->push_constant("lower_bound", fds->gridlines_lower_bound);
|
||||
sub_pass->push_constant("upper_bound", fds->gridlines_upper_bound);
|
||||
sub_pass->push_constant("range_color", float4(fds->gridlines_range_color));
|
||||
sub_pass->push_constant("cell_filter", int(fds->gridlines_cell_filter));
|
||||
break;
|
||||
}
|
||||
/* Otherwise, fallback to none color type. */
|
||||
@@ -218,12 +219,12 @@ class Fluids : Overlay {
|
||||
}
|
||||
|
||||
PassSimple::Sub &sub = *sub_pass;
|
||||
sub.push_constant("volumeSize", int3(fds->res));
|
||||
sub.push_constant("slicePosition", fds->slice_depth);
|
||||
sub.push_constant("cellSize", float3(fds->cell_size));
|
||||
sub.push_constant("domainOriginOffset", float3(fds->p0));
|
||||
sub.push_constant("adaptiveCellOffset", int3(fds->res_min));
|
||||
sub.push_constant("sliceAxis", slice_axis);
|
||||
sub.push_constant("volume_size", int3(fds->res));
|
||||
sub.push_constant("slice_position", fds->slice_depth);
|
||||
sub.push_constant("cell_size", float3(fds->cell_size));
|
||||
sub.push_constant("domain_origin_offset", float3(fds->p0));
|
||||
sub.push_constant("adaptive_cell_offset", int3(fds->res_min));
|
||||
sub.push_constant("slice_axis", slice_axis);
|
||||
sub.push_constant("in_select_id", int(sel_id.get()));
|
||||
|
||||
BLI_assert(slice_axis != -1);
|
||||
|
||||
@@ -122,19 +122,19 @@ class GreasePencil : Overlay {
|
||||
if (show_points_) {
|
||||
auto &sub = pass.sub("Points");
|
||||
sub.shader_set(res.shaders->curve_edit_points.get());
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", true);
|
||||
sub.push_constant("doStrokeEndpoints", show_direction);
|
||||
sub.bind_texture("weight_tx", &res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", show_weight_);
|
||||
sub.push_constant("use_grease_pencil", true);
|
||||
sub.push_constant("do_stroke_endpoints", show_direction);
|
||||
edit_points_ = ⊂
|
||||
}
|
||||
|
||||
if (show_lines_) {
|
||||
auto &sub = pass.sub("Lines");
|
||||
sub.shader_set(res.shaders->curve_edit_line.get());
|
||||
sub.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", true);
|
||||
sub.bind_texture("weight_tx", &res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", show_weight_);
|
||||
sub.push_constant("use_grease_pencil", true);
|
||||
edit_lines_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -236,10 +236,10 @@ class GreasePencil : Overlay {
|
||||
|
||||
const float4x4 grid_mat = grid_matrix_get(*ob_ref.object, state.scene) * transform_mat;
|
||||
|
||||
grid_ps_.push_constant("xAxis", grid_mat.x_axis());
|
||||
grid_ps_.push_constant("yAxis", grid_mat.y_axis());
|
||||
grid_ps_.push_constant("x_axis", grid_mat.x_axis());
|
||||
grid_ps_.push_constant("y_axis", grid_mat.y_axis());
|
||||
grid_ps_.push_constant("origin", grid_mat.location());
|
||||
grid_ps_.push_constant("halfLineCount", line_count / 2);
|
||||
grid_ps_.push_constant("half_line_count", line_count / 2);
|
||||
grid_ps_.draw_procedural(GPU_PRIM_LINES, 1, line_count * 2);
|
||||
}
|
||||
}
|
||||
@@ -293,7 +293,7 @@ class GreasePencil : Overlay {
|
||||
const bool is_stroke_order_3d = (grease_pencil.flag & GREASE_PENCIL_STROKE_ORDER_3D) != 0;
|
||||
|
||||
if (is_stroke_order_3d) {
|
||||
pass.push_constant("gpDepthPlane", float4(0.0f));
|
||||
pass.push_constant("gp_depth_plane", float4(0.0f));
|
||||
}
|
||||
else {
|
||||
int64_t index = res.depth_planes.append_and_get_index({});
|
||||
@@ -303,7 +303,7 @@ class GreasePencil : Overlay {
|
||||
plane.bounds = BKE_object_boundbox_get(ob).value_or(blender::Bounds(float3(0)));
|
||||
plane.handle = res_handle;
|
||||
|
||||
pass.push_constant("gpDepthPlane", &plane.plane);
|
||||
pass.push_constant("gp_depth_plane", &plane.plane);
|
||||
}
|
||||
|
||||
int t_offset = 0;
|
||||
@@ -313,7 +313,7 @@ class GreasePencil : Overlay {
|
||||
gpu::VertBuf *position_tx = draw::DRW_cache_grease_pencil_position_buffer_get(scene, ob);
|
||||
gpu::VertBuf *color_tx = draw::DRW_cache_grease_pencil_color_buffer_get(scene, ob);
|
||||
|
||||
pass.push_constant("gpStrokeOrder3d", is_stroke_order_3d);
|
||||
pass.push_constant("gp_stroke_order3d", is_stroke_order_3d);
|
||||
pass.bind_texture("gp_pos_tx", position_tx);
|
||||
pass.bind_texture("gp_col_tx", color_tx);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class Grid : Overlay {
|
||||
res.theme_settings.color_background, res.theme_settings.color_grid, 0.5);
|
||||
sub.push_constant("ucolor", color_back);
|
||||
sub.push_constant("tile_scale", float3(data_.size));
|
||||
sub.bind_texture("depthBuffer", depth_tx);
|
||||
sub.bind_texture("depth_buffer", depth_tx);
|
||||
sub.draw(res.shapes.quad_solid.get());
|
||||
}
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ class Lattices : Overlay {
|
||||
PassMain::Sub &sub_pass = ps_.sub(name);
|
||||
sub_pass.shader_set(shader);
|
||||
if (add_weight_tex) {
|
||||
sub_pass.bind_texture("weightTex", &res.weight_ramp_tx);
|
||||
sub_pass.bind_texture("weight_tx", &res.weight_ramp_tx);
|
||||
}
|
||||
return &sub_pass;
|
||||
};
|
||||
|
||||
@@ -66,8 +66,8 @@ class LightProbes : Overlay {
|
||||
ps_dots_.shader_set(res.shaders->extra_grid.get());
|
||||
ps_dots_.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
ps_dots_.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
ps_dots_.bind_texture("depthBuffer", &res.depth_tx);
|
||||
ps_dots_.push_constant("isTransform", (G.moving & G_TRANSFORM_OBJ) != 0);
|
||||
ps_dots_.bind_texture("depth_buffer", &res.depth_tx);
|
||||
ps_dots_.push_constant("is_transform", (G.moving & G_TRANSFORM_OBJ) != 0);
|
||||
res.select_bind(ps_dots_);
|
||||
}
|
||||
|
||||
@@ -157,7 +157,7 @@ class LightProbes : Overlay {
|
||||
|
||||
const uint cell_count = prb.grid_resolution_x * prb.grid_resolution_y *
|
||||
prb.grid_resolution_z;
|
||||
ps_dots_.push_constant("gridModelMatrix", matrix);
|
||||
ps_dots_.push_constant("grid_model_matrix", matrix);
|
||||
ps_dots_.draw_procedural(GPU_PRIM_POINTS, 1, cell_count, 0, {0}, select_id.get());
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -141,7 +141,7 @@ class Meshes : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL | face_culling,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders->mesh_edit_depth.get());
|
||||
pass.push_constant("retopologyOffset", retopology_offset);
|
||||
pass.push_constant("retopology_offset", retopology_offset);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
}
|
||||
@@ -166,12 +166,12 @@ class Meshes : Overlay {
|
||||
auto shader_pass = [&](GPUShader *shader, const char *name) {
|
||||
auto &sub = pass.sub(name);
|
||||
sub.shader_set(shader);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.bind_texture("depth_tx", depth_tex);
|
||||
sub.push_constant("alpha", backwire_opacity);
|
||||
sub.push_constant("isConstantScreenSizeNormals", use_screen_size);
|
||||
sub.push_constant("normalSize", state.overlay.normals_length);
|
||||
sub.push_constant("normalScreenSize", state.overlay.normals_constant_screen_size);
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("is_constant_screen_size_normals", use_screen_size);
|
||||
sub.push_constant("normal_size", state.overlay.normals_length);
|
||||
sub.push_constant("normal_screen_size", state.overlay.normals_constant_screen_size);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
sub.push_constant("hq_normals", use_hq_normals);
|
||||
return ⊂
|
||||
};
|
||||
@@ -205,7 +205,7 @@ class Meshes : Overlay {
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.bind_texture("colorramp", &res.weight_ramp_tx);
|
||||
pass.push_constant("drawContours", false);
|
||||
pass.push_constant("draw_contours", false);
|
||||
pass.push_constant("opacity", state.overlay.weight_paint_mode_opacity);
|
||||
if (!shadeless) {
|
||||
/* Arbitrary light to give a hint of the geometry behind the weights. */
|
||||
@@ -218,20 +218,20 @@ class Meshes : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_ALPHA,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders->mesh_analysis.get());
|
||||
pass.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
pass.bind_texture("weight_tx", res.weight_ramp_tx);
|
||||
}
|
||||
|
||||
auto mesh_edit_common_resource_bind = [&](PassSimple &pass, float alpha, float ndc_offset) {
|
||||
pass.bind_texture("depthTex", depth_tex);
|
||||
pass.bind_texture("depth_tx", depth_tex);
|
||||
/* TODO(fclem): UBO. */
|
||||
pass.push_constant("wireShading", is_wire_shading_mode);
|
||||
pass.push_constant("selectFace", select_face_);
|
||||
pass.push_constant("selectEdge", select_edge_);
|
||||
pass.push_constant("wire_shading", is_wire_shading_mode);
|
||||
pass.push_constant("select_face", select_face_);
|
||||
pass.push_constant("select_edge", select_edge_);
|
||||
pass.push_constant("alpha", alpha);
|
||||
pass.push_constant("retopologyOffset", retopology_offset);
|
||||
pass.push_constant("retopology_offset", retopology_offset);
|
||||
pass.push_constant("ndc_offset_factor", &state.ndc_offset_factor);
|
||||
pass.push_constant("ndc_offset", ndc_offset);
|
||||
pass.push_constant("dataMask", int4(data_mask));
|
||||
pass.push_constant("data_mask", int4(data_mask));
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
};
|
||||
@@ -290,7 +290,7 @@ class Meshes : Overlay {
|
||||
DRW_STATE_WRITE_DEPTH,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders->mesh_edit_skin_root.get());
|
||||
pass.push_constant("retopologyOffset", retopology_offset);
|
||||
pass.push_constant("retopology_offset", retopology_offset);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
}
|
||||
@@ -656,7 +656,7 @@ class MeshUVs : Overlay {
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("alpha", space_image->uv_opacity);
|
||||
pass.push_constant("doSmoothWire", do_smooth_wire);
|
||||
pass.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
}
|
||||
|
||||
if (show_uv_edit) {
|
||||
@@ -670,10 +670,10 @@ class MeshUVs : Overlay {
|
||||
pass.shader_set(sh);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("lineStyle", int(edit_uv_line_style_from_space_image(space_image)));
|
||||
pass.push_constant("line_style", int(edit_uv_line_style_from_space_image(space_image)));
|
||||
pass.push_constant("alpha", space_image->uv_opacity);
|
||||
pass.push_constant("dashLength", dash_length);
|
||||
pass.push_constant("doSmoothWire", do_smooth_wire);
|
||||
pass.push_constant("dash_length", dash_length);
|
||||
pass.push_constant("do_smooth_wire", do_smooth_wire);
|
||||
}
|
||||
|
||||
if (show_vert_) {
|
||||
@@ -689,8 +689,8 @@ class MeshUVs : Overlay {
|
||||
pass.shader_set(res.shaders->uv_edit_vert.get());
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("pointSize", (point_size + 1.5f) * float(M_SQRT2));
|
||||
pass.push_constant("outlineWidth", 0.75f);
|
||||
pass.push_constant("dot_size", (point_size + 1.5f) * float(M_SQRT2));
|
||||
pass.push_constant("outline_width", 0.75f);
|
||||
pass.push_constant("color", theme_color);
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ class MeshUVs : Overlay {
|
||||
pass.shader_set(res.shaders->uv_edit_facedot.get());
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("pointSize", point_size);
|
||||
pass.push_constant("point_size", point_size);
|
||||
}
|
||||
|
||||
if (show_face_) {
|
||||
@@ -718,7 +718,7 @@ class MeshUVs : Overlay {
|
||||
pass.shader_set(res.shaders->uv_edit_face.get());
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("uvOpacity", opacity);
|
||||
pass.push_constant("uv_opacity", opacity);
|
||||
}
|
||||
|
||||
if (show_mesh_analysis_) {
|
||||
@@ -732,7 +732,7 @@ class MeshUVs : Overlay {
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.push_constant("aspect", state.image_uv_aspect);
|
||||
pass.push_constant("stretch_opacity", space_image->stretch_opacity);
|
||||
pass.push_constant("totalAreaRatio", &total_area_ratio_);
|
||||
pass.push_constant("total_area_ratio", &total_area_ratio_);
|
||||
}
|
||||
|
||||
per_mesh_area_3d_.clear();
|
||||
@@ -938,9 +938,9 @@ class MeshUVs : Overlay {
|
||||
BKE_image_get_size_fl(image, nullptr, &size_image[0]);
|
||||
|
||||
pass.shader_set(res.shaders->uv_brush_stencil.get());
|
||||
pass.bind_texture("imgTexture", stencil_texture);
|
||||
pass.push_constant("imgPremultiplied", true);
|
||||
pass.push_constant("imgAlphaBlend", true);
|
||||
pass.bind_texture("img_tx", stencil_texture);
|
||||
pass.push_constant("img_premultiplied", true);
|
||||
pass.push_constant("img_alpha_blend", true);
|
||||
pass.push_constant("ucolor", float4(1.0f, 1.0f, 1.0f, image_paint_settings.clone_alpha));
|
||||
pass.push_constant("brush_offset", float2(image_paint_settings.clone_offset));
|
||||
pass.push_constant("brush_scale", float2(stencil_texture.size().xy()) / size_image);
|
||||
@@ -959,7 +959,7 @@ class MeshUVs : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_ALWAYS |
|
||||
(is_combined ? DRW_STATE_BLEND_MUL : DRW_STATE_BLEND_ALPHA));
|
||||
pass.shader_set(res.shaders->uv_paint_mask.get());
|
||||
pass.bind_texture("imgTexture", mask_texture_);
|
||||
pass.bind_texture("img_tx", mask_texture_);
|
||||
pass.push_constant("color", float4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
pass.push_constant("opacity", opacity);
|
||||
pass.push_constant("brush_offset", float2(0.0f));
|
||||
|
||||
@@ -163,11 +163,11 @@ class MotionPath : Overlay {
|
||||
current_frame, int(frame_range.start()), int(frame_range.last()), mpath->start_frame);
|
||||
|
||||
auto &sub = *line_ps_;
|
||||
sub.push_constant("mpathLineSettings", motion_path_settings);
|
||||
sub.push_constant("lineThickness", mpath->line_thickness);
|
||||
sub.push_constant("mpath_line_settings", motion_path_settings);
|
||||
sub.push_constant("line_thickness", mpath->line_thickness);
|
||||
sub.push_constant("selected", selected);
|
||||
sub.push_constant("customColorPre", color_pre);
|
||||
sub.push_constant("customColorPost", color_post);
|
||||
sub.push_constant("custom_color_pre", color_pre);
|
||||
sub.push_constant("custom_color_post", color_post);
|
||||
sub.push_constant("camera_space_matrix",
|
||||
camera_eval ? camera_eval->object_to_world() : float4x4::identity());
|
||||
|
||||
@@ -182,10 +182,10 @@ class MotionPath : Overlay {
|
||||
const int4 motion_path_settings = {pt_size, current_frame, mpath->start_frame, stride};
|
||||
|
||||
auto &sub = *vert_ps_;
|
||||
sub.push_constant("mpathPointSettings", motion_path_settings);
|
||||
sub.push_constant("showKeyFrames", show_keyframes);
|
||||
sub.push_constant("customColorPre", color_pre);
|
||||
sub.push_constant("customColorPost", color_post);
|
||||
sub.push_constant("mpath_point_settings", motion_path_settings);
|
||||
sub.push_constant("show_key_frames", show_keyframes);
|
||||
sub.push_constant("custom_color_pre", color_pre);
|
||||
sub.push_constant("custom_color_post", color_post);
|
||||
sub.push_constant("camera_space_matrix",
|
||||
camera_eval ? camera_eval->object_to_world() : float4x4::identity());
|
||||
|
||||
|
||||
@@ -72,37 +72,37 @@ class Outline : Overlay {
|
||||
{
|
||||
auto &sub = pass.sub("Curves");
|
||||
sub.shader_set(res.shaders->outline_prepass_curves.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_curves_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("PointCloud");
|
||||
sub.shader_set(res.shaders->outline_prepass_pointcloud.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_pointcloud_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("GreasePencil");
|
||||
sub.shader_set(res.shaders->outline_prepass_gpencil.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_gpencil_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Mesh");
|
||||
sub.shader_set(res.shaders->outline_prepass_mesh.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_mesh_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Volume");
|
||||
sub.shader_set(res.shaders->outline_prepass_mesh.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_volume_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Wire");
|
||||
sub.shader_set(res.shaders->outline_prepass_wire.get());
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
prepass_wire_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -112,13 +112,13 @@ class Outline : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL);
|
||||
pass.shader_set(res.shaders->outline_detect.get());
|
||||
/* Don't occlude the outline if in xray mode as it causes too much flickering. */
|
||||
pass.push_constant("alphaOcclu", state.xray_enabled ? 1.0f : 0.35f);
|
||||
pass.push_constant("doThickOutlines", do_expand);
|
||||
pass.push_constant("doAntiAliasing", do_smooth_lines);
|
||||
pass.push_constant("isXrayWires", state.xray_enabled_and_not_wire);
|
||||
pass.bind_texture("outlineId", &object_id_tx_);
|
||||
pass.bind_texture("sceneDepth", &res.depth_tx);
|
||||
pass.bind_texture("outlineDepth", &tmp_depth_tx_);
|
||||
pass.push_constant("alpha_occlu", state.xray_enabled ? 1.0f : 0.35f);
|
||||
pass.push_constant("do_thick_outlines", do_expand);
|
||||
pass.push_constant("do_anti_aliasing", do_smooth_lines);
|
||||
pass.push_constant("is_xray_wires", state.xray_enabled_and_not_wire);
|
||||
pass.bind_texture("outline_id_tx", &object_id_tx_);
|
||||
pass.bind_texture("scene_depth_tx", &res.depth_tx);
|
||||
pass.bind_texture("outline_depth_tx", &tmp_depth_tx_);
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
@@ -206,7 +206,7 @@ class Outline : Overlay {
|
||||
pass.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL,
|
||||
state.clipping_plane_count);
|
||||
pass.shader_set(res.shaders->outline_prepass_wire.get());
|
||||
pass.push_constant("isTransform", is_transform);
|
||||
pass.push_constant("is_transform", is_transform);
|
||||
|
||||
for (FlatObjectRef flag_ob_ref : flat_objects_) {
|
||||
flag_ob_ref.if_flat_axis_orthogonal_to_view(
|
||||
|
||||
@@ -116,7 +116,7 @@ class Paints : Overlay {
|
||||
sub.shader_set(shadeless ? res.shaders->paint_weight.get() :
|
||||
res.shaders->paint_weight_fake_shading.get());
|
||||
sub.bind_texture("colorramp", &res.weight_ramp_tx);
|
||||
sub.push_constant("drawContours", draw_contours);
|
||||
sub.push_constant("draw_contours", draw_contours);
|
||||
sub.push_constant("opacity", state.overlay.weight_paint_mode_opacity);
|
||||
if (!shadeless) {
|
||||
/* Arbitrary light to give a hint of the geometry behind the weights. */
|
||||
@@ -147,10 +147,10 @@ class Paints : Overlay {
|
||||
pass.shader_set(res.shaders->paint_texture.get());
|
||||
pass.bind_ubo(OVERLAY_GLOBALS_SLOT, &res.globals_buf);
|
||||
pass.bind_ubo(DRW_CLIPPING_UBO_SLOT, &res.clip_planes_buf);
|
||||
pass.bind_texture("maskImage", mask_texture);
|
||||
pass.bind_texture("mask_image", mask_texture);
|
||||
pass.push_constant("maskPremult", mask_premult);
|
||||
pass.push_constant("maskInvertStencil", mask_inverted);
|
||||
pass.push_constant("maskColor", float3(paint_settings.stencil_col));
|
||||
pass.push_constant("mask_invert_stencil", mask_inverted);
|
||||
pass.push_constant("mask_color", float3(paint_settings.stencil_col));
|
||||
pass.push_constant("opacity", state.overlay.texture_paint_mode_opacity);
|
||||
}
|
||||
}
|
||||
@@ -234,7 +234,7 @@ class Paints : Overlay {
|
||||
|
||||
if ((use_face_selection || show_wires_) && !in_texture_paint_mode) {
|
||||
gpu::Batch *geom = DRW_cache_mesh_surface_edges_get(ob_ref.object);
|
||||
paint_region_edge_ps_->push_constant("useSelect", use_face_selection);
|
||||
paint_region_edge_ps_->push_constant("use_select", use_face_selection);
|
||||
paint_region_edge_ps_->draw(geom, manager.unique_handle(ob_ref));
|
||||
}
|
||||
if (use_face_selection) {
|
||||
|
||||
@@ -69,20 +69,20 @@ class Particles : Overlay {
|
||||
{
|
||||
auto &sub = pass.sub("Dots");
|
||||
sub.shader_set(res.shaders->particle_dot.get());
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.bind_texture("weight_tx", res.weight_ramp_tx);
|
||||
dot_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Shapes");
|
||||
sub.shader_set(res.shaders->particle_shape.get());
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.bind_texture("weight_tx", res.weight_ramp_tx);
|
||||
shape_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Hair");
|
||||
sub.shader_set(res.shaders->particle_hair.get());
|
||||
sub.push_constant("colorType", state.v3d->shading.wire_color_type);
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("color_type", state.v3d->shading.wire_color_type);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
hair_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -98,17 +98,17 @@ class Particles : Overlay {
|
||||
{
|
||||
auto &sub = pass.sub("Dots");
|
||||
sub.shader_set(res.shaders->particle_edit_vert.get());
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", show_weight_);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
sub.bind_texture("weight_tx", res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", show_weight_);
|
||||
sub.push_constant("use_grease_pencil", false);
|
||||
edit_vert_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
auto &sub = pass.sub("Edges");
|
||||
sub.shader_set(res.shaders->particle_edit_edge.get());
|
||||
sub.bind_texture("weightTex", res.weight_ramp_tx);
|
||||
sub.push_constant("useWeight", false);
|
||||
sub.push_constant("useGreasePencil", false);
|
||||
sub.bind_texture("weight_tx", res.weight_ramp_tx);
|
||||
sub.push_constant("use_weight", false);
|
||||
sub.push_constant("use_grease_pencil", false);
|
||||
edit_edge_ps_ = ⊂
|
||||
}
|
||||
}
|
||||
@@ -240,7 +240,7 @@ class Particles : Overlay {
|
||||
break;
|
||||
}
|
||||
geom = DRW_cache_particles_get_hair(ob, psys, nullptr);
|
||||
hair_ps_->push_constant("useColoring", true); /* TODO */
|
||||
hair_ps_->push_constant("use_coloring", true); /* TODO */
|
||||
hair_ps_->draw(geom, handle, res.select_id(ob_ref).get());
|
||||
break;
|
||||
case PART_DRAW_NOT:
|
||||
|
||||
@@ -76,8 +76,8 @@ class Sculpts : Overlay {
|
||||
sub.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS_EQUAL | DRW_STATE_BLEND_MUL,
|
||||
state.clipping_plane_count);
|
||||
sub.shader_set(res.shaders->sculpt_mesh.get());
|
||||
sub.push_constant("maskOpacity", mask_opacity);
|
||||
sub.push_constant("faceSetsOpacity", face_set_opacity);
|
||||
sub.push_constant("mask_opacity", mask_opacity);
|
||||
sub.push_constant("face_sets_opacity", face_set_opacity);
|
||||
mesh_ps_ = ⊂
|
||||
}
|
||||
{
|
||||
|
||||
@@ -87,14 +87,14 @@ class Wireframe : Overlay {
|
||||
sub.specialize_constant(shader, "use_custom_depth_bias", do_smooth_lines);
|
||||
}
|
||||
sub.shader_set(shader);
|
||||
sub.bind_texture("depthTex", depth_tex);
|
||||
sub.push_constant("wireOpacity", state.overlay.wireframe_opacity);
|
||||
sub.push_constant("isTransform", is_transform);
|
||||
sub.push_constant("colorType", state.v3d->shading.wire_color_type);
|
||||
sub.push_constant("useColoring", use_coloring);
|
||||
sub.push_constant("wireStepParam", wire_threshold);
|
||||
sub.bind_texture("depth_tx", depth_tex);
|
||||
sub.push_constant("wire_opacity", state.overlay.wireframe_opacity);
|
||||
sub.push_constant("is_transform", is_transform);
|
||||
sub.push_constant("color_type", state.v3d->shading.wire_color_type);
|
||||
sub.push_constant("use_coloring", use_coloring);
|
||||
sub.push_constant("wire_step_param", wire_threshold);
|
||||
sub.push_constant("ndc_offset_factor", &state.ndc_offset_factor);
|
||||
sub.push_constant("isHair", false);
|
||||
sub.push_constant("is_hair", false);
|
||||
return ⊂
|
||||
};
|
||||
|
||||
|
||||
@@ -38,10 +38,10 @@ class XrayFade : Overlay {
|
||||
pass.shader_set(res.shaders->xray_fade.get());
|
||||
/* TODO(fclem): Confusing. The meaning of xray depth texture changed between legacy engine
|
||||
* and overlay next. To be renamed after shaders are not shared anymore. */
|
||||
pass.bind_texture("depthTex", &res.xray_depth_tx);
|
||||
pass.bind_texture("depthTexInfront", &res.xray_depth_in_front_tx);
|
||||
pass.bind_texture("xrayDepthTex", &res.depth_tx);
|
||||
pass.bind_texture("xrayDepthTexInfront", &res.depth_in_front_tx);
|
||||
pass.bind_texture("depth_tx", &res.xray_depth_tx);
|
||||
pass.bind_texture("depth_txInfront", &res.xray_depth_in_front_tx);
|
||||
pass.bind_texture("xray_depth_tx", &res.depth_tx);
|
||||
pass.bind_texture("xray_depth_txInfront", &res.depth_in_front_tx);
|
||||
pass.push_constant("opacity", 1.0f - state.xray_opacity);
|
||||
pass.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_antialiasing)
|
||||
DO_STATIC_COMPILATION()
|
||||
SAMPLER(0, DEPTH_2D, depthTex)
|
||||
SAMPLER(1, FLOAT_2D, colorTex)
|
||||
SAMPLER(2, FLOAT_2D, lineTex)
|
||||
PUSH_CONSTANT(bool, doSmoothLines)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, DEPTH_2D, depth_tx)
|
||||
SAMPLER(1, FLOAT_2D, color_tx)
|
||||
SAMPLER(2, FLOAT_2D, line_tx)
|
||||
PUSH_CONSTANT(bool, do_smooth_lines)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("overlay_antialiasing_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
@@ -25,12 +25,12 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_xray_fade)
|
||||
DO_STATIC_COMPILATION()
|
||||
SAMPLER(0, DEPTH_2D, depthTex)
|
||||
SAMPLER(1, DEPTH_2D, xrayDepthTex)
|
||||
SAMPLER(0, DEPTH_2D, depth_tx)
|
||||
SAMPLER(1, DEPTH_2D, xray_depth_tx)
|
||||
PUSH_CONSTANT(float, opacity)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("overlay_xray_fade_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
SAMPLER(2, DEPTH_2D, xrayDepthTexInfront)
|
||||
SAMPLER(3, DEPTH_2D, depthTexInfront)
|
||||
SAMPLER(2, DEPTH_2D, xray_depth_txInfront)
|
||||
SAMPLER(3, DEPTH_2D, depth_txInfront)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
#include "overlay_common_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_frag_output)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_wire_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float2, edgeStart)
|
||||
NO_PERSPECTIVE(float2, edgePos)
|
||||
FLAT(float4, final_color)
|
||||
FLAT(float2, edge_start)
|
||||
NO_PERSPECTIVE(float2, edge_pos)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_common)
|
||||
@@ -53,10 +53,10 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS(overlay_armature_sphere_outline)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_sphere_solid_iface)
|
||||
FLAT(float3, finalStateColor)
|
||||
FLAT(float3, finalBoneColor)
|
||||
FLAT(float4x4, sphereMatrix)
|
||||
SMOOTH(float3, viewPosition)
|
||||
FLAT(float3, final_state_color)
|
||||
FLAT(float3, final_bone_color)
|
||||
FLAT(float4x4, sphere_matrix)
|
||||
SMOOTH(float3, view_position)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_sphere_solid)
|
||||
@@ -82,20 +82,10 @@ OVERLAY_INFO_VARIATIONS(overlay_armature_sphere_solid)
|
||||
/** \name Armature Shapes
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_iface, geom_in)
|
||||
SMOOTH(float4, pPos)
|
||||
SMOOTH(float3, vPos)
|
||||
SMOOTH(float2, ssPos)
|
||||
SMOOTH(float4, vColSize)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(geom_in)
|
||||
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_armature_shape_outline_flat_iface, geom_flat_in)
|
||||
FLAT(int, inverted)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(geom_flat_in)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_no_geom_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float2, edgeStart)
|
||||
NO_PERSPECTIVE(float2, edgePos)
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_outline_iface)
|
||||
FLAT(float4, final_color)
|
||||
FLAT(float2, edge_start)
|
||||
NO_PERSPECTIVE(float2, edge_pos)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_shape_outline)
|
||||
@@ -103,7 +93,7 @@ DO_STATIC_COMPILATION()
|
||||
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
|
||||
STORAGE_BUF(1, READ, float4x4, data_buf[])
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
VERTEX_OUT(overlay_armature_shape_outline_no_geom_iface)
|
||||
VERTEX_OUT(overlay_armature_shape_outline_iface)
|
||||
VERTEX_SOURCE("overlay_armature_shape_outline_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_armature_wire_frag.glsl")
|
||||
ADDITIONAL_INFO(overlay_frag_output)
|
||||
@@ -115,7 +105,7 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS(overlay_armature_shape_outline)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_solid_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
FLAT(int, inverted)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
@@ -137,9 +127,9 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS(overlay_armature_shape_solid)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_shape_wire_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
FLAT(float, wire_width)
|
||||
NO_PERSPECTIVE(float, edgeCoord)
|
||||
NO_PERSPECTIVE(float, edge_coord)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_shape_wire)
|
||||
@@ -193,9 +183,9 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS(overlay_armature_envelope_outline)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_envelope_solid_iface)
|
||||
FLAT(float3, finalStateColor)
|
||||
FLAT(float3, finalBoneColor)
|
||||
SMOOTH(float3, normalView)
|
||||
FLAT(float3, final_state_color)
|
||||
FLAT(float3, final_bone_color)
|
||||
SMOOTH(float3, view_normal)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_envelope_solid)
|
||||
@@ -203,7 +193,7 @@ DO_STATIC_COMPILATION()
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(overlay_armature_envelope_solid_iface)
|
||||
PUSH_CONSTANT(bool, isDistance)
|
||||
PUSH_CONSTANT(bool, is_distance)
|
||||
VERTEX_SOURCE("overlay_armature_envelope_solid_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_armature_envelope_solid_frag.glsl")
|
||||
ADDITIONAL_INFO(overlay_frag_output)
|
||||
@@ -221,9 +211,9 @@ OVERLAY_INFO_VARIATIONS(overlay_armature_envelope_solid)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_armature_stick_iface)
|
||||
NO_PERSPECTIVE(float, colorFac)
|
||||
FLAT(float4, finalWireColor)
|
||||
FLAT(float4, finalInnerColor)
|
||||
NO_PERSPECTIVE(float, color_fac)
|
||||
FLAT(float4, final_wire_color)
|
||||
FLAT(float4, final_inner_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_armature_stick_base)
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
GPU_SHADER_CREATE_INFO(overlay_background)
|
||||
DO_STATIC_COMPILATION()
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
SAMPLER(0, FLOAT_2D, colorBuffer)
|
||||
SAMPLER(1, DEPTH_2D, depthBuffer)
|
||||
PUSH_CONSTANT(int, bgType)
|
||||
PUSH_CONSTANT(float4, colorOverride)
|
||||
SAMPLER(0, FLOAT_2D, color_buffer)
|
||||
SAMPLER(1, DEPTH_2D, depth_buffer)
|
||||
PUSH_CONSTANT(int, bg_type)
|
||||
PUSH_CONSTANT(float4, color_override)
|
||||
FRAGMENT_SOURCE("overlay_background_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -34,7 +34,7 @@ DO_STATIC_COMPILATION()
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
PUSH_CONSTANT_ARRAY(float3, boundbox, 8)
|
||||
VERTEX_SOURCE("overlay_clipbound_vert.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
#include "overlay_common_info.hh"
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_flat_color_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_smooth_color_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_nopersp_color_iface)
|
||||
NO_PERSPECTIVE(float4, finalColor)
|
||||
NO_PERSPECTIVE(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
@@ -39,27 +39,27 @@ GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_common)
|
||||
DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a")
|
||||
SAMPLER(0, DEPTH_2D, depthTex)
|
||||
SAMPLER(0, DEPTH_2D, depth_tx)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
/* Per view factor. */
|
||||
PUSH_CONSTANT(float, ndc_offset_factor)
|
||||
/* Per pass factor. */
|
||||
PUSH_CONSTANT(float, ndc_offset)
|
||||
PUSH_CONSTANT(bool, wireShading)
|
||||
PUSH_CONSTANT(bool, selectFace)
|
||||
PUSH_CONSTANT(bool, selectEdge)
|
||||
PUSH_CONSTANT(bool, wire_shading)
|
||||
PUSH_CONSTANT(bool, select_face)
|
||||
PUSH_CONSTANT(bool, select_edge)
|
||||
PUSH_CONSTANT(float, alpha)
|
||||
PUSH_CONSTANT(float, retopologyOffset)
|
||||
PUSH_CONSTANT(int4, dataMask)
|
||||
PUSH_CONSTANT(float, retopology_offset)
|
||||
PUSH_CONSTANT(int4, data_mask)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_depth)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
PUSH_CONSTANT(float, retopologyOffset)
|
||||
PUSH_CONSTANT(float, retopology_offset)
|
||||
VERTEX_SOURCE("overlay_edit_mesh_depth_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_depth_only_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -70,8 +70,8 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_CLIP_VARIATION(overlay_edit_mesh_depth)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_vert_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float, vertexCrease)
|
||||
SMOOTH(float4, final_color)
|
||||
SMOOTH(float, vertex_crease)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_vert)
|
||||
@@ -93,14 +93,14 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_CLIP_VARIATION(overlay_edit_mesh_vert)
|
||||
|
||||
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_iface, geometry_out)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(geometry_out)
|
||||
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_flat_iface, geometry_flat_out)
|
||||
FLAT(float4, finalColorOuter)
|
||||
FLAT(float4, final_color_outer)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(geometry_flat_out)
|
||||
GPU_SHADER_NAMED_INTERFACE_INFO(overlay_edit_mesh_edge_geom_noperspective_iface,
|
||||
geometry_noperspective_out)
|
||||
NO_PERSPECTIVE(float, edgeCoord)
|
||||
NO_PERSPECTIVE(float, edge_coord)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(geometry_noperspective_out)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_edge)
|
||||
@@ -162,15 +162,15 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_edit_mesh_facedot)
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_normal)
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int2, gpu_attr_1)
|
||||
SAMPLER(0, DEPTH_2D, depthTex)
|
||||
PUSH_CONSTANT(float, normalSize)
|
||||
PUSH_CONSTANT(float, normalScreenSize)
|
||||
SAMPLER(0, DEPTH_2D, depth_tx)
|
||||
PUSH_CONSTANT(float, normal_size)
|
||||
PUSH_CONSTANT(float, normal_screen_size)
|
||||
PUSH_CONSTANT(float, alpha)
|
||||
PUSH_CONSTANT(bool, isConstantScreenSizeNormals)
|
||||
PUSH_CONSTANT(bool, is_constant_screen_size_normals)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_mesh_normal_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -265,16 +265,16 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_CLIP_VARIATION(overlay_mesh_vert_normal_subdiv)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_mesh_analysis_iface)
|
||||
SMOOTH(float4, weightColor)
|
||||
SMOOTH(float4, weight_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_analysis)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float, weight)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_OUT(overlay_edit_mesh_analysis_iface)
|
||||
VERTEX_SOURCE("overlay_edit_mesh_analysis_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_edit_mesh_analysis_frag.glsl")
|
||||
@@ -288,7 +288,7 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_edit_mesh_analysis)
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_mesh_skin_root)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_mesh_skin_root_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -308,10 +308,10 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_edit_mesh_skin_root)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_iface)
|
||||
SMOOTH(float, selectionFac)
|
||||
FLAT(float2, stippleStart)
|
||||
NO_PERSPECTIVE(float, edgeCoord)
|
||||
NO_PERSPECTIVE(float2, stipplePos)
|
||||
SMOOTH(float, selection_fac)
|
||||
FLAT(float2, stipple_start)
|
||||
NO_PERSPECTIVE(float, edge_coord)
|
||||
NO_PERSPECTIVE(float2, stipple_pos)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_edges)
|
||||
@@ -320,13 +320,13 @@ STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY)
|
||||
STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY)
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int2, gpu_attr_1)
|
||||
PUSH_CONSTANT(int, lineStyle)
|
||||
PUSH_CONSTANT(bool, doSmoothWire)
|
||||
PUSH_CONSTANT(int, line_style)
|
||||
PUSH_CONSTANT(bool, do_smooth_wire)
|
||||
PUSH_CONSTANT(float, alpha)
|
||||
PUSH_CONSTANT(float, dashLength)
|
||||
PUSH_CONSTANT(float, dash_length)
|
||||
SPECIALIZATION_CONSTANT(bool, use_edge_select, false)
|
||||
VERTEX_OUT(overlay_edit_uv_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_edit_uv_edges_frag.glsl")
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
@@ -342,9 +342,9 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_faces)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float2, au)
|
||||
VERTEX_IN(1, uint, flag)
|
||||
PUSH_CONSTANT(float, uvOpacity)
|
||||
PUSH_CONSTANT(float, uv_opacity)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_faces_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -358,9 +358,9 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_face_dots)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float2, au)
|
||||
VERTEX_IN(1, uint, flag)
|
||||
PUSH_CONSTANT(float, pointSize)
|
||||
PUSH_CONSTANT(float, dot_size)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_face_dots_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -369,8 +369,8 @@ ADDITIONAL_INFO(draw_globals)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_vert_iface)
|
||||
SMOOTH(float4, fillColor)
|
||||
SMOOTH(float4, outlineColor)
|
||||
SMOOTH(float4, fill_color)
|
||||
SMOOTH(float4, outline_color)
|
||||
SMOOTH(float4, radii)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
@@ -378,11 +378,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_verts)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float2, au)
|
||||
VERTEX_IN(1, uint, flag)
|
||||
PUSH_CONSTANT(float, pointSize)
|
||||
PUSH_CONSTANT(float, outlineWidth)
|
||||
PUSH_CONSTANT(float, dot_size)
|
||||
PUSH_CONSTANT(float, outline_width)
|
||||
PUSH_CONSTANT(float4, color)
|
||||
VERTEX_OUT(overlay_edit_uv_vert_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_verts_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_edit_uv_verts_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -394,7 +394,7 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_tiled_image_borders)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
|
||||
PUSH_CONSTANT(float3, tile_pos)
|
||||
@@ -411,11 +411,11 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(edit_uv_image_iface)
|
||||
VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl")
|
||||
SAMPLER(0, FLOAT_2D, imgTexture)
|
||||
PUSH_CONSTANT(bool, imgPremultiplied)
|
||||
PUSH_CONSTANT(bool, imgAlphaBlend)
|
||||
SAMPLER(0, FLOAT_2D, img_tx)
|
||||
PUSH_CONSTANT(bool, img_premultiplied)
|
||||
PUSH_CONSTANT(bool, img_alpha_blend)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("overlay_image_frag.glsl")
|
||||
PUSH_CONSTANT(float2, brush_offset)
|
||||
PUSH_CONSTANT(float2, brush_scale)
|
||||
@@ -426,10 +426,10 @@ GPU_SHADER_CREATE_INFO(overlay_edit_uv_mask_image)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(edit_uv_image_iface)
|
||||
SAMPLER(0, FLOAT_2D, imgTexture)
|
||||
SAMPLER(0, FLOAT_2D, img_tx)
|
||||
PUSH_CONSTANT(float4, color)
|
||||
PUSH_CONSTANT(float, opacity)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_image_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_edit_uv_image_mask_frag.glsl")
|
||||
PUSH_CONSTANT(float2, brush_offset)
|
||||
@@ -448,7 +448,7 @@ VERTEX_IN(0, float2, pos)
|
||||
PUSH_CONSTANT(float2, aspect)
|
||||
PUSH_CONSTANT(float, stretch_opacity)
|
||||
VERTEX_OUT(overlay_edit_nopersp_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_stretching_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -456,7 +456,7 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_uv_stretching_area)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(1, float, ratio)
|
||||
PUSH_CONSTANT(float, totalAreaRatio)
|
||||
PUSH_CONSTANT(float, total_area_ratio)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_modelmat)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
@@ -488,12 +488,12 @@ STORAGE_BUF_FREQ(1, READ, uint, data[], GEOMETRY)
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int2, gpu_attr_1)
|
||||
VERTEX_OUT(overlay_edit_smooth_color_iface)
|
||||
PUSH_CONSTANT(bool, showCurveHandles)
|
||||
PUSH_CONSTANT(int, curveHandleDisplay)
|
||||
PUSH_CONSTANT(bool, show_curve_handles)
|
||||
PUSH_CONSTANT(int, curve_handle_display)
|
||||
PUSH_CONSTANT(float, alpha)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_curve_handle_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -510,9 +510,9 @@ TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, uint, data)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
PUSH_CONSTANT(bool, showCurveHandles)
|
||||
PUSH_CONSTANT(int, curveHandleDisplay)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(bool, show_curve_handles)
|
||||
PUSH_CONSTANT(int, curve_handle_display)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_curve_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -528,9 +528,9 @@ VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float3, nor)
|
||||
VERTEX_IN(2, float3, tangent)
|
||||
VERTEX_IN(3, float, rad)
|
||||
PUSH_CONSTANT(float, normalSize)
|
||||
PUSH_CONSTANT(float, normal_size)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_curve_wire_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -550,10 +550,10 @@ PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int2, gpu_attr_1)
|
||||
PUSH_CONSTANT(int2, gpu_attr_2)
|
||||
PUSH_CONSTANT(int2, gpu_attr_3)
|
||||
PUSH_CONSTANT(float, normalSize)
|
||||
PUSH_CONSTANT(float, normal_size)
|
||||
PUSH_CONSTANT(bool, use_hq_normals)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_curve_normals_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -580,8 +580,8 @@ PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int2, gpu_attr_1)
|
||||
PUSH_CONSTANT(int2, gpu_attr_2)
|
||||
VERTEX_OUT(overlay_edit_smooth_color_iface)
|
||||
PUSH_CONSTANT(int, curveHandleDisplay)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(int, curve_handle_display)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_curves_handle_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -602,14 +602,14 @@ VERTEX_IN(2, float, selection)
|
||||
#if 1 /* TODO(fclem): Required for legacy gpencil overlay. To be moved to specialized shader. */
|
||||
TYPEDEF_SOURCE("gpencil_shader_shared.hh")
|
||||
VERTEX_IN(3, uint, vflag)
|
||||
PUSH_CONSTANT(bool, doStrokeEndpoints)
|
||||
PUSH_CONSTANT(bool, do_stroke_endpoints)
|
||||
#endif
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
PUSH_CONSTANT(bool, useWeight)
|
||||
PUSH_CONSTANT(bool, useGreasePencil)
|
||||
PUSH_CONSTANT(int, curveHandleDisplay)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
PUSH_CONSTANT(bool, use_weight)
|
||||
PUSH_CONSTANT(bool, use_grease_pencil)
|
||||
PUSH_CONSTANT(int, curve_handle_display)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_particle_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -630,8 +630,8 @@ VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, uint, data)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_lattice_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -643,11 +643,11 @@ OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_edit_lattice_point, overlay_edit_lattic
|
||||
GPU_SHADER_CREATE_INFO(overlay_edit_lattice_wire_base)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float, weight)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
VERTEX_OUT(overlay_edit_smooth_color_iface)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_lattice_wire_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -666,11 +666,11 @@ GPU_SHADER_CREATE_INFO(overlay_edit_particle_strand)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float, selection)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
PUSH_CONSTANT(bool, useWeight)
|
||||
PUSH_CONSTANT(bool, useGreasePencil)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
PUSH_CONSTANT(bool, use_weight)
|
||||
PUSH_CONSTANT(bool, use_grease_pencil)
|
||||
VERTEX_OUT(overlay_edit_smooth_color_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_particle_strand_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -685,15 +685,15 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float, selection)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
PUSH_CONSTANT(bool, useWeight)
|
||||
PUSH_CONSTANT(bool, useGreasePencil)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
PUSH_CONSTANT(bool, use_weight)
|
||||
PUSH_CONSTANT(bool, use_grease_pencil)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
#if 1 /* TODO(fclem): Required for legacy gpencil overlay. To be moved to specialized shader. */
|
||||
TYPEDEF_SOURCE("gpencil_shader_shared.hh")
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(3, uint, vflag)
|
||||
PUSH_CONSTANT(bool, doStrokeEndpoints)
|
||||
PUSH_CONSTANT(bool, do_stroke_endpoints)
|
||||
#endif
|
||||
VERTEX_SOURCE("overlay_edit_particle_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
@@ -714,8 +714,8 @@ GPU_SHADER_CREATE_INFO(overlay_edit_pointcloud_base)
|
||||
VERTEX_IN(0, float4, pos_rad)
|
||||
VERTEX_OUT(overlay_edit_flat_color_iface)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_pointcloud_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -772,8 +772,8 @@ VERTEX_OUT(overlay_depth_only_gpencil_noperspective_iface)
|
||||
VERTEX_SOURCE("overlay_depth_only_gpencil_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_depth_only_gpencil_frag.glsl")
|
||||
DEPTH_WRITE(DepthWrite::ANY)
|
||||
PUSH_CONSTANT(bool, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(float4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(bool, gp_stroke_order3d) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(float4, gp_depth_plane) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
ADDITIONAL_INFO(draw_gpencil)
|
||||
@@ -813,8 +813,8 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
DEFINE("LINE_OUTPUT")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_depth_only_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_extra_iface)
|
||||
NO_PERSPECTIVE(float2, edgePos)
|
||||
FLAT(float2, edgeStart)
|
||||
FLAT(float4, finalColor)
|
||||
NO_PERSPECTIVE(float2, edge_pos)
|
||||
FLAT(float2, edge_start)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_extra)
|
||||
@@ -33,8 +33,8 @@ TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, int, vclass)
|
||||
VERTEX_OUT(overlay_extra_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_extra_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -59,15 +59,15 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_extra_spot_cone)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_extra_grid_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_extra_grid_base)
|
||||
SAMPLER(0, DEPTH_2D, depthBuffer)
|
||||
PUSH_CONSTANT(float4x4, gridModelMatrix)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
SAMPLER(0, DEPTH_2D, depth_buffer)
|
||||
PUSH_CONSTANT(float4x4, grid_model_matrix)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
VERTEX_OUT(overlay_extra_grid_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_extra_lightprobe_grid_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -87,8 +87,8 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
/* Instance attributes. */
|
||||
VERTEX_OUT(overlay_extra_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_extra_groundline_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -107,13 +107,13 @@ OVERLAY_INFO_VARIATIONS(overlay_extra_groundline)
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_extra_wire_iface)
|
||||
NO_PERSPECTIVE(float2, stipple_coord)
|
||||
FLAT(float2, stipple_start)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_extra_wire_base)
|
||||
VERTEX_OUT(overlay_extra_wire_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_extra_wire_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl")
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
@@ -133,8 +133,8 @@ VERTEX_IN(1, float4, color)
|
||||
/* If colorid is equal to 0 (i.e: Not specified) use color attribute and stippling. */
|
||||
VERTEX_IN(2, int, colorid)
|
||||
VERTEX_OUT(overlay_extra_wire_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_extra_wire_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_wire_frag.glsl")
|
||||
DEFINE("OBJECT_WIRE")
|
||||
@@ -152,15 +152,15 @@ OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_extra_wire_object, overlay_extra_wire_o
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_extra_point_iface)
|
||||
FLAT(float4, radii)
|
||||
FLAT(float4, fillColor)
|
||||
FLAT(float4, outlineColor)
|
||||
FLAT(float4, fill_color)
|
||||
FLAT(float4, outline_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_extra_point_base)
|
||||
/* TODO(fclem): Move the vertex shader to Overlay engine and remove this bypass. */
|
||||
DEFINE_VALUE("blender_srgb_to_framebuffer_space(a)", "a")
|
||||
VERTEX_OUT(overlay_extra_point_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_extra_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_varying_outline_aa_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -172,13 +172,13 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_extra_point, overlay_extra_point_base)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_extra_loose_point_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_extra_loose_point_base)
|
||||
VERTEX_OUT(overlay_extra_loose_point_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_extra_loose_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_loose_point_frag.glsl")
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
@@ -203,14 +203,14 @@ GPU_SHADER_CREATE_INFO(overlay_motion_path_line)
|
||||
DO_STATIC_COMPILATION()
|
||||
STORAGE_BUF_FREQ(0, READ, float, pos[], GEOMETRY)
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
PUSH_CONSTANT(int4, mpathLineSettings)
|
||||
PUSH_CONSTANT(int4, mpath_line_settings)
|
||||
PUSH_CONSTANT(bool, selected)
|
||||
PUSH_CONSTANT(float3, customColorPre)
|
||||
PUSH_CONSTANT(float3, customColorPost)
|
||||
PUSH_CONSTANT(int, lineThickness) /* In pixels. */
|
||||
PUSH_CONSTANT(float3, custom_color_pre)
|
||||
PUSH_CONSTANT(float3, custom_color_post)
|
||||
PUSH_CONSTANT(int, line_thickness) /* In pixels. */
|
||||
PUSH_CONSTANT(float4x4, camera_space_matrix)
|
||||
VERTEX_OUT(overlay_motion_path_line_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_motion_path_line_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_motion_path_line_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -221,7 +221,7 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_CLIP_VARIATION(overlay_motion_path_line)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_motion_path_point_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_motion_path_point)
|
||||
@@ -229,13 +229,13 @@ DO_STATIC_COMPILATION()
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, int, flag)
|
||||
PUSH_CONSTANT(int4, mpathPointSettings)
|
||||
PUSH_CONSTANT(bool, showKeyFrames)
|
||||
PUSH_CONSTANT(float3, customColorPre)
|
||||
PUSH_CONSTANT(float3, customColorPost)
|
||||
PUSH_CONSTANT(int4, mpath_point_settings)
|
||||
PUSH_CONSTANT(bool, show_key_frames)
|
||||
PUSH_CONSTANT(float3, custom_color_pre)
|
||||
PUSH_CONSTANT(float3, custom_color_post)
|
||||
PUSH_CONSTANT(float4x4, camera_space_matrix)
|
||||
VERTEX_OUT(overlay_motion_path_point_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_motion_path_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -255,15 +255,15 @@ SMOOTH(float2, uvs)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_image_base)
|
||||
PUSH_CONSTANT(bool, depthSet)
|
||||
PUSH_CONSTANT(bool, isCameraBackground)
|
||||
PUSH_CONSTANT(bool, imgPremultiplied)
|
||||
PUSH_CONSTANT(bool, imgAlphaBlend)
|
||||
PUSH_CONSTANT(bool, depth_set)
|
||||
PUSH_CONSTANT(bool, is_camera_background)
|
||||
PUSH_CONSTANT(bool, img_premultiplied)
|
||||
PUSH_CONSTANT(bool, img_alpha_blend)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(overlay_image_iface)
|
||||
SAMPLER(0, FLOAT_2D, imgTexture)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, FLOAT_2D, img_tx)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_image_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_image_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -290,12 +290,12 @@ GPU_SHADER_CREATE_INFO(overlay_gpencil_canvas)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_OUT(overlay_extra_iface)
|
||||
PUSH_CONSTANT(float4, color)
|
||||
PUSH_CONSTANT(float3, xAxis)
|
||||
PUSH_CONSTANT(float3, yAxis)
|
||||
PUSH_CONSTANT(float3, x_axis)
|
||||
PUSH_CONSTANT(float3, y_axis)
|
||||
PUSH_CONSTANT(float3, origin)
|
||||
PUSH_CONSTANT(int, halfLineCount)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
PUSH_CONSTANT(int, half_line_count)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_edit_gpencil_canvas_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_mesh)
|
||||
@@ -312,18 +312,18 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_gpencil_canvas)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_particle_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_particle_dot_base)
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
PUSH_CONSTANT(float4, ucolor) /* Draw-size packed in alpha. */
|
||||
VERTEX_IN(0, float3, part_pos)
|
||||
VERTEX_IN(1, float4, part_rot)
|
||||
VERTEX_IN(2, float, part_val)
|
||||
VERTEX_OUT(overlay_particle_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_particle_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_particle_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -334,14 +334,14 @@ OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_particle_dot, overlay_particle_dot_base
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_particle_shape_base)
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
SAMPLER(0, FLOAT_1D, weightTex)
|
||||
SAMPLER(0, FLOAT_1D, weight_tx)
|
||||
PUSH_CONSTANT(float4, ucolor) /* Draw-size packed in alpha. */
|
||||
PUSH_CONSTANT(int, shape_type)
|
||||
/* Use first attribute to only bind one buffer. */
|
||||
STORAGE_BUF_FREQ(0, READ, ParticlePointData, part_pos[], GEOMETRY)
|
||||
VERTEX_OUT(overlay_extra_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_particle_shape_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -354,12 +354,12 @@ GPU_SHADER_CREATE_INFO(overlay_particle_hair_base)
|
||||
TYPEDEF_SOURCE("overlay_shader_shared.hh")
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float3, nor)
|
||||
PUSH_CONSTANT(int, colorType)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(bool, useColoring)
|
||||
PUSH_CONSTANT(int, color_type)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
PUSH_CONSTANT(bool, use_coloring)
|
||||
VERTEX_OUT(overlay_extra_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_particle_hair_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_particle_shape_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -17,7 +17,7 @@ GPU_SHADER_CREATE_INFO(overlay_facing_base)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_SOURCE("overlay_facing_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_facing_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -39,9 +39,9 @@ GPU_SHADER_CREATE_END()
|
||||
GPU_SHADER_CREATE_INFO(overlay_grid_background)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
SAMPLER(0, DEPTH_2D, depthBuffer)
|
||||
SAMPLER(0, DEPTH_2D, depth_buffer)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_grid_background_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -55,7 +55,7 @@ GPU_SHADER_CREATE_INFO(overlay_grid_image)
|
||||
DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_edit_uv_tiled_image_borders_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -32,7 +32,7 @@ FLAT(uint, ob_id)
|
||||
GPU_SHADER_NAMED_INTERFACE_END(interp)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_outline_prepass)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
VERTEX_OUT(overlay_outline_prepass_iface)
|
||||
/* Using uint because 16bit uint can contain more ids than int. */
|
||||
FRAGMENT_OUT(0, uint, out_object_id)
|
||||
@@ -96,13 +96,13 @@ GPU_SHADER_NAMED_INTERFACE_END(gp_interp_noperspective)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_outline_prepass_gpencil)
|
||||
DO_STATIC_COMPILATION()
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
VERTEX_OUT(overlay_outline_prepass_iface)
|
||||
VERTEX_OUT(overlay_outline_prepass_gpencil_flat_iface)
|
||||
VERTEX_OUT(overlay_outline_prepass_gpencil_noperspective_iface)
|
||||
VERTEX_SOURCE("overlay_outline_prepass_gpencil_vert.glsl")
|
||||
PUSH_CONSTANT(bool, gpStrokeOrder3d) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(float4, gpDepthPlane) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(bool, gp_stroke_order3d) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
PUSH_CONSTANT(float4, gp_depth_plane) /* TODO(fclem): Move to a GPencil object UBO. */
|
||||
/* Using uint because 16bit uint can contain more ids than int. */
|
||||
FRAGMENT_OUT(0, uint, out_object_id)
|
||||
FRAGMENT_SOURCE("overlay_outline_prepass_gpencil_frag.glsl")
|
||||
@@ -137,15 +137,15 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_outline_prepass_pointcloud)
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_outline_detect)
|
||||
DO_STATIC_COMPILATION()
|
||||
PUSH_CONSTANT(float, alphaOcclu)
|
||||
PUSH_CONSTANT(bool, isXrayWires)
|
||||
PUSH_CONSTANT(bool, doAntiAliasing)
|
||||
PUSH_CONSTANT(bool, doThickOutlines)
|
||||
SAMPLER(0, UINT_2D, outlineId)
|
||||
SAMPLER(1, DEPTH_2D, outlineDepth)
|
||||
SAMPLER(2, DEPTH_2D, sceneDepth)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
PUSH_CONSTANT(float, alpha_occlu)
|
||||
PUSH_CONSTANT(bool, is_xray_wires)
|
||||
PUSH_CONSTANT(bool, do_anti_aliasing)
|
||||
PUSH_CONSTANT(bool, do_thick_outlines)
|
||||
SAMPLER(0, UINT_2D, outline_id_tx)
|
||||
SAMPLER(1, DEPTH_2D, outline_depth_tx)
|
||||
SAMPLER(2, DEPTH_2D, scene_depth_tx)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
FRAGMENT_SOURCE("overlay_outline_detect_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -24,7 +24,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float4, nor) /* Select flag on the 4th component. */
|
||||
PUSH_CONSTANT(float4, ucolor)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_paint_face_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_uniform_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -43,7 +43,7 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_paint_face)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_overlay_paint_point_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_paint_point)
|
||||
@@ -51,7 +51,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float4, nor) /* Select flag on the 4th component. */
|
||||
VERTEX_OUT(overlay_overlay_paint_point_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_paint_point_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_point_varying_color_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -78,12 +78,12 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float2, mu) /* Masking uv map. */
|
||||
VERTEX_OUT(overlay_paint_texture_iface)
|
||||
SAMPLER(0, FLOAT_2D, maskImage)
|
||||
PUSH_CONSTANT(float3, maskColor)
|
||||
SAMPLER(0, FLOAT_2D, mask_image)
|
||||
PUSH_CONSTANT(float3, mask_color)
|
||||
PUSH_CONSTANT(float, opacity) /* `1.0f` by default. */
|
||||
PUSH_CONSTANT(bool, maskInvertStencil)
|
||||
PUSH_CONSTANT(bool, maskImagePremultiplied)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(bool, mask_invert_stencil)
|
||||
PUSH_CONSTANT(bool, mask_image_premultiplied)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_paint_texture_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_paint_texture_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -114,10 +114,10 @@ VERTEX_IN(1, float3, pos)
|
||||
VERTEX_IN(2, float3, nor)
|
||||
VERTEX_OUT(overlay_paint_weight_iface)
|
||||
SAMPLER(0, FLOAT_1D, colorramp)
|
||||
PUSH_CONSTANT(float, opacity) /* `1.0f` by default. */
|
||||
PUSH_CONSTANT(bool, drawContours) /* `false` by default. */
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
PUSH_CONSTANT(float, opacity) /* `1.0f` by default. */
|
||||
PUSH_CONSTANT(bool, draw_contours) /* `false` by default. */
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_SOURCE("overlay_paint_weight_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_paint_weight_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -146,7 +146,7 @@ OVERLAY_INFO_CLIP_VARIATION(overlay_paint_weight_fake_shading)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_paint_wire_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_paint_wire)
|
||||
@@ -154,8 +154,8 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float4, nor) /* flag stored in w */
|
||||
VERTEX_OUT(overlay_paint_wire_iface)
|
||||
PUSH_CONSTANT(bool, useSelect)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(bool, use_select)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_paint_wire_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -38,9 +38,9 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_CLIP_VARIATION(overlay_sculpt_curves_selection)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_sculpt_curves_cage_iface)
|
||||
NO_PERSPECTIVE(float2, edgePos)
|
||||
FLAT(float2, edgeStart)
|
||||
SMOOTH(float4, finalColor)
|
||||
NO_PERSPECTIVE(float2, edge_pos)
|
||||
FLAT(float2, edge_start)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_sculpt_curves_cage)
|
||||
@@ -48,8 +48,8 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float, selection)
|
||||
VERTEX_OUT(overlay_sculpt_curves_cage_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
PUSH_CONSTANT(float, opacity)
|
||||
VERTEX_SOURCE("overlay_sculpt_curves_cage_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_extra_frag.glsl")
|
||||
|
||||
@@ -16,20 +16,20 @@
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_sculpt_mask_iface)
|
||||
FLAT(float3, faceset_color)
|
||||
SMOOTH(float, mask_color)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_sculpt_mask)
|
||||
DO_STATIC_COMPILATION()
|
||||
PUSH_CONSTANT(float, maskOpacity)
|
||||
PUSH_CONSTANT(float, faceSetsOpacity)
|
||||
PUSH_CONSTANT(float, mask_opacity)
|
||||
PUSH_CONSTANT(float, face_sets_opacity)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float3, fset)
|
||||
VERTEX_IN(2, float, msk)
|
||||
VERTEX_OUT(overlay_sculpt_mask_iface)
|
||||
VERTEX_SOURCE("overlay_sculpt_mask_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_sculpt_mask_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_modelmat)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "overlay_common_info.hh"
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_viewer_attribute_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_viewer_attribute_common)
|
||||
@@ -33,7 +33,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_SOURCE("overlay_viewer_attribute_mesh_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, out_color)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float4, attribute_value)
|
||||
VERTEX_OUT(overlay_viewer_attribute_iface)
|
||||
@@ -50,7 +50,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_SOURCE("overlay_viewer_attribute_pointcloud_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, out_color)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
SAMPLER(3, FLOAT_BUFFER, attribute_tx)
|
||||
VERTEX_OUT(overlay_viewer_attribute_iface)
|
||||
ADDITIONAL_INFO(overlay_viewer_attribute_common)
|
||||
@@ -67,7 +67,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_SOURCE("overlay_viewer_attribute_curve_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, out_color)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float4, attribute_value)
|
||||
VERTEX_OUT(overlay_viewer_attribute_iface)
|
||||
@@ -84,7 +84,7 @@ DO_STATIC_COMPILATION()
|
||||
VERTEX_SOURCE("overlay_viewer_attribute_curves_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_viewer_attribute_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, out_color)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
SAMPLER(1, FLOAT_BUFFER, color_tx)
|
||||
PUSH_CONSTANT(bool, is_point_domain)
|
||||
VERTEX_OUT(overlay_viewer_attribute_iface)
|
||||
|
||||
@@ -22,27 +22,27 @@
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_volume_velocity_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
SMOOTH(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_volume_velocity)
|
||||
SAMPLER(0, FLOAT_3D, velocityX)
|
||||
SAMPLER(1, FLOAT_3D, velocityY)
|
||||
SAMPLER(2, FLOAT_3D, velocityZ)
|
||||
PUSH_CONSTANT(float, displaySize)
|
||||
PUSH_CONSTANT(float, slicePosition)
|
||||
PUSH_CONSTANT(int, sliceAxis)
|
||||
PUSH_CONSTANT(bool, scaleWithMagnitude)
|
||||
PUSH_CONSTANT(bool, isCellCentered)
|
||||
SAMPLER(0, FLOAT_3D, velocity_x)
|
||||
SAMPLER(1, FLOAT_3D, velocity_y)
|
||||
SAMPLER(2, FLOAT_3D, velocity_z)
|
||||
PUSH_CONSTANT(float, display_size)
|
||||
PUSH_CONSTANT(float, slice_position)
|
||||
PUSH_CONSTANT(int, slice_axis)
|
||||
PUSH_CONSTANT(bool, scale_with_magnitude)
|
||||
PUSH_CONSTANT(bool, is_cell_centered)
|
||||
/* FluidDomainSettings.cell_size */
|
||||
PUSH_CONSTANT(float3, cellSize)
|
||||
PUSH_CONSTANT(float3, cell_size)
|
||||
/* FluidDomainSettings.p0 */
|
||||
PUSH_CONSTANT(float3, domainOriginOffset)
|
||||
PUSH_CONSTANT(float3, domain_origin_offset)
|
||||
/* FluidDomainSettings.res_min */
|
||||
PUSH_CONSTANT(int3, adaptiveCellOffset)
|
||||
PUSH_CONSTANT(int3, adaptive_cell_offset)
|
||||
PUSH_CONSTANT(int, in_select_id)
|
||||
VERTEX_OUT(overlay_volume_velocity_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_volume_velocity_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -59,9 +59,9 @@ OVERLAY_INFO_SELECT_VARIATION(overlay_volume_velocity_streamline)
|
||||
GPU_SHADER_CREATE_INFO(overlay_volume_velocity_mac)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("USE_MAC")
|
||||
PUSH_CONSTANT(bool, drawMACX)
|
||||
PUSH_CONSTANT(bool, drawMACY)
|
||||
PUSH_CONSTANT(bool, drawMACZ)
|
||||
PUSH_CONSTANT(bool, draw_macx)
|
||||
PUSH_CONSTANT(bool, draw_macy)
|
||||
PUSH_CONSTANT(bool, draw_macz)
|
||||
ADDITIONAL_INFO(draw_volume)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(overlay_volume_velocity)
|
||||
@@ -86,23 +86,23 @@ OVERLAY_INFO_SELECT_VARIATION(overlay_volume_velocity_needle)
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_volume_gridlines_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, final_color)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines)
|
||||
PUSH_CONSTANT(float, slicePosition)
|
||||
PUSH_CONSTANT(int, sliceAxis)
|
||||
PUSH_CONSTANT(float, slice_position)
|
||||
PUSH_CONSTANT(int, slice_axis)
|
||||
/* FluidDomainSettings.res */
|
||||
PUSH_CONSTANT(int3, volumeSize)
|
||||
PUSH_CONSTANT(int3, volume_size)
|
||||
/* FluidDomainSettings.cell_size */
|
||||
PUSH_CONSTANT(float3, cellSize)
|
||||
PUSH_CONSTANT(float3, cell_size)
|
||||
/* FluidDomainSettings.p0 */
|
||||
PUSH_CONSTANT(float3, domainOriginOffset)
|
||||
PUSH_CONSTANT(float3, domain_origin_offset)
|
||||
/* FluidDomainSettings.res_min */
|
||||
PUSH_CONSTANT(int3, adaptiveCellOffset)
|
||||
PUSH_CONSTANT(int3, adaptive_cell_offset)
|
||||
PUSH_CONSTANT(int, in_select_id)
|
||||
VERTEX_OUT(overlay_volume_gridlines_iface)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
VERTEX_SOURCE("overlay_volume_gridlines_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_varying_color.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
@@ -119,7 +119,7 @@ OVERLAY_INFO_SELECT_VARIATION(overlay_volume_gridlines_flat)
|
||||
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_flags)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("SHOW_FLAGS")
|
||||
SAMPLER(0, UINT_3D, flagTexture)
|
||||
SAMPLER(0, UINT_3D, flag_tx)
|
||||
ADDITIONAL_INFO(draw_volume)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(overlay_volume_gridlines)
|
||||
@@ -130,12 +130,12 @@ OVERLAY_INFO_SELECT_VARIATION(overlay_volume_gridlines_flags)
|
||||
GPU_SHADER_CREATE_INFO(overlay_volume_gridlines_range)
|
||||
DO_STATIC_COMPILATION()
|
||||
DEFINE("SHOW_RANGE")
|
||||
PUSH_CONSTANT(float, lowerBound)
|
||||
PUSH_CONSTANT(float, upperBound)
|
||||
PUSH_CONSTANT(float4, rangeColor)
|
||||
PUSH_CONSTANT(int, cellFilter)
|
||||
SAMPLER(0, UINT_3D, flagTexture)
|
||||
SAMPLER(1, FLOAT_3D, fieldTexture)
|
||||
PUSH_CONSTANT(float, lower_bound)
|
||||
PUSH_CONSTANT(float, upper_bound)
|
||||
PUSH_CONSTANT(float4, range_color)
|
||||
PUSH_CONSTANT(int, cell_filter)
|
||||
SAMPLER(0, UINT_3D, flag_tx)
|
||||
SAMPLER(1, FLOAT_3D, field_tx)
|
||||
ADDITIONAL_INFO(draw_volume)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(overlay_volume_gridlines)
|
||||
|
||||
@@ -18,30 +18,30 @@
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_wireframe_iface)
|
||||
SMOOTH(float4, finalColor)
|
||||
FLAT(float2, edgeStart)
|
||||
NO_PERSPECTIVE(float2, edgePos)
|
||||
SMOOTH(float4, final_color)
|
||||
FLAT(float2, edge_start)
|
||||
NO_PERSPECTIVE(float2, edge_pos)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_wireframe_base)
|
||||
PUSH_CONSTANT(float, ndc_offset_factor)
|
||||
PUSH_CONSTANT(float, wireStepParam)
|
||||
PUSH_CONSTANT(float, wireOpacity)
|
||||
PUSH_CONSTANT(bool, useColoring)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(int, colorType)
|
||||
PUSH_CONSTANT(bool, isHair)
|
||||
PUSH_CONSTANT(float4x4, hairDupliMatrix)
|
||||
PUSH_CONSTANT(float, wire_step_param)
|
||||
PUSH_CONSTANT(float, wire_opacity)
|
||||
PUSH_CONSTANT(bool, use_coloring)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
PUSH_CONSTANT(int, color_type)
|
||||
PUSH_CONSTANT(bool, is_hair)
|
||||
PUSH_CONSTANT(float4x4, hair_dupli_matrix)
|
||||
/* Scene Depth texture copy for manual depth test. */
|
||||
SAMPLER(0, DEPTH_2D, depthTex)
|
||||
SAMPLER(0, DEPTH_2D, depth_tx)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, float3, nor)
|
||||
VERTEX_IN(2, float, wd) /* wire-data. */
|
||||
VERTEX_OUT(overlay_wireframe_iface)
|
||||
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
DEPTH_WRITE(DepthWrite::ANY)
|
||||
SPECIALIZATION_CONSTANT(bool, use_custom_depth_bias, true)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
@@ -54,16 +54,16 @@ OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_wireframe, overlay_wireframe_base)
|
||||
GPU_SHADER_CREATE_INFO(overlay_wireframe_curve_base)
|
||||
DEFINE("CURVES")
|
||||
PUSH_CONSTANT(float, ndc_offset_factor)
|
||||
PUSH_CONSTANT(float, wireOpacity)
|
||||
PUSH_CONSTANT(bool, useColoring)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(int, colorType)
|
||||
PUSH_CONSTANT(float, wire_opacity)
|
||||
PUSH_CONSTANT(bool, use_coloring)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
PUSH_CONSTANT(int, color_type)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(overlay_wireframe_iface)
|
||||
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_object_infos)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
@@ -72,22 +72,22 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_wireframe_curve, overlay_wireframe_curve_base)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_wireframe_points_iface)
|
||||
FLAT(float4, finalColor)
|
||||
FLAT(float4, finalColorInner)
|
||||
FLAT(float4, final_color)
|
||||
FLAT(float4, final_color_inner)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_wireframe_points_base)
|
||||
DEFINE("POINTS")
|
||||
PUSH_CONSTANT(float, ndc_offset_factor)
|
||||
PUSH_CONSTANT(bool, useColoring)
|
||||
PUSH_CONSTANT(bool, isTransform)
|
||||
PUSH_CONSTANT(int, colorType)
|
||||
PUSH_CONSTANT(bool, use_coloring)
|
||||
PUSH_CONSTANT(bool, is_transform)
|
||||
PUSH_CONSTANT(int, color_type)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_OUT(overlay_wireframe_points_iface)
|
||||
VERTEX_SOURCE("overlay_wireframe_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_wireframe_frag.glsl")
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(1, float4, lineOutput)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_OUT(1, float4, line_output)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
ADDITIONAL_INFO(draw_object_infos)
|
||||
ADDITIONAL_INFO(draw_globals)
|
||||
@@ -96,10 +96,10 @@ GPU_SHADER_CREATE_END()
|
||||
OVERLAY_INFO_VARIATIONS_MODELMAT(overlay_wireframe_points, overlay_wireframe_points_base)
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(overlay_edit_uv_iface_wireframe)
|
||||
SMOOTH(float, selectionFac)
|
||||
FLAT(float2, stippleStart)
|
||||
NO_PERSPECTIVE(float, edgeCoord)
|
||||
NO_PERSPECTIVE(float2, stipplePos)
|
||||
SMOOTH(float, selection_fac)
|
||||
FLAT(float2, stipple_start)
|
||||
NO_PERSPECTIVE(float, edge_coord)
|
||||
NO_PERSPECTIVE(float2, stipple_pos)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(overlay_wireframe_uv)
|
||||
@@ -107,13 +107,13 @@ DO_STATIC_COMPILATION()
|
||||
DEFINE("WIREFRAME")
|
||||
STORAGE_BUF_FREQ(0, READ, float, au[], GEOMETRY)
|
||||
PUSH_CONSTANT(int2, gpu_attr_0)
|
||||
DEFINE_VALUE("lineStyle", "4u" /* OVERLAY_UV_LINE_STYLE_SHADOW */)
|
||||
DEFINE_VALUE("dashLength", "1" /* Not used by this line style */)
|
||||
DEFINE_VALUE("line_style", "4u" /* OVERLAY_UV_LINE_STYLE_SHADOW */)
|
||||
DEFINE_VALUE("dash_length", "1" /* Not used by this line style */)
|
||||
DEFINE_VALUE("use_edge_select", "false")
|
||||
PUSH_CONSTANT(bool, doSmoothWire)
|
||||
PUSH_CONSTANT(bool, do_smooth_wire)
|
||||
PUSH_CONSTANT(float, alpha)
|
||||
VERTEX_OUT(overlay_edit_uv_iface_wireframe)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
/* Note: Reuse edit mode shader as it is mostly the same. */
|
||||
VERTEX_SOURCE("overlay_edit_uv_edges_vert.glsl")
|
||||
FRAGMENT_SOURCE("overlay_edit_uv_edges_frag.glsl")
|
||||
|
||||
@@ -26,7 +26,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_antialiasing)
|
||||
*/
|
||||
float line_coverage(float distance_to_line, float line_kernel_size)
|
||||
{
|
||||
if (doSmoothLines) {
|
||||
if (do_smooth_lines) {
|
||||
return smoothstep(
|
||||
LINE_SMOOTH_END, LINE_SMOOTH_START, abs(distance_to_line) - line_kernel_size);
|
||||
}
|
||||
@@ -36,7 +36,7 @@ float line_coverage(float distance_to_line, float line_kernel_size)
|
||||
}
|
||||
float4 line_coverage(float4 distance_to_line, float line_kernel_size)
|
||||
{
|
||||
if (doSmoothLines) {
|
||||
if (do_smooth_lines) {
|
||||
return smoothstep(
|
||||
LINE_SMOOTH_END, LINE_SMOOTH_START, abs(distance_to_line) - line_kernel_size);
|
||||
}
|
||||
@@ -96,36 +96,36 @@ void main()
|
||||
int2 center_texel = int2(gl_FragCoord.xy);
|
||||
float line_kernel = sizePixel * 0.5f - 0.5f;
|
||||
|
||||
fragColor = texelFetch(colorTex, center_texel, 0);
|
||||
frag_color = texelFetch(color_tx, center_texel, 0);
|
||||
|
||||
bool original_col_has_alpha = fragColor.a < 1.0f;
|
||||
bool original_col_has_alpha = frag_color.a < 1.0f;
|
||||
|
||||
float depth = texelFetch(depthTex, center_texel, 0).r;
|
||||
float depth = texelFetch(depth_tx, center_texel, 0).r;
|
||||
|
||||
float dist_raw = texelFetch(lineTex, center_texel, 0).b;
|
||||
float dist_raw = texelFetch(line_tx, center_texel, 0).b;
|
||||
float dist = decode_line_dist(dist_raw);
|
||||
|
||||
if (!doSmoothLines && dist <= 1.0f) {
|
||||
if (!do_smooth_lines && dist <= 1.0f) {
|
||||
/* No expansion or AA should be applied. */
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: Optimization: use textureGather. */
|
||||
float4 neightbor_col0 = texelFetchOffset(colorTex, center_texel, 0, int2(1, 0));
|
||||
float4 neightbor_col1 = texelFetchOffset(colorTex, center_texel, 0, int2(-1, 0));
|
||||
float4 neightbor_col2 = texelFetchOffset(colorTex, center_texel, 0, int2(0, 1));
|
||||
float4 neightbor_col3 = texelFetchOffset(colorTex, center_texel, 0, int2(0, -1));
|
||||
float4 neightbor_col0 = texelFetchOffset(color_tx, center_texel, 0, int2(1, 0));
|
||||
float4 neightbor_col1 = texelFetchOffset(color_tx, center_texel, 0, int2(-1, 0));
|
||||
float4 neightbor_col2 = texelFetchOffset(color_tx, center_texel, 0, int2(0, 1));
|
||||
float4 neightbor_col3 = texelFetchOffset(color_tx, center_texel, 0, int2(0, -1));
|
||||
|
||||
float3 neightbor_line0 = texelFetchOffset(lineTex, center_texel, 0, int2(1, 0)).rgb;
|
||||
float3 neightbor_line1 = texelFetchOffset(lineTex, center_texel, 0, int2(-1, 0)).rgb;
|
||||
float3 neightbor_line2 = texelFetchOffset(lineTex, center_texel, 0, int2(0, 1)).rgb;
|
||||
float3 neightbor_line3 = texelFetchOffset(lineTex, center_texel, 0, int2(0, -1)).rgb;
|
||||
float3 neightbor_line0 = texelFetchOffset(line_tx, center_texel, 0, int2(1, 0)).rgb;
|
||||
float3 neightbor_line1 = texelFetchOffset(line_tx, center_texel, 0, int2(-1, 0)).rgb;
|
||||
float3 neightbor_line2 = texelFetchOffset(line_tx, center_texel, 0, int2(0, 1)).rgb;
|
||||
float3 neightbor_line3 = texelFetchOffset(line_tx, center_texel, 0, int2(0, -1)).rgb;
|
||||
|
||||
float4 depths;
|
||||
depths.x = texelFetchOffset(depthTex, center_texel, 0, int2(1, 0)).r;
|
||||
depths.y = texelFetchOffset(depthTex, center_texel, 0, int2(-1, 0)).r;
|
||||
depths.z = texelFetchOffset(depthTex, center_texel, 0, int2(0, 1)).r;
|
||||
depths.w = texelFetchOffset(depthTex, center_texel, 0, int2(0, -1)).r;
|
||||
depths.x = texelFetchOffset(depth_tx, center_texel, 0, int2(1, 0)).r;
|
||||
depths.y = texelFetchOffset(depth_tx, center_texel, 0, int2(-1, 0)).r;
|
||||
depths.z = texelFetchOffset(depth_tx, center_texel, 0, int2(0, 1)).r;
|
||||
depths.w = texelFetchOffset(depth_tx, center_texel, 0, int2(0, -1)).r;
|
||||
|
||||
float4 line_dists;
|
||||
line_dists.x = neighbor_dist(neightbor_line0, float2(1, 0));
|
||||
@@ -136,15 +136,15 @@ void main()
|
||||
float4 coverage = line_coverage(line_dists, line_kernel);
|
||||
|
||||
if (dist_raw > 0.0f) {
|
||||
fragColor *= line_coverage(dist, line_kernel);
|
||||
frag_color *= line_coverage(dist, line_kernel);
|
||||
}
|
||||
|
||||
/* We don't order fragments but use alpha over/alpha under based on current minimum frag depth.
|
||||
*/
|
||||
neighbor_blend(coverage.x, depths.x, neightbor_col0, depth, fragColor);
|
||||
neighbor_blend(coverage.y, depths.y, neightbor_col1, depth, fragColor);
|
||||
neighbor_blend(coverage.z, depths.z, neightbor_col2, depth, fragColor);
|
||||
neighbor_blend(coverage.w, depths.w, neightbor_col3, depth, fragColor);
|
||||
neighbor_blend(coverage.x, depths.x, neightbor_col0, depth, frag_color);
|
||||
neighbor_blend(coverage.y, depths.y, neightbor_col1, depth, frag_color);
|
||||
neighbor_blend(coverage.z, depths.z, neightbor_col2, depth, frag_color);
|
||||
neighbor_blend(coverage.w, depths.w, neightbor_col3, depth, frag_color);
|
||||
|
||||
#if 1
|
||||
/* Fix aliasing issue with really dense meshes and 1 pixel sized lines. */
|
||||
@@ -155,7 +155,7 @@ void main()
|
||||
float blend = dot(float4(0.25f), step(0.001f, lines));
|
||||
/* Only do blend if there are more than 2 neighbors. This avoids losing too much AA. */
|
||||
blend = clamp(blend * 2.0f - 1.0f, 0.0f, 1.0f);
|
||||
fragColor = mix(fragColor, fragColor / fragColor.a, blend);
|
||||
frag_color = mix(frag_color, frag_color / frag_color.a, blend);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,6 +8,6 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_armature_dof)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = float4(finalColor.rgb, finalColor.a * alpha);
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color = float4(final_color.rgb, final_color.a * alpha);
|
||||
line_output = float4(0.0f);
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ void main()
|
||||
|
||||
float3 world_pos = (model_mat * float4(final_pos, 1.0f)).xyz;
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
finalColor = data_buf[gl_InstanceID].color_;
|
||||
final_color = data_buf[gl_InstanceID].color_;
|
||||
|
||||
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_start = edge_pos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void main()
|
||||
/* Offset away from the center to avoid overlap with solid shape. */
|
||||
gl_Position.xy += ofs_dir * sizeViewportInv * gl_Position.w;
|
||||
|
||||
edgeStart = edgePos = proj(gl_Position);
|
||||
edge_start = edge_pos = proj(gl_Position);
|
||||
|
||||
finalColor = float4(data_buf[gl_InstanceID].bone_color_and_wire_width.rgb, 1.0f);
|
||||
final_color = float4(data_buf[gl_InstanceID].bone_color_and_wire_width.rgb, 1.0f);
|
||||
}
|
||||
|
||||
@@ -10,19 +10,19 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_armature_envelope_solid)
|
||||
|
||||
void main()
|
||||
{
|
||||
float n = normalize(normalView).z;
|
||||
if (isDistance) {
|
||||
float n = normalize(view_normal).z;
|
||||
if (is_distance) {
|
||||
n = 1.0f - clamp(-n, 0.0f, 1.0f);
|
||||
fragColor = float4(1.0f, 1.0f, 1.0f, 0.33f * alpha) * n;
|
||||
frag_color = float4(1.0f, 1.0f, 1.0f, 0.33f * alpha) * n;
|
||||
}
|
||||
else {
|
||||
/* Smooth lighting factor. */
|
||||
constexpr float s = 0.2f; /* [0.0f-0.5f] range */
|
||||
float fac = clamp((n * (1.0f - s)) + s, 0.0f, 1.0f);
|
||||
fragColor.rgb = mix(finalStateColor, finalBoneColor, fac * fac);
|
||||
fragColor.a = alpha;
|
||||
frag_color.rgb = mix(final_state_color, final_bone_color, fac * fac);
|
||||
frag_color.a = alpha;
|
||||
}
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -43,10 +43,10 @@ void main()
|
||||
sp = bone_mat * sp.xzy + data_buf[gl_InstanceID].head_sphere.xyz;
|
||||
nor = bone_mat * nor.xzy;
|
||||
|
||||
normalView = to_float3x3(drw_view().viewmat) * nor;
|
||||
view_normal = to_float3x3(drw_view().viewmat) * nor;
|
||||
|
||||
finalStateColor = data_buf[gl_InstanceID].state_color.xyz;
|
||||
finalBoneColor = data_buf[gl_InstanceID].bone_color_and_wire_width.xyz;
|
||||
final_state_color = data_buf[gl_InstanceID].state_color.xyz;
|
||||
final_bone_color = data_buf[gl_InstanceID].bone_color_and_wire_width.xyz;
|
||||
|
||||
view_clipping_distances(sp);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ void emit_vertex(const uint strip_index,
|
||||
return;
|
||||
}
|
||||
|
||||
finalColor = color;
|
||||
final_color = color;
|
||||
|
||||
gl_Position = hs_P;
|
||||
/* Offset away from the center to avoid overlap with solid shape. */
|
||||
@@ -81,7 +81,7 @@ void emit_vertex(const uint strip_index,
|
||||
/* Improve AA bleeding inside bone silhouette. */
|
||||
gl_Position.z -= (is_persp) ? 1e-4f : 1e-6f;
|
||||
|
||||
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_start = edge_pos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
view_clipping_distances(ws_P);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ void main()
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
fragColor = float4(finalColor.rgb, alpha);
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color = float4(final_color.rgb, alpha);
|
||||
line_output = float4(0.0f);
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ void main()
|
||||
/* Smooth lighting factor. */
|
||||
constexpr float s = 0.2f; /* [0.0f-0.5f] range */
|
||||
float fac = clamp((n * (1.0f - s)) + s, 0.0f, 1.0f);
|
||||
finalColor.rgb = mix(state_color.rgb, bone_color.rgb, fac * fac);
|
||||
finalColor.a = 1.0f;
|
||||
final_color.rgb = mix(state_color.rgb, bone_color.rgb, fac * fac);
|
||||
final_color.a = 1.0f;
|
||||
|
||||
float4 world_pos = model_mat * float4(pos, 1.0f);
|
||||
gl_Position = drw_view().winmat * (drw_view().viewmat * world_pos);
|
||||
|
||||
@@ -37,12 +37,12 @@ void main()
|
||||
{
|
||||
float half_size = (do_smooth_wire ? wire_width - 0.5f : wire_width) / 2.0f;
|
||||
|
||||
float dist = abs(edgeCoord) - half_size;
|
||||
float dist = abs(edge_coord) - half_size;
|
||||
float mix_w = saturate(edge_step(dist));
|
||||
|
||||
fragColor = mix(float4(finalColor.rgb, alpha), float4(0), mix_w);
|
||||
fragColor.a *= 1.0f - mix_w;
|
||||
lineOutput = float4(0);
|
||||
frag_color = mix(float4(final_color.rgb, alpha), float4(0), mix_w);
|
||||
frag_color.a *= 1.0f - mix_w;
|
||||
line_output = float4(0);
|
||||
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ VertIn input_assembly(uint in_vertex_id, float4x4 inst_matrix)
|
||||
|
||||
struct VertOut {
|
||||
float4 gpu_position;
|
||||
float4 finalColor;
|
||||
float4 final_color;
|
||||
float3 world_pos;
|
||||
float wire_width;
|
||||
};
|
||||
@@ -68,8 +68,8 @@ VertOut vertex_main(VertIn v_in)
|
||||
}
|
||||
v_out.gpu_position = drw_point_world_to_homogenous(v_out.world_pos);
|
||||
|
||||
v_out.finalColor.rgb = mix(state_color.rgb, bone_color.rgb, 0.5f);
|
||||
v_out.finalColor.a = 1.0f;
|
||||
v_out.final_color.rgb = mix(state_color.rgb, bone_color.rgb, 0.5f);
|
||||
v_out.final_color.a = 1.0f;
|
||||
/* Because the packing clamps the value, the wire width is passed in compressed. */
|
||||
v_out.wire_width = bone_color.a * WIRE_WIDTH_COMPRESSION;
|
||||
|
||||
@@ -94,8 +94,8 @@ void do_vertex(const uint strip_index,
|
||||
return;
|
||||
}
|
||||
|
||||
finalColor = color;
|
||||
edgeCoord = coord;
|
||||
final_color = color;
|
||||
edge_coord = coord;
|
||||
gl_Position = hs_P;
|
||||
/* Multiply offset by 2 because gl_Position range is [-1..1]. */
|
||||
gl_Position.xy += offset * 2.0f * hs_P.w;
|
||||
@@ -145,7 +145,7 @@ void geometry_main(VertOut geom_in[2],
|
||||
float2 line_norm = normalize(float2(line[1], -line[0]));
|
||||
float2 edge_ofs = (half_size * line_norm) * sizeViewportInv;
|
||||
|
||||
float4 final_color = geom_in[0].finalColor;
|
||||
float4 final_color = geom_in[0].final_color;
|
||||
do_vertex(0,
|
||||
out_vertex_id,
|
||||
out_primitive_id,
|
||||
|
||||
@@ -25,7 +25,7 @@ void main()
|
||||
float4x4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color);
|
||||
|
||||
float4x4 model_view_matrix = drw_view().viewmat * model_mat;
|
||||
float4x4 sphereMatrix = inverse(model_view_matrix);
|
||||
float4x4 sphere_matrix = inverse(model_view_matrix);
|
||||
|
||||
bool is_persp = (drw_view().winmat[3][3] == 0.0f);
|
||||
|
||||
@@ -33,14 +33,14 @@ void main()
|
||||
* In perspective mode it's also the view-space position
|
||||
* of the sphere center. */
|
||||
float3 cam_ray = (is_persp) ? model_view_matrix[3].xyz : float3(0.0f, 0.0f, -1.0f);
|
||||
cam_ray = to_float3x3(sphereMatrix) * cam_ray;
|
||||
cam_ray = to_float3x3(sphere_matrix) * cam_ray;
|
||||
|
||||
/* Sphere center distance from the camera (persp) in local space. */
|
||||
float cam_dist = length(cam_ray);
|
||||
|
||||
/* Compute view aligned orthonormal space. */
|
||||
float3 z_axis = cam_ray / cam_dist;
|
||||
float3 x_axis = normalize(cross(sphereMatrix[1].xyz, z_axis));
|
||||
float3 x_axis = normalize(cross(sphere_matrix[1].xyz, z_axis));
|
||||
float3 y_axis = cross(z_axis, x_axis);
|
||||
float z_ofs = 0.0f;
|
||||
|
||||
@@ -76,9 +76,9 @@ void main()
|
||||
float2 ofs_dir = normalize(proj(gl_Position) - proj(center));
|
||||
gl_Position.xy += ofs_dir * sizeViewportInv * gl_Position.w;
|
||||
|
||||
edgeStart = edgePos = proj(gl_Position);
|
||||
edge_start = edge_pos = proj(gl_Position);
|
||||
|
||||
finalColor = float4(bone_color.rgb, 1.0f);
|
||||
final_color = float4(bone_color.rgb, 1.0f);
|
||||
|
||||
float4 world_pos = model_mat * float4(cam_pos0, 1.0f);
|
||||
view_clipping_distances(world_pos.xyz);
|
||||
|
||||
@@ -14,20 +14,20 @@ void main()
|
||||
constexpr float sphere_radius = 0.05f;
|
||||
|
||||
bool is_perp = (drw_view().winmat[3][3] == 0.0f);
|
||||
float3 ray_ori_view = (is_perp) ? float3(0.0f) : viewPosition.xyz;
|
||||
float3 ray_dir_view = (is_perp) ? viewPosition : float3(0.0f, 0.0f, -1.0f);
|
||||
float3 ray_ori_view = (is_perp) ? float3(0.0f) : view_position.xyz;
|
||||
float3 ray_dir_view = (is_perp) ? view_position : float3(0.0f, 0.0f, -1.0f);
|
||||
|
||||
/* Single matrix mul without branch. */
|
||||
float4 mul_vec = (is_perp) ? float4(ray_dir_view, 0.0f) : float4(ray_ori_view, 1.0f);
|
||||
float3 mul_res = (sphereMatrix * mul_vec).xyz;
|
||||
float3 mul_res = (sphere_matrix * mul_vec).xyz;
|
||||
|
||||
/* Reminder :
|
||||
* sphereMatrix[3] is the view space origin in sphere space (sph_ori -> view_ori).
|
||||
* sphereMatrix[2] is the view space Z axis in sphere space. */
|
||||
* sphere_matrix[3] is the view space origin in sphere space (sph_ori -> view_ori).
|
||||
* sphere_matrix[2] is the view space Z axis in sphere space. */
|
||||
|
||||
/* convert to sphere local space */
|
||||
float3 ray_ori = (is_perp) ? sphereMatrix[3].xyz : mul_res;
|
||||
float3 ray_dir = (is_perp) ? mul_res : -sphereMatrix[2].xyz;
|
||||
float3 ray_ori = (is_perp) ? sphere_matrix[3].xyz : mul_res;
|
||||
float3 ray_dir = (is_perp) ? mul_res : -sphere_matrix[2].xyz;
|
||||
float ray_len = length(ray_dir);
|
||||
ray_dir /= ray_len;
|
||||
|
||||
@@ -41,19 +41,19 @@ void main()
|
||||
/* Compute dot product for lighting */
|
||||
float3 p = ray_dir * t + ray_ori; /* Point on sphere */
|
||||
float3 n = normalize(p); /* Normal is just the point in sphere space, normalized. */
|
||||
float3 l = normalize(sphereMatrix[2].xyz); /* Just the view Z axis in the sphere space. */
|
||||
float3 l = normalize(sphere_matrix[2].xyz); /* Just the view Z axis in the sphere space. */
|
||||
|
||||
/* Smooth lighting factor. */
|
||||
constexpr float s = 0.2f; /* [0.0f-0.5f] range */
|
||||
float fac = clamp((dot(n, l) * (1.0f - s)) + s, 0.0f, 1.0f);
|
||||
fragColor.rgb = mix(finalStateColor, finalBoneColor, fac * fac);
|
||||
frag_color.rgb = mix(final_state_color, final_bone_color, fac * fac);
|
||||
|
||||
/* 2x2 dither pattern to smooth the lighting. */
|
||||
float dither = (0.5f + dot(float2(int2(gl_FragCoord.xy) & int2(1)), float2(1.0f, 2.0f))) * 0.25f;
|
||||
dither *= (1.0f / 255.0f); /* Assume 8bit per color buffer. */
|
||||
|
||||
fragColor = float4(fragColor.rgb + dither, alpha);
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color = float4(frag_color.rgb + dither, alpha);
|
||||
line_output = float4(0.0f);
|
||||
|
||||
t /= ray_len;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ void main()
|
||||
float4x4 model_mat = extract_matrix_packed_data(inst_obmat, state_color, bone_color);
|
||||
|
||||
float4x4 model_view_matrix = drw_view().viewmat * model_mat;
|
||||
sphereMatrix = inverse(model_view_matrix);
|
||||
sphere_matrix = inverse(model_view_matrix);
|
||||
|
||||
bool is_persp = (drw_view().winmat[3][3] == 0.0f);
|
||||
|
||||
@@ -31,14 +31,14 @@ void main()
|
||||
* In perspective mode it's also the view-space position
|
||||
* of the sphere center. */
|
||||
float3 cam_ray = (is_persp) ? model_view_matrix[3].xyz : float3(0.0f, 0.0f, -1.0f);
|
||||
cam_ray = to_float3x3(sphereMatrix) * cam_ray;
|
||||
cam_ray = to_float3x3(sphere_matrix) * cam_ray;
|
||||
|
||||
/* Sphere center distance from the camera (persp) in local space. */
|
||||
float cam_dist = length(cam_ray);
|
||||
|
||||
/* Compute view aligned orthonormal space. */
|
||||
float3 z_axis = cam_ray / cam_dist;
|
||||
float3 x_axis = normalize(cross(sphereMatrix[1].xyz, z_axis));
|
||||
float3 x_axis = normalize(cross(sphere_matrix[1].xyz, z_axis));
|
||||
float3 y_axis = cross(z_axis, x_axis);
|
||||
|
||||
float z_ofs = -rad - 1e-8f; /* offset to the front of the sphere */
|
||||
@@ -78,10 +78,10 @@ void main()
|
||||
float4 pos_4d = float4(cam_pos, 1.0f);
|
||||
float4 V = model_view_matrix * pos_4d;
|
||||
gl_Position = drw_view().winmat * V;
|
||||
viewPosition = V.xyz;
|
||||
view_position = V.xyz;
|
||||
|
||||
finalStateColor = state_color.xyz;
|
||||
finalBoneColor = bone_color.xyz;
|
||||
final_state_color = state_color.xyz;
|
||||
final_bone_color = bone_color.xyz;
|
||||
|
||||
float4 world_pos = model_mat * pos_4d;
|
||||
view_clipping_distances(world_pos.xyz);
|
||||
|
||||
@@ -10,9 +10,9 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_armature_stick)
|
||||
|
||||
void main()
|
||||
{
|
||||
float fac = smoothstep(1.0f, 0.2f, colorFac);
|
||||
fragColor.rgb = mix(finalInnerColor.rgb, finalWireColor.rgb, fac);
|
||||
fragColor.a = alpha;
|
||||
lineOutput = float4(0.0f);
|
||||
float fac = smoothstep(1.0f, 0.2f, color_fac);
|
||||
frag_color.rgb = mix(final_inner_color.rgb, final_wire_color.rgb, fac);
|
||||
frag_color.a = alpha;
|
||||
line_output = float4(0.0f);
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -23,15 +23,15 @@ void main()
|
||||
select_id_set(in_select_buf[gl_InstanceID]);
|
||||
|
||||
StickBoneFlag bone_flag = StickBoneFlag(vclass);
|
||||
finalInnerColor = flag_test(bone_flag, COL_HEAD) ? data_buf[gl_InstanceID].head_color :
|
||||
data_buf[gl_InstanceID].tail_color;
|
||||
finalInnerColor = flag_test(bone_flag, COL_BONE) ? data_buf[gl_InstanceID].bone_color :
|
||||
finalInnerColor;
|
||||
finalWireColor = (data_buf[gl_InstanceID].wire_color.a > 0.0f) ?
|
||||
data_buf[gl_InstanceID].wire_color :
|
||||
finalInnerColor;
|
||||
colorFac = flag_test(bone_flag, COL_WIRE) ? 0.0f :
|
||||
(flag_test(bone_flag, COL_BONE) ? 1.0f : 2.0f);
|
||||
final_inner_color = flag_test(bone_flag, COL_HEAD) ? data_buf[gl_InstanceID].head_color :
|
||||
data_buf[gl_InstanceID].tail_color;
|
||||
final_inner_color = flag_test(bone_flag, COL_BONE) ? data_buf[gl_InstanceID].bone_color :
|
||||
final_inner_color;
|
||||
final_wire_color = (data_buf[gl_InstanceID].wire_color.a > 0.0f) ?
|
||||
data_buf[gl_InstanceID].wire_color :
|
||||
final_inner_color;
|
||||
color_fac = flag_test(bone_flag, COL_WIRE) ? 0.0f :
|
||||
(flag_test(bone_flag, COL_BONE) ? 1.0f : 2.0f);
|
||||
|
||||
float4 boneStart_4d = float4(data_buf[gl_InstanceID].bone_start.xyz, 1.0f);
|
||||
float4 boneEnd_4d = float4(data_buf[gl_InstanceID].bone_end.xyz, 1.0f);
|
||||
@@ -68,7 +68,7 @@ void main()
|
||||
vpos *= (drw_view().winmat[3][3] == 0.0f) ? h : 1.0f;
|
||||
vpos *= (data_buf[gl_InstanceID].wire_color.a > 0.0f) ? 1.0f : 0.5f;
|
||||
|
||||
if (finalInnerColor.a > 0.0f) {
|
||||
if (final_inner_color.a > 0.0f) {
|
||||
float stick_size = sizePixel * 5.0f;
|
||||
gl_Position = (is_head) ? p0 : p1;
|
||||
gl_Position.xy += stick_size * (vpos * sizeViewportInv);
|
||||
|
||||
@@ -11,7 +11,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_armature_wire)
|
||||
|
||||
void main()
|
||||
{
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
|
||||
fragColor = float4(finalColor.rgb, finalColor.a * alpha);
|
||||
line_output = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
frag_color = float4(final_color.rgb, final_color.a * alpha);
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ void main()
|
||||
{
|
||||
select_id_set(in_select_buf[gl_VertexID / 2]);
|
||||
|
||||
finalColor.rgb = data_buf[gl_VertexID].color_.rgb;
|
||||
finalColor.a = 1.0f;
|
||||
final_color.rgb = data_buf[gl_VertexID].color_.rgb;
|
||||
final_color.a = 1.0f;
|
||||
|
||||
float3 world_pos = data_buf[gl_VertexID].pos_.xyz;
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_start = edge_pos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ void main()
|
||||
* This removes the alpha channel and put the background behind reference images
|
||||
* while masking the reference images by the render alpha.
|
||||
*/
|
||||
float alpha = texture(colorBuffer, screen_uv).a;
|
||||
float depth = texture(depthBuffer, screen_uv).r;
|
||||
float alpha = texture(color_buffer, screen_uv).a;
|
||||
float depth = texture(depth_buffer, screen_uv).r;
|
||||
|
||||
float3 bg_col;
|
||||
float3 col_high;
|
||||
@@ -41,9 +41,9 @@ void main()
|
||||
|
||||
/* BG_SOLID_CHECKER selects BG_SOLID when no pixel has been drawn otherwise use the BG_CHERKER.
|
||||
*/
|
||||
int bg_type = bgType == BG_SOLID_CHECKER ? (depth == 1.0f ? BG_SOLID : BG_CHECKER) : bgType;
|
||||
int type = bg_type == BG_SOLID_CHECKER ? (depth == 1.0f ? BG_SOLID : BG_CHECKER) : bg_type;
|
||||
|
||||
switch (bg_type) {
|
||||
switch (type) {
|
||||
case BG_SOLID:
|
||||
bg_col = colorBackground.rgb;
|
||||
break;
|
||||
@@ -79,17 +79,17 @@ void main()
|
||||
break;
|
||||
}
|
||||
case BG_MASK:
|
||||
fragColor = float4(float3(1.0f - alpha), 0.0f);
|
||||
frag_color = float4(float3(1.0f - alpha), 0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
bg_col = mix(bg_col, colorOverride.rgb, colorOverride.a);
|
||||
bg_col = mix(bg_col, color_override.rgb, color_override.a);
|
||||
|
||||
/* Mimic alpha under behavior. Result is premultiplied. */
|
||||
fragColor = float4(bg_col, 1.0f) * (1.0f - alpha);
|
||||
frag_color = float4(bg_col, 1.0f) * (1.0f - alpha);
|
||||
|
||||
/* Special case: If the render is not transparent, do not clear alpha values. */
|
||||
if (depth == 1.0f && alpha == 1.0f) {
|
||||
fragColor.a = 1.0f;
|
||||
frag_color.a = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ void main()
|
||||
#ifndef SELECT_ENABLE
|
||||
/* We cannot change the fragment's depth in selection mode. Otherwise we would break pipeline
|
||||
* correctness when early depth test enforced. */
|
||||
if (!gpStrokeOrder3d) {
|
||||
/* Stroke order 2D. Project to gpDepthPlane. */
|
||||
if (!gp_stroke_order3d) {
|
||||
/* Stroke order 2D. Project to gp_depth_plane. */
|
||||
bool is_persp = drw_view().winmat[3][3] == 0.0f;
|
||||
float2 uvs = float2(gl_FragCoord.xy) * sizeViewportInv;
|
||||
float3 pos_ndc = float3(uvs, gl_FragCoord.z) * 2.0f - 1.0f;
|
||||
@@ -47,7 +47,7 @@ void main()
|
||||
|
||||
float3 ray_ori = pos;
|
||||
float3 ray_dir = (is_persp) ? (drw_view().viewinv[3].xyz - pos) : drw_view().viewinv[2].xyz;
|
||||
float3 isect = ray_plane_intersection(ray_ori, ray_dir, gpDepthPlane);
|
||||
float3 isect = ray_plane_intersection(ray_ori, ray_dir, gp_depth_plane);
|
||||
float4 ndc = drw_point_world_to_homogenous(isect);
|
||||
gl_FragDepth = (ndc.z / ndc.w) * 0.5f + 0.5f;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ struct GeomOut {
|
||||
|
||||
void export_vertex(GeomOut geom_out)
|
||||
{
|
||||
finalColor = geom_out.color;
|
||||
final_color = geom_out.color;
|
||||
gl_Position = geom_out.gpu_position;
|
||||
gl_Position.xy += geom_out.offset * geom_out.gpu_position.w;
|
||||
view_clipping_distances(geom_out.ws_P);
|
||||
@@ -108,18 +108,18 @@ void geometry_main(VertOut geom_in[2],
|
||||
uint color_id = (geom_in[1].flag >> COLOR_SHIFT);
|
||||
|
||||
/* Don't output any edges if we don't show handles */
|
||||
if (!showCurveHandles && (color_id < 5u)) {
|
||||
if (!show_curve_handles && (color_id < 5u)) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool edge_selected = (((geom_in[1].flag | geom_in[0].flag) & VERT_SELECTED) != 0u);
|
||||
bool handle_selected = (showCurveHandles && (((geom_in[1].flag | geom_in[0].flag) &
|
||||
VERT_SELECTED_BEZT_HANDLE) != 0u));
|
||||
bool handle_selected = (show_curve_handles && (((geom_in[1].flag | geom_in[0].flag) &
|
||||
VERT_SELECTED_BEZT_HANDLE) != 0u));
|
||||
|
||||
bool is_gpencil = ((geom_in[1].flag & VERT_GPENCIL_BEZT_HANDLE) != 0u);
|
||||
|
||||
/* If handle type is only selected and the edge is not selected, don't show. */
|
||||
if ((uint(curveHandleDisplay) != CURVE_HANDLE_ALL) && (!handle_selected)) {
|
||||
if ((uint(curve_handle_display) != CURVE_HANDLE_ALL) && (!handle_selected)) {
|
||||
/* Nurbs must show the handles always. */
|
||||
bool is_u_segment = (((geom_in[1].flag ^ geom_in[0].flag) & EVEN_U_BIT) != 0u);
|
||||
if ((!is_u_segment) && (color_id <= 4u)) {
|
||||
|
||||
@@ -38,13 +38,13 @@ void main()
|
||||
|
||||
if ((gl_VertexID & 1) == 0) {
|
||||
float flip = ((gl_VertexID & 2) == 0) ? -1.0f : 1.0f;
|
||||
ls_P += normalSize * radius * (flip * ls_N - ls_T);
|
||||
ls_P += normal_size * radius * (flip * ls_N - ls_T);
|
||||
}
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(ls_P);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
finalColor = colorWireEdit;
|
||||
final_color = colorWireEdit;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -16,14 +16,14 @@ void main()
|
||||
bool is_gpencil = ((data & EDGE_FREESTYLE) != 0u);
|
||||
if ((data & VERT_SELECTED) != 0u) {
|
||||
if ((data & VERT_ACTIVE) != 0u) {
|
||||
finalColor = colorEditMeshActive;
|
||||
final_color = colorEditMeshActive;
|
||||
}
|
||||
else {
|
||||
finalColor = (!is_gpencil) ? colorVertexSelect : colorGpencilVertexSelect;
|
||||
final_color = (!is_gpencil) ? colorVertexSelect : colorGpencilVertexSelect;
|
||||
}
|
||||
}
|
||||
else {
|
||||
finalColor = (!is_gpencil) ? colorVertex : colorGpencilVertex;
|
||||
final_color = (!is_gpencil) ? colorVertex : colorGpencilVertex;
|
||||
}
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
@@ -31,8 +31,8 @@ void main()
|
||||
gl_PointSize = (!is_gpencil) ? sizeVertex * 2.0f : sizeVertexGpencil * 2.0f;
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
bool show_handle = showCurveHandles;
|
||||
if ((uint(curveHandleDisplay) == CURVE_HANDLE_SELECTED) &&
|
||||
bool show_handle = show_curve_handles;
|
||||
if ((uint(curve_handle_display) == CURVE_HANDLE_SELECTED) &&
|
||||
((data & VERT_SELECTED_BEZT_HANDLE) == 0u))
|
||||
{
|
||||
show_handle = false;
|
||||
|
||||
@@ -17,13 +17,13 @@ void main()
|
||||
float flip = (gl_InstanceID != 0) ? -1.0f : 1.0f;
|
||||
|
||||
if (gl_VertexID % 2 == 0) {
|
||||
final_pos += normalSize * rad * (flip * nor - tangent);
|
||||
final_pos += normal_size * rad * (flip * nor - tangent);
|
||||
}
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(final_pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
finalColor = colorWireEdit;
|
||||
final_color = colorWireEdit;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ struct GeomOut {
|
||||
|
||||
void export_vertex(GeomOut geom_out)
|
||||
{
|
||||
finalColor = geom_out.color;
|
||||
final_color = geom_out.color;
|
||||
gl_Position = geom_out.gpu_position;
|
||||
gl_Position.xy += geom_out.offset * geom_out.gpu_position.w;
|
||||
view_clipping_distances(geom_out.ws_P);
|
||||
@@ -132,13 +132,13 @@ void geometry_main(VertOut geom_in[2],
|
||||
|
||||
bool is_bezier_handle = (geom_in[0].flag & EDIT_CURVES_BEZIER_HANDLE) != 0;
|
||||
/* Don't output any edges if we don't show handles */
|
||||
if ((uint(curveHandleDisplay) == CURVE_HANDLE_NONE) && is_bezier_handle) {
|
||||
if ((uint(curve_handle_display) == CURVE_HANDLE_NONE) && is_bezier_handle) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* If handle type is only selected and the edge is not selected, don't show.
|
||||
* Nurbs and other curves must show the handles always. */
|
||||
if ((uint(curveHandleDisplay) == CURVE_HANDLE_SELECTED) && is_bezier_handle && !is_active) {
|
||||
if ((uint(curve_handle_display) == CURVE_HANDLE_SELECTED) && is_bezier_handle && !is_active) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,23 +13,23 @@ void main()
|
||||
{
|
||||
float2 pos;
|
||||
pos.x = float(gl_VertexID % 2);
|
||||
pos.y = float(gl_VertexID / 2) / float(halfLineCount - 1);
|
||||
pos.y = float(gl_VertexID / 2) / float(half_line_count - 1);
|
||||
|
||||
if (pos.y > 1.0f) {
|
||||
pos.xy = pos.yx;
|
||||
pos.x -= 1.0f + 1.0f / float(halfLineCount - 1);
|
||||
pos.x -= 1.0f + 1.0f / float(half_line_count - 1);
|
||||
}
|
||||
|
||||
pos -= 0.5f;
|
||||
|
||||
float3 world_pos = xAxis * pos.x + yAxis * pos.y + origin;
|
||||
float3 world_pos = x_axis * pos.x + y_axis * pos.y + origin;
|
||||
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
finalColor = color;
|
||||
final_color = color;
|
||||
|
||||
/* Convert to screen position [0..sizeVp]. */
|
||||
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_pos = edge_start = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
}
|
||||
|
||||
@@ -13,13 +13,13 @@ VERTEX_SHADER_CREATE_INFO(overlay_edit_lattice_point)
|
||||
void main()
|
||||
{
|
||||
if ((data & VERT_SELECTED) != 0u) {
|
||||
finalColor = colorVertexSelect;
|
||||
final_color = colorVertexSelect;
|
||||
}
|
||||
else if ((data & VERT_ACTIVE) != 0u) {
|
||||
finalColor = colorEditMeshActive;
|
||||
final_color = colorEditMeshActive;
|
||||
}
|
||||
else {
|
||||
finalColor = colorVertex;
|
||||
final_color = colorVertex;
|
||||
}
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
|
||||
@@ -23,13 +23,13 @@ float3 weight_to_rgb(float t)
|
||||
return float3(1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
return texture(weightTex, t).rgb;
|
||||
return texture(weight_tx, t).rgb;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
finalColor = float4(weight_to_rgb(weight), 1.0f);
|
||||
final_color = float4(weight_to_rgb(weight), 1.0f);
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
@@ -8,6 +8,6 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_edit_mesh_analysis)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = weightColor;
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color = weight_color;
|
||||
line_output = float4(0.0f);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ float3 weight_to_rgb(float t)
|
||||
return float3(1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
return texture(weightTex, t).rgb;
|
||||
return texture(weight_tx, t).rgb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ void main()
|
||||
{
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
weightColor = float4(weight_to_rgb(weight), 1.0f);
|
||||
weight_color = float4(weight_to_rgb(weight), 1.0f);
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ float4 EDIT_MESH_edge_color_outer(uint edge_flag, uint face_flag, float crease,
|
||||
float4 EDIT_MESH_edge_color_inner(uint edge_flag)
|
||||
{
|
||||
float4 color = colorWireEdit;
|
||||
float4 selected_edge_col = (selectEdge) ? colorEdgeModeSelect : colorEdgeSelect;
|
||||
float4 selected_edge_col = (select_edge) ? colorEdgeModeSelect : colorEdgeSelect;
|
||||
color = ((edge_flag & EDGE_SELECTED) != 0u) ? selected_edge_col : color;
|
||||
color = ((edge_flag & EDGE_ACTIVE) != 0u) ? colorEditMeshActive : color;
|
||||
color.a = 1.0f;
|
||||
@@ -32,7 +32,7 @@ float4 EDIT_MESH_edge_color_inner(uint edge_flag)
|
||||
float4 EDIT_MESH_edge_vertex_color(uint vertex_flag)
|
||||
{
|
||||
/* Edge color in vertex selection mode. */
|
||||
float4 selected_edge_col = (selectEdge) ? colorEdgeModeSelect : colorEdgeSelect;
|
||||
float4 selected_edge_col = (select_edge) ? colorEdgeModeSelect : colorEdgeSelect;
|
||||
bool edge_selected = (vertex_flag & (VERT_ACTIVE | VERT_SELECTED)) != 0u;
|
||||
float4 color = (edge_selected) ? selected_edge_col : colorWireEdit;
|
||||
color.a = 1.0f;
|
||||
@@ -61,23 +61,23 @@ float4 EDIT_MESH_face_color(uint face_flag)
|
||||
bool face_freestyle = (face_flag & FACE_FREESTYLE) != 0u;
|
||||
bool face_selected = (face_flag & FACE_SELECTED) != 0u;
|
||||
bool face_active = (face_flag & FACE_ACTIVE) != 0u;
|
||||
bool face_retopo = (retopologyOffset > 0.0f);
|
||||
float4 selected_face_col = (selectFace) ? colorFaceModeSelect : colorFaceSelect;
|
||||
bool face_retopo = (retopology_offset > 0.0f);
|
||||
float4 selected_face_col = (select_face) ? colorFaceModeSelect : colorFaceSelect;
|
||||
float4 color = colorFace;
|
||||
color = face_retopo ? colorFaceRetopology : color;
|
||||
color = face_freestyle ? colorFaceFreestyle : color;
|
||||
color = face_selected ? selected_face_col : color;
|
||||
if (selectFace && face_active) {
|
||||
if (select_face && face_active) {
|
||||
color = mix(selected_face_col, colorEditMeshActive, 0.5f);
|
||||
color.a = selected_face_col.a;
|
||||
}
|
||||
if (wireShading) {
|
||||
if (wire_shading) {
|
||||
/* Lower face selection opacity for better wireframe visibility. */
|
||||
color.a = (face_selected) ? color.a * 0.6f : color.a;
|
||||
}
|
||||
else {
|
||||
/* Don't always fill 'colorFace'. */
|
||||
color.a = (selectFace || face_selected || face_active || face_freestyle || face_retopo) ?
|
||||
color.a = (select_face || face_selected || face_active || face_freestyle || face_retopo) ?
|
||||
color.a :
|
||||
0.0f;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ void main()
|
||||
|
||||
/* Offset Z position for retopology overlay. */
|
||||
gl_Position.z += get_homogenous_z_offset(
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopologyOffset);
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopology_offset);
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ struct GeomOut {
|
||||
|
||||
void export_vertex(GeomOut geom_out)
|
||||
{
|
||||
geometry_out.finalColor = geom_out.final_color;
|
||||
geometry_noperspective_out.edgeCoord = geom_out.edge_coord;
|
||||
geometry_out.final_color = geom_out.final_color;
|
||||
geometry_noperspective_out.edge_coord = geom_out.edge_coord;
|
||||
view_clipping_distances(geom_out.world_pos);
|
||||
gl_Position = geom_out.gpu_position;
|
||||
}
|
||||
@@ -116,10 +116,10 @@ void geometry_main(VertOut geom_in[2], uint out_vert_id, uint out_prim_id, uint
|
||||
float2 line = ss_pos[0] - ss_pos[1];
|
||||
line = abs(line) * sizeViewport;
|
||||
|
||||
geometry_flat_out.finalColorOuter = geom_in[0].final_color_outer;
|
||||
geometry_flat_out.final_color_outer = geom_in[0].final_color_outer;
|
||||
float half_size = sizeEdge;
|
||||
/* Enlarge edge for flag display. */
|
||||
half_size += (geometry_flat_out.finalColorOuter.a > 0.0f) ? max(sizeEdge, 1.0f) : 0.0f;
|
||||
half_size += (geometry_flat_out.final_color_outer.a > 0.0f) ? max(sizeEdge, 1.0f) : 0.0f;
|
||||
|
||||
if (do_smooth_wire) {
|
||||
/* Add 1px for AA */
|
||||
|
||||
@@ -23,5 +23,5 @@ void main()
|
||||
VertOut vert_out = vertex_main(vert_in);
|
||||
|
||||
gl_Position = vert_out.gpu_position;
|
||||
finalColor = vert_out.final_color;
|
||||
final_color = vert_out.final_color;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_edit_mesh_edge)
|
||||
|
||||
bool test_occlusion()
|
||||
{
|
||||
return gl_FragCoord.z > texelFetch(depthTex, int2(gl_FragCoord.xy), 0).r;
|
||||
return gl_FragCoord.z > texelFetch(depth_tx, int2(gl_FragCoord.xy), 0).r;
|
||||
}
|
||||
|
||||
float edge_step(float dist)
|
||||
@@ -37,17 +37,17 @@ float edge_step(float dist)
|
||||
|
||||
void main()
|
||||
{
|
||||
float dist = abs(geometry_noperspective_out.edgeCoord) - max(sizeEdge - 0.5f, 0.0f);
|
||||
float dist = abs(geometry_noperspective_out.edge_coord) - max(sizeEdge - 0.5f, 0.0f);
|
||||
float dist_outer = dist - max(sizeEdge, 1.0f);
|
||||
float mix_w = edge_step(dist);
|
||||
float mix_w_outer = edge_step(dist_outer);
|
||||
/* Line color & alpha. */
|
||||
fragColor = mix(geometry_flat_out.finalColorOuter,
|
||||
geometry_out.finalColor,
|
||||
1.0f - mix_w * geometry_flat_out.finalColorOuter.a);
|
||||
frag_color = mix(geometry_flat_out.final_color_outer,
|
||||
geometry_out.final_color,
|
||||
1.0f - mix_w * geometry_flat_out.final_color_outer.a);
|
||||
/* Line edges shape. */
|
||||
fragColor.a *= 1.0f - (geometry_flat_out.finalColorOuter.a > 0.0f ? mix_w_outer : mix_w);
|
||||
frag_color.a *= 1.0f - (geometry_flat_out.final_color_outer.a > 0.0f ? mix_w_outer : mix_w);
|
||||
|
||||
fragColor.a *= test_occlusion() ? alpha : 1.0f;
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color.a *= test_occlusion() ? alpha : 1.0f;
|
||||
line_output = float4(0.0f);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ struct VertIn {
|
||||
bool test_occlusion(float4 gpu_position)
|
||||
{
|
||||
float3 ndc = (gpu_position.xyz / gpu_position.w) * 0.5f + 0.5f;
|
||||
return ndc.z > texture(depthTex, ndc.xy).r;
|
||||
return ndc.z > texture(depth_tx, ndc.xy).r;
|
||||
}
|
||||
|
||||
float3 non_linear_blend_color(float3 col1, float3 col2, float fac)
|
||||
@@ -58,14 +58,14 @@ VertOut vertex_main(VertIn vert_in)
|
||||
|
||||
/* Offset Z position for retopology overlay. */
|
||||
vert_out.gpu_position.z += get_homogenous_z_offset(
|
||||
drw_view().winmat, view_pos.z, vert_out.gpu_position.w, retopologyOffset);
|
||||
drw_view().winmat, view_pos.z, vert_out.gpu_position.w, retopology_offset);
|
||||
|
||||
uint4 m_data = vert_in.e_data & uint4(dataMask);
|
||||
uint4 m_data = vert_in.e_data & uint4(data_mask);
|
||||
|
||||
#if defined(VERT)
|
||||
vertexCrease = float(m_data.z >> 4) / 15.0f;
|
||||
vert_out.final_color = EDIT_MESH_vertex_color(m_data.y, vertexCrease);
|
||||
gl_PointSize = sizeVertex * ((vertexCrease > 0.0f) ? 3.0f : 2.0f);
|
||||
vertex_crease = float(m_data.z >> 4) / 15.0f;
|
||||
vert_out.final_color = EDIT_MESH_vertex_color(m_data.y, vertex_crease);
|
||||
gl_PointSize = sizeVertex * ((vertex_crease > 0.0f) ? 3.0f : 2.0f);
|
||||
/* Make selected and active vertex always on top. */
|
||||
if ((data.x & VERT_SELECTED) != 0u) {
|
||||
vert_out.gpu_position.z -= 5e-7f * abs(vert_out.gpu_position.w);
|
||||
|
||||
@@ -19,13 +19,13 @@ VERTEX_SHADER_CREATE_INFO(overlay_mesh_loop_normal)
|
||||
bool test_occlusion()
|
||||
{
|
||||
float3 ndc = (gl_Position.xyz / gl_Position.w) * 0.5f + 0.5f;
|
||||
return (ndc.z - 0.00035f) > texture(depthTex, ndc.xy).r;
|
||||
return (ndc.z - 0.00035f) > texture(depth_tx, ndc.xy).r;
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Avoid undefined behavior after return. */
|
||||
finalColor = float4(0.0f);
|
||||
final_color = float4(0.0f);
|
||||
gl_Position = float4(0.0f);
|
||||
|
||||
#if defined(FACE_NORMAL) || defined(VERT_NORMAL) || defined(LOOP_NORMAL)
|
||||
@@ -63,7 +63,7 @@ void main()
|
||||
}
|
||||
# endif
|
||||
|
||||
finalColor = colorNormal;
|
||||
final_color = colorNormal;
|
||||
|
||||
#elif defined(VERT_NORMAL)
|
||||
# if defined(FLOAT_NORMAL)
|
||||
@@ -72,7 +72,7 @@ void main()
|
||||
# else
|
||||
nor = gpu_attr_load_uint_1010102_snorm(vnor, gpu_attr_0, vert_i).xyz;
|
||||
# endif
|
||||
finalColor = colorVNormal;
|
||||
final_color = colorVNormal;
|
||||
|
||||
#elif defined(LOOP_NORMAL)
|
||||
# if defined(FLOAT_NORMAL)
|
||||
@@ -86,7 +86,7 @@ void main()
|
||||
nor = gpu_attr_load_uint_1010102_snorm(lnor, gpu_attr_0, vert_i).xyz;
|
||||
}
|
||||
# endif
|
||||
finalColor = colorLNormal;
|
||||
final_color = colorLNormal;
|
||||
|
||||
#else
|
||||
|
||||
@@ -96,21 +96,21 @@ void main()
|
||||
return;
|
||||
}
|
||||
nor = lnor.xyz;
|
||||
finalColor = colorLNormal;
|
||||
final_color = colorLNormal;
|
||||
}
|
||||
else if (!all(equal(vnor.xyz, float3(0)))) {
|
||||
if (vnor.w < 0.0f) {
|
||||
return;
|
||||
}
|
||||
nor = vnor.xyz;
|
||||
finalColor = colorVNormal;
|
||||
final_color = colorVNormal;
|
||||
}
|
||||
else {
|
||||
nor = norAndFlag.xyz;
|
||||
if (all(equal(nor, float3(0)))) {
|
||||
return;
|
||||
}
|
||||
finalColor = colorNormal;
|
||||
final_color = colorNormal;
|
||||
}
|
||||
float3 ls_pos = pos;
|
||||
#endif
|
||||
@@ -119,27 +119,27 @@ void main()
|
||||
float3 world_pos = drw_point_object_to_world(ls_pos);
|
||||
|
||||
if ((gl_VertexID & 1) == 0) {
|
||||
if (isConstantScreenSizeNormals) {
|
||||
if (is_constant_screen_size_normals) {
|
||||
bool is_persp = (drw_view().winmat[3][3] == 0.0f);
|
||||
if (is_persp) {
|
||||
float dist_fac = length(drw_view_position() - world_pos);
|
||||
float cos_fac = dot(drw_view_forward(), drw_world_incident_vector(world_pos));
|
||||
world_pos += n * normalScreenSize * dist_fac * cos_fac * globalsBlock.pixel_fac *
|
||||
world_pos += n * normal_screen_size * dist_fac * cos_fac * globalsBlock.pixel_fac *
|
||||
sizePixel;
|
||||
}
|
||||
else {
|
||||
float frustrum_fac = mul_project_m4_v3_zfac(globalsBlock.pixel_fac, n) * sizePixel;
|
||||
world_pos += n * normalScreenSize * frustrum_fac;
|
||||
world_pos += n * normal_screen_size * frustrum_fac;
|
||||
}
|
||||
}
|
||||
else {
|
||||
world_pos += n * normalSize;
|
||||
world_pos += n * normal_size;
|
||||
}
|
||||
}
|
||||
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
finalColor.a *= (test_occlusion()) ? alpha : 1.0f;
|
||||
final_color.a *= (test_occlusion()) ? alpha : 1.0f;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ void main()
|
||||
|
||||
float theta = M_TAU * (float(vert_id) / 63.0f);
|
||||
float3 circle_P = float3(cos(theta), 0.0f, sin(theta));
|
||||
finalColor = colorSkinRoot;
|
||||
final_color = colorSkinRoot;
|
||||
#else
|
||||
float3 lP = local_pos;
|
||||
float circle_size = size;
|
||||
float3 circle_P = pos;
|
||||
/* Manual stipple: one segment out of 2 is transparent. */
|
||||
finalColor = ((gl_VertexID & 1) == 0) ? colorSkinRoot : float4(0.0f);
|
||||
final_color = ((gl_VertexID & 1) == 0) ? colorSkinRoot : float4(0.0f);
|
||||
#endif
|
||||
float3 screen_pos = (right * circle_P.x + up * circle_P.z) * circle_size;
|
||||
float4 pos_4d = drw_modelmat() * float4(lP + screen_pos, 1.0f);
|
||||
|
||||
@@ -17,15 +17,15 @@ VERTEX_SHADER_CREATE_INFO(overlay_edit_mesh_vert)
|
||||
|
||||
#ifdef EDGE
|
||||
/* Ugly but needed to keep the same vertex shader code for other passes. */
|
||||
# define finalColor geometry_in.finalColor_
|
||||
# define finalColorOuter geometry_in.finalColorOuter_
|
||||
# define final_color geometry_in.final_color_
|
||||
# define final_color_outer geometry_in.final_color_outer_
|
||||
# define selectOverride geometry_in.selectOverride_
|
||||
#endif
|
||||
|
||||
bool test_occlusion()
|
||||
{
|
||||
float3 ndc = (gl_Position.xyz / gl_Position.w) * 0.5f + 0.5f;
|
||||
float4 depths = textureGather(depthTex, ndc.xy);
|
||||
float4 depths = textureGather(depth_tx, ndc.xy);
|
||||
return all(greaterThan(float4(ndc.z), depths));
|
||||
}
|
||||
|
||||
@@ -45,14 +45,14 @@ void main()
|
||||
|
||||
/* Offset Z position for retopology overlay. */
|
||||
gl_Position.z += get_homogenous_z_offset(
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopologyOffset);
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopology_offset);
|
||||
|
||||
uint4 m_data = data & uint4(dataMask);
|
||||
uint4 m_data = data & uint4(data_mask);
|
||||
|
||||
#if defined(VERT)
|
||||
vertexCrease = float(m_data.z >> 4) / 15.0f;
|
||||
finalColor = EDIT_MESH_vertex_color(m_data.y, vertexCrease);
|
||||
gl_PointSize = sizeVertex * ((vertexCrease > 0.0f) ? 3.0f : 2.0f);
|
||||
vertex_crease = float(m_data.z >> 4) / 15.0f;
|
||||
final_color = EDIT_MESH_vertex_color(m_data.y, vertex_crease);
|
||||
gl_PointSize = sizeVertex * ((vertex_crease > 0.0f) ? 3.0f : 2.0f);
|
||||
/* Make selected and active vertex always on top. */
|
||||
if ((data.x & VERT_SELECTED) != 0u) {
|
||||
gl_Position.z -= 5e-7f * abs(gl_Position.w);
|
||||
@@ -65,25 +65,25 @@ void main()
|
||||
|
||||
#elif defined(EDGE)
|
||||
# ifdef FLAT
|
||||
finalColor = EDIT_MESH_edge_color_inner(m_data.y);
|
||||
final_color = EDIT_MESH_edge_color_inner(m_data.y);
|
||||
selectOverride = 1u;
|
||||
# else
|
||||
finalColor = EDIT_MESH_edge_vertex_color(m_data.y);
|
||||
final_color = EDIT_MESH_edge_vertex_color(m_data.y);
|
||||
selectOverride = (m_data.y & EDGE_SELECTED);
|
||||
# endif
|
||||
|
||||
float edge_crease = float(m_data.z & 0xFu) / 15.0f;
|
||||
float bweight = float(m_data.w) / 255.0f;
|
||||
finalColorOuter = EDIT_MESH_edge_color_outer(m_data.y, m_data.x, edge_crease, bweight);
|
||||
final_color_outer = EDIT_MESH_edge_color_outer(m_data.y, m_data.x, edge_crease, bweight);
|
||||
|
||||
if (finalColorOuter.a > 0.0f) {
|
||||
if (final_color_outer.a > 0.0f) {
|
||||
gl_Position.z -= 5e-7f * abs(gl_Position.w);
|
||||
}
|
||||
|
||||
bool occluded = false; /* Done in fragment shader */
|
||||
|
||||
#elif defined(FACE)
|
||||
finalColor = EDIT_MESH_face_color(m_data.x);
|
||||
final_color = EDIT_MESH_face_color(m_data.x);
|
||||
bool occluded = true;
|
||||
|
||||
# ifdef GPU_METAL
|
||||
@@ -92,7 +92,7 @@ void main()
|
||||
# endif
|
||||
|
||||
#elif defined(FACEDOT)
|
||||
finalColor = EDIT_MESH_facedot_color(norAndFlag.w);
|
||||
final_color = EDIT_MESH_facedot_color(norAndFlag.w);
|
||||
|
||||
/* Bias Face-dot Z position in clip-space. */
|
||||
gl_Position.z -= (drw_view().winmat[3][3] == 0.0f) ? 0.00035f : 1e-6f;
|
||||
@@ -102,7 +102,7 @@ void main()
|
||||
|
||||
#endif
|
||||
|
||||
finalColor.a *= (occluded) ? alpha : 1.0f;
|
||||
final_color.a *= (occluded) ? alpha : 1.0f;
|
||||
|
||||
#if !defined(FACE)
|
||||
/* Facing based color blend */
|
||||
@@ -113,9 +113,9 @@ void main()
|
||||
facing = 1.0f - abs(facing) * 0.2f;
|
||||
|
||||
/* Do interpolation in a non-linear space to have a better visual result. */
|
||||
finalColor.rgb = mix(finalColor.rgb,
|
||||
non_linear_blend_color(colorEditMeshMiddle.rgb, finalColor.rgb, facing),
|
||||
fresnelMixEdit);
|
||||
final_color.rgb = mix(final_color.rgb,
|
||||
non_linear_blend_color(colorEditMeshMiddle.rgb, final_color.rgb, facing),
|
||||
fresnelMixEdit);
|
||||
#endif
|
||||
|
||||
gl_Position.z -= ndc_offset_factor * ndc_offset;
|
||||
|
||||
@@ -27,7 +27,7 @@ float3 weight_to_rgb(float t)
|
||||
return float3(1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
return texture(weightTex, t).rgb;
|
||||
return texture(weight_tx, t).rgb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,8 +37,8 @@ void main()
|
||||
bool is_active = (data & EDIT_CURVES_ACTIVE_HANDLE) != 0u;
|
||||
bool is_bezier_handle = (data & EDIT_CURVES_BEZIER_HANDLE) != 0u;
|
||||
|
||||
if (is_bezier_handle && ((uint(curveHandleDisplay) == CURVE_HANDLE_NONE) ||
|
||||
(uint(curveHandleDisplay) == CURVE_HANDLE_SELECTED) && !is_active))
|
||||
if (is_bezier_handle && ((uint(curve_handle_display) == CURVE_HANDLE_NONE) ||
|
||||
(uint(curve_handle_display) == CURVE_HANDLE_SELECTED) && !is_active))
|
||||
{
|
||||
DISCARD_VERTEX
|
||||
}
|
||||
@@ -48,32 +48,32 @@ void main()
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
float end_point_size_factor = 1.0f;
|
||||
|
||||
if (useWeight) {
|
||||
finalColor = float4(weight_to_rgb(selection), 1.0f);
|
||||
if (use_weight) {
|
||||
final_color = float4(weight_to_rgb(selection), 1.0f);
|
||||
}
|
||||
else {
|
||||
float4 color_selected = useGreasePencil ? colorGpencilVertexSelect : colorVertexSelect;
|
||||
float4 color_not_selected = useGreasePencil ? colorGpencilVertex : colorVertex;
|
||||
finalColor = mix(color_not_selected, color_selected, selection);
|
||||
float4 color_selected = use_grease_pencil ? colorGpencilVertexSelect : colorVertexSelect;
|
||||
float4 color_not_selected = use_grease_pencil ? colorGpencilVertex : colorVertex;
|
||||
final_color = mix(color_not_selected, color_selected, selection);
|
||||
|
||||
#if 1 /* Should be checking CURVES_POINT */
|
||||
if (doStrokeEndpoints) {
|
||||
if (do_stroke_endpoints) {
|
||||
bool is_stroke_start = (vflag & GP_EDIT_STROKE_START) != 0u;
|
||||
bool is_stroke_end = (vflag & GP_EDIT_STROKE_END) != 0u;
|
||||
|
||||
if (is_stroke_start) {
|
||||
end_point_size_factor *= 2.0f;
|
||||
finalColor.rgb = float3(0.0f, 1.0f, 0.0f);
|
||||
final_color.rgb = float3(0.0f, 1.0f, 0.0f);
|
||||
}
|
||||
else if (is_stroke_end) {
|
||||
end_point_size_factor *= 1.5f;
|
||||
finalColor.rgb = float3(1.0f, 0.0f, 0.0f);
|
||||
final_color.rgb = float3(1.0f, 0.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
float vsize = useGreasePencil ? sizeVertexGpencil : sizeVertex;
|
||||
float vsize = use_grease_pencil ? sizeVertexGpencil : sizeVertex;
|
||||
gl_PointSize = vsize * 2.0f * end_point_size_factor;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
@@ -23,7 +23,7 @@ float3 weight_to_rgb(float t)
|
||||
return float3(1.0f, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
return texture(weightTex, t).rgb;
|
||||
return texture(weight_tx, t).rgb;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ void main()
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
if (useWeight) {
|
||||
finalColor = float4(weight_to_rgb(selection), 1.0f);
|
||||
if (use_weight) {
|
||||
final_color = float4(weight_to_rgb(selection), 1.0f);
|
||||
}
|
||||
else {
|
||||
float4 use_color = useGreasePencil ? colorGpencilVertexSelect : colorVertexSelect;
|
||||
finalColor = mix(colorWireEdit, use_color, selection);
|
||||
float4 use_color = use_grease_pencil ? colorGpencilVertexSelect : colorVertexSelect;
|
||||
final_color = mix(colorWireEdit, use_color, selection);
|
||||
}
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
@@ -12,7 +12,7 @@ VERTEX_SHADER_CREATE_INFO(overlay_edit_pointcloud)
|
||||
|
||||
void main()
|
||||
{
|
||||
finalColor = colorVertexSelect;
|
||||
final_color = colorVertexSelect;
|
||||
|
||||
float radius = pos_rad.w;
|
||||
float3 world_pos = drw_point_object_to_world(pos_rad.xyz);
|
||||
|
||||
@@ -27,44 +27,44 @@ void main()
|
||||
float4 inner_color = float4(float3(0.0f), 1.0f);
|
||||
float4 outer_color = float4(0.0f);
|
||||
|
||||
float2 dd = fwidth(stipplePos);
|
||||
float line_distance = distance(stipplePos, stippleStart) / max(dd.x, dd.y);
|
||||
float2 dd = fwidth(stipple_pos);
|
||||
float line_distance = distance(stipple_pos, stipple_start) / max(dd.x, dd.y);
|
||||
|
||||
if (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_OUTLINE) {
|
||||
if (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_OUTLINE) {
|
||||
if (use_edge_select) {
|
||||
/* TODO(@ideasman42): The current wire-edit color contrast enough against the selection.
|
||||
* Look into changing the default theme color instead of reducing contrast with edge-select.
|
||||
*/
|
||||
inner_color = (selectionFac != 0.0f) ? colorEdgeSelect : (colorWireEdit * 0.5f);
|
||||
inner_color = (selection_fac != 0.0f) ? colorEdgeSelect : (colorWireEdit * 0.5f);
|
||||
}
|
||||
else {
|
||||
inner_color = mix(colorWireEdit, colorEdgeSelect, selectionFac);
|
||||
inner_color = mix(colorWireEdit, colorEdgeSelect, selection_fac);
|
||||
}
|
||||
outer_color = float4(float3(0.0f), 1.0f);
|
||||
}
|
||||
else if (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_DASH) {
|
||||
if (fract(line_distance / dashLength) < 0.5f) {
|
||||
inner_color = mix(float4(float3(0.35f), 1.0f), colorEdgeSelect, selectionFac);
|
||||
else if (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_DASH) {
|
||||
if (fract(line_distance / dash_length) < 0.5f) {
|
||||
inner_color = mix(float4(float3(0.35f), 1.0f), colorEdgeSelect, selection_fac);
|
||||
}
|
||||
}
|
||||
else if (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_BLACK) {
|
||||
else if (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_BLACK) {
|
||||
float4 base_color = float4(float3(0.0f), 1.0f);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selectionFac);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selection_fac);
|
||||
}
|
||||
else if (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_WHITE) {
|
||||
else if (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_WHITE) {
|
||||
float4 base_color = float4(1.0f);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selectionFac);
|
||||
inner_color = mix(base_color, colorEdgeSelect, selection_fac);
|
||||
}
|
||||
else if (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_SHADOW) {
|
||||
else if (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_SHADOW) {
|
||||
inner_color = colorUVShadow;
|
||||
}
|
||||
|
||||
float dist = abs(edgeCoord) - max(sizeEdge - 0.5f, 0.0f);
|
||||
float dist = abs(edge_coord) - max(sizeEdge - 0.5f, 0.0f);
|
||||
float dist_outer = dist - max(sizeEdge, 1.0f);
|
||||
float mix_w;
|
||||
float mix_w_outer;
|
||||
|
||||
if (doSmoothWire) {
|
||||
if (do_smooth_wire) {
|
||||
mix_w = smoothstep(GRID_LINE_SMOOTH_START, GRID_LINE_SMOOTH_END, dist);
|
||||
mix_w_outer = smoothstep(GRID_LINE_SMOOTH_START, GRID_LINE_SMOOTH_END, dist_outer);
|
||||
}
|
||||
@@ -80,5 +80,5 @@ void main()
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
final_color.a *= is_active ? alpha : (alpha * 0.25f);
|
||||
|
||||
fragColor = final_color;
|
||||
frag_color = final_color;
|
||||
}
|
||||
|
||||
@@ -78,10 +78,10 @@ struct GeomOut {
|
||||
|
||||
void export_vertex(GeomOut geom_out)
|
||||
{
|
||||
selectionFac = float(geom_out.selected);
|
||||
stippleStart = geom_out.stipple_start;
|
||||
stipplePos = geom_out.stipple_pos;
|
||||
edgeCoord = geom_out.edge_coord;
|
||||
selection_fac = float(geom_out.selected);
|
||||
stipple_start = geom_out.stipple_start;
|
||||
stipple_pos = geom_out.stipple_pos;
|
||||
edge_coord = geom_out.edge_coord;
|
||||
gl_Position = geom_out.gpu_position;
|
||||
}
|
||||
|
||||
@@ -111,11 +111,11 @@ void geometry_main(VertOut geom_in[2],
|
||||
float half_size = sizeEdge;
|
||||
/* Enlarge edge for outline drawing. */
|
||||
/* Factor of 3.0 out of nowhere! Seems to fix issues with float imprecision. */
|
||||
half_size += (OVERLAY_UVLineStyle(lineStyle) == OVERLAY_UV_LINE_STYLE_OUTLINE) ?
|
||||
max(sizeEdge * (doSmoothWire ? 1.0f : 3.0f), 1.0f) :
|
||||
half_size += (OVERLAY_UVLineStyle(line_style) == OVERLAY_UV_LINE_STYLE_OUTLINE) ?
|
||||
max(sizeEdge * (do_smooth_wire ? 1.0f : 3.0f), 1.0f) :
|
||||
0.0f;
|
||||
/* Add 1 PX for AA. */
|
||||
if (doSmoothWire) {
|
||||
if (do_smooth_wire) {
|
||||
half_size += 0.5f;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,6 @@ void main()
|
||||
float3 world_pos = float3(au, 0.0f);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
finalColor = ((flag & FACE_UV_SELECT) != 0u) ? colorFaceDot : float4(colorWire.rgb, 1.0f);
|
||||
gl_PointSize = pointSize;
|
||||
final_color = ((flag & FACE_UV_SELECT) != 0u) ? colorFaceDot : float4(colorWire.rgb, 1.0f);
|
||||
gl_PointSize = dot_size;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ void main()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_object_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
finalColor = (is_selected) ? colorFaceSelect : colorFace;
|
||||
finalColor = (is_active) ? colorEditMeshActive : finalColor;
|
||||
finalColor.a *= is_object_active ? uvOpacity : (uvOpacity * 0.25f);
|
||||
final_color = (is_selected) ? colorFaceSelect : colorFace;
|
||||
final_color = (is_active) ? colorEditMeshActive : final_color;
|
||||
final_color.a *= is_object_active ? uv_opacity : (uv_opacity * 0.25f);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_edit_uv_mask_image)
|
||||
void main()
|
||||
{
|
||||
float2 uvs_clamped = clamp(uvs, 0.0f, 1.0f);
|
||||
float mask_value = texture_read_as_linearrgb(imgTexture, true, uvs_clamped).r;
|
||||
float mask_value = texture_read_as_linearrgb(img_tx, true, uvs_clamped).r;
|
||||
mask_value = mix(1.0f, mask_value, opacity);
|
||||
fragColor = float4(color.rgb * mask_value, color.a);
|
||||
frag_color = float4(color.rgb * mask_value, color.a);
|
||||
}
|
||||
|
||||
@@ -83,9 +83,9 @@ void main()
|
||||
stretch = stretch;
|
||||
stretch = 1.0f - stretch * stretch;
|
||||
#else
|
||||
float stretch = 1.0f - area_ratio_to_stretch(ratio, totalAreaRatio);
|
||||
float stretch = 1.0f - area_ratio_to_stretch(ratio, total_area_ratio);
|
||||
|
||||
#endif
|
||||
|
||||
finalColor = float4(weight_to_rgb(stretch), stretch_opacity);
|
||||
final_color = float4(weight_to_rgb(stretch), stretch_opacity);
|
||||
}
|
||||
|
||||
@@ -25,10 +25,10 @@ void main()
|
||||
float midStroke = 0.5f * (radii[1] + radii[2]);
|
||||
|
||||
if (dist > midStroke) {
|
||||
fragColor.rgb = outlineColor.rgb;
|
||||
fragColor.a = mix(outlineColor.a, 0.0f, smoothstep(radii[1], radii[0], dist));
|
||||
frag_color.rgb = outline_color.rgb;
|
||||
frag_color.a = mix(outline_color.a, 0.0f, smoothstep(radii[1], radii[0], dist));
|
||||
}
|
||||
else {
|
||||
fragColor = mix(fillColor, outlineColor, smoothstep(radii[3], radii[2], dist));
|
||||
frag_color = mix(fill_color, outline_color, smoothstep(radii[3], radii[2], dist));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ void main()
|
||||
bool is_selected = (flag & (VERT_UV_SELECT | FACE_UV_SELECT)) != 0u;
|
||||
bool is_pinned = (flag & VERT_UV_PINNED) != 0u;
|
||||
float4 deselect_col = (is_pinned) ? pinned_col : float4(color.rgb, 1.0f);
|
||||
fillColor = (is_selected) ? colorVertexSelect : deselect_col;
|
||||
outlineColor = (is_pinned) ? pinned_col : float4(fillColor.rgb, 0.0f);
|
||||
fill_color = (is_selected) ? colorVertexSelect : deselect_col;
|
||||
outline_color = (is_pinned) ? pinned_col : float4(fill_color.rgb, 0.0f);
|
||||
|
||||
float3 world_pos = float3(au, 0.0f);
|
||||
/* Move selected vertices to the top
|
||||
@@ -26,17 +26,17 @@ void main()
|
||||
* actual pixels are at 0.75, 1.0 is used for the background. */
|
||||
float depth = is_selected ? (is_pinned ? 0.05f : 0.10f) : 0.15f;
|
||||
gl_Position = float4(drw_point_world_to_homogenous(world_pos).xy, depth, 1.0f);
|
||||
gl_PointSize = pointSize;
|
||||
gl_PointSize = dot_size;
|
||||
|
||||
/* calculate concentric radii in pixels */
|
||||
float radius = 0.5f * pointSize;
|
||||
float radius = 0.5f * dot_size;
|
||||
|
||||
/* start at the outside and progress toward the center */
|
||||
radii[0] = radius;
|
||||
radii[1] = radius - 1.0f;
|
||||
radii[2] = radius - outlineWidth;
|
||||
radii[3] = radius - outlineWidth - 1.0f;
|
||||
radii[2] = radius - outline_width;
|
||||
radii[3] = radius - outline_width - 1.0f;
|
||||
|
||||
/* convert to PointCoord units */
|
||||
radii /= pointSize;
|
||||
radii /= dot_size;
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_extra_groundline)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
#ifdef IS_SPOT_CONE
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
#else
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
|
||||
line_output = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
select_id_output(select_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ VERTEX_SHADER_CREATE_INFO(overlay_extra_groundline)
|
||||
void main()
|
||||
{
|
||||
select_id_set(in_select_buf[gl_InstanceID]);
|
||||
finalColor = colorLight;
|
||||
final_color = colorLight;
|
||||
|
||||
/* Relative to DPI scaling. Have constant screen size. */
|
||||
float3 screen_pos = drw_view().viewinv[0].xyz * pos.x + drw_view().viewinv[1].xyz * pos.y;
|
||||
@@ -27,7 +27,7 @@ void main()
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
/* Convert to screen position [0..sizeVp]. */
|
||||
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_pos = edge_start = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ VERTEX_SHADER_CREATE_INFO(draw_modelmat)
|
||||
|
||||
float4 color_from_id(float color_id)
|
||||
{
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return colorTransform;
|
||||
}
|
||||
else if (color_id == 1.0f) {
|
||||
@@ -27,7 +27,7 @@ float4 color_from_id(float color_id)
|
||||
return colorTransform;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* SHIFT = (32 - (16 - 2)) */
|
||||
#define SHIFT 18u
|
||||
@@ -35,12 +35,13 @@ float4 color_from_id(float color_id)
|
||||
void main()
|
||||
{
|
||||
select_id_set(drw_custom_id());
|
||||
float4x4 model_mat = gridModelMatrix;
|
||||
float4x4 model_mat = grid_model_matrix;
|
||||
model_mat[0][3] = model_mat[1][3] = model_mat[2][3] = 0.0f;
|
||||
model_mat[3][3] = 1.0f;
|
||||
float color_id = gridModelMatrix[3].w;
|
||||
float color_id = grid_model_matrix[3].w;
|
||||
|
||||
int3 grid_resolution = int3(gridModelMatrix[0].w, gridModelMatrix[1].w, gridModelMatrix[2].w);
|
||||
int3 grid_resolution = int3(
|
||||
grid_model_matrix[0].w, grid_model_matrix[1].w, grid_model_matrix[2].w);
|
||||
|
||||
float3 ls_cell_location;
|
||||
/* Keep in sync with update_irradiance_probe */
|
||||
@@ -56,16 +57,16 @@ void main()
|
||||
gl_Position = drw_point_world_to_homogenous(ws_cell_location);
|
||||
gl_PointSize = sizeVertex * 2.0f;
|
||||
|
||||
finalColor = color_from_id(color_id);
|
||||
final_color = color_from_id(color_id);
|
||||
|
||||
/* Shade occluded points differently. */
|
||||
float4 p = gl_Position / gl_Position.w;
|
||||
float z_depth = texture(depthBuffer, p.xy * 0.5f + 0.5f).r * 2.0f - 1.0f;
|
||||
float z_depth = texture(depth_buffer, p.xy * 0.5f + 0.5f).r * 2.0f - 1.0f;
|
||||
float z_delta = p.z - z_depth;
|
||||
if (z_delta > 0.0f) {
|
||||
float fac = 1.0f - z_delta * 10000.0f;
|
||||
/* Smooth blend to avoid flickering. */
|
||||
finalColor = mix(colorBackground, finalColor, clamp(fac, 0.2f, 1.0f));
|
||||
final_color = mix(colorBackground, final_color, clamp(fac, 0.2f, 1.0f));
|
||||
}
|
||||
|
||||
view_clipping_distances(ws_cell_location);
|
||||
|
||||
@@ -14,11 +14,11 @@ void main()
|
||||
float fac = dist * dist * 4.0f;
|
||||
/* Non linear blend. */
|
||||
float4 col1 = sqrt(colorEditMeshMiddle);
|
||||
float4 col2 = sqrt(finalColor);
|
||||
fragColor = mix(col1, col2, 0.45f + fac * 0.65f);
|
||||
fragColor *= fragColor;
|
||||
float4 col2 = sqrt(final_color);
|
||||
frag_color = mix(col1, col2, 0.45f + fac * 0.65f);
|
||||
frag_color *= frag_color;
|
||||
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
|
||||
/* Make the effect more like a fresnel by offsetting
|
||||
* the depth and creating mini-spheres.
|
||||
|
||||
@@ -13,7 +13,7 @@ VERTEX_SHADER_CREATE_INFO(draw_modelmat)
|
||||
|
||||
void main()
|
||||
{
|
||||
finalColor = data_buf[gl_VertexID].color_;
|
||||
final_color = data_buf[gl_VertexID].color_;
|
||||
|
||||
float3 world_pos = (drw_modelmat() * float4(data_buf[gl_VertexID].pos_.xyz, 1.0f)).xyz;
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
@@ -28,8 +28,8 @@ void main()
|
||||
radii[3] = radius - outline_width - 1.0f;
|
||||
radii /= sizeObjectCenter;
|
||||
|
||||
fillColor = data_buf[gl_VertexID].color_;
|
||||
outlineColor = colorOutline;
|
||||
fill_color = data_buf[gl_VertexID].color_;
|
||||
outline_color = colorOutline;
|
||||
|
||||
#ifdef SELECT_ENABLE
|
||||
/* Selection frame-buffer can be very small.
|
||||
|
||||
@@ -65,9 +65,9 @@ void main()
|
||||
obmat[0][3] = obmat[1][3] = obmat[2][3] = 0.0f;
|
||||
obmat[3][3] = 1.0f;
|
||||
|
||||
finalColor = color;
|
||||
final_color = color;
|
||||
if (color.a < 0.0f) {
|
||||
finalColor.a = 1.0f;
|
||||
final_color.a = 1.0f;
|
||||
}
|
||||
|
||||
float lamp_spot_sine;
|
||||
@@ -120,16 +120,16 @@ void main()
|
||||
/* Override color. */
|
||||
switch (int(camera_distance_color)) {
|
||||
case 0: /* Mist */
|
||||
finalColor = float4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
final_color = float4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
break;
|
||||
case 1: /* Mist Active */
|
||||
finalColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
final_color = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
case 2: /* Clip */
|
||||
finalColor = float4(0.5f, 0.5f, 0.25f, 1.0f);
|
||||
final_color = float4(0.5f, 0.5f, 0.25f, 1.0f);
|
||||
break;
|
||||
case 3: /* Clip Active */
|
||||
finalColor = float4(1.0f, 1.0f, 0.5f, 1.0f);
|
||||
final_color = float4(1.0f, 1.0f, 0.5f, 1.0f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -162,8 +162,8 @@ void main()
|
||||
|
||||
float3 axis_color = float3(0.0f);
|
||||
axis_color[int(axis)] = 1.0f;
|
||||
finalColor.rgb = mix(axis_color + fract(axis), color.rgb, color.a);
|
||||
finalColor.a = 1.0f;
|
||||
final_color.rgb = mix(axis_color + fract(axis), color.rgb, color.a);
|
||||
final_color.a = 1.0f;
|
||||
}
|
||||
|
||||
/* Not exclusive with previous flags. */
|
||||
@@ -173,16 +173,16 @@ void main()
|
||||
float color_intensity = fract(color.r);
|
||||
switch (color_class) {
|
||||
case 0: /* No eye (convergence plane). */
|
||||
finalColor = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
final_color = float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
case 1: /* Left eye. */
|
||||
finalColor = float4(0.0f, 1.0f, 1.0f, 1.0f);
|
||||
final_color = float4(0.0f, 1.0f, 1.0f, 1.0f);
|
||||
break;
|
||||
case 2: /* Right eye. */
|
||||
finalColor = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
final_color = float4(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
finalColor *= float4(float3(color_intensity), color.g);
|
||||
final_color *= float4(float3(color_intensity), color.g);
|
||||
}
|
||||
|
||||
float3 world_pos;
|
||||
@@ -230,7 +230,7 @@ void main()
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
/* Convert to screen position [0..sizeVp]. */
|
||||
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_pos = edge_start = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
#if defined(SELECT_ENABLE)
|
||||
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
|
||||
|
||||
@@ -11,22 +11,22 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_extra_wire_base)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
|
||||
/* Stipple */
|
||||
constexpr float dash_width = 6.0f;
|
||||
constexpr float dash_factor = 0.5f;
|
||||
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, stipple_start, stipple_coord);
|
||||
line_output = pack_line_data(gl_FragCoord.xy, stipple_start, stipple_coord);
|
||||
|
||||
float dist = distance(stipple_start, stipple_coord);
|
||||
|
||||
if (fragColor.a == 0.0f) {
|
||||
if (frag_color.a == 0.0f) {
|
||||
/* Disable stippling. */
|
||||
dist = 0.0f;
|
||||
}
|
||||
|
||||
fragColor.a = 1.0f;
|
||||
frag_color.a = 1.0f;
|
||||
|
||||
#ifndef SELECT_ENABLE
|
||||
/* Discarding inside the selection will create some undefined behavior.
|
||||
|
||||
@@ -39,24 +39,24 @@ void main()
|
||||
|
||||
#ifdef OBJECT_WIRE
|
||||
/* Extract data packed inside the unused float4x4 members. */
|
||||
finalColor = float4(
|
||||
final_color = float4(
|
||||
drw_modelmat()[0][3], drw_modelmat()[1][3], drw_modelmat()[2][3], drw_modelmat()[3][3]);
|
||||
#else
|
||||
|
||||
if (colorid != 0) {
|
||||
/* TH_CAMERA_PATH is the only color code at the moment.
|
||||
* Checking `colorid != 0` to avoid having to sync its value with the GLSL code. */
|
||||
finalColor = colorCameraPath;
|
||||
finalColor.a = 0.0f; /* No Stipple */
|
||||
final_color = colorCameraPath;
|
||||
final_color.a = 0.0f; /* No Stipple */
|
||||
}
|
||||
else {
|
||||
finalColor = color;
|
||||
finalColor.a = 1.0f; /* Stipple */
|
||||
final_color = color;
|
||||
final_color.a = 1.0f; /* Stipple */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SELECT_ENABLE)
|
||||
finalColor.a = 0.0f; /* No Stipple */
|
||||
final_color.a = 0.0f; /* No Stipple */
|
||||
#endif
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
@@ -8,7 +8,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_facing_base)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = gl_FrontFacing ? colorFaceFront : colorFaceBack;
|
||||
frag_color = gl_FrontFacing ? colorFaceFront : colorFaceBack;
|
||||
/* Pre-multiply the output as we do not do any blending in the frame-buffer. */
|
||||
fragColor.rgb *= fragColor.a;
|
||||
frag_color.rgb *= frag_color.a;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_grid_background)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = ucolor;
|
||||
float scene_depth = texelFetch(depthBuffer, int2(gl_FragCoord.xy), 0).r;
|
||||
fragColor.a = (scene_depth == 1.0f) ? 1.0f : 0.0f;
|
||||
frag_color = ucolor;
|
||||
float scene_depth = texelFetch(depth_buffer, int2(gl_FragCoord.xy), 0).r;
|
||||
frag_color.a = (scene_depth == 1.0f) ? 1.0f : 0.0f;
|
||||
}
|
||||
|
||||
@@ -13,23 +13,23 @@ void main()
|
||||
{
|
||||
float2 uvs_clamped = clamp(uvs, 0.0f, 1.0f);
|
||||
float4 tex_color;
|
||||
tex_color = texture_read_as_linearrgb(imgTexture, imgPremultiplied, uvs_clamped);
|
||||
tex_color = texture_read_as_linearrgb(img_tx, img_premultiplied, uvs_clamped);
|
||||
|
||||
fragColor = tex_color * ucolor;
|
||||
frag_color = tex_color * ucolor;
|
||||
|
||||
if (!imgAlphaBlend) {
|
||||
if (!img_alpha_blend) {
|
||||
/* Arbitrary discard anything below 5% opacity.
|
||||
* Note that this could be exposed to the User. */
|
||||
if (tex_color.a < 0.05f) {
|
||||
discard;
|
||||
}
|
||||
else {
|
||||
fragColor.a = 1.0f;
|
||||
frag_color.a = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pre-multiplied blending. */
|
||||
fragColor.rgb *= fragColor.a;
|
||||
frag_color.rgb *= frag_color.a;
|
||||
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@ void main()
|
||||
{
|
||||
select_id_set(drw_custom_id());
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
if (isCameraBackground) {
|
||||
if (is_camera_background) {
|
||||
/* Model matrix converts to view position to avoid jittering (see #91398). */
|
||||
#ifdef DEPTH_BIAS
|
||||
gl_Position = depth_bias_winmat * float4(world_pos, 1.0f);
|
||||
@@ -36,7 +36,7 @@ void main()
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
if (depthSet) {
|
||||
if (depth_set) {
|
||||
/* Result in a position at 1.0 (far plane). Small epsilon to avoid precision issue.
|
||||
* This mimics the effect of infinite projection matrix
|
||||
* (see http://www.terathon.com/gdc07_lengyel.pdf). */
|
||||
|
||||
@@ -8,5 +8,5 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_motion_path_line)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = interp.color;
|
||||
frag_color = interp.color;
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ struct VertOut {
|
||||
float4 color;
|
||||
};
|
||||
|
||||
#define frameCurrent mpathLineSettings.x
|
||||
#define frameStart mpathLineSettings.y
|
||||
#define frameEnd mpathLineSettings.z
|
||||
#define cacheStart mpathLineSettings.w
|
||||
#define frameCurrent mpath_line_settings.x
|
||||
#define frameStart mpath_line_settings.y
|
||||
#define frameEnd mpath_line_settings.z
|
||||
#define cacheStart mpath_line_settings.w
|
||||
|
||||
VertOut vertex_main(VertIn vert_in)
|
||||
{
|
||||
@@ -55,13 +55,13 @@ VertOut vertex_main(VertIn vert_in)
|
||||
float3 blend_base = (abs(frame - frameCurrent) == 0) ?
|
||||
colorCurrentFrame.rgb :
|
||||
colorBackground.rgb; /* "bleed" CFRAME color to ease color blending */
|
||||
bool use_custom_color = customColorPre.x >= 0.0f;
|
||||
bool use_custom_color = custom_color_pre.x >= 0.0f;
|
||||
|
||||
if (frame < frameCurrent) {
|
||||
vert_out.color.rgb = use_custom_color ? customColorPre : colorBeforeFrame.rgb;
|
||||
vert_out.color.rgb = use_custom_color ? custom_color_pre : colorBeforeFrame.rgb;
|
||||
}
|
||||
else if (frame > frameCurrent) {
|
||||
vert_out.color.rgb = use_custom_color ? customColorPost : colorAfterFrame.rgb;
|
||||
vert_out.color.rgb = use_custom_color ? custom_color_post : colorAfterFrame.rgb;
|
||||
}
|
||||
else /* if (frame == frameCurrent) */ {
|
||||
vert_out.color.rgb = use_custom_color ? colorCurrentFrame.rgb : blend_base;
|
||||
@@ -108,7 +108,7 @@ void geometry_main(VertOut geom_in[2],
|
||||
float2 edge_dir = orthogonal(normalize(ss_P1 - ss_P0 + 1e-8f)) * sizeViewportInv;
|
||||
|
||||
bool is_persp = (drw_view().winmat[3][3] == 0.0f);
|
||||
float line_size = float(lineThickness) * sizePixel;
|
||||
float line_size = float(line_thickness) * sizePixel;
|
||||
|
||||
GeomOut geom_out;
|
||||
|
||||
|
||||
@@ -9,52 +9,52 @@ VERTEX_SHADER_CREATE_INFO(overlay_motion_path_point)
|
||||
#include "draw_view_clipping_lib.glsl"
|
||||
#include "draw_view_lib.glsl"
|
||||
|
||||
#define pointSize mpathPointSettings.x
|
||||
#define frameCurrent mpathPointSettings.y
|
||||
#define cacheStart mpathPointSettings.z
|
||||
#define stepSize mpathPointSettings.w
|
||||
|
||||
void main()
|
||||
{
|
||||
int pt_size = mpath_point_settings.x;
|
||||
int frameCurrent = mpath_point_settings.y;
|
||||
int cacheStart = mpath_point_settings.z;
|
||||
int stepSize = mpath_point_settings.w;
|
||||
|
||||
gl_Position = drw_view().winmat *
|
||||
(drw_view().viewmat * (camera_space_matrix * float4(pos, 1.0f)));
|
||||
gl_PointSize = float(pointSize + 2);
|
||||
gl_PointSize = float(pt_size + 2);
|
||||
|
||||
int frame = gl_VertexID + cacheStart;
|
||||
bool use_custom_color = customColorPre.x >= 0.0f;
|
||||
finalColor = (use_custom_color) ? float4(customColorPre, 1.0f) : colorVertex;
|
||||
bool use_custom_color = custom_color_pre.x >= 0.0f;
|
||||
final_color = (use_custom_color) ? float4(custom_color_pre, 1.0f) : colorVertex;
|
||||
|
||||
/* Bias to reduce z fighting with the path */
|
||||
gl_Position.z -= 1e-4f;
|
||||
|
||||
if (gl_VertexID % stepSize == 0) {
|
||||
gl_PointSize = float(pointSize) + 4;
|
||||
gl_PointSize = float(pt_size) + 4;
|
||||
}
|
||||
|
||||
/* Draw special dot where the current frame is. */
|
||||
if (frame == frameCurrent) {
|
||||
gl_PointSize = float(pointSize + 8);
|
||||
finalColor = colorCurrentFrame;
|
||||
gl_PointSize = float(pt_size + 8);
|
||||
final_color = colorCurrentFrame;
|
||||
/* Bias more to get these on top of keyframes */
|
||||
gl_Position.z -= 1e-4f;
|
||||
}
|
||||
else if (frame < frameCurrent) {
|
||||
if (use_custom_color) {
|
||||
finalColor = float4(customColorPre, 1.0f);
|
||||
final_color = float4(custom_color_pre, 1.0f);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* frame > frameCurrent */
|
||||
if (use_custom_color) {
|
||||
finalColor = float4(customColorPost, 1.0f);
|
||||
final_color = float4(custom_color_post, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
if (showKeyFrames) {
|
||||
if (show_key_frames) {
|
||||
/* Overrides the color to highlight points that are keyframes. */
|
||||
if ((uint(flag) & MOTIONPATH_VERT_KEY) != 0u) {
|
||||
gl_PointSize = float(pointSize + 5);
|
||||
finalColor = colorVertexSelect;
|
||||
gl_PointSize = float(pt_size + 5);
|
||||
final_color = colorVertexSelect;
|
||||
/* Bias more to get these on top of regular points */
|
||||
gl_Position.z -= 1e-4f;
|
||||
}
|
||||
|
||||
@@ -42,13 +42,13 @@ bool4 gather_edges(float2 uv, uint ref)
|
||||
{
|
||||
uint4 ids;
|
||||
#ifdef GPU_ARB_texture_gather
|
||||
ids = textureGather(outlineId, uv);
|
||||
ids = textureGather(outline_id_tx, uv);
|
||||
#else
|
||||
float3 ofs = float3(0.5f, 0.5f, -0.5f) * sizeViewportInv.xyy;
|
||||
ids.x = textureLod(outlineId, uv - ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outlineId, uv + ofs.xy, 0.0f).r;
|
||||
ids.z = textureLod(outlineId, uv + ofs.xz, 0.0f).r;
|
||||
ids.w = textureLod(outlineId, uv - ofs.xy, 0.0f).r;
|
||||
ids.x = textureLod(outline_id_tx, uv - ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outline_id_tx, uv + ofs.xy, 0.0f).r;
|
||||
ids.z = textureLod(outline_id_tx, uv + ofs.xz, 0.0f).r;
|
||||
ids.w = textureLod(outline_id_tx, uv - ofs.xy, 0.0f).r;
|
||||
#endif
|
||||
|
||||
return notEqual(ids, uint4(ref));
|
||||
@@ -166,7 +166,7 @@ void diag_dir(bool4 edges1, bool4 edges2, out float2 line_start, out float2 line
|
||||
|
||||
void main()
|
||||
{
|
||||
uint ref = textureLod(outlineId, screen_uv, 0.0f).r;
|
||||
uint ref = textureLod(outline_id_tx, screen_uv, 0.0f).r;
|
||||
uint ref_col = ref;
|
||||
|
||||
float2 uvs = gl_FragCoord.xy * sizeViewportInv;
|
||||
@@ -178,25 +178,25 @@ void main()
|
||||
#ifdef GPU_ARB_texture_gather
|
||||
/* Reminder: Samples order is CW starting from top left. */
|
||||
uint2 tmp1, tmp2, tmp3, tmp4;
|
||||
if (doThickOutlines) {
|
||||
tmp1 = textureGather(outlineId, uvs + ofs.xy * float2(1.5f, -0.5f)).xy;
|
||||
tmp2 = textureGather(outlineId, uvs + ofs.xy * float2(-1.5f, -0.5f)).yx;
|
||||
tmp3 = textureGather(outlineId, uvs + ofs.xy * float2(0.5f, 1.5f)).wx;
|
||||
tmp4 = textureGather(outlineId, uvs + ofs.xy * float2(0.5f, -1.5f)).xw;
|
||||
if (do_thick_outlines) {
|
||||
tmp1 = textureGather(outline_id_tx, uvs + ofs.xy * float2(1.5f, -0.5f)).xy;
|
||||
tmp2 = textureGather(outline_id_tx, uvs + ofs.xy * float2(-1.5f, -0.5f)).yx;
|
||||
tmp3 = textureGather(outline_id_tx, uvs + ofs.xy * float2(0.5f, 1.5f)).wx;
|
||||
tmp4 = textureGather(outline_id_tx, uvs + ofs.xy * float2(0.5f, -1.5f)).xw;
|
||||
ids.x = tmp1.x;
|
||||
ids.y = tmp2.x;
|
||||
ids.z = tmp3.x;
|
||||
ids.w = tmp4.x;
|
||||
}
|
||||
else {
|
||||
ids.xz = textureGather(outlineId, uvs + ofs.xy * 0.5f).zx;
|
||||
ids.yw = textureGather(outlineId, uvs - ofs.xy * 0.5f).xz;
|
||||
ids.xz = textureGather(outline_id_tx, uvs + ofs.xy * 0.5f).zx;
|
||||
ids.yw = textureGather(outline_id_tx, uvs - ofs.xy * 0.5f).xz;
|
||||
}
|
||||
#else
|
||||
ids.x = textureLod(outlineId, uvs + ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outlineId, uvs - ofs.xz, 0.0f).r;
|
||||
ids.z = textureLod(outlineId, uvs + ofs.zy, 0.0f).r;
|
||||
ids.w = textureLod(outlineId, uvs - ofs.zy, 0.0f).r;
|
||||
ids.x = textureLod(outline_id_tx, uvs + ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outline_id_tx, uvs - ofs.xz, 0.0f).r;
|
||||
ids.z = textureLod(outline_id_tx, uvs + ofs.zy, 0.0f).r;
|
||||
ids.w = textureLod(outline_id_tx, uvs - ofs.zy, 0.0f).r;
|
||||
#endif
|
||||
|
||||
bool has_edge_pos_x = has_edge(ids.x, uvs + ofs.xz, ref, ref_col, depth_uv);
|
||||
@@ -204,7 +204,7 @@ void main()
|
||||
bool has_edge_pos_y = has_edge(ids.z, uvs + ofs.zy, ref, ref_col, depth_uv);
|
||||
bool has_edge_neg_y = has_edge(ids.w, uvs - ofs.zy, ref, ref_col, depth_uv);
|
||||
|
||||
if (doThickOutlines) {
|
||||
if (do_thick_outlines) {
|
||||
if (!any(bool4(has_edge_pos_x, has_edge_neg_x, has_edge_pos_y, has_edge_neg_y))) {
|
||||
#ifdef GPU_ARB_texture_gather
|
||||
ids.x = tmp1.y;
|
||||
@@ -212,10 +212,10 @@ void main()
|
||||
ids.z = tmp3.y;
|
||||
ids.w = tmp4.y;
|
||||
#else
|
||||
ids.x = textureLod(outlineId, uvs + 2.0f * ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outlineId, uvs - 2.0f * ofs.xz, 0.0f).r;
|
||||
ids.z = textureLod(outlineId, uvs + 2.0f * ofs.zy, 0.0f).r;
|
||||
ids.w = textureLod(outlineId, uvs - 2.0f * ofs.zy, 0.0f).r;
|
||||
ids.x = textureLod(outline_id_tx, uvs + 2.0f * ofs.xz, 0.0f).r;
|
||||
ids.y = textureLod(outline_id_tx, uvs - 2.0f * ofs.xz, 0.0f).r;
|
||||
ids.z = textureLod(outline_id_tx, uvs + 2.0f * ofs.zy, 0.0f).r;
|
||||
ids.w = textureLod(outline_id_tx, uvs - 2.0f * ofs.zy, 0.0f).r;
|
||||
#endif
|
||||
|
||||
has_edge_pos_x = has_edge(ids.x, uvs + 2.0f * ofs.xz, ref, ref_col, depth_uv);
|
||||
@@ -225,35 +225,35 @@ void main()
|
||||
}
|
||||
}
|
||||
|
||||
if (isXrayWires) {
|
||||
if (is_xray_wires) {
|
||||
/* Don't inflate the wire outlines too much. */
|
||||
has_edge_neg_x = has_edge_neg_y = false;
|
||||
}
|
||||
|
||||
/* WATCH: Keep in sync with outlineId of the pre-pass. */
|
||||
/* WATCH: Keep in sync with outline_id_tx of the pre-pass. */
|
||||
uint color_id = ref_col >> 14u;
|
||||
if (ref_col == 0u) {
|
||||
fragColor = float4(0.0f);
|
||||
frag_color = float4(0.0f);
|
||||
}
|
||||
else if (color_id == 1u) {
|
||||
fragColor = colorSelect;
|
||||
frag_color = colorSelect;
|
||||
}
|
||||
else if (color_id == 3u) {
|
||||
fragColor = colorActive;
|
||||
frag_color = colorActive;
|
||||
}
|
||||
else {
|
||||
fragColor = colorTransform;
|
||||
frag_color = colorTransform;
|
||||
}
|
||||
|
||||
float ref_depth = textureLod(outlineDepth, depth_uv, 0.0f).r;
|
||||
float scene_depth = textureLod(sceneDepth, depth_uv, 0.0f).r;
|
||||
float ref_depth = textureLod(outline_depth_tx, depth_uv, 0.0f).r;
|
||||
float scene_depth = textureLod(scene_depth_tx, depth_uv, 0.0f).r;
|
||||
|
||||
/* Avoid bad cases of Z-fighting for occlusion only. */
|
||||
constexpr float epsilon = 3.0f / 8388608.0f;
|
||||
bool occluded = (ref_depth > scene_depth + epsilon);
|
||||
|
||||
/* NOTE: We never set alpha to 1.0 to avoid Anti-aliasing destroying the line. */
|
||||
fragColor *= (occluded ? alphaOcclu : 1.0f) * (254.0f / 255.0f);
|
||||
frag_color *= (occluded ? alpha_occlu : 1.0f) * (254.0f / 255.0f);
|
||||
|
||||
int edge_case = 0;
|
||||
edge_case += int(has_edge_pos_x) * XPOS;
|
||||
@@ -269,8 +269,8 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!doAntiAliasing) {
|
||||
lineOutput = float4(0.0f);
|
||||
if (!do_anti_aliasing) {
|
||||
line_output = float4(0.0f);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -367,5 +367,5 @@ void main()
|
||||
break;
|
||||
}
|
||||
|
||||
lineOutput = pack_line_data(float2(0.0f), line_start, line_end);
|
||||
line_output = pack_line_data(float2(0.0f), line_start, line_end);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ uint outline_colorid_get()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return 0u; /* colorTransform */
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -31,7 +31,7 @@ uint outline_colorid_get()
|
||||
return 0u;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* `float3 world_pos = drw_point_object_to_world(pos);`
|
||||
* `SHIFT = (32 - (16 - 2))`. */
|
||||
|
||||
@@ -29,8 +29,8 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gpStrokeOrder3d) {
|
||||
/* Stroke order 2D. Project to gpDepthPlane. */
|
||||
if (!gp_stroke_order3d) {
|
||||
/* Stroke order 2D. Project to gp_depth_plane. */
|
||||
bool is_persp = drw_view().winmat[3][3] == 0.0f;
|
||||
float2 uvs = float2(gl_FragCoord.xy) * sizeViewportInv;
|
||||
float3 pos_ndc = float3(uvs, gl_FragCoord.z) * 2.0f - 1.0f;
|
||||
@@ -39,7 +39,7 @@ void main()
|
||||
|
||||
float3 ray_ori = pos;
|
||||
float3 ray_dir = (is_persp) ? (drw_view().viewinv[3].xyz - pos) : drw_view().viewinv[2].xyz;
|
||||
float3 isect = ray_plane_intersection(ray_ori, ray_dir, gpDepthPlane);
|
||||
float3 isect = ray_plane_intersection(ray_ori, ray_dir, gp_depth_plane);
|
||||
float4 ndc = drw_point_world_to_homogenous(isect);
|
||||
gl_FragDepth = (ndc.z / ndc.w) * 0.5f + 0.5f;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ uint outline_colorid_get()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return 0u; /* colorTransform */
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -30,7 +30,7 @@ uint outline_colorid_get()
|
||||
return 0u;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* SHIFT = (32 - (16 - 2)) */
|
||||
#define SHIFT 18u
|
||||
|
||||
@@ -18,7 +18,7 @@ uint outline_colorid_get()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return 0u; /* colorTransform */
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -31,7 +31,7 @@ uint outline_colorid_get()
|
||||
return 0u;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* SHIFT = (32 - (16 - 2)) */
|
||||
#define SHIFT 18u
|
||||
|
||||
@@ -17,7 +17,7 @@ uint outline_colorid_get()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return 0u; /* colorTransform */
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -30,7 +30,7 @@ uint outline_colorid_get()
|
||||
return 0u;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* SHIFT = (32 - (16 - 2)) */
|
||||
#define SHIFT 18u
|
||||
|
||||
@@ -19,7 +19,7 @@ uint outline_colorid_get()
|
||||
eObjectInfoFlag ob_flag = drw_object_infos().flag;
|
||||
bool is_active = flag_test(ob_flag, OBJECT_ACTIVE);
|
||||
|
||||
if (isTransform) {
|
||||
if (is_transform) {
|
||||
return 0u; /* colorTransform */
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -45,7 +45,7 @@ VertIn input_assembly(uint in_vertex_id)
|
||||
return vert_in;
|
||||
}
|
||||
|
||||
/* Replace top 2 bits (of the 16bit output) by outlineId.
|
||||
/* Replace top 2 bits (of the 16bit output) by outline_id.
|
||||
* This leaves 16K different IDs to create outlines between objects.
|
||||
* SHIFT = (32 - (16 - 2)) */
|
||||
#define SHIFT 18u
|
||||
|
||||
@@ -25,8 +25,8 @@ void main()
|
||||
gl_Position = float4(-2.0f, -2.0f, -2.0f, 1.0f);
|
||||
}
|
||||
|
||||
finalColor = (is_select) ? float4(1.0f) : colorWire;
|
||||
finalColor.a = nor.w;
|
||||
final_color = (is_select) ? float4(1.0f) : colorWire;
|
||||
final_color.a = nor.w;
|
||||
|
||||
gl_PointSize = sizeVertex * 2.0f;
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_paint_texture)
|
||||
|
||||
void main()
|
||||
{
|
||||
float4 mask = float4(texture_read_as_srgb(maskImage, maskImagePremultiplied, uv_interp).rgb,
|
||||
float4 mask = float4(texture_read_as_srgb(mask_image, mask_image_premultiplied, uv_interp).rgb,
|
||||
1.0f);
|
||||
if (maskInvertStencil) {
|
||||
if (mask_invert_stencil) {
|
||||
mask.rgb = 1.0f - mask.rgb;
|
||||
}
|
||||
float mask_step = smoothstep(0.0f, 3.0f, mask.r + mask.g + mask.b);
|
||||
mask.rgb *= maskColor;
|
||||
mask.rgb *= mask_color;
|
||||
mask.a = mask_step * opacity;
|
||||
|
||||
fragColor = mask;
|
||||
frag_color = mask;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ void main()
|
||||
weight_color = apply_color_fac(weight_color);
|
||||
|
||||
/* Contour display */
|
||||
if (drawContours) {
|
||||
if (draw_contours) {
|
||||
/* This must be executed uniformly for all fragments */
|
||||
float weight_gradient = length(float2(dFdx(weight), dFdy(weight)));
|
||||
|
||||
@@ -102,6 +102,6 @@ void main()
|
||||
color = mix(weight_color, color_unreferenced, alert * alert);
|
||||
}
|
||||
|
||||
fragColor = float4(color.rgb, opacity);
|
||||
lineOutput = float4(0.0f);
|
||||
frag_color = float4(color.rgb, opacity);
|
||||
line_output = float4(0.0f);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ VERTEX_SHADER_CREATE_INFO(overlay_paint_wire)
|
||||
|
||||
void main()
|
||||
{
|
||||
bool is_select = (nor.w > 0.0f) && useSelect;
|
||||
bool is_hidden = (nor.w < 0.0f) && useSelect;
|
||||
bool is_select = (nor.w > 0.0f) && use_select;
|
||||
bool is_hidden = (nor.w < 0.0f) && use_select;
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
@@ -27,11 +27,11 @@ void main()
|
||||
|
||||
constexpr float4 colSel = float4(1.0f);
|
||||
|
||||
finalColor = (is_select) ? colSel : colorWire;
|
||||
final_color = (is_select) ? colSel : colorWire;
|
||||
|
||||
/* Weight paint needs a light color to contrasts with dark weights. */
|
||||
if (!useSelect) {
|
||||
finalColor = float4(1.0f, 1.0f, 1.0f, 0.3f);
|
||||
if (!use_select) {
|
||||
final_color = float4(1.0f, 1.0f, 1.0f, 0.3f);
|
||||
}
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
@@ -20,7 +20,7 @@ void main()
|
||||
}
|
||||
/* Nice sphere falloff. */
|
||||
float intensity = sqrt(1.0f - dist * 2.0f) * 0.5f + 0.5f;
|
||||
fragColor = finalColor * float4(intensity, intensity, intensity, 1.0f);
|
||||
frag_color = final_color * float4(intensity, intensity, intensity, 1.0f);
|
||||
|
||||
/* The default value of GL_POINT_SPRITE_COORD_ORIGIN is GL_UPPER_LEFT. Need to reverse the Y. */
|
||||
uv.y = -uv.y;
|
||||
@@ -28,7 +28,7 @@ void main()
|
||||
float2 edge_pos = gl_FragCoord.xy - uv * (0.75f / (dist + 1e-9f));
|
||||
float2 edge_start = edge_pos + float2(-uv.y, uv.x);
|
||||
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
line_output = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ void wire_color_get(out float3 rim_col, out float3 wire_col)
|
||||
rim_col = colorWire.rgb;
|
||||
wire_col = colorWire.rgb;
|
||||
}
|
||||
else if (is_selected && useColoring) {
|
||||
if (isTransform) {
|
||||
else if (is_selected && use_coloring) {
|
||||
if (is_transform) {
|
||||
rim_col = colorTransform.rgb;
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -63,7 +63,7 @@ void wire_object_color_get(out float3 rim_col, out float3 wire_col)
|
||||
ObjectInfos info = drw_object_infos();
|
||||
bool is_selected = flag_test(info.flag, OBJECT_SELECTED);
|
||||
|
||||
if (colorType == V3D_SHADING_OBJECT_COLOR) {
|
||||
if (color_type == V3D_SHADING_OBJECT_COLOR) {
|
||||
rim_col = wire_col = drw_object_infos().ob_color.rgb * 0.5f;
|
||||
}
|
||||
else {
|
||||
@@ -72,7 +72,7 @@ void wire_object_color_get(out float3 rim_col, out float3 wire_col)
|
||||
rim_col = wire_col = hsv_to_rgb(hsv);
|
||||
}
|
||||
|
||||
if (is_selected && useColoring) {
|
||||
if (is_selected && use_coloring) {
|
||||
/* "Normalize" color. */
|
||||
wire_col += 1e-4f; /* Avoid division by 0. */
|
||||
float brightness = max(wire_col.x, max(wire_col.y, wire_col.z));
|
||||
@@ -94,10 +94,10 @@ void main()
|
||||
|
||||
gl_Position = drw_point_world_to_homogenous(ws_P);
|
||||
|
||||
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_start = edge_pos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
float3 rim_col, wire_col;
|
||||
if (colorType == V3D_SHADING_OBJECT_COLOR || colorType == V3D_SHADING_RANDOM_COLOR) {
|
||||
if (color_type == V3D_SHADING_OBJECT_COLOR || color_type == V3D_SHADING_RANDOM_COLOR) {
|
||||
wire_object_color_get(rim_col, wire_col);
|
||||
}
|
||||
else {
|
||||
@@ -110,9 +110,9 @@ void main()
|
||||
rim_col = sqrt(rim_col);
|
||||
wire_col = sqrt(wire_col);
|
||||
float3 final_front_col = mix(rim_col, wire_col, 0.35f);
|
||||
finalColor.rgb = mix(rim_col, final_front_col, facing);
|
||||
finalColor.rgb = square(finalColor.rgb);
|
||||
finalColor.a = 1.0f;
|
||||
final_color.rgb = mix(rim_col, final_front_col, facing);
|
||||
final_color.rgb = square(final_color.rgb);
|
||||
final_color.a = 1.0f;
|
||||
|
||||
view_clipping_distances(ws_P);
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_particle_shape_base)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
|
||||
line_output = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -72,13 +72,13 @@ void main()
|
||||
break;
|
||||
}
|
||||
|
||||
finalColor = float4(1.0f);
|
||||
final_color = float4(1.0f);
|
||||
if (shape_type == PART_SHAPE_AXIS) {
|
||||
/* Works because of flat interpolation. */
|
||||
finalColor.rgb = shape_pos;
|
||||
final_color.rgb = shape_pos;
|
||||
}
|
||||
else {
|
||||
finalColor.rgb = part.value < 0.0f ? ucolor.rgb : texture(weightTex, part.value).rgb;
|
||||
final_color.rgb = part.value < 0.0f ? ucolor.rgb : texture(weight_tx, part.value).rgb;
|
||||
}
|
||||
|
||||
/* Draw-size packed in alpha. */
|
||||
@@ -93,7 +93,7 @@ void main()
|
||||
world_pos += rotate(shape_pos, part.rotation);
|
||||
}
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
edgeStart = edgePos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_start = edge_pos = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ void main()
|
||||
|
||||
/* Coloring */
|
||||
if (part_val < 0.0f) {
|
||||
finalColor = float4(ucolor.rgb, 1.0f);
|
||||
final_color = float4(ucolor.rgb, 1.0f);
|
||||
}
|
||||
else {
|
||||
finalColor = float4(texture(weightTex, part_val).rgb, 1.0f);
|
||||
final_color = float4(texture(weight_tx, part_val).rgb, 1.0f);
|
||||
}
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
|
||||
@@ -21,18 +21,18 @@ void main()
|
||||
}
|
||||
|
||||
#if defined(VERT)
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
|
||||
float midStroke = 0.5f * rad_squared;
|
||||
if (vertexCrease > 0.0f && dist_squared > midStroke) {
|
||||
fragColor.rgb = mix(finalColor.rgb, colorEdgeCrease.rgb, vertexCrease);
|
||||
if (vertex_crease > 0.0f && dist_squared > midStroke) {
|
||||
frag_color.rgb = mix(final_color.rgb, colorEdgeCrease.rgb, vertex_crease);
|
||||
}
|
||||
#else
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
#endif
|
||||
|
||||
#ifdef LINE_OUTPUT
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
#endif
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ void main()
|
||||
float midStroke = 0.5f * (radii[1] + radii[2]);
|
||||
|
||||
if (dist > midStroke) {
|
||||
fragColor.rgb = outlineColor.rgb;
|
||||
fragColor.a = mix(outlineColor.a, 0.0f, smoothstep(radii[1], radii[0], dist));
|
||||
frag_color.rgb = outline_color.rgb;
|
||||
frag_color.a = mix(outline_color.a, 0.0f, smoothstep(radii[1], radii[0], dist));
|
||||
}
|
||||
else {
|
||||
fragColor = mix(fillColor, outlineColor, smoothstep(radii[3], radii[2], dist));
|
||||
frag_color = mix(fill_color, outline_color, smoothstep(radii[3], radii[2], dist));
|
||||
}
|
||||
|
||||
select_id_output(select_id);
|
||||
|
||||
@@ -15,9 +15,9 @@ void main()
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
finalColor = float4(selection);
|
||||
finalColor.a *= opacity;
|
||||
final_color = float4(selection);
|
||||
final_color.a *= opacity;
|
||||
|
||||
/* Convert to screen position [0..sizeVp]. */
|
||||
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_pos = edge_start = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
}
|
||||
|
||||
@@ -8,5 +8,5 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_sculpt_mask)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = float4(faceset_color * mask_color, 1.0f);
|
||||
frag_color = float4(faceset_color * mask_color, 1.0f);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,8 @@ void main()
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
faceset_color = mix(float3(1.0f), fset, faceSetsOpacity);
|
||||
mask_color = 1.0f - (msk * maskOpacity);
|
||||
faceset_color = mix(float3(1.0f), fset, face_sets_opacity);
|
||||
mask_color = 1.0f - (msk * mask_opacity);
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_paint_face)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = ucolor;
|
||||
frag_color = ucolor;
|
||||
#ifdef LINE_OUTPUT
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -10,9 +10,9 @@ VERTEX_SHADER_CREATE_INFO(overlay_volume_velocity_mac)
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = finalColor;
|
||||
frag_color = final_color;
|
||||
#ifdef LINE_OUTPUT
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
#endif
|
||||
select_id_output(select_id);
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ void main()
|
||||
{
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
finalColor = attribute_value;
|
||||
final_color = attribute_value;
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ void main()
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
if (is_point_domain) {
|
||||
finalColor = texelFetch(color_tx, hair_get_base_id());
|
||||
final_color = texelFetch(color_tx, hair_get_base_id());
|
||||
}
|
||||
else {
|
||||
finalColor = texelFetch(color_tx, hair_get_strand_id());
|
||||
final_color = texelFetch(color_tx, hair_get_strand_id());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ FRAGMENT_SHADER_CREATE_INFO(overlay_viewer_attribute_pointcloud)
|
||||
|
||||
void main()
|
||||
{
|
||||
out_color = finalColor;
|
||||
out_color = final_color;
|
||||
out_color.a *= opacity;
|
||||
/* Writing to this second texture is necessary to avoid undefined behavior. */
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
}
|
||||
|
||||
@@ -14,5 +14,5 @@ void main()
|
||||
{
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
finalColor = attribute_value;
|
||||
final_color = attribute_value;
|
||||
}
|
||||
|
||||
@@ -15,5 +15,5 @@ void main()
|
||||
{
|
||||
float3 world_pos = pointcloud_get_pos();
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
finalColor = pointcloud_get_customdata_vec4(attribute_tx);
|
||||
final_color = pointcloud_get_customdata_vec4(attribute_tx);
|
||||
}
|
||||
|
||||
@@ -45,23 +45,23 @@ void main()
|
||||
float3x3 rot_mat = float3x3(0.0f);
|
||||
|
||||
float3 cell_offset = float3(0.5f);
|
||||
int3 cell_div = volumeSize;
|
||||
if (sliceAxis == 0) {
|
||||
cell_offset.x = slicePosition * float(volumeSize.x);
|
||||
int3 cell_div = volume_size;
|
||||
if (slice_axis == 0) {
|
||||
cell_offset.x = slice_position * float(volume_size.x);
|
||||
cell_div.x = 1;
|
||||
rot_mat[2].x = 1.0f;
|
||||
rot_mat[0].y = 1.0f;
|
||||
rot_mat[1].z = 1.0f;
|
||||
}
|
||||
else if (sliceAxis == 1) {
|
||||
cell_offset.y = slicePosition * float(volumeSize.y);
|
||||
else if (slice_axis == 1) {
|
||||
cell_offset.y = slice_position * float(volume_size.y);
|
||||
cell_div.y = 1;
|
||||
rot_mat[1].x = 1.0f;
|
||||
rot_mat[2].y = 1.0f;
|
||||
rot_mat[0].z = 1.0f;
|
||||
}
|
||||
else if (sliceAxis == 2) {
|
||||
cell_offset.z = slicePosition * float(volumeSize.z);
|
||||
else if (slice_axis == 2) {
|
||||
cell_offset.z = slice_position * float(volume_size.z);
|
||||
cell_div.z = 1;
|
||||
rot_mat[0].x = 1.0f;
|
||||
rot_mat[1].y = 1.0f;
|
||||
@@ -73,21 +73,21 @@ void main()
|
||||
cell_co.y = (cell / cell_div.x) % cell_div.y;
|
||||
cell_co.z = cell / (cell_div.x * cell_div.y);
|
||||
|
||||
finalColor = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
final_color = float4(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
#if defined(SHOW_FLAGS) || defined(SHOW_RANGE)
|
||||
uint flag = texelFetch(flagTexture, cell_co + int3(cell_offset), 0).r;
|
||||
uint flag = texelFetch(flag_tx, cell_co + int3(cell_offset), 0).r;
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_FLAGS
|
||||
finalColor = flag_to_color(flag);
|
||||
final_color = flag_to_color(flag);
|
||||
#endif
|
||||
|
||||
#ifdef SHOW_RANGE
|
||||
float value = texelFetch(fieldTexture, cell_co + int3(cell_offset), 0).r;
|
||||
if (value >= lowerBound && value <= upperBound) {
|
||||
if (cellFilter == 0 || bool(uint(cellFilter) & flag)) {
|
||||
finalColor = rangeColor;
|
||||
float value = texelFetch(field_tx, cell_co + int3(cell_offset), 0).r;
|
||||
if (value >= lower_bound && value <= upper_bound) {
|
||||
if (cell_filter == 0 || bool(uint(cell_filter) & flag)) {
|
||||
final_color = range_color;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -102,10 +102,10 @@ void main()
|
||||
float3(0.45f, -0.45f, 0.0f),
|
||||
float3(-0.45f, -0.45f, 0.0f));
|
||||
|
||||
float3 pos = domainOriginOffset +
|
||||
cellSize * (float3(cell_co + adaptiveCellOffset) + cell_offset);
|
||||
float3 pos = domain_origin_offset +
|
||||
cell_size * (float3(cell_co + adaptive_cell_offset) + cell_offset);
|
||||
float3 rotated_pos = rot_mat * corners[indices[gl_VertexID % 8]];
|
||||
pos += rotated_pos * cellSize;
|
||||
pos += rotated_pos * cell_size;
|
||||
|
||||
float3 world_pos = drw_point_object_to_world(pos);
|
||||
gl_Position = drw_point_world_to_homogenous(world_pos);
|
||||
|
||||
@@ -56,9 +56,9 @@ float3 get_vector(int3 cell_co)
|
||||
{
|
||||
float3 vector;
|
||||
|
||||
vector.x = texelFetch(velocityX, cell_co, 0).r;
|
||||
vector.y = texelFetch(velocityY, cell_co, 0).r;
|
||||
vector.z = texelFetch(velocityZ, cell_co, 0).r;
|
||||
vector.x = texelFetch(velocity_x, cell_co, 0).r;
|
||||
vector.y = texelFetch(velocity_y, cell_co, 0).r;
|
||||
vector.z = texelFetch(velocity_z, cell_co, 0).r;
|
||||
|
||||
return vector;
|
||||
}
|
||||
@@ -68,12 +68,12 @@ float3 get_vector_centered(int3 cell_co)
|
||||
{
|
||||
float3 vector;
|
||||
|
||||
vector.x = 0.5f * (texelFetch(velocityX, cell_co, 0).r +
|
||||
texelFetch(velocityX, int3(cell_co.x + 1, cell_co.yz), 0).r);
|
||||
vector.y = 0.5f * (texelFetch(velocityY, cell_co, 0).r +
|
||||
texelFetch(velocityY, int3(cell_co.x, cell_co.y + 1, cell_co.z), 0).r);
|
||||
vector.z = 0.5f * (texelFetch(velocityZ, cell_co, 0).r +
|
||||
texelFetch(velocityZ, int3(cell_co.xy, cell_co.z + 1), 0).r);
|
||||
vector.x = 0.5f * (texelFetch(velocity_x, cell_co, 0).r +
|
||||
texelFetch(velocity_x, int3(cell_co.x + 1, cell_co.yz), 0).r);
|
||||
vector.y = 0.5f * (texelFetch(velocity_y, cell_co, 0).r +
|
||||
texelFetch(velocity_y, int3(cell_co.x, cell_co.y + 1, cell_co.z), 0).r);
|
||||
vector.z = 0.5f * (texelFetch(velocity_z, cell_co, 0).r +
|
||||
texelFetch(velocity_z, int3(cell_co.xy, cell_co.z + 1), 0).r);
|
||||
|
||||
return vector;
|
||||
}
|
||||
@@ -83,12 +83,12 @@ float3 get_vector_mac(int3 cell_co)
|
||||
{
|
||||
float3 vector;
|
||||
|
||||
vector.x = 0.5f * (texelFetch(velocityX, int3(cell_co.x - 1, cell_co.yz), 0).r +
|
||||
texelFetch(velocityX, cell_co, 0).r);
|
||||
vector.y = 0.5f * (texelFetch(velocityY, int3(cell_co.x, cell_co.y - 1, cell_co.z), 0).r +
|
||||
texelFetch(velocityY, cell_co, 0).r);
|
||||
vector.z = 0.5f * (texelFetch(velocityZ, int3(cell_co.xy, cell_co.z - 1), 0).r +
|
||||
texelFetch(velocityZ, cell_co, 0).r);
|
||||
vector.x = 0.5f * (texelFetch(velocity_x, int3(cell_co.x - 1, cell_co.yz), 0).r +
|
||||
texelFetch(velocity_x, cell_co, 0).r);
|
||||
vector.y = 0.5f * (texelFetch(velocity_y, int3(cell_co.x, cell_co.y - 1, cell_co.z), 0).r +
|
||||
texelFetch(velocity_y, cell_co, 0).r);
|
||||
vector.z = 0.5f * (texelFetch(velocity_z, int3(cell_co.xy, cell_co.z - 1), 0).r +
|
||||
texelFetch(velocity_z, cell_co, 0).r);
|
||||
|
||||
return vector;
|
||||
}
|
||||
@@ -105,20 +105,20 @@ void main()
|
||||
int cell = gl_VertexID / 2;
|
||||
#endif
|
||||
|
||||
int3 volume_size = textureSize(velocityX, 0);
|
||||
int3 volume_size = textureSize(velocity_x, 0);
|
||||
|
||||
int3 cell_ofs = int3(0);
|
||||
int3 cell_div = volume_size;
|
||||
if (sliceAxis == 0) {
|
||||
cell_ofs.x = int(slicePosition * float(volume_size.x));
|
||||
if (slice_axis == 0) {
|
||||
cell_ofs.x = int(slice_position * float(volume_size.x));
|
||||
cell_div.x = 1;
|
||||
}
|
||||
else if (sliceAxis == 1) {
|
||||
cell_ofs.y = int(slicePosition * float(volume_size.y));
|
||||
else if (slice_axis == 1) {
|
||||
cell_ofs.y = int(slice_position * float(volume_size.y));
|
||||
cell_div.y = 1;
|
||||
}
|
||||
else if (sliceAxis == 2) {
|
||||
cell_ofs.z = int(slicePosition * float(volume_size.z));
|
||||
else if (slice_axis == 2) {
|
||||
cell_ofs.z = int(slice_position * float(volume_size.z));
|
||||
cell_div.z = 1;
|
||||
}
|
||||
|
||||
@@ -128,50 +128,50 @@ void main()
|
||||
cell_co.z = cell / (cell_div.x * cell_div.y);
|
||||
cell_co += cell_ofs;
|
||||
|
||||
float3 pos = domainOriginOffset + cellSize * (float3(cell_co + adaptiveCellOffset) + 0.5f);
|
||||
float3 pos = domain_origin_offset + cell_size * (float3(cell_co + adaptive_cell_offset) + 0.5f);
|
||||
|
||||
float3 vector;
|
||||
|
||||
#ifdef USE_MAC
|
||||
float3 color;
|
||||
vector = (isCellCentered) ? get_vector_mac(cell_co) : get_vector(cell_co);
|
||||
vector = (is_cell_centered) ? get_vector_mac(cell_co) : get_vector(cell_co);
|
||||
|
||||
switch (gl_VertexID % 6) {
|
||||
case 0: /* Tail of X component. */
|
||||
pos.x += (drawMACX) ? -0.5f * cellSize.x : 0.0f;
|
||||
pos.x += (draw_macx) ? -0.5f * cell_size.x : 0.0f;
|
||||
color = float3(1.0f, 0.0f, 0.0f); /* red */
|
||||
break;
|
||||
case 1: /* Head of X component. */
|
||||
pos.x += (drawMACX) ? (-0.5f + vector.x * displaySize) * cellSize.x : 0.0f;
|
||||
pos.x += (draw_macx) ? (-0.5f + vector.x * display_size) * cell_size.x : 0.0f;
|
||||
color = float3(1.0f, 1.0f, 0.0f); /* yellow */
|
||||
break;
|
||||
case 2: /* Tail of Y component. */
|
||||
pos.y += (drawMACY) ? -0.5f * cellSize.y : 0.0f;
|
||||
pos.y += (draw_macy) ? -0.5f * cell_size.y : 0.0f;
|
||||
color = float3(0.0f, 1.0f, 0.0f); /* green */
|
||||
break;
|
||||
case 3: /* Head of Y component. */
|
||||
pos.y += (drawMACY) ? (-0.5f + vector.y * displaySize) * cellSize.y : 0.0f;
|
||||
pos.y += (draw_macy) ? (-0.5f + vector.y * display_size) * cell_size.y : 0.0f;
|
||||
color = float3(1.0f, 1.0f, 0.0f); /* yellow */
|
||||
break;
|
||||
case 4: /* Tail of Z component. */
|
||||
pos.z += (drawMACZ) ? -0.5f * cellSize.z : 0.0f;
|
||||
pos.z += (draw_macz) ? -0.5f * cell_size.z : 0.0f;
|
||||
color = float3(0.0f, 0.0f, 1.0f); /* blue */
|
||||
break;
|
||||
case 5: /* Head of Z component. */
|
||||
pos.z += (drawMACZ) ? (-0.5f + vector.z * displaySize) * cellSize.z : 0.0f;
|
||||
pos.z += (draw_macz) ? (-0.5f + vector.z * display_size) * cell_size.z : 0.0f;
|
||||
color = float3(1.0f, 1.0f, 0.0f); /* yellow */
|
||||
break;
|
||||
}
|
||||
|
||||
finalColor = float4(color, 1.0f);
|
||||
final_color = float4(color, 1.0f);
|
||||
#else
|
||||
vector = (isCellCentered) ? get_vector(cell_co) : get_vector_centered(cell_co);
|
||||
vector = (is_cell_centered) ? get_vector(cell_co) : get_vector_centered(cell_co);
|
||||
|
||||
finalColor = float4(weight_to_color(length(vector)), 1.0f);
|
||||
final_color = float4(weight_to_color(length(vector)), 1.0f);
|
||||
|
||||
float vector_length = 1.0f;
|
||||
|
||||
if (scaleWithMagnitude) {
|
||||
if (scale_with_magnitude) {
|
||||
vector_length = length(vector);
|
||||
}
|
||||
else if (length(vector) == 0.0f) {
|
||||
@@ -191,10 +191,10 @@ void main()
|
||||
constexpr int indices[12] = int_array(0, 1, 1, 2, 2, 0, 0, 3, 1, 3, 2, 3);
|
||||
|
||||
float3 rotated_pos = rot_mat * corners[indices[gl_VertexID % 12]];
|
||||
pos += rotated_pos * vector_length * displaySize * cellSize;
|
||||
pos += rotated_pos * vector_length * display_size * cell_size;
|
||||
# else
|
||||
float3 rotated_pos = rot_mat * float3(0.0f, 0.0f, 1.0f);
|
||||
pos += ((gl_VertexID % 2) == 1) ? rotated_pos * vector_length * displaySize * cellSize :
|
||||
pos += ((gl_VertexID % 2) == 1) ? rotated_pos * vector_length * display_size * cell_size :
|
||||
float3(0.0f);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@@ -15,13 +15,13 @@ void main()
|
||||
#if !defined(POINTS) && !defined(CURVES)
|
||||
/* Needed only because of wireframe slider.
|
||||
* If we could get rid of it would be nice because of performance drain of discard. */
|
||||
if (edgeStart.r == -1.0f) {
|
||||
if (edge_start.r == -1.0f) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
lineOutput = float4(0.0f);
|
||||
line_output = float4(0.0f);
|
||||
|
||||
#if defined(POINTS)
|
||||
float2 centered = abs(gl_PointCoord - float2(0.5f));
|
||||
@@ -30,23 +30,23 @@ void main()
|
||||
float fac = dist * dist * 4.0f;
|
||||
/* Create a small gradient so that dense objects have a small fresnel effect. */
|
||||
/* Non linear blend. */
|
||||
float3 rim_col = sqrt(finalColorInner.rgb);
|
||||
float3 wire_col = sqrt(finalColor.rgb);
|
||||
float3 rim_col = sqrt(final_color_inner.rgb);
|
||||
float3 wire_col = sqrt(final_color.rgb);
|
||||
float3 final_front_col = mix(rim_col, wire_col, 0.35f);
|
||||
fragColor = float4(mix(final_front_col, rim_col, saturate(fac)), 1.0f);
|
||||
fragColor *= fragColor;
|
||||
frag_color = float4(mix(final_front_col, rim_col, saturate(fac)), 1.0f);
|
||||
frag_color *= frag_color;
|
||||
|
||||
#elif !defined(SELECT_ENABLE)
|
||||
lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos);
|
||||
fragColor = finalColor;
|
||||
line_output = pack_line_data(gl_FragCoord.xy, edge_start, edge_pos);
|
||||
frag_color = final_color;
|
||||
|
||||
# if !defined(CURVES)
|
||||
if (use_custom_depth_bias) {
|
||||
float2 dir = lineOutput.xy * 2.0f - 1.0f;
|
||||
float2 dir = line_output.xy * 2.0f - 1.0f;
|
||||
bool dir_horiz = abs(dir.x) > abs(dir.y);
|
||||
|
||||
float2 uv = gl_FragCoord.xy * sizeViewportInv;
|
||||
float depth_occluder = texture(depthTex, uv).r;
|
||||
float depth_occluder = texture(depth_tx, uv).r;
|
||||
float depth_min = depth_occluder;
|
||||
float2 uv_offset = sizeViewportInv;
|
||||
if (dir_horiz) {
|
||||
@@ -56,8 +56,8 @@ void main()
|
||||
uv_offset.x = 0.0f;
|
||||
}
|
||||
|
||||
depth_min = min(depth_min, texture(depthTex, uv - uv_offset).r);
|
||||
depth_min = min(depth_min, texture(depthTex, uv + uv_offset).r);
|
||||
depth_min = min(depth_min, texture(depth_tx, uv - uv_offset).r);
|
||||
depth_min = min(depth_min, texture(depth_tx, uv + uv_offset).r);
|
||||
|
||||
float delta = abs(depth_occluder - depth_min);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ VERTEX_SHADER_CREATE_INFO(overlay_wireframe)
|
||||
#if !defined(POINTS) && !defined(CURVES)
|
||||
bool is_edge_sharpness_visible(float wire_data)
|
||||
{
|
||||
return wire_data <= wireStepParam;
|
||||
return wire_data <= wire_step_param;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -33,8 +33,8 @@ void wire_color_get(out float3 rim_col, out float3 wire_col)
|
||||
rim_col = colorWire.rgb;
|
||||
wire_col = colorWire.rgb;
|
||||
}
|
||||
else if (is_selected && useColoring) {
|
||||
if (isTransform) {
|
||||
else if (is_selected && use_coloring) {
|
||||
if (is_transform) {
|
||||
rim_col = colorTransform.rgb;
|
||||
}
|
||||
else if (is_active) {
|
||||
@@ -64,7 +64,7 @@ void wire_object_color_get(out float3 rim_col, out float3 wire_col)
|
||||
ObjectInfos info = drw_object_infos();
|
||||
bool is_selected = flag_test(info.flag, OBJECT_SELECTED);
|
||||
|
||||
if (colorType == V3D_SHADING_OBJECT_COLOR) {
|
||||
if (color_type == V3D_SHADING_OBJECT_COLOR) {
|
||||
rim_col = wire_col = drw_object_infos().ob_color.rgb * 0.5f;
|
||||
}
|
||||
else {
|
||||
@@ -73,7 +73,7 @@ void wire_object_color_get(out float3 rim_col, out float3 wire_col)
|
||||
rim_col = wire_col = hsv_to_rgb(hsv);
|
||||
}
|
||||
|
||||
if (is_selected && useColoring) {
|
||||
if (is_selected && use_coloring) {
|
||||
/* "Normalize" color. */
|
||||
wire_col += 1e-4f; /* Avoid division by 0. */
|
||||
float brightness = max(wire_col.x, max(wire_col.y, wire_col.z));
|
||||
@@ -93,7 +93,7 @@ void main()
|
||||
/* If no attribute is available, use a fixed facing value depending on the coloring mode.
|
||||
* This allow to keep most of the contrast between unselected and selected color
|
||||
* while keeping object coloring mode working (see #134011). */
|
||||
float no_nor_facing = (colorType == V3D_SHADING_SINGLE_COLOR) ? 0.0f : 0.5f;
|
||||
float no_nor_facing = (color_type == V3D_SHADING_SINGLE_COLOR) ? 0.0f : 0.5f;
|
||||
|
||||
float3 wpos = drw_point_object_to_world(pos);
|
||||
#if defined(POINTS)
|
||||
@@ -103,8 +103,8 @@ void main()
|
||||
#else
|
||||
float3 wnor = safe_normalize(drw_normal_object_to_world(nor));
|
||||
|
||||
if (isHair) {
|
||||
float4x4 obmat = hairDupliMatrix;
|
||||
if (is_hair) {
|
||||
float4x4 obmat = hair_dupli_matrix;
|
||||
wpos = (obmat * float4(pos, 1.0f)).xyz;
|
||||
wnor = -normalize(to_float3x3(obmat) * nor);
|
||||
}
|
||||
@@ -140,7 +140,7 @@ void main()
|
||||
#endif
|
||||
|
||||
float3 rim_col, wire_col;
|
||||
if (colorType == V3D_SHADING_OBJECT_COLOR || colorType == V3D_SHADING_RANDOM_COLOR) {
|
||||
if (color_type == V3D_SHADING_OBJECT_COLOR || color_type == V3D_SHADING_RANDOM_COLOR) {
|
||||
wire_object_color_get(rim_col, wire_col);
|
||||
}
|
||||
else {
|
||||
@@ -148,13 +148,13 @@ void main()
|
||||
}
|
||||
|
||||
#if defined(POINTS)
|
||||
finalColor = wire_col.rgbb;
|
||||
finalColorInner = rim_col.rgbb;
|
||||
final_color = wire_col.rgbb;
|
||||
final_color_inner = rim_col.rgbb;
|
||||
|
||||
#else
|
||||
/* Convert to screen position [0..sizeVp]. */
|
||||
edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edgePos = edgeStart;
|
||||
edge_start = ((gl_Position.xy / gl_Position.w) * 0.5f + 0.5f) * sizeViewport;
|
||||
edge_pos = edge_start;
|
||||
|
||||
# if !defined(SELECT_ENABLE)
|
||||
facing = clamp(abs(facing), 0.0f, 1.0f);
|
||||
@@ -162,17 +162,17 @@ void main()
|
||||
rim_col = pow(rim_col, float3(1.0f / 2.2f));
|
||||
wire_col = pow(wire_col, float3(1.0f / 2.2f));
|
||||
float3 final_front_col = mix(rim_col, wire_col, 0.35f);
|
||||
finalColor.rgb = mix(rim_col, final_front_col, facing);
|
||||
finalColor.rgb = pow(finalColor.rgb, float3(2.2f));
|
||||
final_color.rgb = mix(rim_col, final_front_col, facing);
|
||||
final_color.rgb = pow(final_color.rgb, float3(2.2f));
|
||||
# endif
|
||||
|
||||
finalColor.a = wireOpacity;
|
||||
finalColor.rgb *= wireOpacity;
|
||||
final_color.a = wire_opacity;
|
||||
final_color.rgb *= wire_opacity;
|
||||
|
||||
# if !defined(CURVES)
|
||||
/* Cull flat edges below threshold. */
|
||||
if (!no_attr && !is_edge_sharpness_visible(wd)) {
|
||||
edgeStart = float2(-1.0f);
|
||||
edge_start = float2(-1.0f);
|
||||
}
|
||||
# endif
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ void main()
|
||||
{
|
||||
/* TODO(fclem): Cleanup naming. Here the xray depth mean the scene depth (from workbench) and
|
||||
* simple depth is the overlay depth. */
|
||||
float depth_infront = textureLod(depthTexInfront, screen_uv, 0.0f).r;
|
||||
float depth_xray_infront = textureLod(xrayDepthTexInfront, screen_uv, 0.0f).r;
|
||||
float depth_infront = textureLod(depth_txInfront, screen_uv, 0.0f).r;
|
||||
float depth_xray_infront = textureLod(xray_depth_txInfront, screen_uv, 0.0f).r;
|
||||
if (depth_infront != 1.0f) {
|
||||
if (depth_xray_infront < depth_infront) {
|
||||
fragColor = float4(opacity);
|
||||
frag_color = float4(opacity);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -22,15 +22,15 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
float depth = textureLod(depthTex, screen_uv, 0.0f).r;
|
||||
float depth_xray = textureLod(xrayDepthTex, screen_uv, 0.0f).r;
|
||||
float depth = textureLod(depth_tx, screen_uv, 0.0f).r;
|
||||
float depth_xray = textureLod(xray_depth_tx, screen_uv, 0.0f).r;
|
||||
/* Merge infront depth. */
|
||||
if (depth_xray_infront != 1.0f) {
|
||||
depth_xray = 0.0f;
|
||||
}
|
||||
|
||||
if (depth_xray < depth) {
|
||||
fragColor = float4(opacity);
|
||||
frag_color = float4(opacity);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,14 +140,14 @@ struct Instance : public DrawEngine {
|
||||
{
|
||||
auto &sub = depth_only_ps.sub("DepthOnly");
|
||||
sub.shader_set(sh->select_id_uniform);
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
sub.push_constant("select_id", 0);
|
||||
depth_only = ⊂
|
||||
}
|
||||
if (retopology_occlusion) {
|
||||
auto &sub = depth_only_ps.sub("Occlusion");
|
||||
sub.shader_set(sh->select_id_uniform);
|
||||
sub.push_constant("retopologyOffset", 0.0f);
|
||||
sub.push_constant("retopology_offset", 0.0f);
|
||||
sub.push_constant("select_id", 0);
|
||||
depth_occlude = ⊂
|
||||
}
|
||||
@@ -159,14 +159,14 @@ struct Instance : public DrawEngine {
|
||||
if (e_data.context.select_mode & SCE_SELECT_FACE) {
|
||||
auto &sub = select_face_ps.sub("Face");
|
||||
sub.shader_set(sh->select_id_flat);
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
select_face_flat = ⊂
|
||||
}
|
||||
else {
|
||||
auto &sub = select_face_ps.sub("FaceNoSelect");
|
||||
sub.shader_set(sh->select_id_uniform);
|
||||
sub.push_constant("select_id", 0);
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
select_face_uniform = ⊂
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ struct Instance : public DrawEngine {
|
||||
auto &sub = select_edge_ps.sub("Sub");
|
||||
sub.state_set(state | DRW_STATE_FIRST_VERTEX_CONVENTION, clipping_plane_count);
|
||||
sub.shader_set(sh->select_id_flat);
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
select_edge = ⊂
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ struct Instance : public DrawEngine {
|
||||
sub.state_set(state, clipping_plane_count);
|
||||
sub.shader_set(sh->select_id_flat);
|
||||
sub.push_constant("vertex_size", float(2 * vertex_size));
|
||||
sub.push_constant("retopologyOffset", retopology_offset);
|
||||
sub.push_constant("retopology_offset", retopology_offset);
|
||||
select_vert = ⊂
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,11 @@ GPU_SHADER_INTERFACE_END()
|
||||
GPU_SHADER_CREATE_INFO(select_id_flat)
|
||||
PUSH_CONSTANT(float, vertex_size)
|
||||
PUSH_CONSTANT(int, offset)
|
||||
PUSH_CONSTANT(float, retopologyOffset)
|
||||
PUSH_CONSTANT(float, retopology_offset)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
VERTEX_IN(1, int, index)
|
||||
VERTEX_OUT(select_id_iface)
|
||||
FRAGMENT_OUT(0, uint, fragColor)
|
||||
FRAGMENT_OUT(0, uint, frag_color)
|
||||
VERTEX_SOURCE("select_id_vert.glsl")
|
||||
FRAGMENT_SOURCE("select_id_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_modelmat)
|
||||
@@ -32,9 +32,9 @@ GPU_SHADER_CREATE_INFO(select_id_uniform)
|
||||
DEFINE("UNIFORM_ID")
|
||||
PUSH_CONSTANT(float, vertex_size)
|
||||
PUSH_CONSTANT(int, select_id)
|
||||
PUSH_CONSTANT(float, retopologyOffset)
|
||||
PUSH_CONSTANT(float, retopology_offset)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
FRAGMENT_OUT(0, uint, fragColor)
|
||||
FRAGMENT_OUT(0, uint, frag_color)
|
||||
VERTEX_SOURCE("select_id_vert.glsl")
|
||||
FRAGMENT_SOURCE("select_id_frag.glsl")
|
||||
ADDITIONAL_INFO(draw_modelmat)
|
||||
@@ -64,6 +64,6 @@ GPU_SHADER_CREATE_INFO(select_debug_fullscreen)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
FRAGMENT_SOURCE("select_debug_frag.glsl")
|
||||
SAMPLER(0, UINT_2D, image)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -5,12 +5,12 @@
|
||||
void main()
|
||||
{
|
||||
uint px = texture(image, screen_uv).r;
|
||||
fragColor = float4(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
frag_color = float4(1.0f, 1.0f, 1.0f, 0.0f);
|
||||
if (px != 0u) {
|
||||
fragColor.a = 1.0f;
|
||||
frag_color.a = 1.0f;
|
||||
px &= 0x3Fu;
|
||||
fragColor.r = ((px >> 0) & 0x3u) / float(0x3u);
|
||||
fragColor.g = ((px >> 2) & 0x3u) / float(0x3u);
|
||||
fragColor.b = ((px >> 4) & 0x3u) / float(0x3u);
|
||||
frag_color.r = ((px >> 0) & 0x3u) / float(0x3u);
|
||||
frag_color.g = ((px >> 2) & 0x3u) / float(0x3u);
|
||||
frag_color.b = ((px >> 4) & 0x3u) / float(0x3u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
fragColor = floatBitsToUint(intBitsToFloat(select_id));
|
||||
frag_color = floatBitsToUint(intBitsToFloat(select_id));
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void main()
|
||||
|
||||
/* Offset Z position for retopology selection occlusion. */
|
||||
gl_Position.z += get_homogenous_z_offset(
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopologyOffset);
|
||||
drw_view().winmat, view_pos.z, gl_Position.w, retopology_offset);
|
||||
|
||||
view_clipping_distances(world_pos);
|
||||
}
|
||||
|
||||
@@ -34,8 +34,8 @@ SAMPLER(4, FLOAT_2D, normal_tx)
|
||||
SAMPLER(5, FLOAT_2D, material_tx)
|
||||
UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data)
|
||||
TYPEDEF_SOURCE("workbench_shader_shared.hh")
|
||||
PUSH_CONSTANT(bool, forceShadowing)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
PUSH_CONSTANT(bool, force_shadowing)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("workbench_composite_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# define SMAA_STAGE 1
|
||||
# define SMAA_PRESET_HIGH
|
||||
# define SMAA_NO_DISCARD
|
||||
# define SMAA_RT_METRICS viewportMetrics
|
||||
# define SMAA_RT_METRICS viewport_metrics
|
||||
# define SMAA_LUMA_WEIGHT float4(1.0f, 1.0f, 1.0f, 1.0f)
|
||||
#endif
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_taa)
|
||||
SAMPLER(0, FLOAT_2D, colorBuffer)
|
||||
SAMPLER(0, FLOAT_2D, color_buffer)
|
||||
PUSH_CONSTANT_ARRAY(float, samplesWeights, 9)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
FRAGMENT_SOURCE("workbench_effect_taa_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
DO_STATIC_COMPILATION()
|
||||
@@ -45,19 +45,19 @@ GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_smaa)
|
||||
DEFINE("SMAA_GLSL_3")
|
||||
DEFINE_VALUE("SMAA_RT_METRICS", "viewportMetrics")
|
||||
DEFINE_VALUE("SMAA_RT_METRICS", "viewport_metrics")
|
||||
DEFINE("SMAA_PRESET_HIGH")
|
||||
DEFINE_VALUE("SMAA_LUMA_WEIGHT", "float4(1.0f, 1.0f, 1.0f, 1.0f)")
|
||||
DEFINE("SMAA_NO_DISCARD")
|
||||
VERTEX_OUT(workbench_smaa_iface)
|
||||
PUSH_CONSTANT(float4, viewportMetrics)
|
||||
PUSH_CONSTANT(float4, viewport_metrics)
|
||||
VERTEX_SOURCE("workbench_effect_smaa_vert.glsl")
|
||||
FRAGMENT_SOURCE("workbench_effect_smaa_frag.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_smaa_stage_0)
|
||||
DEFINE_VALUE("SMAA_STAGE", "0")
|
||||
SAMPLER(0, FLOAT_2D, colorTex)
|
||||
SAMPLER(0, FLOAT_2D, color_tx)
|
||||
FRAGMENT_OUT(0, float2, out_edges)
|
||||
ADDITIONAL_INFO(workbench_smaa)
|
||||
DO_STATIC_COMPILATION()
|
||||
@@ -65,9 +65,9 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_smaa_stage_1)
|
||||
DEFINE_VALUE("SMAA_STAGE", "1")
|
||||
SAMPLER(0, FLOAT_2D, edgesTex)
|
||||
SAMPLER(1, FLOAT_2D, areaTex)
|
||||
SAMPLER(2, FLOAT_2D, searchTex)
|
||||
SAMPLER(0, FLOAT_2D, edges_tx)
|
||||
SAMPLER(1, FLOAT_2D, area_tx)
|
||||
SAMPLER(2, FLOAT_2D, search_tx)
|
||||
FRAGMENT_OUT(0, float4, out_weights)
|
||||
ADDITIONAL_INFO(workbench_smaa)
|
||||
DO_STATIC_COMPILATION()
|
||||
@@ -75,10 +75,10 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_smaa_stage_2)
|
||||
DEFINE_VALUE("SMAA_STAGE", "2")
|
||||
SAMPLER(0, FLOAT_2D, colorTex)
|
||||
SAMPLER(1, FLOAT_2D, blendTex)
|
||||
PUSH_CONSTANT(float, mixFactor)
|
||||
PUSH_CONSTANT(float, taaAccumulatedWeight)
|
||||
SAMPLER(0, FLOAT_2D, color_tx)
|
||||
SAMPLER(1, FLOAT_2D, blend_tx)
|
||||
PUSH_CONSTANT(float, mix_factor)
|
||||
PUSH_CONSTANT(float, taa_accumulated_weight)
|
||||
FRAGMENT_OUT(0, float4, out_color)
|
||||
ADDITIONAL_INFO(workbench_smaa)
|
||||
DO_STATIC_COMPILATION()
|
||||
|
||||
@@ -24,26 +24,26 @@
|
||||
/*
|
||||
* NOTE: Keep the sampler bind points consistent between the steps.
|
||||
*
|
||||
* SAMPLER(0, FLOAT_2D, inputCocTex)
|
||||
* SAMPLER(1, FLOAT_2D, sceneColorTex)
|
||||
* SAMPLER(2, FLOAT_2D, sceneDepthTex)
|
||||
* SAMPLER(3, FLOAT_2D, halfResColorTex)
|
||||
* SAMPLER(4, FLOAT_2D, blurTex)
|
||||
* SAMPLER(5, FLOAT_2D, noiseTex)
|
||||
* SAMPLER(0, FLOAT_2D, input_coc_tx)
|
||||
* SAMPLER(1, FLOAT_2D, scene_color_tx)
|
||||
* SAMPLER(2, FLOAT_2D, scene_depth_tx)
|
||||
* SAMPLER(3, FLOAT_2D, half_res_color_tx)
|
||||
* SAMPLER(4, FLOAT_2D, blur_tx)
|
||||
* SAMPLER(5, FLOAT_2D, noise_tx)
|
||||
*/
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof)
|
||||
PUSH_CONSTANT(float2, invertedViewportSize)
|
||||
PUSH_CONSTANT(float2, nearFar)
|
||||
PUSH_CONSTANT(float3, dofParams)
|
||||
PUSH_CONSTANT(float, noiseOffset)
|
||||
PUSH_CONSTANT(float2, inverted_viewport_size)
|
||||
PUSH_CONSTANT(float2, near_far)
|
||||
PUSH_CONSTANT(float3, dof_params)
|
||||
PUSH_CONSTANT(float, noise_offset)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
ADDITIONAL_INFO(draw_view)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof_prepare)
|
||||
SAMPLER(1, FLOAT_2D, sceneColorTex)
|
||||
SAMPLER(2, FLOAT_2D, sceneDepthTex)
|
||||
SAMPLER(1, FLOAT_2D, scene_color_tx)
|
||||
SAMPLER(2, FLOAT_2D, scene_depth_tx)
|
||||
FRAGMENT_OUT(0, float4, halfResColor)
|
||||
FRAGMENT_OUT(1, float2, normalizedCoc)
|
||||
FRAGMENT_SOURCE("workbench_effect_dof_prepare_frag.glsl")
|
||||
@@ -52,8 +52,8 @@ DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof_downsample)
|
||||
SAMPLER(0, FLOAT_2D, inputCocTex)
|
||||
SAMPLER(1, FLOAT_2D, sceneColorTex)
|
||||
SAMPLER(0, FLOAT_2D, input_coc_tx)
|
||||
SAMPLER(1, FLOAT_2D, scene_color_tx)
|
||||
FRAGMENT_OUT(0, float4, outColor)
|
||||
FRAGMENT_OUT(1, float2, outCocs)
|
||||
FRAGMENT_SOURCE("workbench_effect_dof_downsample_frag.glsl")
|
||||
@@ -63,9 +63,9 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur1)
|
||||
DEFINE_VALUE("NUM_SAMPLES", "49")
|
||||
SAMPLER(0, FLOAT_2D, inputCocTex)
|
||||
SAMPLER(3, FLOAT_2D, halfResColorTex)
|
||||
SAMPLER(5, FLOAT_2D, noiseTex)
|
||||
SAMPLER(0, FLOAT_2D, input_coc_tx)
|
||||
SAMPLER(3, FLOAT_2D, half_res_color_tx)
|
||||
SAMPLER(5, FLOAT_2D, noise_tx)
|
||||
UNIFORM_BUF(1, float4, samples[49])
|
||||
FRAGMENT_OUT(0, float4, blurColor)
|
||||
FRAGMENT_SOURCE("workbench_effect_dof_blur1_frag.glsl")
|
||||
@@ -74,20 +74,20 @@ DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof_blur2)
|
||||
SAMPLER(0, FLOAT_2D, inputCocTex)
|
||||
SAMPLER(4, FLOAT_2D, blurTex)
|
||||
FRAGMENT_OUT(0, float4, finalColor)
|
||||
SAMPLER(0, FLOAT_2D, input_coc_tx)
|
||||
SAMPLER(4, FLOAT_2D, blur_tx)
|
||||
FRAGMENT_OUT(0, float4, final_color)
|
||||
FRAGMENT_SOURCE("workbench_effect_dof_blur2_frag.glsl")
|
||||
ADDITIONAL_INFO(workbench_effect_dof)
|
||||
DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_dof_resolve)
|
||||
SAMPLER(1, FLOAT_2D, sceneColorTex)
|
||||
SAMPLER(2, FLOAT_2D, sceneDepthTex)
|
||||
SAMPLER(3, FLOAT_2D, halfResColorTex)
|
||||
FRAGMENT_OUT_DUAL(0, float4, finalColorAdd, SRC_0)
|
||||
FRAGMENT_OUT_DUAL(0, float4, finalColorMul, SRC_1)
|
||||
SAMPLER(1, FLOAT_2D, scene_color_tx)
|
||||
SAMPLER(2, FLOAT_2D, scene_depth_tx)
|
||||
SAMPLER(3, FLOAT_2D, half_res_color_tx)
|
||||
FRAGMENT_OUT_DUAL(0, float4, final_colorAdd, SRC_0)
|
||||
FRAGMENT_OUT_DUAL(0, float4, final_colorMul, SRC_1)
|
||||
FRAGMENT_SOURCE("workbench_effect_dof_resolve_frag.glsl")
|
||||
ADDITIONAL_INFO(workbench_effect_dof)
|
||||
DO_STATIC_COMPILATION()
|
||||
|
||||
@@ -16,9 +16,9 @@
|
||||
GPU_SHADER_CREATE_INFO(workbench_effect_outline)
|
||||
TYPEDEF_SOURCE("workbench_shader_shared.hh")
|
||||
FRAGMENT_SOURCE("workbench_effect_outline_frag.glsl")
|
||||
SAMPLER(0, UINT_2D, objectIdBuffer)
|
||||
SAMPLER(0, UINT_2D, object_id_buffer)
|
||||
UNIFORM_BUF(WB_WORLD_SLOT, WorldData, world_data)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
DO_STATIC_COMPILATION()
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -104,9 +104,9 @@ STORAGE_BUF(WB_MATERIAL_SLOT, READ, float4, materials_data[])
|
||||
SAMPLER_FREQ(WB_TEXTURE_SLOT, FLOAT_2D, imageTexture, BATCH)
|
||||
SAMPLER_FREQ(WB_TILE_ARRAY_SLOT, FLOAT_2D_ARRAY, imageTileArray, BATCH)
|
||||
SAMPLER_FREQ(WB_TILE_DATA_SLOT, FLOAT_1D_ARRAY, imageTileData, BATCH)
|
||||
PUSH_CONSTANT(bool, isImageTile)
|
||||
PUSH_CONSTANT(bool, imagePremult)
|
||||
PUSH_CONSTANT(float, imageTransparencyCutoff)
|
||||
PUSH_CONSTANT(bool, is_image_tile)
|
||||
PUSH_CONSTANT(bool, image_premult)
|
||||
PUSH_CONSTANT(float, image_transparency_cutoff)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_color_vertex)
|
||||
@@ -131,7 +131,7 @@ GPU_SHADER_CREATE_INFO(workbench_transparent_accum)
|
||||
FRAGMENT_OUT(0, float4, out_transparent_accum)
|
||||
FRAGMENT_OUT(1, float4, out_revealage_accum)
|
||||
FRAGMENT_OUT(2, uint, out_object_id)
|
||||
PUSH_CONSTANT(bool, forceShadowing)
|
||||
PUSH_CONSTANT(bool, force_shadowing)
|
||||
TYPEDEF_SOURCE("workbench_shader_shared.hh")
|
||||
FRAGMENT_SOURCE("workbench_transparent_accum_frag.glsl")
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#include "gpu_shader_create_info.hh"
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_transparent_resolve)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, FLOAT_2D, transparentAccum)
|
||||
SAMPLER(1, FLOAT_2D, transparentRevealage)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
SAMPLER(0, FLOAT_2D, transparent_accum)
|
||||
SAMPLER(1, FLOAT_2D, transparent_revealage)
|
||||
FRAGMENT_SOURCE("workbench_transparent_resolve_frag.glsl")
|
||||
ADDITIONAL_INFO(gpu_fullscreen)
|
||||
DO_STATIC_COMPILATION()
|
||||
|
||||
@@ -28,13 +28,13 @@
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_common)
|
||||
VERTEX_IN(0, float3, pos)
|
||||
FRAGMENT_OUT(0, float4, fragColor)
|
||||
SAMPLER(0, DEPTH_2D, depthBuffer)
|
||||
SAMPLER(1, FLOAT_3D, densityTexture)
|
||||
PUSH_CONSTANT(int, samplesLen)
|
||||
PUSH_CONSTANT(float, noiseOfs)
|
||||
PUSH_CONSTANT(float, stepLength)
|
||||
PUSH_CONSTANT(float, densityScale)
|
||||
FRAGMENT_OUT(0, float4, frag_color)
|
||||
SAMPLER(0, DEPTH_2D, depth_buffer)
|
||||
SAMPLER(1, FLOAT_3D, density_tx)
|
||||
PUSH_CONSTANT(int, samples_len)
|
||||
PUSH_CONSTANT(float, noise_ofs)
|
||||
PUSH_CONSTANT(float, step_length)
|
||||
PUSH_CONSTANT(float, density_fac)
|
||||
PUSH_CONSTANT(bool, do_depth_test)
|
||||
VERTEX_SOURCE("workbench_volume_vert.glsl")
|
||||
FRAGMENT_SOURCE("workbench_volume_frag.glsl")
|
||||
@@ -54,16 +54,16 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_smoke_common)
|
||||
DEFINE("VOLUME_SMOKE")
|
||||
SAMPLER(2, FLOAT_3D, flameTexture)
|
||||
SAMPLER(3, FLOAT_1D, flameColorTexture)
|
||||
SAMPLER(2, FLOAT_3D, flame_tx)
|
||||
SAMPLER(3, FLOAT_1D, flame_color_tx)
|
||||
ADDITIONAL_INFO(draw_resource_id_varying)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_object_common)
|
||||
DEFINE("VOLUME_OBJECT")
|
||||
PUSH_CONSTANT(float4x4, volumeTextureToObject)
|
||||
PUSH_CONSTANT(float4x4, volume_texture_to_object)
|
||||
/* FIXME(fclem): This overflow the push_constant limit. */
|
||||
PUSH_CONSTANT(float4x4, volumeObjectToTexture)
|
||||
PUSH_CONSTANT(float4x4, volume_object_to_texture)
|
||||
ADDITIONAL_INFO(draw_resource_id_varying)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
@@ -85,17 +85,17 @@ GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_coba)
|
||||
DEFINE("USE_COBA")
|
||||
SAMPLER(4, UINT_3D, flagTexture)
|
||||
SAMPLER(5, FLOAT_1D, transferTexture)
|
||||
PUSH_CONSTANT(bool, showPhi)
|
||||
PUSH_CONSTANT(bool, showFlags)
|
||||
PUSH_CONSTANT(bool, showPressure)
|
||||
PUSH_CONSTANT(float, gridScale)
|
||||
SAMPLER(4, UINT_3D, flag_tx)
|
||||
SAMPLER(5, FLOAT_1D, transfer_tx)
|
||||
PUSH_CONSTANT(bool, show_phi)
|
||||
PUSH_CONSTANT(bool, show_flags)
|
||||
PUSH_CONSTANT(bool, show_pressure)
|
||||
PUSH_CONSTANT(float, grid_scale)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_no_coba)
|
||||
SAMPLER(4, FLOAT_3D, shadowTexture)
|
||||
PUSH_CONSTANT(float3, activeColor)
|
||||
SAMPLER(4, FLOAT_3D, shadow_tx)
|
||||
PUSH_CONSTANT(float3, active_color)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
/** \} */
|
||||
@@ -121,15 +121,15 @@ GPU_SHADER_CREATE_END()
|
||||
* \{ */
|
||||
|
||||
GPU_SHADER_INTERFACE_INFO(workbench_volume_iface)
|
||||
SMOOTH(float3, localPos)
|
||||
SMOOTH(float3, local_position)
|
||||
GPU_SHADER_INTERFACE_END()
|
||||
|
||||
GPU_SHADER_CREATE_INFO(workbench_volume_slice)
|
||||
DEFINE("VOLUME_SLICE")
|
||||
VERTEX_IN(1, float3, uvs)
|
||||
VERTEX_OUT(workbench_volume_iface)
|
||||
PUSH_CONSTANT(int, sliceAxis) /* -1 is no slice. */
|
||||
PUSH_CONSTANT(float, slicePosition)
|
||||
PUSH_CONSTANT(int, slice_axis) /* -1 is no slice. */
|
||||
PUSH_CONSTANT(float, slice_position)
|
||||
GPU_SHADER_CREATE_END()
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -24,14 +24,14 @@ SHADER_LIBRARY_CREATE_INFO(workbench_resolve_cavity)
|
||||
#ifdef USE_CAVITY
|
||||
|
||||
void cavity_compute(float2 screenco,
|
||||
depth2D depthBuffer,
|
||||
depth2D depth_buffer,
|
||||
sampler2D normalBuffer,
|
||||
out float cavities,
|
||||
out float edges)
|
||||
{
|
||||
cavities = edges = 0.0f;
|
||||
|
||||
float depth = texture(depthBuffer, screenco).x;
|
||||
float depth = texture(depth_buffer, screenco).x;
|
||||
|
||||
/* Early out if background and in front. */
|
||||
if (depth == 1.0f || depth == 0.0f) {
|
||||
@@ -73,7 +73,7 @@ void cavity_compute(float2 screenco,
|
||||
continue;
|
||||
}
|
||||
/* Sample depth. */
|
||||
float s_depth = texture(depthBuffer, uvcoords).r;
|
||||
float s_depth = texture(depth_buffer, uvcoords).r;
|
||||
/* Handle Background case */
|
||||
bool is_background = (s_depth == 1.0f);
|
||||
/* This trick provide good edge effect even if no neighbor is found. */
|
||||
|
||||
@@ -74,5 +74,5 @@ void main()
|
||||
color.rgb *= get_shadow(N, shadow);
|
||||
#endif
|
||||
|
||||
fragColor = color;
|
||||
frag_color = color;
|
||||
}
|
||||
|
||||
@@ -21,17 +21,17 @@ float curvature_soft_clamp(float curvature, float control)
|
||||
}
|
||||
|
||||
void curvature_compute(float2 uv,
|
||||
usampler2D objectIdBuffer,
|
||||
usampler2D object_id_buffer,
|
||||
sampler2D normalBuffer,
|
||||
out float curvature)
|
||||
{
|
||||
curvature = 0.0f;
|
||||
|
||||
float3 offset = float3(world_data.viewport_size_inv, 0.0f) * world_data.ui_scale;
|
||||
uint object_up = texture(objectIdBuffer, uv + offset.zy).r;
|
||||
uint object_down = texture(objectIdBuffer, uv - offset.zy).r;
|
||||
uint object_right = texture(objectIdBuffer, uv + offset.xz).r;
|
||||
uint object_left = texture(objectIdBuffer, uv - offset.xz).r;
|
||||
uint object_up = texture(object_id_buffer, uv + offset.zy).r;
|
||||
uint object_down = texture(object_id_buffer, uv - offset.zy).r;
|
||||
uint object_right = texture(object_id_buffer, uv + offset.xz).r;
|
||||
uint object_left = texture(object_id_buffer, uv - offset.xz).r;
|
||||
|
||||
/* Remove object outlines. */
|
||||
if ((object_up != object_down) || (object_right != object_left)) {
|
||||
|
||||
@@ -28,7 +28,7 @@ float2 get_random_vector(float offset)
|
||||
* http://www.iryoku.com/next-generation-post-processing-in-call-of-duty-advanced-warfare */
|
||||
float ign = fract(
|
||||
offset + 52.9829189f * fract(0.06711056f * gl_FragCoord.x + 0.00583715f * gl_FragCoord.y));
|
||||
float bn = texelFetch(noiseTex, int2(gl_FragCoord.xy) % 64, 0).a;
|
||||
float bn = texelFetch(noise_tx, int2(gl_FragCoord.xy) % 64, 0).a;
|
||||
float ang = M_PI * 2.0f * fract(bn + offset);
|
||||
return float2(cos(ang), sin(ang)) * sqrt(ign);
|
||||
// return noise.rg * sqrt(ign);
|
||||
@@ -36,26 +36,26 @@ float2 get_random_vector(float offset)
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 uv = gl_FragCoord.xy * invertedViewportSize * 2.0f;
|
||||
float2 uv = gl_FragCoord.xy * inverted_viewport_size * 2.0f;
|
||||
|
||||
float2 size = float2(textureSize(halfResColorTex, 0).xy);
|
||||
float2 size = float2(textureSize(half_res_color_tx, 0).xy);
|
||||
int2 texel = int2(uv * size);
|
||||
|
||||
float4 color = float4(0.0f);
|
||||
float tot = 0.0f;
|
||||
|
||||
float coc = dof_decode_coc(texelFetch(inputCocTex, texel, 0).rg);
|
||||
float coc = dof_decode_coc(texelFetch(input_coc_tx, texel, 0).rg);
|
||||
float max_radius = coc;
|
||||
float2 noise = get_random_vector(noiseOffset) * 0.2f *
|
||||
float2 noise = get_random_vector(noise_offset) * 0.2f *
|
||||
clamp(max_radius * 0.2f - 4.0f, 0.0f, 1.0f);
|
||||
for (int i = 0; i < NUM_SAMPLES; i++) {
|
||||
float2 tc = uv + (noise + samples[i].xy) * invertedViewportSize * max_radius;
|
||||
float2 tc = uv + (noise + samples[i].xy) * inverted_viewport_size * max_radius;
|
||||
|
||||
/* decode_signed_coc return biggest coc. */
|
||||
coc = abs(dof_decode_signed_coc(texture(inputCocTex, tc).rg));
|
||||
coc = abs(dof_decode_signed_coc(texture(input_coc_tx, tc).rg));
|
||||
|
||||
float lod = log2(clamp((coc + min(coc, max_radius)) * 0.5f - 21.0f, 0.0f, 16.0f) * 0.25f);
|
||||
float4 samp = textureLod(halfResColorTex, tc, lod);
|
||||
float4 samp = textureLod(half_res_color_tx, tc, lod);
|
||||
|
||||
float radius = samples[i].z * max_radius;
|
||||
float weight = abs(coc) * smoothstep(radius - 0.5f, radius + 0.5f, abs(coc));
|
||||
@@ -68,6 +68,6 @@ void main()
|
||||
blurColor = color / tot;
|
||||
}
|
||||
else {
|
||||
blurColor = textureLod(halfResColorTex, uv, 0.0f);
|
||||
blurColor = textureLod(half_res_color_tx, uv, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,9 @@ FRAGMENT_SHADER_CREATE_INFO(workbench_effect_dof_blur2)
|
||||
void main()
|
||||
{
|
||||
/* Half Res pass */
|
||||
float2 pixel_size = 1.0f / float2(textureSize(blurTex, 0).xy);
|
||||
float2 pixel_size = 1.0f / float2(textureSize(blur_tx, 0).xy);
|
||||
float2 uv = gl_FragCoord.xy * pixel_size.xy;
|
||||
float coc = dof_decode_coc(texture(inputCocTex, uv).rg);
|
||||
float coc = dof_decode_coc(texture(input_coc_tx, uv).rg);
|
||||
/* Only use this filter if coc is > 9.0f
|
||||
* since this filter is not weighted by CoC
|
||||
* and can bleed a bit. */
|
||||
@@ -80,7 +80,7 @@ void main()
|
||||
/* If a pixel in the window is located at (x+dX, y+dY), put it at index (dX + R)(2R + 1) +
|
||||
* (dY + R) of the pixel array. This will fill the pixel array, with the top left pixel of
|
||||
* the window at pixel[0] and the bottom right pixel of the window at pixel[N-1]. */
|
||||
v[(dX + 1) * 3 + (dY + 1)] = toVec(texture(blurTex, uv + offset * pixel_size * rad));
|
||||
v[(dX + 1) * 3 + (dY + 1)] = toVec(texture(blur_tx, uv + offset * pixel_size * rad));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,5 +91,5 @@ void main()
|
||||
mnmx5(v[1], v[2], v[3], v[4], v[6]);
|
||||
mnmx4(v[2], v[3], v[4], v[7]);
|
||||
mnmx3(v[3], v[4], v[8]);
|
||||
toVec(finalColor) = v[4];
|
||||
toVec(final_color) = v[4];
|
||||
}
|
||||
|
||||
@@ -24,20 +24,20 @@ FRAGMENT_SHADER_CREATE_INFO(workbench_effect_dof_downsample)
|
||||
void main()
|
||||
{
|
||||
float4 texel = float4(gl_FragCoord.xyxy) * 2.0f + float4(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
texel = (texel - 0.5f) / float4(textureSize(sceneColorTex, 0).xyxy);
|
||||
texel = (texel - 0.5f) / float4(textureSize(scene_color_tx, 0).xyxy);
|
||||
|
||||
/* Using texelFetch can bypass the mip range setting on some platform.
|
||||
* Using texture LOD fixes this issue. Note that we need to disable filtering to get the right
|
||||
* texel values. */
|
||||
float4 color1 = textureLod(sceneColorTex, texel.xy, 0.0f);
|
||||
float4 color2 = textureLod(sceneColorTex, texel.zw, 0.0f);
|
||||
float4 color3 = textureLod(sceneColorTex, texel.zy, 0.0f);
|
||||
float4 color4 = textureLod(sceneColorTex, texel.xw, 0.0f);
|
||||
float4 color1 = textureLod(scene_color_tx, texel.xy, 0.0f);
|
||||
float4 color2 = textureLod(scene_color_tx, texel.zw, 0.0f);
|
||||
float4 color3 = textureLod(scene_color_tx, texel.zy, 0.0f);
|
||||
float4 color4 = textureLod(scene_color_tx, texel.xw, 0.0f);
|
||||
|
||||
float2 cocs1 = textureLod(inputCocTex, texel.xy, 0.0f).rg;
|
||||
float2 cocs2 = textureLod(inputCocTex, texel.zw, 0.0f).rg;
|
||||
float2 cocs3 = textureLod(inputCocTex, texel.zy, 0.0f).rg;
|
||||
float2 cocs4 = textureLod(inputCocTex, texel.xw, 0.0f).rg;
|
||||
float2 cocs1 = textureLod(input_coc_tx, texel.xy, 0.0f).rg;
|
||||
float2 cocs2 = textureLod(input_coc_tx, texel.zw, 0.0f).rg;
|
||||
float2 cocs3 = textureLod(input_coc_tx, texel.zy, 0.0f).rg;
|
||||
float2 cocs4 = textureLod(input_coc_tx, texel.xw, 0.0f).rg;
|
||||
|
||||
float4 cocs_near = float4(cocs1.r, cocs2.r, cocs3.r, cocs4.r) * MAX_COC_SIZE;
|
||||
float4 cocs_far = float4(cocs1.g, cocs2.g, cocs3.g, cocs4.g) * MAX_COC_SIZE;
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
#include "gpu_shader_math_vector_lib.glsl"
|
||||
|
||||
#define dof_aperturesize dofParams.x
|
||||
#define dof_distance dofParams.y
|
||||
#define dof_invsensorsize dofParams.z
|
||||
#define dof_aperturesize dof_params.x
|
||||
#define dof_distance dof_params.y
|
||||
#define dof_invsensorsize dof_params.z
|
||||
|
||||
/* divide by sensor size to get the normalized size */
|
||||
#define dof_calculate_coc(zdepth) \
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
#define dof_linear_depth(z) \
|
||||
((drw_view().winmat[3][3] == 0.0f) ? \
|
||||
(nearFar.x * nearFar.y) / (z * (nearFar.x - nearFar.y) + nearFar.y) : \
|
||||
(z * 2.0f - 1.0f) * nearFar.y)
|
||||
(near_far.x * near_far.y) / (z * (near_far.x - near_far.y) + near_far.y) : \
|
||||
(z * 2.0f - 1.0f) * near_far.y)
|
||||
|
||||
#define MAX_COC_SIZE 100.0f
|
||||
float2 dof_encode_coc(float near, float far)
|
||||
|
||||
@@ -25,16 +25,16 @@ void main()
|
||||
{
|
||||
int4 texel = int4(gl_FragCoord.xyxy) * 2 + int4(0, 0, 1, 1);
|
||||
|
||||
float4 color1 = texelFetch(sceneColorTex, texel.xy, 0);
|
||||
float4 color2 = texelFetch(sceneColorTex, texel.zw, 0);
|
||||
float4 color3 = texelFetch(sceneColorTex, texel.zy, 0);
|
||||
float4 color4 = texelFetch(sceneColorTex, texel.xw, 0);
|
||||
float4 color1 = texelFetch(scene_color_tx, texel.xy, 0);
|
||||
float4 color2 = texelFetch(scene_color_tx, texel.zw, 0);
|
||||
float4 color3 = texelFetch(scene_color_tx, texel.zy, 0);
|
||||
float4 color4 = texelFetch(scene_color_tx, texel.xw, 0);
|
||||
|
||||
float4 depths;
|
||||
depths.x = texelFetch(sceneDepthTex, texel.xy, 0).x;
|
||||
depths.y = texelFetch(sceneDepthTex, texel.zw, 0).x;
|
||||
depths.z = texelFetch(sceneDepthTex, texel.zy, 0).x;
|
||||
depths.w = texelFetch(sceneDepthTex, texel.xw, 0).x;
|
||||
depths.x = texelFetch(scene_depth_tx, texel.xy, 0).x;
|
||||
depths.y = texelFetch(scene_depth_tx, texel.zw, 0).x;
|
||||
depths.z = texelFetch(scene_depth_tx, texel.zy, 0).x;
|
||||
depths.w = texelFetch(scene_depth_tx, texel.xw, 0).x;
|
||||
|
||||
float4 zdepths = dof_linear_depth(depths);
|
||||
float4 cocs_near = dof_calculate_coc(zdepths);
|
||||
|
||||
@@ -23,15 +23,15 @@ FRAGMENT_SHADER_CREATE_INFO(workbench_effect_dof_resolve)
|
||||
void main()
|
||||
{
|
||||
/* Full-screen pass. */
|
||||
float2 pixel_size = 0.5f / float2(textureSize(halfResColorTex, 0).xy);
|
||||
float2 pixel_size = 0.5f / float2(textureSize(half_res_color_tx, 0).xy);
|
||||
float2 uv = gl_FragCoord.xy * pixel_size;
|
||||
|
||||
/* TODO: MAKE SURE TO ALIGN SAMPLE POSITION TO AVOID OFFSET IN THE BOKEH. */
|
||||
float depth = texelFetch(sceneDepthTex, int2(gl_FragCoord.xy), 0).r;
|
||||
float depth = texelFetch(scene_depth_tx, int2(gl_FragCoord.xy), 0).r;
|
||||
float zdepth = dof_linear_depth(depth);
|
||||
float coc = dof_calculate_coc(zdepth);
|
||||
|
||||
float blend = smoothstep(1.0f, 3.0f, abs(coc));
|
||||
finalColorAdd = texture(halfResColorTex, uv) * blend;
|
||||
finalColorMul = float4(1.0f - blend);
|
||||
final_colorAdd = texture(half_res_color_tx, uv) * blend;
|
||||
final_colorMul = float4(1.0f - blend);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ void main()
|
||||
float3 offset = float3(world_data.viewport_size_inv, 0.0f) * world_data.ui_scale;
|
||||
float2 uv = screen_uv;
|
||||
|
||||
uint center_id = texture(objectIdBuffer, uv).r;
|
||||
uint4 adjacent_ids = uint4(texture(objectIdBuffer, uv + offset.zy).r,
|
||||
texture(objectIdBuffer, uv - offset.zy).r,
|
||||
texture(objectIdBuffer, uv + offset.xz).r,
|
||||
texture(objectIdBuffer, uv - offset.xz).r);
|
||||
uint center_id = texture(object_id_buffer, uv).r;
|
||||
uint4 adjacent_ids = uint4(texture(object_id_buffer, uv + offset.zy).r,
|
||||
texture(object_id_buffer, uv - offset.zy).r,
|
||||
texture(object_id_buffer, uv + offset.xz).r,
|
||||
texture(object_id_buffer, uv - offset.xz).r);
|
||||
|
||||
float outline_opacity = 1.0f - dot(float4(equal(uint4(center_id), adjacent_ids)), float4(0.25f));
|
||||
|
||||
fragColor = world_data.object_outline_color * outline_opacity;
|
||||
frag_color = world_data.object_outline_color * outline_opacity;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ void main()
|
||||
{
|
||||
#if SMAA_STAGE == 0
|
||||
/* Detect edges in color and revealage buffer. */
|
||||
out_edges = SMAALumaEdgeDetectionPS(uvs, offset, colorTex);
|
||||
out_edges = SMAALumaEdgeDetectionPS(uvs, offset, color_tx);
|
||||
/* Discard if there is no edge. */
|
||||
if (dot(out_edges, float2(1.0f, 1.0f)) == 0.0f) {
|
||||
discard;
|
||||
@@ -22,17 +22,17 @@ void main()
|
||||
|
||||
#elif SMAA_STAGE == 1
|
||||
out_weights = SMAABlendingWeightCalculationPS(
|
||||
uvs, pixcoord, offset, edgesTex, areaTex, searchTex, float4(0));
|
||||
uvs, pixcoord, offset, edges_tx, area_tx, search_tx, float4(0));
|
||||
|
||||
#elif SMAA_STAGE == 2
|
||||
out_color = float4(0.0f);
|
||||
if (mixFactor > 0.0f) {
|
||||
out_color += SMAANeighborhoodBlendingPS(uvs, offset[0], colorTex, blendTex) * mixFactor;
|
||||
if (mix_factor > 0.0f) {
|
||||
out_color += SMAANeighborhoodBlendingPS(uvs, offset[0], color_tx, blend_tx) * mix_factor;
|
||||
}
|
||||
if (mixFactor < 1.0f) {
|
||||
out_color += texture(colorTex, uvs) * (1.0f - mixFactor);
|
||||
if (mix_factor < 1.0f) {
|
||||
out_color += texture(color_tx, uvs) * (1.0f - mix_factor);
|
||||
}
|
||||
out_color /= taaAccumulatedWeight;
|
||||
out_color /= taa_accumulated_weight;
|
||||
/* Exit log2 space used for Anti-aliasing. */
|
||||
out_color = exp2(out_color) - 0.5f;
|
||||
|
||||
|
||||
@@ -8,20 +8,20 @@ FRAGMENT_SHADER_CREATE_INFO(workbench_taa)
|
||||
|
||||
void main()
|
||||
{
|
||||
float2 texel_size = 1.0f / float2(textureSize(colorBuffer, 0));
|
||||
float2 texel_size = 1.0f / float2(textureSize(color_buffer, 0));
|
||||
float2 uv = gl_FragCoord.xy * texel_size;
|
||||
|
||||
fragColor = float4(0.0f);
|
||||
frag_color = float4(0.0f);
|
||||
int i = 0;
|
||||
for (int x = -1; x <= 1; x++) {
|
||||
for (int y = -1; y <= 1; y++, i++) {
|
||||
float4 color = texture(colorBuffer, uv + float2(x, y) * texel_size);
|
||||
float4 color = texture(color_buffer, uv + float2(x, y) * texel_size);
|
||||
/* Clamp infinite inputs (See #112211). */
|
||||
color = clamp(color, float4(0.0f), float4(1e10f));
|
||||
/* Use log2 space to avoid highlights creating too much aliasing. */
|
||||
color = log2(color + 0.5f);
|
||||
|
||||
fragColor += color * samplesWeights[i];
|
||||
frag_color += color * samplesWeights[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ float3 workbench_image_color(float2 uvs)
|
||||
float4 color;
|
||||
|
||||
float3 co = float3(uvs, 0.0f);
|
||||
if (isImageTile) {
|
||||
if (is_image_tile) {
|
||||
if (node_tex_tile_lookup(co, imageTileData)) {
|
||||
color = texture(imageTileArray, co);
|
||||
}
|
||||
@@ -53,12 +53,12 @@ float3 workbench_image_color(float2 uvs)
|
||||
}
|
||||
|
||||
/* Unpremultiply if stored multiplied, since straight alpha is expected by shaders. */
|
||||
if (imagePremult && !(color.a == 0.0f || color.a == 1.0f)) {
|
||||
if (image_premult && !(color.a == 0.0f || color.a == 1.0f)) {
|
||||
color.rgb /= color.a;
|
||||
}
|
||||
|
||||
# ifdef GPU_FRAGMENT_SHADER
|
||||
if (color.a < imageTransparencyCutoff) {
|
||||
if (color.a < image_transparency_cutoff) {
|
||||
discard;
|
||||
}
|
||||
# endif
|
||||
|
||||
@@ -80,7 +80,7 @@ void main()
|
||||
float3 shaded_color = color;
|
||||
#endif
|
||||
|
||||
shaded_color *= get_shadow(N, forceShadowing);
|
||||
shaded_color *= get_shadow(N, force_shadowing);
|
||||
|
||||
/* Listing 4 */
|
||||
float alpha = alpha_interp * world_data.xray_alpha;
|
||||
|
||||
@@ -13,14 +13,14 @@ FRAGMENT_SHADER_CREATE_INFO(workbench_transparent_resolve)
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Revealage is actually stored in transparentAccum alpha channel.
|
||||
/* Revealage is actually stored in transparent_accum alpha channel.
|
||||
* This is a workaround to older hardware not having separate blend equation per render target.
|
||||
*/
|
||||
float4 trans_accum = texture(transparentAccum, screen_uv);
|
||||
float trans_weight = texture(transparentRevealage, screen_uv).r;
|
||||
float4 trans_accum = texture(transparent_accum, screen_uv);
|
||||
float trans_weight = texture(transparent_revealage, screen_uv).r;
|
||||
float trans_reveal = trans_accum.a;
|
||||
|
||||
/* Listing 4 */
|
||||
fragColor.rgb = trans_accum.rgb / clamp(trans_weight, 1e-4f, 5e4f);
|
||||
fragColor.a = 1.0f - trans_reveal;
|
||||
frag_color.rgb = trans_accum.rgb / clamp(trans_weight, 1e-4f, 5e4f);
|
||||
frag_color.a = 1.0f - trans_reveal;
|
||||
}
|
||||
|
||||
@@ -126,9 +126,9 @@ void volume_properties(float3 ls_pos, out float3 scattering, out float extinctio
|
||||
float3 co = ls_pos * 0.5f + 0.5f;
|
||||
#ifdef USE_COBA
|
||||
float4 tval;
|
||||
if (showPhi) {
|
||||
if (show_phi) {
|
||||
/* Color mapping for level-set representation */
|
||||
float val = sample_volume_texture(densityTexture, co).r * gridScale;
|
||||
float val = sample_volume_texture(density_tx, co).r * grid_scale;
|
||||
|
||||
val = max(min(val * 0.2f, 1.0f), -1.0f);
|
||||
|
||||
@@ -139,14 +139,14 @@ void volume_properties(float3 ls_pos, out float3 scattering, out float extinctio
|
||||
tval = float4(0.5f, 1.0f + val, 0.0f, 0.06f);
|
||||
}
|
||||
}
|
||||
else if (showFlags) {
|
||||
else if (show_flags) {
|
||||
/* Color mapping for flags */
|
||||
uint flag = texture(flagTexture, co).r;
|
||||
uint flag = texture(flag_tx, co).r;
|
||||
tval = flag_to_color(flag);
|
||||
}
|
||||
else if (showPressure) {
|
||||
else if (show_pressure) {
|
||||
/* Color mapping for pressure */
|
||||
float val = sample_volume_texture(densityTexture, co).r * gridScale;
|
||||
float val = sample_volume_texture(density_tx, co).r * grid_scale;
|
||||
|
||||
if (val > 0) {
|
||||
tval = float4(val, val, val, 0.06f);
|
||||
@@ -156,27 +156,27 @@ void volume_properties(float3 ls_pos, out float3 scattering, out float extinctio
|
||||
}
|
||||
}
|
||||
else {
|
||||
float val = sample_volume_texture(densityTexture, co).r * gridScale;
|
||||
tval = texture(transferTexture, val);
|
||||
float val = sample_volume_texture(density_tx, co).r * grid_scale;
|
||||
tval = texture(transfer_tx, val);
|
||||
}
|
||||
tval *= densityScale;
|
||||
tval *= density_fac;
|
||||
tval.rgb = pow(tval.rgb, float3(2.2f));
|
||||
scattering = tval.rgb * 1500.0f;
|
||||
extinction = max(1e-4f, tval.a * 50.0f);
|
||||
#else
|
||||
# ifdef VOLUME_SMOKE
|
||||
float flame = sample_volume_texture(flameTexture, co).r;
|
||||
float4 emission = texture(flameColorTexture, flame);
|
||||
float flame = sample_volume_texture(flame_tx, co).r;
|
||||
float4 emission = texture(flame_color_tx, flame);
|
||||
# endif
|
||||
float3 density = sample_volume_texture(densityTexture, co).rgb;
|
||||
float shadows = sample_volume_texture(shadowTexture, co).r;
|
||||
float3 density = sample_volume_texture(density_tx, co).rgb;
|
||||
float shadows = sample_volume_texture(shadow_tx, co).r;
|
||||
|
||||
scattering = density * densityScale;
|
||||
scattering = density * density_fac;
|
||||
extinction = max(1e-4f, dot(scattering, float3(0.33333f)));
|
||||
scattering *= activeColor;
|
||||
scattering *= active_color;
|
||||
|
||||
/* Scale shadows in log space and clamp them to avoid completely black shadows. */
|
||||
scattering *= exp(clamp(log(shadows) * densityScale * 0.1f, -2.5f, 0.0f)) * M_PI;
|
||||
scattering *= exp(clamp(log(shadows) * density_fac * 0.1f, -2.5f, 0.0f)) * M_PI;
|
||||
|
||||
# ifdef VOLUME_SMOKE
|
||||
/* 800 is arbitrary and here to mimic old viewport. TODO: make it a parameter. */
|
||||
@@ -210,10 +210,10 @@ float4 volume_integration(
|
||||
float final_transmittance = 1.0f;
|
||||
|
||||
int2 tx = int2(gl_FragCoord.xy) % 4;
|
||||
float noise = fract(dither_mat[tx.x][tx.y] + noiseOfs);
|
||||
float noise = fract(dither_mat[tx.x][tx.y] + noise_ofs);
|
||||
|
||||
float ray_len = noise * ray_inc;
|
||||
for (int i = 0; i < samplesLen && ray_len < ray_max; i++, ray_len += ray_inc) {
|
||||
for (int i = 0; i < samples_len && ray_len < ray_max; i++, ray_len += ray_inc) {
|
||||
float3 ls_pos = ray_ori + ray_dir * ray_len;
|
||||
|
||||
float3 Lscat;
|
||||
@@ -246,7 +246,7 @@ void main()
|
||||
|
||||
#ifdef VOLUME_SLICE
|
||||
/* Manual depth test. TODO: remove. */
|
||||
float depth = texelFetch(depthBuffer, int2(gl_FragCoord.xy), 0).r;
|
||||
float depth = texelFetch(depth_buffer, int2(gl_FragCoord.xy), 0).r;
|
||||
if (do_depth_test && gl_FragCoord.z >= depth) {
|
||||
/* NOTE: In the Metal API, prior to Metal 2.3, Discard is not an explicit return and can
|
||||
* produce undefined behavior. This is especially prominent with derivatives if control-flow
|
||||
@@ -261,17 +261,17 @@ void main()
|
||||
|
||||
float3 Lscat;
|
||||
float s_extinction, Tr;
|
||||
volume_properties(localPos, Lscat, s_extinction);
|
||||
eval_volume_step(Lscat, s_extinction, stepLength, Tr);
|
||||
volume_properties(local_position, Lscat, s_extinction);
|
||||
eval_volume_step(Lscat, s_extinction, step_length, Tr);
|
||||
|
||||
fragColor = float4(Lscat, Tr);
|
||||
frag_color = float4(Lscat, Tr);
|
||||
#else
|
||||
float2 screen_uv = gl_FragCoord.xy / float2(textureSize(depthBuffer, 0).xy);
|
||||
float2 screen_uv = gl_FragCoord.xy / float2(textureSize(depth_buffer, 0).xy);
|
||||
bool is_persp = drw_view().winmat[3][3] == 0.0f;
|
||||
|
||||
float3 volume_center = drw_modelmat()[3].xyz;
|
||||
|
||||
float depth = do_depth_test ? texelFetch(depthBuffer, int2(gl_FragCoord.xy), 0).r : 1.0f;
|
||||
float depth = do_depth_test ? texelFetch(depth_buffer, int2(gl_FragCoord.xy), 0).r : 1.0f;
|
||||
float depth_end = min(depth, gl_FragCoord.z);
|
||||
float3 vs_ray_end = drw_point_screen_to_view(float3(screen_uv, depth_end));
|
||||
float3 vs_ray_ori = drw_point_screen_to_view(float3(screen_uv, 0.0f));
|
||||
@@ -287,9 +287,9 @@ void main()
|
||||
ls_ray_ori = (drw_object_orco(ls_ray_ori)) * 2.0f - 1.0f;
|
||||
ls_ray_end = (drw_object_orco(ls_ray_end)) * 2.0f - 1.0f;
|
||||
# else
|
||||
ls_ray_dir = (volumeObjectToTexture * float4(ls_ray_dir, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
ls_ray_ori = (volumeObjectToTexture * float4(ls_ray_ori, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
ls_ray_end = (volumeObjectToTexture * float4(ls_ray_end, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
ls_ray_dir = (volume_object_to_texture * float4(ls_ray_dir, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
ls_ray_ori = (volume_object_to_texture * float4(ls_ray_ori, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
ls_ray_end = (volume_object_to_texture * float4(ls_ray_end, 1.0f)).xyz * 2.0f - 1.0f;
|
||||
# endif
|
||||
|
||||
ls_ray_dir -= ls_ray_ori;
|
||||
@@ -309,13 +309,13 @@ void main()
|
||||
return;
|
||||
}
|
||||
|
||||
fragColor = volume_integration(ls_ray_ori,
|
||||
ls_ray_dir,
|
||||
stepLength,
|
||||
length(ls_vol_isect) / length(ls_ray_dir),
|
||||
length(vs_ray_dir) * stepLength);
|
||||
frag_color = volume_integration(ls_ray_ori,
|
||||
ls_ray_dir,
|
||||
step_length,
|
||||
length(ls_vol_isect) / length(ls_ray_dir),
|
||||
length(vs_ray_dir) * step_length);
|
||||
#endif
|
||||
|
||||
/* Convert transmittance to alpha so we can use pre-multiply blending. */
|
||||
fragColor.a = 1.0f - fragColor.a;
|
||||
frag_color.a = 1.0f - frag_color.a;
|
||||
}
|
||||
|
||||
@@ -19,16 +19,16 @@ void main()
|
||||
drw_ResourceID_iface.resource_index = drw_resource_id();
|
||||
|
||||
#ifdef VOLUME_SLICE
|
||||
if (sliceAxis == 0) {
|
||||
localPos = float3(slicePosition * 2.0f - 1.0f, pos.xy);
|
||||
if (slice_axis == 0) {
|
||||
local_position = float3(slice_position * 2.0f - 1.0f, pos.xy);
|
||||
}
|
||||
else if (sliceAxis == 1) {
|
||||
localPos = float3(pos.x, slicePosition * 2.0f - 1.0f, pos.y);
|
||||
else if (slice_axis == 1) {
|
||||
local_position = float3(pos.x, slice_position * 2.0f - 1.0f, pos.y);
|
||||
}
|
||||
else {
|
||||
localPos = float3(pos.xy, slicePosition * 2.0f - 1.0f);
|
||||
local_position = float3(pos.xy, slice_position * 2.0f - 1.0f);
|
||||
}
|
||||
float3 final_pos = localPos;
|
||||
float3 final_pos = local_position;
|
||||
#else
|
||||
float3 final_pos = pos;
|
||||
#endif
|
||||
@@ -37,7 +37,7 @@ void main()
|
||||
ObjectInfos info = drw_object_infos();
|
||||
final_pos = ((final_pos * 0.5f + 0.5f) - info.orco_add) / info.orco_mul;
|
||||
#else
|
||||
final_pos = (volumeTextureToObject * float4(final_pos * 0.5f + 0.5f, 1.0f)).xyz;
|
||||
final_pos = (volume_texture_to_object * float4(final_pos * 0.5f + 0.5f, 1.0f)).xyz;
|
||||
#endif
|
||||
gl_Position = drw_point_world_to_homogenous(drw_point_object_to_world(final_pos));
|
||||
}
|
||||
|
||||
@@ -147,10 +147,10 @@ float3 get_world_lighting(float3 base_color, float roughness, float metallic, fl
|
||||
return diffuse_light + specular_light;
|
||||
}
|
||||
|
||||
float get_shadow(float3 N, bool force_shadowing)
|
||||
float get_shadow(float3 N, bool force_shadow)
|
||||
{
|
||||
float light_factor = -dot(N, world_data.shadow_direction_vs.xyz);
|
||||
float shadow_mix = smoothstep(world_data.shadow_shift, world_data.shadow_focus, light_factor);
|
||||
shadow_mix *= force_shadowing ? 0.0f : world_data.shadow_mul;
|
||||
shadow_mix *= force_shadow ? 0.0f : world_data.shadow_mul;
|
||||
return shadow_mix + world_data.shadow_add;
|
||||
}
|
||||
|
||||
@@ -158,36 +158,36 @@ void AntiAliasingPass::sync(const SceneState &scene_state, SceneResources &resou
|
||||
DRW_STATE_WRITE_COLOR :
|
||||
DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ADD_FULL);
|
||||
taa_accumulation_ps_.shader_set(ShaderCache::get().taa_accumulation.get());
|
||||
taa_accumulation_ps_.bind_texture("colorBuffer", &resources.color_tx);
|
||||
taa_accumulation_ps_.bind_texture("color_buffer", &resources.color_tx);
|
||||
taa_accumulation_ps_.push_constant("samplesWeights", weights_, 9);
|
||||
taa_accumulation_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
smaa_edge_detect_ps_.init();
|
||||
smaa_edge_detect_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
smaa_edge_detect_ps_.shader_set(ShaderCache::get().smaa_edge_detect.get());
|
||||
smaa_edge_detect_ps_.bind_texture("colorTex", &taa_accumulation_tx_);
|
||||
smaa_edge_detect_ps_.push_constant("viewportMetrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_edge_detect_ps_.bind_texture("color_tx", &taa_accumulation_tx_);
|
||||
smaa_edge_detect_ps_.push_constant("viewport_metrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_edge_detect_ps_.clear_color(float4(0.0f));
|
||||
smaa_edge_detect_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
smaa_aa_weight_ps_.init();
|
||||
smaa_aa_weight_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
smaa_aa_weight_ps_.shader_set(ShaderCache::get().smaa_aa_weight.get());
|
||||
smaa_aa_weight_ps_.bind_texture("edgesTex", &smaa_edge_tx_);
|
||||
smaa_aa_weight_ps_.bind_texture("areaTex", smaa_area_tx_);
|
||||
smaa_aa_weight_ps_.bind_texture("searchTex", smaa_search_tx_);
|
||||
smaa_aa_weight_ps_.push_constant("viewportMetrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_aa_weight_ps_.bind_texture("edges_tx", &smaa_edge_tx_);
|
||||
smaa_aa_weight_ps_.bind_texture("area_tx", smaa_area_tx_);
|
||||
smaa_aa_weight_ps_.bind_texture("search_tx", smaa_search_tx_);
|
||||
smaa_aa_weight_ps_.push_constant("viewport_metrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_aa_weight_ps_.clear_color(float4(0.0f));
|
||||
smaa_aa_weight_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
smaa_resolve_ps_.init();
|
||||
smaa_resolve_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
smaa_resolve_ps_.shader_set(ShaderCache::get().smaa_resolve.get());
|
||||
smaa_resolve_ps_.bind_texture("blendTex", &smaa_weight_tx_);
|
||||
smaa_resolve_ps_.bind_texture("colorTex", &taa_accumulation_tx_);
|
||||
smaa_resolve_ps_.push_constant("viewportMetrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_resolve_ps_.push_constant("mixFactor", &smaa_mix_factor_, 1);
|
||||
smaa_resolve_ps_.push_constant("taaAccumulatedWeight", &weight_accum_, 1);
|
||||
smaa_resolve_ps_.bind_texture("blend_tx", &smaa_weight_tx_);
|
||||
smaa_resolve_ps_.bind_texture("color_tx", &taa_accumulation_tx_);
|
||||
smaa_resolve_ps_.push_constant("viewport_metrics", &smaa_viewport_metrics_, 1);
|
||||
smaa_resolve_ps_.push_constant("mix_factor", &smaa_mix_factor_, 1);
|
||||
smaa_resolve_ps_.push_constant("taa_accumulated_weight", &weight_accum_, 1);
|
||||
smaa_resolve_ps_.clear_color(float4(0.0f));
|
||||
smaa_resolve_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
@@ -167,47 +167,47 @@ void DofPass::sync(SceneResources &resources, const DRWContext *draw_ctx)
|
||||
down_ps_.init();
|
||||
down_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
down_ps_.shader_set(ShaderCache::get().dof_prepare.get());
|
||||
down_ps_.bind_texture("sceneColorTex", &resources.color_tx);
|
||||
down_ps_.bind_texture("sceneDepthTex", &resources.depth_tx);
|
||||
down_ps_.push_constant("invertedViewportSize", viewport_size_inv);
|
||||
down_ps_.push_constant("dofParams", float3(aperture_size_, distance_, invsensor_size_));
|
||||
down_ps_.push_constant("nearFar", float2(near_, far_));
|
||||
down_ps_.bind_texture("scene_color_tx", &resources.color_tx);
|
||||
down_ps_.bind_texture("scene_depth_tx", &resources.depth_tx);
|
||||
down_ps_.push_constant("inverted_viewport_size", viewport_size_inv);
|
||||
down_ps_.push_constant("dof_params", float3(aperture_size_, distance_, invsensor_size_));
|
||||
down_ps_.push_constant("near_far", float2(near_, far_));
|
||||
down_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
down2_ps_.init();
|
||||
down2_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
down2_ps_.shader_set(ShaderCache::get().dof_downsample.get());
|
||||
down2_ps_.bind_texture("sceneColorTex", &source_tx_, sampler_state);
|
||||
down2_ps_.bind_texture("inputCocTex", &coc_halfres_tx_, sampler_state);
|
||||
down2_ps_.bind_texture("scene_color_tx", &source_tx_, sampler_state);
|
||||
down2_ps_.bind_texture("input_coc_tx", &coc_halfres_tx_, sampler_state);
|
||||
down2_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
blur_ps_.init();
|
||||
blur_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
blur_ps_.shader_set(ShaderCache::get().dof_blur1.get());
|
||||
blur_ps_.bind_ubo("samples", samples_buf_);
|
||||
blur_ps_.bind_texture("noiseTex", resources.jitter_tx);
|
||||
blur_ps_.bind_texture("inputCocTex", &coc_halfres_tx_, sampler_state);
|
||||
blur_ps_.bind_texture("halfResColorTex", &source_tx_, sampler_state);
|
||||
blur_ps_.push_constant("invertedViewportSize", viewport_size_inv);
|
||||
blur_ps_.push_constant("noiseOffset", offset_);
|
||||
blur_ps_.bind_texture("noise_tx", resources.jitter_tx);
|
||||
blur_ps_.bind_texture("input_coc_tx", &coc_halfres_tx_, sampler_state);
|
||||
blur_ps_.bind_texture("half_res_color_tx", &source_tx_, sampler_state);
|
||||
blur_ps_.push_constant("inverted_viewport_size", viewport_size_inv);
|
||||
blur_ps_.push_constant("noise_offset", offset_);
|
||||
blur_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
blur2_ps_.init();
|
||||
blur2_ps_.state_set(DRW_STATE_WRITE_COLOR);
|
||||
blur2_ps_.shader_set(ShaderCache::get().dof_blur2.get());
|
||||
blur2_ps_.bind_texture("inputCocTex", &coc_halfres_tx_, sampler_state);
|
||||
blur2_ps_.bind_texture("blurTex", &blur_tx_);
|
||||
blur2_ps_.push_constant("invertedViewportSize", viewport_size_inv);
|
||||
blur2_ps_.bind_texture("input_coc_tx", &coc_halfres_tx_, sampler_state);
|
||||
blur2_ps_.bind_texture("blur_tx", &blur_tx_);
|
||||
blur2_ps_.push_constant("inverted_viewport_size", viewport_size_inv);
|
||||
blur2_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
|
||||
resolve_ps_.init();
|
||||
resolve_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_CUSTOM);
|
||||
resolve_ps_.shader_set(ShaderCache::get().dof_resolve.get());
|
||||
resolve_ps_.bind_texture("halfResColorTex", &source_tx_, sampler_state);
|
||||
resolve_ps_.bind_texture("sceneDepthTex", &resources.depth_tx);
|
||||
resolve_ps_.push_constant("invertedViewportSize", viewport_size_inv);
|
||||
resolve_ps_.push_constant("dofParams", float3(aperture_size_, distance_, invsensor_size_));
|
||||
resolve_ps_.push_constant("nearFar", float2(near_, far_));
|
||||
resolve_ps_.bind_texture("half_res_color_tx", &source_tx_, sampler_state);
|
||||
resolve_ps_.bind_texture("scene_depth_tx", &resources.depth_tx);
|
||||
resolve_ps_.push_constant("inverted_viewport_size", viewport_size_inv);
|
||||
resolve_ps_.push_constant("dof_params", float3(aperture_size_, distance_, invsensor_size_));
|
||||
resolve_ps_.push_constant("near_far", float2(near_, far_));
|
||||
resolve_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ void OutlinePass::sync(SceneResources &resources)
|
||||
ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL);
|
||||
ps_.shader_set(ShaderCache::get().outline.get());
|
||||
ps_.bind_ubo("world_data", resources.world_buf);
|
||||
ps_.bind_texture("objectIdBuffer", &resources.object_id_tx);
|
||||
ps_.bind_texture("object_id_buffer", &resources.object_id_tx);
|
||||
ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -74,13 +74,13 @@ PassMain::Sub &MeshPass::get_subpass(eGeometryType geometry_type,
|
||||
else {
|
||||
sub_pass->bind_texture(WB_TEXTURE_SLOT, texture->gpu.texture, texture->sampler_state);
|
||||
}
|
||||
sub_pass->push_constant("isImageTile", texture->gpu.tile_mapping != nullptr);
|
||||
sub_pass->push_constant("imagePremult", texture->premultiplied);
|
||||
sub_pass->push_constant("is_image_tile", texture->gpu.tile_mapping != nullptr);
|
||||
sub_pass->push_constant("image_premult", texture->premultiplied);
|
||||
/* TODO(@pragma37): This setting should be exposed on the user side,
|
||||
* either as a global parameter (and set it here)
|
||||
* or by reading the Material Clipping Threshold (and set it per material) */
|
||||
float alpha_cutoff = texture->alpha_cutoff ? 0.1f : -FLT_MAX;
|
||||
sub_pass->push_constant("imageTransparencyCutoff", alpha_cutoff);
|
||||
sub_pass->push_constant("image_transparency_cutoff", alpha_cutoff);
|
||||
return sub_pass;
|
||||
};
|
||||
|
||||
@@ -121,7 +121,7 @@ void OpaquePass::sync(const SceneState &scene_state, SceneResources &resources)
|
||||
scene_state.draw_cavity,
|
||||
scene_state.draw_curvature,
|
||||
scene_state.draw_shadows));
|
||||
deferred_ps_.push_constant("forceShadowing", false);
|
||||
deferred_ps_.push_constant("force_shadowing", false);
|
||||
deferred_ps_.bind_ubo(WB_WORLD_SLOT, resources.world_buf);
|
||||
deferred_ps_.bind_texture(WB_MATCAP_SLOT, resources.matcap_tx);
|
||||
deferred_ps_.bind_texture("normal_tx", &gbuffer_normal_tx);
|
||||
@@ -240,8 +240,8 @@ void TransparentPass::sync(const SceneState &scene_state, SceneResources &resour
|
||||
resolve_ps_.init();
|
||||
resolve_ps_.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA);
|
||||
resolve_ps_.shader_set(ShaderCache::get().transparent_resolve.get());
|
||||
resolve_ps_.bind_texture("transparentAccum", &accumulation_tx);
|
||||
resolve_ps_.bind_texture("transparentRevealage", &reveal_tx);
|
||||
resolve_ps_.bind_texture("transparent_accum", &accumulation_tx);
|
||||
resolve_ps_.bind_texture("transparent_revealage", &reveal_tx);
|
||||
resolve_ps_.draw_procedural(GPU_PRIM_TRIS, 1, 3);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,18 +57,18 @@ void VolumePass::object_sync_volume(Manager &manager,
|
||||
ShaderCache::get().volume_get(false, volume.display.interpolation_method, false, use_slice));
|
||||
sub_ps.push_constant("do_depth_test", scene_state.shading.type >= OB_SOLID);
|
||||
|
||||
const float density_scale = volume.display.density *
|
||||
BKE_volume_density_scale(&volume, ob->object_to_world().ptr());
|
||||
const float density_fac = volume.display.density *
|
||||
BKE_volume_density_scale(&volume, ob->object_to_world().ptr());
|
||||
|
||||
sub_ps.bind_texture("depthBuffer", &resources.depth_tx);
|
||||
sub_ps.bind_texture("depth_buffer", &resources.depth_tx);
|
||||
sub_ps.bind_texture("stencil_tx", &stencil_tx_);
|
||||
sub_ps.bind_texture("densityTexture", grid->texture);
|
||||
sub_ps.bind_texture("density_tx", grid->texture);
|
||||
/* TODO: implement shadow texture, see manta_smoke_calc_transparency. */
|
||||
sub_ps.bind_texture("shadowTexture", dummy_shadow_tx_);
|
||||
sub_ps.push_constant("activeColor", color);
|
||||
sub_ps.push_constant("densityScale", density_scale);
|
||||
sub_ps.push_constant("volumeObjectToTexture", float4x4(grid->object_to_texture));
|
||||
sub_ps.push_constant("volumeTextureToObject", float4x4(grid->texture_to_object));
|
||||
sub_ps.bind_texture("shadow_tx", dummy_shadow_tx_);
|
||||
sub_ps.push_constant("active_color", color);
|
||||
sub_ps.push_constant("density_fac", density_fac);
|
||||
sub_ps.push_constant("volume_object_to_texture", float4x4(grid->object_to_texture));
|
||||
sub_ps.push_constant("volume_texture_to_object", float4x4(grid->texture_to_object));
|
||||
|
||||
if (use_slice) {
|
||||
draw_slice_ps(
|
||||
@@ -135,40 +135,39 @@ void VolumePass::object_sync_modifier(Manager &manager,
|
||||
FLUID_DOMAIN_FIELD_PHI_OUT,
|
||||
FLUID_DOMAIN_FIELD_PHI_OBSTACLE);
|
||||
|
||||
sub_ps.push_constant("showFlags", show_flags);
|
||||
sub_ps.push_constant("showPressure", show_pressure);
|
||||
sub_ps.push_constant("showPhi", show_phi);
|
||||
sub_ps.push_constant("gridScale", settings.grid_scale);
|
||||
sub_ps.push_constant("show_flags", show_flags);
|
||||
sub_ps.push_constant("show_pressure", show_pressure);
|
||||
sub_ps.push_constant("show_phi", show_phi);
|
||||
sub_ps.push_constant("grid_scale", settings.grid_scale);
|
||||
|
||||
if (show_flags) {
|
||||
sub_ps.bind_texture("flagTexture", settings.tex_field);
|
||||
sub_ps.bind_texture("flag_tx", settings.tex_field);
|
||||
}
|
||||
else {
|
||||
sub_ps.bind_texture("densityTexture", settings.tex_field);
|
||||
sub_ps.bind_texture("density_tx", settings.tex_field);
|
||||
}
|
||||
|
||||
if (!show_flags && !show_pressure && !show_phi) {
|
||||
sub_ps.bind_texture("transferTexture", settings.tex_coba);
|
||||
sub_ps.bind_texture("transfer_tx", settings.tex_coba);
|
||||
}
|
||||
}
|
||||
else {
|
||||
bool use_constant_color = ((settings.active_fields & FLUID_DOMAIN_ACTIVE_COLORS) == 0 &&
|
||||
(settings.active_fields & FLUID_DOMAIN_ACTIVE_COLOR_SET) != 0);
|
||||
|
||||
sub_ps.push_constant("activeColor",
|
||||
sub_ps.push_constant("active_color",
|
||||
use_constant_color ? float3(settings.active_color) : float3(1));
|
||||
|
||||
sub_ps.bind_texture("densityTexture",
|
||||
sub_ps.bind_texture("density_tx",
|
||||
settings.tex_color ? settings.tex_color : settings.tex_density);
|
||||
sub_ps.bind_texture("flameTexture",
|
||||
settings.tex_flame ? settings.tex_flame : dummy_volume_tx_);
|
||||
sub_ps.bind_texture("flameColorTexture",
|
||||
sub_ps.bind_texture("flame_tx", settings.tex_flame ? settings.tex_flame : dummy_volume_tx_);
|
||||
sub_ps.bind_texture("flame_color_tx",
|
||||
settings.tex_flame ? settings.tex_flame_coba : dummy_coba_tx_);
|
||||
sub_ps.bind_texture("shadowTexture", settings.tex_shadow);
|
||||
sub_ps.bind_texture("shadow_tx", settings.tex_shadow);
|
||||
}
|
||||
|
||||
sub_ps.push_constant("densityScale", 10.0f * settings.display_thickness);
|
||||
sub_ps.bind_texture("depthBuffer", &resources.depth_tx);
|
||||
sub_ps.push_constant("density_fac", 10.0f * settings.display_thickness);
|
||||
sub_ps.bind_texture("depth_buffer", &resources.depth_tx);
|
||||
sub_ps.bind_texture("stencil_tx", &stencil_tx_);
|
||||
|
||||
if (use_slice) {
|
||||
@@ -217,9 +216,9 @@ void VolumePass::draw_slice_ps(Manager &manager,
|
||||
float step_length = std::max(1e-16f, dimensions[axis] * 0.05f);
|
||||
|
||||
ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL | DRW_STATE_CULL_FRONT);
|
||||
ps.push_constant("slicePosition", slice_depth);
|
||||
ps.push_constant("sliceAxis", axis);
|
||||
ps.push_constant("stepLength", step_length);
|
||||
ps.push_constant("slice_position", slice_depth);
|
||||
ps.push_constant("slice_axis", axis);
|
||||
ps.push_constant("step_length", step_length);
|
||||
|
||||
ps.draw(resources.volume_cube_batch, manager.resource_handle(ob_ref));
|
||||
}
|
||||
@@ -239,9 +238,9 @@ void VolumePass::draw_volume_ps(Manager &manager,
|
||||
float step_length = math::length((1.0f / slice_count) * world_size);
|
||||
|
||||
ps.state_set(DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL | DRW_STATE_CULL_FRONT);
|
||||
ps.push_constant("samplesLen", max_slice);
|
||||
ps.push_constant("stepLength", step_length);
|
||||
ps.push_constant("noiseOfs", float(noise_offset));
|
||||
ps.push_constant("samples_len", max_slice);
|
||||
ps.push_constant("step_length", step_length);
|
||||
ps.push_constant("noise_ofs", float(noise_offset));
|
||||
|
||||
ps.draw(resources.volume_cube_batch, manager.resource_handle(ob_ref));
|
||||
}
|
||||
|
||||
@@ -69,12 +69,12 @@ float gpencil_decode_hardness(int packed_data)
|
||||
return float((uint(packed_data) & 0x3FC0000u) >> 18u) * (1.0f / 255.0f);
|
||||
}
|
||||
|
||||
float2 gpencil_project_to_screenspace(float4 v, float4 viewport_size)
|
||||
float2 gpencil_project_to_screenspace(float4 v, float4 viewport_res)
|
||||
{
|
||||
return ((v.xy / v.w) * 0.5f + 0.5f) * viewport_size.xy;
|
||||
return ((v.xy / v.w) * 0.5f + 0.5f) * viewport_res.xy;
|
||||
}
|
||||
|
||||
float gpencil_stroke_thickness_modulate(float thickness, float4 ndc_pos, float4 viewport_size)
|
||||
float gpencil_stroke_thickness_modulate(float thickness, float4 ndc_pos, float4 viewport_res)
|
||||
{
|
||||
/* Modify stroke thickness by object scale. */
|
||||
thickness = length(to_float3x3(drw_modelmat()) * float3(thickness * M_SQRT1_3));
|
||||
@@ -88,7 +88,7 @@ float gpencil_stroke_thickness_modulate(float thickness, float4 ndc_pos, float4
|
||||
thickness /= legacy_radius_conversion_factor;
|
||||
|
||||
/* World space point size. */
|
||||
thickness *= drw_view().winmat[1][1] * viewport_size.y;
|
||||
thickness *= drw_view().winmat[1][1] * viewport_res.y;
|
||||
|
||||
return thickness;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ bool gpencil_is_stroke_vertex()
|
||||
* WARNING: Max attribute count is actually 14 because OSX OpenGL implementation
|
||||
* considers gl_VertexID and gl_InstanceID as vertex attribute. (see #74536)
|
||||
*/
|
||||
float4 gpencil_vertex(float4 viewport_size,
|
||||
float4 gpencil_vertex(float4 viewport_res,
|
||||
gpMaterialFlag material_flags,
|
||||
float2 alignment_rot,
|
||||
/* World Position. */
|
||||
@@ -243,16 +243,16 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
out_P = (use_curr) ? wpos1 : wpos2;
|
||||
out_strength = abs((use_curr) ? strength1 : strength2);
|
||||
|
||||
float2 ss_adj = gpencil_project_to_screenspace(ndc_adj, viewport_size);
|
||||
float2 ss1 = gpencil_project_to_screenspace(ndc1, viewport_size);
|
||||
float2 ss2 = gpencil_project_to_screenspace(ndc2, viewport_size);
|
||||
float2 ss_adj = gpencil_project_to_screenspace(ndc_adj, viewport_res);
|
||||
float2 ss1 = gpencil_project_to_screenspace(ndc1, viewport_res);
|
||||
float2 ss2 = gpencil_project_to_screenspace(ndc2, viewport_res);
|
||||
/* Screen-space Lines tangents. */
|
||||
float line_len;
|
||||
float2 line = safe_normalize_and_get_length(ss2 - ss1, line_len);
|
||||
float2 line_adj = safe_normalize((use_curr) ? (ss1 - ss_adj) : (ss_adj - ss2));
|
||||
|
||||
float thickness = abs((use_curr) ? thickness1 : thickness2);
|
||||
thickness = gpencil_stroke_thickness_modulate(thickness, out_ndc, viewport_size);
|
||||
thickness = gpencil_stroke_thickness_modulate(thickness, out_ndc, viewport_res);
|
||||
float clamped_thickness = gpencil_clamp_small_stroke_thickness(thickness, out_ndc);
|
||||
|
||||
out_uv = float2(x, y) * 0.5f + 0.5f;
|
||||
@@ -276,7 +276,7 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
}
|
||||
else { /* GP_STROKE_ALIGNMENT_OBJECT */
|
||||
float4 ndc_x = drw_point_world_to_homogenous(wpos1 + drw_modelmat()[0].xyz);
|
||||
float2 ss_x = gpencil_project_to_screenspace(ndc_x, viewport_size);
|
||||
float2 ss_x = gpencil_project_to_screenspace(ndc_x, viewport_res);
|
||||
x_axis = safe_normalize(ss_x - ss1);
|
||||
}
|
||||
|
||||
@@ -300,7 +300,7 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
/* Invert for vertex shader. */
|
||||
out_aspect = 1.0f / out_aspect;
|
||||
|
||||
out_ndc.xy += (x * x_axis + y * y_axis) * viewport_size.zw * clamped_thickness;
|
||||
out_ndc.xy += (x * x_axis + y * y_axis) * viewport_res.zw * clamped_thickness;
|
||||
|
||||
out_sspos.xy = ss1;
|
||||
out_sspos.zw = ss1 + x_axis * 0.5f;
|
||||
@@ -337,7 +337,7 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
screen_ofs += line * x;
|
||||
}
|
||||
|
||||
out_ndc.xy += screen_ofs * viewport_size.zw * clamped_thickness;
|
||||
out_ndc.xy += screen_ofs * viewport_res.zw * clamped_thickness;
|
||||
|
||||
out_uv.x = (use_curr) ? uv1.z : uv2.z;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
return out_ndc;
|
||||
}
|
||||
|
||||
float4 gpencil_vertex(float4 viewport_size,
|
||||
float4 gpencil_vertex(float4 viewport_res,
|
||||
out float3 out_P,
|
||||
out float3 out_N,
|
||||
out float4 out_color,
|
||||
@@ -391,7 +391,7 @@ float4 gpencil_vertex(float4 viewport_size,
|
||||
out float2 out_thickness,
|
||||
out float out_hardness)
|
||||
{
|
||||
return gpencil_vertex(viewport_size,
|
||||
return gpencil_vertex(viewport_res,
|
||||
gpMaterialFlag(0u),
|
||||
float2(1.0f, 0.0f),
|
||||
out_P,
|
||||
|
||||
Reference in New Issue
Block a user