Blender V5.3
DNA_lightprobe_types.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#include "DNA_ID.h"
12
13#include "BLI_assert.hh"
14#include "BLI_enum_flags.hh"
15
16namespace blender {
17
18struct AnimData;
19struct Object;
20namespace gpu {
21class Texture;
22} // namespace gpu
23
25#define LIGHTCACHE_STATIC_VERSION 2
26
27/* Probe->type */
33
34/* Probe->flag */
45
46/* Probe->grid_flag */
53
54/* Probe->display */
61
62/* Probe->parallax && Probe->attenuation_type. */
67
68/* LightCache->type */
72
73/* LightCache->flag */
74enum eLightCache_Flag : int {
75 LIGHTCACHE_BAKED = (1 << 0),
79 /* Update tagging */
88};
90
91/* EEVEE_LightCacheTexture->data_type */
98
99
106
114
116#ifdef __cplusplus
118 static constexpr ID_Type id_type = ID_LP;
119#endif
120
123 struct AnimData *adt = nullptr;
124
136 char _pad0[3] = {};
137
139 float distinf = 2.5f;
141 float distpar = 2.5f;
143 float falloff = 0.2f;
144
145 float clipsta = 0.8f, clipend = 20.0f;
146
148 float vis_bias = 1.0f, vis_bleedbias = 0;
149 float vis_blur = 0.2f;
150
152 float intensity = 1.0f;
153
161 float grid_surface_bias = 0.05;
162 float grid_escape_bias = 0.1;
164 float grid_normal_bias = 0.3f;
165 float grid_view_bias = 0.0f;
166 float grid_facing_bias = 0.5f;
171
173 float grid_clamp_direct = 0.0f;
174 float grid_clamp_indirect = 10.0f;
175
178
180 struct Collection *visibility_grp = nullptr;
181
183 float data_display_size = 0.1f;
184 char _pad1[4] = {};
185};
186
187/* ------- Eevee LightProbes ------- */
188/* Needs to be there because written to file with the light-cache. */
189
190/* IMPORTANT Padding in these structs is essential. It must match
191 * GLSL struct definition in lightprobe_lib.glsl. */
192
193/* Must match CubeData. */
195 float position[3] = {}, parallax_type = 0;
198 float _pad3[2] = {};
199 float attenuationmat[4][4] = {};
200 float parallaxmat[4][4] = {};
201};
202
203/* Must match GridData. */
205 float mat[4][4] = {};
207 int resolution[3] = {}, offset = 0;
208 float corner[3] = {}, attenuation_scale = 0;
210 float increment_x[3] = {}, attenuation_bias = 0;
211 float increment_y[3] = {}, level_bias = 0;
212 float increment_z[3] = {}, _pad4 = 0;
214};
215
216/* These are used as UBO data. They need to be aligned to size of vec4. */
219
220/* ------ Eevee Lightcache ------- */
221
223 gpu::Texture *tex = nullptr;
225 char *data = nullptr;
226 int tex_size[3] = {};
228 char components = 0;
229 char _pad[2] = {};
230};
231
235 int version = 0;
238 /* only a single cache for now */
240 int cube_len = 0, grid_len = 0;
242 int mips_len = 0;
244 int vis_res = 0, ref_res = 0;
245 char _pad[4][2] = {};
246 /* In the future, we could create a bigger texture containing
247 * multiple caches (for animation) and interpolate between the
248 * caches overtime to another texture. */
254 /* All light-probes data contained in the cache. */
257};
258
259/* -------------------------------------------------------------------- */
266
272 float (*L0)[4] = {};
273 float (*L1_a)[4] = {};
274 float (*L1_b)[4] = {};
275 float (*L1_c)[4] = {};
276 float *validity = nullptr;
277 /* Capture offset. Only for debugging. */
279};
280
285 float (*L0)[3] = {};
286 float (*L1_a)[3] = {};
287 float (*L1_b)[3] = {};
288 float (*L1_c)[3] = {};
289};
290
295 float *L0 = nullptr;
296 float *L1_a = nullptr;
297 float *L1_b = nullptr;
298 float *L1_c = nullptr;
299};
300
308
314 /* Offset inside the level-of-detail this block starts. */
315 int offset[3] = {};
316 /* Level-of-detail this block is from. */
317 int level = 0;
318};
319
321
322/* -------------------------------------------------------------------- */
326
357
374
376
377} // namespace blender
#define ENUM_OPERATORS(_enum_type)
ID and Library types, which are fundamental for SDNA.
#define BLI_STATIC_ASSERT_ALIGN(st, align)
BMesh Iterators.
unsigned char uint8_t
Definition BKE_text.h:79
@ LIGHTPROBE_CACHE_ADAPTIVE_RESOLUTION
@ LIGHTPROBE_GRID_CAPTURE_INDIRECT
@ LIGHTPROBE_GRID_CAPTURE_EMISSION
@ LIGHTPROBE_GRID_CAPTURE_WORLD
@ LIGHTPROBE_FLAG_SHOW_PARALLAX
@ LIGHTPROBE_FLAG_SHOW_CLIP_DIST
@ LIGHTPROBE_FLAG_CUSTOM_PARALLAX
@ LIGHTPROBE_FLAG_SHOW_INFLUENCE
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eLightCacheTexture_DataType data_type
LightCacheTexture cube_tx
LightProbeCache * cube_data
LightCacheTexture * cube_mips
LightCacheTexture grid_tx
eLightProbeGridCacheLayout data_layout
LightProbeConnectivityData connectivity
struct LightProbeGridCacheFrame * grid_static_cache
eLightProbeObjectCacheType cache_type
eLightProbeShape attenuation_type
struct Collection * visibility_grp
eLightProbeShape parallax_type
eLightProbe_GridFlag grid_flag