summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/bind/core_bind.cpp13
-rw-r--r--core/bind/core_bind.h3
-rw-r--r--core/engine.cpp25
-rw-r--r--core/engine.h19
-rw-r--r--core/project_settings.cpp28
-rw-r--r--core/project_settings.h17
-rw-r--r--core/register_core_types.cpp27
-rw-r--r--core/script_debugger_remote.cpp3
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.cpp18
-rw-r--r--drivers/gles3/rasterizer_storage_gles3.h2
-rw-r--r--editor/doc/doc_data.cpp9
-rw-r--r--editor/editor_file_system.cpp3
-rw-r--r--editor/editor_node.cpp4
-rw-r--r--editor/plugins/material_editor_plugin.cpp38
-rw-r--r--editor/plugins/material_editor_plugin.h8
-rw-r--r--editor/project_manager.cpp2
-rw-r--r--editor/scene_tree_editor.cpp6
-rw-r--r--main/main.cpp2
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp4
-rw-r--r--modules/gdnative/nativescript/api_generator.cpp4
-rw-r--r--modules/gdscript/gd_script.cpp12
-rw-r--r--modules/mono/editor/bindings_generator.cpp6
-rw-r--r--modules/mono/glue/glue_header.h2
-rw-r--r--modules/mono/register_types.cpp4
-rw-r--r--modules/visual_script/visual_script_func_nodes.cpp16
-rw-r--r--modules/visual_script/visual_script_nodes.cpp11
-rw-r--r--platform/android/godot_android.cpp3
-rw-r--r--platform/android/java_glue.cpp5
-rw-r--r--platform/android/os_android.cpp2
-rw-r--r--platform/iphone/os_iphone.cpp10
-rw-r--r--platform/javascript/os_javascript.cpp5
-rw-r--r--scene/2d/canvas_item.cpp6
-rw-r--r--scene/2d/canvas_item.h2
-rw-r--r--scene/3d/gi_probe.cpp19
-rw-r--r--scene/3d/gi_probe.h2
-rw-r--r--scene/resources/material.cpp27
-rw-r--r--scene/resources/material.h12
-rw-r--r--scene/resources/mesh.cpp7
-rw-r--r--scene/resources/mesh.h3
-rw-r--r--servers/register_server_types.cpp11
-rw-r--r--servers/visual/rasterizer.h2
-rw-r--r--servers/visual/visual_server_raster.cpp2
-rw-r--r--servers/visual/visual_server_raster.h517
-rw-r--r--servers/visual/visual_server_wrap_mt.h2
-rw-r--r--servers/visual_server.cpp2
-rw-r--r--servers/visual_server.h3
46 files changed, 291 insertions, 637 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp
index c369f4bffe..e1adb250e7 100644
--- a/core/bind/core_bind.cpp
+++ b/core/bind/core_bind.cpp
@@ -2592,6 +2592,16 @@ bool _Engine::is_in_physics_frame() const {
return Engine::get_singleton()->is_in_physics_frame();
}
+bool _Engine::has_singleton(const String &p_name) const {
+
+ return Engine::get_singleton()->has_singleton(p_name);
+}
+
+Object *_Engine::get_singleton_object(const String &p_name) const {
+
+ return Engine::get_singleton()->get_singleton_object(p_name);
+}
+
void _Engine::set_editor_hint(bool p_enabled) {
Engine::get_singleton()->set_editor_hint(p_enabled);
@@ -2621,6 +2631,9 @@ void _Engine::_bind_methods() {
ClassDB::bind_method(D_METHOD("is_in_physics_frame"), &_Engine::is_in_physics_frame);
+ ClassDB::bind_method(D_METHOD("has_singleton", "name"), &_Engine::has_singleton);
+ ClassDB::bind_method(D_METHOD("get_singleton", "name"), &_Engine::get_singleton_object);
+
ClassDB::bind_method(D_METHOD("set_editor_hint", "enabled"), &_Engine::set_editor_hint);
ClassDB::bind_method(D_METHOD("is_editor_hint"), &_Engine::is_editor_hint);
}
diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h
index bbbb40d926..9be8895443 100644
--- a/core/bind/core_bind.h
+++ b/core/bind/core_bind.h
@@ -670,6 +670,9 @@ public:
bool is_in_physics_frame() const;
+ bool has_singleton(const String &p_name) const;
+ Object *get_singleton_object(const String &p_name) const;
+
void set_editor_hint(bool p_enabled);
bool is_editor_hint() const;
diff --git a/core/engine.cpp b/core/engine.cpp
index c609ae9520..31abcd62ef 100644
--- a/core/engine.cpp
+++ b/core/engine.cpp
@@ -100,6 +100,31 @@ Dictionary Engine::get_version_info() const {
return dict;
}
+void Engine::add_singleton(const Singleton &p_singleton) {
+
+ singletons.push_back(p_singleton);
+ singleton_ptrs[p_singleton.name] = p_singleton.ptr;
+}
+
+Object *Engine::get_singleton_object(const String &p_name) const {
+
+ const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
+ ERR_EXPLAIN("Failed to retrieve non-existent singleton '" + p_name + "'");
+ ERR_FAIL_COND_V(!E, NULL);
+ return E->get();
+};
+
+bool Engine::has_singleton(const String &p_name) const {
+
+ return singleton_ptrs.has(p_name);
+};
+
+void Engine::get_singletons(List<Singleton> *p_singletons) {
+
+ for (List<Singleton>::Element *E = singletons.front(); E; E = E->next())
+ p_singletons->push_back(E->get());
+}
+
Engine *Engine::singleton = NULL;
Engine *Engine::get_singleton() {
diff --git a/core/engine.h b/core/engine.h
index 3b4979582f..4a573c1539 100644
--- a/core/engine.h
+++ b/core/engine.h
@@ -37,6 +37,17 @@
class Engine {
+public:
+ struct Singleton {
+ StringName name;
+ Object *ptr;
+ Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL)
+ : name(p_name),
+ ptr(p_ptr) {
+ }
+ };
+
+private:
friend class Main;
uint64_t frames_drawn;
@@ -54,6 +65,9 @@ class Engine {
uint64_t _idle_frames;
bool _in_physics;
+ List<Singleton> singletons;
+ Map<StringName, Object *> singleton_ptrs;
+
bool editor_hint;
static Engine *singleton;
@@ -83,6 +97,11 @@ public:
void set_frame_delay(uint32_t p_msec);
uint32_t get_frame_delay() const;
+ void add_singleton(const Singleton &p_singleton);
+ void get_singletons(List<Singleton> *p_singletons);
+ bool has_singleton(const String &p_name) const;
+ Object *get_singleton_object(const String &p_name) const;
+
_FORCE_INLINE_ bool get_use_pixel_snap() const { return _pixel_snap; }
#ifdef TOOLS_ENABLED
diff --git a/core/project_settings.cpp b/core/project_settings.cpp
index 2e4fc26784..65a6f2b83c 100644
--- a/core/project_settings.cpp
+++ b/core/project_settings.cpp
@@ -776,32 +776,6 @@ Variant _GLOBAL_DEF(const String &p_var, const Variant &p_default) {
return ret;
}
-void ProjectSettings::add_singleton(const Singleton &p_singleton) {
-
- singletons.push_back(p_singleton);
- singleton_ptrs[p_singleton.name] = p_singleton.ptr;
-}
-
-Object *ProjectSettings::get_singleton_object(const String &p_name) const {
-
- const Map<StringName, Object *>::Element *E = singleton_ptrs.find(p_name);
- if (!E)
- return NULL;
- else
- return E->get();
-};
-
-bool ProjectSettings::has_singleton(const String &p_name) const {
-
- return get_singleton_object(p_name) != NULL;
-};
-
-void ProjectSettings::get_singletons(List<Singleton> *p_singletons) {
-
- for (List<Singleton>::Element *E = singletons.front(); E; E = E->next())
- p_singletons->push_back(E->get());
-}
-
Vector<String> ProjectSettings::get_optimizer_presets() const {
List<PropertyInfo> pi;
@@ -893,8 +867,6 @@ void ProjectSettings::_bind_methods() {
ClassDB::bind_method(D_METHOD("localize_path", "path"), &ProjectSettings::localize_path);
ClassDB::bind_method(D_METHOD("globalize_path", "path"), &ProjectSettings::globalize_path);
ClassDB::bind_method(D_METHOD("save"), &ProjectSettings::save);
- ClassDB::bind_method(D_METHOD("has_singleton", "name"), &ProjectSettings::has_singleton);
- ClassDB::bind_method(D_METHOD("get_singleton", "name"), &ProjectSettings::get_singleton_object);
ClassDB::bind_method(D_METHOD("load_resource_pack", "pack"), &ProjectSettings::_load_resource_pack);
ClassDB::bind_method(D_METHOD("property_can_revert", "name"), &ProjectSettings::property_can_revert);
ClassDB::bind_method(D_METHOD("property_get_revert", "name"), &ProjectSettings::property_get_revert);
diff --git a/core/project_settings.h b/core/project_settings.h
index f75cad815f..1c4078cebb 100644
--- a/core/project_settings.h
+++ b/core/project_settings.h
@@ -45,14 +45,6 @@ class ProjectSettings : public Object {
public:
typedef Map<String, Variant> CustomMap;
- struct Singleton {
- StringName name;
- Object *ptr;
- Singleton(const StringName &p_name = StringName(), Object *p_ptr = NULL)
- : name(p_name),
- ptr(p_ptr) {
- }
- };
enum {
//properties that are not for built in values begin from this value, so builtin ones are displayed first
NO_BUILTIN_ORDER_BASE = 1 << 16
@@ -106,9 +98,6 @@ protected:
Error _save_settings_text(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
Error _save_settings_binary(const String &p_file, const Map<String, List<String> > &props, const CustomMap &p_custom = CustomMap(), const String &p_custom_features = String());
- List<Singleton> singletons;
- Map<StringName, Object *> singleton_ptrs;
-
Error _save_custom_bnd(const String &p_file);
bool _load_resource_pack(const String &p_pack);
@@ -145,17 +134,11 @@ public:
Error save();
void set_custom_property_info(const String &p_prop, const PropertyInfo &p_info);
- void add_singleton(const Singleton &p_singleton);
- void get_singletons(List<Singleton> *p_singletons);
-
- bool has_singleton(const String &p_name) const;
-
Vector<String> get_optimizer_presets() const;
List<String> get_input_presets() const { return input_presets; }
void set_disable_feature_overrides(bool p_disable);
- Object *get_singleton_object(const String &p_name) const;
void register_global_defaults();
diff --git a/core/register_core_types.cpp b/core/register_core_types.cpp
index c6d7cd44e8..baaf738b42 100644
--- a/core/register_core_types.cpp
+++ b/core/register_core_types.cpp
@@ -34,6 +34,7 @@
#include "compressed_translation.h"
#include "core/io/xml_parser.h"
#include "core_string_names.h"
+#include "engine.h"
#include "func_ref.h"
#include "geometry.h"
#include "input_map.h"
@@ -203,19 +204,19 @@ void register_core_singletons() {
ClassDB::register_class<InputMap>();
ClassDB::register_class<_JSON>();
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("IP", IP::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Geometry", _Geometry::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceLoader", _ResourceLoader::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ResourceSaver", _ResourceSaver::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("OS", _OS::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Engine", _Engine::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ClassDB", _classdb));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Marshalls", _Marshalls::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("TranslationServer", TranslationServer::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Input", Input::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InputMap", InputMap::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JSON", _JSON::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ProjectSettings", ProjectSettings::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("IP", IP::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Geometry", _Geometry::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceLoader", _ResourceLoader::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ResourceSaver", _ResourceSaver::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("OS", _OS::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Engine", _Engine::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ClassDB", _classdb));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Marshalls", _Marshalls::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("TranslationServer", TranslationServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Input", Input::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("InputMap", InputMap::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("JSON", _JSON::get_singleton()));
}
void unregister_core_types() {
diff --git a/core/script_debugger_remote.cpp b/core/script_debugger_remote.cpp
index 2feb068ecb..f77fb116c7 100644
--- a/core/script_debugger_remote.cpp
+++ b/core/script_debugger_remote.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "script_debugger_remote.h"
+#include "engine.h"
#include "io/ip.h"
#include "io/marshalls.h"
#include "os/input.h"
@@ -939,7 +940,7 @@ ScriptDebuggerRemote::ScriptDebuggerRemote()
tcp_client(StreamPeerTCP::create_ref()),
packet_peer_stream(Ref<PacketPeerStream>(memnew(PacketPeerStream))),
last_perf_time(0),
- performance(ProjectSettings::get_singleton()->get_singleton_object("Performance")),
+ performance(Engine::get_singleton()->get_singleton_object("Performance")),
requested_quit(false),
mutex(Mutex::create()),
max_cps(GLOBAL_GET("network/limits/debugger_stdout/max_chars_per_second")),
diff --git a/drivers/gles3/rasterizer_storage_gles3.cpp b/drivers/gles3/rasterizer_storage_gles3.cpp
index 296d945cda..5071fbba01 100644
--- a/drivers/gles3/rasterizer_storage_gles3.cpp
+++ b/drivers/gles3/rasterizer_storage_gles3.cpp
@@ -2866,7 +2866,7 @@ void RasterizerStorageGLES3::mesh_add_surface(RID p_mesh, uint32_t p_format, VS:
glGenBuffers(1, &surface->vertex_id);
glBindBuffer(GL_ARRAY_BUFFER, surface->vertex_id);
- glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), GL_STATIC_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, array_size, vr.ptr(), p_format & VS::ARRAY_FLAG_USE_DYNAMIC_UPDATE ? GL_DYNAMIC_DRAW : GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
if (p_format & VS::ARRAY_FORMAT_INDEX) {
@@ -3104,6 +3104,22 @@ VS::BlendShapeMode RasterizerStorageGLES3::mesh_get_blend_shape_mode(RID p_mesh)
return mesh->blend_shape_mode;
}
+void RasterizerStorageGLES3::mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
+
+ Mesh *mesh = mesh_owner.getornull(p_mesh);
+ ERR_FAIL_COND(!mesh);
+ ERR_FAIL_INDEX(p_surface, mesh->surfaces.size());
+
+ int total_size = p_data.size();
+ ERR_FAIL_COND(p_offset + total_size > mesh->surfaces[p_surface]->array_byte_size);
+
+ PoolVector<uint8_t>::Read r = p_data.read();
+
+ glBindBuffer(GL_ARRAY_BUFFER, mesh->surfaces[p_surface]->array_id);
+ glBufferSubData(GL_ARRAY_BUFFER, p_offset, total_size, r.ptr());
+ glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
+}
+
void RasterizerStorageGLES3::mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) {
Mesh *mesh = mesh_owner.getornull(p_mesh);
diff --git a/drivers/gles3/rasterizer_storage_gles3.h b/drivers/gles3/rasterizer_storage_gles3.h
index 6abc22b643..bd5aad29c9 100644
--- a/drivers/gles3/rasterizer_storage_gles3.h
+++ b/drivers/gles3/rasterizer_storage_gles3.h
@@ -692,6 +692,8 @@ public:
virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode);
virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const;
+ virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data);
+
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material);
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const;
diff --git a/editor/doc/doc_data.cpp b/editor/doc/doc_data.cpp
index 533ed48d15..0f113b11e6 100644
--- a/editor/doc/doc_data.cpp
+++ b/editor/doc/doc_data.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "doc_data.h"
+#include "engine.h"
#include "global_constants.h"
#include "io/compression.h"
#include "io/marshalls.h"
@@ -543,14 +544,14 @@ void DocData::generate(bool p_basic_types) {
c.constants.push_back(cd);
}
- List<ProjectSettings::Singleton> singletons;
- ProjectSettings::get_singleton()->get_singletons(&singletons);
+ List<Engine::Singleton> singletons;
+ Engine::get_singleton()->get_singletons(&singletons);
//servers (this is kind of hackish)
- for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
+ for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
PropertyDoc pd;
- ProjectSettings::Singleton &s = E->get();
+ Engine::Singleton &s = E->get();
pd.name = s.name;
pd.type = s.ptr->get_class();
while (String(ClassDB::get_parent_class(pd.type)) != "Object")
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp
index 9e002bc73d..9db3bcba00 100644
--- a/editor/editor_file_system.cpp
+++ b/editor/editor_file_system.cpp
@@ -913,7 +913,8 @@ void EditorFileSystem::_notification(int p_what) {
case NOTIFICATION_ENTER_TREE: {
- scan();
+ call_deferred("scan"); //this should happen after every editor node entered the tree
+
} break;
case NOTIFICATION_EXIT_TREE: {
if (use_threads && thread) {
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index e0cae7de57..6a4e879340 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -5533,6 +5533,10 @@ EditorNode::EditorNode() {
spatial_mat_convert.instance();
resource_conversion_plugins.push_back(spatial_mat_convert);
+ Ref<CanvasItemMaterialConversionPlugin> canvas_item_mat_convert;
+ canvas_item_mat_convert.instance();
+ resource_conversion_plugins.push_back(canvas_item_mat_convert);
+
Ref<ParticlesMaterialConversionPlugin> particles_mat_convert;
particles_mat_convert.instance();
resource_conversion_plugins.push_back(particles_mat_convert);
diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp
index bd4891ccb7..1fc112896d 100644
--- a/editor/plugins/material_editor_plugin.cpp
+++ b/editor/plugins/material_editor_plugin.cpp
@@ -503,3 +503,41 @@ Ref<Resource> ParticlesMaterialConversionPlugin::convert(const Ref<Resource> &p_
smat->set_render_priority(mat->get_render_priority());
return smat;
}
+
+String CanvasItemMaterialConversionPlugin::converts_to() const {
+
+ return "ShaderMaterial";
+}
+bool CanvasItemMaterialConversionPlugin::handles(const Ref<Resource> &p_resource) const {
+
+ Ref<CanvasItemMaterial> mat = p_resource;
+ return mat.is_valid();
+}
+Ref<Resource> CanvasItemMaterialConversionPlugin::convert(const Ref<Resource> &p_resource) {
+
+ Ref<CanvasItemMaterial> mat = p_resource;
+ ERR_FAIL_COND_V(!mat.is_valid(), Ref<Resource>());
+
+ Ref<ShaderMaterial> smat;
+ smat.instance();
+
+ Ref<Shader> shader;
+ shader.instance();
+
+ String code = VS::get_singleton()->shader_get_code(mat->get_shader_rid());
+
+ shader->set_code(code);
+
+ smat->set_shader(shader);
+
+ List<PropertyInfo> params;
+ VS::get_singleton()->shader_get_param_list(mat->get_shader_rid(), &params);
+
+ for (List<PropertyInfo>::Element *E = params.front(); E; E = E->next()) {
+ Variant value = VS::get_singleton()->material_get_param(mat->get_rid(), E->get().name);
+ smat->set_shader_param(E->get().name, value);
+ }
+
+ smat->set_render_priority(mat->get_render_priority());
+ return smat;
+}
diff --git a/editor/plugins/material_editor_plugin.h b/editor/plugins/material_editor_plugin.h
index 52c73cb7d8..2cc24be33a 100644
--- a/editor/plugins/material_editor_plugin.h
+++ b/editor/plugins/material_editor_plugin.h
@@ -119,4 +119,12 @@ public:
virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
};
+class CanvasItemMaterialConversionPlugin : public EditorResourceConversionPlugin {
+ GDCLASS(CanvasItemMaterialConversionPlugin, EditorResourceConversionPlugin)
+public:
+ virtual String converts_to() const;
+ virtual bool handles(const Ref<Resource> &p_resource) const;
+ virtual Ref<Resource> convert(const Ref<Resource> &p_resource);
+};
+
#endif // MATERIAL_EDITOR_PLUGIN_H
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 5bfdd73aad..cc9de3e44d 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -284,7 +284,6 @@ private:
}
ProjectSettings *current = memnew(ProjectSettings);
- current->add_singleton(ProjectSettings::Singleton("Current"));
if (current->setup(dir, "")) {
set_message(TTR("Couldn't get project.godot in project path."), MESSAGE_ERROR);
@@ -503,7 +502,6 @@ public:
name_container->show();
ProjectSettings *current = memnew(ProjectSettings);
- current->add_singleton(ProjectSettings::Singleton("Current"));
if (current->setup(project_path->get_text(), "")) {
set_message(TTR("Couldn't get project.godot in the project path."), MESSAGE_ERROR);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index a6e0af05b2..c4b86c6b2b 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -354,7 +354,11 @@ void SceneTreeEditor::_update_visibility_color(Node *p_node, TreeItem *p_item) {
void SceneTreeEditor::_node_script_changed(Node *p_node) {
- _update_tree();
+ if (tree_dirty)
+ return;
+
+ MessageQueue::get_singleton()->push_call(this, "_update_tree");
+ tree_dirty = true;
/*
changes the order :|
TreeItem* item=p_node?_find(tree->get_root(),p_node->get_path()):NULL;
diff --git a/main/main.cpp b/main/main.cpp
index aa4dce93a6..cc6e66d352 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -294,7 +294,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
translation_server = memnew(TranslationServer);
performance = memnew(Performance);
ClassDB::register_class<Performance>();
- globals->add_singleton(ProjectSettings::Singleton("Performance", performance));
+ engine->add_singleton(Engine::Singleton("Performance", performance));
GLOBAL_DEF("debug/settings/crash_handler/message", String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues"));
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 0298f4c054..6dfa7ec20b 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -30,10 +30,10 @@
#include "gdnative/gdnative.h"
#include "class_db.h"
+#include "engine.h"
#include "error_macros.h"
#include "global_constants.h"
#include "os/os.h"
-#include "project_settings.h"
#include "variant.h"
#ifdef __cplusplus
@@ -47,7 +47,7 @@ void GDAPI godot_object_destroy(godot_object *p_o) {
// Singleton API
godot_object GDAPI *godot_global_get_singleton(char *p_name) {
- return (godot_object *)ProjectSettings::get_singleton()->get_singleton_object(String(p_name));
+ return (godot_object *)Engine::get_singleton()->get_singleton_object(String(p_name));
} // result shouldn't be freed
void GDAPI *godot_get_stack_bottom() {
diff --git a/modules/gdnative/nativescript/api_generator.cpp b/modules/gdnative/nativescript/api_generator.cpp
index 63fb71feb6..f9d699fb59 100644
--- a/modules/gdnative/nativescript/api_generator.cpp
+++ b/modules/gdnative/nativescript/api_generator.cpp
@@ -32,9 +32,9 @@
#ifdef TOOLS_ENABLED
#include "core/class_db.h"
+#include "core/engine.h"
#include "core/global_constants.h"
#include "core/pair.h"
-#include "core/project_settings.h"
#include "os/file_access.h"
// helper stuff
@@ -177,7 +177,7 @@ List<ClassAPI> generate_c_api_classes() {
if (name.begins_with("_")) {
name.remove(0);
}
- class_api.is_singleton = ProjectSettings::get_singleton()->has_singleton(name);
+ class_api.is_singleton = Engine::get_singleton()->has_singleton(name);
}
class_api.is_instanciable = !class_api.is_singleton && ClassDB::can_instance(class_name);
diff --git a/modules/gdscript/gd_script.cpp b/modules/gdscript/gd_script.cpp
index e5016c59bd..e5d834c9e7 100644
--- a/modules/gdscript/gd_script.cpp
+++ b/modules/gdscript/gd_script.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "gd_script.h"
+#include "engine.h"
#include "gd_compiler.h"
#include "global_constants.h"
#include "io/file_access_encrypted.h"
@@ -1347,9 +1348,9 @@ void GDScriptLanguage::init() {
//populate singletons
- List<ProjectSettings::Singleton> singletons;
- ProjectSettings::get_singleton()->get_singletons(&singletons);
- for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
+ List<Engine::Singleton> singletons;
+ Engine::get_singleton()->get_singletons(&singletons);
+ for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
_add_global(E->get().name, E->get().ptr);
}
@@ -1598,17 +1599,18 @@ void GDScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool p_so
Object *obj = E->get()->placeholders.front()->get()->get_owner();
//save instance info
- List<Pair<StringName, Variant> > state;
if (obj->get_script_instance()) {
+ map.insert(obj->get_instance_id(), List<Pair<StringName, Variant> >());
+ List<Pair<StringName, Variant> > &state = map[obj->get_instance_id()];
obj->get_script_instance()->get_property_state(state);
- map[obj->get_instance_id()] = state;
obj->set_script(RefPtr());
} else {
// no instance found. Let's remove it so we don't loop forever
E->get()->placeholders.erase(E->get()->placeholders.front()->get());
}
}
+
#endif
for (Map<ObjectID, List<Pair<StringName, Variant> > >::Element *F = E->get()->pending_reload_state.front(); F; F = F->next()) {
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index eb504ec021..e6099c7cdf 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -31,12 +31,12 @@
#ifdef DEBUG_METHODS_ENABLED
+#include "engine.h"
#include "global_constants.h"
#include "io/compression.h"
#include "os/dir_access.h"
#include "os/file_access.h"
#include "os/os.h"
-#include "project_settings.h"
#include "ucaps.h"
#include "../glue/cs_compressed.gen.h"
@@ -1169,7 +1169,7 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) {
output.push_back("Object* ");
output.push_back(singleton_icall_name);
- output.push_back("() " OPEN_BLOCK "\treturn ProjectSettings::get_singleton()->get_singleton_object(\"");
+ output.push_back("() " OPEN_BLOCK "\treturn Engine::get_singleton()->get_singleton_object(\"");
output.push_back(itype.proxy_name);
output.push_back("\");\n" CLOSE_BLOCK "\n");
}
@@ -1505,7 +1505,7 @@ void BindingsGenerator::_populate_object_type_interfaces() {
TypeInterface itype = TypeInterface::create_object_type(type_cname, api_type);
itype.base_name = ClassDB::get_parent_class(type_cname);
- itype.is_singleton = ProjectSettings::get_singleton()->has_singleton(itype.proxy_name);
+ itype.is_singleton = Engine::get_singleton()->has_singleton(itype.proxy_name);
itype.is_instantiable = ClassDB::can_instance(type_cname) && !itype.is_singleton;
itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name);
itype.memory_own = itype.is_reference;
diff --git a/modules/mono/glue/glue_header.h b/modules/mono/glue/glue_header.h
index 0751a0160f..75a4eb2b40 100644
--- a/modules/mono/glue/glue_header.h
+++ b/modules/mono/glue/glue_header.h
@@ -35,10 +35,10 @@
#include "bind/core_bind.h"
#include "class_db.h"
+#include "engine.h"
#include "io/marshalls.h"
#include "object.h"
#include "os/os.h"
-#include "project_settings.h"
#include "reference.h"
#include "variant_parser.h"
diff --git a/modules/mono/register_types.cpp b/modules/mono/register_types.cpp
index 2656de5b14..217460a439 100644
--- a/modules/mono/register_types.cpp
+++ b/modules/mono/register_types.cpp
@@ -29,7 +29,7 @@
/*************************************************************************/
#include "register_types.h"
-#include "project_settings.h"
+#include "engine.h"
#include "csharp_script.h"
@@ -45,7 +45,7 @@ void register_mono_types() {
_godotsharp = memnew(_GodotSharp);
ClassDB::register_class<_GodotSharp>();
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GodotSharp", _GodotSharp::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("GodotSharp", _GodotSharp::get_singleton()));
script_language_cs = memnew(CSharpLanguage);
script_language_cs->set_language_index(ScriptServer::get_language_count());
diff --git a/modules/visual_script/visual_script_func_nodes.cpp b/modules/visual_script/visual_script_func_nodes.cpp
index a5dc6ffc13..cbe4438cdf 100644
--- a/modules/visual_script/visual_script_func_nodes.cpp
+++ b/modules/visual_script/visual_script_func_nodes.cpp
@@ -29,9 +29,9 @@
/*************************************************************************/
#include "visual_script_func_nodes.h"
+#include "engine.h"
#include "io/resource_loader.h"
#include "os/os.h"
-#include "project_settings.h"
#include "scene/main/node.h"
#include "scene/main/scene_tree.h"
#include "visual_script_nodes.h"
@@ -344,7 +344,7 @@ void VisualScriptFunctionCall::set_singleton(const StringName &p_type) {
return;
singleton = p_type;
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
base_type = obj->get_class();
}
@@ -380,7 +380,7 @@ void VisualScriptFunctionCall::_update_method_cache() {
} else if (call_mode == CALL_MODE_SINGLETON) {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
type = obj->get_class();
script = obj->get_script();
@@ -565,11 +565,11 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
if (call_mode != CALL_MODE_SINGLETON) {
property.usage = 0;
} else {
- List<ProjectSettings::Singleton> names;
- ProjectSettings::get_singleton()->get_singletons(&names);
+ List<Engine::Singleton> names;
+ Engine::get_singleton()->get_singletons(&names);
property.hint = PROPERTY_HINT_ENUM;
String sl;
- for (List<ProjectSettings::Singleton>::Element *E = names.front(); E; E = E->next()) {
+ for (List<Engine::Singleton>::Element *E = names.front(); E; E = E->next()) {
if (sl != String())
sl += ",";
sl += E->get().name;
@@ -603,7 +603,7 @@ void VisualScriptFunctionCall::_validate_property(PropertyInfo &property) const
property.hint_string = itos(get_visual_script()->get_instance_id());
} else if (call_mode == CALL_MODE_SINGLETON) {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
if (obj) {
property.hint = PROPERTY_HINT_METHOD_OF_INSTANCE;
property.hint_string = itos(obj->get_instance_id());
@@ -879,7 +879,7 @@ public:
} break;
case VisualScriptFunctionCall::CALL_MODE_SINGLETON: {
- Object *object = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *object = Engine::get_singleton()->get_singleton_object(singleton);
if (!object) {
r_error.error = Variant::CallError::CALL_ERROR_INVALID_METHOD;
r_error_str = "Invalid singleton name: '" + String(singleton) + "'";
diff --git a/modules/visual_script/visual_script_nodes.cpp b/modules/visual_script/visual_script_nodes.cpp
index 3863fa7e1c..05ff629d1b 100644
--- a/modules/visual_script/visual_script_nodes.cpp
+++ b/modules/visual_script/visual_script_nodes.cpp
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "visual_script_nodes.h"
+#include "engine.h"
#include "global_constants.h"
#include "os/input.h"
#include "os/os.h"
@@ -1976,13 +1977,13 @@ public:
VisualScriptNodeInstance *VisualScriptEngineSingleton::instance(VisualScriptInstance *p_instance) {
VisualScriptNodeInstanceEngineSingleton *instance = memnew(VisualScriptNodeInstanceEngineSingleton);
- instance->singleton = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ instance->singleton = Engine::get_singleton()->get_singleton_object(singleton);
return instance;
}
VisualScriptEngineSingleton::TypeGuess VisualScriptEngineSingleton::guess_output_type(TypeGuess *p_inputs, int p_output) const {
- Object *obj = ProjectSettings::get_singleton()->get_singleton_object(singleton);
+ Object *obj = Engine::get_singleton()->get_singleton_object(singleton);
TypeGuess tg;
tg.type = Variant::OBJECT;
if (obj) {
@@ -2000,11 +2001,11 @@ void VisualScriptEngineSingleton::_bind_methods() {
String cc;
- List<ProjectSettings::Singleton> singletons;
+ List<Engine::Singleton> singletons;
- ProjectSettings::get_singleton()->get_singletons(&singletons);
+ Engine::get_singleton()->get_singletons(&singletons);
- for (List<ProjectSettings::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
+ for (List<Engine::Singleton>::Element *E = singletons.front(); E; E = E->next()) {
if (E->get().name == "VS" || E->get().name == "PS" || E->get().name == "PS2D" || E->get().name == "AS" || E->get().name == "TS" || E->get().name == "SS" || E->get().name == "SS2D")
continue; //skip these, too simple named
diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp
index abe5e3b77a..9d056bca7c 100644
--- a/platform/android/godot_android.cpp
+++ b/platform/android/godot_android.cpp
@@ -35,6 +35,7 @@
#include <EGL/egl.h>
#include <GLES2/gl2.h>
+#include "engine.h"
#include "file_access_android.h"
#include "main/main.h"
#include "os_android.h"
@@ -842,7 +843,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_Godot_registerSingleton(JNIEnv
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname] = s;
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s));
+ Engine::get_singleton()->add_singleton(Engine::Singleton(singname, s));
}
static Variant::Type get_jni_type(const String &p_type) {
diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp
index 87f20bee91..90144d9b4d 100644
--- a/platform/android/java_glue.cpp
+++ b/platform/android/java_glue.cpp
@@ -34,6 +34,7 @@
#include "audio_driver_jandroid.h"
#include "core/os/keyboard.h"
#include "dir_access_jandroid.h"
+#include "engine.h"
#include "file_access_android.h"
#include "file_access_jandroid.h"
#include "java_class_wrapper.h"
@@ -953,7 +954,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_setup(JNIEnv *env, jo
__android_log_print(ANDROID_LOG_INFO, "godot", "*****SETUP OK");
java_class_wrapper = memnew(JavaClassWrapper(_godot_instance));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaClassWrapper", java_class_wrapper));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("JavaClassWrapper", java_class_wrapper));
_initialize_java_modules();
}
@@ -1426,7 +1427,7 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_GodotLib_singleton(JNIEnv *env
s->set_instance(env->NewGlobalRef(p_object));
jni_singletons[singname] = s;
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton(singname, s));
+ Engine::get_singleton()->add_singleton(Engine::Singleton(singname, s));
ProjectSettings::get_singleton()->set(singname, s);
}
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index a36df0675c..2578bd6d96 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -641,7 +641,7 @@ String OS_Android::get_data_dir() const {
}
return ".";
- //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
+ //return Engine::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
}
void OS_Android::set_screen_orientation(ScreenOrientation p_orientation) {
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 0685e961c3..d0865a35b9 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -138,28 +138,28 @@ void OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p_
/*
#ifdef IOS_SCORELOOP_ENABLED
scoreloop = memnew(ScoreloopIOS);
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Scoreloop", scoreloop));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Scoreloop", scoreloop));
scoreloop->connect();
#endif
*/
#ifdef GAME_CENTER_ENABLED
game_center = memnew(GameCenter);
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("GameCenter", game_center));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("GameCenter", game_center));
game_center->connect();
#endif
#ifdef STOREKIT_ENABLED
store_kit = memnew(InAppStore);
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("InAppStore", store_kit));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("InAppStore", store_kit));
#endif
#ifdef ICLOUD_ENABLED
icloud = memnew(ICloud);
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ICloud", icloud));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
//icloud->connect();
#endif
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("iOS", memnew(iOS)));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", memnew(iOS)));
};
MainLoop *OSIPhone::get_main_loop() const {
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 389d5d206e..77d81aec5d 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -29,8 +29,8 @@
/*************************************************************************/
#include "os_javascript.h"
+#include "core/engine.h"
#include "core/io/file_access_buffered_fa.h"
-#include "core/project_settings.h"
#include "dom_keys.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/dir_access_unix.h"
@@ -514,7 +514,7 @@ void OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, i
#ifdef JAVASCRIPT_EVAL_ENABLED
javascript_eval = memnew(JavaScript);
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("JavaScript", javascript_eval));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("JavaScript", javascript_eval));
#endif
visual_server->init();
@@ -896,7 +896,6 @@ String OS_JavaScript::get_data_dir() const {
return get_data_dir_func();
*/
return "/userfs";
- //return ProjectSettings::get_singleton()->get_singleton_object("GodotOS")->call("get_data_dir");
};
String OS_JavaScript::get_executable_path() const {
diff --git a/scene/2d/canvas_item.cpp b/scene/2d/canvas_item.cpp
index b41ba7f590..fa45c61f68 100644
--- a/scene/2d/canvas_item.cpp
+++ b/scene/2d/canvas_item.cpp
@@ -178,6 +178,12 @@ CanvasItemMaterial::LightMode CanvasItemMaterial::get_light_mode() const {
void CanvasItemMaterial::_validate_property(PropertyInfo &property) const {
}
+RID CanvasItemMaterial::get_shader_rid() const {
+
+ ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
+ return shader_map[current_key].shader;
+}
+
void CanvasItemMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_blend_mode", "blend_mode"), &CanvasItemMaterial::set_blend_mode);
diff --git a/scene/2d/canvas_item.h b/scene/2d/canvas_item.h
index cb8ee761e6..1a043c204f 100644
--- a/scene/2d/canvas_item.h
+++ b/scene/2d/canvas_item.h
@@ -121,6 +121,8 @@ public:
static void finish_shaders();
static void flush_changes();
+ RID get_shader_rid() const;
+
CanvasItemMaterial();
virtual ~CanvasItemMaterial();
};
diff --git a/scene/3d/gi_probe.cpp b/scene/3d/gi_probe.cpp
index c0ca358717..002ce1793b 100644
--- a/scene/3d/gi_probe.cpp
+++ b/scene/3d/gi_probe.cpp
@@ -891,7 +891,7 @@ void GIProbe::_fixup_plot(int p_idx, int p_level, int p_x, int p_y, int p_z, Bak
}
}
-Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_color) {
+Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_color, bool p_color_add) {
Vector<Color> ret;
@@ -919,9 +919,16 @@ Vector<Color> GIProbe::_get_bake_texture(Ref<Image> p_image, const Color &p_colo
for (int i = 0; i < bake_texture_size * bake_texture_size; i++) {
Color c;
- c.r = (r[i * 4 + 0] / 255.0) * p_color.r;
- c.g = (r[i * 4 + 1] / 255.0) * p_color.g;
- c.b = (r[i * 4 + 2] / 255.0) * p_color.b;
+ if (p_color_add) {
+ c.r = (r[i * 4 + 0] / 255.0) + p_color.r;
+ c.g = (r[i * 4 + 1] / 255.0) + p_color.g;
+ c.b = (r[i * 4 + 2] / 255.0) + p_color.b;
+ } else {
+ c.r = (r[i * 4 + 0] / 255.0) * p_color.r;
+ c.g = (r[i * 4 + 1] / 255.0) * p_color.g;
+ c.b = (r[i * 4 + 2] / 255.0) * p_color.b;
+ }
+
c.a = r[i * 4 + 3] / 255.0;
ret[i] = c;
@@ -954,7 +961,7 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
} else {
}
- mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo());
+ mc.albedo = _get_bake_texture(img_albedo, mat->get_albedo(), false);
Ref<ImageTexture> emission_tex = mat->get_texture(SpatialMaterial::TEXTURE_EMISSION);
@@ -970,7 +977,7 @@ GIProbe::Baker::MaterialCache GIProbe::_get_material_cache(Ref<Material> p_mater
img_emission = emission_tex->get_data();
}
- mc.emission = _get_bake_texture(img_emission, emission_col);
+ mc.emission = _get_bake_texture(img_emission, emission_col, mat->get_emission_operator() == SpatialMaterial::EMISSION_OP_ADD);
} else {
Ref<Image> empty;
diff --git a/scene/3d/gi_probe.h b/scene/3d/gi_probe.h
index 50d0c33d4f..8aca2c549b 100644
--- a/scene/3d/gi_probe.h
+++ b/scene/3d/gi_probe.h
@@ -178,7 +178,7 @@ private:
int color_scan_cell_width;
int bake_texture_size;
- Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color);
+ Vector<Color> _get_bake_texture(Ref<Image> p_image, const Color &p_color, bool p_color_add = false);
Baker::MaterialCache _get_material_cache(Ref<Material> p_material, Baker *p_baker);
void _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 _plot_mesh(const Transform &p_xform, Ref<Mesh> &p_mesh, Baker *p_baker, const Vector<Ref<Material> > &p_materials, const Ref<Material> &p_override_material);
diff --git a/scene/resources/material.cpp b/scene/resources/material.cpp
index 12434b39fa..286840656b 100644
--- a/scene/resources/material.cpp
+++ b/scene/resources/material.cpp
@@ -723,7 +723,11 @@ void SpatialMaterial::_update_shader() {
} else {
code += "\tvec3 emission_tex = texture(texture_emission,base_uv).rgb;\n";
}
- code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n";
+ if (emission_op == EMISSION_OP_ADD) {
+ code += "\tEMISSION = (emission.rgb+emission_tex)*emission_energy;\n";
+ } else {
+ code += "\tEMISSION = (emission.rgb*emission_tex)*emission_energy;\n";
+ }
}
if (features[FEATURE_REFRACTION] && !flags[FLAG_UV1_USE_TRIPLANAR]) { //refraction not supported with triplanar
@@ -1635,6 +1639,19 @@ float SpatialMaterial::get_distance_fade_min_distance() const {
return distance_fade_min_distance;
}
+void SpatialMaterial::set_emission_operator(EmissionOperator p_op) {
+
+ if (emission_op == p_op)
+ return;
+ emission_op = p_op;
+ _queue_shader_change();
+}
+
+SpatialMaterial::EmissionOperator SpatialMaterial::get_emission_operator() const {
+
+ return emission_op;
+}
+
RID SpatialMaterial::get_shader_rid() const {
ERR_FAIL_COND_V(!shader_map.has(current_key), RID());
@@ -1769,6 +1786,9 @@ void SpatialMaterial::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_grow", "amount"), &SpatialMaterial::set_grow);
ClassDB::bind_method(D_METHOD("get_grow"), &SpatialMaterial::get_grow);
+ ClassDB::bind_method(D_METHOD("set_emission_operator", "operator"), &SpatialMaterial::set_emission_operator);
+ ClassDB::bind_method(D_METHOD("get_emission_operator"), &SpatialMaterial::get_emission_operator);
+
ClassDB::bind_method(D_METHOD("set_ao_light_affect", "amount"), &SpatialMaterial::set_ao_light_affect);
ClassDB::bind_method(D_METHOD("get_ao_light_affect"), &SpatialMaterial::get_ao_light_affect);
@@ -1854,6 +1874,7 @@ void SpatialMaterial::_bind_methods() {
ADD_PROPERTYI(PropertyInfo(Variant::BOOL, "emission_enabled"), "set_feature", "get_feature", FEATURE_EMISSION);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "emission", PROPERTY_HINT_COLOR_NO_ALPHA), "set_emission", "get_emission");
ADD_PROPERTY(PropertyInfo(Variant::REAL, "emission_energy", PROPERTY_HINT_RANGE, "0,16,0.01"), "set_emission_energy", "get_emission_energy");
+ ADD_PROPERTY(PropertyInfo(Variant::INT, "emission_operator", PROPERTY_HINT_ENUM, "Add,Multiply"), "set_emission_operator", "get_emission_operator");
ADD_PROPERTYI(PropertyInfo(Variant::OBJECT, "emission_texture", PROPERTY_HINT_RESOURCE_TYPE, "Texture"), "set_texture", "get_texture", TEXTURE_EMISSION);
ADD_GROUP("NormalMap", "normal_");
@@ -2022,6 +2043,9 @@ void SpatialMaterial::_bind_methods() {
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_BLUE);
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_ALPHA);
BIND_ENUM_CONSTANT(TEXTURE_CHANNEL_GRAYSCALE);
+
+ BIND_ENUM_CONSTANT(EMISSION_OP_ADD);
+ BIND_ENUM_CONSTANT(EMISSION_OP_MULTIPLY);
}
SpatialMaterial::SpatialMaterial()
@@ -2057,6 +2081,7 @@ SpatialMaterial::SpatialMaterial()
set_particles_anim_v_frames(1);
set_particles_anim_loop(false);
set_alpha_scissor_threshold(0.98);
+ emission_op = EMISSION_OP_ADD;
proximity_fade_enabled = false;
distance_fade_enabled = false;
diff --git a/scene/resources/material.h b/scene/resources/material.h
index 2425f1a174..877d4dfd41 100644
--- a/scene/resources/material.h
+++ b/scene/resources/material.h
@@ -215,6 +215,11 @@ public:
TEXTURE_CHANNEL_GRAYSCALE
};
+ enum EmissionOperator {
+ EMISSION_OP_ADD,
+ EMISSION_OP_MULTIPLY
+ };
+
private:
union MaterialKey {
@@ -234,6 +239,7 @@ private:
uint64_t grow : 1;
uint64_t proximity_fade : 1;
uint64_t distance_fade : 1;
+ uint64_t emission_op : 1;
};
uint64_t key;
@@ -278,6 +284,7 @@ private:
mk.grow = grow_enabled;
mk.proximity_fade = proximity_fade_enabled;
mk.distance_fade = distance_fade_enabled;
+ mk.emission_op = emission_op;
return mk;
}
@@ -394,6 +401,7 @@ private:
SpecularMode specular_mode;
DiffuseMode diffuse_mode;
BillboardMode billboard_mode;
+ EmissionOperator emission_op;
TextureChannel metallic_texture_channel;
TextureChannel roughness_texture_channel;
@@ -571,6 +579,9 @@ public:
void set_distance_fade_min_distance(float p_distance);
float get_distance_fade_min_distance() const;
+ void set_emission_operator(EmissionOperator p_op);
+ EmissionOperator get_emission_operator() const;
+
void set_metallic_texture_channel(TextureChannel p_channel);
TextureChannel get_metallic_texture_channel() const;
void set_roughness_texture_channel(TextureChannel p_channel);
@@ -603,6 +614,7 @@ VARIANT_ENUM_CAST(SpatialMaterial::DiffuseMode)
VARIANT_ENUM_CAST(SpatialMaterial::SpecularMode)
VARIANT_ENUM_CAST(SpatialMaterial::BillboardMode)
VARIANT_ENUM_CAST(SpatialMaterial::TextureChannel)
+VARIANT_ENUM_CAST(SpatialMaterial::EmissionOperator)
//////////////////////
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 26f5deae1d..3e86daf3a7 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -920,6 +920,12 @@ String ArrayMesh::surface_get_name(int p_idx) const {
return surfaces[p_idx].name;
}
+void ArrayMesh::surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) {
+
+ ERR_FAIL_INDEX(p_surface, surfaces.size());
+ VS::get_singleton()->mesh_surface_update_region(mesh, p_surface, p_offset, p_data);
+}
+
void ArrayMesh::surface_set_custom_aabb(int p_idx, const Rect3 &p_aabb) {
ERR_FAIL_INDEX(p_idx, surfaces.size());
@@ -1041,6 +1047,7 @@ void ArrayMesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("add_surface_from_arrays", "primitive", "arrays", "blend_shapes", "compress_flags"), &ArrayMesh::add_surface_from_arrays, DEFVAL(Array()), DEFVAL(ARRAY_COMPRESS_DEFAULT));
ClassDB::bind_method(D_METHOD("get_surface_count"), &ArrayMesh::get_surface_count);
ClassDB::bind_method(D_METHOD("surface_remove", "surf_idx"), &ArrayMesh::surface_remove);
+ ClassDB::bind_method(D_METHOD("surface_update_region", "surf_idx", "offset", "data"), &ArrayMesh::surface_update_region);
ClassDB::bind_method(D_METHOD("surface_get_array_len", "surf_idx"), &ArrayMesh::surface_get_array_len);
ClassDB::bind_method(D_METHOD("surface_get_array_index_len", "surf_idx"), &ArrayMesh::surface_get_array_index_len);
ClassDB::bind_method(D_METHOD("surface_get_format", "surf_idx"), &ArrayMesh::surface_get_format);
diff --git a/scene/resources/mesh.h b/scene/resources/mesh.h
index b11adf50b9..75927079c7 100644
--- a/scene/resources/mesh.h
+++ b/scene/resources/mesh.h
@@ -95,6 +95,7 @@ public:
ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1,
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
+ ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
@@ -185,6 +186,8 @@ public:
void set_blend_shape_mode(BlendShapeMode p_mode);
BlendShapeMode get_blend_shape_mode() const;
+ void surface_update_region(int p_surface, int p_offset, const PoolVector<uint8_t> &p_data);
+
int get_surface_count() const;
void surface_remove(int p_idx);
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 1ba9e7b174..99493afc40 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "register_server_types.h"
+#include "engine.h"
#include "project_settings.h"
#include "arvr/arvr_interface.h"
@@ -171,9 +172,9 @@ void unregister_server_types() {
}
void register_server_singletons() {
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("VisualServer", VisualServer::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("AudioServer", AudioServer::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("Physics2DServer", Physics2DServer::get_singleton()));
- ProjectSettings::get_singleton()->add_singleton(ProjectSettings::Singleton("ARVRServer", ARVRServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("VisualServer", VisualServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("AudioServer", AudioServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("PhysicsServer", PhysicsServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("Physics2DServer", Physics2DServer::get_singleton()));
+ Engine::get_singleton()->add_singleton(Engine::Singleton("ARVRServer", ARVRServer::get_singleton()));
}
diff --git a/servers/visual/rasterizer.h b/servers/visual/rasterizer.h
index 164baa8c9b..333fe1e72a 100644
--- a/servers/visual/rasterizer.h
+++ b/servers/visual/rasterizer.h
@@ -242,6 +242,8 @@ public:
virtual void mesh_set_blend_shape_mode(RID p_mesh, VS::BlendShapeMode p_mode) = 0;
virtual VS::BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
+ virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0;
+
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index 69e2d1c162..9432d3fdd9 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -120,6 +120,8 @@ void VisualServerRaster::draw() {
frame_drawn_callbacks.pop_front();
}
+
+ emit_signal("frame_drawn_in_thread");
}
void VisualServerRaster::sync() {
}
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index b579f4032f..67375e81b6 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -73,521 +73,6 @@ class VisualServerRaster : public VisualServer {
List<FrameDrawnCallbacks> frame_drawn_callbacks;
-// FIXME: Kept as reference for future implementation
-#if 0
- struct Room {
-
- bool occlude_exterior;
- BSP_Tree bounds;
- Room() { occlude_exterior=true; }
- };
-
-
- BalloonAllocator<> octree_allocator;
-
- struct OctreeAllocator {
-
- static BalloonAllocator<> *allocator;
-
- _FORCE_INLINE_ static void *alloc(size_t p_size) { return allocator->alloc(p_size); }
- _FORCE_INLINE_ static void free(void *p_ptr) { return allocator->free(p_ptr); }
-
- };
-
- struct Portal {
-
- bool enabled;
- float disable_distance;
- Color disable_color;
- float connect_range;
- Vector<Point2> shape;
- Rect2 bounds;
-
-
- Portal() { enabled=true; disable_distance=50; disable_color=Color(); connect_range=0.8; }
- };
-
- struct BakedLight {
-
- Rasterizer::BakedLightData data;
- PoolVector<int> sampler;
- Rect3 octree_aabb;
- Size2i octree_tex_size;
- Size2i light_tex_size;
-
- };
-
- struct BakedLightSampler {
-
- float params[BAKED_LIGHT_SAMPLER_MAX];
- int resolution;
- Vector<Vector3> dp_cache;
-
- BakedLightSampler() {
- params[BAKED_LIGHT_SAMPLER_STRENGTH]=1.0;
- params[BAKED_LIGHT_SAMPLER_ATTENUATION]=1.0;
- params[BAKED_LIGHT_SAMPLER_RADIUS]=1.0;
- params[BAKED_LIGHT_SAMPLER_DETAIL_RATIO]=0.1;
- resolution=16;
- }
- };
-
- void _update_baked_light_sampler_dp_cache(BakedLightSampler * blsamp);
- struct Camera {
-
- enum Type {
- PERSPECTIVE,
- ORTHOGONAL
- };
- Type type;
- float fov;
- float znear,zfar;
- float size;
- uint32_t visible_layers;
- bool vaspect;
- RID env;
-
- Transform transform;
-
- Camera() {
-
- visible_layers=0xFFFFFFFF;
- fov=60;
- type=PERSPECTIVE;
- znear=0.1; zfar=100;
- size=1.0;
- vaspect=false;
-
- }
- };
-
-
- struct Instance;
- typedef Set<Instance*,Comparator<Instance*>,OctreeAllocator> InstanceSet;
- struct Scenario;
-
- struct Instance {
-
- enum {
-
- MAX_LIGHTS=4
- };
-
- RID self;
- OctreeElementID octree_id;
- Scenario *scenario;
- bool update;
- bool update_aabb;
- bool update_materials;
- Instance *update_next;
- InstanceType base_type;
-
- RID base_rid;
-
- Rect3 aabb;
- Rect3 transformed_aabb;
- uint32_t object_ID;
- bool visible;
- bool visible_in_all_rooms;
- uint32_t layer_mask;
- float draw_range_begin;
- float draw_range_end;
- float extra_margin;
-
-
-
- Rasterizer::InstanceData data;
-
-
- Set<Instance*> auto_rooms;
- Set<Instance*> valid_auto_rooms;
- Instance *room;
- List<Instance*>::Element *RE;
- Instance *baked_light;
- List<Instance*>::Element *BLE;
- Instance *sampled_light;
- bool exterior;
-
- uint64_t last_render_pass;
- uint64_t last_frame_pass;
-
- uint64_t version; // changes to this, and changes to base increase version
-
- InstanceSet lights;
- bool light_cache_dirty;
-
-
-
- struct RoomInfo {
-
- Transform affine_inverse;
- Room *room;
- List<Instance*> owned_geometry_instances;
- List<Instance*> owned_portal_instances;
- List<Instance*> owned_room_instances;
- List<Instance*> owned_light_instances; //not used, but just for the sake of it
- Set<Instance*> disconnected_child_portals;
- Set<Instance*> owned_autoroom_geometry;
- uint64_t last_visited_pass;
- RoomInfo() { last_visited_pass=0; }
-
- };
-
- struct PortalInfo {
-
- Portal *portal;
- Set<Instance*> candidate_set;
- Instance *connected;
- uint64_t last_visited_pass;
-
- Plane plane_cache;
- Vector<Vector3> transformed_point_cache;
-
-
- PortalInfo() { connected=NULL; last_visited_pass=0;}
- };
-
- struct LightInfo {
-
- RID instance;
- int light_set_index;
- uint64_t last_version;
- uint64_t last_add_pass;
- List<RID>::Element *D; // directional light in scenario
- InstanceSet affected;
- bool enabled;
- float dtc; //distance to camera, used for sorting
-
-
- LightInfo() {
-
- D=NULL;
- light_set_index=-1;
- last_add_pass=0;
- enabled=true;
- }
- };
-
- struct BakedLightInfo {
-
- BakedLight *baked_light;
- Transform affine_inverse;
- List<Instance*> owned_instances;
- };
-
- struct BakedLightSamplerInfo {
-
- Set<Instance*> baked_lights;
- Set<Instance*> owned_instances;
- BakedLightSampler *sampler;
- int resolution;
- Vector<Color> light_buffer;
- RID sampled_light;
- uint64_t last_pass;
- Transform xform; // viewspace normal to lightspace, might not use one.
- BakedLightSamplerInfo() {
- sampler=NULL;
- last_pass=0;
- resolution=0;
- }
- };
-
- struct ParticlesInfo {
-
- RID instance;
- };
-
-
- RoomInfo *room_info;
- LightInfo *light_info;
- ParticlesInfo *particles_info;
- PortalInfo * portal_info;
- BakedLightInfo * baked_light_info;
- BakedLightSamplerInfo * baked_light_sampler_info;
-
-
- Instance() {
- octree_id=0;
- update_next=0;
- object_ID=0;
- last_render_pass=0;
- last_frame_pass=0;
- light_info=0;
- particles_info=0;
- update_next=NULL;
- update=false;
- visible=true;
- data.cast_shadows=SHADOW_CASTING_SETTING_ON;
- data.receive_shadows=true;
- data.depth_scale=false;
- data.billboard=false;
- data.billboard_y=false;
- data.baked_light=NULL;
- data.baked_light_octree_xform=NULL;
- data.baked_lightmap_id=-1;
- version=1;
- room_info=NULL;
- room=NULL;
- RE=NULL;
- portal_info=NULL;
- exterior=false;
- layer_mask=1;
- draw_range_begin=0;
- draw_range_end=0;
- extra_margin=0;
- visible_in_all_rooms=false;
- update_aabb=false;
- update_materials=false;
-
- baked_light=NULL;
- baked_light_info=NULL;
- baked_light_sampler_info=NULL;
- sampled_light=NULL;
- BLE=NULL;
-
- light_cache_dirty=true;
-
- }
-
- ~Instance() {
-
- if (light_info)
- memdelete(light_info);
- if (particles_info)
- memdelete(particles_info);
- if (room_info)
- memdelete(room_info);
- if (portal_info)
- memdelete(portal_info);
- if (baked_light_info)
- memdelete(baked_light_info);
- };
- };
-
- struct _InstanceLightsort {
-
- bool operator()(const Instance* p_A, const Instance* p_B) const { return p_A->light_info->dtc < p_B->light_info->dtc; }
- };
-
- struct Scenario {
-
-
- ScenarioDebugMode debug;
- RID self;
- // well wtf, balloon allocator is slower?
- typedef ::Octree<Instance,true> Octree;
-
- Octree octree;
-
- List<RID> directional_lights;
- RID environment;
- RID fallback_environment;
-
- Instance *dirty_instances;
-
- Scenario() { dirty_instances=NULL; debug=SCENARIO_DEBUG_DISABLED; }
- };
-
-
-
- mutable RID_Owner<Rasterizer::ShaderMaterial> canvas_item_material_owner;
-
-
-
- struct Viewport {
-
- RID self;
- RID parent;
-
- VisualServer::ViewportRect rect;
- RID camera;
- RID scenario;
- RID viewport_data;
-
- RenderTargetUpdateMode render_target_update_mode;
- RID render_target;
- RID render_target_texture;
-
- Rect2 rt_to_screen_rect;
-
- bool hide_scenario;
- bool hide_canvas;
- bool transparent_bg;
- bool queue_capture;
- bool render_target_vflip;
- bool render_target_clear_on_new_frame;
- bool render_target_clear;
- bool disable_environment;
-
- Image capture;
-
- bool rendered_in_prev_frame;
-
- struct CanvasKey {
-
- int layer;
- RID canvas;
- bool operator<(const CanvasKey& p_canvas) const { if (layer==p_canvas.layer) return canvas < p_canvas.canvas; return layer<p_canvas.layer; }
- CanvasKey() { layer=0; }
- CanvasKey(const RID& p_canvas, int p_layer) { canvas=p_canvas; layer=p_layer; }
- };
-
- struct CanvasData {
-
- Canvas *canvas;
- Transform2D transform;
- int layer;
- };
-
- Transform2D global_transform;
-
- Map<RID,CanvasData> canvas_map;
-
- SelfList<Viewport> update_list;
-
- Viewport() : update_list(this) { transparent_bg=false; render_target_update_mode=RENDER_TARGET_UPDATE_WHEN_VISIBLE; queue_capture=false; rendered_in_prev_frame=false; render_target_vflip=false; render_target_clear_on_new_frame=true; render_target_clear=true; disable_environment=false; }
- };
-
- SelfList<Viewport>::List viewport_update_list;
-
- Map<RID,int> screen_viewports;
-
- struct CullRange {
-
- Plane nearp;
- float min,max;
- float z_near,z_far;
-
- void add_aabb(const Rect3& p_aabb) {
-
-
- }
- };
-
- struct Cursor {
-
- Point2 pos;
- float rot;
- RID texture;
- Point2 center;
- bool visible;
- Rect2 region;
- Cursor() {
-
- rot = 0;
- visible = false;
- region = Rect2();
- };
- };
-
- Rect2 canvas_clip;
- Color clear_color;
- Cursor cursors[MAX_CURSORS];
- RID default_cursor_texture;
-
- static void* instance_pair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int);
- static void instance_unpair(void *p_self, OctreeElementID,Instance *p_A,int, OctreeElementID,Instance *p_B,int,void*);
-
- Instance *instance_cull_result[MAX_INSTANCE_CULL];
- Instance *instance_shadow_cull_result[MAX_INSTANCE_CULL]; //used for generating shadowmaps
- Instance *light_cull_result[MAX_LIGHTS_CULLED];
- int light_cull_count;
-
- Instance *exterior_portal_cull_result[MAX_EXTERIOR_PORTALS];
- int exterior_portal_cull_count;
- bool exterior_visited;
-
- Instance *light_sampler_cull_result[MAX_LIGHT_SAMPLERS];
- int light_samplers_culled;
-
- Instance *room_cull_result[MAX_ROOM_CULL];
- int room_cull_count;
- bool room_cull_enabled;
- bool light_discard_enabled;
- bool shadows_enabled;
- int black_margin[4];
- RID black_image[4];
-
- Vector<Vector3> aabb_random_points;
- Vector<Vector3> transformed_aabb_random_points;
-
- void _instance_validate_autorooms(Instance *p_geometry);
-
- void _portal_disconnect(Instance *p_portal,bool p_cleanup=false);
- void _portal_attempt_connect(Instance *p_portal);
- void _dependency_queue_update(RID p_rid, bool p_update_aabb=false, bool p_update_materials=false);
- _FORCE_INLINE_ void _instance_queue_update(Instance *p_instance,bool p_update_aabb=false,bool p_update_materials=false);
- void _update_instances();
- void _update_instance_aabb(Instance *p_instance);
- void _update_instance(Instance *p_instance);
- void _free_attached_instances(RID p_rid,bool p_free_scenario=false);
- void _clean_up_owner(RID_OwnerBase *p_owner,String p_type);
-
- Instance *instance_update_list;
-
- //RID default_scenario;
- //RID default_viewport;
-
- RID test_cube;
-
-
- mutable RID_Owner<Room> room_owner;
- mutable RID_Owner<Portal> portal_owner;
-
- mutable RID_Owner<BakedLight> baked_light_owner;
- mutable RID_Owner<BakedLightSampler> baked_light_sampler_owner;
-
- mutable RID_Owner<Camera> camera_owner;
- mutable RID_Owner<Viewport> viewport_owner;
-
- mutable RID_Owner<Scenario> scenario_owner;
- mutable RID_Owner<Instance> instance_owner;
-
- mutable RID_Owner<Canvas> canvas_owner;
- mutable RID_Owner<CanvasItem> canvas_item_owner;
-
- Map< RID, Set<RID> > instance_dependency_map;
- Map< RID, Set<Instance*> > skeleton_dependency_map;
-
-
- ViewportRect viewport_rect;
- _FORCE_INLINE_ void _instance_draw(Instance *p_instance);
-
- bool _test_portal_cull(Camera *p_camera, Instance *p_portal_from, Instance *p_portal_to);
- void _cull_portal(Camera *p_camera, Instance *p_portal,Instance *p_from_portal);
- void _cull_room(Camera *p_camera, Instance *p_room,Instance *p_from_portal=NULL);
- void _process_sampled_light(const Transform &p_camera, Instance *p_sampled_light, bool p_linear_colorspace);
-
- void _render_no_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
- void _render_camera(Viewport *p_viewport,Camera *p_camera, Scenario *p_scenario);
- static void _render_canvas_item_viewport(VisualServer* p_self,void *p_vp,const Rect2& p_rect);
- void _render_canvas_item_tree(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, const Color &p_modulate, Rasterizer::CanvasLight *p_lights);
- void _render_canvas_item(CanvasItem *p_canvas_item, const Transform2D& p_transform, const Rect2& p_clip_rect, float p_opacity, int p_z, Rasterizer::CanvasItem **z_list, Rasterizer::CanvasItem **z_last_list, CanvasItem *p_canvas_clip, CanvasItem *p_material_owner);
- void _render_canvas(Canvas *p_canvas, const Transform2D &p_transform, Rasterizer::CanvasLight *p_lights, Rasterizer::CanvasLight *p_masked_lights);
- void _light_mask_canvas_items(int p_z,Rasterizer::CanvasItem *p_canvas_item,Rasterizer::CanvasLight *p_masked_lights);
-
- Vector<Vector3> _camera_generate_endpoints(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max);
- Vector<Plane> _camera_generate_orthogonal_planes(Instance *p_light,Camera *p_camera,float p_range_min, float p_range_max);
-
- void _light_instance_update_lispsm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
- void _light_instance_update_pssm_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
-
- void _light_instance_update_shadow(Instance *p_light,Scenario *p_scenario,Camera *p_camera,const CullRange& p_cull_range);
-
- uint64_t render_pass;
- int changes;
- bool draw_extra_frame;
-
- void _draw_viewport_camera(Viewport *p_viewport, bool p_ignore_camera);
- void _draw_viewport(Viewport *p_viewport,int p_ofs_x, int p_ofs_y,int p_parent_w,int p_parent_h);
- void _draw_viewports();
- void _draw_cursors_and_margins();
-
-
- Rasterizer *rasterizer;
-
-#endif
-
void _draw_margins();
static void _changes_changed() {}
@@ -726,6 +211,8 @@ public:
BIND2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
BIND1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
+ BIND4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &)
+
BIND3(mesh_surface_set_material, RID, int, RID)
BIND2RC(RID, mesh_surface_get_material, RID, int)
diff --git a/servers/visual/visual_server_wrap_mt.h b/servers/visual/visual_server_wrap_mt.h
index 80a1ef3879..1dddef7bd4 100644
--- a/servers/visual/visual_server_wrap_mt.h
+++ b/servers/visual/visual_server_wrap_mt.h
@@ -144,6 +144,8 @@ public:
FUNC2(mesh_set_blend_shape_mode, RID, BlendShapeMode)
FUNC1RC(BlendShapeMode, mesh_get_blend_shape_mode, RID)
+ FUNC4(mesh_surface_update_region, RID, int, int, const PoolVector<uint8_t> &)
+
FUNC3(mesh_surface_set_material, RID, int, RID)
FUNC2RC(RID, mesh_surface_get_material, RID, int)
diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp
index 2234ddda0d..039bbedbcc 100644
--- a/servers/visual_server.cpp
+++ b/servers/visual_server.cpp
@@ -1856,6 +1856,8 @@ void VisualServer::_bind_methods() {
BIND_ENUM_CONSTANT(FEATURE_SHADERS);
BIND_ENUM_CONSTANT(FEATURE_MULTITHREADED);
+
+ ADD_SIGNAL(MethodInfo("frame_drawn_in_thread"));
}
void VisualServer::_canvas_item_add_style_box(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector<float> &p_margins, const Color &p_modulate) {
diff --git a/servers/visual_server.h b/servers/visual_server.h
index 7b0976b100..a36ba4a50a 100644
--- a/servers/visual_server.h
+++ b/servers/visual_server.h
@@ -227,6 +227,7 @@ public:
ARRAY_FLAG_USE_2D_VERTICES = ARRAY_COMPRESS_INDEX << 1,
ARRAY_FLAG_USE_16_BIT_BONES = ARRAY_COMPRESS_INDEX << 2,
+ ARRAY_FLAG_USE_DYNAMIC_UPDATE = ARRAY_COMPRESS_INDEX << 3,
ARRAY_COMPRESS_DEFAULT = ARRAY_COMPRESS_VERTEX | ARRAY_COMPRESS_NORMAL | ARRAY_COMPRESS_TANGENT | ARRAY_COMPRESS_COLOR | ARRAY_COMPRESS_TEX_UV | ARRAY_COMPRESS_TEX_UV2 | ARRAY_COMPRESS_WEIGHTS
@@ -259,6 +260,8 @@ public:
virtual void mesh_set_blend_shape_mode(RID p_mesh, BlendShapeMode p_mode) = 0;
virtual BlendShapeMode mesh_get_blend_shape_mode(RID p_mesh) const = 0;
+ virtual void mesh_surface_update_region(RID p_mesh, int p_surface, int p_offset, const PoolVector<uint8_t> &p_data) = 0;
+
virtual void mesh_surface_set_material(RID p_mesh, int p_surface, RID p_material) = 0;
virtual RID mesh_surface_get_material(RID p_mesh, int p_surface) const = 0;