HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ImfDeepCompositing.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2012, Weta Digital Ltd
4 //
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are
9 // met:
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Weta Digital nor the names of
17 // its contributors may be used to endorse or promote products derived
18 // from this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 //
32 ///////////////////////////////////////////////////////////////////////////
33 
34 
35 #ifndef INCLUDED_IMF_DEEPCOMPOSITING_H
36 #define INCLUDED_IMF_DEEPCOMPOSITING_H
37 
38 //-----------------------------------------------------------------------------
39 //
40 // Class to sort and composite deep samples into a frame buffer
41 // You may derive from this class to change the way that CompositeDeepScanLine
42 // and CompositeDeepTile combine samples together - pass an instance of your derived
43 // class to the compositing engine
44 //
45 //-----------------------------------------------------------------------------
46 
47 #include "ImfForward.h"
48 #include "ImfNamespace.h"
49 #include "ImfExport.h"
50 
52 
54 {
55  public:
57  virtual ~DeepCompositing();
58 
59 
60  //////////////////////////////////////////////
61  ///
62  /// composite together the given channels
63  ///
64  /// @param outputs - return array of pixel values -
65  /// @param inputs - arrays of input sample
66  /// @param channel_names - array of channel names for corresponding channels
67  /// @param num_channels - number of active channels (3 or greater)
68  /// @param num_samples - number of values in all input arrays
69  /// @param sources - number of different sources
70  ///
71  /// each array input has num_channels entries: outputs[n] should be the composited
72  /// values in array inputs[n], whose name will be given by channel_names[n]
73  ///
74  /// The channel ordering shall be as follows:
75  /// Position Channel
76  /// 0 Z
77  /// 1 ZBack (if no ZBack, then inputs[1]==inputs[0] and channel_names[1]==channel_names[0])
78  /// 2 A (alpha channel)
79  /// 3-n other channels - only channels in the frame buffer will appear here
80  ///
81  /// since a Z and Alpha channel is required, and channel[1] is ZBack or another copy of Z
82  /// there will always be 3 or more channels.
83  ///
84  /// The default implementation calls sort() if and only if more than one source is active,
85  /// composites all samples together using the Over operator from front to back,
86  /// stopping as soon as a sample with alpha=1 is found
87  /// It also blanks all outputs if num_samples==0
88  ///
89  /// note - multiple threads may call composite_pixel simultaneously for different pixels
90  ///
91  ///
92  //////////////////////////////////////////////
93  virtual void composite_pixel(float outputs[],
94  const float * inputs[],
95  const char * channel_names[],
96  int num_channels,
97  int num_samples,
98  int sources
99  );
100 
101 
102 
103  ////////////////////////////////////////////////////////////////
104  ///
105  /// find the depth order for samples with given channel values
106  /// does not sort the values in-place. Instead it populates
107  /// array 'order' with the desired sorting order
108  ///
109  /// the default operation sorts samples from front to back according to their Z channel
110  ///
111  /// @param order - required output order. order[n] shall be the nth closest sample
112  /// @param inputs - arrays of input samples, one array per channel_name
113  /// @param channel_names - array of channel names for corresponding channels
114  /// @param num_channels - number of channels (3 or greater)
115  /// @param num_samples - number of samples in each array
116  /// @param sources - number of different sources the data arises from
117  ///
118  /// the channel layout is identical to composite_pixel()
119  ///
120  ///////////////////////////////////////////////////////////////
121 
122  virtual void sort(int order[],
123  const float * inputs[],
124  const char * channel_names[],
125  int num_channels,
126  int num_samples,
127  int sources);
128 };
129 
131 
132 #endif
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT
Definition: ImfNamespace.h:109
GLsizei GLenum * sources
Definition: glcorearb.h:2541
#define IMF_EXPORT
Definition: ImfExport.h:59
#define OPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER
Definition: ImfNamespace.h:108