1/**************************************************************************/
2/* renderer_scene_render.cpp */
3/**************************************************************************/
4/* This file is part of: */
5/* GODOT ENGINE */
6/* https://godotengine.org */
7/**************************************************************************/
8/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10/* */
11/* Permission is hereby granted, free of charge, to any person obtaining */
12/* a copy of this software and associated documentation files (the */
13/* "Software"), to deal in the Software without restriction, including */
14/* without limitation the rights to use, copy, modify, merge, publish, */
15/* distribute, sublicense, and/or sell copies of the Software, and to */
16/* permit persons to whom the Software is furnished to do so, subject to */
17/* the following conditions: */
18/* */
19/* The above copyright notice and this permission notice shall be */
20/* included in all copies or substantial portions of the Software. */
21/* */
22/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29/**************************************************************************/
30
31#include "renderer_scene_render.h"
32
33/////////////////////////////////////////////////////////////////////////////
34// CameraData
35
36void RendererSceneRender::CameraData::set_camera(const Transform3D p_transform, const Projection p_projection, bool p_is_orthogonal, bool p_vaspect, const Vector2 &p_taa_jitter, const uint32_t p_visible_layers) {
37 view_count = 1;
38 is_orthogonal = p_is_orthogonal;
39 vaspect = p_vaspect;
40
41 main_transform = p_transform;
42 main_projection = p_projection;
43
44 visible_layers = p_visible_layers;
45 view_offset[0] = Transform3D();
46 view_projection[0] = p_projection;
47 taa_jitter = p_taa_jitter;
48}
49
50void RendererSceneRender::CameraData::set_multiview_camera(uint32_t p_view_count, const Transform3D *p_transforms, const Projection *p_projections, bool p_is_orthogonal, bool p_vaspect) {
51 ERR_FAIL_COND_MSG(p_view_count != 2, "Incorrect view count for stereoscopic view");
52
53 visible_layers = 0xFFFFFFFF;
54 view_count = p_view_count;
55 is_orthogonal = p_is_orthogonal;
56 vaspect = p_vaspect;
57 Vector<Plane> planes[2];
58
59 /////////////////////////////////////////////////////////////////////////////
60 // Figure out our center transform
61
62 // 1. obtain our planes
63 for (uint32_t v = 0; v < view_count; v++) {
64 planes[v] = p_projections[v].get_projection_planes(p_transforms[v]);
65 }
66
67 // 2. average and normalize plane normals to obtain z vector, cross them to obtain y vector, and from there the x vector for combined camera basis.
68 Vector3 n0 = planes[0][Projection::PLANE_LEFT].normal;
69 Vector3 n1 = planes[1][Projection::PLANE_RIGHT].normal;
70 Vector3 z = (n0 + n1).normalized();
71 Vector3 y = n0.cross(n1).normalized();
72 Vector3 x = y.cross(z).normalized();
73 y = z.cross(x).normalized();
74 main_transform.basis.set_columns(x, y, z);
75
76 // 3. create a horizon plane with one of the eyes and the up vector as normal.
77 Plane horizon(y, p_transforms[0].origin);
78
79 // 4. Intersect horizon, left and right to obtain the combined camera origin.
80 ERR_FAIL_COND_MSG(
81 !horizon.intersect_3(planes[0][Projection::PLANE_LEFT], planes[1][Projection::PLANE_RIGHT], &main_transform.origin), "Can't determine camera origin");
82
83 // handy to have the inverse of the transform we just build
84 Transform3D main_transform_inv = main_transform.inverse();
85
86 // 5. figure out far plane, this could use some improvement, we may have our far plane too close like this, not sure if this matters
87 Vector3 far_center = (planes[0][Projection::PLANE_FAR].get_center() + planes[1][Projection::PLANE_FAR].get_center()) * 0.5;
88 Plane far(-z, far_center);
89
90 /////////////////////////////////////////////////////////////////////////////
91 // Figure out our top/bottom planes
92
93 // 6. Intersect far and left planes with top planes from both eyes, save the point with highest y as top_left.
94 Vector3 top_left, other;
95 ERR_FAIL_COND_MSG(
96 !far.intersect_3(planes[0][Projection::PLANE_LEFT], planes[0][Projection::PLANE_TOP], &top_left), "Can't determine left camera far/left/top vector");
97 ERR_FAIL_COND_MSG(
98 !far.intersect_3(planes[1][Projection::PLANE_LEFT], planes[1][Projection::PLANE_TOP], &other), "Can't determine right camera far/left/top vector");
99 if (y.dot(top_left) < y.dot(other)) {
100 top_left = other;
101 }
102
103 // 7. Intersect far and left planes with bottom planes from both eyes, save the point with lowest y as bottom_left.
104 Vector3 bottom_left;
105 ERR_FAIL_COND_MSG(
106 !far.intersect_3(planes[0][Projection::PLANE_LEFT], planes[0][Projection::PLANE_BOTTOM], &bottom_left), "Can't determine left camera far/left/bottom vector");
107 ERR_FAIL_COND_MSG(
108 !far.intersect_3(planes[1][Projection::PLANE_LEFT], planes[1][Projection::PLANE_BOTTOM], &other), "Can't determine right camera far/left/bottom vector");
109 if (y.dot(other) < y.dot(bottom_left)) {
110 bottom_left = other;
111 }
112
113 // 8. Intersect far and right planes with top planes from both eyes, save the point with highest y as top_right.
114 Vector3 top_right;
115 ERR_FAIL_COND_MSG(
116 !far.intersect_3(planes[0][Projection::PLANE_RIGHT], planes[0][Projection::PLANE_TOP], &top_right), "Can't determine left camera far/right/top vector");
117 ERR_FAIL_COND_MSG(
118 !far.intersect_3(planes[1][Projection::PLANE_RIGHT], planes[1][Projection::PLANE_TOP], &other), "Can't determine right camera far/right/top vector");
119 if (y.dot(top_right) < y.dot(other)) {
120 top_right = other;
121 }
122
123 // 9. Intersect far and right planes with bottom planes from both eyes, save the point with lowest y as bottom_right.
124 Vector3 bottom_right;
125 ERR_FAIL_COND_MSG(
126 !far.intersect_3(planes[0][Projection::PLANE_RIGHT], planes[0][Projection::PLANE_BOTTOM], &bottom_right), "Can't determine left camera far/right/bottom vector");
127 ERR_FAIL_COND_MSG(
128 !far.intersect_3(planes[1][Projection::PLANE_RIGHT], planes[1][Projection::PLANE_BOTTOM], &other), "Can't determine right camera far/right/bottom vector");
129 if (y.dot(other) < y.dot(bottom_right)) {
130 bottom_right = other;
131 }
132
133 // 10. Create top plane with these points: camera origin, top_left, top_right
134 Plane top(main_transform.origin, top_left, top_right);
135
136 // 11. Create bottom plane with these points: camera origin, bottom_left, bottom_right
137 Plane bottom(main_transform.origin, bottom_left, bottom_right);
138
139 /////////////////////////////////////////////////////////////////////////////
140 // Figure out our near plane points
141
142 // 12. Create a near plane using -camera z and the eye further along in that axis.
143 Plane near;
144 Vector3 neg_z = -z;
145 if (neg_z.dot(p_transforms[1].origin) < neg_z.dot(p_transforms[0].origin)) {
146 near = Plane(neg_z, p_transforms[0].origin);
147 } else {
148 near = Plane(neg_z, p_transforms[1].origin);
149 }
150
151 // 13. Intersect near plane with bottm/left planes, to obtain min_vec then top/right to obtain max_vec
152 Vector3 min_vec;
153 ERR_FAIL_COND_MSG(
154 !near.intersect_3(bottom, planes[0][Projection::PLANE_LEFT], &min_vec), "Can't determine left camera near/left/bottom vector");
155 ERR_FAIL_COND_MSG(
156 !near.intersect_3(bottom, planes[1][Projection::PLANE_LEFT], &other), "Can't determine right camera near/left/bottom vector");
157 if (x.dot(other) < x.dot(min_vec)) {
158 min_vec = other;
159 }
160
161 Vector3 max_vec;
162 ERR_FAIL_COND_MSG(
163 !near.intersect_3(top, planes[0][Projection::PLANE_RIGHT], &max_vec), "Can't determine left camera near/right/top vector");
164 ERR_FAIL_COND_MSG(
165 !near.intersect_3(top, planes[1][Projection::PLANE_RIGHT], &other), "Can't determine right camera near/right/top vector");
166 if (x.dot(max_vec) < x.dot(other)) {
167 max_vec = other;
168 }
169
170 // 14. transform these points by the inverse camera to obtain local_min_vec and local_max_vec
171 Vector3 local_min_vec = main_transform_inv.xform(min_vec);
172 Vector3 local_max_vec = main_transform_inv.xform(max_vec);
173
174 // 15. get x and y from these to obtain left, top, right bottom for the frustum. Get the distance from near plane to camera origin to obtain near, and the distance from the far plane to the camer origin to obtain far.
175 float z_near = -near.distance_to(main_transform.origin);
176 float z_far = -far.distance_to(main_transform.origin);
177
178 // 16. Use this to build the combined camera matrix.
179 main_projection.set_frustum(local_min_vec.x, local_max_vec.x, local_min_vec.y, local_max_vec.y, z_near, z_far);
180
181 /////////////////////////////////////////////////////////////////////////////
182 // 3. Copy our view data
183 for (uint32_t v = 0; v < view_count; v++) {
184 view_offset[v] = main_transform_inv * p_transforms[v];
185 view_projection[v] = p_projections[v] * Projection(view_offset[v].inverse());
186 }
187}
188
189/* Environment API */
190
191RID RendererSceneRender::environment_allocate() {
192 return environment_storage.environment_allocate();
193}
194
195void RendererSceneRender::environment_initialize(RID p_rid) {
196 environment_storage.environment_initialize(p_rid);
197}
198
199void RendererSceneRender::environment_free(RID p_rid) {
200 environment_storage.environment_free(p_rid);
201}
202
203bool RendererSceneRender::is_environment(RID p_rid) const {
204 return environment_storage.is_environment(p_rid);
205}
206
207// background
208
209void RendererSceneRender::environment_set_background(RID p_env, RS::EnvironmentBG p_bg) {
210 environment_storage.environment_set_background(p_env, p_bg);
211}
212
213void RendererSceneRender::environment_set_sky(RID p_env, RID p_sky) {
214 environment_storage.environment_set_sky(p_env, p_sky);
215}
216
217void RendererSceneRender::environment_set_sky_custom_fov(RID p_env, float p_scale) {
218 environment_storage.environment_set_sky_custom_fov(p_env, p_scale);
219}
220
221void RendererSceneRender::environment_set_sky_orientation(RID p_env, const Basis &p_orientation) {
222 environment_storage.environment_set_sky_orientation(p_env, p_orientation);
223}
224
225void RendererSceneRender::environment_set_bg_color(RID p_env, const Color &p_color) {
226 environment_storage.environment_set_bg_color(p_env, p_color);
227}
228
229void RendererSceneRender::environment_set_bg_energy(RID p_env, float p_multiplier, float p_exposure_value) {
230 environment_storage.environment_set_bg_energy(p_env, p_multiplier, p_exposure_value);
231}
232
233void RendererSceneRender::environment_set_canvas_max_layer(RID p_env, int p_max_layer) {
234 environment_storage.environment_set_canvas_max_layer(p_env, p_max_layer);
235}
236
237void RendererSceneRender::environment_set_ambient_light(RID p_env, const Color &p_color, RS::EnvironmentAmbientSource p_ambient, float p_energy, float p_sky_contribution, RS::EnvironmentReflectionSource p_reflection_source) {
238 environment_storage.environment_set_ambient_light(p_env, p_color, p_ambient, p_energy, p_sky_contribution, p_reflection_source);
239}
240
241RS::EnvironmentBG RendererSceneRender::environment_get_background(RID p_env) const {
242 return environment_storage.environment_get_background(p_env);
243}
244
245RID RendererSceneRender::environment_get_sky(RID p_env) const {
246 return environment_storage.environment_get_sky(p_env);
247}
248
249float RendererSceneRender::environment_get_sky_custom_fov(RID p_env) const {
250 return environment_storage.environment_get_sky_custom_fov(p_env);
251}
252
253Basis RendererSceneRender::environment_get_sky_orientation(RID p_env) const {
254 return environment_storage.environment_get_sky_orientation(p_env);
255}
256
257Color RendererSceneRender::environment_get_bg_color(RID p_env) const {
258 return environment_storage.environment_get_bg_color(p_env);
259}
260
261float RendererSceneRender::environment_get_bg_energy_multiplier(RID p_env) const {
262 return environment_storage.environment_get_bg_energy_multiplier(p_env);
263}
264
265float RendererSceneRender::environment_get_bg_intensity(RID p_env) const {
266 return environment_storage.environment_get_bg_intensity(p_env);
267}
268
269int RendererSceneRender::environment_get_canvas_max_layer(RID p_env) const {
270 return environment_storage.environment_get_canvas_max_layer(p_env);
271}
272
273RS::EnvironmentAmbientSource RendererSceneRender::environment_get_ambient_source(RID p_env) const {
274 return environment_storage.environment_get_ambient_source(p_env);
275}
276
277Color RendererSceneRender::environment_get_ambient_light(RID p_env) const {
278 return environment_storage.environment_get_ambient_light(p_env);
279}
280
281float RendererSceneRender::environment_get_ambient_light_energy(RID p_env) const {
282 return environment_storage.environment_get_ambient_light_energy(p_env);
283}
284
285float RendererSceneRender::environment_get_ambient_sky_contribution(RID p_env) const {
286 return environment_storage.environment_get_ambient_sky_contribution(p_env);
287}
288
289RS::EnvironmentReflectionSource RendererSceneRender::environment_get_reflection_source(RID p_env) const {
290 return environment_storage.environment_get_reflection_source(p_env);
291}
292
293// Tonemap
294
295void RendererSceneRender::environment_set_tonemap(RID p_env, RS::EnvironmentToneMapper p_tone_mapper, float p_exposure, float p_white) {
296 environment_storage.environment_set_tonemap(p_env, p_tone_mapper, p_exposure, p_white);
297}
298
299RS::EnvironmentToneMapper RendererSceneRender::environment_get_tone_mapper(RID p_env) const {
300 return environment_storage.environment_get_tone_mapper(p_env);
301}
302
303float RendererSceneRender::environment_get_exposure(RID p_env) const {
304 return environment_storage.environment_get_exposure(p_env);
305}
306
307float RendererSceneRender::environment_get_white(RID p_env) const {
308 return environment_storage.environment_get_white(p_env);
309}
310
311// Fog
312
313void RendererSceneRender::environment_set_fog(RID p_env, bool p_enable, const Color &p_light_color, float p_light_energy, float p_sun_scatter, float p_density, float p_height, float p_height_density, float p_aerial_perspective, float p_sky_affect) {
314 environment_storage.environment_set_fog(p_env, p_enable, p_light_color, p_light_energy, p_sun_scatter, p_density, p_height, p_height_density, p_aerial_perspective, p_sky_affect);
315}
316
317bool RendererSceneRender::environment_get_fog_enabled(RID p_env) const {
318 return environment_storage.environment_get_fog_enabled(p_env);
319}
320
321Color RendererSceneRender::environment_get_fog_light_color(RID p_env) const {
322 return environment_storage.environment_get_fog_light_color(p_env);
323}
324
325float RendererSceneRender::environment_get_fog_light_energy(RID p_env) const {
326 return environment_storage.environment_get_fog_light_energy(p_env);
327}
328
329float RendererSceneRender::environment_get_fog_sun_scatter(RID p_env) const {
330 return environment_storage.environment_get_fog_sun_scatter(p_env);
331}
332
333float RendererSceneRender::environment_get_fog_density(RID p_env) const {
334 return environment_storage.environment_get_fog_density(p_env);
335}
336
337float RendererSceneRender::environment_get_fog_sky_affect(RID p_env) const {
338 return environment_storage.environment_get_fog_sky_affect(p_env);
339}
340
341float RendererSceneRender::environment_get_fog_height(RID p_env) const {
342 return environment_storage.environment_get_fog_height(p_env);
343}
344
345float RendererSceneRender::environment_get_fog_height_density(RID p_env) const {
346 return environment_storage.environment_get_fog_height_density(p_env);
347}
348
349float RendererSceneRender::environment_get_fog_aerial_perspective(RID p_env) const {
350 return environment_storage.environment_get_fog_aerial_perspective(p_env);
351}
352
353// Volumetric Fog
354
355void RendererSceneRender::environment_set_volumetric_fog(RID p_env, bool p_enable, float p_density, const Color &p_albedo, const Color &p_emission, float p_emission_energy, float p_anisotropy, float p_length, float p_detail_spread, float p_gi_inject, bool p_temporal_reprojection, float p_temporal_reprojection_amount, float p_ambient_inject, float p_sky_affect) {
356 environment_storage.environment_set_volumetric_fog(p_env, p_enable, p_density, p_albedo, p_emission, p_emission_energy, p_anisotropy, p_length, p_detail_spread, p_gi_inject, p_temporal_reprojection, p_temporal_reprojection_amount, p_ambient_inject, p_sky_affect);
357}
358
359bool RendererSceneRender::environment_get_volumetric_fog_enabled(RID p_env) const {
360 return environment_storage.environment_get_volumetric_fog_enabled(p_env);
361}
362
363float RendererSceneRender::environment_get_volumetric_fog_density(RID p_env) const {
364 return environment_storage.environment_get_volumetric_fog_density(p_env);
365}
366
367Color RendererSceneRender::environment_get_volumetric_fog_scattering(RID p_env) const {
368 return environment_storage.environment_get_volumetric_fog_scattering(p_env);
369}
370
371Color RendererSceneRender::environment_get_volumetric_fog_emission(RID p_env) const {
372 return environment_storage.environment_get_volumetric_fog_emission(p_env);
373}
374
375float RendererSceneRender::environment_get_volumetric_fog_emission_energy(RID p_env) const {
376 return environment_storage.environment_get_volumetric_fog_emission_energy(p_env);
377}
378
379float RendererSceneRender::environment_get_volumetric_fog_anisotropy(RID p_env) const {
380 return environment_storage.environment_get_volumetric_fog_anisotropy(p_env);
381}
382
383float RendererSceneRender::environment_get_volumetric_fog_length(RID p_env) const {
384 return environment_storage.environment_get_volumetric_fog_length(p_env);
385}
386
387float RendererSceneRender::environment_get_volumetric_fog_detail_spread(RID p_env) const {
388 return environment_storage.environment_get_volumetric_fog_detail_spread(p_env);
389}
390
391float RendererSceneRender::environment_get_volumetric_fog_gi_inject(RID p_env) const {
392 return environment_storage.environment_get_volumetric_fog_gi_inject(p_env);
393}
394
395float RendererSceneRender::environment_get_volumetric_fog_sky_affect(RID p_env) const {
396 return environment_storage.environment_get_volumetric_fog_sky_affect(p_env);
397}
398
399bool RendererSceneRender::environment_get_volumetric_fog_temporal_reprojection(RID p_env) const {
400 return environment_storage.environment_get_volumetric_fog_temporal_reprojection(p_env);
401}
402
403float RendererSceneRender::environment_get_volumetric_fog_temporal_reprojection_amount(RID p_env) const {
404 return environment_storage.environment_get_volumetric_fog_temporal_reprojection_amount(p_env);
405}
406
407float RendererSceneRender::environment_get_volumetric_fog_ambient_inject(RID p_env) const {
408 return environment_storage.environment_get_volumetric_fog_ambient_inject(p_env);
409}
410
411// GLOW
412
413void RendererSceneRender::environment_set_glow(RID p_env, bool p_enable, Vector<float> p_levels, float p_intensity, float p_strength, float p_mix, float p_bloom_threshold, RS::EnvironmentGlowBlendMode p_blend_mode, float p_hdr_bleed_threshold, float p_hdr_bleed_scale, float p_hdr_luminance_cap, float p_glow_map_strength, RID p_glow_map) {
414 environment_storage.environment_set_glow(p_env, p_enable, p_levels, p_intensity, p_strength, p_mix, p_bloom_threshold, p_blend_mode, p_hdr_bleed_threshold, p_hdr_bleed_scale, p_hdr_luminance_cap, p_glow_map_strength, p_glow_map);
415}
416
417bool RendererSceneRender::environment_get_glow_enabled(RID p_env) const {
418 return environment_storage.environment_get_glow_enabled(p_env);
419}
420
421Vector<float> RendererSceneRender::environment_get_glow_levels(RID p_env) const {
422 return environment_storage.environment_get_glow_levels(p_env);
423}
424
425float RendererSceneRender::environment_get_glow_intensity(RID p_env) const {
426 return environment_storage.environment_get_glow_intensity(p_env);
427}
428
429float RendererSceneRender::environment_get_glow_strength(RID p_env) const {
430 return environment_storage.environment_get_glow_strength(p_env);
431}
432
433float RendererSceneRender::environment_get_glow_bloom(RID p_env) const {
434 return environment_storage.environment_get_glow_bloom(p_env);
435}
436
437float RendererSceneRender::environment_get_glow_mix(RID p_env) const {
438 return environment_storage.environment_get_glow_mix(p_env);
439}
440
441RS::EnvironmentGlowBlendMode RendererSceneRender::environment_get_glow_blend_mode(RID p_env) const {
442 return environment_storage.environment_get_glow_blend_mode(p_env);
443}
444
445float RendererSceneRender::environment_get_glow_hdr_bleed_threshold(RID p_env) const {
446 return environment_storage.environment_get_glow_hdr_bleed_threshold(p_env);
447}
448
449float RendererSceneRender::environment_get_glow_hdr_luminance_cap(RID p_env) const {
450 return environment_storage.environment_get_glow_hdr_luminance_cap(p_env);
451}
452
453float RendererSceneRender::environment_get_glow_hdr_bleed_scale(RID p_env) const {
454 return environment_storage.environment_get_glow_hdr_bleed_scale(p_env);
455}
456
457float RendererSceneRender::environment_get_glow_map_strength(RID p_env) const {
458 return environment_storage.environment_get_glow_map_strength(p_env);
459}
460
461RID RendererSceneRender::environment_get_glow_map(RID p_env) const {
462 return environment_storage.environment_get_glow_map(p_env);
463}
464
465// SSR
466
467void RendererSceneRender::environment_set_ssr(RID p_env, bool p_enable, int p_max_steps, float p_fade_int, float p_fade_out, float p_depth_tolerance) {
468 environment_storage.environment_set_ssr(p_env, p_enable, p_max_steps, p_fade_int, p_fade_out, p_depth_tolerance);
469}
470
471bool RendererSceneRender::environment_get_ssr_enabled(RID p_env) const {
472 return environment_storage.environment_get_ssr_enabled(p_env);
473}
474
475int RendererSceneRender::environment_get_ssr_max_steps(RID p_env) const {
476 return environment_storage.environment_get_ssr_max_steps(p_env);
477}
478
479float RendererSceneRender::environment_get_ssr_fade_in(RID p_env) const {
480 return environment_storage.environment_get_ssr_fade_in(p_env);
481}
482
483float RendererSceneRender::environment_get_ssr_fade_out(RID p_env) const {
484 return environment_storage.environment_get_ssr_fade_out(p_env);
485}
486
487float RendererSceneRender::environment_get_ssr_depth_tolerance(RID p_env) const {
488 return environment_storage.environment_get_ssr_depth_tolerance(p_env);
489}
490
491// SSAO
492
493void RendererSceneRender::environment_set_ssao(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_power, float p_detail, float p_horizon, float p_sharpness, float p_light_affect, float p_ao_channel_affect) {
494 environment_storage.environment_set_ssao(p_env, p_enable, p_radius, p_intensity, p_power, p_detail, p_horizon, p_sharpness, p_light_affect, p_ao_channel_affect);
495}
496
497bool RendererSceneRender::environment_get_ssao_enabled(RID p_env) const {
498 return environment_storage.environment_get_ssao_enabled(p_env);
499}
500
501float RendererSceneRender::environment_get_ssao_radius(RID p_env) const {
502 return environment_storage.environment_get_ssao_radius(p_env);
503}
504
505float RendererSceneRender::environment_get_ssao_intensity(RID p_env) const {
506 return environment_storage.environment_get_ssao_intensity(p_env);
507}
508
509float RendererSceneRender::environment_get_ssao_power(RID p_env) const {
510 return environment_storage.environment_get_ssao_power(p_env);
511}
512
513float RendererSceneRender::environment_get_ssao_detail(RID p_env) const {
514 return environment_storage.environment_get_ssao_detail(p_env);
515}
516
517float RendererSceneRender::environment_get_ssao_horizon(RID p_env) const {
518 return environment_storage.environment_get_ssao_horizon(p_env);
519}
520
521float RendererSceneRender::environment_get_ssao_sharpness(RID p_env) const {
522 return environment_storage.environment_get_ssao_sharpness(p_env);
523}
524
525float RendererSceneRender::environment_get_ssao_direct_light_affect(RID p_env) const {
526 return environment_storage.environment_get_ssao_direct_light_affect(p_env);
527}
528
529float RendererSceneRender::environment_get_ssao_ao_channel_affect(RID p_env) const {
530 return environment_storage.environment_get_ssao_ao_channel_affect(p_env);
531}
532
533// SSIL
534
535void RendererSceneRender::environment_set_ssil(RID p_env, bool p_enable, float p_radius, float p_intensity, float p_sharpness, float p_normal_rejection) {
536 environment_storage.environment_set_ssil(p_env, p_enable, p_radius, p_intensity, p_sharpness, p_normal_rejection);
537}
538
539bool RendererSceneRender::environment_get_ssil_enabled(RID p_env) const {
540 return environment_storage.environment_get_ssil_enabled(p_env);
541}
542
543float RendererSceneRender::environment_get_ssil_radius(RID p_env) const {
544 return environment_storage.environment_get_ssil_radius(p_env);
545}
546
547float RendererSceneRender::environment_get_ssil_intensity(RID p_env) const {
548 return environment_storage.environment_get_ssil_intensity(p_env);
549}
550
551float RendererSceneRender::environment_get_ssil_sharpness(RID p_env) const {
552 return environment_storage.environment_get_ssil_sharpness(p_env);
553}
554
555float RendererSceneRender::environment_get_ssil_normal_rejection(RID p_env) const {
556 return environment_storage.environment_get_ssil_normal_rejection(p_env);
557}
558
559// SDFGI
560
561void RendererSceneRender::environment_set_sdfgi(RID p_env, bool p_enable, int p_cascades, float p_min_cell_size, RS::EnvironmentSDFGIYScale p_y_scale, bool p_use_occlusion, float p_bounce_feedback, bool p_read_sky, float p_energy, float p_normal_bias, float p_probe_bias) {
562 environment_storage.environment_set_sdfgi(p_env, p_enable, p_cascades, p_min_cell_size, p_y_scale, p_use_occlusion, p_bounce_feedback, p_read_sky, p_energy, p_normal_bias, p_probe_bias);
563}
564
565bool RendererSceneRender::environment_get_sdfgi_enabled(RID p_env) const {
566 return environment_storage.environment_get_sdfgi_enabled(p_env);
567}
568
569int RendererSceneRender::environment_get_sdfgi_cascades(RID p_env) const {
570 return environment_storage.environment_get_sdfgi_cascades(p_env);
571}
572
573float RendererSceneRender::environment_get_sdfgi_min_cell_size(RID p_env) const {
574 return environment_storage.environment_get_sdfgi_min_cell_size(p_env);
575}
576
577bool RendererSceneRender::environment_get_sdfgi_use_occlusion(RID p_env) const {
578 return environment_storage.environment_get_sdfgi_use_occlusion(p_env);
579}
580
581float RendererSceneRender::environment_get_sdfgi_bounce_feedback(RID p_env) const {
582 return environment_storage.environment_get_sdfgi_bounce_feedback(p_env);
583}
584
585bool RendererSceneRender::environment_get_sdfgi_read_sky_light(RID p_env) const {
586 return environment_storage.environment_get_sdfgi_read_sky_light(p_env);
587}
588
589float RendererSceneRender::environment_get_sdfgi_energy(RID p_env) const {
590 return environment_storage.environment_get_sdfgi_energy(p_env);
591}
592
593float RendererSceneRender::environment_get_sdfgi_normal_bias(RID p_env) const {
594 return environment_storage.environment_get_sdfgi_normal_bias(p_env);
595}
596
597float RendererSceneRender::environment_get_sdfgi_probe_bias(RID p_env) const {
598 return environment_storage.environment_get_sdfgi_probe_bias(p_env);
599}
600
601RS::EnvironmentSDFGIYScale RendererSceneRender::environment_get_sdfgi_y_scale(RID p_env) const {
602 return environment_storage.environment_get_sdfgi_y_scale(p_env);
603}
604
605// Adjustments
606
607void RendererSceneRender::environment_set_adjustment(RID p_env, bool p_enable, float p_brightness, float p_contrast, float p_saturation, bool p_use_1d_color_correction, RID p_color_correction) {
608 environment_storage.environment_set_adjustment(p_env, p_enable, p_brightness, p_contrast, p_saturation, p_use_1d_color_correction, p_color_correction);
609}
610
611bool RendererSceneRender::environment_get_adjustments_enabled(RID p_env) const {
612 return environment_storage.environment_get_adjustments_enabled(p_env);
613}
614
615float RendererSceneRender::environment_get_adjustments_brightness(RID p_env) const {
616 return environment_storage.environment_get_adjustments_brightness(p_env);
617}
618
619float RendererSceneRender::environment_get_adjustments_contrast(RID p_env) const {
620 return environment_storage.environment_get_adjustments_contrast(p_env);
621}
622
623float RendererSceneRender::environment_get_adjustments_saturation(RID p_env) const {
624 return environment_storage.environment_get_adjustments_saturation(p_env);
625}
626
627bool RendererSceneRender::environment_get_use_1d_color_correction(RID p_env) const {
628 return environment_storage.environment_get_use_1d_color_correction(p_env);
629}
630
631RID RendererSceneRender::environment_get_color_correction(RID p_env) const {
632 return environment_storage.environment_get_color_correction(p_env);
633}
634