Blender  V3.3
COM_MapValueOperation.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. */
3 
5 
6 namespace blender::compositor {
7 
9 {
12  input_operation_ = nullptr;
13  flags_.can_be_constant = true;
14 }
15 
17 {
18  input_operation_ = this->get_input_socket_reader(0);
19 }
20 
22  float x,
23  float y,
25 {
26  float src[4];
27  input_operation_->read_sampled(src, x, y, sampler);
28  TexMapping *texmap = settings_;
29  float value = (src[0] + texmap->loc[0]) * texmap->size[0];
30  if (texmap->flag & TEXMAP_CLIP_MIN) {
31  if (value < texmap->min[0]) {
32  value = texmap->min[0];
33  }
34  }
35  if (texmap->flag & TEXMAP_CLIP_MAX) {
36  if (value > texmap->max[0]) {
37  value = texmap->max[0];
38  }
39  }
40 
41  output[0] = value;
42 }
43 
45 {
46  input_operation_ = nullptr;
47 }
48 
50  const rcti &area,
52 {
53  for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) {
54  const float input = *it.in(0);
55  TexMapping *texmap = settings_;
56  float value = (input + texmap->loc[0]) * texmap->size[0];
57  if (texmap->flag & TEXMAP_CLIP_MIN) {
58  if (value < texmap->min[0]) {
59  value = texmap->min[0];
60  }
61  }
62  if (texmap->flag & TEXMAP_CLIP_MAX) {
63  if (value > texmap->max[0]) {
64  value = texmap->max[0];
65  }
66  }
67 
68  it.out[0] = value;
69  }
70 }
71 
72 } // namespace blender::compositor
#define TEXMAP_CLIP_MIN
#define TEXMAP_CLIP_MAX
_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 update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override
a MemoryBuffer contains access to the data of a chunk
void add_output_socket(DataType datatype)
SocketReader * get_input_socket_reader(unsigned int index)
void read_sampled(float result[4], float x, float y, PixelSampler sampler)
void add_input_socket(DataType datatype, ResizeMode resize_mode=ResizeMode::Center)
SyclQueue void void * src
depth_tx sampler(1, ImageType::FLOAT_2D, "combined_tx") .sampler(2
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])
typename BuffersIteratorBuilder< T >::Iterator BuffersIterator
static bNodeSocketTemplate inputs[]
#define min(a, b)
Definition: sort.c:35