30 b.add_output<
decl::Color>(
N_(
"Color")).no_muted_links().dependent_field();
31 b.add_output<
decl::Float>(
N_(
"Alpha")).no_muted_links().dependent_field();
48 const int interpolation_;
60 : interpolation_(interpolation),
61 extension_(extension),
63 image_user_(image_user)
69 if (image_buffer_ ==
nullptr) {
70 throw std::runtime_error(
"cannot acquire image buffer");
83 throw std::runtime_error(
"cannot get float buffer");
117 if (px < 0 || py < 0 || px >= ibuf->
x || py >= ibuf->
y) {
118 return float4(0.0f, 0.0f, 0.0f, 0.0f);
123 static float frac(
const float x,
int *ix)
125 const int i = (int)
x - ((
x < 0.0f) ? 1 : 0);
135 const int width = ibuf->
x;
137 int pix, piy, nix, niy;
138 const float tx =
frac(px * (
float)
width - 0.5f, &pix);
139 const float ty =
frac(py * (
float)
height - 0.5f, &piy);
140 int ppix, ppiy, nnix, nniy;
175 return float4(0.0f, 0.0f, 0.0f, 0.0f);
178 const int xc[4] = {ppix, pix, nix, nnix};
179 const int yc[4] = {ppiy, piy, niy, nniy};
182 u[0] = (((-1.0f / 6.0f) * tx + 0.5f) * tx - 0.5f) * tx + (1.0f / 6.0f);
183 u[1] = ((0.5f * tx - 1.0f) * tx) * tx + (2.0f / 3.0f);
184 u[2] = ((-0.5f * tx + 0.5f) * tx + 0.5f) * tx + (1.0f / 6.0f);
185 u[3] = (1.0f / 6.0f) * tx * tx * tx;
187 v[0] = (((-1.0f / 6.0f) * ty + 0.5f) * ty - 0.5f) * ty + (1.0f / 6.0f);
188 v[1] = ((0.5f * ty - 1.0f) * ty) * ty + (2.0f / 3.0f);
189 v[2] = ((-0.5f * ty + 0.5f) * ty + 0.5f) * ty + (1.0f / 6.0f);
190 v[3] = (1.0f / 6.0f) * ty * ty * ty;
215 const int width = ibuf->
x;
217 int pix, piy, nix, niy;
218 const float nfx =
frac(px * (
float)
width - 0.5f, &pix);
219 const float nfy =
frac(py * (
float)
height - 0.5f, &piy);
243 const float ptx = 1.0f - nfx;
244 const float pty = 1.0f - nfy;
257 const int width = ibuf->
x;
260 const float tx =
frac(px * (
float)
width, &ix);
261 const float ty =
frac(py * (
float)
height, &iy);
270 if (tx < 0.0f || ty < 0.0f || tx > 1.0f || ty > 1.0f) {
271 return float4(0.0f, 0.0f, 0.0f, 0.0f);
273 if (ix < 0 || iy < 0 || ix >
width || iy >
height) {
274 return float4(0.0f, 0.0f, 0.0f, 0.0f);
284 return float4(0.0f, 0.0f, 0.0f, 0.0f);
298 switch (interpolation_) {
301 const float3 p = vectors[i];
307 const float3 p = vectors[i];
314 const float3 p = vectors[i];
325 switch (alpha_mode) {
344 color_data[i].w = 1.0f;
350 if (!r_alpha.is_empty()) {
352 r_alpha[i] = r_color[i].a;
361 if (
image ==
nullptr) {
362 params.set_default_remaining_outputs();
370 image_user.
cycl =
false;
371 image_user.
frames = INT_MAX;
375 std::unique_ptr<ImageFieldsFunction> image_fn;
377 image_fn = std::make_unique<ImageFieldsFunction>(
380 catch (
const std::runtime_error &) {
381 params.set_default_remaining_outputs();
387 auto image_op = std::make_shared<FieldOperation>(
typedef float(TangentPoint)[2]
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
bool BKE_image_is_animated(struct Image *image)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
void BKE_imageuser_default(struct ImageUser *iuser)
#define NODE_STORAGE_FUNCS(StorageT)
void node_type_init(struct bNodeType *ntype, void(*initfunc)(struct bNodeTree *ntree, struct bNode *node))
void node_type_size_preset(struct bNodeType *ntype, eNodeSizePreset size)
#define GEO_NODE_IMAGE_TEXTURE
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
#define NODE_CLASS_TEXTURE
void nodeRegisterType(struct bNodeType *ntype)
MINLINE void straight_to_premul_v4(float color[4])
void BLI_thread_unlock(int type)
void BLI_thread_lock(int type)
@ IMA_ALPHA_CHANNEL_PACKED
#define SHD_IMAGE_EXTENSION_CLIP
#define SHD_IMAGE_EXTENSION_EXTEND
#define SHD_IMAGE_EXTENSION_REPEAT
#define SHD_INTERP_CLOSEST
#define SHD_INTERP_LINEAR
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei height
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei width
bool IMB_colormanagement_space_name_is_data(const char *name)
void IMB_float_from_rect(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ColorManagedColorspaceSettings colorspace_settings
constexpr T * data() const
void set_signature(const MFSignature *signature)
const MFSignature & signature() const
StringRefNull description() const
~ImageFieldsFunction() override
static float4 image_closest_texture_lookup(const ImBuf *ibuf, const float px, const float py, const int extension)
static float frac(const float x, int *ix)
static int wrap_clamp(const int x, const int width)
ImageFieldsFunction(const int interpolation, const int extension, Image &image, ImageUser image_user)
static int wrap_periodic(int x, const int width)
void call(IndexMask mask, fn::MFParams params, fn::MFContext UNUSED(context)) const override
static float4 image_cubic_texture_lookup(const ImBuf *ibuf, const float px, const float py, const int extension)
static float4 image_linear_texture_lookup(const ImBuf *ibuf, const float px, const float py, const int extension)
static float4 image_pixel_lookup(const ImBuf *ibuf, const int px, const int py)
static fn::MFSignature create_signature()
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
T clamp(const T &a, const T &min, const T &max)
static void node_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
static void node_geo_exec(GeoNodeExecParams params)
static void node_init(bNodeTree *UNUSED(ntree), bNode *node)
static void node_declare(NodeDeclarationBuilder &b)
vec_base< float, 4 > float4
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static void node_init(const struct bContext *C, bNodeTree *ntree, bNode *node)
void register_node_type_geo_image_texture()
void geo_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
NodeGeometryExecFunction geometry_node_execute
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
NodeDeclareFunction declare