2017-03-17 00:00:46 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright 2016, Blender Foundation.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): Blender Institute
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/** \file eevee_private.h
|
|
|
|
|
* \ingroup DNA
|
|
|
|
|
*/
|
|
|
|
|
|
2017-05-08 11:44:58 +10:00
|
|
|
#ifndef __EEVEE_PRIVATE_H__
|
|
|
|
|
#define __EEVEE_PRIVATE_H__
|
|
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
struct Object;
|
|
|
|
|
|
2017-05-16 03:03:58 +02:00
|
|
|
extern struct DrawEngineType draw_engine_eevee_type;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* Minimum UBO is 16384 bytes */
|
2017-06-04 12:12:58 +02:00
|
|
|
#define MAX_PROBE 128 /* TODO : find size by dividing UBO max size by probe data size */
|
2017-06-13 17:39:39 +02:00
|
|
|
#define MAX_GRID 64 /* TODO : find size by dividing UBO max size by grid data size */
|
2017-06-17 00:08:03 +02:00
|
|
|
#define MAX_PLANAR 16 /* TODO : find size by dividing UBO max size by grid data size */
|
2017-04-10 12:06:17 +02:00
|
|
|
#define MAX_LIGHT 128 /* TODO : find size by dividing UBO max size by light data size */
|
|
|
|
|
#define MAX_SHADOW_CUBE 42 /* TODO : Make this depends on GL_MAX_ARRAY_TEXTURE_LAYERS */
|
|
|
|
|
#define MAX_SHADOW_MAP 64
|
|
|
|
|
#define MAX_SHADOW_CASCADE 8
|
|
|
|
|
#define MAX_CASCADE_NUM 4
|
2017-05-07 14:27:43 +02:00
|
|
|
#define MAX_BLOOM_STEP 16
|
2017-04-10 12:06:17 +02:00
|
|
|
|
2017-06-13 17:39:39 +02:00
|
|
|
/* Only define one of these. */
|
|
|
|
|
// #define IRRADIANCE_SH_L2
|
|
|
|
|
// #define IRRADIANCE_CUBEMAP
|
|
|
|
|
#define IRRADIANCE_HL2
|
|
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
typedef struct EEVEE_PassList {
|
2017-04-18 12:50:09 +02:00
|
|
|
/* Shadows */
|
2017-04-10 12:06:17 +02:00
|
|
|
struct DRWPass *shadow_pass;
|
2017-04-19 22:07:53 +02:00
|
|
|
struct DRWPass *shadow_cube_pass;
|
2017-05-20 13:16:14 +02:00
|
|
|
struct DRWPass *shadow_cube_store_pass;
|
2017-04-20 13:07:24 +02:00
|
|
|
struct DRWPass *shadow_cascade_pass;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
|
|
|
|
/* Probes */
|
|
|
|
|
struct DRWPass *probe_background;
|
2017-06-13 17:39:39 +02:00
|
|
|
struct DRWPass *probe_glossy_compute;
|
|
|
|
|
struct DRWPass *probe_diffuse_compute;
|
2017-06-14 13:45:54 +02:00
|
|
|
struct DRWPass *probe_display;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct DRWPass *motion_blur;
|
2017-05-07 14:27:43 +02:00
|
|
|
struct DRWPass *bloom_blit;
|
|
|
|
|
struct DRWPass *bloom_downsample_first;
|
|
|
|
|
struct DRWPass *bloom_downsample;
|
|
|
|
|
struct DRWPass *bloom_upsample;
|
|
|
|
|
struct DRWPass *bloom_resolve;
|
2017-05-09 21:57:13 +02:00
|
|
|
struct DRWPass *dof_down;
|
|
|
|
|
struct DRWPass *dof_scatter;
|
|
|
|
|
struct DRWPass *dof_resolve;
|
2017-05-04 17:36:40 +02:00
|
|
|
|
2017-03-18 01:55:41 +01:00
|
|
|
struct DRWPass *depth_pass;
|
|
|
|
|
struct DRWPass *depth_pass_cull;
|
2017-06-16 23:50:40 +02:00
|
|
|
struct DRWPass *depth_pass_clip;
|
|
|
|
|
struct DRWPass *depth_pass_clip_cull;
|
2017-04-25 18:46:59 +02:00
|
|
|
struct DRWPass *default_pass;
|
2017-06-04 12:12:58 +02:00
|
|
|
struct DRWPass *default_flat_pass;
|
2017-06-14 12:39:57 +02:00
|
|
|
struct DRWPass *default_hair_pass;
|
2017-04-25 18:46:59 +02:00
|
|
|
struct DRWPass *material_pass;
|
2017-05-04 17:39:50 +02:00
|
|
|
struct DRWPass *background_pass;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_PassList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_FramebufferList {
|
2017-05-04 17:36:40 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct GPUFrameBuffer *effect_fb; /* HDR */
|
2017-05-07 14:27:43 +02:00
|
|
|
struct GPUFrameBuffer *bloom_blit_fb; /* HDR */
|
|
|
|
|
struct GPUFrameBuffer *bloom_down_fb[MAX_BLOOM_STEP]; /* HDR */
|
|
|
|
|
struct GPUFrameBuffer *bloom_accum_fb[MAX_BLOOM_STEP-1]; /* HDR */
|
2017-05-09 21:57:13 +02:00
|
|
|
struct GPUFrameBuffer *dof_down_fb;
|
|
|
|
|
struct GPUFrameBuffer *dof_scatter_far_fb;
|
|
|
|
|
struct GPUFrameBuffer *dof_scatter_near_fb;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-17 00:08:03 +02:00
|
|
|
struct GPUFrameBuffer *planarref_fb;
|
|
|
|
|
|
2017-04-18 12:50:09 +02:00
|
|
|
struct GPUFrameBuffer *main; /* HDR */
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_FramebufferList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_TextureList {
|
2017-05-07 14:27:43 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct GPUTexture *color_post; /* R16_G16_B16 */
|
2017-05-09 21:57:13 +02:00
|
|
|
struct GPUTexture *dof_down_near; /* R16_G16_B16_A16 */
|
|
|
|
|
struct GPUTexture *dof_down_far; /* R16_G16_B16_A16 */
|
|
|
|
|
struct GPUTexture *dof_coc; /* R16_G16 */
|
|
|
|
|
struct GPUTexture *dof_near_blur; /* R16_G16_B16_A16 */
|
|
|
|
|
struct GPUTexture *dof_far_blur; /* R16_G16_B16_A16 */
|
2017-05-07 14:27:43 +02:00
|
|
|
struct GPUTexture *bloom_blit; /* R16_G16_B16 */
|
|
|
|
|
struct GPUTexture *bloom_downsample[MAX_BLOOM_STEP]; /* R16_G16_B16 */
|
|
|
|
|
struct GPUTexture *bloom_upsample[MAX_BLOOM_STEP-1]; /* R16_G16_B16 */
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-17 00:08:03 +02:00
|
|
|
struct GPUTexture *planar_pool;
|
|
|
|
|
|
2017-04-18 12:50:09 +02:00
|
|
|
struct GPUTexture *color; /* R16_G16_B16 */
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_TextureList;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_StorageList {
|
2017-05-04 17:36:40 +02:00
|
|
|
/* Effects */
|
|
|
|
|
struct EEVEE_EffectsInfo *effects;
|
|
|
|
|
|
2017-04-29 16:52:12 +10:00
|
|
|
struct EEVEE_PrivateData *g_data;
|
2017-03-17 00:00:46 +01:00
|
|
|
} EEVEE_StorageList;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* ************ LIGHT UBO ************* */
|
|
|
|
|
typedef struct EEVEE_Light {
|
|
|
|
|
float position[3], dist;
|
|
|
|
|
float color[3], spec;
|
|
|
|
|
float spotsize, spotblend, radius, shadowid;
|
|
|
|
|
float rightvec[3], sizex;
|
|
|
|
|
float upvec[3], sizey;
|
|
|
|
|
float forwardvec[3], lamptype;
|
|
|
|
|
} EEVEE_Light;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowCube {
|
2017-06-02 20:50:04 +02:00
|
|
|
float near, far, bias, exp;
|
2017-04-10 12:06:17 +02:00
|
|
|
} EEVEE_ShadowCube;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowMap {
|
|
|
|
|
float shadowmat[4][4]; /* World->Lamp->NDC->Tex : used for sampling the shadow map. */
|
|
|
|
|
float near, far, bias, pad;
|
|
|
|
|
} EEVEE_ShadowMap;
|
|
|
|
|
|
|
|
|
|
typedef struct EEVEE_ShadowCascade {
|
|
|
|
|
float shadowmat[MAX_CASCADE_NUM][4][4]; /* World->Lamp->NDC->Tex : used for sampling the shadow map. */
|
2017-04-21 16:43:14 +02:00
|
|
|
float split[4];
|
|
|
|
|
float bias[4];
|
2017-04-10 12:06:17 +02:00
|
|
|
} EEVEE_ShadowCascade;
|
|
|
|
|
|
2017-04-19 22:07:53 +02:00
|
|
|
typedef struct EEVEE_ShadowRender {
|
|
|
|
|
float shadowmat[6][4][4]; /* World->Lamp->NDC : used to render the shadow map. 6 frustrum for cubemap shadow */
|
2017-05-20 13:16:14 +02:00
|
|
|
float position[3];
|
|
|
|
|
float pad;
|
2017-04-10 12:06:17 +02:00
|
|
|
int layer;
|
2017-06-02 20:50:04 +02:00
|
|
|
float exponent;
|
2017-04-19 22:07:53 +02:00
|
|
|
} EEVEE_ShadowRender;
|
2017-04-10 12:06:17 +02:00
|
|
|
|
2017-04-19 22:07:53 +02:00
|
|
|
/* ************ LIGHT DATA ************* */
|
|
|
|
|
typedef struct EEVEE_LampsInfo {
|
2017-04-10 12:06:17 +02:00
|
|
|
int num_light, cache_num_light;
|
|
|
|
|
int num_cube, cache_num_cube;
|
|
|
|
|
int num_map, cache_num_map;
|
|
|
|
|
int num_cascade, cache_num_cascade;
|
2017-06-01 18:20:44 +02:00
|
|
|
int update_flag;
|
2017-04-10 12:06:17 +02:00
|
|
|
/* List of lights in the scene. */
|
2017-06-01 18:20:44 +02:00
|
|
|
/* XXX This is fragile, can get out of sync quickly. */
|
2017-04-10 12:06:17 +02:00
|
|
|
struct Object *light_ref[MAX_LIGHT];
|
|
|
|
|
struct Object *shadow_cube_ref[MAX_SHADOW_CUBE];
|
|
|
|
|
struct Object *shadow_map_ref[MAX_SHADOW_MAP];
|
|
|
|
|
struct Object *shadow_cascade_ref[MAX_SHADOW_CASCADE];
|
|
|
|
|
/* UBO Storage : data used by UBO */
|
|
|
|
|
struct EEVEE_Light light_data[MAX_LIGHT];
|
2017-04-19 22:07:53 +02:00
|
|
|
struct EEVEE_ShadowRender shadow_render_data;
|
2017-04-10 12:06:17 +02:00
|
|
|
struct EEVEE_ShadowCube shadow_cube_data[MAX_SHADOW_CUBE];
|
|
|
|
|
struct EEVEE_ShadowMap shadow_map_data[MAX_SHADOW_MAP];
|
|
|
|
|
struct EEVEE_ShadowCascade shadow_cascade_data[MAX_SHADOW_CASCADE];
|
|
|
|
|
} EEVEE_LampsInfo;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
/* EEVEE_LampsInfo->update_flag */
|
|
|
|
|
enum {
|
|
|
|
|
LIGHT_UPDATE_SHADOW_CUBE = (1 << 0),
|
|
|
|
|
};
|
|
|
|
|
|
2017-06-04 12:12:58 +02:00
|
|
|
/* ************ PROBE UBO ************* */
|
2017-06-12 20:59:54 +10:00
|
|
|
typedef struct EEVEE_LightProbe {
|
2017-06-09 22:30:49 +02:00
|
|
|
float position[3], parallax_type;
|
|
|
|
|
float attenuation_fac;
|
|
|
|
|
float attenuation_type;
|
|
|
|
|
float pad3[2];
|
|
|
|
|
float attenuationmat[4][4];
|
|
|
|
|
float parallaxmat[4][4];
|
2017-06-12 20:59:54 +10:00
|
|
|
} EEVEE_LightProbe;
|
2017-06-04 12:12:58 +02:00
|
|
|
|
2017-06-13 17:39:39 +02:00
|
|
|
typedef struct EEVEE_LightGrid {
|
|
|
|
|
float mat[4][4];
|
|
|
|
|
int resolution[3], offset;
|
2017-06-14 22:45:20 +02:00
|
|
|
float corner[3], attenuation_scale;
|
|
|
|
|
float increment_x[3], attenuation_bias; /* world space vector between 2 opposite cells */
|
2017-06-13 17:39:39 +02:00
|
|
|
float increment_y[3], pad3;
|
|
|
|
|
float increment_z[3], pad4;
|
|
|
|
|
} EEVEE_LightGrid;
|
|
|
|
|
|
2017-06-17 00:08:03 +02:00
|
|
|
typedef struct EEVEE_PlanarReflection {
|
|
|
|
|
float plane_equation[4];
|
|
|
|
|
float clip_vec_x[3], attenuation_scale;
|
|
|
|
|
float clip_vec_y[3], attenuation_bias;
|
|
|
|
|
float clip_edge_x_pos, clip_edge_x_neg;
|
|
|
|
|
float clip_edge_y_pos, clip_edge_y_neg;
|
|
|
|
|
float facing_scale, facing_bias, pad[2];
|
|
|
|
|
float reflectionmat[4][4];
|
|
|
|
|
} EEVEE_PlanarReflection;
|
|
|
|
|
|
2017-04-18 12:50:09 +02:00
|
|
|
/* ************ PROBE DATA ************* */
|
2017-06-12 20:59:54 +10:00
|
|
|
typedef struct EEVEE_LightProbesInfo {
|
2017-06-04 12:12:58 +02:00
|
|
|
int num_cube, cache_num_cube;
|
2017-06-13 17:39:39 +02:00
|
|
|
int num_grid, cache_num_grid;
|
2017-06-17 00:08:03 +02:00
|
|
|
int num_planar, cache_num_planar;
|
2017-06-04 12:12:58 +02:00
|
|
|
int update_flag;
|
2017-06-14 18:52:53 +02:00
|
|
|
int updated_bounce;
|
2017-06-08 21:48:50 +02:00
|
|
|
/* Actual number of probes that have datas. */
|
2017-06-13 17:39:39 +02:00
|
|
|
int num_render_cube;
|
|
|
|
|
int num_render_grid;
|
2017-04-18 12:50:09 +02:00
|
|
|
/* For rendering probes */
|
|
|
|
|
float probemat[6][4][4];
|
|
|
|
|
int layer;
|
2017-05-29 22:03:57 +02:00
|
|
|
float texel_size;
|
|
|
|
|
float padding_size;
|
2017-04-18 12:50:09 +02:00
|
|
|
float samples_ct;
|
|
|
|
|
float invsamples_ct;
|
|
|
|
|
float roughness;
|
|
|
|
|
float lodfactor;
|
|
|
|
|
float lodmax;
|
2017-04-18 21:02:02 +02:00
|
|
|
int shres;
|
|
|
|
|
int shnbr;
|
2017-06-14 10:35:28 +02:00
|
|
|
bool specular_toggle;
|
2017-06-04 12:12:58 +02:00
|
|
|
/* List of probes in the scene. */
|
|
|
|
|
/* XXX This is fragile, can get out of sync quickly. */
|
2017-06-13 17:39:39 +02:00
|
|
|
struct Object *probes_cube_ref[MAX_PROBE];
|
|
|
|
|
struct Object *probes_grid_ref[MAX_GRID];
|
2017-06-17 00:08:03 +02:00
|
|
|
struct Object *probes_planar_ref[MAX_PLANAR];
|
2017-06-04 12:12:58 +02:00
|
|
|
/* UBO Storage : data used by UBO */
|
2017-06-12 20:59:54 +10:00
|
|
|
struct EEVEE_LightProbe probe_data[MAX_PROBE];
|
2017-06-13 17:39:39 +02:00
|
|
|
struct EEVEE_LightGrid grid_data[MAX_GRID];
|
2017-06-17 00:08:03 +02:00
|
|
|
struct EEVEE_PlanarReflection planar_data[MAX_PLANAR];
|
2017-06-12 20:59:54 +10:00
|
|
|
} EEVEE_LightProbesInfo;
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
/* EEVEE_LightProbesInfo->update_flag */
|
2017-06-04 12:12:58 +02:00
|
|
|
enum {
|
|
|
|
|
PROBE_UPDATE_CUBE = (1 << 0),
|
|
|
|
|
};
|
|
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
/* ************ EFFECTS DATA ************* */
|
|
|
|
|
typedef struct EEVEE_EffectsInfo {
|
2017-05-07 14:27:43 +02:00
|
|
|
int enabled_effects;
|
|
|
|
|
|
|
|
|
|
/* Motion Blur */
|
2017-05-04 17:36:40 +02:00
|
|
|
float current_ndc_to_world[4][4];
|
|
|
|
|
float past_world_to_ndc[4][4];
|
|
|
|
|
float tmp_mat[4][4];
|
2017-05-10 15:58:18 +02:00
|
|
|
int motion_blur_samples;
|
2017-05-04 17:36:40 +02:00
|
|
|
|
2017-05-09 21:57:13 +02:00
|
|
|
/* Depth Of Field */
|
|
|
|
|
float dof_near_far[2];
|
|
|
|
|
float dof_params[3];
|
2017-05-10 15:58:18 +02:00
|
|
|
float dof_bokeh[4];
|
2017-05-09 21:57:13 +02:00
|
|
|
float dof_layer_select[2];
|
|
|
|
|
int dof_target_size[2];
|
|
|
|
|
|
2017-05-07 14:27:43 +02:00
|
|
|
/* Bloom */
|
|
|
|
|
int bloom_iteration_ct;
|
|
|
|
|
float source_texel_size[2];
|
|
|
|
|
float blit_texel_size[2];
|
|
|
|
|
float downsamp_texel_size[MAX_BLOOM_STEP][2];
|
|
|
|
|
float bloom_intensity;
|
|
|
|
|
float bloom_sample_scale;
|
|
|
|
|
float bloom_curve_threshold[4];
|
|
|
|
|
float unf_source_texel_size[2];
|
|
|
|
|
struct GPUTexture *unf_source_buffer; /* pointer copy */
|
|
|
|
|
struct GPUTexture *unf_base_buffer; /* pointer copy */
|
|
|
|
|
|
|
|
|
|
/* Not alloced, just a copy of a *GPUtexture in EEVEE_TextureList. */
|
|
|
|
|
struct GPUTexture *source_buffer; /* latest updated texture */
|
|
|
|
|
struct GPUFrameBuffer *target_buffer; /* next target to render to */
|
2017-05-04 17:36:40 +02:00
|
|
|
} EEVEE_EffectsInfo;
|
|
|
|
|
|
|
|
|
|
enum {
|
2017-05-07 14:27:43 +02:00
|
|
|
EFFECT_MOTION_BLUR = (1 << 0),
|
|
|
|
|
EFFECT_BLOOM = (1 << 1),
|
2017-05-09 21:57:13 +02:00
|
|
|
EFFECT_DOF = (1 << 2),
|
2017-05-04 17:36:40 +02:00
|
|
|
};
|
|
|
|
|
|
2017-05-30 22:29:20 +02:00
|
|
|
/* ************** SCENE LAYER DATA ************** */
|
|
|
|
|
typedef struct EEVEE_SceneLayerData {
|
|
|
|
|
/* Lamps */
|
|
|
|
|
struct EEVEE_LampsInfo *lamps;
|
|
|
|
|
|
|
|
|
|
struct GPUUniformBuffer *light_ubo;
|
|
|
|
|
struct GPUUniformBuffer *shadow_ubo;
|
|
|
|
|
struct GPUUniformBuffer *shadow_render_ubo;
|
|
|
|
|
|
|
|
|
|
struct GPUFrameBuffer *shadow_cube_target_fb;
|
|
|
|
|
struct GPUFrameBuffer *shadow_cube_fb;
|
|
|
|
|
struct GPUFrameBuffer *shadow_map_fb;
|
|
|
|
|
struct GPUFrameBuffer *shadow_cascade_fb;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *shadow_depth_cube_target;
|
|
|
|
|
struct GPUTexture *shadow_color_cube_target;
|
|
|
|
|
struct GPUTexture *shadow_depth_cube_pool;
|
|
|
|
|
struct GPUTexture *shadow_depth_map_pool;
|
|
|
|
|
struct GPUTexture *shadow_depth_cascade_pool;
|
|
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
struct ListBase shadow_casters; /* Shadow casters gathered during cache iteration */
|
|
|
|
|
|
2017-05-30 22:29:20 +02:00
|
|
|
/* Probes */
|
2017-06-12 20:59:54 +10:00
|
|
|
struct EEVEE_LightProbesInfo *probes;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
|
|
|
|
struct GPUUniformBuffer *probe_ubo;
|
2017-06-13 17:39:39 +02:00
|
|
|
struct GPUUniformBuffer *grid_ubo;
|
2017-06-17 00:08:03 +02:00
|
|
|
struct GPUUniformBuffer *planar_ubo;
|
2017-05-30 22:29:20 +02:00
|
|
|
|
|
|
|
|
struct GPUFrameBuffer *probe_fb;
|
|
|
|
|
struct GPUFrameBuffer *probe_filter_fb;
|
|
|
|
|
|
|
|
|
|
struct GPUTexture *probe_rt;
|
|
|
|
|
struct GPUTexture *probe_depth_rt;
|
|
|
|
|
struct GPUTexture *probe_pool;
|
2017-06-13 17:39:39 +02:00
|
|
|
struct GPUTexture *irradiance_pool;
|
2017-06-14 18:52:53 +02:00
|
|
|
struct GPUTexture *irradiance_rt;
|
2017-06-04 12:12:58 +02:00
|
|
|
|
|
|
|
|
struct ListBase probe_queue; /* List of probes to update */
|
2017-05-30 22:29:20 +02:00
|
|
|
} EEVEE_SceneLayerData;
|
|
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
/* ************ OBJECT DATA ************ */
|
|
|
|
|
typedef struct EEVEE_LampEngineData {
|
|
|
|
|
bool need_update;
|
|
|
|
|
struct ListBase shadow_caster_list;
|
|
|
|
|
void *storage; /* either EEVEE_LightData, EEVEE_ShadowCubeData, EEVEE_ShadowCascadeData */
|
|
|
|
|
} EEVEE_LampEngineData;
|
|
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
typedef struct EEVEE_LightProbeEngineData {
|
2017-06-08 21:48:50 +02:00
|
|
|
bool need_update;
|
|
|
|
|
bool ready_to_shade;
|
2017-06-14 18:52:53 +02:00
|
|
|
int updated_cells;
|
|
|
|
|
int num_cell;
|
2017-06-15 00:10:34 +02:00
|
|
|
int probe_id; /* Only used for display data */
|
2017-06-17 00:08:03 +02:00
|
|
|
/* For planar reflection rendering */
|
|
|
|
|
float viewmat[4][4];
|
|
|
|
|
float persmat[4][4];
|
2017-06-08 21:48:50 +02:00
|
|
|
struct ListBase captured_object_list;
|
2017-06-12 20:59:54 +10:00
|
|
|
} EEVEE_LightProbeEngineData;
|
2017-06-08 21:48:50 +02:00
|
|
|
|
2017-06-01 18:20:44 +02:00
|
|
|
typedef struct EEVEE_ObjectEngineData {
|
|
|
|
|
bool need_update;
|
|
|
|
|
} EEVEE_ObjectEngineData;
|
|
|
|
|
|
2017-04-10 12:06:17 +02:00
|
|
|
/* *********************************** */
|
2017-03-17 00:00:46 +01:00
|
|
|
|
|
|
|
|
typedef struct EEVEE_Data {
|
2017-04-03 19:32:05 +02:00
|
|
|
void *engine_type;
|
2017-03-17 00:00:46 +01:00
|
|
|
EEVEE_FramebufferList *fbl;
|
|
|
|
|
EEVEE_TextureList *txl;
|
|
|
|
|
EEVEE_PassList *psl;
|
|
|
|
|
EEVEE_StorageList *stl;
|
|
|
|
|
} EEVEE_Data;
|
|
|
|
|
|
2017-04-29 16:52:12 +10:00
|
|
|
typedef struct EEVEE_PrivateData {
|
2017-04-10 12:06:17 +02:00
|
|
|
struct DRWShadingGroup *shadow_shgrp;
|
2017-03-26 20:13:34 +02:00
|
|
|
struct DRWShadingGroup *depth_shgrp;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp_cull;
|
2017-06-16 23:50:40 +02:00
|
|
|
struct DRWShadingGroup *depth_shgrp_clip;
|
|
|
|
|
struct DRWShadingGroup *depth_shgrp_clip_cull;
|
2017-06-15 00:10:34 +02:00
|
|
|
struct DRWShadingGroup *cube_display_shgrp;
|
2017-06-05 22:05:21 +02:00
|
|
|
struct GHash *material_hash;
|
2017-06-14 12:39:57 +02:00
|
|
|
struct GHash *hair_material_hash;
|
2017-04-29 16:52:12 +10:00
|
|
|
} EEVEE_PrivateData; /* Transient data */
|
2017-03-26 20:13:34 +02:00
|
|
|
|
2017-06-03 00:53:47 +02:00
|
|
|
/* eevee_data.c */
|
|
|
|
|
EEVEE_SceneLayerData *EEVEE_scene_layer_data_get(void);
|
|
|
|
|
EEVEE_ObjectEngineData *EEVEE_object_data_get(Object *ob);
|
2017-06-12 20:59:54 +10:00
|
|
|
EEVEE_LightProbeEngineData *EEVEE_lightprobe_data_get(Object *ob);
|
2017-06-03 00:53:47 +02:00
|
|
|
EEVEE_LampEngineData *EEVEE_lamp_data_get(Object *ob);
|
2017-06-01 18:20:44 +02:00
|
|
|
|
2017-06-04 12:12:58 +02:00
|
|
|
|
|
|
|
|
/* eevee_materials.c */
|
|
|
|
|
void EEVEE_materials_init(void);
|
|
|
|
|
void EEVEE_materials_cache_init(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_materials_cache_populate(EEVEE_Data *vedata, EEVEE_SceneLayerData *sldata, Object *ob, struct Batch *geom);
|
2017-06-05 22:05:21 +02:00
|
|
|
void EEVEE_materials_cache_finish(EEVEE_Data *vedata);
|
2017-06-12 20:59:54 +10:00
|
|
|
struct GPUMaterial *EEVEE_material_world_lightprobe_get(struct Scene *scene, struct World *wo);
|
2017-06-04 12:12:58 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_world_background_get(struct Scene *scene, struct World *wo);
|
2017-06-12 20:59:54 +10:00
|
|
|
struct GPUMaterial *EEVEE_material_mesh_lightprobe_get(struct Scene *scene, Material *ma);
|
2017-06-04 12:12:58 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_mesh_get(struct Scene *scene, Material *ma);
|
2017-06-14 12:39:57 +02:00
|
|
|
struct GPUMaterial *EEVEE_material_hair_get(struct Scene *scene, Material *ma);
|
2017-06-04 12:12:58 +02:00
|
|
|
void EEVEE_materials_free(void);
|
|
|
|
|
|
2017-03-17 00:00:46 +01:00
|
|
|
/* eevee_lights.c */
|
2017-05-30 22:29:20 +02:00
|
|
|
void EEVEE_lights_init(EEVEE_SceneLayerData *sldata);
|
|
|
|
|
void EEVEE_lights_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl);
|
|
|
|
|
void EEVEE_lights_cache_add(EEVEE_SceneLayerData *sldata, struct Object *ob);
|
|
|
|
|
void EEVEE_lights_cache_shcaster_add(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, struct Batch *geom, float (*obmat)[4]);
|
|
|
|
|
void EEVEE_lights_cache_finish(EEVEE_SceneLayerData *sldata);
|
|
|
|
|
void EEVEE_lights_update(EEVEE_SceneLayerData *sldata);
|
|
|
|
|
void EEVEE_draw_shadows(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl);
|
2017-05-20 13:16:14 +02:00
|
|
|
void EEVEE_lights_free(void);
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-06-12 20:59:54 +10:00
|
|
|
/* eevee_lightprobes.c */
|
2017-06-17 00:08:03 +02:00
|
|
|
void EEVEE_lightprobes_init(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata);
|
2017-06-15 00:10:34 +02:00
|
|
|
void EEVEE_lightprobes_cache_init(EEVEE_SceneLayerData *sldata, EEVEE_PassList *psl, EEVEE_StorageList *stl);
|
2017-06-12 20:59:54 +10:00
|
|
|
void EEVEE_lightprobes_cache_add(EEVEE_SceneLayerData *sldata, Object *ob);
|
2017-06-15 00:10:34 +02:00
|
|
|
void EEVEE_lightprobes_cache_finish(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata);
|
2017-06-17 00:08:03 +02:00
|
|
|
void EEVEE_lightprobes_refresh(EEVEE_SceneLayerData *sldata, EEVEE_Data *vedata);
|
2017-06-12 20:59:54 +10:00
|
|
|
void EEVEE_lightprobes_free(void);
|
2017-04-18 12:50:09 +02:00
|
|
|
|
2017-05-04 17:36:40 +02:00
|
|
|
/* eevee_effects.c */
|
|
|
|
|
void EEVEE_effects_init(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_effects_cache_init(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_draw_effects(EEVEE_Data *vedata);
|
|
|
|
|
void EEVEE_effects_free(void);
|
|
|
|
|
|
2017-04-18 12:50:09 +02:00
|
|
|
/* Shadow Matrix */
|
|
|
|
|
static const float texcomat[4][4] = { /* From NDC to TexCo */
|
|
|
|
|
{0.5, 0.0, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.5, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 0.5, 0.0},
|
|
|
|
|
{0.5, 0.5, 0.5, 1.0}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Cubemap Matrices */
|
|
|
|
|
static const float cubefacemat[6][4][4] = {
|
|
|
|
|
/* Pos X */
|
|
|
|
|
{{0.0, 0.0, -1.0, 0.0},
|
|
|
|
|
{0.0, -1.0, 0.0, 0.0},
|
|
|
|
|
{-1.0, 0.0, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
/* Neg X */
|
|
|
|
|
{{0.0, 0.0, 1.0, 0.0},
|
|
|
|
|
{0.0, -1.0, 0.0, 0.0},
|
|
|
|
|
{1.0, 0.0, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
/* Pos Y */
|
|
|
|
|
{{1.0, 0.0, 0.0, 0.0},
|
2017-05-20 13:16:14 +02:00
|
|
|
{0.0, 0.0, -1.0, 0.0},
|
|
|
|
|
{0.0, 1.0, 0.0, 0.0},
|
2017-04-18 12:50:09 +02:00
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
/* Neg Y */
|
|
|
|
|
{{1.0, 0.0, 0.0, 0.0},
|
2017-05-20 13:16:14 +02:00
|
|
|
{0.0, 0.0, 1.0, 0.0},
|
|
|
|
|
{0.0, -1.0, 0.0, 0.0},
|
2017-04-18 12:50:09 +02:00
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
/* Pos Z */
|
|
|
|
|
{{1.0, 0.0, 0.0, 0.0},
|
|
|
|
|
{0.0, -1.0, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.0, -1.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
/* Neg Z */
|
|
|
|
|
{{-1.0, 0.0, 0.0, 0.0},
|
|
|
|
|
{0.0, -1.0, 0.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 1.0, 0.0},
|
|
|
|
|
{0.0, 0.0, 0.0, 1.0}},
|
|
|
|
|
};
|
2017-05-08 11:44:58 +10:00
|
|
|
|
|
|
|
|
#endif /* __EEVEE_PRIVATE_H__ */
|