diff options
Diffstat (limited to 'source/blender/compositor/operations/COM_RenderLayersProg.cc')
-rw-r--r-- | source/blender/compositor/operations/COM_RenderLayersProg.cc | 117 |
1 files changed, 60 insertions, 57 deletions
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cc b/source/blender/compositor/operations/COM_RenderLayersProg.cc index 02a278899bb..7650def2c87 100644 --- a/source/blender/compositor/operations/COM_RenderLayersProg.cc +++ b/source/blender/compositor/operations/COM_RenderLayersProg.cc @@ -24,21 +24,21 @@ namespace blender::compositor { /* ******** Render Layers Base Prog ******** */ -RenderLayersProg::RenderLayersProg(const char *passName, DataType type, int elementsize) - : passName_(passName) +RenderLayersProg::RenderLayersProg(const char *pass_name, DataType type, int elementsize) + : pass_name_(pass_name) { - this->setScene(nullptr); - inputBuffer_ = nullptr; + this->set_scene(nullptr); + input_buffer_ = nullptr; elementsize_ = elementsize; rd_ = nullptr; layer_buffer_ = nullptr; - this->addOutputSocket(type); + this->add_output_socket(type); } -void RenderLayersProg::initExecution() +void RenderLayersProg::init_execution() { - Scene *scene = this->getScene(); + Scene *scene = this->get_scene(); Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; RenderResult *rr = nullptr; @@ -47,14 +47,14 @@ void RenderLayersProg::initExecution() } if (rr) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, get_layer_id()); if (view_layer) { RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); if (rl) { - inputBuffer_ = RE_RenderLayerGetPass(rl, passName_.c_str(), viewName_); - if (inputBuffer_) { - layer_buffer_ = new MemoryBuffer(inputBuffer_, elementsize_, getWidth(), getHeight()); + input_buffer_ = RE_RenderLayerGetPass(rl, pass_name_.c_str(), view_name_); + if (input_buffer_) { + layer_buffer_ = new MemoryBuffer(input_buffer_, elementsize_, get_width(), get_height()); } } } @@ -65,10 +65,10 @@ void RenderLayersProg::initExecution() } } -void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::do_interpolation(float output[4], float x, float y, PixelSampler sampler) { unsigned int offset; - int width = this->getWidth(), height = this->getHeight(); + int width = this->get_width(), height = this->get_height(); int ix = x, iy = y; if (ix < 0 || iy < 0 || ix >= width || iy >= height) { @@ -89,28 +89,31 @@ void RenderLayersProg::doInterpolation(float output[4], float x, float y, PixelS offset = (iy * width + ix) * elementsize_; if (elementsize_ == 1) { - output[0] = inputBuffer_[offset]; + output[0] = input_buffer_[offset]; } else if (elementsize_ == 3) { - copy_v3_v3(output, &inputBuffer_[offset]); + copy_v3_v3(output, &input_buffer_[offset]); } else { - copy_v4_v4(output, &inputBuffer_[offset]); + copy_v4_v4(output, &input_buffer_[offset]); } break; } case PixelSampler::Bilinear: - BLI_bilinear_interpolation_fl(inputBuffer_, output, width, height, elementsize_, x, y); + BLI_bilinear_interpolation_fl(input_buffer_, output, width, height, elementsize_, x, y); break; case PixelSampler::Bicubic: - BLI_bicubic_interpolation_fl(inputBuffer_, output, width, height, elementsize_, x, y); + BLI_bicubic_interpolation_fl(input_buffer_, output, width, height, elementsize_, x, y); break; } } -void RenderLayersProg::executePixelSampled(float output[4], float x, float y, PixelSampler sampler) +void RenderLayersProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { #if 0 const RenderData *rd = rd_; @@ -118,14 +121,14 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi int dx = 0, dy = 0; if (rd->mode & R_BORDER && rd->mode & R_CROP) { - /* see comment in executeRegion describing coordinate mapping, + /* see comment in execute_region describing coordinate mapping, * here it simply goes other way around */ int full_width = rd->xsch * rd->size / 100; int full_height = rd->ysch * rd->size / 100; - dx = rd->border.xmin * full_width - (full_width - this->getWidth()) / 2.0f; - dy = rd->border.ymin * full_height - (full_height - this->getHeight()) / 2.0f; + dx = rd->border.xmin * full_width - (full_width - this->get_width()) / 2.0f; + dy = rd->border.ymin * full_height - (full_height - this->get_height()) / 2.0f; } int ix = x - dx; @@ -134,7 +137,7 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi #ifndef NDEBUG { - const DataType data_type = this->getOutputSocket()->getDataType(); + const DataType data_type = this->get_output_socket()->get_data_type(); int actual_element_size = elementsize_; int expected_element_size; if (data_type == DataType::Value) { @@ -154,7 +157,7 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi } #endif - if (inputBuffer_ == nullptr) { + if (input_buffer_ == nullptr) { int elemsize = elementsize_; if (elemsize == 1) { output[0] = 0.0f; @@ -168,13 +171,13 @@ void RenderLayersProg::executePixelSampled(float output[4], float x, float y, Pi } } else { - doInterpolation(output, x, y, sampler); + do_interpolation(output, x, y, sampler); } } -void RenderLayersProg::deinitExecution() +void RenderLayersProg::deinit_execution() { - inputBuffer_ = nullptr; + input_buffer_ = nullptr; if (layer_buffer_) { delete layer_buffer_; layer_buffer_ = nullptr; @@ -183,7 +186,7 @@ void RenderLayersProg::deinitExecution() void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti &r_area) { - Scene *sce = this->getScene(); + Scene *sce = this->get_scene(); Render *re = (sce) ? RE_GetSceneRender(sce) : nullptr; RenderResult *rr = nullptr; @@ -194,7 +197,7 @@ void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti } if (rr) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&sce->view_layers, get_layer_id()); if (view_layer) { RenderLayer *rl = RE_GetRenderLayer(rr, view_layer->name); if (rl) { @@ -208,9 +211,9 @@ void RenderLayersProg::determine_canvas(const rcti &UNUSED(preferred_area), rcti } } -std::unique_ptr<MetaData> RenderLayersProg::getMetaData() +std::unique_ptr<MetaData> RenderLayersProg::get_meta_data() { - Scene *scene = this->getScene(); + Scene *scene = this->get_scene(); Render *re = (scene) ? RE_GetSceneRender(scene) : nullptr; RenderResult *render_result = nullptr; MetaDataExtractCallbackData callback_data = {nullptr}; @@ -220,15 +223,15 @@ std::unique_ptr<MetaData> RenderLayersProg::getMetaData() } if (render_result && render_result->stamp_data) { - ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, getLayerId()); + ViewLayer *view_layer = (ViewLayer *)BLI_findlink(&scene->view_layers, get_layer_id()); if (view_layer) { std::string full_layer_name = std::string( view_layer->name, BLI_strnlen(view_layer->name, sizeof(view_layer->name))) + - "." + passName_; + "." + pass_name_; blender::StringRef cryptomatte_layer_name = blender::bke::cryptomatte::BKE_cryptomatte_extract_layer_name(full_layer_name); - callback_data.setCryptomatteKeys(cryptomatte_layer_name); + callback_data.set_cryptomatte_keys(cryptomatte_layer_name); BKE_stamp_info_callback(&callback_data, render_result->stamp_data, @@ -260,17 +263,17 @@ void RenderLayersProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers AO Operation ******** */ -void RenderLayersAOOperation::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void RenderLayersAOOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float *inputBuffer = this->getInputBuffer(); - if (inputBuffer == nullptr) { + float *input_buffer = this->get_input_buffer(); + if (input_buffer == nullptr) { zero_v3(output); } else { - doInterpolation(output, x, y, sampler); + do_interpolation(output, x, y, sampler); } output[3] = 1.0f; } @@ -291,19 +294,19 @@ void RenderLayersAOOperation::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Alpha Operation ******** */ -void RenderLayersAlphaProg::executePixelSampled(float output[4], - float x, - float y, - PixelSampler sampler) +void RenderLayersAlphaProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) { - float *inputBuffer = this->getInputBuffer(); + float *input_buffer = this->get_input_buffer(); - if (inputBuffer == nullptr) { + if (input_buffer == nullptr) { output[0] = 0.0f; } else { float temp[4]; - doInterpolation(temp, x, y, sampler); + do_interpolation(temp, x, y, sampler); output[0] = temp[3]; } } @@ -323,22 +326,22 @@ void RenderLayersAlphaProg::update_memory_buffer_partial(MemoryBuffer *output, } /* ******** Render Layers Depth Operation ******** */ -void RenderLayersDepthProg::executePixelSampled(float output[4], - float x, - float y, - PixelSampler /*sampler*/) +void RenderLayersDepthProg::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler /*sampler*/) { int ix = x; int iy = y; - float *inputBuffer = this->getInputBuffer(); + float *input_buffer = this->get_input_buffer(); - if (inputBuffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->getWidth() || - iy >= (int)this->getHeight()) { + if (input_buffer == nullptr || ix < 0 || iy < 0 || ix >= (int)this->get_width() || + iy >= (int)this->get_height()) { output[0] = 10e10f; } else { - unsigned int offset = (iy * this->getWidth() + ix); - output[0] = inputBuffer[offset]; + unsigned int offset = (iy * this->get_width() + ix); + output[0] = input_buffer[offset]; } } |