Blender
V3.3
|
The BokehImageOperation class is an operation that creates an image useful to mimic the internals of a camera. More...
#include <COM_BokehImageOperation.h>
Public Member Functions | |
BokehImageOperation () | |
void | execute_pixel_sampled (float output[4], float x, float y, PixelSampler sampler) override |
The inner loop of this operation. More... | |
void | init_execution () override |
Initialize the execution. More... | |
void | deinit_execution () override |
Deinitialize the execution. More... | |
void | determine_canvas (const rcti &preferred_area, rcti &r_area) override |
determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS] More... | |
void | set_data (NodeBokehImage *data) |
set the node data More... | |
void | delete_data_on_finish () |
delete_data_on_finish More... | |
void | update_memory_buffer_partial (MemoryBuffer *output, const rcti &area, Span< MemoryBuffer * > inputs) override |
![]() | |
virtual | ~NodeOperation () |
void | set_name (const std::string name) |
const std::string | get_name () const |
void | set_id (const int id) |
const int | get_id () const |
float | get_constant_value_default (float default_value) |
const float * | get_constant_elem_default (const float *default_elem) |
const NodeOperationFlags | get_flags () const |
std::optional< NodeOperationHash > | generate_hash () |
unsigned int | get_number_of_input_sockets () const |
unsigned int | get_number_of_output_sockets () const |
NodeOperationOutput * | get_output_socket (unsigned int index=0) |
NodeOperationInput * | get_input_socket (unsigned int index) |
NodeOperation * | get_input_operation (int index) |
virtual bool | is_output_operation (bool) const |
is_output_operation determines whether this operation is an output of the ExecutionSystem during rendering or editing. More... | |
void | set_execution_model (const eExecutionModel model) |
void | set_bnodetree (const bNodeTree *tree) |
void | set_execution_system (ExecutionSystem *system) |
virtual void | init_data () |
virtual void | execute_region (rcti *, unsigned int) |
when a chunk is executed by a CPUDevice, this method is called More... | |
virtual void | execute_opencl_region (OpenCLDevice *, rcti *, unsigned int, MemoryBuffer **, MemoryBuffer *) |
when a chunk is executed by an OpenCLDevice, this method is called More... | |
virtual void | execute_opencl (OpenCLDevice *, MemoryBuffer *, cl_mem, MemoryBuffer **, std::list< cl_mem > *, std::list< cl_kernel > *) |
custom handle to add new tasks to the OpenCL command queue in order to execute a chunk on an GPUDevice. More... | |
void | set_canvas (const rcti &canvas_area) |
const rcti & | get_canvas () const |
void | unset_canvas () |
virtual bool | is_active_viewer_output () const |
is this operation the active viewer output user can select an ViewerNode to be active (the result of this node will be drawn on the backdrop). More... | |
virtual bool | determine_depending_area_of_interest (rcti *input, ReadBufferOperation *read_operation, rcti *output) |
void | set_canvas_input_index (unsigned int index) |
set the index of the input socket that will determine the canvas of this operation More... | |
void | set_determined_canvas_modifier (std::function< void(rcti &canvas)> fn) |
virtual eCompositorPriority | get_render_priority () const |
get the render priority of this node. More... | |
bool | is_braked () const |
void | update_draw () |
unsigned int | get_width () const |
unsigned int | get_height () const |
void | read_sampled (float result[4], float x, float y, PixelSampler sampler) |
void | read_filtered (float result[4], float x, float y, float dx[2], float dy[2]) |
void | read (float result[4], int x, int y, void *chunk_data) |
virtual void * | initialize_tile_data (rcti *) |
virtual void | deinitialize_tile_data (rcti *, void *) |
virtual MemoryBuffer * | get_input_memory_buffer (MemoryBuffer **) |
virtual std::unique_ptr< MetaData > | get_meta_data () |
void | render (MemoryBuffer *output_buf, Span< rcti > areas, Span< MemoryBuffer * > inputs_bufs) |
virtual void | update_memory_buffer (MemoryBuffer *UNUSED(output), const rcti &UNUSED(area), Span< MemoryBuffer * > UNUSED(inputs)) |
virtual void | get_area_of_interest (int input_idx, const rcti &output_area, rcti &r_input_area) |
Get input operation area being read by this operation on rendering given output area. More... | |
void | get_area_of_interest (NodeOperation *input_op, const rcti &output_area, rcti &r_input_area) |
The BokehImageOperation class is an operation that creates an image useful to mimic the internals of a camera.
features:
Per pixel the algorithm determines the edge of the bokeh on the same line as the center of the image and the pixel is evaluating.
The edge is detected by finding the closest point on the direct line between the two nearest flap-corners. this edge is interpolated with a full circle. Result of this edge detection is stored as the distance between the center of the image and the edge.
catadioptric lenses are simulated to interpolate between the center of the image and the distance of the edge. We now have three distances:
With a simple compare it can be detected if the evaluated pixel is between the outer and inner edge.
Definition at line 37 of file COM_BokehImageOperation.h.
blender::compositor::BokehImageOperation::BokehImageOperation | ( | ) |
Definition at line 8 of file COM_BokehImageOperation.cc.
References blender::compositor::NodeOperation::add_output_socket(), and blender::compositor::Color.
|
overridevirtual |
Deinitialize the execution.
Reimplemented from blender::compositor::NodeOperation.
Definition at line 123 of file COM_BokehImageOperation.cc.
|
inline |
delete_data_on_finish
There are cases that the compositor uses this operation on its own (see defocus node) the delete_data_on_finish must only be called when the data has been created by the compositor. It should not be called when the data has been created by the node-editor/user.
Definition at line 134 of file COM_BokehImageOperation.h.
Referenced by blender::compositor::DefocusNode::convert_to_operations().
|
overridevirtual |
determine the resolution of this operation. currently fixed at [COM_BLUR_BOKEH_PIXELS, COM_BLUR_BOKEH_PIXELS]
resolution |
Reimplemented from blender::compositor::NodeOperation.
Definition at line 133 of file COM_BokehImageOperation.cc.
References BLI_rcti_init(), blender::compositor::COM_BLUR_BOKEH_PIXELS, rcti::xmin, and rcti::ymin.
|
overridevirtual |
The inner loop of this operation.
Reimplemented from blender::compositor::NodeOperation.
Definition at line 73 of file COM_BokehImageOperation.cc.
References blender::math::distance(), fabsf, NodeBokehImage::lensshift, output, x, and y.
|
overridevirtual |
Initialize the execution.
Reimplemented from blender::compositor::NodeOperation.
Definition at line 13 of file COM_BokehImageOperation.cc.
References NodeBokehImage::angle, NodeBokehImage::flaps, float(), blender::compositor::NodeOperation::get_height(), blender::compositor::NodeOperation::get_width(), M_PI, and NodeBokehImage::rounding.
|
inline |
set the node data
data |
Definition at line 122 of file COM_BokehImageOperation.h.
Referenced by blender::compositor::BokehImageNode::convert_to_operations(), and blender::compositor::DefocusNode::convert_to_operations().
|
overridevirtual |
Executes operation updating a memory buffer area. Multi-threaded calls.
Implements blender::compositor::MultiThreadedOperation.
Definition at line 97 of file COM_BokehImageOperation.cc.
References blender::compositor::area(), blender::math::distance(), fabsf, NodeBokehImage::lensshift, and output.