diff options
author | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:01:15 +0300 |
---|---|---|
committer | Manuel Castilla <manzanillawork@gmail.com> | 2021-10-14 00:41:14 +0300 |
commit | 1c42d4930a24d639b3aa561b9a8b4bbce05977e0 (patch) | |
tree | 68c2aae3fd5ae98b78708bea28c0b55d3f4fb5f0 /source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc | |
parent | a2ee3c3a9f01f5cb2f05f1e84a1b6c1931d9d4a4 (diff) |
Cleanup: convert camelCase naming to snake_case in Compositor
To convert old code to the current convention and
use a single code style.
Diffstat (limited to 'source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc | 109 |
1 files changed, 54 insertions, 55 deletions
diff --git a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc index 77d7831c680..729b01d924d 100644 --- a/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc +++ b/source/blender/compositor/operations/COM_DisplaceSimpleOperation.cc @@ -22,108 +22,107 @@ namespace blender::compositor { DisplaceSimpleOperation::DisplaceSimpleOperation() { - this->addInputSocket(DataType::Color); - this->addInputSocket(DataType::Vector); - this->addInputSocket(DataType::Value); - this->addInputSocket(DataType::Value); - this->addOutputSocket(DataType::Color); - - inputColorProgram_ = nullptr; - inputVectorProgram_ = nullptr; - inputScaleXProgram_ = nullptr; - inputScaleYProgram_ = nullptr; + this->add_input_socket(DataType::Color); + this->add_input_socket(DataType::Vector); + this->add_input_socket(DataType::Value); + this->add_input_socket(DataType::Value); + this->add_output_socket(DataType::Color); + + input_color_program_ = nullptr; + input_vector_program_ = nullptr; + input_scale_xprogram_ = nullptr; + input_scale_yprogram_ = nullptr; } -void DisplaceSimpleOperation::initExecution() +void DisplaceSimpleOperation::init_execution() { - inputColorProgram_ = this->getInputSocketReader(0); - inputVectorProgram_ = this->getInputSocketReader(1); - inputScaleXProgram_ = this->getInputSocketReader(2); - inputScaleYProgram_ = this->getInputSocketReader(3); + input_color_program_ = this->get_input_socket_reader(0); + input_vector_program_ = this->get_input_socket_reader(1); + input_scale_xprogram_ = this->get_input_socket_reader(2); + input_scale_yprogram_ = this->get_input_socket_reader(3); - width_x4_ = this->getWidth() * 4; - height_x4_ = this->getHeight() * 4; + width_x4_ = this->get_width() * 4; + height_x4_ = this->get_height() * 4; } /* minimum distance (in pixels) a pixel has to be displaced * in order to take effect */ // #define DISPLACE_EPSILON 0.01f -void DisplaceSimpleOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void DisplaceSimpleOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float inVector[4]; - float inScale[4]; + float in_vector[4]; + float in_scale[4]; float p_dx, p_dy; /* main displacement in pixel space */ float u, v; - inputScaleXProgram_->readSampled(inScale, x, y, sampler); - float xs = inScale[0]; - inputScaleYProgram_->readSampled(inScale, x, y, sampler); - float ys = inScale[0]; + input_scale_xprogram_->read_sampled(in_scale, x, y, sampler); + float xs = in_scale[0]; + input_scale_yprogram_->read_sampled(in_scale, x, y, sampler); + float ys = in_scale[0]; /* clamp x and y displacement to triple image resolution - * to prevent hangs from huge values mistakenly plugged in eg. z buffers */ CLAMP(xs, -width_x4_, width_x4_); CLAMP(ys, -height_x4_, height_x4_); - inputVectorProgram_->readSampled(inVector, x, y, sampler); - p_dx = inVector[0] * xs; - p_dy = inVector[1] * ys; + input_vector_program_->read_sampled(in_vector, x, y, sampler); + p_dx = in_vector[0] * xs; + p_dy = in_vector[1] * ys; /* displaced pixel in uv coords, for image sampling */ /* clamp nodes to avoid glitches */ u = x - p_dx + 0.5f; v = y - p_dy + 0.5f; - CLAMP(u, 0.0f, this->getWidth() - 1.0f); - CLAMP(v, 0.0f, this->getHeight() - 1.0f); + CLAMP(u, 0.0f, this->get_width() - 1.0f); + CLAMP(v, 0.0f, this->get_height() - 1.0f); - inputColorProgram_->readSampled(output, u, v, sampler); + input_color_program_->read_sampled(output, u, v, sampler); } -void DisplaceSimpleOperation::deinitExecution() +void DisplaceSimpleOperation::deinit_execution() { - inputColorProgram_ = nullptr; - inputVectorProgram_ = nullptr; - inputScaleXProgram_ = nullptr; - inputScaleYProgram_ = nullptr; + input_color_program_ = nullptr; + input_vector_program_ = nullptr; + input_scale_xprogram_ = nullptr; + input_scale_yprogram_ = nullptr; } -bool DisplaceSimpleOperation::determineDependingAreaOfInterest(rcti *input, - ReadBufferOperation *readOperation, - rcti *output) +bool DisplaceSimpleOperation::determine_depending_area_of_interest( + rcti *input, ReadBufferOperation *read_operation, rcti *output) { - rcti colorInput; + rcti color_input; NodeOperation *operation = nullptr; /* the vector buffer only needs a 2x2 buffer. The image needs whole buffer */ /* image */ - operation = getInputOperation(0); - colorInput.xmax = operation->getWidth(); - colorInput.xmin = 0; - colorInput.ymax = operation->getHeight(); - colorInput.ymin = 0; - if (operation->determineDependingAreaOfInterest(&colorInput, readOperation, output)) { + operation = get_input_operation(0); + color_input.xmax = operation->get_width(); + color_input.xmin = 0; + color_input.ymax = operation->get_height(); + color_input.ymin = 0; + if (operation->determine_depending_area_of_interest(&color_input, read_operation, output)) { return true; } /* vector */ - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } /* scale x */ - operation = getInputOperation(2); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(2); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } /* scale y */ - operation = getInputOperation(3); - if (operation->determineDependingAreaOfInterest(input, readOperation, output)) { + operation = get_input_operation(3); + if (operation->determine_depending_area_of_interest(input, read_operation, output)) { return true; } @@ -150,8 +149,8 @@ void DisplaceSimpleOperation::update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) { - const float width = this->getWidth(); - const float height = this->getHeight(); + const float width = this->get_width(); + const float height = this->get_height(); const MemoryBuffer *input_color = inputs[0]; for (BuffersIterator<float> it = output->iterate_with(inputs.drop_front(1), area); !it.is_end(); ++it) { |