Removed GIProbes.

This commit is contained in:
Relintai 2022-03-15 19:03:03 +01:00
parent 9e0b7c56bb
commit 03890f9e38
26 changed files with 161 additions and 4733 deletions

View File

@ -101,11 +101,6 @@ public:
bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) { return false; }
bool reflection_probe_instance_postprocess_step(RID p_instance) { return true; }
RID gi_probe_instance_create() { return RID(); }
void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) {}
void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {}
void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) {}
void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) {}
void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) {}
@ -557,51 +552,6 @@ public:
void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {}
void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) {}
/* GI PROBE API */
RID gi_probe_create() { return RID(); }
void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {}
AABB gi_probe_get_bounds(RID p_probe) const { return AABB(); }
void gi_probe_set_cell_size(RID p_probe, float p_range) {}
float gi_probe_get_cell_size(RID p_probe) const { return 0.0; }
void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {}
Transform gi_probe_get_to_cell_xform(RID p_probe) const { return Transform(); }
void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {}
PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const {
PoolVector<int> p;
return p;
}
void gi_probe_set_dynamic_range(RID p_probe, int p_range) {}
int gi_probe_get_dynamic_range(RID p_probe) const { return 0; }
void gi_probe_set_energy(RID p_probe, float p_range) {}
float gi_probe_get_energy(RID p_probe) const { return 0.0; }
void gi_probe_set_bias(RID p_probe, float p_range) {}
float gi_probe_get_bias(RID p_probe) const { return 0.0; }
void gi_probe_set_normal_bias(RID p_probe, float p_range) {}
float gi_probe_get_normal_bias(RID p_probe) const { return 0.0; }
void gi_probe_set_propagation(RID p_probe, float p_range) {}
float gi_probe_get_propagation(RID p_probe) const { return 0.0; }
void gi_probe_set_interior(RID p_probe, bool p_enable) {}
bool gi_probe_is_interior(RID p_probe) const { return false; }
void gi_probe_set_compress(RID p_probe, bool p_enable) {}
bool gi_probe_is_compressed(RID p_probe) const { return false; }
uint32_t gi_probe_get_version(RID p_probe) { return 0; }
RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) { return RID(); }
void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {}
/* LIGHTMAP CAPTURE */
struct Instantiable : public RID_Data {
SelfList<RasterizerScene::InstanceBase>::List instance_list;

View File

@ -982,20 +982,6 @@ void RasterizerSceneGLES2::light_instance_mark_visible(RID p_light_instance) {
light_instance->last_scene_pass = scene_pass;
}
//////////////////////
RID RasterizerSceneGLES2::gi_probe_instance_create() {
return RID();
}
void RasterizerSceneGLES2::gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) {
}
void RasterizerSceneGLES2::gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) {
}
void RasterizerSceneGLES2::gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) {
}
////////////////////////////
////////////////////////////
////////////////////////////

View File

