kernel_path_common.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright 2011-2015 Blender Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include "util/util_hash.h"
  17. CCL_NAMESPACE_BEGIN
  18. ccl_device_inline void kernel_path_trace_setup(
  19. KernelGlobals *kg, int sample, int x, int y, uint *rng_hash, ccl_addr_space Ray *ray)
  20. {
  21. float filter_u;
  22. float filter_v;
  23. int num_samples = kernel_data.integrator.aa_samples;
  24. path_rng_init(kg, sample, num_samples, rng_hash, x, y, &filter_u, &filter_v);
  25. /* sample camera ray */
  26. float lens_u = 0.0f, lens_v = 0.0f;
  27. if (kernel_data.cam.aperturesize > 0.0f)
  28. path_rng_2D(kg, *rng_hash, sample, num_samples, PRNG_LENS_U, &lens_u, &lens_v);
  29. float time = 0.0f;
  30. #ifdef __CAMERA_MOTION__
  31. if (kernel_data.cam.shuttertime != -1.0f)
  32. time = path_rng_1D(kg, *rng_hash, sample, num_samples, PRNG_TIME);
  33. #endif
  34. camera_sample(kg, x, y, filter_u, filter_v, lens_u, lens_v, time, ray);
  35. }
  36. CCL_NAMESPACE_END