Files
test/source/blender/compositor/operations/COM_ImageOperation.h
Sergey Sharybin e1b60fdb91 Remove Z Buffer from ImBuf
It was only used by OpenEXR and Iris images, and saving the Z Buffer
in those formats was disabled by default. This option comes from the
times prior to the addition of the Multilayer EXR.

It also worth noting that it was not possible to save Iris with Depth
pass from Blender as internally it is called IRIZ format and it was
not exposed. But even after exposing this format option something still
was missing as saving and loading ITIZ did not show up the Depth pass.

The reason of removal is to make it a more clear match of the ImBuf
with a render pass, and use it instead of a custom type in the render
result and render pass API. This will simplify the API and also avoid
stealing buffers and making shallow copies when showing the render
result.

For the cases when Depth is needed a Multilayer EXR is to be used,
as most likely more than just the Depth will be needed.

On a user level this change:

- Removes the "Z Buffer" option from the interface.

- It preserves existing sockets in compositor nodes, but it will
  output black image. Also changing the image data-block will
  remove the socket unless a Multilayer EXR with Depth pass image
  is selected.

- Removes "Depth" socket of the Viewer and Composite nodes.

Ref #108618

Pull Request: https://projects.blender.org/blender/blender/pulls/109687
2023-07-04 17:03:02 +02:00

95 lines
2.3 KiB
C++

/* SPDX-FileCopyrightText: 2011 Blender Foundation
*
* SPDX-License-Identifier: GPL-2.0-or-later */
#pragma once
#include "BKE_image.h"
#include "BLI_listbase.h"
#include "BLI_sys_types.h"
#include "BLI_utildefines.h"
#include "COM_MultiThreadedOperation.h"
#include "MEM_guardedalloc.h"
#include "RE_pipeline.h"
#include "RE_texture.h"
namespace blender::compositor {
/**
* \brief Base class for all image operations
*/
class BaseImageOperation : public MultiThreadedOperation {
protected:
ImBuf *buffer_;
Image *image_;
ImageUser *image_user_;
/* TODO: Remove raw buffers when removing Tiled implementation. */
float *image_float_buffer_;
uint8_t *image_byte_buffer_;
int imageheight_;
int imagewidth_;
int framenumber_;
int number_of_channels_;
const RenderData *rd_;
const char *view_name_;
BaseImageOperation();
/**
* Determine the output resolution. The resolution is retrieved from the Renderer
*/
void determine_canvas(const rcti &preferred_area, rcti &r_area) override;
virtual ImBuf *get_im_buf();
public:
void init_execution() override;
void deinit_execution() override;
void set_image(Image *image)
{
image_ = image;
}
void set_image_user(ImageUser *imageuser)
{
image_user_ = imageuser;
}
void set_render_data(const RenderData *rd)
{
rd_ = rd;
}
void set_view_name(const char *view_name)
{
view_name_ = view_name;
}
void set_framenumber(int framenumber)
{
framenumber_ = framenumber;
}
};
class ImageOperation : public BaseImageOperation {
public:
/**
* Constructor
*/
ImageOperation();
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
};
class ImageAlphaOperation : public BaseImageOperation {
public:
/**
* Constructor
*/
ImageAlphaOperation();
void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override;
void update_memory_buffer_partial(MemoryBuffer *output,
const rcti &area,
Span<MemoryBuffer *> inputs) override;
};
} // namespace blender::compositor