File: light.isph

package info (click to toggle)
embree 4.3.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 100,656 kB
  • sloc: cpp: 228,918; xml: 40,944; ansic: 2,685; python: 812; sh: 635; makefile: 228; csh: 42
file content (63 lines) | stat: -rw-r--r-- 2,167 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#pragma once

#include "../device_default.isph"
#include "../core/differential_geometry.isph"

struct Light;

enum TutorialLightType
{
  LIGHT_AMBIENT,
  LIGHT_POINT,
  LIGHT_DIRECTIONAL,
  LIGHT_SPOT,
  LIGHT_DISTANT,
  LIGHT_TRIANGLE,
  LIGHT_QUAD,
};

struct Light_SampleRes
{
  Vec3f weight;  //!< radiance that arrives at the given point divided by pdf
  Vec3f dir;     //!< direction towards the light source
  float dist;    //!< largest valid t_far value for a shadow ray
  float pdf;     //!< probability density that this sample was taken
};

//! compute the weighted radiance at a point caused by a sample on the light source
// by convention, giving (0, 0) as "random" numbers should sample the "center"
// of the light source (used by the raytracing renderers such as the OBJ renderer)
typedef Light_SampleRes (*Light_SampleFunc)(const uniform Light* uniform self,
                                            const DifferentialGeometry& dg, /*! point to generate the sample for >*/
                                            const Vec2f& s);                /*! random numbers to generate the sample >*/


struct Light_EvalRes
{
  Vec3f value;     //!< radiance that arrives at the given point (not weighted by pdf)
  float dist;
  float pdf;       //!< probability density that the direction would have been sampled
};

//! compute the radiance, distance and pdf caused by the light source (pointed to by the given direction)
typedef Light_EvalRes (*Light_EvalFunc)(const uniform Light* uniform self,
                                        const DifferentialGeometry& dg, /*! point to evaluate illumination for >*/
                                        const Vec3f& dir);              /*! direction towards the light source >*/


struct Light
{
  //Light_SampleFunc sample;
  //Light_EvalFunc eval;
  TutorialLightType type;
};

SYCL_EXTERNAL Light_EvalRes Light_eval(const uniform Light* uniform self, const DifferentialGeometry& dg, const Vec3f& dir);

inline void Light_Constructor(uniform Light* uniform self)
{
  //self->eval = GET_FUNCTION_POINTER(Light_eval);
}