54 #define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE 96
55 #define STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT 32
56 #define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH (STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 2)
57 #define STUDIOLIGHT_PASSNAME_DIFFUSE "diffuse"
58 #define STUDIOLIGHT_PASSNAME_SPECULAR "specular"
60 #define STUDIOLIGHT_SH_WINDOWING 0.0f
66 #define STUDIOLIGHT_LOAD_CACHED_FILES
90 #define ITER_PIXELS(type, src, channels, width, height) \
92 float texel_size[2]; \
93 texel_size[0] = 1.0f / width; \
94 texel_size[1] = 1.0f / height; \
95 type(*pixel_)[channels] = (type(*)[channels])src; \
96 for (float y = 0.5 * texel_size[1]; y < 1.0; y += texel_size[1]) { \
97 for (float x = 0.5 * texel_size[0]; x < 1.0; x += texel_size[0], pixel_++) { \
98 type *pixel = *pixel_;
100 #define ITER_PIXELS_END \
107 #define IMB_SAFE_FREE(p) \
115 #define GPU_TEXTURE_SAFE_FREE(p) \
118 GPU_texture_free(p); \
125 #define STUDIOLIGHT_DELETE_ICON(s) \
128 BKE_icon_delete(s); \
140 #undef STUDIOLIGHT_DELETE_ICON
142 for (
int index = 0; index < 6; index++) {
187 #define STUDIOLIGHT_FILE_VERSION 1
189 #define READ_VAL(type, parser, id, val, lines) \
191 for (LinkNode *line = lines; line; line = line->next) { \
192 char *val_str, *str = line->link; \
193 if ((val_str = strstr(str, id " "))) { \
194 val_str += sizeof(id);
\
195 val = parser(val_str); \
200 #define READ_FVAL(id, val, lines) READ_VAL(float, atof, id, val, lines)
201 #define READ_IVAL(id, val, lines) READ_VAL(int, atoi, id, val, lines)
203 #define READ_VEC3(id, val, lines) \
205 READ_FVAL(id ".x", val[0], lines); \
206 READ_FVAL(id ".y", val[1], lines); \
207 READ_FVAL(id ".z", val[2], lines); \
210 #define READ_SOLIDLIGHT(sl, i, lines) \
212 READ_IVAL("light[" STRINGIFY(i) "].flag", sl[i].flag, lines); \
213 READ_FVAL("light[" STRINGIFY(i) "].smooth", sl[i].smooth, lines); \
214 READ_VEC3("light[" STRINGIFY(i) "].col", sl[i].col, lines); \
215 READ_VEC3("light[" STRINGIFY(i) "].spec", sl[i].spec, lines); \
216 READ_VEC3("light[" STRINGIFY(i) "].vec", sl[i].vec, lines); \
232 #undef READ_SOLIDLIGHT
237 #define WRITE_FVAL(str, id, val) (BLI_dynstr_appendf(str, id " %f\n", val))
238 #define WRITE_IVAL(str, id, val) (BLI_dynstr_appendf(str, id " %d\n", val))
240 #define WRITE_VEC3(str, id, val) \
242 WRITE_FVAL(str, id ".x", val[0]); \
243 WRITE_FVAL(str, id ".y", val[1]); \
244 WRITE_FVAL(str, id ".z", val[2]); \
247 #define WRITE_SOLIDLIGHT(str, sl, i) \
249 WRITE_IVAL(str, "light[" STRINGIFY(i) "].flag", sl[i].flag); \
250 WRITE_FVAL(str, "light[" STRINGIFY(i) "].smooth", sl[i].smooth); \
251 WRITE_VEC3(str, "light[" STRINGIFY(i) "].col", sl[i].col); \
252 WRITE_VEC3(str, "light[" STRINGIFY(i) "].spec", sl[i].spec); \
253 WRITE_VEC3(str, "light[" STRINGIFY(i) "].vec", sl[i].vec); \
280 #undef WRITE_SOLIDLIGHT
293 float phi = (-(
M_PI * 2)) * u +
M_PI;
295 float sin_theta =
sinf(theta);
296 r[0] = sin_theta *
cosf(phi);
297 r[1] = sin_theta *
sinf(phi);
306 bool is_pos = (dir[0] > 0.0f);
308 r_uv[0] = dir[2] /
fabsf(dir[0]) * (is_pos ? 1 : -1);
309 r_uv[1] = dir[1] /
fabsf(dir[0]) * -1;
312 bool is_pos = (dir[1] > 0.0f);
314 r_uv[0] = dir[0] /
fabsf(dir[1]) * 1;
315 r_uv[1] = dir[2] /
fabsf(dir[1]) * (is_pos ? -1 : 1);
318 bool is_pos = (dir[2] > 0.0f);
320 r_uv[0] = dir[0] /
fabsf(dir[2]) * (is_pos ? -1 : 1);
321 r_uv[1] = dir[1] /
fabsf(dir[2]) * -1;
323 r_uv[0] = r_uv[0] * 0.5f + 0.5f;
324 r_uv[1] = r_uv[1] * 0.5f + 0.5f;
329 const float conversion_matrices[6][3][3] = {
330 {{0.0f, 0.0f, 1.0f}, {0.0f, -1.0f, 0.0f}, {1.0f, 0.0f, 0.0f}},
331 {{0.0f, 0.0f, -1.0f}, {0.0f, -1.0f, 0.0f}, {-1.0f, 0.0f, 0.0f}},
332 {{1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f, 0.0f}},
333 {{1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, -1.0f, 0.0f}},
334 {{1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, {0.0f, 0.0f, -1.0f}},
335 {{-1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}},
339 mul_m3_v3(conversion_matrices[face], r_dir);
364 const unsigned int channels)
370 float *new_rect =
MEM_callocN(
sizeof(
float[4]) * ibuf->
x * ibuf->
y, __func__);
389 const char *pass_name,
392 const char *
UNUSED(chan_id),
393 const char *
UNUSED(view_name))
418 const bool failed = (ibuf ==
NULL);
469 if (diffuse_ibuf ==
NULL) {
472 const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
473 const float magenta[4] = {1.0f, 0.0f, 1.0f, 1.0f};
475 NULL, (failed || (specular_ibuf ==
NULL)) ? magenta : black, 1, 1, 4);
481 if (specular_ibuf !=
NULL) {
487 if (specular_ibuf !=
NULL) {
515 float *gpu_matcap_3components =
MEM_callocN(
sizeof(
float[3]) * ibuf->
x * ibuf->
y, __func__);
518 float(*offset3)[3] = (
float(*)[3])gpu_matcap_3components;
519 for (
int i = 0; i < ibuf->
x * ibuf->
y; i++, offset4++, offset3++) {
585 direction[index_x] = xsign * (
x - 0.5f);
586 direction[index_y] = ysign * (
y - 0.5f);
587 direction[index_z] = zsign * 0.5f;
635 "/tmp/studiolight_radiance_left.png",
638 "/tmp/studiolight_radiance_right.png",
641 "/tmp/studiolight_radiance_front.png",
644 "/tmp/studiolight_radiance_back.png",
647 "/tmp/studiolight_radiance_bottom.png",
650 "/tmp/studiolight_radiance_top.png",
669 float v1x = (
x - halfpix) * 2.0f - 1.0f;
670 float v1y = (
y - halfpix) * 2.0f - 1.0f;
671 float v2x = (
x + halfpix) * 2.0f - 1.0f;
672 float v2y = (
y + halfpix) * 2.0f - 1.0f;
679 float normal[3],
float *weight,
int face,
float x,
float y)
688 float weight_accum = 0.0f;
691 for (
int face = 0; face < 6; face++) {
697 float color[3], cubevec[3], weight;
700 weight_accum += weight;
705 #if STUDIOLIGHT_SH_BANDS > 1
706 const float nx = cubevec[0];
707 const float ny = cubevec[1];
708 const float nz = cubevec[2];
713 #if STUDIOLIGHT_SH_BANDS > 2
714 const float nx2 = SQUARE(nx);
715 const float ny2 = SQUARE(
ny);
716 const float nz2 = SQUARE(nz);
719 madd_v3_v3fl(sh[i++], color, 0.315392f * (3.0f * ny2 - 1.0f));
724 #if STUDIOLIGHT_SH_BANDS > 4
725 const float nx4 = SQUARE(nx2);
726 const float ny4 = SQUARE(ny2);
727 const float nz4 = SQUARE(nz2);
728 madd_v3_v3fl(sh[i++], color, 2.5033429417967046f * nx * nz * (nx2 - nz2));
729 madd_v3_v3fl(sh[i++], color, -1.7701307697799304f * nz *
ny * (3.0f * nx2 - nz2));
730 madd_v3_v3fl(sh[i++], color, 0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2));
731 madd_v3_v3fl(sh[i++], color, -0.6690465435572892f * nz *
ny * (-3.0f + 7.0f * ny2));
732 madd_v3_v3fl(sh[i++], color, (105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f);
733 madd_v3_v3fl(sh[i++], color, -0.6690465435572892f * nx *
ny * (-3.0f + 7.0f * ny2));
734 madd_v3_v3fl(sh[i++], color, 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2));
735 madd_v3_v3fl(sh[i++], color, -1.7701307697799304f * nx *
ny * (nx2 - 3.0f * nz2));
736 madd_v3_v3fl(sh[i++], color, 0.6258357354491761f * (nx4 - 6.0f * nz2 * nx2 + nz4));
766 for (
int m = -1; m <= level; m++) {
772 float squared_lamplacian = 0.0f;
774 squared_lamplacian += table_l[level] * table_b[level];
777 const float target_squared_laplacian = max_laplacian * max_laplacian;
778 if (squared_lamplacian <= target_squared_laplacian) {
782 const int no_iterations = 10000000;
783 for (
int i = 0; i < no_iterations; i++) {
788 f += table_l[level] * table_b[level] /
square_f(1.0f + lambda * table_l[level]);
789 fd += (2.0f *
square_f(table_l[level]) * table_b[level]) /
790 cube_f(1.0f + lambda * table_l[level]);
793 f = target_squared_laplacian - f;
795 float delta = -f / fd;
798 if (
fabsf(delta) < 1e-6f) {
808 if (max_laplacian <= 0.0f) {
828 const int level_sq =
square_i(level);
829 const int level_1_sq =
square_i(level + 1.0f);
830 s[0] = 1.0f / (1.0f + lambda_r * level_sq * level_1_sq);
831 s[1] = 1.0f / (1.0f + lambda_g * level_sq * level_1_sq);
832 s[2] = 1.0f / (1.0f + lambda_b * level_sq * level_1_sq);
834 for (
int m = -1; m <= level; m++) {
841 const float normal[3],
float sh0,
float sh1,
float sh2,
float sh3)
848 float R1[3] = {-sh3, sh2, -sh1};
854 float p = 1.0f + 2.0f * lenR1 / R0;
855 float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0);
857 return R0 * (
a + (1.0f -
a) * (p + 1.0f) *
powf(q, p));
864 #if STUDIOLIGHT_SH_BANDS == 2
866 for (
int i = 0; i < 3; i++) {
868 normal, sh[0][i], sh[1][i], sh[2][i], sh[3][i]);
873 # if STUDIOLIGHT_SH_BANDS > 1
874 const float nx =
normal[0];
876 const float nz =
normal[2];
881 # if STUDIOLIGHT_SH_BANDS > 2
882 const float nx2 = SQUARE(nx);
883 const float ny2 = SQUARE(
ny);
884 const float nz2 = SQUARE(nz);
892 # if STUDIOLIGHT_SH_BANDS > 4
893 const float nx4 = SQUARE(nx2);
894 const float ny4 = SQUARE(ny2);
895 const float nz4 = SQUARE(nz2);
900 -1.7701307697799304f * nz *
ny * (3.0f * nx2 - nz2));
903 0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2));
906 -0.6690465435572892f * nz *
ny * (-3.0f + 7.0f * ny2));
909 (105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f);
912 -0.6690465435572892f * nx *
ny * (-3.0f + 7.0f * ny2));
915 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2));
918 -1.7701307697799304f * nx *
ny * (nx2 - 3.0f * nz2));
921 0.6258357354491761f * (nx4 - 6.0f * nz2 * nx2 + nz4));
929 static const float sl_sh_band_factors[5] = {
937 int index = 0, dst_idx = 0;
940 for (
int m = 0; m < last_band; m++) {
980 if (radiance_buffer ==
NULL) {
984 float accum[3] = {0.0f, 0.0f, 0.0f};
985 float accum_weight = 0.00001f;
992 direction[zoffset] = zsign * 0.5f;
993 direction[xoffset] =
x - 0.5f;
994 direction[yoffset] =
y - 0.5f;
999 accum_weight += weight;
1010 float fresnel = exp2(-8.35f * NV) * (1.0f -
roughness);
1011 return spec_color * (1.0f - fresnel) + fresnel;
1017 float w_1 =
w + 1.0f;
1018 return max_ff((
NL +
w) / (w_1 * w_1), 0.0f);
1037 gloss *= 1.0f -
wrap;
1038 float shininess = exp2(10.0f * gloss + 1.0f);
1042 float normalization_factor = shininess * 0.125f + 1.0f;
1043 float spec_light =
powf(spec_angle, shininess) *
max_ff(
NL, 0.0f) * normalization_factor;
1051 return spec_light * (1.0 - w2) + spec_env * w2;
1061 float diff_light[3], spec_light[3];
1090 #ifdef STUDIOLIGHT_LOAD_CACHED_FILES
1109 #ifdef STUDIOLIGHT_LOAD_CACHED_FILES
1186 const char *subfolder,
1194 for (i = 0; i < totfile; i++) {
1195 if ((dir[i].
type & S_IFREG)) {
1221 if (flagorder1 < flagorder2) {
1224 if (flagorder1 > flagorder2) {
1239 const float co[2] = {u - 0.5f,
v - 0.5f};
1241 float alpha = 1.0f + (inner_edge - dist) / (outer_edge - inner_edge);
1247 #define STUDIOLIGHT_DIAMETER 0.95f
1249 #define RESCALE_COORD(x) (x / STUDIOLIGHT_DIAMETER - (1.0f - STUDIOLIGHT_DIAMETER) / 2.0f)
1254 normal[0] = u * 2.0f - 1.0f;
1269 if (alphamask != 0) {
1270 float normal[3], direction[3], color[4];
1271 const float incoming[3] = {0.0f, 0.0f, -1.0f};
1275 SWAP(
float, direction[1], direction[2]);
1276 direction[1] = -direction[1];
1307 float u = dx * diffuse_buffer->
x - 1.0f;
1308 float v = dy * diffuse_buffer->
y - 1.0f;
1311 if (specular_buffer) {
1334 if (alphamask != 0) {
1335 float normal[3], color[3];
1360 lights[0].
smooth = 0.526620f;
1361 lights[0].
col[0] = 0.033103f;
1362 lights[0].
col[1] = 0.033103f;
1363 lights[0].
col[2] = 0.033103f;
1364 lights[0].
spec[0] = 0.266761f;
1365 lights[0].
spec[1] = 0.266761f;
1366 lights[0].
spec[2] = 0.266761f;
1367 lights[0].
vec[0] = -0.352546f;
1368 lights[0].
vec[1] = 0.170931f;
1369 lights[0].
vec[2] = -0.920051f;
1372 lights[1].
smooth = 0.000000f;
1373 lights[1].
col[0] = 0.521083f;
1374 lights[1].
col[1] = 0.538226f;
1375 lights[1].
col[2] = 0.538226f;
1376 lights[1].
spec[0] = 0.599030f;
1377 lights[1].
spec[1] = 0.599030f;
1378 lights[1].
spec[2] = 0.599030f;
1379 lights[1].
vec[0] = -0.408163f;
1380 lights[1].
vec[1] = 0.346939f;
1381 lights[1].
vec[2] = 0.844415f;
1384 lights[2].
smooth = 0.478261f;
1385 lights[2].
col[0] = 0.038403f;
1386 lights[2].
col[1] = 0.034357f;
1387 lights[2].
col[2] = 0.049530f;
1388 lights[2].
spec[0] = 0.106102f;
1389 lights[2].
spec[1] = 0.125981f;
1390 lights[2].
spec[2] = 0.158523f;
1391 lights[2].
vec[0] = 0.521739f;
1392 lights[2].
vec[1] = 0.826087f;
1393 lights[2].
vec[2] = 0.212999f;
1396 lights[3].
smooth = 0.200000f;
1397 lights[3].
col[0] = 0.090838f;
1398 lights[3].
col[1] = 0.082080f;
1399 lights[3].
col[2] = 0.072255f;
1400 lights[3].
spec[0] = 0.106535f;
1401 lights[3].
spec[1] = 0.084771f;
1402 lights[3].
spec[2] = 0.066080f;
1403 lights[3].
vec[0] = 0.624519f;
1404 lights[3].
vec[1] = -0.562067f;
1405 lights[3].
vec[2] = -0.542269f;
1460 const char *default_name =
"";
1517 switch (icon_id_type) {
1541 if ((sl->
flag & flag) == flag) {
1594 const float light_ambient[3])
1605 memcpy(sl->
light, light,
sizeof(*light) * 4);
1606 memcpy(sl->
light_ambient, light_ambient,
sizeof(*light_ambient) * 3);
1620 memcpy(sl.
light,
U.light_param,
sizeof(*sl.
light) * 4);
typedef float(TangentPoint)[2]
@ BLENDER_SYSTEM_DATAFILES
bool BKE_appdir_app_is_portable_install(void)
const char * BKE_appdir_folder_id(const int folder_id, const char *subfolder)
int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type)
#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP
#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED
#define STUDIOLIGHT_ICON_ID_TYPE_RADIANCE
#define STUDIOLIGHT_X_POS
@ STUDIOLIGHT_EXTERNAL_IMAGE_LOADED
@ STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE
@ STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE
@ STUDIOLIGHT_USER_DEFINED
@ STUDIOLIGHT_EQUIRECT_IRRADIANCE_IMAGE_CALCULATED
@ STUDIOLIGHT_SPHERICAL_HARMONICS_COEFFICIENTS_CALCULATED
@ STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE
@ STUDIOLIGHT_TYPE_MATCAP
@ STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED
@ STUDIOLIGHT_SPECULAR_HIGHLIGHT_PASS
@ STUDIOLIGHT_EQUIRECT_IRRADIANCE_GPUTEXTURE
@ STUDIOLIGHT_TYPE_STUDIO
@ STUDIOLIGHT_EXTERNAL_FILE
void StudioLightFreeFunction(struct StudioLight *, void *data)
#define STUDIOLIGHT_SH_BANDS
#define STUDIOLIGHT_X_NEG
#define STUDIOLIGHT_ICON_SIZE
#define STUDIOLIGHT_Y_NEG
#define STUDIOLIGHT_Z_POS
#define STUDIOLIGHT_Z_NEG
#define STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE
#define STUDIOLIGHT_Y_POS
#define STUDIOLIGHT_MAX_LIGHT
#define STUDIOLIGHT_SH_COEFS_LEN
A dynamically sized string ADT.
DynStr * BLI_dynstr_new(void) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
char * BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
File and directory operations.
void BLI_filelist_free(struct direntry *filelist, const unsigned int nrentries)
unsigned int BLI_filelist_dir_contents(const char *dir, struct direntry **r_filelist)
void BLI_file_free_lines(struct LinkNode *lines)
struct LinkNode * BLI_file_read_as_lines(const char *file) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FILE * BLI_fopen(const char *filename, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Some types for dealing with directories.
void * BLI_pophead(ListBase *listbase) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_listbase_sort(struct ListBase *listbase, int(*cmp)(const void *, const void *)) ATTR_NONNULL(1
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE float min_ff(float a, float b)
MINLINE int square_i(int a)
MINLINE float cube_f(float a)
MINLINE float square_f(float a)
unsigned int rgb_to_cpack(float r, float g, float b)
float linearrgb_to_srgb(float c)
void mul_m3_v3(const float M[3][3], float r[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
void reflect_v3_v3v3(float out[3], const float vec[3], const float normal[3])
MINLINE float normalize_v3(float r[3])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check_array(const char *str, const char **ext_array) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check(const char *str, const char *ext) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BLI_split_file_part(const char *string, char *file, const size_t filelen)
#define STRNCPY(dst, src)
int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
#define BLI_string_joinN(...)
#define UNUSED_FUNCTION(x)
#define STREQLEN(a, b, n)
These structs are the foundation for all linked lists in the library system.
_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 GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_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 ny
_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 type
_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
void GPU_texture_wrap_mode(GPUTexture *tex, bool use_repeat, bool use_clamp)
struct GPUTexture GPUTexture
void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void *data)
void GPU_texture_filter_mode(GPUTexture *tex, bool use_filter)
GPUTexture * GPU_texture_create_2d(const char *name, int w, int h, int mip_len, eGPUTextureFormat format, const float *data)
void IMB_float_from_rect(struct ImBuf *ibuf)
void IMB_freeImBuf(struct ImBuf *ibuf)
void nearest_interpolation_color_wrap(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
void nearest_interpolation_color(struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
void IMB_buffer_float_from_float(float *rect_to, const float *rect_from, int channels_from, int profile_to, int profile_from, bool predivide, int width, int height, int stride_to, int stride_from)
struct ImBuf * IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
struct ImBuf * IMB_allocFromBuffer(const unsigned int *rect, const float *rectf, unsigned int w, unsigned int h, unsigned int channels)
bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags)
Contains defines and structs used throughout the imbuf module.
#define IB_PROFILE_LINEAR_RGB
const char * imb_ext_image[]
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
static CCL_NAMESPACE_BEGIN const double alpha
IconTextureDrawCall normal
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
IMETHOD Vector diff(const Vector &a, const Vector &b, double dt=1)
INLINE Rall1d< T, V, S > atan2(const Rall1d< T, V, S > &y, const Rall1d< T, V, S > &x)
static GPUContext * wrap(Context *ctx)
static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal)
static const pxr::TfToken diffuse_color("diffuseColor", pxr::TfToken::Immortal)
void IMB_exr_close(void *handle)
void IMB_exr_multilayer_convert(void *handle, void *base, void *(*addview)(void *base, const char *str), void *(*addlayer)(void *base, const char *str), void(*addpass)(void *base, void *lay, const char *str, float *rect, int totchan, const char *chan_id, const char *view))
int num_specular_channels
struct GPUTexture * gputexture
StudioLightImage matcap_specular
SolidLight light[STUDIOLIGHT_MAX_LIGHT]
void * free_function_data
struct GPUTexture * equirect_radiance_gputexture
float spherical_harmonics_coefs[STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN][3]
struct ImBuf * equirect_irradiance_buffer
StudioLightFreeFunction * free_function
struct ImBuf * equirect_radiance_buffer
int icon_id_matcap_flipped
StudioLightImage matcap_diffuse
struct ImBuf * radiance_cubemap_buffers[6]
struct GPUTexture * equirect_irradiance_gputexture
static void studiolight_create_matcap_specular_gputexture(StudioLight *sl)
#define STUDIOLIGHT_FILE_VERSION
static const char * STUDIOLIGHT_LIGHTS_FOLDER
static void studiolight_radiance_preview(uint *icon_buffer, StudioLight *sl)
#define WRITE_IVAL(str, id, val)
void BKE_studiolight_remove(StudioLight *sl)
#define STUDIOLIGHT_PASSNAME_DIFFUSE
#define STUDIOLIGHT_SH_WINDOWING
static float * studiolight_multilayer_convert_pass(ImBuf *ibuf, float *rect, const unsigned int channels)
static void * studiolight_multilayer_addview(void *UNUSED(base), const char *UNUSED(view_name))
struct StudioLight * BKE_studiolight_findindex(int index, int flag)
static void studiolight_irradiance_preview(uint *icon_buffer, StudioLight *sl)
static const char * STUDIOLIGHT_MATCAP_DEFAULT
static void studiolight_spherical_harmonics_calculate_coefficients(StudioLight *sl, float(*sh)[3])
static struct StudioLight * studiolight_create(int flag)
#define WRITE_SOLIDLIGHT(str, sl, i)
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[4])
static bool studiolight_load_irradiance_equirect_image(StudioLight *sl)
static void studiolight_lights_eval(StudioLight *sl, float color[3], const float normal[3])
static int last_studiolight_id
static int studiolight_cmp(const void *a, const void *b)
static void studiolight_calculate_cubemap_vector_weight(float normal[3], float *weight, int face, float x, float y)
#define ITER_PIXELS(type, src, channels, width, height)
static int studiolight_flag_cmp_order(const StudioLight *sl)
struct MultilayerConvertContext MultilayerConvertContext
static void studiolight_calculate_radiance_buffer(ImBuf *ibuf, float *colbuf, const int index_x, const int index_y, const int index_z, const float xsign, const float ysign, const float zsign)
static void cube_face_uv_to_direction(float r_dir[3], float x, float y, int face)
static StudioLight * studiolight_add_file(const char *path, int flag)
static ListBase studiolights
static bool studiolight_load_spherical_harmonics_coefficients(StudioLight *sl)
struct ListBase * BKE_studiolight_listbase(void)
static void studiolight_calculate_radiance(ImBuf *ibuf, float color[4], const float direction[3])
StudioLight * BKE_studiolight_load(const char *path, int type)
static void studiolight_spherical_harmonics_apply_windowing(float(*sh)[3], float max_laplacian)
StudioLight * BKE_studiolight_create(const char *path, const SolidLight light[4], const float light_ambient[3])
BLI_INLINE float texel_solid_angle(float x, float y, float halfpix)
static void studiolight_load_equirect_image(StudioLight *sl)
void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id)
static uint alpha_circle_mask(float u, float v, float inner_edge, float outer_edge)
static void studiolight_calculate_radiance_cubemap_buffers(StudioLight *sl)
static void studiolight_create_matcap_gputexture(StudioLightImage *sli)
static void UNUSED_FUNCTION() direction_to_cube_face_uv(float r_uv[2], int *r_face, const float dir[3])
static void sphere_normal_from_uv(float normal[3], float u, float v)
#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT
static void * studiolight_multilayer_addlayer(void *base, const char *UNUSED(layer_name))
void BKE_studiolight_set_free_function(StudioLight *sl, StudioLightFreeFunction *free_function, void *data)
#define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE
static void studiolight_add_files_from_datafolder(const int folder_id, const char *subfolder, int flag)
#define WRITE_VEC3(str, id, val)
BLI_INLINE float area_element(float x, float y)
static void studiolight_calculate_diffuse_light(StudioLight *sl)
static void studiolight_calculate_irradiance_equirect_image(StudioLight *sl)
static void studiolight_load_solid_light(StudioLight *sl)
void BKE_studiolight_init(void)
static void studiolight_multilayer_addpass(void *base, void *UNUSED(lay), const char *pass_name, float *rect, int num_channels, const char *UNUSED(chan_id), const char *UNUSED(view_name))
static float wrapped_lighting(float NL, float w)
static void studiolight_free(struct StudioLight *sl)
#define STUDIOLIGHT_DELETE_ICON(s)
#define STUDIOLIGHT_PASSNAME_SPECULAR
static const char * STUDIOLIGHT_WORLD_FOLDER
static void studiolight_spherical_harmonics_apply_band_factors(StudioLight *sl, float(*sh)[3])
static void studiolight_create_matcap_diffuse_gputexture(StudioLight *sl)
struct StudioLight * BKE_studiolight_find(const char *name, int flag)
#define READ_VEC3(id, val, lines)
void BKE_studiolight_ensure_flag(StudioLight *sl, int flag)
static float studiolight_spherical_harmonics_lambda_get(float *sh, float max_laplacian)
#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH
static const char * STUDIOLIGHT_MATCAP_FOLDER
static void studiolight_create_equirect_radiance_gputexture(StudioLight *sl)
static float brdf_approx(float spec_color, float roughness, float NV)
BLI_INLINE void studiolight_spherical_harmonics_eval(StudioLight *sl, float color[3], const float normal[3])
#define GPU_TEXTURE_SAFE_FREE(p)
static void direction_to_equirect(float r[2], const float dir[3])
static float studiolight_spherical_harmonics_geomerics_eval(const float normal[3], float sh0, float sh1, float sh2, float sh3)
static void studiolight_write_solid_light(StudioLight *sl)
struct StudioLight * BKE_studiolight_find_default(int flag)
static const char * STUDIOLIGHT_WORLD_DEFAULT
static void studiolight_create_equirect_irradiance_gputexture(StudioLight *sl)
StudioLight * BKE_studiolight_studio_edit_get(void)
void BKE_studiolight_free(void)
static void equirect_to_direction(float r[3], float u, float v)
#define READ_SOLIDLIGHT(sl, i, lines)
static void studiolight_matcap_preview(uint *icon_buffer, StudioLight *sl, bool flipped)
static float blinn_specular(const float L[3], const float I[3], const float N[3], const float R[3], float NL, float roughness, float wrap)
BLI_INLINE void studiolight_evaluate_specular_radiance_buffer(ImBuf *radiance_buffer, const float normal[3], float color[3], int xoffset, int yoffset, int zoffset, float zsign)
void BKE_studiolight_refresh(void)
void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)