summaryrefslogtreecommitdiff
path: root/scene/3d/reflection_probe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/reflection_probe.cpp')
-rw-r--r--scene/3d/reflection_probe.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/scene/3d/reflection_probe.cpp b/scene/3d/reflection_probe.cpp
index 24bf8b43d1..b1f19053d9 100644
--- a/scene/3d/reflection_probe.cpp
+++ b/scene/3d/reflection_probe.cpp
@@ -31,18 +31,15 @@
#include "reflection_probe.h"
void ReflectionProbe::set_intensity(float p_intensity) {
-
intensity = p_intensity;
RS::get_singleton()->reflection_probe_set_intensity(probe, p_intensity);
}
float ReflectionProbe::get_intensity() const {
-
return intensity;
}
void ReflectionProbe::set_interior_ambient(Color p_ambient) {
-
interior_ambient = p_ambient;
RS::get_singleton()->reflection_probe_set_interior_ambient(probe, p_ambient);
}
@@ -57,33 +54,28 @@ float ReflectionProbe::get_interior_ambient_energy() const {
}
Color ReflectionProbe::get_interior_ambient() const {
-
return interior_ambient;
}
void ReflectionProbe::set_interior_ambient_probe_contribution(float p_contribution) {
-
interior_ambient_probe_contribution = p_contribution;
RS::get_singleton()->reflection_probe_set_interior_ambient_probe_contribution(probe, p_contribution);
}
float ReflectionProbe::get_interior_ambient_probe_contribution() const {
-
return interior_ambient_probe_contribution;
}
void ReflectionProbe::set_max_distance(float p_distance) {
-
max_distance = p_distance;
RS::get_singleton()->reflection_probe_set_max_distance(probe, p_distance);
}
-float ReflectionProbe::get_max_distance() const {
+float ReflectionProbe::get_max_distance() const {
return max_distance;
}
void ReflectionProbe::set_extents(const Vector3 &p_extents) {
-
extents = p_extents;
for (int i = 0; i < 3; i++) {
@@ -102,17 +94,15 @@ void ReflectionProbe::set_extents(const Vector3 &p_extents) {
_change_notify("extents");
update_gizmo();
}
-Vector3 ReflectionProbe::get_extents() const {
+Vector3 ReflectionProbe::get_extents() const {
return extents;
}
void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
-
origin_offset = p_extents;
for (int i = 0; i < 3; i++) {
-
if (extents[i] - 0.01 < ABS(origin_offset[i])) {
origin_offset[i] = SGN(origin_offset[i]) * (extents[i] - 0.01);
}
@@ -123,50 +113,45 @@ void ReflectionProbe::set_origin_offset(const Vector3 &p_extents) {
_change_notify("origin_offset");
update_gizmo();
}
-Vector3 ReflectionProbe::get_origin_offset() const {
+Vector3 ReflectionProbe::get_origin_offset() const {
return origin_offset;
}
void ReflectionProbe::set_enable_box_projection(bool p_enable) {
-
box_projection = p_enable;
RS::get_singleton()->reflection_probe_set_enable_box_projection(probe, p_enable);
}
-bool ReflectionProbe::is_box_projection_enabled() const {
+bool ReflectionProbe::is_box_projection_enabled() const {
return box_projection;
}
void ReflectionProbe::set_as_interior(bool p_enable) {
-
interior = p_enable;
RS::get_singleton()->reflection_probe_set_as_interior(probe, interior);
_change_notify();
}
bool ReflectionProbe::is_set_as_interior() const {
-
return interior;
}
void ReflectionProbe::set_enable_shadows(bool p_enable) {
-
enable_shadows = p_enable;
RS::get_singleton()->reflection_probe_set_enable_shadows(probe, p_enable);
}
-bool ReflectionProbe::are_shadows_enabled() const {
+bool ReflectionProbe::are_shadows_enabled() const {
return enable_shadows;
}
void ReflectionProbe::set_cull_mask(uint32_t p_layers) {
-
cull_mask = p_layers;
RS::get_singleton()->reflection_probe_set_cull_mask(probe, p_layers);
}
-uint32_t ReflectionProbe::get_cull_mask() const {
+uint32_t ReflectionProbe::get_cull_mask() const {
return cull_mask;
}
@@ -180,19 +165,17 @@ ReflectionProbe::UpdateMode ReflectionProbe::get_update_mode() const {
}
AABB ReflectionProbe::get_aabb() const {
-
AABB aabb;
aabb.position = -origin_offset;
aabb.size = origin_offset + extents;
return aabb;
}
-Vector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const {
+Vector<Face3> ReflectionProbe::get_faces(uint32_t p_usage_flags) const {
return Vector<Face3>();
}
void ReflectionProbe::_validate_property(PropertyInfo &property) const {
-
if (property.name == "interior/ambient_color" || property.name == "interior/ambient_energy" || property.name == "interior/ambient_contrib") {
if (!interior) {
property.usage = PROPERTY_USAGE_NOEDITOR | PROPERTY_USAGE_INTERNAL;
@@ -201,7 +184,6 @@ void ReflectionProbe::_validate_property(PropertyInfo &property) const {
}
void ReflectionProbe::_bind_methods() {
-
ClassDB::bind_method(D_METHOD("set_intensity", "intensity"), &ReflectionProbe::set_intensity);
ClassDB::bind_method(D_METHOD("get_intensity"), &ReflectionProbe::get_intensity);
@@ -258,7 +240,6 @@ void ReflectionProbe::_bind_methods() {
}
ReflectionProbe::ReflectionProbe() {
-
intensity = 1.0;
interior_ambient = Color(0, 0, 0);
interior_ambient_probe_contribution = 0;
@@ -278,6 +259,5 @@ ReflectionProbe::ReflectionProbe() {
}
ReflectionProbe::~ReflectionProbe() {
-
RS::get_singleton()->free(probe);
}