Merge pull request #50040 from reduz/fix-renderingserver-bindings

Clean up RenderingServer and its bindings
This commit is contained in:
Rémi Verschelde
2021-07-01 15:17:33 +02:00
committed by GitHub
34 changed files with 3020 additions and 900 deletions
-48
View File
@@ -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");
}
-13
View File
@@ -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;
+3 -7
View File
@@ -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);
}
+1 -1
View File
@@ -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;