Blender V4.3
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
13#include "BLI_sys_types.h"
14
15#include "BLI_path_utils.hh"
16
17#include "DNA_userdef_types.h" /* for #SolidLight */
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
23struct ImBuf;
24
25#define STUDIOLIGHT_ICON_ID_TYPE_RADIANCE (1 << 0)
26#define STUDIOLIGHT_ICON_ID_TYPE_IRRADIANCE (1 << 1)
27#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP (1 << 2)
28#define STUDIOLIGHT_ICON_ID_TYPE_MATCAP_FLIPPED (1 << 3)
29
30#define STUDIOLIGHT_MAX_LIGHT 4
31
32#define STUDIOLIGHT_ICON_SIZE 96
33
34struct GPUTexture;
35struct StudioLight;
36
54
55#define STUDIOLIGHT_FLAG_ALL (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_EXTERNAL_FILE)
56#define STUDIOLIGHT_FLAG_ORIENTATIONS \
57 (STUDIOLIGHT_TYPE_STUDIO | STUDIOLIGHT_TYPE_WORLD | STUDIOLIGHT_TYPE_MATCAP)
58#define STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE (STUDIOLIGHT_TYPE_WORLD)
59#define STUDIOLIGHT_ORIENTATIONS_SOLID (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_TYPE_STUDIO)
60
61typedef void StudioLightFreeFunction(struct StudioLight *, void *data);
62
63typedef struct StudioLightImage {
64 struct ImBuf *ibuf;
65 struct GPUTexture *gputexture;
67
68typedef struct StudioLight {
70
71 int index;
72 int flag;
73 char name[FILE_MAXFILE];
82 struct GPUTexture *equirect_radiance_gputexture;
84 float light_ambient[3];
85
86 /*
87 * Free function to clean up the running icons previews (wmJob) the usage is in
88 * interface_icons. Please be aware that this was build to handle only one free function
89 * that cleans up all icons. just to keep the code simple.
90 */
94
95/* API */
96
97void BKE_studiolight_init(void);
98void BKE_studiolight_free(void);
99void BKE_studiolight_default(SolidLight lights[4], float light_ambient[3]);
100struct StudioLight *BKE_studiolight_find(const char *name, int flag);
101struct StudioLight *BKE_studiolight_findindex(int index, int flag);
103void BKE_studiolight_preview(uint *icon_buffer, StudioLight *sl, int icon_id_type);
109void BKE_studiolight_refresh(void);
110StudioLight *BKE_studiolight_load(const char *filepath, int type);
111StudioLight *BKE_studiolight_create(const char *filepath,
112 const SolidLight light[4],
113 const float light_ambient[3]);
120 StudioLightFreeFunction *free_function,
121 void *data);
122void BKE_studiolight_unset_icon_id(StudioLight *sl, int icon_id);
123
124#ifdef __cplusplus
125}
126#endif
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)
struct StudioLight StudioLight
void StudioLightFreeFunction(struct StudioLight *, void *data)
StudioLight * BKE_studiolight_load(const char *filepath, int type)
struct StudioLight * BKE_studiolight_findindex(int index, int flag)
struct StudioLightImage StudioLightImage
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
struct GPUTexture * gputexture
struct ImBuf * ibuf
StudioLightImage matcap_specular
struct StudioLight * prev
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
StudioLightImage matcap_diffuse
float light_ambient[3]
uint8_t flag
Definition wm_window.cc:138