OLD | NEW |
1 /* | 1 /* |
2 Copyright (c) 2009 Sony Pictures Imageworks, et al. | 2 Copyright (c) 2009 Sony Pictures Imageworks, et al. |
3 All Rights Reserved. | 3 All Rights Reserved. |
4 | 4 |
5 Redistribution and use in source and binary forms, with or without | 5 Redistribution and use in source and binary forms, with or without |
6 modification, are permitted provided that the following conditions are | 6 modification, are permitted provided that the following conditions are |
7 met: | 7 met: |
8 * Redistributions of source code must retain the above copyright | 8 * Redistributions of source code must retain the above copyright |
9 notice, this list of conditions and the following disclaimer. | 9 notice, this list of conditions and the following disclaimer. |
10 * Redistributions in binary form must reproduce the above copyright | 10 * Redistributions in binary form must reproduce the above copyright |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void *addr = m_context->heap_allot (sym, true); | 188 void *addr = m_context->heap_allot (sym, true); |
189 VaryingRef<Dual2<Vec3> > P ((Dual2<Vec3> *)addr, sym.step())
; | 189 VaryingRef<Dual2<Vec3> > P ((Dual2<Vec3> *)addr, sym.step())
; |
190 for (int i = 0; i < npoints(); ++i) | 190 for (int i = 0; i < npoints(); ++i) |
191 P[i].set (globals->P[i], globals->dPdx[i], globals->dPdy
[i]); | 191 P[i].set (globals->P[i], globals->dPdx[i], globals->dPdy
[i]); |
192 } else { | 192 } else { |
193 // No derivs anyway -- don't copy the user's data | 193 // No derivs anyway -- don't copy the user's data |
194 sym.has_derivs (false); | 194 sym.has_derivs (false); |
195 sym.data (globals->P.ptr()); sym.step (globals->P.step()); | 195 sym.data (globals->P.ptr()); sym.step (globals->P.step()); |
196 } | 196 } |
197 } else if (sym.name() == Strings::I) { | 197 } else if (sym.name() == Strings::I) { |
198 sym.has_derivs (false); | 198 if (globals->dIdx.ptr() && globals->dIdy.ptr()) { |
199 sym.data (globals->I.ptr()); sym.step (globals->I.step()); | 199 sym.has_derivs (true); |
| 200 void *addr = m_context->heap_allot (sym, true); |
| 201 VaryingRef<Dual2<Vec3> > I ((Dual2<Vec3> *)addr, sym.step())
; |
| 202 for (int i = 0; i < npoints(); ++i) |
| 203 I[i].set (globals->I[i], globals->dIdx[i], globals->dIdy
[i]); |
| 204 } else { |
| 205 sym.has_derivs (false); |
| 206 sym.data (globals->I.ptr()); sym.step (globals->I.step()); |
| 207 } |
200 } else if (sym.name() == Strings::N) { | 208 } else if (sym.name() == Strings::N) { |
201 sym.has_derivs (false); | 209 sym.has_derivs (false); |
202 sym.data (globals->N.ptr()); sym.step (globals->N.step()); | 210 sym.data (globals->N.ptr()); sym.step (globals->N.step()); |
203 } else if (sym.name() == Strings::Ng) { | 211 } else if (sym.name() == Strings::Ng) { |
204 sym.has_derivs (false); | 212 sym.has_derivs (false); |
205 sym.data (globals->Ng.ptr()); sym.step (globals->Ng.step()); | 213 sym.data (globals->Ng.ptr()); sym.step (globals->Ng.step()); |
206 } else if (sym.name() == Strings::u) { | 214 } else if (sym.name() == Strings::u) { |
207 if (globals->dudx.ptr() && globals->dudy.ptr()) { | 215 if (globals->dudx.ptr() && globals->dudy.ptr()) { |
208 // Derivs supplied | 216 // Derivs supplied |
209 sym.has_derivs (true); | 217 sym.has_derivs (true); |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 get_matrix (Mfrom, from, whichpoint); | 904 get_matrix (Mfrom, from, whichpoint); |
897 get_inverse_matrix (Mto, to, whichpoint); | 905 get_inverse_matrix (Mto, to, whichpoint); |
898 result = Mfrom * Mto; | 906 result = Mfrom * Mto; |
899 } | 907 } |
900 | 908 |
901 | 909 |
902 | 910 |
903 | 911 |
904 }; // namespace pvt | 912 }; // namespace pvt |
905 }; // namespace OSL | 913 }; // namespace OSL |
OLD | NEW |