@ -554,13 +554,6 @@ public:
int render_directional_lights;
int render_light_instance_count;
/* REFLECTION INSTANCE */
virtual RID gi_probe_instance_create();
virtual void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data);
virtual void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform);
virtual void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds);
/* RENDER LIST */
enum LightMode {

View File

@ -4555,97 +4555,6 @@ int RasterizerStorageGLES2::reflection_probe_get_resolution(RID p_probe) const {
return reflection_probe->resolution;
}
RID RasterizerStorageGLES2::gi_probe_create() {
return RID();
}
void RasterizerStorageGLES2::gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) {
}
AABB RasterizerStorageGLES2::gi_probe_get_bounds(RID p_probe) const {
return AABB();
}
void RasterizerStorageGLES2::gi_probe_set_cell_size(RID p_probe, float p_size) {
}
float RasterizerStorageGLES2::gi_probe_get_cell_size(RID p_probe) const {
return 0.0;
}
void RasterizerStorageGLES2::gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) {
}
Transform RasterizerStorageGLES2::gi_probe_get_to_cell_xform(RID p_probe) const {
return Transform();
}
void RasterizerStorageGLES2::gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) {
}
PoolVector<int> RasterizerStorageGLES2::gi_probe_get_dynamic_data(RID p_probe) const {
return PoolVector<int>();
}
void RasterizerStorageGLES2::gi_probe_set_dynamic_range(RID p_probe, int p_range) {
}
int RasterizerStorageGLES2::gi_probe_get_dynamic_range(RID p_probe) const {
return 0;
}
void RasterizerStorageGLES2::gi_probe_set_energy(RID p_probe, float p_range) {
}
void RasterizerStorageGLES2::gi_probe_set_bias(RID p_probe, float p_range) {
}
void RasterizerStorageGLES2::gi_probe_set_normal_bias(RID p_probe, float p_range) {
}
void RasterizerStorageGLES2::gi_probe_set_propagation(RID p_probe, float p_range) {
}
void RasterizerStorageGLES2::gi_probe_set_interior(RID p_probe, bool p_enable) {
}
bool RasterizerStorageGLES2::gi_probe_is_interior(RID p_probe) const {
return false;
}
void RasterizerStorageGLES2::gi_probe_set_compress(RID p_probe, bool p_enable) {
}
bool RasterizerStorageGLES2::gi_probe_is_compressed(RID p_probe) const {
return false;
}
float RasterizerStorageGLES2::gi_probe_get_energy(RID p_probe) const {
return 0;
}
float RasterizerStorageGLES2::gi_probe_get_bias(RID p_probe) const {
return 0;
}
float RasterizerStorageGLES2::gi_probe_get_normal_bias(RID p_probe) const {
return 0;
}
float RasterizerStorageGLES2::gi_probe_get_propagation(RID p_probe) const {
return 0;
}
uint32_t RasterizerStorageGLES2::gi_probe_get_version(RID p_probe) {
return 0;
}
RID RasterizerStorageGLES2::gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) {
return RID();
}
void RasterizerStorageGLES2::gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) {
}
///////
RID RasterizerStorageGLES2::lightmap_capture_create() {
@ -4900,10 +4809,6 @@ void RasterizerStorageGLES2::instance_add_dependency(RID p_base, RasterizerScene
inst = light_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
/*case VS::INSTANCE_GI_PROBE: {
inst = gi_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;*/
case VS::INSTANCE_LIGHTMAP_CAPTURE: {
inst = lightmap_capture_data_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
@ -4944,10 +4849,6 @@ void RasterizerStorageGLES2::instance_remove_dependency(RID p_base, RasterizerSc
inst = light_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break;
/*case VS::INSTANCE_GI_PROBE: {
inst = gi_probe_owner.getornull(p_base);
ERR_FAIL_COND(!inst);
} break; */
case VS::INSTANCE_LIGHTMAP_CAPTURE: {
inst = lightmap_capture_data_owner.getornull(p_base);
ERR_FAIL_COND(!inst);

View File

@ -1042,47 +1042,6 @@ public:
virtual float reflection_probe_get_origin_max_distance(RID p_probe) const;
virtual bool reflection_probe_renders_shadows(RID p_probe) const;
/* GI PROBE API */
virtual RID gi_probe_create();
virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds);
virtual AABB gi_probe_get_bounds(RID p_probe) const;
virtual void gi_probe_set_cell_size(RID p_probe, float p_size);
virtual float gi_probe_get_cell_size(RID p_probe) const;
virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform);
virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const;
virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data);
virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const;
virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range);
virtual int gi_probe_get_dynamic_range(RID p_probe) const;
virtual void gi_probe_set_energy(RID p_probe, float p_range);
virtual float gi_probe_get_energy(RID p_probe) const;
virtual void gi_probe_set_bias(RID p_probe, float p_range);
virtual float gi_probe_get_bias(RID p_probe) const;
virtual void gi_probe_set_normal_bias(RID p_probe, float p_range);
virtual float gi_probe_get_normal_bias(RID p_probe) const;
virtual void gi_probe_set_propagation(RID p_probe, float p_range);
virtual float gi_probe_get_propagation(RID p_probe) const;
virtual void gi_probe_set_interior(RID p_probe, bool p_enable);
virtual bool gi_probe_is_interior(RID p_probe) const;
virtual void gi_probe_set_compress(RID p_probe, bool p_enable);
virtual bool gi_probe_is_compressed(RID p_probe) const;
virtual uint32_t gi_probe_get_version(RID p_probe);
virtual RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression);
virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data);
/* LIGHTMAP */
struct LightmapCapture : public Instantiable {

View File

@ -125,7 +125,6 @@
#include "editor/plugins/cpu_particles_editor_plugin.h"
#include "editor/plugins/curve_editor_plugin.h"
#include "editor/plugins/editor_preview_plugins.h"
#include "editor/plugins/gi_probe_editor_plugin.h"
#include "editor/plugins/gradient_editor_plugin.h"
#include "editor/plugins/item_list_editor_plugin.h"
#include "editor/plugins/light_occluder_2d_editor_plugin.h"
@ -6947,7 +6946,6 @@ EditorNode::EditorNode() {
add_editor_plugin(memnew(SpriteFramesEditorPlugin(this)));
add_editor_plugin(memnew(TextureRegionEditorPlugin(this)));
add_editor_plugin(memnew(Particles2DEditorPlugin(this)));
add_editor_plugin(memnew(GIProbeEditorPlugin(this)));
add_editor_plugin(memnew(RoomManagerEditorPlugin(this)));
add_editor_plugin(memnew(RoomEditorPlugin(this)));
add_editor_plugin(memnew(OccluderEditorPlugin(this)));

View File

@ -1,99 +0,0 @@
/*************************************************************************/
/* gi_probe_editor_plugin.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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 "gi_probe_editor_plugin.h"
void GIProbeEditorPlugin::_bake() {
if (gi_probe) {
gi_probe->bake();
}
}
void GIProbeEditorPlugin::edit(Object *p_object) {
GIProbe *s = Object::cast_to<GIProbe>(p_object);
if (!s) {
return;
}
gi_probe = s;
}
bool GIProbeEditorPlugin::handles(Object *p_object) const {
return p_object->is_class("GIProbe");
}
void GIProbeEditorPlugin::make_visible(bool p_visible) {
if (p_visible) {
bake->show();
} else {
bake->hide();
}
}
EditorProgress *GIProbeEditorPlugin::tmp_progress = nullptr;
void GIProbeEditorPlugin::bake_func_begin(int p_steps) {
ERR_FAIL_COND(tmp_progress != nullptr);
tmp_progress = memnew(EditorProgress("bake_gi", TTR("Bake GI Probe"), p_steps));
}
void GIProbeEditorPlugin::bake_func_step(int p_step, const String &p_description) {
ERR_FAIL_COND(tmp_progress == nullptr);
tmp_progress->step(p_description, p_step, false);
}
void GIProbeEditorPlugin::bake_func_end() {
ERR_FAIL_COND(tmp_progress == nullptr);
memdelete(tmp_progress);
tmp_progress = nullptr;
}
void GIProbeEditorPlugin::_bind_methods() {
ClassDB::bind_method("_bake", &GIProbeEditorPlugin::_bake);
}
GIProbeEditorPlugin::GIProbeEditorPlugin(EditorNode *p_node) {
editor = p_node;
bake = memnew(ToolButton);
bake->set_icon(editor->get_gui_base()->get_icon("Bake", "EditorIcons"));
bake->set_text(TTR("Bake GI Probe"));
bake->hide();
bake->connect("pressed", this, "_bake");
add_control_to_container(CONTAINER_SPATIAL_EDITOR_MENU, bake);
gi_probe = nullptr;
GIProbe::bake_begin_function = bake_func_begin;
GIProbe::bake_step_function = bake_func_step;
GIProbe::bake_end_function = bake_func_end;
}
GIProbeEditorPlugin::~GIProbeEditorPlugin() {
}

View File

@ -1,68 +0,0 @@
/*************************************************************************/
/* gi_probe_editor_plugin.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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. */
/*************************************************************************/
#ifndef GIPROBEEDITORPLUGIN_H
#define GIPROBEEDITORPLUGIN_H
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
#include "scene/3d/gi_probe.h"
#include "scene/resources/material.h"
class GIProbeEditorPlugin : public EditorPlugin {
GDCLASS(GIProbeEditorPlugin, EditorPlugin);
GIProbe *gi_probe;
ToolButton *bake;
EditorNode *editor;
static EditorProgress *tmp_progress;
static void bake_func_begin(int p_steps);
static void bake_func_step(int p_step, const String &p_description);
static void bake_func_end();
void _bake();
protected:
static void _bind_methods();
public:
virtual String get_name() const { return "GIProbe"; }
bool has_main_screen() const { return false; }
virtual void edit(Object *p_object);
virtual bool handles(Object *p_object) const;
virtual void make_visible(bool p_visible);
GIProbeEditorPlugin(EditorNode *p_node);
~GIProbeEditorPlugin();
};
#endif // GIPROBEEDITORPLUGIN_H

View File

@ -6543,7 +6543,6 @@ void SpatialEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<ParticlesGizmoPlugin>(memnew(ParticlesGizmoPlugin)));
add_gizmo_plugin(Ref<CPUParticlesGizmoPlugin>(memnew(CPUParticlesGizmoPlugin)));
add_gizmo_plugin(Ref<ReflectionProbeGizmoPlugin>(memnew(ReflectionProbeGizmoPlugin)));
add_gizmo_plugin(Ref<GIProbeGizmoPlugin>(memnew(GIProbeGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionObjectGizmoPlugin>(memnew(CollisionObjectGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionShapeSpatialGizmoPlugin>(memnew(CollisionShapeSpatialGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionPolygonSpatialGizmoPlugin>(memnew(CollisionPolygonSpatialGizmoPlugin)));

View File

@ -6540,7 +6540,6 @@ void SpatialEditor::_register_all_gizmos() {
add_gizmo_plugin(Ref<ParticlesGizmoPlugin>(memnew(ParticlesGizmoPlugin)));
add_gizmo_plugin(Ref<CPUParticlesGizmoPlugin>(memnew(CPUParticlesGizmoPlugin)));
add_gizmo_plugin(Ref<ReflectionProbeGizmoPlugin>(memnew(ReflectionProbeGizmoPlugin)));
add_gizmo_plugin(Ref<GIProbeGizmoPlugin>(memnew(GIProbeGizmoPlugin)));
add_gizmo_plugin(Ref<BakedIndirectLightGizmoPlugin>(memnew(BakedIndirectLightGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionObjectGizmoPlugin>(memnew(CollisionObjectGizmoPlugin)));
add_gizmo_plugin(Ref<CollisionShapeSpatialGizmoPlugin>(memnew(CollisionShapeSpatialGizmoPlugin)));

View File

@ -36,7 +36,6 @@
#include "scene/3d/collision_polygon.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/cpu_particles.h"
#include "scene/3d/gi_probe.h"
#include "scene/3d/light.h"
#include "scene/3d/listener.h"
#include "scene/3d/mesh_instance.h"
@ -2691,176 +2690,6 @@ void ReflectionProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_handles(handles, get_material("handles"));
}
GIProbeGizmoPlugin::GIProbeGizmoPlugin() {
Color gizmo_color = EDITOR_DEF("editors/3d_gizmos/gizmo_colors/gi_probe", Color(0.5, 1, 0.6));
create_material("gi_probe_material", gizmo_color);
gizmo_color.a = 0.5;
create_material("gi_probe_internal_material", gizmo_color);
gizmo_color.a = 0.1;
create_material("gi_probe_solid_material", gizmo_color);
create_icon_material("gi_probe_icon", SpatialEditor::get_singleton()->get_icon("GizmoGIProbe", "EditorIcons"));
create_handle_material("handles");
}
bool GIProbeGizmoPlugin::has_gizmo(Spatial *p_spatial) {
return Object::cast_to<GIProbe>(p_spatial) != nullptr;
}
String GIProbeGizmoPlugin::get_name() const {
return "GIProbe";
}
int GIProbeGizmoPlugin::get_priority() const {
return -1;
}
String GIProbeGizmoPlugin::get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const {
switch (p_idx) {
case 0:
return "Extents X";
case 1:
return "Extents Y";
case 2:
return "Extents Z";
}
return "";
}
Variant GIProbeGizmoPlugin::get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const {
GIProbe *probe = Object::cast_to<GIProbe>(p_gizmo->get_spatial_node());
return probe->get_extents();
}
void GIProbeGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point) {
GIProbe *probe = Object::cast_to<GIProbe>(p_gizmo->get_spatial_node());
Transform gt = probe->get_global_transform();
Transform gi = gt.affine_inverse();
Vector3 extents = probe->get_extents();
Vector3 ray_from = p_camera->project_ray_origin(p_point);
Vector3 ray_dir = p_camera->project_ray_normal(p_point);
Vector3 sg[2] = { gi.xform(ray_from), gi.xform(ray_from + ray_dir * 16384) };
Vector3 axis;
axis[p_idx] = 1.0;
Vector3 ra, rb;
Geometry::get_closest_points_between_segments(Vector3(), axis * 16384, sg[0], sg[1], ra, rb);
float d = ra[p_idx];
if (SpatialEditor::get_singleton()->is_snap_enabled()) {
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
}
if (d < 0.001) {
d = 0.001;
}
extents[p_idx] = d;
probe->set_extents(extents);
}
void GIProbeGizmoPlugin::commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel) {
GIProbe *probe = Object::cast_to<GIProbe>(p_gizmo->get_spatial_node());
Vector3 restore = p_restore;
if (p_cancel) {
probe->set_extents(restore);
return;
}
UndoRedo *ur = SpatialEditor::get_singleton()->get_undo_redo();
ur->create_action(TTR("Change Probe Extents"));
ur->add_do_method(probe, "set_extents", probe->get_extents());
ur->add_undo_method(probe, "set_extents", restore);
ur->commit_action();
}
void GIProbeGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
GIProbe *probe = Object::cast_to<GIProbe>(p_gizmo->get_spatial_node());
Ref<Material> material = get_material("gi_probe_material", p_gizmo);
Ref<Material> icon = get_material("gi_probe_icon", p_gizmo);
Ref<Material> material_internal = get_material("gi_probe_internal_material", p_gizmo);
p_gizmo->clear();
Vector<Vector3> lines;
Vector3 extents = probe->get_extents();
static const int subdivs[GIProbe::SUBDIV_MAX] = { 64, 128, 256, 512 };
AABB aabb = AABB(-extents, extents * 2);
int subdiv = subdivs[probe->get_subdiv()];
float cell_size = aabb.get_longest_axis_size() / subdiv;
for (int i = 0; i < 12; i++) {
Vector3 a, b;
aabb.get_edge(i, a, b);
lines.push_back(a);
lines.push_back(b);
}
p_gizmo->add_lines(lines, material);
lines.clear();
for (int i = 1; i < subdiv; i++) {
for (int j = 0; j < 3; j++) {
if (cell_size * i > aabb.size[j]) {
continue;
}
int j_n1 = (j + 1) % 3;
int j_n2 = (j + 2) % 3;
for (int k = 0; k < 4; k++) {
Vector3 from = aabb.position, to = aabb.position;
from[j] += cell_size * i;
to[j] += cell_size * i;
if (k & 1) {
to[j_n1] += aabb.size[j_n1];
} else {
to[j_n2] += aabb.size[j_n2];
}
if (k & 2) {
from[j_n1] += aabb.size[j_n1];
from[j_n2] += aabb.size[j_n2];
}
lines.push_back(from);
lines.push_back(to);
}
}
}
p_gizmo->add_lines(lines, material_internal);
Vector<Vector3> handles;
for (int i = 0; i < 3; i++) {
Vector3 ax;
ax[i] = aabb.position[i] + aabb.size[i];
handles.push_back(ax);
}
if (p_gizmo->is_selected()) {
Ref<Material> solid_material = get_material("gi_probe_solid_material", p_gizmo);
p_gizmo->add_solid_box(solid_material, aabb.get_size());
}
p_gizmo->add_unscaled_billboard(icon, 0.05);
p_gizmo->add_handles(handles, get_material("handles"));
}
////
CollisionObjectGizmoPlugin::CollisionObjectGizmoPlugin() {

View File

@ -283,23 +283,6 @@ public:
ReflectionProbeGizmoPlugin();
};
class GIProbeGizmoPlugin : public EditorSpatialGizmoPlugin {
GDCLASS(GIProbeGizmoPlugin, EditorSpatialGizmoPlugin);
public:
bool has_gizmo(Spatial *p_spatial);
String get_name() const;
int get_priority() const;
void redraw(EditorSpatialGizmo *p_gizmo);
String get_handle_name(const EditorSpatialGizmo *p_gizmo, int p_idx) const;
Variant get_handle_value(EditorSpatialGizmo *p_gizmo, int p_idx) const;
void set_handle(EditorSpatialGizmo *p_gizmo, int p_idx, Camera *p_camera, const Point2 &p_point);
void commit_handle(EditorSpatialGizmo *p_gizmo, int p_idx, const Variant &p_restore, bool p_cancel = false);
GIProbeGizmoPlugin();
};
class CollisionObjectGizmoPlugin : public EditorSpatialGizmoPlugin {
GDCLASS(CollisionObjectGizmoPlugin, EditorSpatialGizmoPlugin);

View File

@ -1,531 +0,0 @@
/*************************************************************************/
/* gi_probe.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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 "gi_probe.h"
#include "core/os/os.h"
#include "mesh_instance.h"
#include "voxel_light_baker.h"
void GIProbeData::set_bounds(const AABB &p_bounds) {
VS::get_singleton()->gi_probe_set_bounds(probe, p_bounds);
}
AABB GIProbeData::get_bounds() const {
return VS::get_singleton()->gi_probe_get_bounds(probe);
}
void GIProbeData::set_cell_size(float p_size) {
VS::get_singleton()->gi_probe_set_cell_size(probe, p_size);
}
float GIProbeData::get_cell_size() const {
return VS::get_singleton()->gi_probe_get_cell_size(probe);
}
void GIProbeData::set_to_cell_xform(const Transform &p_xform) {
VS::get_singleton()->gi_probe_set_to_cell_xform(probe, p_xform);
}
Transform GIProbeData::get_to_cell_xform() const {
return VS::get_singleton()->gi_probe_get_to_cell_xform(probe);
}
void GIProbeData::set_dynamic_data(const PoolVector<int> &p_data) {
VS::get_singleton()->gi_probe_set_dynamic_data(probe, p_data);
}
PoolVector<int> GIProbeData::get_dynamic_data() const {
return VS::get_singleton()->gi_probe_get_dynamic_data(probe);
}
void GIProbeData::set_dynamic_range(int p_range) {
VS::get_singleton()->gi_probe_set_dynamic_range(probe, p_range);
}
void GIProbeData::set_energy(float p_range) {
VS::get_singleton()->gi_probe_set_energy(probe, p_range);
}
float GIProbeData::get_energy() const {
return VS::get_singleton()->gi_probe_get_energy(probe);
}
void GIProbeData::set_bias(float p_range) {
VS::get_singleton()->gi_probe_set_bias(probe, p_range);
}
float GIProbeData::get_bias() const {
return VS::get_singleton()->gi_probe_get_bias(probe);
}
void GIProbeData::set_normal_bias(float p_range) {
VS::get_singleton()->gi_probe_set_normal_bias(probe, p_range);
}
float GIProbeData::get_normal_bias() const {
return VS::get_singleton()->gi_probe_get_normal_bias(probe);
}
void GIProbeData::set_propagation(float p_range) {
VS::get_singleton()->gi_probe_set_propagation(probe, p_range);
}
float GIProbeData::get_propagation() const {
return VS::get_singleton()->gi_probe_get_propagation(probe);
}
void GIProbeData::set_interior(bool p_enable) {
VS::get_singleton()->gi_probe_set_interior(probe, p_enable);
}
bool GIProbeData::is_interior() const {
return VS::get_singleton()->gi_probe_is_interior(probe);
}
bool GIProbeData::is_compressed() const {
return VS::get_singleton()->gi_probe_is_compressed(probe);
}
void GIProbeData::set_compress(bool p_enable) {
VS::get_singleton()->gi_probe_set_compress(probe, p_enable);
}
int GIProbeData::get_dynamic_range() const {
return VS::get_singleton()->gi_probe_get_dynamic_range(probe);
}
RID GIProbeData::get_rid() const {
return probe;
}
void GIProbeData::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_bounds", "bounds"), &GIProbeData::set_bounds);
ClassDB::bind_method(D_METHOD("get_bounds"), &GIProbeData::get_bounds);
ClassDB::bind_method(D_METHOD("set_cell_size", "cell_size"), &GIProbeData::set_cell_size);
ClassDB::bind_method(D_METHOD("get_cell_size"), &GIProbeData::get_cell_size);
ClassDB::bind_method(D_METHOD("set_to_cell_xform", "to_cell_xform"), &GIProbeData::set_to_cell_xform);
ClassDB::bind_method(D_METHOD("get_to_cell_xform"), &GIProbeData::get_to_cell_xform);
ClassDB::bind_method(D_METHOD("set_dynamic_data", "dynamic_data"), &GIProbeData::set_dynamic_data);
ClassDB::bind_method(D_METHOD("get_dynamic_data"), &GIProbeData::get_dynamic_data);
ClassDB::bind_method(D_METHOD("set_dynamic_range", "dynamic_range"), &GIProbeData::set_dynamic_range);
ClassDB::bind_method(D_METHOD("get_dynamic_range"), &GIProbeData::get_dynamic_range);
ClassDB::bind_method(D_METHOD("set_energy", "energy"), &GIProbeData::set_energy);
ClassDB::bind_method(D_METHOD("get_energy"), &GIProbeData::get_energy);
ClassDB::bind_method(D_METHOD("set_bias", "bias"), &GIProbeData::set_bias);
ClassDB::bind_method(D_METHOD("get_bias"), &GIProbeData::get_bias);
ClassDB::bind_method(D_METHOD("set_normal_bias", "bias"), &GIProbeData::set_normal_bias);
ClassDB::bind_method(D_METHOD("get_normal_bias"), &GIProbeData::get_normal_bias);
ClassDB::bind_method(D_METHOD("set_propagation", "propagation"), &GIProbeData::set_propagation);
ClassDB::bind_method(D_METHOD("get_propagation"), &GIProbeData::get_propagation);
ClassDB::bind_method(D_METHOD("set_interior", "interior"), &GIProbeData::set_interior);
ClassDB::bind_method(D_METHOD("is_interior"), &GIProbeData::is_interior);
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::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");
ADD_PROPERTY(PropertyInfo(Variant::POOL_INT_ARRAY, "dynamic_data", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_dynamic_data", "get_dynamic_data");
ADD_PROPERTY(PropertyInfo(Variant::INT, "dynamic_range", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_dynamic_range", "get_dynamic_range");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_energy", "get_energy");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_bias", "get_bias");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_normal_bias", "get_normal_bias");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_propagation", "get_propagation");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_interior", "is_interior");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NOEDITOR), "set_compress", "is_compressed");
}
GIProbeData::GIProbeData() {
probe = RID_PRIME(VS::get_singleton()->gi_probe_create());
}
GIProbeData::~GIProbeData() {
VS::get_singleton()->free(probe);
}
//////////////////////
//////////////////////
void GIProbe::set_probe_data(const Ref<GIProbeData> &p_data) {
if (p_data.is_valid()) {
VS::get_singleton()->instance_set_base(get_instance(), p_data->get_rid());
} else {
VS::get_singleton()->instance_set_base(get_instance(), RID());
}
probe_data = p_data;
}
Ref<GIProbeData> GIProbe::get_probe_data() const {
return probe_data;
}
void GIProbe::set_subdiv(Subdiv p_subdiv) {
ERR_FAIL_INDEX(p_subdiv, SUBDIV_MAX);
subdiv = p_subdiv;
update_gizmo();
}
GIProbe::Subdiv GIProbe::get_subdiv() const {
return subdiv;
}
void GIProbe::set_extents(const Vector3 &p_extents) {
extents = p_extents;
update_gizmo();
_change_notify("extents");
}
Vector3 GIProbe::get_extents() const {
return extents;
}
void GIProbe::set_dynamic_range(int p_dynamic_range) {
dynamic_range = p_dynamic_range;
}
int GIProbe::get_dynamic_range() const {
return dynamic_range;
}
void GIProbe::set_energy(float p_energy) {
energy = p_energy;
if (probe_data.is_valid()) {
probe_data->set_energy(energy);
}
}
float GIProbe::get_energy() const {
return energy;
}
void GIProbe::set_bias(float p_bias) {
bias = p_bias;
if (probe_data.is_valid()) {
probe_data->set_bias(bias);
}
}
float GIProbe::get_bias() const {
return bias;
}
void GIProbe::set_normal_bias(float p_normal_bias) {
normal_bias = p_normal_bias;
if (probe_data.is_valid()) {
probe_data->set_normal_bias(normal_bias);
}
}
float GIProbe::get_normal_bias() const {
return normal_bias;
}
void GIProbe::set_propagation(float p_propagation) {
propagation = p_propagation;
if (probe_data.is_valid()) {
probe_data->set_propagation(propagation);
}
}
float GIProbe::get_propagation() const {
return propagation;
}
void GIProbe::set_interior(bool p_enable) {
interior = p_enable;
if (probe_data.is_valid()) {
probe_data->set_interior(p_enable);
}
}
bool GIProbe::is_interior() const {
return interior;
}
void GIProbe::set_compress(bool p_enable) {
compress = p_enable;
if (probe_data.is_valid()) {
probe_data->set_compress(p_enable);
}
update_configuration_warning();
}
bool GIProbe::is_compressed() const {
return compress;
}
void GIProbe::_find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes) {
MeshInstance *mi = Object::cast_to<MeshInstance>(p_at_node);
if (mi && mi->get_flag(GeometryInstance::FLAG_USE_BAKED_LIGHT) && mi->is_visible_in_tree()) {
Ref<Mesh> mesh = mi->get_mesh();
if (mesh.is_valid()) {
AABB aabb = mesh->get_aabb();
Transform xf = get_global_transform().affine_inverse() * mi->get_global_transform();
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
for (int i = 0; i < mesh->get_surface_count(); i++) {
pm.instance_materials.push_back(mi->get_surface_material(i));
}
pm.override_material = mi->get_material_override();
plot_meshes.push_back(pm);
}
}
}
Spatial *s = Object::cast_to<Spatial>(p_at_node);
if (s) {
if (s->is_visible_in_tree()) {
Array meshes = p_at_node->call("get_meshes");
for (int i = 0; i < meshes.size(); i += 2) {
Transform mxf = meshes[i];
Ref<Mesh> mesh = meshes[i + 1];
if (!mesh.is_valid()) {
continue;
}
AABB aabb = mesh->get_aabb();
Transform xf = get_global_transform().affine_inverse() * (s->get_global_transform() * mxf);
if (AABB(-extents, extents * 2).intersects(xf.xform(aabb))) {
PlotMesh pm;
pm.local_xform = xf;
pm.mesh = mesh;
plot_meshes.push_back(pm);
}
}
}
}
for (int i = 0; i < p_at_node->get_child_count(); i++) {
Node *child = p_at_node->get_child(i);
_find_meshes(child, plot_meshes);
}
}
GIProbe::BakeBeginFunc GIProbe::bake_begin_function = nullptr;
GIProbe::BakeStepFunc GIProbe::bake_step_function = nullptr;
GIProbe::BakeEndFunc GIProbe::bake_end_function = nullptr;
void GIProbe::bake(Node *p_from_node, bool p_create_visual_debug) {
static const int subdiv_value[SUBDIV_MAX] = { 7, 8, 9, 10 };
p_from_node = p_from_node ? p_from_node : get_parent();
ERR_FAIL_NULL(p_from_node);
VoxelLightBaker baker;
baker.begin_bake(subdiv_value[subdiv], AABB(-extents, extents * 2.0));
List<PlotMesh> mesh_list;
_find_meshes(p_from_node, mesh_list);
if (bake_begin_function) {
bake_begin_function(mesh_list.size() + 1);
}
int pmc = 0;
for (List<PlotMesh>::Element *E = mesh_list.front(); E; E = E->next()) {
if (bake_step_function) {
bake_step_function(pmc, RTR("Plotting Meshes") + " " + itos(pmc) + "/" + itos(mesh_list.size()));
}
pmc++;
baker.plot_mesh(E->get().local_xform, E->get().mesh, E->get().instance_materials, E->get().override_material);
}
if (bake_step_function) {
bake_step_function(pmc++, RTR("Finishing Plot"));
}
baker.end_bake();
//create the data for visual server
PoolVector<int> data = baker.create_gi_probe_data();
if (p_create_visual_debug) {
MultiMeshInstance *mmi = memnew(MultiMeshInstance);
mmi->set_multimesh(baker.create_debug_multimesh());
add_child(mmi);
#ifdef TOOLS_ENABLED
if (is_inside_tree() && get_tree()->get_edited_scene_root() == this) {
mmi->set_owner(this);
} else {
mmi->set_owner(get_owner());
}
#else
mmi->set_owner(get_owner());
#endif
} else {
Ref<GIProbeData> probe_data = get_probe_data();
if (probe_data.is_null()) {
probe_data.instance();
}
probe_data->set_bounds(AABB(-extents, extents * 2.0));
probe_data->set_cell_size(baker.get_cell_size());
probe_data->set_dynamic_data(data);
probe_data->set_dynamic_range(dynamic_range);
probe_data->set_energy(energy);
probe_data->set_bias(bias);
probe_data->set_normal_bias(normal_bias);
probe_data->set_propagation(propagation);
probe_data->set_interior(interior);
probe_data->set_compress(compress);
probe_data->set_to_cell_xform(baker.get_to_cell_space_xform());
set_probe_data(probe_data);
}
if (bake_end_function) {
bake_end_function();
}
}
void GIProbe::_debug_bake() {
bake(nullptr, true);
}
AABB GIProbe::get_aabb() const {
return AABB(-extents, extents * 2);
}
PoolVector<Face3> GIProbe::get_faces(uint32_t p_usage_flags) const {
return PoolVector<Face3>();
}
String GIProbe::get_configuration_warning() const {
String warning = VisualInstance::get_configuration_warning();
if (OS::get_singleton()->get_current_video_driver() == OS::VIDEO_DRIVER_GLES2) {
if (warning != String()) {
warning += "\n\n";
}
warning += TTR("GIProbes are not supported by the GLES2 video driver.\nUse a BakedLightmap instead.");
}
if (is_compressed()) {
if (warning != String()) {
warning += "\n\n";
}
warning += TTR("The GIProbe Compress property has been deprecated due to known bugs and no longer has any effect.\nTo remove this warning, disable the GIProbe's Compress property.");
}
return warning;
}
void GIProbe::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_probe_data", "data"), &GIProbe::set_probe_data);
ClassDB::bind_method(D_METHOD("get_probe_data"), &GIProbe::get_probe_data);
ClassDB::bind_method(D_METHOD("set_subdiv", "subdiv"), &GIProbe::set_subdiv);
ClassDB::bind_method(D_METHOD("get_subdiv"), &GIProbe::get_subdiv);
ClassDB::bind_method(D_METHOD("set_extents", "extents"), &GIProbe::set_extents);
ClassDB::bind_method(D_METHOD("get_extents"), &GIProbe::get_extents);
ClassDB::bind_method(D_METHOD("set_dynamic_range", "max"), &GIProbe::set_dynamic_range);
ClassDB::bind_method(D_METHOD("get_dynamic_range"), &GIProbe::get_dynamic_range);
ClassDB::bind_method(D_METHOD("set_energy", "max"), &GIProbe::set_energy);
ClassDB::bind_method(D_METHOD("get_energy"), &GIProbe::get_energy);
ClassDB::bind_method(D_METHOD("set_bias", "max"), &GIProbe::set_bias);
ClassDB::bind_method(D_METHOD("get_bias"), &GIProbe::get_bias);
ClassDB::bind_method(D_METHOD("set_normal_bias", "max"), &GIProbe::set_normal_bias);
ClassDB::bind_method(D_METHOD("get_normal_bias"), &GIProbe::get_normal_bias);
ClassDB::bind_method(D_METHOD("set_propagation", "max"), &GIProbe::set_propagation);
ClassDB::bind_method(D_METHOD("get_propagation"), &GIProbe::get_propagation);
ClassDB::bind_method(D_METHOD("set_interior", "enable"), &GIProbe::set_interior);
ClassDB::bind_method(D_METHOD("is_interior"), &GIProbe::is_interior);
ClassDB::bind_method(D_METHOD("set_compress", "enable"), &GIProbe::set_compress);
ClassDB::bind_method(D_METHOD("is_compressed"), &GIProbe::is_compressed);
ClassDB::bind_method(D_METHOD("bake", "from_node", "create_visual_debug"), &GIProbe::bake, DEFVAL(Variant()), DEFVAL(false));
ClassDB::bind_method(D_METHOD("debug_bake"), &GIProbe::_debug_bake);
ClassDB::set_method_flags(get_class_static(), _scs_create("debug_bake"), METHOD_FLAGS_DEFAULT | METHOD_FLAG_EDITOR);
ADD_PROPERTY(PropertyInfo(Variant::INT, "subdiv", PROPERTY_HINT_ENUM, "64,128,256,512"), "set_subdiv", "get_subdiv");
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3, "extents"), "set_extents", "get_extents");
ADD_PROPERTY(PropertyInfo(Variant::INT, "dynamic_range", PROPERTY_HINT_RANGE, "1,16,1"), "set_dynamic_range", "get_dynamic_range");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "energy", PROPERTY_HINT_RANGE, "0,16,0.01,or_greater"), "set_energy", "get_energy");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "propagation", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_propagation", "get_propagation");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_bias", "get_bias");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "normal_bias", PROPERTY_HINT_RANGE, "0,4,0.001"), "set_normal_bias", "get_normal_bias");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "interior"), "set_interior", "is_interior");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "compress"), "set_compress", "is_compressed");
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "data", PROPERTY_HINT_RESOURCE_TYPE, "GIProbeData", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_DO_NOT_SHARE_ON_DUPLICATE), "set_probe_data", "get_probe_data");
BIND_ENUM_CONSTANT(SUBDIV_64);
BIND_ENUM_CONSTANT(SUBDIV_128);
BIND_ENUM_CONSTANT(SUBDIV_256);
BIND_ENUM_CONSTANT(SUBDIV_512);
BIND_ENUM_CONSTANT(SUBDIV_MAX);
}
GIProbe::GIProbe() {
subdiv = SUBDIV_128;
dynamic_range = 4;
energy = 1.0;
bias = 1.5;
normal_bias = 0.0;
propagation = 0.7;
extents = Vector3(10, 10, 10);
interior = false;
compress = false;
gi_probe = RID_PRIME(VS::get_singleton()->gi_probe_create());
set_disable_scale(true);
}
GIProbe::~GIProbe() {
VS::get_singleton()->free(gi_probe);
}

View File

@ -1,178 +0,0 @@
/*************************************************************************/
/* gi_probe.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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. */
/*************************************************************************/
#ifndef GIPROBE_H
#define GIPROBE_H
#include "multimesh_instance.h"
#include "scene/3d/visual_instance.h"
class GIProbeData : public Resource {
GDCLASS(GIProbeData, Resource);
RID probe;
protected:
static void _bind_methods();
public:
void set_bounds(const AABB &p_bounds);
AABB get_bounds() const;
void set_cell_size(float p_size);
float get_cell_size() const;
void set_to_cell_xform(const Transform &p_xform);
Transform get_to_cell_xform() const;
void set_dynamic_data(const PoolVector<int> &p_data);
PoolVector<int> get_dynamic_data() const;
void set_dynamic_range(int p_range);
int get_dynamic_range() const;
void set_propagation(float p_range);
float get_propagation() const;
void set_energy(float p_range);
float get_energy() const;
void set_bias(float p_range);
float get_bias() const;
void set_normal_bias(float p_range);
float get_normal_bias() const;
void set_interior(bool p_enable);
bool is_interior() const;
void set_compress(bool p_enable);
bool is_compressed() const;
virtual RID get_rid() const;
GIProbeData();
~GIProbeData();
};
class GIProbe : public VisualInstance {
GDCLASS(GIProbe, VisualInstance);
public:
enum Subdiv {
SUBDIV_64,
SUBDIV_128,
SUBDIV_256,
SUBDIV_512,
SUBDIV_MAX
};
typedef void (*BakeBeginFunc)(int);
typedef void (*BakeStepFunc)(int, const String &);
typedef void (*BakeEndFunc)();
private:
Ref<GIProbeData> probe_data;
RID gi_probe;
Subdiv subdiv;
Vector3 extents;
int dynamic_range;
float energy;
float bias;
float normal_bias;
float propagation;
bool interior;
bool compress;
struct PlotMesh {
Ref<Material> override_material;
Vector<Ref<Material>> instance_materials;
Ref<Mesh> mesh;
Transform local_xform;
};
void _find_meshes(Node *p_at_node, List<PlotMesh> &plot_meshes);
void _debug_bake();
protected:
static void _bind_methods();
public:
static BakeBeginFunc bake_begin_function;
static BakeStepFunc bake_step_function;
static BakeEndFunc bake_end_function;
void set_probe_data(const Ref<GIProbeData> &p_data);
Ref<GIProbeData> get_probe_data() const;
void set_subdiv(Subdiv p_subdiv);
Subdiv get_subdiv() const;
void set_extents(const Vector3 &p_extents);
Vector3 get_extents() const;
void set_dynamic_range(int p_dynamic_range);
int get_dynamic_range() const;
void set_energy(float p_energy);
float get_energy() const;
void set_bias(float p_bias);
float get_bias() const;
void set_normal_bias(float p_normal_bias);
float get_normal_bias() const;
void set_propagation(float p_propagation);
float get_propagation() const;
void set_interior(bool p_enable);
bool is_interior() const;
void set_compress(bool p_enable);
bool is_compressed() const;
void bake(Node *p_from_node = nullptr, bool p_create_visual_debug = false);
virtual AABB get_aabb() const;
virtual PoolVector<Face3> get_faces(uint32_t p_usage_flags) const;
virtual String get_configuration_warning() const;
GIProbe();
~GIProbe();
};
VARIANT_ENUM_CAST(GIProbe::Subdiv)
#endif // GIPROBE_H

File diff suppressed because it is too large Load Diff

View File

@ -1,171 +0,0 @@
/*************************************************************************/
/* voxel_light_baker.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* 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. */
/*************************************************************************/
#ifndef VOXEL_LIGHT_BAKER_H
#define VOXEL_LIGHT_BAKER_H
#include "scene/3d/mesh_instance.h"
#include "scene/resources/multimesh.h"
class VoxelLightBaker {
public:
enum DebugMode {
DEBUG_ALBEDO,
DEBUG_LIGHT
};
enum BakeQuality {
BAKE_QUALITY_LOW,
BAKE_QUALITY_MEDIUM,
BAKE_QUALITY_HIGH
};
enum BakeMode {
BAKE_MODE_CONE_TRACE,
BAKE_MODE_RAY_TRACE,
};
private:
enum {
CHILD_EMPTY = 0xFFFFFFFF
};
struct Cell {
uint32_t children[8];
float albedo[3]; //albedo in RGB24
float emission[3]; //accumulated light in 16:16 fixed point (needs to be integer for moving lights fast)
float normal[3];
uint32_t used_sides;
float alpha; //used for upsampling
int level;
Cell() {
for (int i = 0; i < 8; i++) {
children[i] = CHILD_EMPTY;
}
for (int i = 0; i < 3; i++) {
emission[i] = 0;
albedo[i] = 0;
normal[i] = 0;
}
alpha = 0;
used_sides = 0;
level = 0;
}
};
Vector<Cell> bake_cells;
int cell_subdiv;
struct Light {
int x, y, z;
float accum[6][3]; //rgb anisotropic
float direct_accum[6][3]; //for direct bake
int next_leaf;
Light() {
x = y = z = 0;
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 3; j++) {
accum[i][j] = 0;
direct_accum[i][j] = 0;
}
}
next_leaf = 0;
}
};
int first_leaf;
Vector<Light> bake_light;
struct MaterialCache {
//128x128 textures
Vector<Color> albedo;
Vector<Color> emission;
};
Map<Ref<Material>, MaterialCache> material_cache;
int leaf_voxel_count;
bool direct_lights_baked;
AABB original_bounds;
AABB po2_bounds;
int axis_cell_size[3];
Transform to_cell_space;
int color_scan_cell_width;
int bake_texture_size;
float cell_size;
float propagation;
BakeQuality bake_quality;
int max_original_cells;
void _init_light_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, uint32_t p_parent);
Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color_mul, const Color &p_color_add);
MaterialCache _get_material_cache(Ref<Material> p_material);
void _plot_face(int p_idx, int p_level, int p_x, int p_y, int p_z, const Vector3 *p_vtx, const Vector3 *p_normal, const Vector2 *p_uv, const MaterialCache &p_material, const AABB &p_aabb);
void _fixup_plot(int p_idx, int p_level);
void _debug_mesh(int p_idx, int p_level, const AABB &p_aabb, Ref<MultiMesh> &p_multimesh, int &idx, DebugMode p_mode);
void _check_init_light();
uint32_t _find_cell_at_pos(const Cell *cells, int x, int y, int z);
public:
void begin_bake(int p_subdiv, const AABB &p_bounds);
void plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, const Vector<Ref<Material>> &p_materials, const Ref<Material> &p_override_material);
void begin_bake_light(BakeQuality p_quality = BAKE_QUALITY_MEDIUM, float p_propagation = 0.85);
void plot_light_directional(const Vector3 &p_direction, const Color &p_color, float p_energy, float p_indirect_energy, bool p_direct);
void plot_light_omni(const Vector3 &p_pos, const Color &p_color, float p_energy, float p_indirect_energy, float p_radius, float p_attenutation, bool p_direct);
void plot_light_spot(const Vector3 &p_pos, const Vector3 &p_axis, const Color &p_color, float p_energy, float p_indirect_energy, float p_radius, float p_attenutation, float p_spot_angle, float p_spot_attenuation, bool p_direct);
void end_bake();
struct LightMapData {
int width;
int height;
PoolVector<float> light;
};
PoolVector<int> create_gi_probe_data();
Ref<MultiMesh> create_debug_multimesh(DebugMode p_mode = DEBUG_ALBEDO);
PoolVector<uint8_t> create_capture_octree(int p_subdiv);
float get_cell_size() const;
Transform get_to_cell_space_xform() const;
VoxelLightBaker();
};
#endif // VOXEL_LIGHT_BAKER_H

View File

@ -185,7 +185,6 @@
#include "scene/3d/collision_polygon.h"
#include "scene/3d/collision_shape.h"
#include "scene/3d/cpu_particles.h"
#include "scene/3d/gi_probe.h"
#include "scene/3d/immediate_geometry.h"
#include "scene/3d/interpolated_camera.h"
#include "scene/3d/light.h"
@ -438,8 +437,6 @@ void register_scene_types() {
ClassDB::register_class<OmniLight>();
ClassDB::register_class<SpotLight>();
ClassDB::register_class<ReflectionProbe>();
ClassDB::register_class<GIProbe>();
ClassDB::register_class<GIProbeData>();
ClassDB::register_class<Particles>();
ClassDB::register_class<CPUParticles>();
ClassDB::register_class<Position3D>();

View File

@ -109,7 +109,6 @@ public:
Vector<RID> materials;
Vector<RID> light_instances;
Vector<RID> reflection_probe_instances;
Vector<RID> gi_probe_instances;
PoolVector<float> blend_values;
@ -184,11 +183,6 @@ public:
virtual bool reflection_probe_instance_begin_render(RID p_instance, RID p_reflection_atlas) = 0;
virtual bool reflection_probe_instance_postprocess_step(RID p_instance) = 0;
virtual RID gi_probe_instance_create() = 0;
virtual void gi_probe_instance_set_light_data(RID p_probe, RID p_base, RID p_data) = 0;
virtual void gi_probe_instance_set_transform_to_data(RID p_probe, const Transform &p_xform) = 0;
virtual void gi_probe_instance_set_bounds(RID p_probe, const Vector3 &p_bounds) = 0;
virtual void render_scene(const Transform &p_cam_transform, const CameraMatrix &p_cam_projection, const int p_eye, bool p_cam_ortogonal, InstanceBase **p_cull_result, int p_cull_count, RID *p_light_cull_result, int p_light_cull_count, RID *p_reflection_probe_cull_result, int p_reflection_probe_cull_count, RID p_environment, RID p_shadow_atlas, RID p_reflection_atlas, RID p_reflection_probe, int p_reflection_probe_pass) = 0;
virtual void render_shadow(RID p_light, RID p_shadow_atlas, int p_pass, InstanceBase **p_cull_result, int p_cull_count) = 0;
@ -522,54 +516,6 @@ public:
virtual void instance_add_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0;
virtual void instance_remove_dependency(RID p_base, RasterizerScene::InstanceBase *p_instance) = 0;
/* GI PROBE API */
virtual RID gi_probe_create() = 0;
virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) = 0;
virtual AABB gi_probe_get_bounds(RID p_probe) const = 0;
virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_cell_size(RID p_probe) const = 0;
virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) = 0;
virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const = 0;
virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) = 0;
virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const = 0;
virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range) = 0;
virtual int gi_probe_get_dynamic_range(RID p_probe) const = 0;
virtual void gi_probe_set_energy(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_energy(RID p_probe) const = 0;
virtual void gi_probe_set_bias(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_bias(RID p_probe) const = 0;
virtual void gi_probe_set_normal_bias(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_normal_bias(RID p_probe) const = 0;
virtual void gi_probe_set_propagation(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_propagation(RID p_probe) const = 0;
virtual void gi_probe_set_interior(RID p_probe, bool p_enable) = 0;
virtual bool gi_probe_is_interior(RID p_probe) const = 0;
virtual void gi_probe_set_compress(RID p_probe, bool p_enable) = 0;
virtual bool gi_probe_is_compressed(RID p_probe) const = 0;
virtual uint32_t gi_probe_get_version(RID p_probe) = 0;
enum GIProbeCompression {
GI_PROBE_UNCOMPRESSED,
GI_PROBE_S3TC,
GI_PROBE_ETC2
};
virtual RID gi_probe_dynamic_data_create(int p_width, int p_height, int p_depth, GIProbeCompression p_compression) = 0;
virtual void gi_probe_dynamic_data_update(RID p_gi_probe_data, int p_depth_slice, int p_slice_count, int p_mipmap, const void *p_data) = 0;
/* LIGHTMAP CAPTURE */
struct LightmapCaptureOctree {

View File

@ -114,7 +114,6 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
VSG::scene->update_dirty_instances(); //update scene stuff
VSG::viewport->draw_viewports();
VSG::scene->render_probes();
_draw_margins();
VSG::rasterizer->end_frame(p_swap_buffers);

View File

@ -356,43 +356,6 @@ public:
BIND2(reflection_probe_set_cull_mask, RID, uint32_t)
BIND2(reflection_probe_set_resolution, RID, int)
/* BAKED LIGHT API */
BIND0R(RID, gi_probe_create)
BIND2(gi_probe_set_bounds, RID, const AABB &)
BIND1RC(AABB, gi_probe_get_bounds, RID)
BIND2(gi_probe_set_cell_size, RID, float)
BIND1RC(float, gi_probe_get_cell_size, RID)
BIND2(gi_probe_set_to_cell_xform, RID, const Transform &)
BIND1RC(Transform, gi_probe_get_to_cell_xform, RID)
BIND2(gi_probe_set_dynamic_range, RID, int)
BIND1RC(int, gi_probe_get_dynamic_range, RID)
BIND2(gi_probe_set_energy, RID, float)
BIND1RC(float, gi_probe_get_energy, RID)
BIND2(gi_probe_set_bias, RID, float)
BIND1RC(float, gi_probe_get_bias, RID)
BIND2(gi_probe_set_normal_bias, RID, float)
BIND1RC(float, gi_probe_get_normal_bias, RID)
BIND2(gi_probe_set_propagation, RID, float)
BIND1RC(float, gi_probe_get_propagation, RID)
BIND2(gi_probe_set_interior, RID, bool)
BIND1RC(bool, gi_probe_is_interior, RID)
BIND2(gi_probe_set_compress, RID, bool)
BIND1RC(bool, gi_probe_is_compressed, RID)
BIND2(gi_probe_set_dynamic_data, RID, const PoolVector<int> &)
BIND1RC(PoolVector<int>, gi_probe_get_dynamic_data, RID)
/* LIGHTMAP CAPTURE */
BIND0R(RID, lightmap_capture_create)

File diff suppressed because it is too large Load Diff

View File

@ -423,9 +423,6 @@ public:
List<Instance *> reflection_probes;
bool reflection_dirty;
List<Instance *> gi_probes;
bool gi_probes_dirty;
List<Instance *> lightmap_captures;
InstanceGeometryData() {
@ -433,7 +430,6 @@ public:
reflection_dirty = true;
can_cast_shadows = true;
material_is_animated = true;
gi_probes_dirty = true;
}
};
@ -489,108 +485,6 @@ public:
}
};
struct InstanceGIProbeData : public InstanceBaseData {
Instance *owner;
struct PairInfo {
List<Instance *>::Element *L; //gi probe iterator in geometry
Instance *geometry;
};
List<PairInfo> geometries;
Set<Instance *> lights;
struct LightCache {
VS::LightType type;
Transform transform;
Color color;
float energy;
float radius;
float attenuation;
float spot_angle;
float spot_attenuation;
bool visible;
bool operator==(const LightCache &p_cache) {
return (type == p_cache.type &&
transform == p_cache.transform &&
color == p_cache.color &&
energy == p_cache.energy &&
radius == p_cache.radius &&
attenuation == p_cache.attenuation &&
spot_angle == p_cache.spot_angle &&
spot_attenuation == p_cache.spot_attenuation &&
visible == p_cache.visible);
}
bool operator!=(const LightCache &p_cache) {
return !operator==(p_cache);
}
LightCache() {
type = VS::LIGHT_DIRECTIONAL;
energy = 1.0;
radius = 1.0;
attenuation = 1.0;
spot_angle = 1.0;
spot_attenuation = 1.0;
visible = true;
}
};
struct LocalData {
uint16_t pos[3];
uint16_t energy[3]; //using 0..1024 for float range 0..1. integer is needed for deterministic add/remove of lights
};
struct CompBlockS3TC {
uint32_t offset; //offset in mipmap
uint32_t source_count; //sources
uint32_t sources[16]; //id for each source
uint8_t alpha[8]; //alpha block is pre-computed
};
struct Dynamic {
Map<RID, LightCache> light_cache;
Map<RID, LightCache> light_cache_changes;
PoolVector<int> light_data;
PoolVector<LocalData> local_data;
Vector<Vector<uint32_t>> level_cell_lists;
RID probe_data;
bool enabled;
int bake_dynamic_range;
RasterizerStorage::GIProbeCompression compression;
Vector<PoolVector<uint8_t>> mipmaps_3d;
Vector<PoolVector<CompBlockS3TC>> mipmaps_s3tc; //for s3tc
int updating_stage;
float propagate;
int grid_size[3];
Transform light_to_cell_xform;
} dynamic;
RID probe_instance;
bool invalid;
uint32_t base_version;
SelfList<InstanceGIProbeData> update_element;
InstanceGIProbeData() :
update_element(this) {
invalid = true;
base_version = 0;
dynamic.updating_stage = GI_UPDATE_STAGE_CHECK;
}
};
SelfList<InstanceGIProbeData>::List gi_probe_update_list;
struct InstanceLightmapCaptureData : public InstanceBaseData {
struct PairInfo {
List<Instance *>::Element *L; //iterator in geometry
@ -843,52 +737,6 @@ public:
void update_interpolation_tick(Scenario::InterpolationData &r_interpolation_data, bool p_process = true);
void update_interpolation_frame(Scenario::InterpolationData &r_interpolation_data, bool p_process = true);
//probes
struct GIProbeDataHeader {
uint32_t version;
uint32_t cell_subdiv;
uint32_t width;
uint32_t height;
uint32_t depth;
uint32_t cell_count;
uint32_t leaf_cell_count;
};
struct GIProbeDataCell {
uint32_t children[8];
uint32_t albedo;
uint32_t emission;
uint32_t normal;
uint32_t level_alpha;
};
enum {
GI_UPDATE_STAGE_CHECK,
GI_UPDATE_STAGE_LIGHTING,
GI_UPDATE_STAGE_UPLOADING,
};
void _gi_probe_bake_thread();
static void _gi_probe_bake_threads(void *);
bool probe_bake_thread_exit;
Thread probe_bake_thread;
Semaphore probe_bake_sem;
Mutex probe_bake_mutex;
List<Instance *> probe_bake_list;
bool _render_reflection_probe_step(Instance *p_instance, int p_step);
void _gi_probe_fill_local_data(int p_idx, int p_level, int p_x, int p_y, int p_z, const GIProbeDataCell *p_cell, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, Vector<uint32_t> *prev_cell);
_FORCE_INLINE_ uint32_t _gi_bake_find_cell(const GIProbeDataCell *cells, int x, int y, int z, int p_cell_subdiv);
void _bake_gi_downscale_light(int p_idx, int p_level, const GIProbeDataCell *p_cells, const GIProbeDataHeader *p_header, InstanceGIProbeData::LocalData *p_local_data, float p_propagate);
void _bake_gi_probe_light(const GIProbeDataHeader *header, const GIProbeDataCell *cells, InstanceGIProbeData::LocalData *local_data, const uint32_t *leaves, int p_leaf_count, const InstanceGIProbeData::LightCache &light_cache, int p_sign);
void _bake_gi_probe(Instance *p_gi_probe);
bool _check_gi_probe(Instance *p_gi_probe);
void _setup_gi_probe(Instance *p_instance);
void render_probes();
bool free(RID p_rid);
private:

View File

@ -158,7 +158,6 @@ void VisualServerWrapMT::finish() {
omni_light_free_cached_ids();
spot_light_free_cached_ids();
reflection_probe_free_cached_ids();
gi_probe_free_cached_ids();
lightmap_capture_free_cached_ids();
particles_free_cached_ids();
camera_free_cached_ids();

View File

@ -286,43 +286,6 @@ public:
FUNC2(reflection_probe_set_cull_mask, RID, uint32_t)
FUNC2(reflection_probe_set_resolution, RID, int)
/* BAKED LIGHT API */
FUNCRID(gi_probe)
FUNC2(gi_probe_set_bounds, RID, const AABB &)
FUNC1RC(AABB, gi_probe_get_bounds, RID)
FUNC2(gi_probe_set_cell_size, RID, float)
FUNC1RC(float, gi_probe_get_cell_size, RID)
FUNC2(gi_probe_set_to_cell_xform, RID, const Transform &)
FUNC1RC(Transform, gi_probe_get_to_cell_xform, RID)
FUNC2(gi_probe_set_dynamic_range, RID, int)
FUNC1RC(int, gi_probe_get_dynamic_range, RID)
FUNC2(gi_probe_set_energy, RID, float)
FUNC1RC(float, gi_probe_get_energy, RID)
FUNC2(gi_probe_set_bias, RID, float)
FUNC1RC(float, gi_probe_get_bias, RID)
FUNC2(gi_probe_set_normal_bias, RID, float)
FUNC1RC(float, gi_probe_get_normal_bias, RID)
FUNC2(gi_probe_set_propagation, RID, float)
FUNC1RC(float, gi_probe_get_propagation, RID)
FUNC2(gi_probe_set_interior, RID, bool)
FUNC1RC(bool, gi_probe_is_interior, RID)
FUNC2(gi_probe_set_compress, RID, bool)
FUNC1RC(bool, gi_probe_is_compressed, RID)
FUNC2(gi_probe_set_dynamic_data, RID, const PoolVector<int> &)
FUNC1RC(PoolVector<int>, gi_probe_get_dynamic_data, RID)
/* LIGHTMAP CAPTURE */
FUNCRID(lightmap_capture)

View File

@ -1990,30 +1990,6 @@ void VisualServer::_bind_methods() {
ClassDB::bind_method(D_METHOD("reflection_probe_set_enable_shadows", "probe", "enable"), &VisualServer::reflection_probe_set_enable_shadows);
ClassDB::bind_method(D_METHOD("reflection_probe_set_cull_mask", "probe", "layers"), &VisualServer::reflection_probe_set_cull_mask);
ClassDB::bind_method(D_METHOD("gi_probe_create"), &VisualServer::gi_probe_create);
ClassDB::bind_method(D_METHOD("gi_probe_set_bounds", "probe", "bounds"), &VisualServer::gi_probe_set_bounds);
ClassDB::bind_method(D_METHOD("gi_probe_get_bounds", "probe"), &VisualServer::gi_probe_get_bounds);
ClassDB::bind_method(D_METHOD("gi_probe_set_cell_size", "probe", "range"), &VisualServer::gi_probe_set_cell_size);
ClassDB::bind_method(D_METHOD("gi_probe_get_cell_size", "probe"), &VisualServer::gi_probe_get_cell_size);
ClassDB::bind_method(D_METHOD("gi_probe_set_to_cell_xform", "probe", "xform"), &VisualServer::gi_probe_set_to_cell_xform);
ClassDB::bind_method(D_METHOD("gi_probe_get_to_cell_xform", "probe"), &VisualServer::gi_probe_get_to_cell_xform);
ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_data", "probe", "data"), &VisualServer::gi_probe_set_dynamic_data);
ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_data", "probe"), &VisualServer::gi_probe_get_dynamic_data);
ClassDB::bind_method(D_METHOD("gi_probe_set_dynamic_range", "probe", "range"), &VisualServer::gi_probe_set_dynamic_range);
ClassDB::bind_method(D_METHOD("gi_probe_get_dynamic_range", "probe"), &VisualServer::gi_probe_get_dynamic_range);
ClassDB::bind_method(D_METHOD("gi_probe_set_energy", "probe", "energy"), &VisualServer::gi_probe_set_energy);
ClassDB::bind_method(D_METHOD("gi_probe_get_energy", "probe"), &VisualServer::gi_probe_get_energy);
ClassDB::bind_method(D_METHOD("gi_probe_set_bias", "probe", "bias"), &VisualServer::gi_probe_set_bias);
ClassDB::bind_method(D_METHOD("gi_probe_get_bias", "probe"), &VisualServer::gi_probe_get_bias);
ClassDB::bind_method(D_METHOD("gi_probe_set_normal_bias", "probe", "bias"), &VisualServer::gi_probe_set_normal_bias);
ClassDB::bind_method(D_METHOD("gi_probe_get_normal_bias", "probe"), &VisualServer::gi_probe_get_normal_bias);
ClassDB::bind_method(D_METHOD("gi_probe_set_propagation", "probe", "propagation"), &VisualServer::gi_probe_set_propagation);
ClassDB::bind_method(D_METHOD("gi_probe_get_propagation", "probe"), &VisualServer::gi_probe_get_propagation);
ClassDB::bind_method(D_METHOD("gi_probe_set_interior", "probe", "enable"), &VisualServer::gi_probe_set_interior);
ClassDB::bind_method(D_METHOD("gi_probe_is_interior", "probe"), &VisualServer::gi_probe_is_interior);
ClassDB::bind_method(D_METHOD("gi_probe_set_compress", "probe", "enable"), &VisualServer::gi_probe_set_compress);
ClassDB::bind_method(D_METHOD("gi_probe_is_compressed", "probe"), &VisualServer::gi_probe_is_compressed);
ClassDB::bind_method(D_METHOD("lightmap_capture_create"), &VisualServer::lightmap_capture_create);
ClassDB::bind_method(D_METHOD("lightmap_capture_set_bounds", "capture", "bounds"), &VisualServer::lightmap_capture_set_bounds);
ClassDB::bind_method(D_METHOD("lightmap_capture_get_bounds", "capture"), &VisualServer::lightmap_capture_get_bounds);
@ -2424,7 +2400,6 @@ void VisualServer::_bind_methods() {
BIND_ENUM_CONSTANT(INSTANCE_PARTICLES);
BIND_ENUM_CONSTANT(INSTANCE_LIGHT);
BIND_ENUM_CONSTANT(INSTANCE_REFLECTION_PROBE);
BIND_ENUM_CONSTANT(INSTANCE_GI_PROBE);
BIND_ENUM_CONSTANT(INSTANCE_LIGHTMAP_CAPTURE);
BIND_ENUM_CONSTANT(INSTANCE_MAX);
BIND_ENUM_CONSTANT(INSTANCE_GEOMETRY_MASK);

View File

@ -526,43 +526,6 @@ public:
virtual void reflection_probe_set_cull_mask(RID p_probe, uint32_t p_layers) = 0;
virtual void reflection_probe_set_resolution(RID p_probe, int p_resolution) = 0;
/* GI PROBE API */
virtual RID gi_probe_create() = 0;
virtual void gi_probe_set_bounds(RID p_probe, const AABB &p_bounds) = 0;
virtual AABB gi_probe_get_bounds(RID p_probe) const = 0;
virtual void gi_probe_set_cell_size(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_cell_size(RID p_probe) const = 0;
virtual void gi_probe_set_to_cell_xform(RID p_probe, const Transform &p_xform) = 0;
virtual Transform gi_probe_get_to_cell_xform(RID p_probe) const = 0;
virtual void gi_probe_set_dynamic_data(RID p_probe, const PoolVector<int> &p_data) = 0;
virtual PoolVector<int> gi_probe_get_dynamic_data(RID p_probe) const = 0;
virtual void gi_probe_set_dynamic_range(RID p_probe, int p_range) = 0;
virtual int gi_probe_get_dynamic_range(RID p_probe) const = 0;
virtual void gi_probe_set_energy(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_energy(RID p_probe) const = 0;
virtual void gi_probe_set_bias(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_bias(RID p_probe) const = 0;
virtual void gi_probe_set_normal_bias(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_normal_bias(RID p_probe) const = 0;
virtual void gi_probe_set_propagation(RID p_probe, float p_range) = 0;
virtual float gi_probe_get_propagation(RID p_probe) const = 0;
virtual void gi_probe_set_interior(RID p_probe, bool p_enable) = 0;
virtual bool gi_probe_is_interior(RID p_probe) const = 0;
virtual void gi_probe_set_compress(RID p_probe, bool p_enable) = 0;
virtual bool gi_probe_is_compressed(RID p_probe) const = 0;
/* LIGHTMAP CAPTURE */
virtual RID lightmap_capture_create() = 0;
@ -850,7 +813,6 @@ public:
INSTANCE_PARTICLES,
INSTANCE_LIGHT,
INSTANCE_REFLECTION_PROBE,
INSTANCE_GI_PROBE,
INSTANCE_LIGHTMAP_CAPTURE,
INSTANCE_MAX,