37 #define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE 96
38 #define STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT 32
39 #define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH (STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 2)
40 #define STUDIOLIGHT_PASSNAME_DIFFUSE "diffuse"
41 #define STUDIOLIGHT_PASSNAME_SPECULAR "specular"
43 #define STUDIOLIGHT_SH_WINDOWING 0.0f
49 #define STUDIOLIGHT_LOAD_CACHED_FILES
73 #define ITER_PIXELS(type, src, channels, width, height) \
75 float texel_size[2]; \
76 texel_size[0] = 1.0f / width; \
77 texel_size[1] = 1.0f / height; \
78 type(*pixel_)[channels] = (type(*)[channels])src; \
79 for (float y = 0.5 * texel_size[1]; y < 1.0; y += texel_size[1]) { \
80 for (float x = 0.5 * texel_size[0]; x < 1.0; x += texel_size[0], pixel_++) { \
81 type *pixel = *pixel_;
83 #define ITER_PIXELS_END \
90 #define IMB_SAFE_FREE(p) \
98 #define GPU_TEXTURE_SAFE_FREE(p) \
101 GPU_texture_free(p); \
108 #define STUDIOLIGHT_DELETE_ICON(s) \
111 BKE_icon_delete(s); \
123 #undef STUDIOLIGHT_DELETE_ICON
125 for (
int index = 0; index < 6; index++) {
170 #define STUDIOLIGHT_FILE_VERSION 1
172 #define READ_VAL(type, parser, id, val, lines) \
174 for (LinkNode *line = lines; line; line = line->next) { \
175 char *val_str, *str = line->link; \
176 if ((val_str = strstr(str, id " "))) { \
177 val_str += sizeof(id);
\
178 val = parser(val_str); \
183 #define READ_FVAL(id, val, lines) READ_VAL(float, atof, id, val, lines)
184 #define READ_IVAL(id, val, lines) READ_VAL(int, atoi, id, val, lines)
186 #define READ_VEC3(id, val, lines) \
188 READ_FVAL(id ".x", val[0], lines); \
189 READ_FVAL(id ".y", val[1], lines); \
190 READ_FVAL(id ".z", val[2], lines); \
193 #define READ_SOLIDLIGHT(sl, i, lines) \
195 READ_IVAL("light[" STRINGIFY(i) "].flag", sl[i].flag, lines); \
196 READ_FVAL("light[" STRINGIFY(i) "].smooth", sl[i].smooth, lines); \
197 READ_VEC3("light[" STRINGIFY(i) "].col", sl[i].col, lines); \
198 READ_VEC3("light[" STRINGIFY(i) "].spec", sl[i].spec, lines); \
199 READ_VEC3("light[" STRINGIFY(i) "].vec", sl[i].vec, lines); \
215 #undef READ_SOLIDLIGHT
220 #define WRITE_FVAL(str, id, val) (BLI_dynstr_appendf(str, id " %f\n", val))
221 #define WRITE_IVAL(str, id, val) (BLI_dynstr_appendf(str, id " %d\n", val))
223 #define WRITE_VEC3(str, id, val) \
225 WRITE_FVAL(str, id ".x", val[0]); \
226 WRITE_FVAL(str, id ".y", val[1]); \
227 WRITE_FVAL(str, id ".z", val[2]); \
230 #define WRITE_SOLIDLIGHT(str, sl, i) \
232 WRITE_IVAL(str, "light[" STRINGIFY(i) "].flag", sl[i].flag); \
233 WRITE_FVAL(str, "light[" STRINGIFY(i) "].smooth", sl[i].smooth); \
234 WRITE_VEC3(str, "light[" STRINGIFY(i) "].col", sl[i].col); \
235 WRITE_VEC3(str, "light[" STRINGIFY(i) "].spec", sl[i].spec); \
236 WRITE_VEC3(str, "light[" STRINGIFY(i) "].vec", sl[i].vec); \
263 #undef WRITE_SOLIDLIGHT
276 float phi = (-(
M_PI * 2)) * u +
M_PI;
278 float sin_theta =
sinf(theta);
279 r[0] = sin_theta *
cosf(phi);
280 r[1] = sin_theta *
sinf(phi);
289 bool is_pos = (dir[0] > 0.0f);
291 r_uv[0] = dir[2] /
fabsf(dir[0]) * (is_pos ? 1 : -1);
292 r_uv[1] = dir[1] /
fabsf(dir[0]) * -1;
295 bool is_pos = (dir[1] > 0.0f);
297 r_uv[0] = dir[0] /
fabsf(dir[1]) * 1;
298 r_uv[1] = dir[2] /
fabsf(dir[1]) * (is_pos ? -1 : 1);
301 bool is_pos = (dir[2] > 0.0f);
303 r_uv[0] = dir[0] /
fabsf(dir[2]) * (is_pos ? -1 : 1);
304 r_uv[1] = dir[1] /
fabsf(dir[2]) * -1;
306 r_uv[0] = r_uv[0] * 0.5f + 0.5f;
307 r_uv[1] = r_uv[1] * 0.5f + 0.5f;
312 const float conversion_matrices[6][3][3] = {
313 {{0.0f, 0.0f, 1.0f}, {0.0f, -1.0f, 0.0f}, {1.0f, 0.0f, 0.0f}},
314 {{0.0f, 0.0f, -1.0f}, {0.0f, -1.0f, 0.0f}, {-1.0f, 0.0f, 0.0f}},
315 {{1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, -1.0f}, {0.0f, 1.0f, 0.0f}},
316 {{1.0f, 0.0f, 0.0f}, {0.0f, 0.0f, 1.0f}, {0.0f, -1.0f, 0.0f}},
317 {{1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, {0.0f, 0.0f, -1.0f}},
318 {{-1.0f, 0.0f, 0.0f}, {0.0f, -1.0f, 0.0f}, {0.0f, 0.0f, 1.0f}},
322 mul_m3_v3(conversion_matrices[face], r_dir);
353 float *new_rect =
MEM_callocN(
sizeof(
float[4]) * ibuf->
x * ibuf->
y, __func__);
372 const char *pass_name,
375 const char *
UNUSED(chan_id),
376 const char *
UNUSED(view_name))
401 const bool failed = (ibuf ==
NULL);
450 if (diffuse_ibuf ==
NULL) {
453 const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
454 const float magenta[4] = {1.0f, 0.0f, 1.0f, 1.0f};
456 NULL, (failed || (specular_ibuf ==
NULL)) ? magenta : black, 1, 1, 4);
462 if (specular_ibuf !=
NULL) {
468 if (specular_ibuf !=
NULL) {
496 float *gpu_matcap_3components =
MEM_callocN(
sizeof(
float[3]) * ibuf->
x * ibuf->
y, __func__);
499 float(*offset3)[3] = (
float(*)[3])gpu_matcap_3components;
500 for (
int i = 0; i < ibuf->
x * ibuf->
y; i++, offset4++, offset3++) {
566 direction[index_x] = xsign * (
x - 0.5f);
567 direction[index_y] = ysign * (
y - 0.5f);
568 direction[index_z] = zsign * 0.5f;
616 "/tmp/studiolight_radiance_left.png",
619 "/tmp/studiolight_radiance_right.png",
622 "/tmp/studiolight_radiance_front.png",
625 "/tmp/studiolight_radiance_back.png",
628 "/tmp/studiolight_radiance_bottom.png",
631 "/tmp/studiolight_radiance_top.png",
650 float v1x = (
x - halfpix) * 2.0f - 1.0f;
651 float v1y = (
y - halfpix) * 2.0f - 1.0f;
652 float v2x = (
x + halfpix) * 2.0f - 1.0f;
653 float v2y = (
y + halfpix) * 2.0f - 1.0f;
660 float normal[3],
float *weight,
int face,
float x,
float y)
669 float weight_accum = 0.0f;
672 for (
int face = 0; face < 6; face++) {
678 float color[3], cubevec[3], weight;
681 weight_accum += weight;
686 #if STUDIOLIGHT_SH_BANDS > 1
687 const float nx = cubevec[0];
688 const float ny = cubevec[1];
689 const float nz = cubevec[2];
694 #if STUDIOLIGHT_SH_BANDS > 2
695 const float nx2 = SQUARE(nx);
696 const float ny2 = SQUARE(
ny);
697 const float nz2 = SQUARE(nz);
705 #if STUDIOLIGHT_SH_BANDS > 4
706 const float nx4 = SQUARE(nx2);
707 const float ny4 = SQUARE(ny2);
708 const float nz4 = SQUARE(nz2);
747 for (
int m = -1; m <= level; m++) {
753 float squared_lamplacian = 0.0f;
755 squared_lamplacian += table_l[level] * table_b[level];
758 const float target_squared_laplacian = max_laplacian * max_laplacian;
759 if (squared_lamplacian <= target_squared_laplacian) {
763 const int no_iterations = 10000000;
764 for (
int i = 0; i < no_iterations; i++) {
769 f += table_l[level] * table_b[level] /
square_f(1.0f + lambda * table_l[level]);
770 fd += (2.0f *
square_f(table_l[level]) * table_b[level]) /
771 cube_f(1.0f + lambda * table_l[level]);
774 f = target_squared_laplacian - f;
776 float delta = -f / fd;
779 if (
fabsf(delta) < 1e-6f) {
789 if (max_laplacian <= 0.0f) {
809 const int level_sq =
square_i(level);
810 const int level_1_sq =
square_i(level + 1.0f);
811 s[0] = 1.0f / (1.0f + lambda_r * level_sq * level_1_sq);
812 s[1] = 1.0f / (1.0f + lambda_g * level_sq * level_1_sq);
813 s[2] = 1.0f / (1.0f + lambda_b * level_sq * level_1_sq);
815 for (
int m = -1; m <= level; m++) {
822 const float normal[3],
float sh0,
float sh1,
float sh2,
float sh3)
829 float R1[3] = {-sh3, sh2, -sh1};
835 float p = 1.0f + 2.0f * lenR1 / R0;
836 float a = (1.0f - lenR1 / R0) / (1.0f + lenR1 / R0);
838 return R0 * (
a + (1.0f -
a) * (p + 1.0f) *
powf(q, p));
845 #if STUDIOLIGHT_SH_BANDS == 2
847 for (
int i = 0; i < 3; i++) {
854 # if STUDIOLIGHT_SH_BANDS > 1
855 const float nx =
normal[0];
857 const float nz =
normal[2];
862 # if STUDIOLIGHT_SH_BANDS > 2
863 const float nx2 = SQUARE(nx);
864 const float ny2 = SQUARE(
ny);
865 const float nz2 = SQUARE(nz);
873 # if STUDIOLIGHT_SH_BANDS > 4
874 const float nx4 = SQUARE(nx2);
875 const float ny4 = SQUARE(ny2);
876 const float nz4 = SQUARE(nz2);
881 -1.7701307697799304f * nz *
ny * (3.0f * nx2 - nz2));
884 0.9461746957575601f * nz * nx * (-1.0f + 7.0f * ny2));
887 -0.6690465435572892f * nz *
ny * (-3.0f + 7.0f * ny2));
890 (105.0f * ny4 - 90.0f * ny2 + 9.0f) / 28.359261614f);
893 -0.6690465435572892f * nx *
ny * (-3.0f + 7.0f * ny2));
896 0.9461746957575601f * (nx2 - nz2) * (-1.0f + 7.0f * ny2));
899 -1.7701307697799304f * nx *
ny * (nx2 - 3.0f * nz2));
902 0.6258357354491761f * (nx4 - 6.0f * nz2 * nx2 + nz4));
910 static const float sl_sh_band_factors[5] = {
918 int index = 0, dst_idx = 0;
921 for (
int m = 0; m < last_band; m++) {
961 if (radiance_buffer ==
NULL) {
965 float accum[3] = {0.0f, 0.0f, 0.0f};
966 float accum_weight = 0.00001f;
973 direction[zoffset] = zsign * 0.5f;
974 direction[xoffset] =
x - 0.5f;
975 direction[yoffset] =
y - 0.5f;
980 accum_weight += weight;
991 float fresnel = exp2(-8.35f * NV) * (1.0f -
roughness);
992 return spec_color * (1.0f - fresnel) + fresnel;
998 float w_1 =
w + 1.0f;
999 return max_ff((
NL +
w) / (w_1 * w_1), 0.0f);
1018 gloss *= 1.0f -
wrap;
1019 float shininess = exp2(10.0f * gloss + 1.0f);
1023 float normalization_factor = shininess * 0.125f + 1.0f;
1024 float spec_light =
powf(spec_angle, shininess) *
max_ff(
NL, 0.0f) * normalization_factor;
1032 return spec_light * (1.0 - w2) + spec_env * w2;
1042 float diff_light[3], spec_light[3];
1071 #ifdef STUDIOLIGHT_LOAD_CACHED_FILES
1090 #ifdef STUDIOLIGHT_LOAD_CACHED_FILES
1166 const char *subfolder,
1174 for (i = 0; i < dirs_num; i++) {
1175 if (dirs[i].
type & S_IFREG) {
1201 if (flagorder1 < flagorder2) {
1204 if (flagorder1 > flagorder2) {
1219 const float co[2] = {u - 0.5f,
v - 0.5f};
1221 float alpha = 1.0f + (inner_edge - dist) / (outer_edge - inner_edge);
1227 #define STUDIOLIGHT_DIAMETER 0.95f
1229 #define RESCALE_COORD(x) (x / STUDIOLIGHT_DIAMETER - (1.0f - STUDIOLIGHT_DIAMETER) / 2.0f)
1234 normal[0] = u * 2.0f - 1.0f;
1249 if (alphamask != 0) {
1251 const float incoming[3] = {0.0f, 0.0f, -1.0f};
1255 SWAP(
float, direction[1], direction[2]);
1256 direction[1] = -direction[1];
1287 float u = dx * diffuse_buffer->
x - 1.0f;
1288 float v = dy * diffuse_buffer->
y - 1.0f;
1291 if (specular_buffer) {
1314 if (alphamask != 0) {
1340 lights[0].
smooth = 0.526620f;
1341 lights[0].
col[0] = 0.033103f;
1342 lights[0].
col[1] = 0.033103f;
1343 lights[0].
col[2] = 0.033103f;
1344 lights[0].
spec[0] = 0.266761f;
1345 lights[0].
spec[1] = 0.266761f;
1346 lights[0].
spec[2] = 0.266761f;
1347 lights[0].
vec[0] = -0.352546f;
1348 lights[0].
vec[1] = 0.170931f;
1349 lights[0].
vec[2] = -0.920051f;
1352 lights[1].
smooth = 0.000000f;
1353 lights[1].
col[0] = 0.521083f;
1354 lights[1].
col[1] = 0.538226f;
1355 lights[1].
col[2] = 0.538226f;
1356 lights[1].
spec[0] = 0.599030f;
1357 lights[1].
spec[1] = 0.599030f;
1358 lights[1].
spec[2] = 0.599030f;
1359 lights[1].
vec[0] = -0.408163f;
1360 lights[1].
vec[1] = 0.346939f;
1361 lights[1].
vec[2] = 0.844415f;
1364 lights[2].
smooth = 0.478261f;
1365 lights[2].
col[0] = 0.038403f;
1366 lights[2].
col[1] = 0.034357f;
1367 lights[2].
col[2] = 0.049530f;
1368 lights[2].
spec[0] = 0.106102f;
1369 lights[2].
spec[1] = 0.125981f;
1370 lights[2].
spec[2] = 0.158523f;
1371 lights[2].
vec[0] = 0.521739f;
1372 lights[2].
vec[1] = 0.826087f;
1373 lights[2].
vec[2] = 0.212999f;
1376 lights[3].
smooth = 0.200000f;
1377 lights[3].
col[0] = 0.090838f;
1378 lights[3].
col[1] = 0.082080f;
1379 lights[3].
col[2] = 0.072255f;
1380 lights[3].
spec[0] = 0.106535f;
1381 lights[3].
spec[1] = 0.084771f;
1382 lights[3].
spec[2] = 0.066080f;
1383 lights[3].
vec[0] = 0.624519f;
1384 lights[3].
vec[1] = -0.562067f;
1385 lights[3].
vec[2] = -0.542269f;
1439 const char *default_name =
"";
1496 switch (icon_id_type) {
1519 if ((sl->
flag & flag) == flag) {
1573 const float light_ambient[3])
1584 memcpy(sl->
light, light,
sizeof(*light) * 4);
1585 memcpy(sl->
light_ambient, light_ambient,
sizeof(*light_ambient) * 3);
1598 memcpy(sl.
light,
U.light_param,
sizeof(*sl.
light) * 4);
typedef float(TangentPoint)[2]
bool BKE_appdir_app_is_portable_install(void)
const char * BKE_appdir_folder_id(int folder_id, const char *subfolder)
@ BLENDER_SYSTEM_DATAFILES
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(const DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL()
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
unsigned int BLI_filelist_dir_contents(const char *dir, struct direntry **r_filelist)
void BLI_file_free_lines(struct LinkNode *lines)
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
struct LinkNode * BLI_file_read_as_lines(const char *file) 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, 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, 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 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 type
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_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_allocFromBufferOwn(unsigned int *rect, float *rectf, unsigned int w, unsigned int h, unsigned int channels)
struct ImBuf * IMB_loadiffname(const char *filepath, int flags, char colorspace[IM_MAX_SPACE])
void nearest_interpolation_color(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
void nearest_interpolation_color_wrap(const struct ImBuf *in, unsigned char outI[4], float outF[4], float u, float v)
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[]
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))
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a color
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img GPU_RGBA16F
void IMB_freeImBuf(ImBuf *UNUSED(ibuf))
IconTextureDrawCall normal
ccl_gpu_kernel_postfix ccl_global float int int int int sh
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)
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
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 struct PartialUpdateUser * wrap(PartialUpdateUserImpl *user)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal)
static const pxr::TfToken specular("specular", pxr::TfToken::Immortal)
static const pxr::TfToken diffuse_color("diffuseColor", pxr::TfToken::Immortal)
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)
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)
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[3])
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)