RenderMan API  23.0
RixVolume.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 1986-2019 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 RixVolume_h
38 #define RixVolume_h
39 
40 #include <cstddef> // for NULL
41 #include "RixIntegrator.h" // for RtRayGeometry
42 #include "RixInterfaces.h" // for RixInterface
43 #include "RixShading.h" // for RixSCDetail, etc
44 #include "ri.h" // for RtPoint3
45 
49 {
50 public:
52  {}
53 
55  {}
56 };
57 
59 {
60 public:
62  {}
63 
64  // Returns true if the iterator was able to advance the full
65  // distance, otherwise returns false, signalling that some local
66  // new maximum density information is now available.
67  virtual bool Advance(float distance) = 0;
68 
69  // Returns the distance at the end of the current segment
70  virtual float GetSegmentEnd() const = 0;
71 
72  virtual float GetTotalDistance() const = 0;
73 
74  virtual RtPoint3 GetOrigin() const = 0;
75 
76  virtual RtVector3 GetDirection() const = 0;
77 
78  virtual float GetOriginRadius() const = 0;
79 
80  virtual float GetRaySpread() const = 0;
81 
82  virtual float GetMaxDensity() const = 0;
83 
84  virtual float GetMinDensity() const = 0;
85 
86  virtual RixVolumeAggregateIterator& operator=(const RixVolumeAggregateIterator& rhs) = 0;
87 
88  bool finished;
89 
91 
92 protected:
93  RixVolumeAggregateIterator() : finished(false), currentDistance(0.0f)
94  {}
95 };
96 
98 {
99  k_SkipMatteVolumes // Whether to skip volumes with Matte 1; bool input
100 };
101 
103 {
104 public:
106  {}
107 
112  virtual RixVolumeAggregateIterator* CreateIterator(int index) = 0;
113 
119  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, float* densities) = 0;
120 
126  virtual void ComputeEmission(RixVolumeAggregateIterator** iterators, RtColorRGB* emissions) = 0;
127 
138  virtual void CreateScatterContexts(RixVolumeAggregateIterator** iterators,
139  int* numShadingContexts,
140  RixShadingContext** shadingContexts) = 0;
141 
146  virtual void CreateScatterContexts(RixShadingContext const* parentContext,
147  RixVolumeAggregateIterator** iterators,
148  int* numShadingContexts,
149  RixShadingContext** shadingContexts) = 0;
150 
157  virtual void ReleaseScatterContexts(int numShadingContexts, RixShadingContext** shadingContexts,
158  RixBXLobeTraits const* exposeVol = NULL,
159  RtInt** memberships = NULL,
160  int* numNewShadingContexts = NULL,
161  RixShadingContext const** newShadingContexts = NULL) = 0;
162 
170  virtual void GenerateLightSamples(RixVolumeAggregateIterator** iterators, RixRNG* rng,
171  RixLightingServices* lightingServices, float* maxDistances,
172  RtPoint3* positions, bool* sampleFailed) = 0;
173 
179  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, RtColorRGB* densities) = 0;
180 
182  virtual bool SetProperty(VolumeAggregateProperty, void const* in) = 0;
183 
185  virtual RixVolumeIrradianceEstimateContext* CreateIrradianceEstimateContext() = 0;
186 
191  virtual void AddToIrradianceQueries(RixVolumeAggregateIterator* iterator, int stepNum,
192  RixVolumeIrradianceEstimateContext* queryContext) = 0;
193 
196  virtual void ServiceIrradianceQueries(RixVolumeIrradianceEstimateContext* queryContext,
197  RixLightingServices* lightingServices, float* estimates,
198  float* confidences) = 0;
199 };
200 
209 {
210 public:
211  RixVolumeServices() : RixInterface(1), shadingCtx(NULL)
212  {}
213 
214  // Begin for a Rix shading context (RIS usage)
215  virtual void Begin(RixShadingContext const* sCtx) = 0;
216 
217  virtual void End() = 0;
218 
237  virtual int GetDensityRanges(const RtPoint3& pt0, const RtPoint3& pt1, float length,
238  float maxDensity, float** dist, float** minDensities,
239  float** maxDensities, float* minTrans, float* maxTrans) const = 0;
240 
241  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, float const** result,
242  float const* dflt) const = 0;
243 
244  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtColorRGB const** result,
245  RtColorRGB const* dflt) const = 0;
246 
247  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtFloat3 const** result,
248  RtFloat3 const* dflt) const = 0;
249 
250  virtual RixVolumeAggregate* GetAggregate(RtUString const name, int numRays,
251  RtRayGeometry const* rays,
252  RtUString const subset = US_NULL,
253  RtUString const excludeSubset = US_NULL) const = 0;
254 
255 protected:
257  {}
259 };
260 
261 #endif
pxrcore::ColorRGB RtColorRGB
#define US_NULL
virtual ~RixVolumeAggregateIterator()
Definition: RixVolume.h:61
RtFloat3 RtPoint3
Definition: RiTypesHelper.h:69
RixSCDetail
Definition: RixShading.h:376
VolumeAggregateProperty
Definition: RixVolume.h:97
pxrcore::UString RtUString
virtual ~RixVolumeServices()
Definition: RixVolume.h:256
pxrcore::Float3 RtFloat3
Definition: RiTypesHelper.h:68
Definition: RixRNG.h:59
virtual ~RixVolumeAggregate()
Definition: RixVolume.h:105
int RtInt
Definition: ri.h:55
RixShadingContext const * shadingCtx
Definition: RixVolume.h:258
virtual ~RixVolumeIrradianceEstimateContext()
Definition: RixVolume.h:54
RtFloat3 RtVector3
Definition: RiTypesHelper.h:71