Merge pull request #50040 from reduz/fix-renderingserver-bindings
Clean up RenderingServer and its bindings
This commit is contained in:
commit
ad8a2b3d52
|
@ -61,10 +61,8 @@
|
|||
</return>
|
||||
<argument index="0" name="image" type="Image">
|
||||
</argument>
|
||||
<argument index="1" name="immediate" type="bool" default="false">
|
||||
</argument>
|
||||
<description>
|
||||
Replaces the texture's data with a new [Image]. If [code]immediate[/code] is [code]true[/code], it will take effect immediately after the call.
|
||||
Replaces the texture's data with a new [Image].
|
||||
[b]Note:[/b] The texture has to be initialized first with the [method create_from_image] method before it can be updated. The new image dimensions, format, and mipmaps configuration should match the existing texture's image configuration, otherwise it has to be re-created with the [method create_from_image] method.
|
||||
Use this method over [method create_from_image] if you need to update the texture frequently, which is faster than allocating additional memory for a new texture each time.
|
||||
</description>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -66,12 +66,6 @@
|
|||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="anisotropy_strength" type="float" setter="set_anisotropy_strength" getter="get_anisotropy_strength" default="0.5">
|
||||
</member>
|
||||
<member name="ao" type="float" setter="set_ao" getter="get_ao" default="0.0">
|
||||
</member>
|
||||
<member name="ao_size" type="float" setter="set_ao_size" getter="get_ao_size" default="0.5">
|
||||
</member>
|
||||
<member name="bias" type="float" setter="set_bias" getter="get_bias" default="1.5">
|
||||
</member>
|
||||
<member name="dynamic_range" type="float" setter="set_dynamic_range" getter="get_dynamic_range" default="4.0">
|
||||
|
|
|
@ -315,7 +315,7 @@ void EditorProfiler::_update_plot() {
|
|||
graph_texture->create_from_image(img);
|
||||
}
|
||||
|
||||
graph_texture->update(img, true);
|
||||
graph_texture->update(img);
|
||||
|
||||
graph->set_texture(graph_texture);
|
||||
graph->update();
|
||||
|
|
|
@ -309,7 +309,7 @@ void EditorVisualProfiler::_update_plot() {
|
|||
graph_texture->create_from_image(img);
|
||||
}
|
||||
|
||||
graph_texture->update(img, true);
|
||||
graph_texture->update(img);
|
||||
|
||||
graph->set_texture(graph_texture);
|
||||
graph->update();
|
||||
|
|
|
@ -591,8 +591,7 @@ void EditorNode::_notification(int p_what) {
|
|||
_initializing_addons = false;
|
||||
}
|
||||
|
||||
RenderingServer::get_singleton()->viewport_set_hide_scenario(get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_disable_2d(get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_disable_environment(get_viewport()->get_viewport_rid(), true);
|
||||
|
||||
feature_profile_manager->notify_changed();
|
||||
|
@ -6119,7 +6118,6 @@ EditorNode::EditorNode() {
|
|||
scene_root->set_embed_subwindows_hint(true);
|
||||
scene_root->set_disable_3d(true);
|
||||
|
||||
RenderingServer::get_singleton()->viewport_set_hide_scenario(scene_root->get_viewport_rid(), true);
|
||||
scene_root->set_disable_input(true);
|
||||
scene_root->set_as_audio_listener_2d(true);
|
||||
|
||||
|
|
|
@ -5631,12 +5631,12 @@ void CanvasItemEditorPlugin::make_visible(bool p_visible) {
|
|||
if (p_visible) {
|
||||
canvas_item_editor->show();
|
||||
canvas_item_editor->set_physics_process(true);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), false);
|
||||
RenderingServer::get_singleton()->viewport_set_disable_2d(editor->get_scene_root()->get_viewport_rid(), false);
|
||||
|
||||
} else {
|
||||
canvas_item_editor->hide();
|
||||
canvas_item_editor->set_physics_process(false);
|
||||
RenderingServer::get_singleton()->viewport_set_hide_canvas(editor->get_scene_root()->get_viewport_rid(), true);
|
||||
RenderingServer::get_singleton()->viewport_set_disable_2d(editor->get_scene_root()->get_viewport_rid(), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7081,8 +7081,6 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
|
|||
|
||||
xform_dialog->connect("confirmed", callable_mp(this, &Node3DEditor::_xform_dialog_action));
|
||||
|
||||
scenario_debug = RenderingServer::SCENARIO_DEBUG_DISABLED;
|
||||
|
||||
selected = nullptr;
|
||||
|
||||
set_process_unhandled_key_input(true);
|
||||
|
|
|
@ -600,8 +600,6 @@ private:
|
|||
|
||||
ToolMode tool_mode;
|
||||
|
||||
RenderingServer::ScenarioDebugMode scenario_debug;
|
||||
|
||||
RID origin;
|
||||
RID origin_instance;
|
||||
bool origin_enabled;
|
||||
|
|
|
@ -185,7 +185,7 @@ void VideoStreamPlaybackGDNative::update_texture() {
|
|||
|
||||
Ref<Image> img = memnew(Image(texture_size.width, texture_size.height, 0, Image::FORMAT_RGBA8, *pba));
|
||||
|
||||
texture->update(img, true);
|
||||
texture->update(img);
|
||||
}
|
||||
|
||||
// ctor and dtor
|
||||
|
|
|
@ -108,7 +108,7 @@ void VideoStreamPlaybackTheora::video_write() {
|
|||
|
||||
Ref<Image> img = memnew(Image(size.x, size.y, 0, Image::FORMAT_RGBA8, frame_data)); //zero copy image creation
|
||||
|
||||
texture->update(img, true); //zero copy send to visual server
|
||||
texture->update(img); //zero copy send to visual server
|
||||
|
||||
frames_pending = 1;
|
||||
}
|
||||
|
|
|
@ -143,15 +143,6 @@ float VoxelGIData::get_propagation() const {
|
|||
return propagation;
|
||||
}
|
||||
|
||||
void VoxelGIData::set_anisotropy_strength(float p_anisotropy_strength) {
|
||||
RS::get_singleton()->voxel_gi_set_anisotropy_strength(probe, p_anisotropy_strength);
|
||||
anisotropy_strength = p_anisotropy_strength;
|
||||
}
|
||||
|
||||
float VoxelGIData::get_anisotropy_strength() const {
|
||||
return anisotropy_strength;
|
||||
}
|
||||
|
||||
void VoxelGIData::set_energy(float p_energy) {
|
||||
RS::get_singleton()->voxel_gi_set_energy(probe, p_energy);
|
||||
energy = p_energy;
|
||||
|
@ -161,24 +152,6 @@ float VoxelGIData::get_energy() const {
|
|||
return energy;
|
||||
}
|
||||
|
||||
void VoxelGIData::set_ao(float p_ao) {
|
||||
RS::get_singleton()->voxel_gi_set_ao(probe, p_ao);
|
||||
ao = p_ao;
|
||||
}
|
||||
|
||||
float VoxelGIData::get_ao() const {
|
||||
return ao;
|
||||
}
|
||||
|
||||
void VoxelGIData::set_ao_size(float p_ao_size) {
|
||||
RS::get_singleton()->voxel_gi_set_ao_size(probe, p_ao_size);
|
||||
ao_size = p_ao_size;
|
||||
}
|
||||
|
||||
float VoxelGIData::get_ao_size() const {
|
||||
return ao_size;
|
||||
}
|
||||
|
||||
void VoxelGIData::set_bias(float p_bias) {
|
||||
RS::get_singleton()->voxel_gi_set_bias(probe, p_bias);
|
||||
bias = p_bias;
|
||||
|
@ -219,15 +192,6 @@ RID VoxelGIData::get_rid() const {
|
|||
return probe;
|
||||
}
|
||||
|
||||
void VoxelGIData::_validate_property(PropertyInfo &property) const {
|
||||
if (property.name == "anisotropy_strength") {
|
||||
bool anisotropy_enabled = ProjectSettings::get_singleton()->get("rendering/global_illumination/voxel_gi/anisotropic");
|
||||
if (!anisotropy_enabled) {
|
||||
property.usage = PROPERTY_USAGE_NOEDITOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void VoxelGIData::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("allocate", "to_cell_xform", "aabb", "octree_size", "octree_cells", "data_cells", "distance_field", "level_counts"), &VoxelGIData::allocate);
|
||||
|
||||
|
@ -253,15 +217,6 @@ void VoxelGIData::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("set_propagation", "propagation"), &VoxelGIData::set_propagation);
|
||||
ClassDB::bind_method(D_METHOD("get_propagation"), &VoxelGIData::get_propagation);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_anisotropy_strength", "strength"), &VoxelGIData::set_anisotropy_strength);
|
||||
ClassDB::bind_method(D_METHOD("get_anisotropy_strength"), &VoxelGIData::get_anisotropy_strength);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ao", "ao"), &VoxelGIData::set_ao);
|
||||
ClassDB::bind_method(D_METHOD("get_ao"), &VoxelGIData::get_ao);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_ao_size", "strength"), &VoxelGIData::set_ao_size);
|
||||
ClassDB::bind_method(D_METHOD("get_ao_size"), &VoxelGIData::get_ao_size);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_interior", "interior"), &VoxelGIData::set_interior);
|
||||
ClassDB::bind_method(D_METHOD("is_interior"), &VoxelGIData::is_interior);
|
||||
|
||||
|
@ -278,9 +233,6 @@ void VoxelGIData::_bind_methods() {
|
|||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "bias", PROPERTY_HINT_RANGE, "0,8,0.01"), "set_bias", "get_bias");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "normal_bias", PROPERTY_HINT_RANGE, "0,8,0.01"), "set_normal_bias", "get_normal_bias");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "propagation", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_propagation", "get_propagation");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "anisotropy_strength", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_anisotropy_strength", "get_anisotropy_strength");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ao", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao", "get_ao");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "ao_size", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_ao_size", "get_ao_size");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "use_two_bounces"), "set_use_two_bounces", "is_using_two_bounces");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
|
||||
}
|
||||
|
|
|
@ -51,15 +51,11 @@ class VoxelGIData : public Resource {
|
|||
float bias = 1.5;
|
||||
float normal_bias = 0.0;
|
||||
float propagation = 0.7;
|
||||
float anisotropy_strength = 0.5;
|
||||
float ao = 0.0;
|
||||
float ao_size = 0.5;
|
||||
bool interior = false;
|
||||
bool use_two_bounces = false;
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
void _validate_property(PropertyInfo &property) const override;
|
||||
|
||||
public:
|
||||
void allocate(const Transform3D &p_to_cell_xform, const AABB &p_aabb, const Vector3 &p_octree_size, const Vector<uint8_t> &p_octree_cells, const Vector<uint8_t> &p_data_cells, const Vector<uint8_t> &p_distance_field, const Vector<int> &p_level_counts);
|
||||
|
@ -77,15 +73,6 @@ public:
|
|||
void set_propagation(float p_propagation);
|
||||
float get_propagation() const;
|
||||
|
||||
void set_anisotropy_strength(float p_anisotropy_strength);
|
||||
float get_anisotropy_strength() const;
|
||||
|
||||
void set_ao(float p_ao);
|
||||
float get_ao() const;
|
||||
|
||||
void set_ao_size(float p_ao_size);
|
||||
float get_ao_size() const;
|
||||
|
||||
void set_energy(float p_energy);
|
||||
float get_energy() const;
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ Image::Format ImageTexture::get_format() const {
|
|||
return format;
|
||||
}
|
||||
|
||||
void ImageTexture::update(const Ref<Image> &p_image, bool p_immediate) {
|
||||
void ImageTexture::update(const Ref<Image> &p_image) {
|
||||
ERR_FAIL_COND_MSG(p_image.is_null(), "Invalid image");
|
||||
ERR_FAIL_COND_MSG(texture.is_null(), "Texture is not initialized.");
|
||||
ERR_FAIL_COND_MSG(p_image->get_width() != w || p_image->get_height() != h,
|
||||
|
@ -183,11 +183,7 @@ void ImageTexture::update(const Ref<Image> &p_image, bool p_immediate) {
|
|||
ERR_FAIL_COND_MSG(mipmaps != p_image->has_mipmaps(),
|
||||
"The new image mipmaps configuration must match the texture's image mipmaps configuration");
|
||||
|
||||
if (p_immediate) {
|
||||
RenderingServer::get_singleton()->texture_2d_update_immediate(texture, p_image);
|
||||
} else {
|
||||
RenderingServer::get_singleton()->texture_2d_update(texture, p_image);
|
||||
}
|
||||
RenderingServer::get_singleton()->texture_2d_update(texture, p_image);
|
||||
|
||||
notify_property_list_changed();
|
||||
emit_changed();
|
||||
|
@ -305,7 +301,7 @@ void ImageTexture::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("create_from_image", "image"), &ImageTexture::create_from_image);
|
||||
ClassDB::bind_method(D_METHOD("get_format"), &ImageTexture::get_format);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("update", "image", "immediate"), &ImageTexture::update, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("update", "image"), &ImageTexture::update);
|
||||
ClassDB::bind_method(D_METHOD("set_size_override", "size"), &ImageTexture::set_size_override);
|
||||
ClassDB::bind_method(D_METHOD("_reload_hook", "rid"), &ImageTexture::_reload_hook);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
|
||||
Image::Format get_format() const;
|
||||
|
||||
void update(const Ref<Image> &p_image, bool p_immediate = false);
|
||||
void update(const Ref<Image> &p_image);
|
||||
Ref<Image> get_image() const override;
|
||||
|
||||
int get_width() const override;
|
||||
|
|
|
@ -225,7 +225,6 @@ public:
|
|||
}
|
||||
|
||||
void texture_2d_layered_initialize(RID p_texture, const Vector<Ref<Image>> &p_layers, RS::TextureLayeredType p_layered_type) override {}
|
||||
void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) override {}
|
||||
void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) override {}
|
||||
void texture_3d_initialize(RID p_texture, Image::Format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) override {}
|
||||
void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) override {}
|
||||
|
@ -491,12 +490,6 @@ public:
|
|||
void voxel_gi_set_energy(RID p_voxel_gi, float p_range) override {}
|
||||
float voxel_gi_get_energy(RID p_voxel_gi) const override { return 0.0; }
|
||||
|
||||
void voxel_gi_set_ao(RID p_voxel_gi, float p_ao) override {}
|
||||
float voxel_gi_get_ao(RID p_voxel_gi) const override { return 0; }
|
||||
|
||||
void voxel_gi_set_ao_size(RID p_voxel_gi, float p_strength) override {}
|
||||
float voxel_gi_get_ao_size(RID p_voxel_gi) const override { return 0; }
|
||||
|
||||
void voxel_gi_set_bias(RID p_voxel_gi, float p_range) override {}
|
||||
float voxel_gi_get_bias(RID p_voxel_gi) const override { return 0.0; }
|
||||
|
||||
|
@ -719,8 +712,6 @@ public:
|
|||
void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) override {}
|
||||
void set_shadow_texture_size(int p_size) override {}
|
||||
|
||||
void draw_window_margins(int *p_margins, RID *p_margin_textures) override {}
|
||||
|
||||
bool free(RID p_rid) override { return true; }
|
||||
void update() override {}
|
||||
|
||||
|
|
|
@ -608,8 +608,6 @@ public:
|
|||
virtual void occluder_polygon_set_cull_mode(RID p_occluder, RS::CanvasOccluderPolygonCullMode p_mode) = 0;
|
||||
virtual void set_shadow_texture_size(int p_size) = 0;
|
||||
|
||||
virtual void draw_window_margins(int *p_margins, RID *p_margin_textures) = 0;
|
||||
|
||||
virtual bool free(RID p_rid) = 0;
|
||||
virtual void update() = 0;
|
||||
|
||||
|
|
|
@ -457,8 +457,6 @@ public:
|
|||
|
||||
void canvas_debug_viewport_shadows(Light *p_lights_with_shadow) {}
|
||||
|
||||
void draw_window_margins(int *p_margins, RID *p_margin_textures) {}
|
||||
|
||||
virtual void set_shadow_texture_size(int p_size);
|
||||
|
||||
void set_time(double p_time);
|
||||
|
|
|
@ -3078,9 +3078,6 @@ void RendererSceneGIRD::setup_voxel_gi_instances(RID p_render_buffers, const Tra
|
|||
gipd.bias = storage->voxel_gi_get_bias(base_probe);
|
||||
gipd.normal_bias = storage->voxel_gi_get_normal_bias(base_probe);
|
||||
gipd.blend_ambient = !storage->voxel_gi_is_interior(base_probe);
|
||||
gipd.anisotropy_strength = 0;
|
||||
gipd.ao = storage->voxel_gi_get_ao(base_probe);
|
||||
gipd.ao_size = Math::pow(storage->voxel_gi_get_ao_size(base_probe), 4.0f);
|
||||
gipd.mipmaps = gipi->mipmaps.size();
|
||||
}
|
||||
|
||||
|
|
|
@ -611,9 +611,9 @@ public:
|
|||
uint32_t blend_ambient;
|
||||
uint32_t texture_slot;
|
||||
|
||||
float anisotropy_strength;
|
||||
float ao;
|
||||
float ao_size;
|
||||
uint32_t pad0;
|
||||
uint32_t pad1;
|
||||
uint32_t pad2;
|
||||
uint32_t mipmaps;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "core/io/resource_loader.h"
|
||||
#include "core/math/math_defs.h"
|
||||
#include "renderer_compositor_rd.h"
|
||||
#include "servers/rendering/rendering_server_globals.h"
|
||||
#include "servers/rendering/shader_language.h"
|
||||
|
||||
bool RendererStorageRD::can_create_resources_async() const {
|
||||
|
@ -883,10 +884,6 @@ void RendererStorageRD::_texture_2d_update(RID p_texture, const Ref<Image> &p_im
|
|||
RD::get_singleton()->texture_update(tex->rd_texture, p_layer, validated->get_data());
|
||||
}
|
||||
|
||||
void RendererStorageRD::texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer) {
|
||||
_texture_2d_update(p_texture, p_image, p_layer, true);
|
||||
}
|
||||
|
||||
void RendererStorageRD::texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer) {
|
||||
_texture_2d_update(p_texture, p_image, p_layer, false);
|
||||
}
|
||||
|
@ -3921,6 +3918,7 @@ void RendererStorageRD::particles_set_emitting(RID p_particles, bool p_emitting)
|
|||
}
|
||||
|
||||
bool RendererStorageRD::particles_get_emitting(RID p_particles) {
|
||||
ERR_FAIL_COND_V_MSG(RSG::threaded, false, "This function should never be used with threaded rendering, as it stalls the renderer.");
|
||||
Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, false);
|
||||
|
||||
|
@ -4243,6 +4241,10 @@ void RendererStorageRD::particles_request_process(RID p_particles) {
|
|||
}
|
||||
|
||||
AABB RendererStorageRD::particles_get_current_aabb(RID p_particles) {
|
||||
if (RSG::threaded) {
|
||||
WARN_PRINT_ONCE("Calling this function with threaded rendering enabled stalls the renderer, use with care.");
|
||||
}
|
||||
|
||||
const Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, AABB());
|
||||
|
||||
|
@ -5127,6 +5129,7 @@ void RendererStorageRD::update_particles() {
|
|||
}
|
||||
|
||||
bool RendererStorageRD::particles_is_inactive(RID p_particles) const {
|
||||
ERR_FAIL_COND_V_MSG(RSG::threaded, false, "This function should never be used with threaded rendering, as it stalls the renderer.");
|
||||
const Particles *particles = particles_owner.getornull(p_particles);
|
||||
ERR_FAIL_COND_V(!particles, false);
|
||||
return !particles->emitting && particles->inactive;
|
||||
|
@ -6635,32 +6638,6 @@ float RendererStorageRD::voxel_gi_get_energy(RID p_voxel_gi) const {
|
|||
return voxel_gi->energy;
|
||||
}
|
||||
|
||||
void RendererStorageRD::voxel_gi_set_ao(RID p_voxel_gi, float p_ao) {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.getornull(p_voxel_gi);
|
||||
ERR_FAIL_COND(!voxel_gi);
|
||||
|
||||
voxel_gi->ao = p_ao;
|
||||
}
|
||||
|
||||
float RendererStorageRD::voxel_gi_get_ao(RID p_voxel_gi) const {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.getornull(p_voxel_gi);
|
||||
ERR_FAIL_COND_V(!voxel_gi, 0);
|
||||
return voxel_gi->ao;
|
||||
}
|
||||
|
||||
void RendererStorageRD::voxel_gi_set_ao_size(RID p_voxel_gi, float p_strength) {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.getornull(p_voxel_gi);
|
||||
ERR_FAIL_COND(!voxel_gi);
|
||||
|
||||
voxel_gi->ao_size = p_strength;
|
||||
}
|
||||
|
||||
float RendererStorageRD::voxel_gi_get_ao_size(RID p_voxel_gi) const {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.getornull(p_voxel_gi);
|
||||
ERR_FAIL_COND_V(!voxel_gi, 0);
|
||||
return voxel_gi->ao_size;
|
||||
}
|
||||
|
||||
void RendererStorageRD::voxel_gi_set_bias(RID p_voxel_gi, float p_bias) {
|
||||
VoxelGI *voxel_gi = voxel_gi_owner.getornull(p_voxel_gi);
|
||||
ERR_FAIL_COND(!voxel_gi);
|
||||
|
|
|
@ -1076,8 +1076,6 @@ private:
|
|||
|
||||
float dynamic_range = 4.0;
|
||||
float energy = 1.0;
|
||||
float ao = 0.0;
|
||||
float ao_size = 0.5;
|
||||
float bias = 1.4;
|
||||
float normal_bias = 0.0;
|
||||
float propagation = 0.7;
|
||||
|
@ -1298,7 +1296,6 @@ public:
|
|||
|
||||
virtual void _texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer, bool p_immediate);
|
||||
|
||||
virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0); //mostly used for video and streaming
|
||||
virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0);
|
||||
virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data);
|
||||
virtual void texture_proxy_update(RID p_texture, RID p_proxy_to);
|
||||
|
@ -2040,12 +2037,6 @@ public:
|
|||
void voxel_gi_set_energy(RID p_voxel_gi, float p_energy);
|
||||
float voxel_gi_get_energy(RID p_voxel_gi) const;
|
||||
|
||||
void voxel_gi_set_ao(RID p_voxel_gi, float p_ao);
|
||||
float voxel_gi_get_ao(RID p_voxel_gi) const;
|
||||
|
||||
void voxel_gi_set_ao_size(RID p_voxel_gi, float p_strength);
|
||||
float voxel_gi_get_ao_size(RID p_voxel_gi) const;
|
||||
|
||||
void voxel_gi_set_bias(RID p_voxel_gi, float p_bias);
|
||||
float voxel_gi_get_bias(RID p_voxel_gi) const;
|
||||
|
||||
|
|
|
@ -77,9 +77,9 @@ struct VoxelGIData {
|
|||
bool blend_ambient;
|
||||
uint texture_slot;
|
||||
|
||||
float anisotropy_strength;
|
||||
float ambient_occlusion;
|
||||
float ambient_occlusion_size;
|
||||
uint pad0;
|
||||
uint pad1;
|
||||
uint pad2;
|
||||
uint mipmaps;
|
||||
};
|
||||
|
||||
|
@ -551,27 +551,6 @@ void voxel_gi_compute(uint index, vec3 position, vec3 normal, vec3 ref_vec, mat3
|
|||
}
|
||||
}
|
||||
|
||||
if (voxel_gi_instances.data[index].ambient_occlusion > 0.001) {
|
||||
float size = 1.0 + voxel_gi_instances.data[index].ambient_occlusion_size * 7.0;
|
||||
|
||||
float taps, blend;
|
||||
blend = modf(size, taps);
|
||||
float ao = 0.0;
|
||||
for (float i = 1.0; i <= taps; i++) {
|
||||
vec3 ofs = (position + normal * (i * 0.5 + 1.0)) * cell_size;
|
||||
ao += textureLod(sampler3D(voxel_gi_textures[index], linear_sampler_with_mipmaps), ofs, i - 1.0).a * i;
|
||||
}
|
||||
|
||||
if (blend > 0.001) {
|
||||
vec3 ofs = (position + normal * ((taps + 1.0) * 0.5 + 1.0)) * cell_size;
|
||||
ao += textureLod(sampler3D(voxel_gi_textures[index], linear_sampler_with_mipmaps), ofs, taps).a * (taps + 1.0) * blend;
|
||||
}
|
||||
|
||||
ao = 1.0 - min(1.0, ao);
|
||||
|
||||
light.rgb = mix(params.ao_color, light.rgb, mix(1.0, ao, voxel_gi_instances.data[index].ambient_occlusion));
|
||||
}
|
||||
|
||||
light.rgb *= voxel_gi_instances.data[index].dynamic_range;
|
||||
if (!voxel_gi_instances.data[index].blend_ambient) {
|
||||
light.a = 1.0;
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
virtual RID scenario_allocate() = 0;
|
||||
virtual void scenario_initialize(RID p_rid) = 0;
|
||||
|
||||
virtual void scenario_set_debug(RID p_scenario, RS::ScenarioDebugMode p_debug_mode) = 0;
|
||||
virtual void scenario_set_environment(RID p_scenario, RID p_environment) = 0;
|
||||
virtual void scenario_set_camera_effects(RID p_scenario, RID p_fx) = 0;
|
||||
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment) = 0;
|
||||
|
@ -81,7 +80,6 @@ public:
|
|||
virtual void instance_set_custom_aabb(RID p_instance, AABB p_aabb) = 0;
|
||||
|
||||
virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton) = 0;
|
||||
virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
|
||||
|
||||
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
|
||||
virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance) = 0;
|
||||
|
|
|
@ -330,12 +330,6 @@ void RendererSceneCull::scenario_initialize(RID p_rid) {
|
|||
RendererSceneOcclusionCull::get_singleton()->add_scenario(p_rid);
|
||||
}
|
||||
|
||||
void RendererSceneCull::scenario_set_debug(RID p_scenario, RS::ScenarioDebugMode p_debug_mode) {
|
||||
Scenario *scenario = scenario_owner.getornull(p_scenario);
|
||||
ERR_FAIL_COND(!scenario);
|
||||
scenario->debug = p_debug_mode;
|
||||
}
|
||||
|
||||
void RendererSceneCull::scenario_set_environment(RID p_scenario, RID p_environment) {
|
||||
Scenario *scenario = scenario_owner.getornull(p_scenario);
|
||||
ERR_FAIL_COND(!scenario);
|
||||
|
@ -939,9 +933,6 @@ void RendererSceneCull::instance_attach_skeleton(RID p_instance, RID p_skeleton)
|
|||
}
|
||||
}
|
||||
|
||||
void RendererSceneCull::instance_set_exterior(RID p_instance, bool p_enabled) {
|
||||
}
|
||||
|
||||
void RendererSceneCull::instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) {
|
||||
Instance *instance = instance_owner.getornull(p_instance);
|
||||
ERR_FAIL_COND(!instance);
|
||||
|
|
|
@ -315,7 +315,6 @@ public:
|
|||
|
||||
DynamicBVH indexers[INDEXER_MAX];
|
||||
|
||||
RS::ScenarioDebugMode debug;
|
||||
RID self;
|
||||
|
||||
List<Instance *> directional_lights;
|
||||
|
@ -338,7 +337,6 @@ public:
|
|||
Scenario() {
|
||||
indexers[INDEXER_GEOMETRY].set_index(INDEXER_GEOMETRY);
|
||||
indexers[INDEXER_VOLUMES].set_index(INDEXER_VOLUMES);
|
||||
debug = RS::SCENARIO_DEBUG_DISABLED;
|
||||
used_viewport_visibility_bits = 0;
|
||||
}
|
||||
};
|
||||
|
@ -355,7 +353,6 @@ public:
|
|||
virtual RID scenario_allocate();
|
||||
virtual void scenario_initialize(RID p_rid);
|
||||
|
||||
virtual void scenario_set_debug(RID p_scenario, RS::ScenarioDebugMode p_debug_mode);
|
||||
virtual void scenario_set_environment(RID p_scenario, RID p_environment);
|
||||
virtual void scenario_set_camera_effects(RID p_scenario, RID p_fx);
|
||||
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment);
|
||||
|
@ -914,7 +911,6 @@ public:
|
|||
virtual void instance_set_custom_aabb(RID p_instance, AABB p_aabb);
|
||||
|
||||
virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton);
|
||||
virtual void instance_set_exterior(RID p_instance, bool p_enabled);
|
||||
|
||||
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin);
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ RID RendererSceneOcclusionCull::HZBuffer::get_debug_texture() {
|
|||
if (debug_texture.is_null()) {
|
||||
debug_texture = RS::get_singleton()->texture_2d_create(debug_image);
|
||||
} else {
|
||||
RenderingServer::get_singleton()->texture_2d_update_immediate(debug_texture, debug_image);
|
||||
RenderingServer::get_singleton()->texture_2d_update(debug_texture, debug_image);
|
||||
}
|
||||
|
||||
return debug_texture;
|
||||
|
|
|
@ -130,7 +130,6 @@ public:
|
|||
virtual void texture_3d_initialize(RID p_texture, Image::Format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) = 0;
|
||||
virtual void texture_proxy_initialize(RID p_texture, RID p_base) = 0; //all slices, then all the mipmaps, must be coherent
|
||||
|
||||
virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0; //mostly used for video and streaming
|
||||
virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0;
|
||||
virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) = 0;
|
||||
virtual void texture_proxy_update(RID p_proxy, RID p_base) = 0;
|
||||
|
@ -422,12 +421,6 @@ public:
|
|||
virtual void voxel_gi_set_energy(RID p_voxel_gi, float p_energy) = 0;
|
||||
virtual float voxel_gi_get_energy(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_ao(RID p_voxel_gi, float p_ao) = 0;
|
||||
virtual float voxel_gi_get_ao(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_ao_size(RID p_voxel_gi, float p_strength) = 0;
|
||||
virtual float voxel_gi_get_ao_size(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_bias(RID p_voxel_gi, float p_bias) = 0;
|
||||
virtual float voxel_gi_get_bias(RID p_voxel_gi) const = 0;
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, uint32_t p_view_coun
|
|||
|
||||
Color bgcolor = RSG::storage->get_default_clear_color();
|
||||
|
||||
if (!p_viewport->hide_canvas && !p_viewport->disable_environment && RSG::scene->is_scenario(p_viewport->scenario)) {
|
||||
if (!p_viewport->disable_2d && !p_viewport->disable_environment && RSG::scene->is_scenario(p_viewport->scenario)) {
|
||||
RID environment = RSG::scene->scenario_get_environment(p_viewport->scenario);
|
||||
if (RSG::scene->is_environment(environment)) {
|
||||
scenario_draw_canvas_bg = RSG::scene->environment_get_background(environment) == RS::ENV_BG_CANVAS;
|
||||
|
@ -145,7 +145,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, uint32_t p_view_coun
|
|||
_draw_3d(p_viewport);
|
||||
}
|
||||
|
||||
if (!p_viewport->hide_canvas) {
|
||||
if (!p_viewport->disable_2d) {
|
||||
int i = 0;
|
||||
|
||||
Map<Viewport::CanvasKey, Viewport::CanvasData *> canvas_map;
|
||||
|
@ -633,8 +633,6 @@ void RendererViewport::viewport_initialize(RID p_rid) {
|
|||
viewport_owner.initialize_rid(p_rid);
|
||||
Viewport *viewport = viewport_owner.getornull(p_rid);
|
||||
viewport->self = p_rid;
|
||||
viewport->hide_scenario = false;
|
||||
viewport->hide_canvas = false;
|
||||
viewport->render_target = RSG::storage->render_target_create();
|
||||
viewport->shadow_atlas = RSG::scene->shadow_atlas_create();
|
||||
viewport->viewport_render_direct_to_screen = false;
|
||||
|
@ -791,18 +789,11 @@ RID RendererViewport::viewport_get_occluder_debug_texture(RID p_viewport) const
|
|||
return RID();
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_hide_scenario(RID p_viewport, bool p_hide) {
|
||||
void RendererViewport::viewport_set_disable_2d(RID p_viewport, bool p_disable) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->hide_scenario = p_hide;
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_hide_canvas(RID p_viewport, bool p_hide) {
|
||||
Viewport *viewport = viewport_owner.getornull(p_viewport);
|
||||
ERR_FAIL_COND(!viewport);
|
||||
|
||||
viewport->hide_canvas = p_hide;
|
||||
viewport->disable_2d = p_disable;
|
||||
}
|
||||
|
||||
void RendererViewport::viewport_set_disable_environment(RID p_viewport, bool p_disable) {
|
||||
|
|
|
@ -68,9 +68,8 @@ public:
|
|||
Rect2 viewport_to_screen_rect;
|
||||
bool viewport_render_direct_to_screen;
|
||||
|
||||
bool hide_scenario;
|
||||
bool hide_canvas;
|
||||
bool disable_environment;
|
||||
bool disable_2d = false;
|
||||
bool disable_environment = false;
|
||||
bool disable_3d = false;
|
||||
bool measure_render_time;
|
||||
|
||||
|
@ -138,7 +137,7 @@ public:
|
|||
update_mode = RS::VIEWPORT_UPDATE_WHEN_VISIBLE;
|
||||
clear_mode = RS::VIEWPORT_CLEAR_ALWAYS;
|
||||
transparent_bg = false;
|
||||
disable_environment = false;
|
||||
|
||||
viewport_to_screen = DisplayServer::INVALID_WINDOW_ID;
|
||||
shadow_atlas_size = 0;
|
||||
measure_render_time = false;
|
||||
|
@ -218,8 +217,7 @@ public:
|
|||
RID viewport_get_texture(RID p_viewport) const;
|
||||
RID viewport_get_occluder_debug_texture(RID p_viewport) const;
|
||||
|
||||
void viewport_set_hide_scenario(RID p_viewport, bool p_hide);
|
||||
void viewport_set_hide_canvas(RID p_viewport, bool p_hide);
|
||||
void viewport_set_disable_2d(RID p_viewport, bool p_disable);
|
||||
void viewport_set_disable_environment(RID p_viewport, bool p_disable);
|
||||
void viewport_set_disable_3d(RID p_viewport, bool p_disable);
|
||||
|
||||
|
|
|
@ -42,26 +42,6 @@
|
|||
|
||||
int RenderingServerDefault::changes = 0;
|
||||
|
||||
/* BLACK BARS */
|
||||
|
||||
void RenderingServerDefault::black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) {
|
||||
black_margin[SIDE_LEFT] = p_left;
|
||||
black_margin[SIDE_TOP] = p_top;
|
||||
black_margin[SIDE_RIGHT] = p_right;
|
||||
black_margin[SIDE_BOTTOM] = p_bottom;
|
||||
}
|
||||
|
||||
void RenderingServerDefault::black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) {
|
||||
black_image[SIDE_LEFT] = p_left;
|
||||
black_image[SIDE_TOP] = p_top;
|
||||
black_image[SIDE_RIGHT] = p_right;
|
||||
black_image[SIDE_BOTTOM] = p_bottom;
|
||||
}
|
||||
|
||||
void RenderingServerDefault::_draw_margins() {
|
||||
RSG::canvas_render->draw_window_margins(black_margin, black_image);
|
||||
};
|
||||
|
||||
/* FREE */
|
||||
|
||||
void RenderingServerDefault::_free(RID p_rid) {
|
||||
|
@ -114,7 +94,6 @@ void RenderingServerDefault::_draw(bool p_swap_buffers, double frame_step) {
|
|||
RSG::viewport->draw_viewports();
|
||||
RSG::canvas_render->update();
|
||||
|
||||
_draw_margins();
|
||||
RSG::rasterizer->end_frame(p_swap_buffers);
|
||||
|
||||
RSG::canvas->update_visibility_notifiers();
|
||||
|
@ -410,11 +389,6 @@ RenderingServerDefault::RenderingServerDefault(bool p_create_thread) :
|
|||
sr->set_scene_render(RSG::rasterizer->get_scene());
|
||||
|
||||
frame_profile_frame = 0;
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
black_margin[i] = 0;
|
||||
black_image[i] = RID();
|
||||
}
|
||||
}
|
||||
|
||||
RenderingServerDefault::~RenderingServerDefault() {
|
||||
|
|
|
@ -58,9 +58,6 @@ class RenderingServerDefault : public RenderingServer {
|
|||
static int changes;
|
||||
RID test_cube;
|
||||
|
||||
int black_margin[4];
|
||||
RID black_image[4];
|
||||
|
||||
struct FrameDrawnCallbacks {
|
||||
ObjectID object;
|
||||
StringName method;
|
||||
|
@ -69,7 +66,6 @@ class RenderingServerDefault : public RenderingServer {
|
|||
|
||||
List<FrameDrawnCallbacks> frame_drawn_callbacks;
|
||||
|
||||
void _draw_margins();
|
||||
static void _changes_changed() {}
|
||||
|
||||
uint64_t frame_profile_frame;
|
||||
|
@ -192,8 +188,6 @@ public:
|
|||
FUNCRIDTEX6(texture_3d, Image::Format, int, int, int, bool, const Vector<Ref<Image>> &)
|
||||
FUNCRIDTEX1(texture_proxy, RID)
|
||||
|
||||
//goes pass-through
|
||||
FUNC3(texture_2d_update_immediate, RID, const Ref<Image> &, int)
|
||||
//these go through command queue if they are in another thread
|
||||
FUNC3(texture_2d_update, RID, const Ref<Image> &, int)
|
||||
FUNC2(texture_3d_update, RID, const Vector<Ref<Image>> &)
|
||||
|
@ -418,34 +412,12 @@ public:
|
|||
FUNC1RC(Transform3D, voxel_gi_get_to_cell_xform, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_dynamic_range, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_dynamic_range, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_propagation, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_propagation, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_energy, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_energy, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_ao, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_ao, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_ao_size, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_ao_size, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_bias, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_bias, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_normal_bias, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_normal_bias, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_interior, RID, bool)
|
||||
FUNC1RC(bool, voxel_gi_is_interior, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_use_two_bounces, RID, bool)
|
||||
FUNC1RC(bool, voxel_gi_is_using_two_bounces, RID)
|
||||
|
||||
FUNC2(voxel_gi_set_anisotropy_strength, RID, float)
|
||||
FUNC1RC(float, voxel_gi_get_anisotropy_strength, RID)
|
||||
|
||||
/* LIGHTMAP */
|
||||
|
||||
|
@ -569,8 +541,7 @@ public:
|
|||
|
||||
FUNC1RC(RID, viewport_get_texture, RID)
|
||||
|
||||
FUNC2(viewport_set_hide_scenario, RID, bool)
|
||||
FUNC2(viewport_set_hide_canvas, RID, bool)
|
||||
FUNC2(viewport_set_disable_2d, RID, bool)
|
||||
FUNC2(viewport_set_disable_environment, RID, bool)
|
||||
FUNC2(viewport_set_disable_3d, RID, bool)
|
||||
|
||||
|
@ -697,7 +668,6 @@ public:
|
|||
|
||||
FUNCRIDSPLIT(scenario)
|
||||
|
||||
FUNC2(scenario_set_debug, RID, ScenarioDebugMode)
|
||||
FUNC2(scenario_set_environment, RID, RID)
|
||||
FUNC2(scenario_set_camera_effects, RID, RID)
|
||||
FUNC2(scenario_set_fallback_environment, RID, RID)
|
||||
|
@ -717,7 +687,6 @@ public:
|
|||
FUNC2(instance_set_custom_aabb, RID, AABB)
|
||||
|
||||
FUNC2(instance_attach_skeleton, RID, RID)
|
||||
FUNC2(instance_set_exterior, RID, bool)
|
||||
|
||||
FUNC2(instance_set_extra_visibility_margin, RID, real_t)
|
||||
FUNC2(instance_set_visibility_parent, RID, RID)
|
||||
|
@ -885,11 +854,6 @@ public:
|
|||
#undef WRITE_ACTION
|
||||
#undef SYNC_DEBUG
|
||||
|
||||
/* BLACK BARS */
|
||||
|
||||
virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) override;
|
||||
virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) override;
|
||||
|
||||
/* FREE */
|
||||
|
||||
virtual void free(RID p_rid) override {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -103,7 +103,6 @@ public:
|
|||
virtual RID texture_3d_create(Image::Format, int p_width, int p_height, int p_depth, bool p_mipmaps, const Vector<Ref<Image>> &p_data) = 0; //all slices, then all the mipmaps, must be coherent
|
||||
virtual RID texture_proxy_create(RID p_base) = 0;
|
||||
|
||||
virtual void texture_2d_update_immediate(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0; //mostly used for video and streaming
|
||||
virtual void texture_2d_update(RID p_texture, const Ref<Image> &p_image, int p_layer = 0) = 0;
|
||||
virtual void texture_3d_update(RID p_texture, const Vector<Ref<Image>> &p_data) = 0;
|
||||
virtual void texture_proxy_update(RID p_texture, RID p_proxy_to) = 0;
|
||||
|
@ -119,10 +118,6 @@ public:
|
|||
|
||||
virtual void texture_replace(RID p_texture, RID p_by_texture) = 0;
|
||||
virtual void texture_set_size_override(RID p_texture, int p_width, int p_height) = 0;
|
||||
// FIXME: Disabled during Vulkan refactoring, should be ported.
|
||||
#if 0
|
||||
virtual void texture_bind(RID p_texture, uint32_t p_texture_no) = 0;
|
||||
#endif
|
||||
|
||||
virtual void texture_set_path(RID p_texture, const String &p_path) = 0;
|
||||
virtual String texture_get_path(RID p_texture) const = 0;
|
||||
|
@ -173,7 +168,6 @@ public:
|
|||
virtual void shader_set_code(RID p_shader, const String &p_code) = 0;
|
||||
virtual String shader_get_code(RID p_shader) const = 0;
|
||||
virtual void shader_get_param_list(RID p_shader, List<PropertyInfo> *p_param_list) const = 0;
|
||||
Array _shader_get_param_list_bind(RID p_shader) const;
|
||||
virtual Variant shader_get_param_default(RID p_shader, const StringName &p_param) const = 0;
|
||||
|
||||
virtual void shader_set_default_texture_param(RID p_shader, const StringName &p_name, RID p_texture) = 0;
|
||||
|
@ -214,9 +208,9 @@ public:
|
|||
|
||||
enum ArrayType {
|
||||
ARRAY_VERTEX = 0, // RG32F or RGB32F (depending on 2D bit)
|
||||
ARRAY_NORMAL = 1, // A2B10G10R10
|
||||
ARRAY_NORMAL = 1, // A2B10G10R10, A is ignored
|
||||
ARRAY_TANGENT = 2, // A2B10G10R10, A flips sign of binormal
|
||||
ARRAY_COLOR = 3, // RGBA16F
|
||||
ARRAY_COLOR = 3, // RGBA8
|
||||
ARRAY_TEX_UV = 4, // RG32F
|
||||
ARRAY_TEX_UV2 = 5, // RG32F
|
||||
ARRAY_CUSTOM0 = 6, // depends on ArrayCustomFormat
|
||||
|
@ -482,6 +476,19 @@ public:
|
|||
|
||||
virtual void light_directional_set_shadow_depth_range_mode(RID p_light, LightDirectionalShadowDepthRangeMode p_range_mode) = 0;
|
||||
|
||||
virtual void directional_shadow_atlas_set_size(int p_size, bool p_16_bits = false) = 0;
|
||||
|
||||
enum ShadowQuality {
|
||||
SHADOW_QUALITY_HARD,
|
||||
SHADOW_QUALITY_SOFT_LOW,
|
||||
SHADOW_QUALITY_SOFT_MEDIUM,
|
||||
SHADOW_QUALITY_SOFT_HIGH,
|
||||
SHADOW_QUALITY_SOFT_ULTRA,
|
||||
SHADOW_QUALITY_MAX
|
||||
};
|
||||
|
||||
virtual void shadows_quality_set(ShadowQuality p_quality) = 0;
|
||||
virtual void directional_shadow_quality_set(ShadowQuality p_quality) = 0;
|
||||
/* PROBE API */
|
||||
|
||||
virtual RID reflection_probe_create() = 0;
|
||||
|
@ -549,34 +556,12 @@ public:
|
|||
virtual Transform3D voxel_gi_get_to_cell_xform(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_dynamic_range(RID p_voxel_gi, float p_range) = 0;
|
||||
virtual float voxel_gi_get_dynamic_range(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_propagation(RID p_voxel_gi, float p_range) = 0;
|
||||
virtual float voxel_gi_get_propagation(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_energy(RID p_voxel_gi, float p_energy) = 0;
|
||||
virtual float voxel_gi_get_energy(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_ao(RID p_voxel_gi, float p_ao) = 0;
|
||||
virtual float voxel_gi_get_ao(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_ao_size(RID p_voxel_gi, float p_strength) = 0;
|
||||
virtual float voxel_gi_get_ao_size(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_bias(RID p_voxel_gi, float p_bias) = 0;
|
||||
virtual float voxel_gi_get_bias(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_normal_bias(RID p_voxel_gi, float p_range) = 0;
|
||||
virtual float voxel_gi_get_normal_bias(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_interior(RID p_voxel_gi, bool p_enable) = 0;
|
||||
virtual bool voxel_gi_is_interior(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_use_two_bounces(RID p_voxel_gi, bool p_enable) = 0;
|
||||
virtual bool voxel_gi_is_using_two_bounces(RID p_voxel_gi) const = 0;
|
||||
|
||||
virtual void voxel_gi_set_anisotropy_strength(RID p_voxel_gi, float p_strength) = 0;
|
||||
virtual float voxel_gi_get_anisotropy_strength(RID p_voxel_gi) const = 0;
|
||||
|
||||
enum VoxelGIQuality {
|
||||
VOXEL_GI_QUALITY_LOW,
|
||||
|
@ -731,7 +716,7 @@ public:
|
|||
virtual void camera_set_camera_effects(RID p_camera, RID p_camera_effects) = 0;
|
||||
virtual void camera_set_use_vertical_aspect(RID p_camera, bool p_enable) = 0;
|
||||
|
||||
/* VIEWPORT TARGET API */
|
||||
/* VIEWPORT API */
|
||||
|
||||
enum CanvasItemTextureFilter {
|
||||
CANVAS_ITEM_TEXTURE_FILTER_DEFAULT, //uses canvas item setting for draw command, uses global setting for canvas item
|
||||
|
@ -782,10 +767,9 @@ public:
|
|||
|
||||
virtual RID viewport_get_texture(RID p_viewport) const = 0;
|
||||
|
||||
virtual void viewport_set_hide_scenario(RID p_viewport, bool p_hide) = 0;
|
||||
virtual void viewport_set_hide_canvas(RID p_viewport, bool p_hide) = 0;
|
||||
virtual void viewport_set_disable_environment(RID p_viewport, bool p_disable) = 0;
|
||||
virtual void viewport_set_disable_3d(RID p_viewport, bool p_disable) = 0;
|
||||
virtual void viewport_set_disable_2d(RID p_viewport, bool p_disable) = 0;
|
||||
|
||||
virtual void viewport_attach_camera(RID p_viewport, RID p_camera) = 0;
|
||||
virtual void viewport_set_scenario(RID p_viewport, RID p_scenario) = 0;
|
||||
|
@ -901,8 +885,6 @@ public:
|
|||
virtual float viewport_get_measured_render_time_cpu(RID p_viewport) const = 0;
|
||||
virtual float viewport_get_measured_render_time_gpu(RID p_viewport) const = 0;
|
||||
|
||||
virtual void directional_shadow_atlas_set_size(int p_size, bool p_16_bits = false) = 0;
|
||||
|
||||
/* SKY API */
|
||||
|
||||
enum SkyMode {
|
||||
|
@ -953,10 +935,6 @@ public:
|
|||
virtual void environment_set_bg_energy(RID p_env, float p_energy) = 0;
|
||||
virtual void environment_set_canvas_max_layer(RID p_env, int p_max_layer) = 0;
|
||||
virtual void environment_set_ambient_light(RID p_env, const Color &p_color, EnvironmentAmbientSource p_ambient = ENV_AMBIENT_SOURCE_BG, float p_energy = 1.0, float p_sky_contribution = 0.0, EnvironmentReflectionSource p_reflection_source = ENV_REFLECTION_SOURCE_BG, const Color &p_ao_color = Color()) = 0;
|
||||
// FIXME: Disabled during Vulkan refactoring, should be ported.
|
||||
#if 0
|
||||
virtual void environment_set_camera_feed_id(RID p_env, int p_camera_feed_id) = 0;
|
||||
#endif
|
||||
|
||||
enum EnvironmentGlowBlendMode {
|
||||
ENV_GLOW_BLEND_MODE_ADDITIVE,
|
||||
|
@ -1098,30 +1076,10 @@ public:
|
|||
virtual void camera_effects_set_dof_blur(RID p_camera_effects, bool p_far_enable, float p_far_distance, float p_far_transition, bool p_near_enable, float p_near_distance, float p_near_transition, float p_amount) = 0;
|
||||
virtual void camera_effects_set_custom_exposure(RID p_camera_effects, bool p_enable, float p_exposure) = 0;
|
||||
|
||||
enum ShadowQuality {
|
||||
SHADOW_QUALITY_HARD,
|
||||
SHADOW_QUALITY_SOFT_LOW,
|
||||
SHADOW_QUALITY_SOFT_MEDIUM,
|
||||
SHADOW_QUALITY_SOFT_HIGH,
|
||||
SHADOW_QUALITY_SOFT_ULTRA,
|
||||
SHADOW_QUALITY_MAX
|
||||
};
|
||||
|
||||
virtual void shadows_quality_set(ShadowQuality p_quality) = 0;
|
||||
virtual void directional_shadow_quality_set(ShadowQuality p_quality) = 0;
|
||||
|
||||
/* SCENARIO API */
|
||||
|
||||
virtual RID scenario_create() = 0;
|
||||
|
||||
enum ScenarioDebugMode {
|
||||
SCENARIO_DEBUG_DISABLED,
|
||||
SCENARIO_DEBUG_WIREFRAME,
|
||||
SCENARIO_DEBUG_OVERDRAW,
|
||||
SCENARIO_DEBUG_SHADELESS,
|
||||
};
|
||||
|
||||
virtual void scenario_set_debug(RID p_scenario, ScenarioDebugMode p_debug_mode) = 0;
|
||||
virtual void scenario_set_environment(RID p_scenario, RID p_environment) = 0;
|
||||
virtual void scenario_set_fallback_environment(RID p_scenario, RID p_environment) = 0;
|
||||
virtual void scenario_set_camera_effects(RID p_scenario, RID p_camera_effects) = 0;
|
||||
|
@ -1162,7 +1120,6 @@ public:
|
|||
virtual void instance_set_custom_aabb(RID p_instance, AABB aabb) = 0;
|
||||
|
||||
virtual void instance_attach_skeleton(RID p_instance, RID p_skeleton) = 0;
|
||||
virtual void instance_set_exterior(RID p_instance, bool p_enabled) = 0;
|
||||
|
||||
virtual void instance_set_extra_visibility_margin(RID p_instance, real_t p_margin) = 0;
|
||||
virtual void instance_set_visibility_parent(RID p_instance, RID p_parent_instance) = 0;
|
||||
|
@ -1194,7 +1151,6 @@ public:
|
|||
virtual void instance_geometry_set_flag(RID p_instance, InstanceFlags p_flags, bool p_enabled) = 0;
|
||||
virtual void instance_geometry_set_cast_shadows_setting(RID p_instance, ShadowCastingSetting p_shadow_casting_setting) = 0;
|
||||
virtual void instance_geometry_set_material_override(RID p_instance, RID p_material) = 0;
|
||||
|
||||
virtual void instance_geometry_set_visibility_range(RID p_instance, float p_min, float p_max, float p_min_margin, float p_max_margin) = 0;
|
||||
virtual void instance_geometry_set_lightmap(RID p_instance, RID p_lightmap, const Rect2 &p_lightmap_uv_scale, int p_lightmap_slice) = 0;
|
||||
virtual void instance_geometry_set_lod_bias(RID p_instance, float p_lod_bias) = 0;
|
||||
|
@ -1224,6 +1180,7 @@ public:
|
|||
|
||||
virtual void canvas_set_disable_scale(bool p_disable) = 0;
|
||||
|
||||
/* CANVAS TEXTURE */
|
||||
virtual RID canvas_texture_create() = 0;
|
||||
|
||||
enum CanvasTextureChannel {
|
||||
|
@ -1238,6 +1195,8 @@ public:
|
|||
virtual void canvas_texture_set_texture_filter(RID p_canvas_texture, CanvasItemTextureFilter p_filter) = 0;
|
||||
virtual void canvas_texture_set_texture_repeat(RID p_canvas_texture, CanvasItemTextureRepeat p_repeat) = 0;
|
||||
|
||||
/* CANVAS ITEM */
|
||||
|
||||
virtual RID canvas_item_create() = 0;
|
||||
virtual void canvas_item_set_parent(RID p_item, RID p_parent) = 0;
|
||||
|
||||
|
@ -1281,6 +1240,7 @@ public:
|
|||
virtual void canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) = 0;
|
||||
virtual void canvas_item_add_clip_ignore(RID p_item, bool p_ignore) = 0;
|
||||
virtual void canvas_item_add_animation_slice(RID p_item, double p_animation_length, double p_slice_begin, double p_slice_end, double p_offset) = 0;
|
||||
|
||||
virtual void canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) = 0;
|
||||
virtual void canvas_item_set_z_index(RID p_item, int p_z) = 0;
|
||||
virtual void canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) = 0;
|
||||
|
@ -1305,6 +1265,7 @@ public:
|
|||
|
||||
virtual void canvas_item_set_canvas_group_mode(RID p_item, CanvasGroupMode p_mode, float p_clear_margin = 5.0, bool p_fit_empty = false, float p_fit_margin = 0.0, bool p_blur_mipmaps = false) = 0;
|
||||
|
||||
/* CANVAS LIGHT */
|
||||
virtual RID canvas_light_create() = 0;
|
||||
|
||||
enum CanvasLightMode {
|
||||
|
@ -1351,6 +1312,8 @@ public:
|
|||
virtual void canvas_light_set_shadow_color(RID p_light, const Color &p_color) = 0;
|
||||
virtual void canvas_light_set_shadow_smooth(RID p_light, float p_smooth) = 0;
|
||||
|
||||
/* CANVAS LIGHT OCCLUDER */
|
||||
|
||||
virtual RID canvas_light_occluder_create() = 0;
|
||||
virtual void canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) = 0;
|
||||
virtual void canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) = 0;
|
||||
|
@ -1359,6 +1322,8 @@ public:
|
|||
virtual void canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) = 0;
|
||||
virtual void canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) = 0;
|
||||
|
||||
/* CANVAS LIGHT OCCLUDER POLYGON */
|
||||
|
||||
virtual RID canvas_occluder_polygon_create() = 0;
|
||||
virtual void canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) = 0;
|
||||
|
||||
|
@ -1421,11 +1386,6 @@ public:
|
|||
|
||||
static ShaderLanguage::DataType global_variable_type_get_shader_datatype(GlobalVariableType p_type);
|
||||
|
||||
/* BLACK BARS */
|
||||
|
||||
virtual void black_bars_set_margins(int p_left, int p_top, int p_right, int p_bottom) = 0;
|
||||
virtual void black_bars_set_images(RID p_left, RID p_top, RID p_right, RID p_bottom) = 0;
|
||||
|
||||
/* FREE */
|
||||
|
||||
virtual void free(RID p_rid) = 0; ///< free RIDs associated with the visual server
|
||||
|
@ -1514,6 +1474,20 @@ public:
|
|||
|
||||
RenderingServer();
|
||||
virtual ~RenderingServer();
|
||||
|
||||
private:
|
||||
//binder helpers
|
||||
RID _texture_2d_layered_create(const TypedArray<Image> &p_layers, TextureLayeredType p_layered_type);
|
||||
RID _texture_3d_create(Image::Format p_format, int p_width, int p_height, int p_depth, bool p_mipmaps, const TypedArray<Image> &p_data);
|
||||
void _texture_3d_update(RID p_texture, const TypedArray<Image> &p_data);
|
||||
TypedArray<Image> _texture_3d_get(RID p_texture) const;
|
||||
TypedArray<Dictionary> _shader_get_param_list(RID p_shader) const;
|
||||
RID _mesh_create_from_surfaces(const TypedArray<Dictionary> &p_surfaces, int p_blend_shape_count);
|
||||
void _mesh_add_surface(RID p_mesh, const Dictionary &p_surface);
|
||||
Dictionary _mesh_get_surface(RID p_mesh, int p_idx);
|
||||
Array _instance_geometry_get_shader_parameter_list(RID p_instance) const;
|
||||
TypedArray<Image> _bake_render_uv2(RID p_base, const TypedArray<RID> &p_material_overrides, const Size2i &p_image_size);
|
||||
void _particles_set_trail_bind_poses(RID p_particles, const TypedArray<Transform3D> &p_bind_poses);
|
||||
};
|
||||
|
||||
// make variant understand the enums
|
||||
|
@ -1522,6 +1496,7 @@ VARIANT_ENUM_CAST(RenderingServer::CubeMapLayer);
|
|||
VARIANT_ENUM_CAST(RenderingServer::ShaderMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ArrayType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ArrayFormat);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ArrayCustomFormat);
|
||||
VARIANT_ENUM_CAST(RenderingServer::PrimitiveType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::BlendShapeMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::MultimeshTransformFormat);
|
||||
|
@ -1533,8 +1508,14 @@ VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowMode);
|
|||
VARIANT_ENUM_CAST(RenderingServer::LightDirectionalShadowDepthRangeMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeUpdateMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ReflectionProbeAmbientMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::VoxelGIQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::DecalTexture);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesTransformAlign);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesDrawOrder);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesEmitFlags);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ParticlesCollisionHeightfieldResolution);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportUpdateMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportClearMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportMSAA);
|
||||
|
@ -1542,6 +1523,8 @@ VARIANT_ENUM_CAST(RenderingServer::ViewportScreenSpaceAA);
|
|||
VARIANT_ENUM_CAST(RenderingServer::ViewportRenderInfo);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportDebugDraw);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportOcclusionCullingBuildQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportSDFOversize);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ViewportSDFScale);
|
||||
VARIANT_ENUM_CAST(RenderingServer::SkyMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentBG);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentAmbientSource);
|
||||
|
@ -1550,11 +1533,15 @@ VARIANT_ENUM_CAST(RenderingServer::EnvironmentGlowBlendMode);
|
|||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentToneMapper);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSRRoughnessQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSSAOQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGICascades);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIFramesToConverge);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIRayCount);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIFramesToUpdateLight);
|
||||
VARIANT_ENUM_CAST(RenderingServer::EnvironmentSDFGIYScale);
|
||||
VARIANT_ENUM_CAST(RenderingServer::SubSurfaceScatteringQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::DOFBlurQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::DOFBokehShape);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ShadowQuality);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ScenarioDebugMode);
|
||||
VARIANT_ENUM_CAST(RenderingServer::InstanceType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::InstanceFlags);
|
||||
VARIANT_ENUM_CAST(RenderingServer::ShadowCastingSetting);
|
||||
|
@ -1569,6 +1556,8 @@ VARIANT_ENUM_CAST(RenderingServer::CanvasOccluderPolygonCullMode);
|
|||
VARIANT_ENUM_CAST(RenderingServer::GlobalVariableType);
|
||||
VARIANT_ENUM_CAST(RenderingServer::RenderInfo);
|
||||
VARIANT_ENUM_CAST(RenderingServer::Features);
|
||||
VARIANT_ENUM_CAST(RenderingServer::CanvasTextureChannel);
|
||||
VARIANT_ENUM_CAST(RenderingServer::BakeChannels);
|
||||
|
||||
// Alias to make it easier to use.
|
||||
#define RS RenderingServer
|
||||
|
|
Loading…
Reference in New Issue