summaryrefslogtreecommitdiff
path: root/drivers/gles3/rasterizer_scene_gles3.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles3/rasterizer_scene_gles3.h')
-rw-r--r--drivers/gles3/rasterizer_scene_gles3.h197
1 files changed, 102 insertions, 95 deletions
diff --git a/drivers/gles3/rasterizer_scene_gles3.h b/drivers/gles3/rasterizer_scene_gles3.h
index 0e6027c4ad..910f90edc2 100644
--- a/drivers/gles3/rasterizer_scene_gles3.h
+++ b/drivers/gles3/rasterizer_scene_gles3.h
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -114,7 +114,7 @@ public:
TonemapShaderGLES3 tonemap_shader;
struct SceneDataUBO {
- //this is a std140 compatible struct. Please read the OpenGL 3.3 Specificaiton spec before doing any changes
+ //this is a std140 compatible struct. Please read the OpenGL 3.3 Specification spec before doing any changes
float projection_matrix[16];
float inv_projection_matrix[16];
float camera_inverse_matrix[16];
@@ -204,7 +204,12 @@ public:
bool cull_disabled;
bool used_sss;
bool used_screen_texture;
- bool using_contact_shadows;
+
+ bool used_depth_prepass;
+
+ bool used_depth_texture;
+ bool prepared_depth_texture;
+ bool bound_depth_texture;
VS::ViewportDebugDraw debug_draw;
} state;
@@ -365,11 +370,14 @@ public:
RID sky;
float sky_custom_fov;
+ Basis sky_orientation;
Color bg_color;
float bg_energy;
float sky_ambient;
+ int camera_feed_id;
+
Color ambient_color;
float ambient_energy;
float ambient_sky_contribution;
@@ -450,89 +458,78 @@ public:
float fog_height_max;
float fog_height_curve;
- Environment() {
- bg_mode = VS::ENV_BG_CLEAR_COLOR;
- sky_custom_fov = 0.0;
- bg_energy = 1.0;
- sky_ambient = 0;
- ambient_energy = 1.0;
- ambient_sky_contribution = 0.0;
- canvas_max_layer = 0;
-
- ssr_enabled = false;
- ssr_max_steps = 64;
- ssr_fade_in = 0.15;
- ssr_fade_out = 2.0;
- ssr_depth_tolerance = 0.2;
- ssr_roughness = true;
-
- ssao_enabled = false;
- ssao_intensity = 1.0;
- ssao_radius = 1.0;
- ssao_intensity2 = 1.0;
- ssao_radius2 = 0.0;
- ssao_bias = 0.01;
- ssao_light_affect = 0;
- ssao_ao_channel_affect = 0;
- ssao_filter = VS::ENV_SSAO_BLUR_3x3;
- ssao_quality = VS::ENV_SSAO_QUALITY_LOW;
- ssao_bilateral_sharpness = 4;
-
- tone_mapper = VS::ENV_TONE_MAPPER_LINEAR;
- tone_mapper_exposure = 1.0;
- tone_mapper_exposure_white = 1.0;
- auto_exposure = false;
- auto_exposure_speed = 0.5;
- auto_exposure_min = 0.05;
- auto_exposure_max = 8;
- auto_exposure_grey = 0.4;
-
- glow_enabled = false;
- glow_levels = (1 << 2) | (1 << 4);
- glow_intensity = 0.8;
- glow_strength = 1.0;
- glow_bloom = 0.0;
- glow_blend_mode = VS::GLOW_BLEND_MODE_SOFTLIGHT;
- glow_hdr_bleed_threshold = 1.0;
- glow_hdr_bleed_scale = 2.0;
- glow_hdr_luminance_cap = 12.0;
- glow_bicubic_upscale = false;
-
- dof_blur_far_enabled = false;
- dof_blur_far_distance = 10;
- dof_blur_far_transition = 5;
- dof_blur_far_amount = 0.1;
- dof_blur_far_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM;
-
- dof_blur_near_enabled = false;
- dof_blur_near_distance = 2;
- dof_blur_near_transition = 1;
- dof_blur_near_amount = 0.1;
- dof_blur_near_quality = VS::ENV_DOF_BLUR_QUALITY_MEDIUM;
-
- adjustments_enabled = false;
- adjustments_brightness = 1.0;
- adjustments_contrast = 1.0;
- adjustments_saturation = 1.0;
-
- fog_enabled = false;
- fog_color = Color(0.5, 0.5, 0.5);
- fog_sun_color = Color(0.8, 0.8, 0.0);
- fog_sun_amount = 0;
-
- fog_depth_enabled = true;
-
- fog_depth_begin = 10;
- fog_depth_end = 0;
- fog_depth_curve = 1;
-
- fog_transmit_enabled = true;
- fog_transmit_curve = 1;
-
- fog_height_enabled = false;
- fog_height_min = 0;
- fog_height_max = 100;
- fog_height_curve = 1;
+ Environment() :
+ bg_mode(VS::ENV_BG_CLEAR_COLOR),
+ sky_custom_fov(0.0),
+ bg_energy(1.0),
+ sky_ambient(0),
+ camera_feed_id(0),
+ ambient_energy(1.0),
+ ambient_sky_contribution(0.0),
+ canvas_max_layer(0),
+ ssr_enabled(false),
+ ssr_max_steps(64),
+ ssr_fade_in(0.15),
+ ssr_fade_out(2.0),
+ ssr_depth_tolerance(0.2),
+ ssr_roughness(true),
+ ssao_enabled(false),
+ ssao_intensity(1.0),
+ ssao_radius(1.0),
+ ssao_intensity2(1.0),
+ ssao_radius2(0.0),
+ ssao_bias(0.01),
+ ssao_light_affect(0),
+ ssao_ao_channel_affect(0),
+ ssao_quality(VS::ENV_SSAO_QUALITY_LOW),
+ ssao_bilateral_sharpness(4),
+ ssao_filter(VS::ENV_SSAO_BLUR_3x3),
+ glow_enabled(false),
+ glow_levels((1 << 2) | (1 << 4)),
+ glow_intensity(0.8),
+ glow_strength(1.0),
+ glow_bloom(0.0),
+ glow_blend_mode(VS::GLOW_BLEND_MODE_SOFTLIGHT),
+ glow_hdr_bleed_threshold(1.0),
+ glow_hdr_bleed_scale(2.0),
+ glow_hdr_luminance_cap(12.0),
+ glow_bicubic_upscale(false),
+ tone_mapper(VS::ENV_TONE_MAPPER_LINEAR),
+ tone_mapper_exposure(1.0),
+ tone_mapper_exposure_white(1.0),
+ auto_exposure(false),
+ auto_exposure_speed(0.5),
+ auto_exposure_min(0.05),
+ auto_exposure_max(8),
+ auto_exposure_grey(0.4),
+ dof_blur_far_enabled(false),
+ dof_blur_far_distance(10),
+ dof_blur_far_transition(5),
+ dof_blur_far_amount(0.1),
+ dof_blur_far_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ dof_blur_near_enabled(false),
+ dof_blur_near_distance(2),
+ dof_blur_near_transition(1),
+ dof_blur_near_amount(0.1),
+ dof_blur_near_quality(VS::ENV_DOF_BLUR_QUALITY_MEDIUM),
+ adjustments_enabled(false),
+ adjustments_brightness(1.0),
+ adjustments_contrast(1.0),
+ adjustments_saturation(1.0),
+ fog_enabled(false),
+ fog_color(Color(0.5, 0.5, 0.5)),
+ fog_sun_color(Color(0.8, 0.8, 0.0)),
+ fog_sun_amount(0),
+ fog_depth_enabled(true),
+ fog_depth_begin(10),
+ fog_depth_end(0),
+ fog_depth_curve(1),
+ fog_transmit_enabled(true),
+ fog_transmit_curve(1),
+ fog_height_enabled(false),
+ fog_height_min(0),
+ fog_height_max(100),
+ fog_height_curve(1) {
}
};
@@ -543,10 +540,12 @@ public:
virtual void environment_set_background(RID p_env, VS::EnvironmentBG p_bg);
virtual void environment_set_sky(RID p_env, RID p_sky);
virtual void environment_set_sky_custom_fov(RID p_env, float p_scale);
+ virtual void environment_set_sky_orientation(RID p_env, const Basis &p_orientation);
virtual void environment_set_bg_color(RID p_env, const Color &p_color);
virtual void environment_set_bg_energy(RID p_env, float p_energy);
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer);
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, float p_energy = 1.0, float p_sky_contribution = 0.0);
+ virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id);
virtual void environment_set_dof_blur_near(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
virtual void environment_set_dof_blur_far(RID p_env, bool p_enable, float p_distance, float p_transition, float p_amount, VS::EnvironmentDOFBlurQuality p_quality);
@@ -579,10 +578,15 @@ public:
float light_params[4]; //spot attenuation, spot angle, specular, shadow enabled
float light_clamp[4];
float light_shadow_color_contact[4];
- float shadow_matrix1[16]; //up to here for spot and omni, rest is for directional
- float shadow_matrix2[16];
- float shadow_matrix3[16];
- float shadow_matrix4[16];
+ union {
+ struct {
+ float matrix1[16]; //up to here for spot and omni, rest is for directional
+ float matrix2[16];
+ float matrix3[16];
+ float matrix4[16];
+ };
+ float matrix[4 * 16];
+ } shadow;
float shadow_split_offsets[4];
};
@@ -643,9 +647,9 @@ public:
Vector3 bounds;
Transform transform_to_data;
- GIProbeInstance() {
- probe = NULL;
- tex_cache = 0;
+ GIProbeInstance() :
+ probe(NULL),
+ tex_cache(0) {
}
};
@@ -835,7 +839,7 @@ public:
_FORCE_INLINE_ void _add_geometry_with_material(RasterizerStorageGLES3::Geometry *p_geometry, InstanceBase *p_instance, RasterizerStorageGLES3::GeometryOwner *p_owner, RasterizerStorageGLES3::Material *p_material, bool p_depth_pass, bool p_shadow_pass);
- void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy);
+ void _draw_sky(RasterizerStorageGLES3::Sky *p_sky, const CameraMatrix &p_projection, const Transform &p_transform, bool p_vflip, float p_custom_fov, float p_energy, const Basis &p_sky_orientation);
void _setup_environment(Environment *env, const CameraMatrix &p_cam_projection, const Transform &p_cam_transform, bool p_no_fog = false);
void _setup_directional_light(int p_index, const Transform &p_camera_inverse_transform, bool p_use_shadows);
@@ -851,6 +855,9 @@ public:
void _render_mrts(Environment *env, const CameraMatrix &p_cam_projection);
void _post_process(Environment *env, const CameraMatrix &p_cam_projection);
+ void _prepare_depth_texture();
+ void _bind_depth_texture();
+
virtual void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass);
virtual void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count);
virtual bool free(RID p_rid);