17 inputUVProgram_ =
nullptr;
18 input_color_program_ =
nullptr;
37 uv_input_read_fn_ = [=](
float x,
float y,
float *
out) {
49 float uv[2], deriv[2][2], alpha;
65 float du =
len_v2(deriv[0]);
66 float dv =
len_v2(deriv[1]);
82 bool MapUVOperation::read_uv(
float x,
float y,
float &r_u,
float &r_v,
float &r_alpha)
84 if (x < 0.0f || x >= uv_width_ || y < 0.0f || y >= uv_height_) {
93 r_u =
vector[0] * image_width_;
94 r_v =
vector[1] * image_height_;
107 read_uv(
xy[0],
xy[1], r_uv[0], r_uv[1], r_alpha);
110 const float epsilon[2] = {1.0f, 1.0f};
116 if (read_uv(
xy[0] +
epsilon[0],
xy[1], uv[0], uv[1], alpha)) {
117 r_deriv[0][0] += uv[0] - r_uv[0];
118 r_deriv[1][0] += uv[1] - r_uv[1];
121 if (read_uv(
xy[0] -
epsilon[0],
xy[1], uv[0], uv[1], alpha)) {
122 r_deriv[0][0] += r_uv[0] - uv[0];
123 r_deriv[1][0] += r_uv[1] - uv[1];
127 float numinv = 1.0f / (
float)num;
128 r_deriv[0][0] *= numinv;
129 r_deriv[1][0] *= numinv;
133 if (read_uv(
xy[0],
xy[1] +
epsilon[1], uv[0], uv[1], alpha)) {
134 r_deriv[0][1] += uv[0] - r_uv[0];
135 r_deriv[1][1] += uv[1] - r_uv[1];
138 if (read_uv(
xy[0],
xy[1] -
epsilon[1], uv[0], uv[1], alpha)) {
139 r_deriv[0][1] += r_uv[0] - uv[0];
140 r_deriv[1][1] += r_uv[1] - uv[1];
144 float numinv = 1.0f / (
float)num;
145 r_deriv[0][1] *= numinv;
146 r_deriv[1][1] *= numinv;
152 inputUVProgram_ =
nullptr;
153 input_color_program_ =
nullptr;
168 color_input.
xmin = 0;
170 color_input.
ymin = 0;
188 const rcti &output_area,
192 case IMAGE_INPUT_INDEX: {
196 case UV_INPUT_INDEX: {
197 r_input_area = output_area;
209 uv_input_read_fn_ = [=](
float x,
float y,
float *
out) {
220 float xy[2] = {(
float)it.x, (
float)it.y};
238 const float du =
len_v2(deriv[0]);
239 const float dv =
len_v2(deriv[1]);
240 const float factor = 1.0f -
threshold * (du / image_width_ + dv / image_height_);
typedef float(TangentPoint)[2]
MINLINE void mul_v4_fl(float r[4], float f)
MINLINE void zero_v4(float r[4])
MINLINE void zero_v2(float r[2])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
_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 y
void init_data() override
void deinit_execution() override
void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override
Get input operation area being read by this operation on rendering given output area.
void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void update_memory_buffer_started(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
void pixel_transform(const float xy[2], float r_uv[2], float r_deriv[2][2], float &r_alpha)
void init_execution() override
bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output) override
a MemoryBuffer contains access to the data of a chunk
void read_elem_bilinear(float x, float y, float *out) const
void read_elem_filtered(float x, float y, float dx[2], float dy[2], float *out) const
NodeOperation contains calculation logic.
unsigned int get_height() const
void add_output_socket(DataType datatype)
void read_filtered(float result[4], float x, float y, float dx[2], float dy[2])
SocketReader * get_input_socket_reader(unsigned int index)
unsigned int get_width() const
eExecutionModel execution_model_
NodeOperationFlags flags_
const rcti & get_canvas() const
NodeOperation * get_input_operation(int index)
virtual bool determine_depending_area_of_interest(rcti *input, ReadBufferOperation *read_operation, rcti *output)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
void set_canvas_input_index(unsigned int index)
set the index of the input socket that will determine the canvas of this operation
@ Vector
Vector data type.
ccl_gpu_kernel_postfix ccl_global float int int int int float threshold
ccl_global KernelShaderEvalInput ccl_global float * output
ccl_global KernelShaderEvalInput * input
static void area(int d1, int d2, int e1, int e2, float weights[2])
void expand_area_for_sampler(rcti &area, PixelSampler sampler)
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
static bNodeSocketTemplate inputs[]