feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -205,9 +205,9 @@ void Fog::init_fog_shader(uint32_t p_max_directional_lights, int p_roughness_lay
|
|||
ShaderCompiler::DefaultIdentifierActions actions;
|
||||
|
||||
actions.renames["TIME"] = "scene_params.time";
|
||||
actions.renames["PI"] = _MKSTR(Math_PI);
|
||||
actions.renames["TAU"] = _MKSTR(Math_TAU);
|
||||
actions.renames["E"] = _MKSTR(Math_E);
|
||||
actions.renames["PI"] = String::num(Math::PI);
|
||||
actions.renames["TAU"] = String::num(Math::TAU);
|
||||
actions.renames["E"] = String::num(Math::E);
|
||||
actions.renames["WORLD_POSITION"] = "world.xyz";
|
||||
actions.renames["OBJECT_POSITION"] = "params.position";
|
||||
actions.renames["UVW"] = "uvw";
|
||||
|
|
@ -437,8 +437,7 @@ void Fog::VolumetricFog::init(const Vector3i &fog_size, RID p_sky_shader) {
|
|||
|
||||
#if defined(MACOS_ENABLED) || defined(IOS_ENABLED)
|
||||
Vector<uint8_t> dm;
|
||||
dm.resize(fog_size.x * fog_size.y * fog_size.z * 4);
|
||||
dm.fill(0);
|
||||
dm.resize_zeroed(fog_size.x * fog_size.y * fog_size.z * 4);
|
||||
|
||||
density_map = RD::get_singleton()->storage_buffer_create(dm.size(), dm);
|
||||
RD::get_singleton()->set_resource_name(density_map, "Fog density map");
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef FOG_RD_H
|
||||
#define FOG_RD_H
|
||||
#pragma once
|
||||
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
|
|
@ -355,5 +354,3 @@ public:
|
|||
};
|
||||
|
||||
} // namespace RendererRD
|
||||
|
||||
#endif // FOG_RD_H
|
||||
|
|
|
|||
|
|
@ -1214,7 +1214,7 @@ void GI::SDFGI::update(RID p_env, const Vector3 &p_world_position) {
|
|||
|
||||
if (cascade.dirty_regions[j] == 0) {
|
||||
continue; // not dirty
|
||||
} else if (uint32_t(ABS(cascade.dirty_regions[j])) >= cascade_size) {
|
||||
} else if (uint32_t(Math::abs(cascade.dirty_regions[j])) >= cascade_size) {
|
||||
//moved too much, just redraw everything (make all dirty)
|
||||
cascade.dirty_regions = SDFGI::Cascade::DIRTY_ALL;
|
||||
break;
|
||||
|
|
@ -1226,7 +1226,7 @@ void GI::SDFGI::update(RID p_env, const Vector3 &p_world_position) {
|
|||
uint32_t total_volume = cascade_size * cascade_size * cascade_size;
|
||||
uint32_t safe_volume = 1;
|
||||
for (int j = 0; j < 3; j++) {
|
||||
safe_volume *= cascade_size - ABS(cascade.dirty_regions[j]);
|
||||
safe_volume *= cascade_size - Math::abs(cascade.dirty_regions[j]);
|
||||
}
|
||||
uint32_t dirty_volume = total_volume - safe_volume;
|
||||
if (dirty_volume > (safe_volume / 2)) {
|
||||
|
|
@ -1674,7 +1674,7 @@ void GI::SDFGI::debug_probes(RID p_framebuffer, const uint32_t p_view_count, con
|
|||
push_constant.band_power = 4;
|
||||
push_constant.sections_in_band = ((band_points / 2) - 1);
|
||||
push_constant.band_mask = band_points - 2;
|
||||
push_constant.section_arc = Math_TAU / float(push_constant.sections_in_band);
|
||||
push_constant.section_arc = Math::TAU / float(push_constant.sections_in_band);
|
||||
push_constant.y_mult = y_mult;
|
||||
|
||||
uint32_t total_points = push_constant.sections_in_band * band_points;
|
||||
|
|
@ -1977,11 +1977,11 @@ void GI::SDFGI::pre_process_gi(const Transform3D &p_transform, RenderDataRD *p_r
|
|||
|
||||
// Convert from Luminous Power to Luminous Intensity
|
||||
if (lights[idx].type == RS::LIGHT_OMNI) {
|
||||
lights[idx].energy *= 1.0 / (Math_PI * 4.0);
|
||||
lights[idx].energy *= 1.0 / (Math::PI * 4.0);
|
||||
} else if (lights[idx].type == RS::LIGHT_SPOT) {
|
||||
// Spot Lights are not physically accurate, Luminous Intensity should change in relation to the cone angle.
|
||||
// We make this assumption to keep them easy to control.
|
||||
lights[idx].energy *= 1.0 / Math_PI;
|
||||
lights[idx].energy *= 1.0 / Math::PI;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2079,9 +2079,9 @@ void GI::SDFGI::render_region(Ref<RenderSceneBuffersRD> p_render_buffers, int p_
|
|||
|
||||
Vector3i dirty = cascades[cascade].dirty_regions;
|
||||
Vector3i groups;
|
||||
groups.x = cascade_size - ABS(dirty.x);
|
||||
groups.y = cascade_size - ABS(dirty.y);
|
||||
groups.z = cascade_size - ABS(dirty.z);
|
||||
groups.x = cascade_size - Math::abs(dirty.x);
|
||||
groups.y = cascade_size - Math::abs(dirty.y);
|
||||
groups.z = cascade_size - Math::abs(dirty.z);
|
||||
|
||||
RD::get_singleton()->compute_list_set_push_constant(compute_list, &push_constant, sizeof(SDFGIShader::PreprocessPushConstant));
|
||||
RD::get_singleton()->compute_list_dispatch_threads(compute_list, groups.x, groups.y, groups.z);
|
||||
|
|
@ -2440,11 +2440,11 @@ void GI::SDFGI::render_static_lights(RenderDataRD *p_render_data, Ref<RenderScen
|
|||
|
||||
// Convert from Luminous Power to Luminous Intensity
|
||||
if (lights[idx].type == RS::LIGHT_OMNI) {
|
||||
lights[idx].energy *= 1.0 / (Math_PI * 4.0);
|
||||
lights[idx].energy *= 1.0 / (Math::PI * 4.0);
|
||||
} else if (lights[idx].type == RS::LIGHT_SPOT) {
|
||||
// Spot Lights are not physically accurate, Luminous Intensity should change in relation to the cone angle.
|
||||
// We make this assumption to keep them easy to control.
|
||||
lights[idx].energy *= 1.0 / Math_PI;
|
||||
lights[idx].energy *= 1.0 / Math::PI;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2676,13 +2676,13 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vector<RID
|
|||
dtf.format = RD::DATA_FORMAT_R16G16B16A16_SFLOAT;
|
||||
dtf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT;
|
||||
|
||||
if (dynamic_maps.size() == 0) {
|
||||
if (dynamic_maps.is_empty()) {
|
||||
dtf.usage_bits |= RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
}
|
||||
dmap.texture = RD::get_singleton()->texture_create(dtf, RD::TextureView());
|
||||
RD::get_singleton()->set_resource_name(dmap.texture, "VoxelGI Instance DMap Texture");
|
||||
|
||||
if (dynamic_maps.size() == 0) {
|
||||
if (dynamic_maps.is_empty()) {
|
||||
// Render depth for first one.
|
||||
// Use 16-bit depth when supported to improve performance.
|
||||
dtf.format = RD::get_singleton()->texture_is_format_supported_for_usage(RD::DATA_FORMAT_D16_UNORM, RD::TEXTURE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT) ? RD::DATA_FORMAT_D16_UNORM : RD::DATA_FORMAT_X8_D24_UNORM_PACK32;
|
||||
|
|
@ -2698,7 +2698,7 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vector<RID
|
|||
dmap.depth = RD::get_singleton()->texture_create(dtf, RD::TextureView());
|
||||
RD::get_singleton()->set_resource_name(dmap.depth, "VoxelGI Instance DMap Depth");
|
||||
|
||||
if (dynamic_maps.size() == 0) {
|
||||
if (dynamic_maps.is_empty()) {
|
||||
dtf.format = RD::DATA_FORMAT_R8G8B8A8_UNORM;
|
||||
dtf.usage_bits = RD::TEXTURE_USAGE_STORAGE_BIT | RD::TEXTURE_USAGE_COLOR_ATTACHMENT_BIT;
|
||||
dmap.albedo = RD::get_singleton()->texture_create(dtf, RD::TextureView());
|
||||
|
|
@ -2906,11 +2906,11 @@ void GI::VoxelGIInstance::update(bool p_update_light_instances, const Vector<RID
|
|||
|
||||
// Convert from Luminous Power to Luminous Intensity
|
||||
if (l.type == RS::LIGHT_OMNI) {
|
||||
l.energy *= 1.0 / (Math_PI * 4.0);
|
||||
l.energy *= 1.0 / (Math::PI * 4.0);
|
||||
} else if (l.type == RS::LIGHT_SPOT) {
|
||||
// Spot Lights are not physically accurate, Luminous Intensity should change in relation to the cone angle.
|
||||
// We make this assumption to keep them easy to control.
|
||||
l.energy *= 1.0 / Math_PI;
|
||||
l.energy *= 1.0 / Math::PI;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3279,7 +3279,7 @@ void GI::VoxelGIInstance::free_resources() {
|
|||
void GI::VoxelGIInstance::debug(RD::DrawListID p_draw_list, RID p_framebuffer, const Projection &p_camera_with_transform, bool p_lighting, bool p_emission, float p_alpha) {
|
||||
RendererRD::MaterialStorage *material_storage = RendererRD::MaterialStorage::get_singleton();
|
||||
|
||||
if (mipmaps.size() == 0) {
|
||||
if (mipmaps.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef GI_RD_H
|
||||
#define GI_RD_H
|
||||
#pragma once
|
||||
|
||||
#include "core/templates/local_vector.h"
|
||||
#include "core/templates/rid_owner.h"
|
||||
|
|
@ -829,5 +828,3 @@ public:
|
|||
};
|
||||
|
||||
} // namespace RendererRD
|
||||
|
||||
#endif // GI_RD_H
|
||||
|
|
|
|||
|
|
@ -722,6 +722,12 @@ SkyRD::SkyRD() {
|
|||
roughness_layers = GLOBAL_GET("rendering/reflections/sky_reflections/roughness_layers");
|
||||
sky_ggx_samples_quality = GLOBAL_GET("rendering/reflections/sky_reflections/ggx_samples");
|
||||
sky_use_cubemap_array = GLOBAL_GET("rendering/reflections/sky_reflections/texture_array_reflections");
|
||||
#if defined(MACOS_ENABLED) && defined(__x86_64__)
|
||||
if (OS::get_singleton()->get_current_rendering_driver_name() == "vulkan" && RenderingServer::get_singleton()->get_video_adapter_name().contains("Intel")) {
|
||||
// Disable texture array reflections on macOS on Intel GPUs due to driver bugs.
|
||||
sky_use_cubemap_array = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SkyRD::init() {
|
||||
|
|
@ -777,9 +783,9 @@ void SkyRD::init() {
|
|||
actions.renames["SCREEN_UV"] = "uv";
|
||||
actions.renames["FRAGCOORD"] = "gl_FragCoord";
|
||||
actions.renames["TIME"] = "params.time";
|
||||
actions.renames["PI"] = _MKSTR(Math_PI);
|
||||
actions.renames["TAU"] = _MKSTR(Math_TAU);
|
||||
actions.renames["E"] = _MKSTR(Math_E);
|
||||
actions.renames["PI"] = String::num(Math::PI);
|
||||
actions.renames["TAU"] = String::num(Math::TAU);
|
||||
actions.renames["E"] = String::num(Math::E);
|
||||
actions.renames["HALF_RES_COLOR"] = "half_res_color";
|
||||
actions.renames["QUARTER_RES_COLOR"] = "quarter_res_color";
|
||||
actions.renames["RADIANCE"] = "radiance";
|
||||
|
|
@ -1093,15 +1099,7 @@ void SkyRD::setup_sky(const RenderDataRD *p_render_data, const Size2i p_screen_s
|
|||
sky_light_data.enabled = true;
|
||||
|
||||
float angular_diameter = light_storage->light_get_param(base, RS::LIGHT_PARAM_SIZE);
|
||||
if (angular_diameter > 0.0) {
|
||||
// I know tan(0) is 0, but let's not risk it with numerical precision.
|
||||
// Technically this will keep expanding until reaching the sun, but all we care about
|
||||
// is expanding until we reach the radius of the near plane. There can't be more occluders than that.
|
||||
angular_diameter = Math::tan(Math::deg_to_rad(angular_diameter));
|
||||
} else {
|
||||
angular_diameter = 0.0;
|
||||
}
|
||||
sky_light_data.size = angular_diameter;
|
||||
sky_light_data.size = Math::deg_to_rad(angular_diameter);
|
||||
sky_scene_state.ubo.directional_light_count++;
|
||||
if (sky_scene_state.ubo.directional_light_count >= sky_scene_state.max_directional_lights) {
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef SKY_RD_H
|
||||
#define SKY_RD_H
|
||||
#pragma once
|
||||
|
||||
#include "core/templates/rid_owner.h"
|
||||
#include "servers/rendering/renderer_compositor.h"
|
||||
|
|
@ -319,5 +318,3 @@ public:
|
|||
};
|
||||
|
||||
} // namespace RendererRD
|
||||
|
||||
#endif // SKY_RD_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue