Blender  V3.3
common.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #pragma once
5 
7 
9 
10 /* Area light sampling */
11 
12 /* Uses the following paper:
13  *
14  * Carlos Urena et al.
15  * An Area-Preserving Parametrization for Spherical Rectangles.
16  *
17  * https://www.solidangle.com/research/egsr2013_spherical_rectangle.pdf
18  *
19  * NOTE: light_p is modified when sample_coord is true.
20  */
22  ccl_private float3 *light_p,
23  float3 axisu,
24  float3 axisv,
25  float randu,
26  float randv,
27  bool sample_coord)
28 {
29  /* In our name system we're using P for the center,
30  * which is o in the paper.
31  */
32 
33  float3 corner = *light_p - axisu * 0.5f - axisv * 0.5f;
34  float axisu_len, axisv_len;
35  /* Compute local reference system R. */
36  float3 x = normalize_len(axisu, &axisu_len);
37  float3 y = normalize_len(axisv, &axisv_len);
38  float3 z = cross(x, y);
39  /* Compute rectangle coords in local reference system. */
40  float3 dir = corner - P;
41  float z0 = dot(dir, z);
42  /* Flip 'z' to make it point against Q. */
43  if (z0 > 0.0f) {
44  z *= -1.0f;
45  z0 *= -1.0f;
46  }
47  float x0 = dot(dir, x);
48  float y0 = dot(dir, y);
49  float x1 = x0 + axisu_len;
50  float y1 = y0 + axisv_len;
51  /* Compute internal angles (gamma_i). */
52  float4 diff = make_float4(x0, y1, x1, y0) - make_float4(x1, y0, x0, y1);
53  float4 nz = make_float4(y0, x1, y1, x0) * diff;
54  nz = nz / sqrt(z0 * z0 * diff * diff + nz * nz);
55  float g0 = safe_acosf(-nz.x * nz.y);
56  float g1 = safe_acosf(-nz.y * nz.z);
57  float g2 = safe_acosf(-nz.z * nz.w);
58  float g3 = safe_acosf(-nz.w * nz.x);
59  /* Compute predefined constants. */
60  float b0 = nz.x;
61  float b1 = nz.z;
62  float b0sq = b0 * b0;
63  float k = M_2PI_F - g2 - g3;
64  /* Compute solid angle from internal angles. */
65  float S = g0 + g1 - k;
66 
67  if (sample_coord) {
68  /* Compute cu. */
69  float au = randu * S + k;
70  float fu = (cosf(au) * b0 - b1) / sinf(au);
71  float cu = 1.0f / sqrtf(fu * fu + b0sq) * (fu > 0.0f ? 1.0f : -1.0f);
72  cu = clamp(cu, -1.0f, 1.0f);
73  /* Compute xu. */
74  float xu = -(cu * z0) / max(sqrtf(1.0f - cu * cu), 1e-7f);
75  xu = clamp(xu, x0, x1);
76  /* Compute yv. */
77  float z0sq = z0 * z0;
78  float y0sq = y0 * y0;
79  float y1sq = y1 * y1;
80  float d = sqrtf(xu * xu + z0sq);
81  float h0 = y0 / sqrtf(d * d + y0sq);
82  float h1 = y1 / sqrtf(d * d + y1sq);
83  float hv = h0 + randv * (h1 - h0), hv2 = hv * hv;
84  float yv = (hv2 < 1.0f - 1e-6f) ? (hv * d) / sqrtf(1.0f - hv2) : y1;
85 
86  /* Transform (xu, yv, z0) to world coords. */
87  *light_p = P + xu * x + yv * y + z0 * z;
88  }
89 
90  /* return pdf */
91  if (S != 0.0f)
92  return 1.0f / S;
93  else
94  return 0.0f;
95 }
96 
97 ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float randv)
98 {
99  to_unit_disk(&randu, &randv);
100  return ru * randu + rv * randv;
101 }
102 
103 ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
104 {
105  float3 ru, rv;
106 
107  make_orthonormals(v, &ru, &rv);
108 
109  return ellipse_sample(ru, rv, randu, randv);
110 }
111 
112 ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
113 {
114  return normalize(D + disk_light_sample(D, randu, randv) * radius);
115 }
116 
118 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
119 {
120  return disk_light_sample(normalize(P - center), randu, randv) * radius;
121 }
122 
123 ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, float3 N)
124 {
125  float attenuation = dot(dir, N);
126 
127  if (attenuation <= spot_angle) {
128  attenuation = 0.0f;
129  }
130  else {
131  float t = attenuation - spot_angle;
132 
133  if (t < spot_smooth && spot_smooth != 0.0f)
134  attenuation *= smoothstepf(t / spot_smooth);
135  }
136 
137  return attenuation;
138 }
139 
141  const float3 lightNg,
142  const float tan_spread,
143  const float normalize_spread)
144 {
145  /* Model a soft-box grid, computing the ratio of light not hidden by the
146  * slats of the grid at a given angle. (see D10594). */
147  const float cos_a = -dot(D, lightNg);
148  const float sin_a = safe_sqrtf(1.0f - sqr(cos_a));
149  const float tan_a = sin_a / cos_a;
150  return max((1.0f - (tan_spread * tan_a)) * normalize_spread, 0.0f);
151 }
152 
153 /* Compute subset of area light that actually has an influence on the shading point, to
154  * reduce noise with low spread. */
156  const float3 lightNg,
157  ccl_private float3 *lightP,
158  ccl_private float3 *axisu,
159  ccl_private float3 *axisv,
160  const float tan_spread)
161 {
162  /* Closest point in area light plane and distance to that plane. */
163  const float3 closest_P = P - dot(lightNg, P - *lightP) * lightNg;
164  const float t = len(closest_P - P);
165 
166  /* Radius of circle on area light that actually affects the shading point. */
167  const float radius = t / tan_spread;
168 
169  /* TODO: would be faster to store as normalized vector + length, also in rect_light_sample. */
170  float len_u, len_v;
171  const float3 u = normalize_len(*axisu, &len_u);
172  const float3 v = normalize_len(*axisv, &len_v);
173 
174  /* Local uv coordinates of closest point. */
175  const float closest_u = dot(u, closest_P - *lightP);
176  const float closest_v = dot(v, closest_P - *lightP);
177 
178  /* Compute rectangle encompassing the circle that affects the shading point,
179  * clamped to the bounds of the area light. */
180  const float min_u = max(closest_u - radius, -len_u * 0.5f);
181  const float max_u = min(closest_u + radius, len_u * 0.5f);
182  const float min_v = max(closest_v - radius, -len_v * 0.5f);
183  const float max_v = min(closest_v + radius, len_v * 0.5f);
184 
185  /* Skip if rectangle is empty. */
186  if (min_u >= max_u || min_v >= max_v) {
187  return false;
188  }
189 
190  /* Compute new area light center position and axes from rectangle in local
191  * uv coordinates. */
192  const float new_center_u = 0.5f * (min_u + max_u);
193  const float new_center_v = 0.5f * (min_v + max_v);
194  const float new_len_u = max_u - min_u;
195  const float new_len_v = max_v - min_v;
196 
197  *lightP = *lightP + new_center_u * u + new_center_v * v;
198  *axisu = u * new_len_u;
199  *axisv = v * new_len_v;
200 
201  return true;
202 }
203 
204 ccl_device float lamp_light_pdf(KernelGlobals kg, const float3 Ng, const float3 I, float t)
205 {
206  float cos_pi = dot(Ng, I);
207 
208  if (cos_pi <= 0.0f)
209  return 0.0f;
210 
211  return t * t / cos_pi;
212 }
213 
sqrt(x)+1/max(0
MINLINE float safe_sqrtf(float a)
MINLINE float safe_acosf(float a)
NSNotificationCenter * center
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble z
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble y1
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
float float4[4]
ATTR_WARN_UNUSED_RESULT const BMVert * v
ccl_device float spot_light_attenuation(float3 dir, float spot_angle, float spot_smooth, float3 N)
Definition: common.h:123
ccl_device float3 disk_light_sample(float3 v, float randu, float randv)
Definition: common.h:103
ccl_device bool light_spread_clamp_area_light(const float3 P, const float3 lightNg, ccl_private float3 *lightP, ccl_private float3 *axisu, ccl_private float3 *axisv, const float tan_spread)
Definition: common.h:155
ccl_device_inline float3 ellipse_sample(float3 ru, float3 rv, float randu, float randv)
Definition: common.h:97
ccl_device float3 distant_light_sample(float3 D, float radius, float randu, float randv)
Definition: common.h:112
ccl_device float light_spread_attenuation(const float3 D, const float3 lightNg, const float tan_spread, const float normalize_spread)
Definition: common.h:140
ccl_device float3 sphere_light_sample(float3 P, float3 center, float radius, float randu, float randv)
Definition: common.h:118
ccl_device float lamp_light_pdf(KernelGlobals kg, const float3 Ng, const float3 I, float t)
Definition: common.h:204
CCL_NAMESPACE_BEGIN ccl_device_inline float rect_light_sample(float3 P, ccl_private float3 *light_p, float3 axisu, float3 axisv, float randu, float randv, bool sample_coord)
Definition: common.h:21
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
#define ccl_device
Definition: cuda/compat.h:32
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_inline
Definition: cuda/compat.h:34
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
const KernelGlobalsCPU *ccl_restrict KernelGlobals
int len
Definition: draw_manager.c:108
ccl_device_inline float2 normalize_len(const float2 &a, float *t)
static float P(float k)
Definition: math_interp.c:25
#define N
#define make_float4(x, y, z, w)
Definition: metal/compat.h:205
#define sqrtf(x)
Definition: metal/compat.h:243
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
vec_base< T, 3 > cross(const vec_base< T, 3 > &a, const vec_base< T, 3 > &b)
T clamp(const T &a, const T &min, const T &max)
vec_base< T, Size > normalize(const vec_base< T, Size > &v)
#define I
CCL_NAMESPACE_BEGIN ccl_device void to_unit_disk(ccl_private float *x, ccl_private float *y)
#define min(a, b)
Definition: sort.c:35
float max
ccl_device_inline float sqr(float a)
Definition: util/math.h:746
#define M_2PI_F
Definition: util/math.h:60
ccl_device_inline void make_orthonormals(const float3 N, ccl_private float3 *a, ccl_private float3 *b)
Definition: util/math.h:566
ccl_device_inline float smoothstepf(float f)
Definition: util/math.h:484
BLI_INLINE float D(const float *data, const int res[3], int x, int y, int z)
Definition: voxel.c:13