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