RenderManAPI  24.0
RixSampleFilter.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 #ifndef RixSampleFilter_h
38 #define RixSampleFilter_h
39 
40 #include "RixIntegrator.h" // for RixChannelId, etc
41 #include "RixInterfaces.h" // for RixContext
42 #include "RixShading.h" // for RixShadingPlugin, etc
43 #include "prmanapi.h" // for PRMANEXPORT
44 #include "RiTypesHelper.h" // for RtColorRGB, etc
45 
47 
53 
55 {
56 public:
57  int GetInterface() const override { return k_RixSampleFilter; }
58 
63 
64  virtual void Filter(
66  void* instanceData) = 0;
67 
68 protected:
70  ~RixSampleFilter() override {}
71 };
72 
73 // clang-format off
74 #define RIX_SAMPLEFILTERCREATE \
75  extern "C" PRMANEXPORT RixSampleFilter* CreateRixSampleFilter(RtConstString hint)
76 
77 #define RIX_SAMPLEFILTERDESTROY \
78  extern "C" PRMANEXPORT void DestroyRixSampleFilter(RixSampleFilter* filter)
79 // clang-format on
80 
82 {
83 public:
86 
92 
93  RtPoint2 const* screen;
94 
99 
100  float const* shutter;
101 
105 
107 
110 
111  int numGrps;
113 
117 
118  float const* depths;
119  int const* originals;
120 
124 
125  virtual bool Read(RixChannelId id, int sample, RtColorRGB &value) const = 0;
126  virtual bool Read(RixChannelId id, int sample, float &value) const = 0;
127  virtual bool Read(RixChannelId id, int sample, int &value) const = 0;
128 
129  virtual bool Write(RixChannelId id, int sample, RtColorRGB value) = 0;
130  virtual bool Write(RixChannelId id, int sample, float value) = 0;
131  virtual bool Write(RixChannelId id, int sample, int value) = 0;
132 
139 
140  virtual bool ReadRegion(RixChannelId id,
141  int regionMinX, int regionMaxX,
142  int regionMinY, int regionMaxY,
143  RtColorRGB *values) const = 0;
144  virtual bool ReadRegion(RixChannelId id,
145  int regionMinX, int regionMaxX,
146  int regionMinY, int regionMaxY,
147  float *values) const = 0;
148 
152 
153  virtual int GetAttribute(int sample, RtUString const name,
154  void *result, int resultLen,
155  RixInterface::Type *resultType,
156  int *resultCount) const = 0;
157 
160 
161  virtual bool IsEnabled(
162  void const* instance,
163  void** instanceData) const = 0;
164 
165 protected:
168 };
169 
170 #endif
RixShadingContext is analogous to a RenderMan grid - it is a group of 1 or more points that may be sh...
Definition: RixShading.h:663
int GetInterface() const override
Definition: RixSampleFilter.h:57
pxrcore::ColorRGB RtColorRGB
Definition: RiTypesHelper.h:520
#define k_RixShadingVersion
Definition: RixShading.h:97
Rix interfaces are obtained from an RixContext.
Definition: RixInterfaces.h:172
Definition: RixShading.h:119
RixShadingPlugin is the base class for RixBxdfFactory, RixDisplacementFactory, RixDisplayFilter, RixIntegrator, RixLightFilter, RixLightFactory, RixPattern, RixProjection, and RixSampleFilter.
Definition: RixShading.h:168
float const * shutter
The shutter samples are time samples in the [0,1) range, with a density distribution according to the...
Definition: RixSampleFilter.h:100
RtPoint2 const * screen
The screen samples represent samples in screen space with subpixel precision.
Definition: RixSampleFilter.h:93
virtual bool ReadRegion(RixChannelId id, int regionMinX, int regionMaxX, int regionMinY, int regionMaxY, RtColorRGB *values) const =0
Read a completely arbitrary rectangular region of pixels into a user-provided buffer.
Definition: RiTypesHelper.h:82
Definition: RixIntegrator.h:234
float const * depths
Extra samples added by the integrator (see numAllSamples above) may have their own depths along the r...
Definition: RixSampleFilter.h:118
RixSampleFilter()
Definition: RixSampleFilter.h:69
virtual bool IsEnabled(void const *instance, void **instanceData) const =0
Determine whether or not the given instance of a sample filter is active.
virtual int GetAttribute(int sample, RtUString const name, void *result, int resultLen, RixInterface::Type *resultType, int *resultCount) const =0
Similar to RixRenderState::GetAttribute(), but looks up an attribute for a single ray sample...
virtual void Filter(RixSampleFilterContext &fCtx, void *instanceData)=0
Filter is the primary entrypoint for this class.
RixShadingContext const ** shadeCtxs
Definition: RixSampleFilter.h:112
RtRayGeometry const * rays
The camera rays that were traced.
Definition: RixSampleFilter.h:106
int numSamples
Definition: RixSampleFilter.h:84
int numGrps
Shading groups.
Definition: RixSampleFilter.h:111
RixSampleFilter plugins sit between the integrator and the framebuffer and filter the shaded camera s...
Definition: RixSampleFilter.h:54
Definition: RixSampleFilter.h:81
int const * originals
Definition: RixSampleFilter.h:119
~RixSampleFilterContext() override
Definition: RixSampleFilter.h:167
int numAllSamples
With extras add by RixDisplayServices::AddSample()
Definition: RixSampleFilter.h:85
unsigned int RixChannelId
Definition: RixIntegrator.h:55
RixSampleFilterContext()
Definition: RixSampleFilter.h:166
pxrcore::UString RtUString
Definition: RiTypesHelper.h:682
~RixSampleFilter() override
Definition: RixSampleFilter.h:70
Type
Definition: RixInterfaces.h:140
virtual bool Write(RixChannelId id, int sample, RtColorRGB value)=0
virtual bool Read(RixChannelId id, int sample, RtColorRGB &value) const =0
Read and write access to sample data.