godot/servers/rendering/renderer_rd/storage_rd/light_storage.cpp

/**************************************************************************/
/*  light_storage.cpp                                                     */
/**************************************************************************/
/*                         This file is part of:                          */
/*                             GODOT ENGINE                               */
/*                        https://godotengine.org                         */
/**************************************************************************/
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur.                  */
/*                                                                        */
/* Permission is hereby granted, free of charge, to any person obtaining  */
/* a copy of this software and associated documentation files (the        */
/* "Software"), to deal in the Software without restriction, including    */
/* without limitation the rights to use, copy, modify, merge, publish,    */
/* distribute, sublicense, and/or sell copies of the Software, and to     */
/* permit persons to whom the Software is furnished to do so, subject to  */
/* the following conditions:                                              */
/*                                                                        */
/* The above copyright notice and this permission notice shall be         */
/* included in all copies or substantial portions of the Software.        */
/*                                                                        */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,        */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF     */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY   */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,   */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE      */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                 */
/**************************************************************************/

#include "light_storage.h"
#include "core/config/project_settings.h"
#include "servers/rendering/renderer_rd/renderer_scene_render_rd.h"
#include "texture_storage.h"

usingnamespaceRendererRD;

LightStorage *LightStorage::singleton =;

LightStorage *LightStorage::get_singleton() {}

LightStorage::LightStorage() {}

LightStorage::~LightStorage() {}

bool LightStorage::free(RID p_rid) {}

/* LIGHT */

void LightStorage::_light_initialize(RID p_light, RS::LightType p_type) {}

RID LightStorage::directional_light_allocate() {}

void LightStorage::directional_light_initialize(RID p_light) {}

RID LightStorage::omni_light_allocate() {}

void LightStorage::omni_light_initialize(RID p_light) {}

RID LightStorage::spot_light_allocate() {}

void LightStorage::spot_light_initialize(RID p_light) {}

void LightStorage::light_free(RID p_rid) {}

void LightStorage::light_set_color(RID p_light, const Color &p_color) {}

void LightStorage::light_set_param(RID p_light, RS::LightParam p_param, float p_value) {}

void LightStorage::light_set_shadow(RID p_light, bool p_enabled) {}

void LightStorage::light_set_projector(RID p_light, RID p_texture) {}

void LightStorage::light_set_negative(RID p_light, bool p_enable) {}

void LightStorage::light_set_cull_mask(RID p_light, uint32_t p_mask) {}

void LightStorage::light_set_distance_fade(RID p_light, bool p_enabled, float p_begin, float p_shadow, float p_length) {}

void LightStorage::light_set_reverse_cull_face_mode(RID p_light, bool p_enabled) {}

void LightStorage::light_set_shadow_caster_mask(RID p_light, uint32_t p_caster_mask) {}

uint32_t LightStorage::light_get_shadow_caster_mask(RID p_light) const {}

void LightStorage::light_set_bake_mode(RID p_light, RS::LightBakeMode p_bake_mode) {}

void LightStorage::light_set_max_sdfgi_cascade(RID p_light, uint32_t p_cascade) {}

void LightStorage::light_omni_set_shadow_mode(RID p_light, RS::LightOmniShadowMode p_mode) {}

RS::LightOmniShadowMode LightStorage::light_omni_get_shadow_mode(RID p_light) {}

void LightStorage::light_directional_set_shadow_mode(RID p_light, RS::LightDirectionalShadowMode p_mode) {}

void LightStorage::light_directional_set_blend_splits(RID p_light, bool p_enable) {}

bool LightStorage::light_directional_get_blend_splits(RID p_light) const {}

void LightStorage::light_directional_set_sky_mode(RID p_light, RS::LightDirectionalSkyMode p_mode) {}

RS::LightDirectionalSkyMode LightStorage::light_directional_get_sky_mode(RID p_light) const {}

RS::LightDirectionalShadowMode LightStorage::light_directional_get_shadow_mode(RID p_light) {}

uint32_t LightStorage::light_get_max_sdfgi_cascade(RID p_light) {}

