summaryrefslogtreecommitdiff
path: root/scene/3d/gi_probe.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/gi_probe.cpp')
-rw-r--r--scene/3d/gi_probe.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index bc70feaffb..05d5d52d28 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -31,12 +31,12 @@
#include "mesh_instance.h"
-void GIProbeData::set_bounds(const Rect3 &p_bounds) {
+void GIProbeData::set_bounds(const AABB &p_bounds) {
VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds);
}
-Rect3 GIProbeData::get_bounds() const {
+AABB GIProbeData::get_bounds() const {
return VS::get_singleton()->gi_probe_get_bounds(probe);
}
@@ -180,7 +180,7 @@ void GIProbeData::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_compress", "compress"), &GIProbeData::set_compress);
ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbeData::is_compressed);
- ADD_PROPERTY(PropertyInfo(Variant::RECT3, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds");
+ ADD_PROPERTY(PropertyInfo(Variant::AABB, "bounds", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bounds", "get_bounds");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "cell_size", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_cell_size", "get_cell_size");
ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM, "to_cell_xform", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_to_cell_xform", "get_to_cell_xform");
@@ -542,7 +542,7 @@ static _FORCE_INLINE_ Vector2 get_uv(const Vector3 &p_pos, const Vector3 *p_vtx,
return p_uv[0] * u + p_uv[1] * v + p_uv[2] * w;
}
-void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const Rect3 &p_aabb, Baker *p_baker) {
+void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector2 *p_uv, const Baker::MaterialCache &p_material, const AABB &p_aabb, Baker *p_baker) {
if (p_level == p_baker->cell_subdiv - 1) {
//plot the face by guessing it's albedo and emission value
@@ -702,7 +702,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
int half = (1 << (p_baker->cell_subdiv - 1)) >> (p_level + 1);
for (int i = 0; i < 8; i++) {
- Rect3 aabb = p_aabb;
+ AABB aabb = p_aabb;
aabb.size *= 0.5;
int nx = p_x;
@@ -726,7 +726,7 @@ void GIProbe::_plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, cons
continue;
{
- Rect3 test_aabb = aabb;
+ AABB test_aabb = aabb;
//test_aabb.grow_by(test_aabb.get_longest_axis_size()*0.05); //grow a bit to avoid numerical error in real-time
Vector3 qsize = test_aabb.size * 0.5; //quarter size, for fast aabb test
@@ -1083,11 +1083,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
- Rect3 aabb = mesh->get_aabb();
+ AABB aabb = mesh->get_aabb();
Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform();
- if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) {
+ if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
Baker::PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
@@ -1113,11 +1113,11 @@ void GIProbe::_find_meshes(Node *p_at_node, Baker *p_baker) {
if (!mesh.is_valid())
continue;
- Rect3 aabb = mesh->get_aabb();
+ AABB aabb = mesh->get_aabb();
Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
- if (Rect3(-extents, extents * 2).intersects(xf.xform(aabb))) {
+ if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
Baker::PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
@@ -1151,7 +1151,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
baker.bake_cells.resize(1);
//find out the actual real bounds, power of 2, which gets the highest subdivision
- baker.po2_bounds = Rect3(-extents, extents * 2.0);
+ baker.po2_bounds = AABB(-extents, extents * 2.0);
int longest_axis = baker.po2_bounds.get_longest_axis_index();
baker.axis_cell_size[longest_axis] = (1 << (baker.cell_subdiv - 1));
baker.leaf_voxel_count = 0;
@@ -1286,7 +1286,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
Ref<GIProbeData> probe_data;
probe_data.instance();
- probe_data->set_bounds(Rect3(-extents, extents * 2.0));
+ probe_data->set_bounds(AABB(-extents, extents * 2.0));
probe_data->set_cell_size(baker.po2_bounds.size[longest_axis] / baker.axis_cell_size[longest_axis]);
probe_data->set_dynamic_data(data);
probe_data->set_dynamic_range(dynamic_range);
@@ -1306,7 +1306,7 @@ void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
}
}
-void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {
+void GIProbe::_debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, Baker *p_baker) {
if (p_level == p_baker->cell_subdiv - 1) {
@@ -1328,7 +1328,7 @@ void GIProbe::_debug_mesh(int p_idx, int p_level, const Rect3 &p_aabb, Ref<Multi
if (p_baker->bake_cells[p_idx].childs[i] == Baker::CHILD_EMPTY)
continue;
- Rect3 aabb = p_aabb;
+ AABB aabb = p_aabb;
aabb.size *= 0.5;
if (i & 1)
@@ -1440,9 +1440,9 @@ void GIProbe::_debug_bake() {
bake(NULL, true);
}
-Rect3 GIProbe::get_aabb() const {
+AABB GIProbe::get_aabb() const {
- return Rect3(-extents, extents * 2);
+ return AABB(-extents, extents * 2);
}
PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const {