RenderMan  26.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RixVolume.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2022 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 "RiTypesHelper.h" // for RtPoint3, etc.
42 #include "RixIntegrator.h" // for RtRayGeometry
43 #include "RixInterfaces.h" // for RixInterface
44 #include "RixShading.h" // for RixSCDetail, etc
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 float GetMeanDensity() const = 0;
87 
88  virtual float GetVarDensity() const = 0;
89 
91 
92  bool finished;
93 
95 
96 protected:
98  {}
99 };
100 
102 {
105 };
106 
108 {
109  k_SkipMatteVolumes, // Whether to skip volumes with Matte 1; bool input
110  k_TransmittanceEstimator // A hint on what type of method will be used for transmittance
111  // estimation; enum VolumeAggregateTransmittanceEstimator
112 };
113 
115 {
116 public:
118  {}
119 
124  virtual RixVolumeAggregateIterator* CreateIterator(int index) = 0;
125 
131  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, float* densities) = 0;
132 
138  virtual void ComputeEmission(RixVolumeAggregateIterator** iterators, RtColorRGB* emissions) = 0;
139 
150  virtual void CreateScatterContexts(RixVolumeAggregateIterator** iterators,
151  int* numShadingContexts,
152  RixShadingContext** shadingContexts) = 0;
153 
158  virtual void CreateScatterContexts(RixShadingContext const* parentContext,
159  RixVolumeAggregateIterator** iterators,
160  int* numShadingContexts,
161  RixShadingContext** shadingContexts) = 0;
162 
169  virtual void ReleaseScatterContexts(int numShadingContexts, RixShadingContext** shadingContexts,
170  RixBXLobeTraits const* exposeVol = NULL,
171  int** memberships = NULL, int* numNewShadingContexts = NULL,
172  RixShadingContext const** newShadingContexts = NULL) = 0;
173 
181  virtual void GenerateLightSamples(RixVolumeAggregateIterator** iterators, RixRNG* rng,
182  RixLightingServices* lightingServices, float* maxDistances,
183  RtPoint3* positions, bool* sampleFailed, float* segmentMinT, float* segmentMaxT) = 0;
184 
190  virtual void ComputeDensity(RixVolumeAggregateIterator** iterators, RtColorRGB* densities) = 0;
191 
193  virtual bool SetProperty(VolumeAggregateProperty, void const* in) = 0;
194 
197 
202  virtual void AddToIrradianceQueries(RixVolumeAggregateIterator* iterator, int stepNum,
203  RixVolumeIrradianceEstimateContext* queryContext) = 0;
204 
208  RixLightingServices* lightingServices, float* estimates,
209  float* confidences) = 0;
210 
219  virtual void ComputeDensityAndEmission(RixVolumeAggregateIterator** iterators,
220  RtColorRGB* densities, RtColorRGB* emissions) = 0;
221 
226  virtual void ComputeDensityAndMatte(RixVolumeAggregateIterator** iterators,
227  RtColorRGB* densities, RtColorRGB* matteDensities) = 0;
228 };
229 
238 {
239 public:
241  {}
242 
243  // Begin for a Rix shading context (RIS usage)
244  virtual void Begin(RixShadingContext const* sCtx) = 0;
245 
246  virtual void End() = 0;
247 
266  virtual int GetDensityRanges(const RtPoint3& pt0, const RtPoint3& pt1, float length,
267  float maxDensity, float** dist, float** minDensities,
268  float** maxDensities, float* minTrans, float* maxTrans) const = 0;
269 
270  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, float const** result,
271  float const* dflt) const = 0;
272 
273  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtColorRGB const** result,
274  RtColorRGB const* dflt) const = 0;
275 
276  virtual RixSCDetail EvalTemporalParam(int paramId, int arrayIndex, RtFloat3 const** result,
277  RtFloat3 const* dflt) const = 0;
278 
279  virtual RixVolumeAggregate* GetAggregate(RtUString const name, int numRays,
280  RtRayGeometry const* rays,
281  RtUString const subset = US_NULL,
282  RtUString const excludeSubset = US_NULL) const = 0;
283 
284  virtual bool HasAggregate(RtUString const name, bool& hasMatte) const = 0;
285 
286 protected:
288  {}
290 };
291 
292 #endif