RS::LightBakeMode LightStorage::light_get_bake_mode(RID p_light) {}

uint64_t LightStorage::light_get_version(RID p_light) const {}

uint32_t LightStorage::light_get_cull_mask(RID p_light) const {}

AABB LightStorage::light_get_aabb(RID p_light) const {}

Dependency *LightStorage::light_get_dependency(RID p_light) const {}

/* LIGHT INSTANCE API */

RID LightStorage::light_instance_create(RID p_light) {}

void LightStorage::light_instance_free(RID p_light) {}

void LightStorage::light_instance_set_transform(RID p_light_instance, const Transform3D &p_transform) {}

void LightStorage::light_instance_set_aabb(RID p_light_instance, const AABB &p_aabb) {}

void LightStorage::light_instance_set_shadow_transform(RID p_light_instance, const Projection &p_projection, const Transform3D &p_transform, float p_far, float p_split, int p_pass, float p_shadow_texel_size, float p_bias_scale, float p_range_begin, const Vector2 &p_uv_scale) {}

void LightStorage::light_instance_mark_visible(RID p_light_instance) {}

/* LIGHT DATA */

void LightStorage::free_light_data() {}

void LightStorage::set_max_lights(const uint32_t p_max_lights) {}

void LightStorage::update_light_buffers(RenderDataRD *p_render_data, const PagedArray<RID> &p_lights, const Transform3D &p_camera_transform, RID p_shadow_atlas, bool p_using_shadows, uint32_t &r_directional_light_count, uint32_t &r_positional_light_count, bool &r_directional_light_soft_shadows) {}

/* REFLECTION PROBE */

RID LightStorage::reflection_probe_allocate() {}

void LightStorage::reflection_probe_initialize(RID p_reflection_probe) {}

void LightStorage::reflection_probe_free(RID p_rid) {}

void LightStorage::reflection_probe_set_update_mode(RID p_probe, RS::ReflectionProbeUpdateMode p_mode) {}

void LightStorage::reflection_probe_set_intensity(RID p_probe, float p_intensity) {}

void LightStorage::reflection_probe_set_ambient_mode(RID p_probe, RS::ReflectionProbeAmbientMode p_mode) {}

void LightStorage::reflection_probe_set_ambient_color(RID p_probe, const Color &p_color) {}

void LightStorage::reflection_probe_set_ambient_energy(RID p_probe, float p_energy) {}

void LightStorage::reflection_probe_set_max_distance(RID p_probe, float p_distance) {}

void LightStorage::reflection_probe_set_size(RID p_probe, const Vector3 &p_size) {}

void LightStorage::reflection_probe_set_origin_offset(RID p_probe, const Vector3 &p_offset) {}

void LightStorage::reflection_probe_set_as_interior(RID p_probe, bool p_enable) {}

void LightStorage::reflection_probe_set_enable_box_projection(RID p_probe, bool p_enable) {}

void LightStorage::reflection_probe_set_enable_shadows(RID p_probe, bool p_enable) {}

void LightStorage::reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) {}

void LightStorage::reflection_probe_set_reflection_mask(RID p_probe, uint32_t p_layers) {}

void LightStorage::reflection_probe_set_resolution(RID p_probe, int p_resolution) {}

void LightStorage::reflection_probe_set_mesh_lod_threshold(RID p_probe, float p_ratio) {}

void LightStorage::reflection_probe_set_baked_exposure(RID p_probe, float p_exposure) {}

AABB LightStorage::reflection_probe_get_aabb(RID p_probe) const {}

RS::ReflectionProbeUpdateMode LightStorage::reflection_probe_get_update_mode(RID p_probe) const {}

uint32_t LightStorage::reflection_probe_get_cull_mask(RID p_probe) const {}

uint32_t LightStorage::reflection_probe_get_reflection_mask(RID p_probe) const {}

Vector3 LightStorage::reflection_probe_get_size(RID p_probe) const {}

Vector3 LightStorage::reflection_probe_get_origin_offset(RID p_probe) const {}

bool LightStorage::reflection_probe_renders_shadows(RID p_probe) const {}

