Blender V4.5
BKE_studiolight.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2006-2007 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
12
13#include "BLI_sys_types.h"
14
15#include "BLI_path_utils.hh"
16
17#include "DNA_userdef_types.h" /* for #SolidLight */
18
19struct ImBuf;
20
21#define STUDIOLIGHT_ICON_ID_TYPE_RADIANCE (1 << 0)
22#define STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE (1 << 1)
23#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP (1 << 2)
24#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED (1 << 3)
25
26#define STUDIOLIGHT_MAX_LIGHT 4
27
28#define STUDIOLIGHT_ICON_SIZE 96
29
30struct GPUTexture;
31struct StudioLight;
32
50
51#define STUDIOLIGHT_FLAG_ALL (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_EXTERNAL_FILE)
52#define STUDIOLIGHT_FLAG_ORIENTATIONS \
53 (STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_TYPE_MATCAP)
54#define STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE (STUDIOLIGHT_TYPE_WORLD)
55#define STUDIOLIGHT_ORIENTATIONS_SOLID (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_TYPE_STUDIO)
56
57typedef void StudioLightFreeFunction(struct StudioLight *, void *data);
58
59typedef struct StudioLightImage {
60 struct ImBuf *ibuf;
61 struct GPUTexture *gputexture;
63
64typedef struct StudioLight {
66
67 int index;
68 int flag;
78 struct GPUTexture *equirect_radiance_gputexture;
80 float light_ambient[3];
81
82 /*
83 * Free function to clean up the running icons previews (wmJob) the usage is in
84 * interface_icons. Please be aware that this was build to handle only one free function
85 * that cleans up all icons. just to keep the code simple.
86 */
90
91/* API */
92
93void BKE_studiolight_init(void);
94void BKE_studiolight_free(void);
95void BKE_studiolight_default(SolidLight lights[4], float light_ambient[3]);
96struct StudioLight *BKE_studiolight_find(const char *name, int flag);
99void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type);
105void BKE_studiolight_refresh(void);
106StudioLight *BKE_studiolight_load(const char *filepath, int type);
107StudioLight *BKE_studiolight_create(const char *filepath,
108 const SolidLight light[4],
109 const float light_ambient[3]);
116 StudioLightFreeFunction *free_function,
117 void *data);
118void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id);
void BKE_studiolight_remove(StudioLight *sl)
StudioLightFlag
@ STUDIOLIGHT_EXTERNAL_IMAGE_LOADED
@ STUDIOLIGHT_EQUIRECT_RADIANCE_GPUTEXTURE
@ STUDIOLIGHT_MATCAP_SPECULAR_GPUTEXTURE
@ STUDIOLIGHT_USER_DEFINED
@ STUDIOLIGHT_INTERNAL
@ STUDIOLIGHT_MATCAP_DIFFUSE_GPUTEXTURE
@ STUDIOLIGHT_TYPE_MATCAP
@ STUDIOLIGHT_TYPE_WORLD
@ STUDIOLIGHT_SPECULAR_HIGHLIGHT_PASS
@ STUDIOLIGHT_TYPE_STUDIO
@ STUDIOLIGHT_EXTERNAL_FILE
struct StudioLight * BKE_studiolight_find(const char *name, int flag)
struct StudioLight * BKE_studiolight_find_default(int flag)
void StudioLightFreeFunction(struct StudioLight *, void *data)
StudioLight * BKE_studiolight_load(const char *filepath, int type)
struct StudioLight * BKE_studiolight_findindex(int index, int flag)
void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id)
void BKE_studiolight_set_free_function(StudioLight *sl, StudioLightFreeFunction *free_function, void *data)
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[3])
struct ListBase * BKE_studiolight_listbase(void)
void BKE_studiolight_init(void)
void BKE_studiolight_ensure_flag(StudioLight *sl, int flag)
StudioLight * BKE_studiolight_create(const char *filepath, const SolidLight light[4], const float light_ambient[3])
StudioLight * BKE_studiolight_studio_edit_get(void)
#define STUDIOLIGHT_MAX_LIGHT
void BKE_studiolight_free(void)
void BKE_studiolight_refresh(void)
void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type)
#define FILE_MAXFILE
#define FILE_MAX
unsigned int uint
BMesh const char void * data
struct GPUTexture * gputexture
struct ImBuf * ibuf
StudioLightImage matcap_specular
struct StudioLight * prev
SolidLight light[STUDIOLIGHT_MAX_LIGHT]
void * free_function_data
struct StudioLight * next
struct GPUTexture * equirect_radiance_gputexture
char filepath[FILE_MAX]
StudioLightFreeFunction * free_function
struct ImBuf * equirect_radiance_buffer
int icon_id_matcap_flipped
char name[FILE_MAXFILE]
StudioLightImage matcap_diffuse
float light_ambient[3]
uint8_t flag
Definition wm_window.cc:139