HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImfDeepCompositing.h
Go to the documentation of this file.
1 //
2 // SPDX-License-Identifier: BSD-3-Clause
3 // Copyright (c) Weta Digital, Ltd and Contributors to the OpenEXR Project.
4 //
5 
6 #ifndef INCLUDED_IMF_DEEPCOMPOSITING_H
7 #define INCLUDED_IMF_DEEPCOMPOSITING_H
8 
9 //-----------------------------------------------------------------------------
10 //
11 // Class to sort and composite deep samples into a frame buffer
12 // You may derive from this class to change the way that CompositeDeepScanLine
13 // and CompositeDeepTile combine samples together - pass an instance of your derived
14 // class to the compositing engine
15 //
16 //-----------------------------------------------------------------------------
17 
18 #include "ImfForward.h"
19 
21 
23 {
24 public:
26  DeepCompositing ();
28  virtual ~DeepCompositing ();
29 
30  //////////////////////////////////////////////
31  ///
32  /// composite together the given channels
33  ///
34  /// @param outputs - return array of pixel values -
35  /// @param inputs - arrays of input sample
36  /// @param channel_names - array of channel names for corresponding channels
37  /// @param num_channels - number of active channels (3 or greater)
38  /// @param num_samples - number of values in all input arrays
39  /// @param sources - number of different sources
40  ///
41  /// each array input has num_channels entries: outputs[n] should be the composited
42  /// values in array inputs[n], whose name will be given by channel_names[n]
43  ///
44  /// The channel ordering shall be as follows:
45  /// Position Channel
46  /// 0 Z
47  /// 1 ZBack (if no ZBack, then inputs[1]==inputs[0] and channel_names[1]==channel_names[0])
48  /// 2 A (alpha channel)
49  /// 3-n other channels - only channels in the frame buffer will appear here
50  ///
51  /// since a Z and Alpha channel is required, and channel[1] is ZBack or another copy of Z
52  /// there will always be 3 or more channels.
53  ///
54  /// The default implementation calls sort() if and only if more than one source is active,
55  /// composites all samples together using the Over operator from front to back,
56  /// stopping as soon as a sample with alpha=1 is found
57  /// It also blanks all outputs if num_samples==0
58  ///
59  /// note - multiple threads may call composite_pixel simultaneously for different pixels
60  ///
61  ///
62  //////////////////////////////////////////////
64  virtual void composite_pixel (
65  float outputs[],
66  const float* inputs[],
67  const char* channel_names[],
68  int num_channels,
69  int num_samples,
70  int sources);
71 
72  ////////////////////////////////////////////////////////////////
73  ///
74  /// find the depth order for samples with given channel values
75  /// does not sort the values in-place. Instead it populates
76  /// array 'order' with the desired sorting order
77  ///
78  /// the default operation sorts samples from front to back according to their Z channel
79  ///
80  /// @param order - required output order. order[n] shall be the nth closest sample
81  /// @param inputs - arrays of input samples, one array per channel_name
82  /// @param channel_names - array of channel names for corresponding channels
83  /// @param num_channels - number of channels (3 or greater)
84  /// @param num_samples - number of samples in each array
85  /// @param sources - number of different sources the data arises from
86  ///
87  /// the channel layout is identical to composite_pixel()
88  ///
89  ///////////////////////////////////////////////////////////////
90 
92  virtual void sort (
93  int order[],
94  const float* inputs[],
95  const char* channel_names[],
96  int num_channels,
97  int num_samples,
98  int sources);
99 };
100 
102 
103 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:83
GLsizei GLenum * sources
Definition: glcorearb.h:2542
GLdouble GLdouble GLint GLint order
Definition: glad.h:2676
class IMF_EXPORT_TYPE DeepCompositing
Definition: ImfForward.h:78
#define IMF_EXPORT
Definition: ImfExport.h:54
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:80
#define IMF_EXPORT_TYPE
Definition: ImfExport.h:57
void sort(I begin, I end, const Pred &pred)
Definition: pugixml.cpp:7334