float LightStorage::reflection_probe_get_origin_max_distance(RID p_probe) const {}

float LightStorage::reflection_probe_get_mesh_lod_threshold(RID p_probe) const {}

int LightStorage::reflection_probe_get_resolution(RID p_probe) const {}

float LightStorage::reflection_probe_get_baked_exposure(RID p_probe) const {}

float LightStorage::reflection_probe_get_intensity(RID p_probe) const {}

bool LightStorage::reflection_probe_is_interior(RID p_probe) const {}

bool LightStorage::reflection_probe_is_box_projection(RID p_probe) const {}

RS::ReflectionProbeAmbientMode LightStorage::reflection_probe_get_ambient_mode(RID p_probe) const {}

Color LightStorage::reflection_probe_get_ambient_color(RID p_probe) const {}
float LightStorage::reflection_probe_get_ambient_color_energy(RID p_probe) const {}

Dependency *LightStorage::reflection_probe_get_dependency(RID p_probe) const {}

/* REFLECTION ATLAS */

RID LightStorage::reflection_atlas_create() {}

void LightStorage::reflection_atlas_free(RID p_ref_atlas) {}

void LightStorage::reflection_atlas_set_size(RID p_ref_atlas, int p_reflection_size, int p_reflection_count) {}

int LightStorage::reflection_atlas_get_size(RID p_ref_atlas) const {}

/* REFLECTION PROBE INSTANCE */

RID LightStorage::reflection_probe_instance_create(RID p_probe) {}

void LightStorage::reflection_probe_instance_free(RID p_instance) {}

void LightStorage::reflection_probe_instance_set_transform(RID p_instance, const Transform3D &p_transform) {}

bool LightStorage::reflection_probe_has_atlas_index(RID p_instance) {}

void LightStorage::reflection_probe_release_atlas_index(RID p_instance) {}

bool LightStorage::reflection_probe_instance_needs_redraw(RID p_instance) {}

bool LightStorage::reflection_probe_instance_has_reflection(RID p_instance) {}

bool LightStorage::reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) {}

Ref<RenderSceneBuffers> LightStorage::reflection_probe_atlas_get_render_buffers(RID p_reflection_atlas) {}

bool LightStorage::reflection_probe_instance_postprocess_step(RID p_instance) {}

uint32_t LightStorage::reflection_probe_instance_get_resolution(RID p_instance) {}

RID LightStorage::reflection_probe_instance_get_framebuffer(RID p_instance, int p_index) {}

RID LightStorage::reflection_probe_instance_get_depth_framebuffer(RID p_instance, int p_index) {}

ClusterBuilderRD *LightStorage::reflection_probe_instance_get_cluster_builder(RID p_instance, ClusterBuilderSharedDataRD *p_cluster_builder_shared) {}

/* REFLECTION DATA */

void LightStorage::free_reflection_data() {}

void LightStorage::set_max_reflection_probes(const uint32_t p_max_reflection_probes) {}

void LightStorage::update_reflection_probe_buffer(RenderDataRD *p_render_data, const PagedArray<RID> &p_reflections, const Transform3D &p_camera_inverse_transform, RID p_environment) {}

RD::DataFormat LightStorage::get_reflection_probe_color_format() {}

uint32_t LightStorage::get_reflection_probe_color_usage_bits() {}

RD::DataFormat LightStorage::get_reflection_probe_depth_format() {}

uint32_t LightStorage::get_reflection_probe_depth_usage_bits() {}

/* LIGHTMAP API */

RID LightStorage::lightmap_allocate() {}

void LightStorage::lightmap_initialize(RID p_lightmap) {}

void LightStorage::lightmap_free(RID p_rid) {}

void LightStorage::lightmap_set_textures(RID p_lightmap, RID p_light, bool p_uses_spherical_haromics) {}

void LightStorage::lightmap_set_probe_bounds(RID p_lightmap, const AABB &p_bounds) {}

void LightStorage::lightmap_set_probe_interior(RID p_lightmap, bool p_interior) {}

void LightStorage::lightmap_set_probe_capture_data(RID p_lightmap, const PackedVector3Array &p_points, const PackedColorArray &p_point_sh, const PackedInt32Array &p_tetrahedra, const PackedInt32Array &p_bsp_tree) {}

void LightStorage::lightmap_set_baked_exposure_normalization(RID p_lightmap, float p_exposure) {}

PackedVector3Array LightStorage::lightmap_get_probe_capture_points(RID p_lightmap) const {}

PackedColorArray LightStorage::lightmap_get_probe_capture_sh(RID p_lightmap) const {}

PackedInt32Array LightStorage::lightmap_get_probe_capture_tetrahedra(RID p_lightmap) const {}

PackedInt32Array LightStorage::lightmap_get_probe_capture_bsp_tree(RID p_lightmap) const {}

void LightStorage::lightmap_set_probe_capture_update_speed(float p_speed) {}

Dependency *LightStorage::lightmap_get_dependency(RID p_lightmap) const {}

void LightStorage::lightmap_tap_sh_light(RID p_lightmap, const Vector3 &p_point, Color *r_sh) {}

bool LightStorage::lightmap_is_interior(RID p_lightmap) const {}

AABB LightStorage::lightmap_get_aabb(RID p_lightmap) const {}

/* LIGHTMAP INSTANCE */

RID LightStorage::lightmap_instance_create(RID p_lightmap) {}

void LightStorage::lightmap_instance_free(RID p_lightmap) {}

void LightStorage::lightmap_instance_set_transform(RID p_lightmap, const Transform3D &p_transform) {}

/* SHADOW ATLAS API */

RID LightStorage::shadow_atlas_create() {}

void LightStorage::shadow_atlas_free(RID p_atlas) {}

void LightStorage::_update_shadow_atlas(ShadowAtlas *shadow_atlas) {}

void LightStorage::shadow_atlas_set_size(RID p_atlas, int p_size, bool p_16_bits) {}

void LightStorage::shadow_atlas_set_quadrant_subdivision(RID p_atlas, int p_quadrant, int p_subdivision) {}

bool LightStorage::_shadow_atlas_find_shadow(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow) {}

bool LightStorage::_shadow_atlas_find_omni_shadows(ShadowAtlas *shadow_atlas, int *p_in_quadrants, int p_quadrant_count, int p_current_subdiv, uint64_t p_tick, int &r_quadrant, int &r_shadow) {}

bool LightStorage::shadow_atlas_update_light(RID p_atlas, RID p_light_instance, float p_coverage, uint64_t p_light_version) {}

void LightStorage::_shadow_atlas_invalidate_shadow(ShadowAtlas::Quadrant::Shadow *p_shadow, RID p_atlas, ShadowAtlas *p_shadow_atlas, uint32_t p_quadrant, uint32_t p_shadow_idx) {}

void LightStorage::shadow_atlas_update(RID p_atlas) {}

RD::DataFormat LightStorage::get_shadow_atlas_depth_format(bool p_16_bits) {}

uint32_t LightStorage::get_shadow_atlas_depth_usage_bits() {}

/* DIRECTIONAL SHADOW */

void LightStorage::update_directional_shadow_atlas() {}
void LightStorage::directional_shadow_atlas_set_size(int p_size, bool p_16_bits) {}

void LightStorage::set_directional_shadow_count(int p_count) {}

static Rect2i _get_directional_shadow_rect(int p_size, int p_shadow_count, int p_shadow_index) {}

Rect2i LightStorage::get_directional_shadow_rect() {}

int LightStorage::get_directional_light_shadow_size(RID p_light_intance) {}

/* SHADOW CUBEMAPS */

LightStorage::ShadowCubemap *LightStorage::_get_shadow_cubemap(int p_size) {}

RID LightStorage::get_cubemap(int p_size) {}

RID LightStorage::get_cubemap_fb(int p_size, int p_pass) {}

RD::DataFormat LightStorage::get_cubemap_depth_format() {}

uint32_t LightStorage::get_cubemap_depth_usage_bits() {}

bool LightStorage::get_shadow_cubemaps_used() const {}

bool LightStorage::get_shadow_dual_paraboloid_used() const {}