@@ -23,6 +23,7 @@ struct Estimator
2323 using interaction_type = Aniso;
2424 using quotient_pdf_type = bxdf::quotient_and_pdf<spectral_type, scalar_type>;
2525 using sample_type = LightSample;
26+ using ray_dir_info_type = typename sample_type::ray_dir_info_type;
2627
2728 static spectral_type proceduralDeferredEvalAndPdf (NBL_REF_ARG (scalar_type) pdf, NBL_CONST_REF_ARG (light_type) light, NBL_CONST_REF_ARG (ray_type) ray, NBL_CONST_REF_ARG (Event) event)
2829 {
@@ -88,6 +89,7 @@ struct Estimator
8889 default :
8990 return (spectral_type)0.0 ;
9091 }
92+ return (spectral_type)0.0 ;
9193 }
9294
9395 static sample_type procedural_generate_and_quotient_and_pdf (NBL_REF_ARG (quotient_pdf_type) quotient_pdf, NBL_REF_ARG (scalar_type) newRayMaxT, NBL_CONST_REF_ARG (light_type) light, NBL_CONST_REF_ARG (vector3_type) origin, NBL_CONST_REF_ARG (interaction_type) interaction, bool isBSDF, NBL_CONST_REF_ARG (vector3_type) xi, uint32_t depth, NBL_CONST_REF_ARG (Event) event)
@@ -104,9 +106,11 @@ struct Estimator
104106 vector3_type position = vector3_type (asfloat (event.data[2 ]), asfloat (event.data[3 ]), asfloat (event.data[4 ]));
105107 Shape<PST_SPHERE> sphere = Shape<PST_SPHERE>::create (position, asfloat (event.data[5 ]), event.data[6 ]);
106108 const vector3_type sampleL = sphere.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
107- const vector3_type V = interaction.V.getDirection ();
109+ const vector3_type V = interaction.isotropic. V.getDirection ();
108110 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
109- L = sample_type::create (sampleL,VdotL,interaction.T,interaction.B,interaction.N);
111+ ray_dir_info_type rayL;
112+ rayL.direction = sampleL;
113+ L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
110114 }
111115 break ;
112116 case PST_TRIANGLE:
@@ -116,9 +120,11 @@ struct Estimator
116120 vector3_type vertex2 = vector3_type (asfloat (event.data[8 ]), asfloat (event.data[9 ]), asfloat (event.data[10 ]));
117121 Shape<PST_TRIANGLE> tri = Shape<PST_TRIANGLE>::create (vertex0, vertex1, vertex2, event.data[11 ]);
118122 const vector3_type sampleL = tri.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
119- const vector3_type V = interaction.V.getDirection ();
123+ const vector3_type V = interaction.isotropic. V.getDirection ();
120124 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
121- L = sample_type::create (sampleL,VdotL,interaction.T,interaction.B,interaction.N);
125+ ray_dir_info_type rayL;
126+ rayL.direction = sampleL;
127+ L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
122128 }
123129 break ;
124130 case PST_RECTANGLE:
@@ -128,9 +134,11 @@ struct Estimator
128134 vector3_type edge1 = vector3_type (asfloat (event.data[8 ]), asfloat (event.data[9 ]), asfloat (event.data[10 ]));
129135 Shape<PST_RECTANGLE> rect = Shape<PST_RECTANGLE>::create (offset, edge0, edge1, event.data[11 ]);
130136 const vector3_type sampleL = rect.template generate_and_pdf<interaction_type>(pdf, newRayMaxT, origin, interaction, isBSDF, xi);
131- const vector3_type V = interaction.V.getDirection ();
137+ const vector3_type V = interaction.isotropic. V.getDirection ();
132138 const scalar_type VdotL = nbl::hlsl::dot<vector3_type>(V, sampleL);
133- L = sample_type::create (sampleL,VdotL,interaction.T,interaction.B,interaction.N);
139+ ray_dir_info_type rayL;
140+ rayL.direction = sampleL;
141+ L = sample_type::create (rayL,VdotL,interaction.T,interaction.B,interaction.isotropic.N);
134142 }
135143 break ;
136144 default :
@@ -149,6 +157,7 @@ struct Estimator
149157 static sample_type generate_and_quotient_and_pdf (NBL_REF_ARG (quotient_pdf_type) quotient_pdf, NBL_REF_ARG (scalar_type) newRayMaxT, NBL_CONST_REF_ARG (light_type) light, NBL_CONST_REF_ARG (vector3_type) origin, NBL_CONST_REF_ARG (interaction_type) interaction, bool isBSDF, NBL_CONST_REF_ARG (vector3_type) xi, uint32_t depth, NBL_CONST_REF_ARG (Event) event)
150158 {
151159 const Event::Mode mode = (Event::Mode)event.mode;
160+ sample_type L;
152161 switch (mode)
153162 {
154163 case Event::Mode::RAY_QUERY:
@@ -168,10 +177,10 @@ struct Estimator
168177 break ;
169178 default :
170179 {
171- sample_type L;
172180 return L;
173181 }
174182 }
183+ return L;
175184 }
176185};
177186
0 commit comments