RenderMan API  23.0
RixLPEInline.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 
38 #ifndef RixLPEInline_h
39 #define RixLPEInline_h
40 
41 #include <cstddef> // for NULL
42 #include <map> // for map, etc
43 #include <set> // for set
44 #include <utility> // for pair
45 #include <vector> // for vector
46 #include "RixBxdfLobe.h" // for RixBXLobeSampled, etc
47 #include "RixIntegrator.h" // for RixDisplayServices, etc
48 #include "RixInterfaces.h" // for RixLPEToken, RixCustomLPE
49 #include "RixShadingUtils.h" // for k_ZeroRGB, k_OneRGB
50 #include "prmanapi.h" // for PRMAN_INLINE
51 #include "ri.h" // for RtColorRGB
52 
53 class RixLPE;
54 class RixLPEState;
55 class RixShadingContext;
56 
57 // The number of scattering types: e.g., D1, D2, ..., S1, S2, ...
58 static const unsigned char k_numScatterTypes = k_RixBXMaxNumDiffuseLobes +
59  k_RixBXMaxNumSpecularLobes +
60  k_RixBXMaxNumUserLobes;
61 
62 // Offsets to start of each group
63 static const unsigned char k_diffStart = 0;
64 static const unsigned char k_specStart = k_diffStart + k_RixBXMaxNumDiffuseLobes;
65 static const unsigned char k_userStart = k_specStart + k_RixBXMaxNumSpecularLobes;
66 
71 {
72 public:
73  short getTransition(short state, RixLPEToken symbol)const
74  {
75  const State &mystate = m_states[state];
76  const Transition *begin = &m_trans[mystate.begin_trans];
77  const Transition *end = begin + mystate.ntrans;
78  while (begin < end) { // binary search
79  const Transition *middle = begin + ((end - begin)>>1);
80  if (symbol < middle->symbol)
81  end = middle;
82  else if (middle->symbol < symbol)
83  begin = middle + 1;
84  else // match
85  return middle->state;
86  }
87  return mystate.wildcard_trans;
88  }
89 
90  void * const * getRules(int state, int &count)const
91  {
92  count = m_states[state].nrules;
93  return &m_rules[m_states[state].begin_rules];
94  }
95 
96  struct State
97  {
98  unsigned int begin_trans;
99  unsigned int ntrans;
100  unsigned int begin_rules;
101  unsigned int nrules;
103  std::vector<int> customIdVec;
104  };
105  struct Transition
106  {
107  // we use this only for sorting
108  static bool trans_comp (const Transition &a, const Transition &b)
109  {
110  return a.symbol < b.symbol;
111  }
113  short state;
114  };
115  std::vector<Transition> m_trans;
116  std::vector<void *> m_rules;
117  std::vector<State> m_states;
118 };
119 
120 //
121 // class RixLPE inline method implementation
122 //
123 
124 // Convert an integer light group id to a LPE token.
127 {
128  // Offset the light group id by the number of built-in tokens.
129  if (lgtGrpId >= 0)
130  return lgtGrpId + k_baseLgtGrpTokenOffset;
131  else
132  return k_BLANK;
133 }
134 
135 // Return true if there are any light path expression AOVs.
136 PRMAN_INLINE bool
138 {
139  return m_anyLPEs;
140 }
141 
142 // Return true if there are any custom light path expressions.
143 PRMAN_INLINE bool
145 {
146  return m_anyCustomLPEs;
147 }
148 
149 // class RixLPEState implementation
150 
153  RixLPEAutomata const* automata, const int nautomata )
154  : m_automata( automata ), m_nautomata( nautomata )
155 {
156  Reset();
157 }
158 
161 {
162 }
163 
164 PRMAN_INLINE void
166 {
167  m_state.resize(m_nautomata);
168  std::fill(m_state.begin(), m_state.end(), 0);
169  m_thruput.One();
170 }
171 
172 PRMAN_INLINE std::vector<short>&
174 {
175  return m_state;
176 }
177 
178 PRMAN_INLINE const std::vector<short>&
180 {
181  return m_state;
182 }
183 
184 PRMAN_INLINE void
185 RixLPEState::SetState(const std::vector<short>& state)
186 {
187  m_state = state;
188 }
189 
190 PRMAN_INLINE bool
192 {
193  if( !m_automata ) return true;
194  for( int i = 0; i < m_nautomata; i++ ) if(m_state[i] >=0) return false;
195  return true;
196 }
197 
198 PRMAN_INLINE bool
200  const RixLPEToken custom)
201 {
202  std::vector<short> saveState = GetState();
203  move(dir, sca, custom);
204  bool active = !Broken();
205  SetState(saveState);
206  return active;
207 }
208 
211 {
212  return m_thruput;
213 }
214 
216 RixLPEState::GetAutomata(int& nautomata) const
217 {
218  nautomata = m_nautomata;
219  return m_automata;
220 }
221 
222 PRMAN_INLINE void
223 RixLPEState::MoveCamera(RixShadingContext const* sCtx, int sCtxIndex)
224 {
225  PIXAR_ARGUSED(sCtx);
226  PIXAR_ARGUSED(sCtxIndex);
228 }
229 
230 PRMAN_INLINE void
231 RixLPEState::MoveCamera(RixShadingContext const* sCtx, int sCtxIndex,
232  const RtColorRGB& thruput)
233 {
234  PIXAR_ARGUSED(sCtx);
235  PIXAR_ARGUSED(sCtxIndex);
237  m_thruput *= thruput;
238 }
239 
240 PRMAN_INLINE void
242  RixShadingContext const* sCtx,
243  int sCtxIndex,
244  RtColorRGB const& thruput,
245  RixLPEToken lpeGroupId)
246 {
247  PIXAR_ARGUSED(sCtx);
248  PIXAR_ARGUSED(sCtxIndex);
249  PIXAR_ARGUSED(thruput);
250  move( RixLPE::k_OBJECT, RixLPE::k_NONE, lpeGroupId );
251 }
252 
253 PRMAN_INLINE void
255  RixShadingContext const* sCtx,
256  int sCtxIndex,
257  RtColorRGB const& thruput,
258  RtColorRGB const* lightTrans,
259  bool firstContribution,
260  RixLPEToken lgtLpeToken)
261 {
262  PIXAR_ARGUSED(sCtx);
263  PIXAR_ARGUSED(sCtxIndex);
264  PIXAR_ARGUSED(thruput);
265  PIXAR_ARGUSED(lightTrans);
266  PIXAR_ARGUSED(firstContribution);
267  move( RixLPE::k_LIGHT, RixLPE::k_NONE, lgtLpeToken );
268 }
269 
270 PRMAN_INLINE void
272  RixShadingContext const* sCtx,
273  int sCtxIndex,
274  RixLPEScatterEvent const scatterEvent,
275  RixLPEToken lpeGroupId)
276 {
277  PIXAR_ARGUSED(sCtx);
278  PIXAR_ARGUSED(sCtxIndex);
279  if( scatterEvent.GetValid() )
280  {
281  RixLPEToken event = scatterEvent.GetEvent();
282  RixLPEToken scatt = scatterEvent.GetScatt();
283 
284  move( event, scatt, lpeGroupId );
285  }
286 }
287 
288 PRMAN_INLINE void
290  RixShadingContext const* sCtx,
291  int sCtxIndex,
292  RixLPEScatterEvent const scatterEvent,
293  const RtColorRGB& thruput,
294  RixLPEToken lpeGroupId,
295  bool doStateTransition)
296 {
297  PIXAR_ARGUSED(sCtx);
298  PIXAR_ARGUSED(sCtxIndex);
299  if( scatterEvent.GetValid() )
300  {
301  RixLPEToken event = scatterEvent.GetEvent();
302  RixLPEToken scatt = scatterEvent.GetScatt();
303 
304  if( doStateTransition )
305  {
306  move( event, scatt, lpeGroupId );
307  }
308 
309  m_thruput *= thruput;
310  }
311 }
312 
313 PRMAN_INLINE void
314 RixLPEState::move( const RixLPEToken event, const RixLPEToken scatt,
315  const RixLPEToken custom )
316 {
317  if( !m_automata )
318  return;
319 
320  for( int i = 0; i < m_nautomata; i++ )
321  {
322  if (m_state[i] >= 0)
323  m_state[i] = m_automata[i].getTransition(m_state[i], event);
324  if (m_state[i] >= 0)
325  m_state[i] = m_automata[i].getTransition(m_state[i], scatt);
326  if (m_state[i] >= 0)
327  m_state[i] = m_automata[i].getTransition(m_state[i], custom);
328  if (m_state[i] >= 0)
329  m_state[i] = m_automata[i].getTransition(m_state[i], RixLPE::k_STOP);
330  }
331 }
332 
333 
334 //
335 // class RixLPEScatterEvent implementation
336 //
337 
339 RixLPEScatterEvent::RixLPEScatterEvent(bool isReflect, bool isUser,
340  bool isSpecular, unsigned char lpeId)
341 {
342  m_isReflect = isReflect;
343  m_lpeId = lpeId;
344  if( isUser )
345  {
346  m_scatter = RixLPE::k_USER1 + m_lpeId;
347  m_lpeIndex = static_cast<unsigned char>(k_userStart + m_lpeId);
348  }
349  else if( isSpecular )
350  {
351  m_scatter = RixLPE::k_SPECULAR1 + m_lpeId;
352  m_lpeIndex = static_cast<unsigned char>(k_specStart + m_lpeId);
353  }
354  else
355  {
356  m_scatter = RixLPE::k_DIFFUSE1 + m_lpeId;
357  m_lpeIndex = static_cast<unsigned char>(k_diffStart + m_lpeId);
358  }
359 }
360 
363 {
364  m_isReflect = lobeSampled.GetReflect();
365  m_lpeId = lobeSampled.GetLpeId();
366 
367  if( !lobeSampled.GetValid() )
368  {
369  m_scatter = RixLPE::k_NONE;
370  m_lpeIndex = 0;
371  }
372  else if( lobeSampled.GetUser() )
373  {
374  m_scatter = RixLPE::k_USER1 + m_lpeId;
375  m_lpeIndex = static_cast<unsigned char>(k_userStart + m_lpeId);
376  }
377  else if( lobeSampled.GetSpecular() )
378  {
379  m_scatter = RixLPE::k_SPECULAR1 + m_lpeId;
380  m_lpeIndex = static_cast<unsigned char>(k_specStart + m_lpeId);
381  }
382  else
383  {
384  // Diffuse
385  m_scatter = RixLPE::k_DIFFUSE1 + m_lpeId;
386  m_lpeIndex = static_cast<unsigned char>(k_diffStart + m_lpeId);
387  }
388 }
389 
392 {
393  m_isReflect = traits.GetReflect();
394 
395  // Find the lpeId
396  unsigned short dl = traits.GetDiffuse();
397  unsigned short sl = traits.GetSpecular();
398 
399  // Only a maximum of one of these should be set
400  assert((dl && !sl) ||
401  (sl && !dl) ||
402  (!dl && !sl));
403 
404  if( (dl && sl) || (!dl && !sl) )
405  {
406  // Neither set is a supported case. We invalidate the scatter event.
407  // Both set is unsupported. Again we invalidate the scatter event.
408  m_scatter = RixLPE::k_NONE;
409  m_lpeId = m_lpeIndex = 0;
410  return;
411  }
412 
413  // An important point to consider here is that, due to the tests above,
414  // either dl or sl will be non-zero. As a consequence, the following sequence
415  // will never produce an undefined result for m_lpeId because the value
416  // passed to RixFindFirstSetBit will always be non-zero.
417  bool isDiffuse = (dl != 0);
418  if( isDiffuse )
419  m_lpeId = static_cast<unsigned char>(RixFindFirstSetBit(dl));
420  else
421  m_lpeId = static_cast<unsigned char>(RixFindFirstSetBit(sl));
422 
423  m_lpeIndex = isDiffuse ? k_diffStart : k_specStart;
424  m_lpeIndex = static_cast<unsigned char>(m_lpeIndex + m_lpeId);
425 
426  m_scatter = isDiffuse ? RixLPE::k_DIFFUSE1 : RixLPE::k_SPECULAR1;
427  m_scatter += m_lpeId;
428 }
429 
432 {
433  return !GetValid() ? RixLPE::k_NONE :
434  (m_isReflect ? RixLPE::k_REFLECT : RixLPE::k_TRANSMIT);
435 }
436 
439 {
440  return !GetValid() ? RixLPE::k_NONE : m_scatter;
441 }
442 
443 PRMAN_INLINE unsigned char
445 {
446  return !GetValid() ? 0 : m_lpeId;
447 }
448 
449 PRMAN_INLINE unsigned char
451 {
452  return !GetValid() ? 0 : m_lpeIndex;
453 }
454 
455 PRMAN_INLINE bool
457 {
458  return (m_scatter != RixLPE::k_NONE);
459 }
460 
461 //
462 // class RixLPE::SplatHelper inline method implementation
463 //
464 
467  RixDisplayServices* displaySvc,
468  int integratorCtxIdx,
469  RixLPE& rixLpe,
470  RixLPEState& state,
471  int depth,
472  RixLPEToken lgtLpeToken,
473  RixLPEToken lpeGrpId,
474  bool isReflect,
475  RtColorRGB const& eyeTrans,
476  RtColorRGB const& lgtTrans,
477  RixShadingContext const* sCtx,
478  int shadingCtxIdx,
479  bool writeOpacityAllowed)
480  : m_depth(depth),
481  m_lgtLpeToken(lgtLpeToken),
482  m_lpeGrpId(lpeGrpId),
483  m_isReflect(isReflect),
484  m_lgtTrans(lgtTrans),
485  m_displaySvc(displaySvc),
486  m_integratorCtxIdx(integratorCtxIdx),
487  m_rixLpe(rixLpe),
488  m_state(state),
489  m_sCtx(sCtx),
490  m_shadingCtxIdx(shadingCtxIdx),
491  m_writeOpacityAllowed(writeOpacityAllowed)
492 {
493  m_eyeTrans = eyeTrans;
494 }
495 
497 {
498 }
499 
500 PRMAN_INLINE void
502  RixBXActiveLobeWeights& activeLobes,
503  int weightIndex,
504  RtColorRGB const& thruput,
505  bool isFinite,
506  float clamp,
507  bool isHoldout)
508 {
509  // Obtain alpha and write Ci.
510  RixLPE const& rixLpe = m_rixLpe;
511 
512  // Splat LPEs before splat beauty
513  if (rixLpe.m_anyLPEs)
514  {
515  // Light path expressions.
516  bool isReflect = m_isReflect;
517  RixLPEToken lgtLpeToken = m_lgtLpeToken;
518 
519  bool firstContribution = true;
520 
521  // backup path state, try avoiding avoiding memory allocations
522  std::vector<short>& state = m_state.GetState();
523  size_t stateSize = state.size();
524  short stateBuffer[1<<16];
525 
526  short* stateBackup = stateBuffer;
527  if (stateSize > 1<<16)
528  // We seems to have a huge number of automatas, we resort to heap memory
529  stateBackup = (short*)malloc(stateSize*sizeof(short));
530 
531  memcpy(stateBackup, state.data(), stateSize*sizeof(short));
532 
533  // Add any non-blank diffuse lobes.
534  for (int i = 0; i < activeLobes.GetNumDiffuseLobes(); i++)
535  {
536  RtColorRGB const& diffuse =
537  activeLobes.GetDiffuseLobe(i)[weightIndex];
538 
539  firstContribution = false;
540 
541  unsigned char lpeId = activeLobes.GetDiffuseLpeId(i);
542  int diffLpeId = k_diffStart + lpeId;
543  RixLPEScatterEvent lpeEvent( isReflect, false, false, lpeId );
545  m_sCtx, m_shadingCtxIdx, lpeEvent,
546  m_lpeGrpId);
548  m_sCtx, m_shadingCtxIdx, diffuse, &m_lgtTrans,
549  firstContribution, lgtLpeToken);
550  SplatLPE(
551  diffuse, &m_lgtTrans, isFinite, clamp, diffLpeId,
552  k_Overwrite, isHoldout);
553 
554  // Restore path state
555  memcpy(state.data(), stateBackup, stateSize*sizeof(short));
556  }
557 
558  // Add any non-blank specular lobes.
559  for (int i = 0; i < activeLobes.GetNumSpecularLobes(); i++)
560  {
561  RtColorRGB const& specular =
562  activeLobes.GetSpecularLobe(i)[weightIndex];
563 
564  firstContribution = false;
565 
566  unsigned char lpeId = activeLobes.GetSpecularLpeId(i);
567  int specLpeId = k_specStart + lpeId;
568  RixLPEScatterEvent lpeEvent( isReflect, false, true, lpeId );
570  m_sCtx, m_shadingCtxIdx, lpeEvent,
571  m_lpeGrpId);
573  m_sCtx, m_shadingCtxIdx, specular, &m_lgtTrans,
574  firstContribution, lgtLpeToken);
575  SplatLPE(
576  specular, &m_lgtTrans, isFinite, clamp, specLpeId,
577  k_Overwrite, isHoldout);
578 
579  // Restore path state
580  memcpy(state.data(), stateBackup, stateSize*sizeof(short));
581  }
582 
583  // Add any non-blank user lobes.
584  for (int i = 0; i < activeLobes.GetNumUserLobes(); i++)
585  {
586  RtColorRGB const& user = activeLobes.GetUserLobe(i)[weightIndex];
587 
588  firstContribution = false;
589 
590  unsigned char lpeId = activeLobes.GetUserLpeId(i);
591  int userLpeId = k_userStart + lpeId;
592  RixLPEScatterEvent lpeEvent( isReflect, true, false, lpeId );
594  m_sCtx, m_shadingCtxIdx, lpeEvent,
595  m_lpeGrpId);
597  m_sCtx, m_shadingCtxIdx, user, &m_lgtTrans, firstContribution,
598  lgtLpeToken);
599  SplatLPE(
600  user, &m_lgtTrans, isFinite, clamp, userLpeId, k_Overwrite,
601  isHoldout);
602 
603  // Restore path state
604  memcpy(state.data(), stateBackup, stateSize*sizeof(short));
605  }
606 
607  if (stateBackup != stateBuffer) free(stateBackup);
608  }
609 
610  // Beauty channel (Ci).
611  if (rixLpe.m_beautyChanId != k_InvalidChannelId)
612  {
613  if (!isHoldout)
614  {
615  RtColorRGB val = isFinite
616  ? activeLobes.SumAtIndex(weightIndex) * thruput * m_lgtTrans * clamp
617  : RixConstants::k_ZeroRGB;
618 
619  SplatBeauty(val, m_eyeTrans);
620  }
621  else if (m_writeOpacityAllowed && (m_depth == 0))
622  {
623  float trans1 = m_eyeTrans.ChannelAvg();
624  if (trans1 != 1.0f)
625  {
627  m_rixLpe.m_beautyChanId, m_integratorCtxIdx, 1.0f - trans1);
628  }
629  }
630  }
631 }
632 
633 PRMAN_INLINE void
635  RtColorRGB const& emission,
636  RtColorRGB const& thruput,
637  bool isFinite,
638  float clamp,
639  bool isHoldout)
640 {
641  // Obtain alpha and write Ci.
642  RixLPE const& rixLpe = m_rixLpe;
643 
644  // Splat LPEs before splat beauty since we may have holdout LPE that will
645  // change the Beauty and alpha
646  if (rixLpe.m_anyLPEs)
647  {
648  // backup path state, try avoiding avoiding memory allocations
649  std::vector<short>& state = m_state.GetState();
650  size_t stateSize = state.size();
651  short stateBuffer[1<<16];
652 
653  short* stateBackup = stateBuffer;
654  if (stateSize > 1<<16)
655  // We seems to have a huge number of automatas, we resort to heap memory
656  stateBackup = (short*)malloc(stateSize*sizeof(short));
657 
658  memcpy(stateBackup, state.data(), stateSize*sizeof(short));
659 
661  m_sCtx, m_shadingCtxIdx, emission, m_lpeGrpId);
662  SplatLPE(
663  emission, 0, isFinite, clamp, -1, k_Accumulate,
664  isHoldout);
665 
666  // Restore path state
667  memcpy(state.data(), stateBackup, stateSize*sizeof(short));
668 
669  if (stateBackup != stateBuffer) free(stateBackup);
670  }
671 
672  // Beauty channel (Ci).
673  if (rixLpe.m_beautyChanId != k_InvalidChannelId)
674  {
675  if (!isHoldout)
676  {
677  SplatBeauty(
678  isFinite
679  ? (emission * thruput * m_lgtTrans * clamp)
680  : RixConstants::k_ZeroRGB,
681  m_eyeTrans);
682  }
683  else if (m_writeOpacityAllowed && (m_depth == 0))
684  {
685  float trans1 = m_eyeTrans.ChannelAvg();
686  if (trans1 != 1.0f)
687  {
689  m_rixLpe.m_beautyChanId, m_integratorCtxIdx, 1.0f - trans1);
690  }
691  }
692  }
693 }
694 
695 PRMAN_INLINE void
697  RtColorRGB const& color,
698  bool isFinite,
699  float clamp)
700 {
701  // Splat LPEs before splat beauty since we may have holdout LPE that will
702  // change the Beauty's alpha
703 
704  if (m_rixLpe.m_anyLPEs)
705  {
706  SplatLPE(color, &m_lgtTrans, isFinite, clamp, -1);
707  }
708 
709  SplatBeauty(
710  isFinite
711  ? (color * m_lgtTrans * clamp)
712  : RixConstants::k_ZeroRGB,
713  m_eyeTrans);
714 }
715 
716 PRMAN_INLINE void
718 {
720 
721  float trans1 = trans.ChannelAvg();
722  if (m_writeOpacityAllowed && (m_depth == 0) && (trans1 != 1.0f))
723  {
725  m_rixLpe.m_beautyChanId, m_integratorCtxIdx, 1.0f - trans1);
726  }
727 }
728 
729 PRMAN_INLINE void
731  RtColorRGB const& val,
732  RtColorRGB const* lgtTrans,
733  bool isFinite,
734  float clamp,
735  int lpeId,
736  OverwritePolicy overwritePolicy,
737  bool isHoldout)
738 {
739  PIXAR_ARGUSED(lpeId);
741  m_integratorCtxIdx, lgtTrans,
742  clamp, isFinite, overwritePolicy, isHoldout );
743 }
744 
745 #endif
unsigned int begin_trans
Definition: RixLPEInline.h:98
static PRMAN_INLINE RixLPEToken LgtGrpIdToToken(int lightGroupId)
Convert an integer light group id to an LPE token.
Definition: RixLPEInline.h:126
pxrcore::ColorRGB RtColorRGB
PRMAN_INLINE bool GetSpecular() const
Definition: RixBxdfLobe.h:673
PRMAN_INLINE bool GetValid() const
Definition: RixBxdfLobe.h:649
unsigned int begin_rules
Definition: RixLPEInline.h:100
void MoveLight(RixShadingContext const *sCtx, int sCtxIndex, RtColorRGB const &thruput, RtColorRGB const *lightTrans, bool firstContribution, RixLPEToken lgtLpeToken)
Definition: RixLPEInline.h:254
This struct represents the characteristics of just one lobe of a bxdf.
Definition: RixBxdfLobe.h:64
void SetState(const std::vector< short > &state)
Definition: RixLPEInline.h:185
PRMAN_INLINE RtColorRGB SumAtIndex(int index, bool includeUserLobes=false) const
Definition: RixBxdfLobe.h:1505
virtual void Splat(const RixLPEState &accum, RixDisplayServices *dspy, const RtColorRGB &val, const int integratorCtxIdx, const RtColorRGB *lgtTrans, const float clamp, const bool isFinite, const OverwritePolicy overwritePolicy, const bool isHoldout) const =0
bool Test(const RixLPEToken dir, const RixLPEToken sca, const RixLPEToken custom)
Definition: RixLPEInline.h:199
RtColorRGB m_lgtTrans
Definition: RixLPE.h:355
RixLPEToken m_lpeGrpId
Definition: RixLPE.h:352
PRMAN_INLINE void SplatPerLobe(RixBXActiveLobeWeights &activeLobes, int weightIndex, RtColorRGB const &thruput, bool isFinite, float clamp=1.0f, bool isHoldout=false)
Definition: RixLPEInline.h:501
void MoveCamera(RixShadingContext const *sCtx, int sCtxIndex)
Definition: RixLPEInline.h:223
PRMAN_INLINE bool GetValid() const
Definition: RixLPEInline.h:456
PRMAN_INLINE void SplatLPE(RtColorRGB const &val, RtColorRGB const *lightTrans, bool isFinite, float clamp, int lpeId=-1, OverwritePolicy overwritePolicy=k_Overwrite, bool isHoldout=false)
Definition: RixLPEInline.h:730
std::vector< short > & GetState()
Definition: RixLPEInline.h:173
PRMAN_INLINE unsigned int RixFindFirstSetBit(unsigned long long v)
short getTransition(short state, RixLPEToken symbol) const
Definition: RixLPEInline.h:73
RixLPE & m_rixLpe
Definition: RixLPE.h:361
static bool trans_comp(const Transition &a, const Transition &b)
Definition: RixLPEInline.h:108
PRMAN_INLINE unsigned char GetDiffuseLpeId(int i) const
Definition: RixBxdfLobe.h:1463
RixLPEState(RixLPEAutomata const *automata, const int nautomata)
Definition: RixLPEInline.h:152
void Reset()
Definition: RixLPEInline.h:165
Definition: RixLPE.h:128
PRMAN_INLINE unsigned char GetNumSpecularLobes() const
Definition: RixBxdfLobe.h:1415
std::vector< void * > m_rules
Definition: RixLPEInline.h:116
void *const * getRules(int state, int &count) const
Definition: RixLPEInline.h:90
PRMAN_INLINE unsigned char GetLpeId() const
Definition: RixBxdfLobe.h:718
std::vector< int > customIdVec
Definition: RixLPEInline.h:103
unsigned int ntrans
Definition: RixLPEInline.h:99
bool m_anyLPEs
Definition: RixLPE.h:254
void MoveVertex(RixShadingContext const *sCtx, int sCtxIndex, RixLPEScatterEvent const scatterEvent, RixLPEToken lpeGroupId=RixLPE::k_BLANK)
Definition: RixLPEInline.h:271
const RixLPEAutomata * GetAutomata(int &nautomata) const
Definition: RixLPEInline.h:216
PRMAN_INLINE unsigned char GetNumDiffuseLobes() const
Definition: RixBxdfLobe.h:1409
PRMAN_INLINE RtColorRGB const * GetDiffuseLobe(int i) const
Definition: RixBxdfLobe.h:1427
const RtColorRGB & GetThruput() const
Definition: RixLPEInline.h:210
PRMAN_INLINE ~SplatHelper()
Definition: RixLPEInline.h:496
PRMAN_INLINE RtColorRGB const * GetUserLobe(int i) const
Definition: RixBxdfLobe.h:1439
PRMAN_INLINE unsigned short GetSpecular() const
Definition: RixBxdfLobe.h:1015
#define PRMAN_INLINE
Definition: prmanapi.h:86
PRMAN_INLINE void SplatEmission(RtColorRGB const &emission, RtColorRGB const &thruput, bool isFinite, float clamp=1.0f, bool isHoldout=false)
Definition: RixLPEInline.h:634
RixDisplayServices * m_displaySvc
Definition: RixLPE.h:359
PRMAN_INLINE void SplatValue(RtColorRGB const &color, bool isFinite, float clamp=1.0f)
Definition: RixLPEInline.h:696
OverwritePolicy
Definition: RixLPE.h:192
PRMAN_INLINE unsigned char GetLpeId() const
Definition: RixLPEInline.h:444
PRMAN_INLINE bool AnyLPEs() const
Definition: RixLPEInline.h:137
PRMAN_INLINE void SplatBeauty(RtColorRGB const &val, RtColorRGB &trans) const
Definition: RixLPEInline.h:717
PRMAN_INLINE unsigned char GetNumUserLobes() const
Definition: RixBxdfLobe.h:1421
PRMAN_INLINE unsigned char GetUserLpeId(int i) const
Definition: RixBxdfLobe.h:1475
PRMAN_INLINE RixLPEToken GetEvent() const
Definition: RixLPEInline.h:431
virtual void WriteOpacity(RixChannelId id, int iCtxIndex, float const value)=0
bool Broken() const
Definition: RixLPEInline.h:191
std::vector< Transition > m_trans
Definition: RixLPEInline.h:115
PRMAN_INLINE unsigned char GetLpeIndex() const
Definition: RixLPEInline.h:450
PRMAN_INLINE bool GetReflect() const
Definition: RixBxdfLobe.h:679
RixLPEState & m_state
Definition: RixLPE.h:362
RixLPEToken m_lgtLpeToken
Definition: RixLPE.h:351
void MoveEmissiveObject(RixShadingContext const *sCtx, int sCtxIndex, RtColorRGB const &thruput, RixLPEToken lpeGroupId=RixLPE::k_BLANK)
Definition: RixLPEInline.h:241
std::vector< State > m_states
Definition: RixLPEInline.h:117
PRMAN_INLINE RtColorRGB const * GetSpecularLobe(int i) const
Definition: RixBxdfLobe.h:1433
bool m_writeOpacityAllowed
Definition: RixLPE.h:365
PRMAN_INLINE bool GetUser() const
Definition: RixBxdfLobe.h:712
RixChannelId m_beautyChanId
Definition: RixLPE.h:260
PRMAN_INLINE SplatHelper(RixDisplayServices *displaySvc, int integratorCtxIndex, RixLPE &rixLpe, RixLPEState &state, int depth, RixLPEToken lightLpeToken, RixLPEToken lpeGroupId, bool isReflect, RtColorRGB const &eyeTrans, RtColorRGB const &lightTrans, RixShadingContext const *shadingCtx, int shadingCtxIndex, bool writeOpacityAllowed=true)
Definition: RixLPEInline.h:466
PRMAN_INLINE unsigned short GetDiffuse() const
Definition: RixBxdfLobe.h:1009
PRMAN_INLINE bool GetReflect() const
Definition: RixBxdfLobe.h:991
PRMAN_INLINE bool AnyCustomLPEs() const
Definition: RixLPEInline.h:144
RtColorRGB m_eyeTrans
Definition: RixLPE.h:354
PRMAN_INLINE unsigned char GetSpecularLpeId(int i) const
Definition: RixBxdfLobe.h:1469
RixShadingContext const * m_sCtx
Definition: RixLPE.h:363
PRMAN_INLINE RixLPEToken GetScatt() const
Definition: RixLPEInline.h:438
int RixLPEToken
PRMAN_INLINE RixLPEScatterEvent(RixBXLobeSampled lobeSampled)
Definition: RixLPEInline.h:362
virtual bool Splat(RixChannelId id, int iCtxIndex, float const value)=0
#define PIXAR_ARGUSED(x)
Definition: prmanapi.h:171
int m_integratorCtxIdx
Definition: RixLPE.h:360