summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2020-04-16 23:52:00 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-04-17 12:35:41 -0300
commit0e1c66d9fced8f9d3a8fbd87ddfd2c29a9ed2679 (patch)
tree20628329f16f74383806fecf9e3135816636e6fb /main/main.cpp
parent30ab5c9baae1cad3e157d906395a4eb8cef77e42 (diff)
Implement global and per instance shader uniforms.
Adds two keywords to shader language for uniforms: -'global' -'instance' This allows them to reference values outside the material.
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index a95af44215..c625a9cb36 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -1481,6 +1481,15 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
// We could add more, and make the CLI arg require a comma-separated list of profilers.
EngineDebugger::get_singleton()->profiler_enable("scripts", true);
}
+
+ if (!project_manager) {
+ // If not running the project manager, and now that the engine is
+ // able to load resources, load the global shader variables.
+ // If running on editor, dont load the textures because the editor
+ // may want to import them first. Editor will reload those later.
+ rendering_server->global_variables_load_settings(!editor);
+ }
+
_start_success = true;
locale = String();
@@ -2280,6 +2289,9 @@ void Main::cleanup() {
// Sync pending commands that may have been queued from a different thread during ScriptServer finalization
RenderingServer::get_singleton()->sync();
+ //clear global shader variables before scene and other graphics stuff is deinitialized.
+ rendering_server->global_variables_clear();
+
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif