Blender  V2.93
Classes | Macros | Typedefs | Functions | Variables
studiolight.c File Reference
#include "BKE_studiolight.h"
#include "BKE_appdir.h"
#include "BKE_icons.h"
#include "BLI_dynstr.h"
#include "BLI_fileops.h"
#include "BLI_fileops_types.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_math_color.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
#include "DNA_listBase.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "GPU_texture.h"
#include "MEM_guardedalloc.h"
#include "intern/openexr/openexr_multi.h"

Go to the source code of this file.

Classes

struct  MultilayerConvertContext
 

Macros

#define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE   96
 
#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT   32
 
#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH   (STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 2)
 
#define STUDIOLIGHT_PASSNAME_DIFFUSE   "diffuse"
 
#define STUDIOLIGHT_PASSNAME_SPECULAR   "specular"
 
#define STUDIOLIGHT_SH_WINDOWING   0.0f /* 0.0 is disabled */
 
#define STUDIOLIGHT_LOAD_CACHED_FILES
 
#define ITER_PIXELS(type, src, channels, width, height)
 
#define ITER_PIXELS_END
 
#define IMB_SAFE_FREE(p)
 
#define GPU_TEXTURE_SAFE_FREE(p)
 
#define STUDIOLIGHT_DELETE_ICON(s)
 
#define STUDIOLIGHT_FILE_VERSION   1
 
#define READ_VAL(type, parser, id, val, lines)
 
#define READ_FVAL(id, val, lines)   READ_VAL(float, atof, id, val, lines)
 
#define READ_IVAL(id, val, lines)   READ_VAL(int, atoi, id, val, lines)
 
#define READ_VEC3(id, val, lines)
 
#define READ_SOLIDLIGHT(sl, i, lines)
 
#define WRITE_FVAL(str, id, val)   (BLI_dynstr_appendf(str, id " %f\n", val))
 
#define WRITE_IVAL(str, id, val)   (BLI_dynstr_appendf(str, id " %d\n", val))
 
#define WRITE_VEC3(str, id, val)
 
#define WRITE_SOLIDLIGHT(str, sl, i)
 
#define STUDIOLIGHT_DIAMETER   0.95f
 
#define RESCALE_COORD(x)   (x / STUDIOLIGHT_DIAMETER - (1.0f - STUDIOLIGHT_DIAMETER) / 2.0f)
 

Typedefs

typedef struct MultilayerConvertContext MultilayerConvertContext
 

Functions

static void studiolight_free (struct StudioLight *sl)
 
static struct StudioLightstudiolight_create (int flag)
 
static void studiolight_load_solid_light (StudioLight *sl)
 
static void studiolight_write_solid_light (StudioLight *sl)
 
static void direction_to_equirect (float r[2], const float dir[3])
 
static void equirect_to_direction (float r[3], float u, float v)
 
static void UNUSED_FUNCTION() direction_to_cube_face_uv (float r_uv[2], int *r_face, const float dir[3])
 
static void cube_face_uv_to_direction (float r_dir[3], float x, float y, int face)
 
static void * studiolight_multilayer_addview (void *UNUSED(base), const char *UNUSED(view_name))
 
static void * studiolight_multilayer_addlayer (void *base, const char *UNUSED(layer_name))
 
static floatstudiolight_multilayer_convert_pass (ImBuf *ibuf, float *rect, const unsigned int channels)
 
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 void studiolight_load_equirect_image (StudioLight *sl)
 
static void studiolight_create_equirect_radiance_gputexture (StudioLight *sl)
 
static void studiolight_create_matcap_gputexture (StudioLightImage *sli)
 
static void studiolight_create_matcap_diffuse_gputexture (StudioLight *sl)
 
static void studiolight_create_matcap_specular_gputexture (StudioLight *sl)
 
static void studiolight_create_equirect_irradiance_gputexture (StudioLight *sl)
 
static void studiolight_calculate_radiance (ImBuf *ibuf, float color[4], const float direction[3])
 
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 studiolight_calculate_radiance_cubemap_buffers (StudioLight *sl)
 
BLI_INLINE float area_element (float x, float y)
 
BLI_INLINE float texel_solid_angle (float x, float y, float halfpix)
 
static void studiolight_calculate_cubemap_vector_weight (float normal[3], float *weight, int face, float x, float y)
 
static void studiolight_spherical_harmonics_calculate_coefficients (StudioLight *sl, float(*sh)[3])
 
static float studiolight_spherical_harmonics_lambda_get (float *sh, float max_laplacian)
 
static void studiolight_spherical_harmonics_apply_windowing (float(*sh)[3], float max_laplacian)
 
static float studiolight_spherical_harmonics_geomerics_eval (const float normal[3], float sh0, float sh1, float sh2, float sh3)
 
BLI_INLINE void studiolight_spherical_harmonics_eval (StudioLight *sl, float color[3], const float normal[3])
 
static void studiolight_spherical_harmonics_apply_band_factors (StudioLight *sl, float(*sh)[3])
 
static void studiolight_calculate_diffuse_light (StudioLight *sl)
 
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)
 
static float brdf_approx (float spec_color, float roughness, float NV)
 
static float wrapped_lighting (float NL, float w)
 
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)
 
static void studiolight_lights_eval (StudioLight *sl, float color[3], const float normal[3])
 
static bool studiolight_load_irradiance_equirect_image (StudioLight *sl)
 
static bool studiolight_load_spherical_harmonics_coefficients (StudioLight *sl)
 
static void studiolight_calculate_irradiance_equirect_image (StudioLight *sl)
 
static StudioLightstudiolight_add_file (const char *path, int flag)
 
static void studiolight_add_files_from_datafolder (const int folder_id, const char *subfolder, int flag)
 
static int studiolight_flag_cmp_order (const StudioLight *sl)
 
static int studiolight_cmp (const void *a, const void *b)
 
static uint alpha_circle_mask (float u, float v, float inner_edge, float outer_edge)
 
static void sphere_normal_from_uv (float normal[3], float u, float v)
 
static void studiolight_radiance_preview (uint *icon_buffer, StudioLight *sl)
 
static void studiolight_matcap_preview (uint *icon_buffer, StudioLight *sl, bool flipped)
 
static void studiolight_irradiance_preview (uint *icon_buffer, StudioLight *sl)
 
void BKE_studiolight_default (SolidLight lights[4], float light_ambient[4])
 
void BKE_studiolight_init (void)
 
void BKE_studiolight_free (void)
 
struct StudioLightBKE_studiolight_find_default (int flag)
 
struct StudioLightBKE_studiolight_find (const char *name, int flag)
 
struct StudioLightBKE_studiolight_findindex (int index, int flag)
 
struct ListBaseBKE_studiolight_listbase (void)
 
void BKE_studiolight_preview (uint *icon_buffer, StudioLight *sl, int icon_id_type)
 
void BKE_studiolight_ensure_flag (StudioLight *sl, int flag)
 
void BKE_studiolight_remove (StudioLight *sl)
 
StudioLightBKE_studiolight_load (const char *path, int type)
 
StudioLightBKE_studiolight_create (const char *path, const SolidLight light[4], const float light_ambient[3])
 
StudioLightBKE_studiolight_studio_edit_get (void)
 
void BKE_studiolight_refresh (void)
 
void BKE_studiolight_set_free_function (StudioLight *sl, StudioLightFreeFunction *free_function, void *data)
 
void BKE_studiolight_unset_icon_id (StudioLight *sl, int icon_id)
 

Variables

static ListBase studiolights
 
static int last_studiolight_id = 0
 
static const char * STUDIOLIGHT_LIGHTS_FOLDER = "studiolights/studio/"
 
static const char * STUDIOLIGHT_WORLD_FOLDER = "studiolights/world/"
 
static const char * STUDIOLIGHT_MATCAP_FOLDER = "studiolights/matcap/"
 
static const char * STUDIOLIGHT_WORLD_DEFAULT = "forest.exr"
 
static const char * STUDIOLIGHT_MATCAP_DEFAULT = "basic_1.exr"
 

Macro Definition Documentation

◆ GPU_TEXTURE_SAFE_FREE

#define GPU_TEXTURE_SAFE_FREE (   p)
Value:
do { \
if (p) { \
GPU_texture_free(p); \
p = NULL; \
} \
} while (0)

Definition at line 115 of file studiolight.c.

◆ IMB_SAFE_FREE

#define IMB_SAFE_FREE (   p)
Value:
do { \
if (p) { \
IMB_freeImBuf(p); \
p = NULL; \
} \
} while (0)

Definition at line 107 of file studiolight.c.

◆ ITER_PIXELS

#define ITER_PIXELS (   type,
  src,
  channels,
  width,
  height 
)
Value:
{ \
float texel_size[2]; \
texel_size[0] = 1.0f / width; \
texel_size[1] = 1.0f / height; \
type(*pixel_)[channels] = (type(*)[channels])src; \
for (float y = 0.5 * texel_size[1]; y < 1.0; y += texel_size[1]) { \
for (float x = 0.5 * texel_size[0]; x < 1.0; x += texel_size[0], pixel_++) { \
type *pixel = *pixel_;
_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 width
_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 height
_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
float texel_size[2]
Definition: eevee_effects.c:42

Iter on all pixel giving texel center position and pixel pointer.

Arguments type : type of src. src : source buffer. channels : number of channels per pixel.

Others x, y : normalized UV coordinate [0..1] of the current pixel center. texel_size[2] : UV size of a pixel in this texture. pixel[] : pointer to the current pixel.

Definition at line 90 of file studiolight.c.

◆ ITER_PIXELS_END

#define ITER_PIXELS_END
Value:
} \
} \
} \
((void)0)

Definition at line 100 of file studiolight.c.

◆ READ_FVAL

#define READ_FVAL (   id,
  val,
  lines 
)    READ_VAL(float, atof, id, val, lines)

Definition at line 200 of file studiolight.c.

◆ READ_IVAL

#define READ_IVAL (   id,
  val,
  lines 
)    READ_VAL(int, atoi, id, val, lines)

Definition at line 201 of file studiolight.c.

◆ READ_SOLIDLIGHT

#define READ_SOLIDLIGHT (   sl,
  i,
  lines 
)
Value:
do { \
READ_IVAL("light[" STRINGIFY(i) "].flag", sl[i].flag, lines); \
READ_FVAL("light[" STRINGIFY(i) "].smooth", sl[i].smooth, lines); \
READ_VEC3("light[" STRINGIFY(i) "].col", sl[i].col, lines); \
READ_VEC3("light[" STRINGIFY(i) "].spec", sl[i].spec, lines); \
READ_VEC3("light[" STRINGIFY(i) "].vec", sl[i].vec, lines); \
} while (0)
#define STRINGIFY(x)
uint col

Definition at line 210 of file studiolight.c.

◆ READ_VAL

#define READ_VAL (   type,
  parser,
  id,
  val,
  lines 
)
Value:
do { \
for (LinkNode *line = lines; line; line = line->next) { \
char *val_str, *str = line->link; \
if ((val_str = strstr(str, id " "))) { \
val_str += sizeof(id); /* Skip id + spacer. */ \
val = parser(val_str); \
} \
} \
} while (0)
#define str(s)
struct LinkNode * next
Definition: BLI_linklist.h:39

Definition at line 189 of file studiolight.c.

◆ READ_VEC3

#define READ_VEC3 (   id,
  val,
  lines 
)
Value:
do { \
READ_FVAL(id ".x", val[0], lines); \
READ_FVAL(id ".y", val[1], lines); \
READ_FVAL(id ".z", val[2], lines); \
} while (0)

Definition at line 203 of file studiolight.c.

◆ RESCALE_COORD

#define RESCALE_COORD (   x)    (x / STUDIOLIGHT_DIAMETER - (1.0f - STUDIOLIGHT_DIAMETER) / 2.0f)

Definition at line 1249 of file studiolight.c.

◆ STUDIOLIGHT_DELETE_ICON

#define STUDIOLIGHT_DELETE_ICON (   s)
Value:
do { \
if (s != 0) { \
BKE_icon_delete(s); \
s = 0; \
} \
} while (0)

◆ STUDIOLIGHT_DIAMETER

#define STUDIOLIGHT_DIAMETER   0.95f

Definition at line 1247 of file studiolight.c.

◆ STUDIOLIGHT_FILE_VERSION

#define STUDIOLIGHT_FILE_VERSION   1

Definition at line 187 of file studiolight.c.

◆ STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT

#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT   32

Definition at line 55 of file studiolight.c.

◆ STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH

#define STUDIOLIGHT_IRRADIANCE_EQUIRECT_WIDTH   (STUDIOLIGHT_IRRADIANCE_EQUIRECT_HEIGHT * 2)

Definition at line 56 of file studiolight.c.

◆ STUDIOLIGHT_LOAD_CACHED_FILES

#define STUDIOLIGHT_LOAD_CACHED_FILES

Definition at line 66 of file studiolight.c.

◆ STUDIOLIGHT_PASSNAME_DIFFUSE

#define STUDIOLIGHT_PASSNAME_DIFFUSE   "diffuse"

Definition at line 57 of file studiolight.c.

◆ STUDIOLIGHT_PASSNAME_SPECULAR

#define STUDIOLIGHT_PASSNAME_SPECULAR   "specular"

Definition at line 58 of file studiolight.c.

◆ STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE

#define STUDIOLIGHT_RADIANCE_CUBEMAP_SIZE   96

Definition at line 54 of file studiolight.c.

◆ STUDIOLIGHT_SH_WINDOWING

#define STUDIOLIGHT_SH_WINDOWING   0.0f /* 0.0 is disabled */

Definition at line 60 of file studiolight.c.

◆ WRITE_FVAL

#define WRITE_FVAL (   str,
  id,
  val 
)    (BLI_dynstr_appendf(str, id " %f\n", val))

Definition at line 237 of file studiolight.c.

◆ WRITE_IVAL

#define WRITE_IVAL (   str,
  id,
  val 
)    (BLI_dynstr_appendf(str, id " %d\n", val))

Definition at line 238 of file studiolight.c.

◆ WRITE_SOLIDLIGHT

#define WRITE_SOLIDLIGHT (   str,
  sl,
 
)
Value:
do { \
WRITE_IVAL(str, "light[" STRINGIFY(i) "].flag", sl[i].flag); \
WRITE_FVAL(str, "light[" STRINGIFY(i) "].smooth", sl[i].smooth); \
WRITE_VEC3(str, "light[" STRINGIFY(i) "].col", sl[i].col); \
WRITE_VEC3(str, "light[" STRINGIFY(i) "].spec", sl[i].spec); \
WRITE_VEC3(str, "light[" STRINGIFY(i) "].vec", sl[i].vec); \
} while (0)

Definition at line 247 of file studiolight.c.

◆ WRITE_VEC3

#define WRITE_VEC3 (   str,
  id,
  val 
)
Value:
do { \
WRITE_FVAL(str, id ".x", val[0]); \
WRITE_FVAL(str, id ".y", val[1]); \
WRITE_FVAL(str, id ".z", val[2]); \
} while (0)

Definition at line 240 of file studiolight.c.

Typedef Documentation

◆ MultilayerConvertContext

Function Documentation

◆ alpha_circle_mask()

static uint alpha_circle_mask ( float  u,
float  v,
float  inner_edge,
float  outer_edge 
)
static

◆ area_element()

BLI_INLINE float area_element ( float  x,
float  y 
)

Definition at line 662 of file studiolight.c.

References KDL::atan2(), sqrtf, x, and y.

Referenced by texel_solid_angle().

◆ BKE_studiolight_create()

StudioLight* BKE_studiolight_create ( const char *  path,
const SolidLight  light[4],
const float  light_ambient[3] 
)

◆ BKE_studiolight_default()

void BKE_studiolight_default ( SolidLight  lights[4],
float  light_ambient[4] 
)

◆ BKE_studiolight_ensure_flag()

void BKE_studiolight_ensure_flag ( StudioLight sl,
int  flag 
)

◆ BKE_studiolight_find()

struct StudioLight* BKE_studiolight_find ( const char *  name,
int  flag 
)

◆ BKE_studiolight_find_default()

struct StudioLight* BKE_studiolight_find_default ( int  flag)

◆ BKE_studiolight_findindex()

struct StudioLight* BKE_studiolight_findindex ( int  index,
int  flag 
)

◆ BKE_studiolight_free()

void BKE_studiolight_free ( void  )

Definition at line 1450 of file studiolight.c.

References BLI_pophead(), studiolight_free(), and studiolights.

Referenced by BKE_blender_free(), and BKE_studiolight_refresh().

◆ BKE_studiolight_init()

void BKE_studiolight_init ( void  )

◆ BKE_studiolight_listbase()

struct ListBase* BKE_studiolight_listbase ( void  )

Definition at line 1510 of file studiolight.c.

References studiolights.

◆ BKE_studiolight_load()

StudioLight* BKE_studiolight_load ( const char *  path,
int  type 
)

Definition at line 1586 of file studiolight.c.

References studiolight_add_file(), STUDIOLIGHT_USER_DEFINED, and type.

◆ BKE_studiolight_preview()

void BKE_studiolight_preview ( uint icon_buffer,
StudioLight sl,
int  icon_id_type 
)

◆ BKE_studiolight_refresh()

void BKE_studiolight_refresh ( void  )

Definition at line 1626 of file studiolight.c.

References BKE_studiolight_free(), and BKE_studiolight_init().

◆ BKE_studiolight_remove()

void BKE_studiolight_remove ( StudioLight sl)

◆ BKE_studiolight_set_free_function()

void BKE_studiolight_set_free_function ( StudioLight sl,
StudioLightFreeFunction free_function,
void *  data 
)

◆ BKE_studiolight_studio_edit_get()

StudioLight* BKE_studiolight_studio_edit_get ( void  )

◆ BKE_studiolight_unset_icon_id()

void BKE_studiolight_unset_icon_id ( StudioLight sl,
int  icon_id 
)

◆ blinn_specular()

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 
)
static

◆ brdf_approx()

static float brdf_approx ( float  spec_color,
float  roughness,
float  NV 
)
static

Definition at line 1006 of file studiolight.c.

References usdtokens::roughness().

Referenced by studiolight_lights_eval().

◆ cube_face_uv_to_direction()

static void cube_face_uv_to_direction ( float  r_dir[3],
float  x,
float  y,
int  face 
)
static

Definition at line 327 of file studiolight.c.

References copy_v3_fl3(), mul_m3_v3(), normalize_v3(), x, and y.

Referenced by studiolight_calculate_cubemap_vector_weight().

◆ direction_to_cube_face_uv()

static void UNUSED_FUNCTION() direction_to_cube_face_uv ( float  r_uv[2],
int *  r_face,
const float  dir[3] 
)
static

◆ direction_to_equirect()

static void direction_to_equirect ( float  r[2],
const float  dir[3] 
)
static

Definition at line 285 of file studiolight.c.

References acosf, atan2f, M_PI, and r.

Referenced by studiolight_calculate_radiance().

◆ equirect_to_direction()

static void equirect_to_direction ( float  r[3],
float  u,
float  v 
)
static

Definition at line 291 of file studiolight.c.

References cosf, M_PI, r, sinf, and v.

Referenced by studiolight_calculate_irradiance_equirect_image().

◆ sphere_normal_from_uv()

static void sphere_normal_from_uv ( float  normal[3],
float  u,
float  v 
)
static

Definition at line 1252 of file studiolight.c.

References len_v2(), normal, sqrtf, square_f(), and v.

Referenced by studiolight_irradiance_preview(), and studiolight_radiance_preview().

◆ studiolight_add_file()

static StudioLight* studiolight_add_file ( const char *  path,
int  flag 
)
static

◆ studiolight_add_files_from_datafolder()

static void studiolight_add_files_from_datafolder ( const int  folder_id,
const char *  subfolder,
int  flag 
)
static

◆ studiolight_calculate_cubemap_vector_weight()

static void studiolight_calculate_cubemap_vector_weight ( float  normal[3],
float weight,
int  face,
float  x,
float  y 
)
static

◆ studiolight_calculate_diffuse_light()

static void studiolight_calculate_diffuse_light ( StudioLight sl)
static

◆ studiolight_calculate_irradiance_equirect_image()

static void studiolight_calculate_irradiance_equirect_image ( StudioLight sl)
static

◆ studiolight_calculate_radiance()

static void studiolight_calculate_radiance ( ImBuf ibuf,
float  color[4],
const float  direction[3] 
)
static

◆ studiolight_calculate_radiance_buffer()

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

◆ studiolight_calculate_radiance_cubemap_buffers()

static void studiolight_calculate_radiance_cubemap_buffers ( StudioLight sl)
static

◆ studiolight_cmp()

static int studiolight_cmp ( const void *  a,
const void *  b 
)
static

◆ studiolight_create()

static struct StudioLight* studiolight_create ( int  flag)
static

◆ studiolight_create_equirect_irradiance_gputexture()

static void studiolight_create_equirect_irradiance_gputexture ( StudioLight sl)
static

◆ studiolight_create_equirect_radiance_gputexture()

static void studiolight_create_equirect_radiance_gputexture ( StudioLight sl)
static

◆ studiolight_create_matcap_diffuse_gputexture()

static void studiolight_create_matcap_diffuse_gputexture ( StudioLight sl)
static

◆ studiolight_create_matcap_gputexture()

static void studiolight_create_matcap_gputexture ( StudioLightImage sli)
static

◆ studiolight_create_matcap_specular_gputexture()

static void studiolight_create_matcap_specular_gputexture ( StudioLight sl)
static

◆ studiolight_evaluate_specular_radiance_buffer()

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 
)

◆ studiolight_flag_cmp_order()

static int studiolight_flag_cmp_order ( const StudioLight sl)
static

Definition at line 1204 of file studiolight.c.

References StudioLight::flag, and STUDIOLIGHT_EXTERNAL_FILE.

Referenced by studiolight_cmp().

◆ studiolight_free()

static void studiolight_free ( struct StudioLight sl)
static

◆ studiolight_irradiance_preview()

static void studiolight_irradiance_preview ( uint icon_buffer,
StudioLight sl 
)
static

◆ studiolight_lights_eval()

static void studiolight_lights_eval ( StudioLight sl,
float  color[3],
const float  normal[3] 
)
static

◆ studiolight_load_equirect_image()

static void studiolight_load_equirect_image ( StudioLight sl)
static

◆ studiolight_load_irradiance_equirect_image()

static bool studiolight_load_irradiance_equirect_image ( StudioLight sl)
static

◆ studiolight_load_solid_light()

static void studiolight_load_solid_light ( StudioLight sl)
static

◆ studiolight_load_spherical_harmonics_coefficients()

static bool studiolight_load_spherical_harmonics_coefficients ( StudioLight sl)
static

◆ studiolight_matcap_preview()

static void studiolight_matcap_preview ( uint icon_buffer,
StudioLight sl,
bool  flipped 
)
static

◆ studiolight_multilayer_addlayer()

static void* studiolight_multilayer_addlayer ( void *  base,
const char *  UNUSEDlayer_name 
)
static

Definition at line 354 of file studiolight.c.

Referenced by studiolight_load_equirect_image().

◆ studiolight_multilayer_addpass()

static void studiolight_multilayer_addpass ( void *  base,
void *  UNUSEDlay,
const char *  pass_name,
float rect,
int  num_channels,
const char *  UNUSEDchan_id,
const char *  UNUSEDview_name 
)
static

◆ studiolight_multilayer_addview()

static void* studiolight_multilayer_addview ( void *  UNUSEDbase,
const char *  UNUSEDview_name 
)
static

Definition at line 350 of file studiolight.c.

References NULL.

Referenced by studiolight_load_equirect_image().

◆ studiolight_multilayer_convert_pass()

static float* studiolight_multilayer_convert_pass ( ImBuf ibuf,
float rect,
const unsigned int  channels 
)
static

◆ studiolight_radiance_preview()

static void studiolight_radiance_preview ( uint icon_buffer,
StudioLight sl 
)
static

◆ studiolight_spherical_harmonics_apply_band_factors()

static void studiolight_spherical_harmonics_apply_band_factors ( StudioLight sl,
float(*)  sh[3] 
)
static

◆ studiolight_spherical_harmonics_apply_windowing()

static void studiolight_spherical_harmonics_apply_windowing ( float(*)  sh[3],
float  max_laplacian 
)
static

◆ studiolight_spherical_harmonics_calculate_coefficients()

static void studiolight_spherical_harmonics_calculate_coefficients ( StudioLight sl,
float(*)  sh[3] 
)
static

◆ studiolight_spherical_harmonics_eval()

BLI_INLINE void studiolight_spherical_harmonics_eval ( StudioLight sl,
float  color[3],
const float  normal[3] 
)

◆ studiolight_spherical_harmonics_geomerics_eval()

static float studiolight_spherical_harmonics_geomerics_eval ( const float  normal[3],
float  sh0,
float  sh1,
float  sh2,
float  sh3 
)
static

Definition at line 840 of file studiolight.c.

References Freestyle::a, dot_v3v3(), len_v3(), M_1_PI, mul_v3_fl(), normal, and powf.

Referenced by studiolight_spherical_harmonics_eval().

◆ studiolight_spherical_harmonics_lambda_get()

static float studiolight_spherical_harmonics_lambda_get ( float sh,
float  max_laplacian 
)
static

◆ studiolight_write_solid_light()

static void studiolight_write_solid_light ( StudioLight sl)
static

◆ texel_solid_angle()

BLI_INLINE float texel_solid_angle ( float  x,
float  y,
float  halfpix 
)

Definition at line 667 of file studiolight.c.

References area_element(), x, and y.

Referenced by studiolight_calculate_cubemap_vector_weight().

◆ wrapped_lighting()

static float wrapped_lighting ( float  NL,
float  w 
)
static

Definition at line 1015 of file studiolight.c.

References max_ff(), NL, and w().

Referenced by blinn_specular(), and studiolight_lights_eval().

Variable Documentation

◆ last_studiolight_id

int last_studiolight_id = 0
static

Definition at line 53 of file studiolight.c.

Referenced by studiolight_create().

◆ STUDIOLIGHT_LIGHTS_FOLDER

const char* STUDIOLIGHT_LIGHTS_FOLDER = "studiolights/studio/"
static

Definition at line 68 of file studiolight.c.

Referenced by BKE_studiolight_init().

◆ STUDIOLIGHT_MATCAP_DEFAULT

const char* STUDIOLIGHT_MATCAP_DEFAULT = "basic_1.exr"
static

Definition at line 73 of file studiolight.c.

Referenced by BKE_studiolight_find_default().

◆ STUDIOLIGHT_MATCAP_FOLDER

const char* STUDIOLIGHT_MATCAP_FOLDER = "studiolights/matcap/"
static

Definition at line 70 of file studiolight.c.

Referenced by BKE_studiolight_init().

◆ STUDIOLIGHT_WORLD_DEFAULT

const char* STUDIOLIGHT_WORLD_DEFAULT = "forest.exr"
static

Definition at line 72 of file studiolight.c.

Referenced by BKE_studiolight_find_default().

◆ STUDIOLIGHT_WORLD_FOLDER

const char* STUDIOLIGHT_WORLD_FOLDER = "studiolights/world/"
static

Definition at line 69 of file studiolight.c.

Referenced by BKE_studiolight_init().

◆ studiolights

ListBase studiolights
static