26#define MINIMUM_DISTORTION -0.999f
28#define PROJECTOR_DISPERSION_SCALE 5.0f
30#define SCREEN_DISPERSION_SCALE 4.0f
32#define DISTORTION_SCALE 4.0f
41 .default_value({1.0f, 1.0f, 1.0f, 1.0f})
42 .compositor_domain_priority(0);
154 return "compositor_screen_lens_distortion_jitter";
156 return "compositor_screen_lens_distortion";
168 return clamp_f(input.get_float_value_default(0.0f), 0.0f, 1.0f);
191 const float maximum_distortion =
max_fff(distortion[0], distortion[1], distortion[2]);
193 if (
get_is_fit() && (maximum_distortion > 0.0f)) {
194 return 1.0f / (1.0f + 2.0f * maximum_distortion);
196 return 1.0f / (1.0f + maximum_distortion);
201 return node_storage(
bnode()).proj;
206 return node_storage(
bnode()).jit;
211 return node_storage(
bnode()).fit;
218 if (
get_input(
"Image").is_single_value()) {
251 ntype.
declare = file_ns::cmp_node_lensdist_declare;
252 ntype.
draw_buttons = file_ns::node_composit_buts_lensdist;
253 ntype.
initfunc = file_ns::node_composit_init_lensdist;
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_DISTORT
MINLINE float max_fff(float a, float b, float c)
MINLINE float clamp_f(float value, float min, float max)
void GPU_shader_uniform_1f(GPUShader *sh, const char *name, float value)
void GPU_shader_uniform_3fv(GPUShader *sh, const char *name, const float data[3])
void GPU_shader_bind(GPUShader *shader)
void GPU_texture_extend_mode(GPUTexture *texture, GPUSamplerExtendMode extend_mode)
@ GPU_SAMPLER_EXTEND_MODE_CLAMP_TO_BORDER
void GPU_texture_filter_mode(GPUTexture *texture, bool use_filter)
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
@ UI_ITEM_R_SPLIT_EMPTY_NAME
struct GPUShader GPUShader
bool compositor_expects_single_value() const
void execute_projector_distortion()
const char * get_screen_distortion_shader()
float3 compute_chromatic_distortion()
void execute_screen_distortion()
GPUShader * get_shader(const char *info_name, ResultPrecision precision)
NodeOperation(Context &context, DNode node)
const bNode & bnode() const
Result & get_input(StringRef identifier) const
Result & get_result(StringRef identifier)
Context & context() const
virtual Domain compute_domain()
void bind_as_image(GPUShader *shader, const char *image_name, bool read=false) const
void pass_through(Result &target)
void unbind_as_texture() const
void unbind_as_image() const
void allocate_texture(Domain domain, bool from_pool=true)
void bind_as_texture(GPUShader *shader, const char *texture_name) const
local_group_size(16, 16) .push_constant(Type b
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
void node_register_type(bNodeType *ntype)
static void node_composit_buts_lensdist(uiLayout *layout, bContext *, PointerRNA *ptr)
static NodeOperation * get_compositor_operation(Context &context, DNode node)
static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b)
static void node_composit_init_lensdist(bNodeTree *, bNode *node)
void compute_dispatch_threads_at_least(GPUShader *shader, int2 threads_range, int2 local_size=int2(16))
VecBase< float, 3 > float3
void register_node_type_cmp_lensdist()
#define SCREEN_DISPERSION_SCALE
#define MINIMUM_DISTORTION
#define PROJECTOR_DISPERSION_SCALE
void cmp_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
NodeGetCompositorOperationFunction get_compositor_operation
void(* initfunc)(bNodeTree *ntree, bNode *node)
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
NodeDeclareFunction declare