summaryrefslogtreecommitdiff
path: root/servers
diff options
context:
space:
mode:
Diffstat (limited to 'servers')
-rw-r--r--servers/arvr/arvr_positional_tracker.cpp18
-rw-r--r--servers/arvr/arvr_positional_tracker.h3
-rw-r--r--servers/audio/audio_stream.cpp6
-rw-r--r--servers/audio/audio_stream.h6
-rw-r--r--servers/audio_server.cpp2
-rw-r--r--servers/physics/body_sw.cpp5
-rw-r--r--servers/physics/joints/generic_6dof_joint_sw.cpp4
-rw-r--r--servers/physics/physics_server_sw.cpp14
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp14
-rw-r--r--servers/physics_2d_server.cpp67
-rw-r--r--servers/physics_2d_server.h37
-rw-r--r--servers/physics_server.cpp67
-rw-r--r--servers/physics_server.h39
-rw-r--r--servers/register_server_types.cpp39
-rw-r--r--servers/register_server_types.h2
-rw-r--r--servers/visual/visual_server_raster.cpp3
-rw-r--r--servers/visual/visual_server_raster.h2
17 files changed, 279 insertions, 49 deletions
diff --git a/servers/arvr/arvr_positional_tracker.cpp b/servers/arvr/arvr_positional_tracker.cpp
index 4ecd7a3898..fc0270615c 100644
--- a/servers/arvr/arvr_positional_tracker.cpp
+++ b/servers/arvr/arvr_positional_tracker.cpp
@@ -52,6 +52,11 @@ void ARVRPositionalTracker::_bind_methods() {
ClassDB::bind_method(D_METHOD("_set_joy_id", "joy_id"), &ARVRPositionalTracker::set_joy_id);
ClassDB::bind_method(D_METHOD("_set_orientation", "orientation"), &ARVRPositionalTracker::set_orientation);
ClassDB::bind_method(D_METHOD("_set_rw_position", "rw_position"), &ARVRPositionalTracker::set_rw_position);
+
+ ClassDB::bind_method(D_METHOD("get_rumble"), &ARVRPositionalTracker::get_rumble);
+ ClassDB::bind_method(D_METHOD("set_rumble", "rumble"), &ARVRPositionalTracker::set_rumble);
+
+ ADD_PROPERTY(PropertyInfo(Variant::REAL, "rumble"), "set_rumble", "get_rumble");
};
void ARVRPositionalTracker::set_type(ARVRServer::TrackerType p_type) {
@@ -170,6 +175,18 @@ Transform ARVRPositionalTracker::get_transform(bool p_adjust_by_reference_frame)
return new_transform;
};
+real_t ARVRPositionalTracker::get_rumble() const {
+ return rumble;
+};
+
+void ARVRPositionalTracker::set_rumble(real_t p_rumble) {
+ if (p_rumble > 0.0) {
+ rumble = p_rumble;
+ } else {
+ rumble = 0.0;
+ };
+};
+
ARVRPositionalTracker::ARVRPositionalTracker() {
type = ARVRServer::TRACKER_UNKNOWN;
name = "Unknown";
@@ -178,6 +195,7 @@ ARVRPositionalTracker::ARVRPositionalTracker() {
tracks_orientation = false;
tracks_position = false;
hand = TRACKER_HAND_UNKNOWN;
+ rumble = 0.0;
};
ARVRPositionalTracker::~ARVRPositionalTracker(){
diff --git a/servers/arvr/arvr_positional_tracker.h b/servers/arvr/arvr_positional_tracker.h
index ff0c150f89..e450328a22 100644
--- a/servers/arvr/arvr_positional_tracker.h
+++ b/servers/arvr/arvr_positional_tracker.h
@@ -65,6 +65,7 @@ private:
bool tracks_position; // do we track position?
Vector3 rw_position; // our position "in the real world, so without world_scale applied"
TrackerHand hand; // if known, the hand this tracker is held in
+ real_t rumble; // rumble strength, 0.0 is off, 1.0 is maximum, note that we only record here, arvr_interface is responsible for execution
protected:
static void _bind_methods();
@@ -87,6 +88,8 @@ public:
Vector3 get_rw_position() const;
ARVRPositionalTracker::TrackerHand get_hand() const;
void set_hand(const ARVRPositionalTracker::TrackerHand p_hand);
+ real_t get_rumble() const;
+ void set_rumble(real_t p_rumble);
Transform get_transform(bool p_adjust_by_reference_frame) const;
diff --git a/servers/audio/audio_stream.cpp b/servers/audio/audio_stream.cpp
index 0e3d5824d9..d7b2c2c5e0 100644
--- a/servers/audio/audio_stream.cpp
+++ b/servers/audio/audio_stream.cpp
@@ -191,12 +191,12 @@ void AudioStreamPlaybackRandomPitch::seek(float p_time) {
}
}
-void AudioStreamPlaybackRandomPitch::mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames) {
+void AudioStreamPlaybackRandomPitch::mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) {
if (playing.is_valid()) {
- playing->mix(p_bufer, p_rate_scale * pitch_scale, p_frames);
+ playing->mix(p_buffer, p_rate_scale * pitch_scale, p_frames);
} else {
for (int i = 0; i < p_frames; i++) {
- p_bufer[i] = AudioFrame(0, 0);
+ p_buffer[i] = AudioFrame(0, 0);
}
}
}
diff --git a/servers/audio/audio_stream.h b/servers/audio/audio_stream.h
index 3324597b41..dc931502b4 100644
--- a/servers/audio/audio_stream.h
+++ b/servers/audio/audio_stream.h
@@ -48,7 +48,7 @@ public:
virtual float get_playback_position() const = 0;
virtual void seek(float p_time) = 0;
- virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames) = 0;
+ virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames) = 0;
virtual float get_length() const = 0; //if supported, otherwise return 0
};
@@ -70,7 +70,7 @@ class AudioStreamPlaybackResampled : public AudioStreamPlayback {
protected:
void _begin_resample();
- virtual void _mix_internal(AudioFrame *p_bufer, int p_frames) = 0;
+ virtual void _mix_internal(AudioFrame *p_buffer, int p_frames) = 0;
virtual float get_stream_sampling_rate() = 0;
public:
@@ -136,7 +136,7 @@ public:
virtual float get_playback_position() const;
virtual void seek(float p_time);
- virtual void mix(AudioFrame *p_bufer, float p_rate_scale, int p_frames);
+ virtual void mix(AudioFrame *p_buffer, float p_rate_scale, int p_frames);
virtual float get_length() const; //if supported, otherwise return 0
diff --git a/servers/audio_server.cpp b/servers/audio_server.cpp
index 18b7014595..697abead68 100644
--- a/servers/audio_server.cpp
+++ b/servers/audio_server.cpp
@@ -226,7 +226,7 @@ void AudioServer::_driver_process(int p_frames, int32_t *p_buffer) {
static int total = 0;
ticks = OS::get_singleton()->get_ticks_msec();
- if ((ticks - first_ticks) > 10 * 1000) {
+ if ((ticks - first_ticks) > 10 * 1000 && count > 0) {
print_line("Audio Driver " + String(AudioDriver::get_singleton()->get_name()) + " average latency: " + itos(total / count) + "ms (frame=" + itos(p_frames) + ")");
first_ticks = ticks;
total = 0;
diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp
index 46a5192e52..6ced004118 100644
--- a/servers/physics/body_sw.cpp
+++ b/servers/physics/body_sw.cpp
@@ -45,8 +45,9 @@ void BodySW::_update_transform_dependant() {
// update inertia tensor
Basis tb = principal_inertia_axes;
Basis tbt = tb.transposed();
- tb.scale(_inv_inertia);
- _inv_inertia_tensor = tb * tbt;
+ Basis diag;
+ diag.scale(_inv_inertia);
+ _inv_inertia_tensor = tb * diag * tbt;
}
void BodySW::update_inertias() {
diff --git a/servers/physics/joints/generic_6dof_joint_sw.cpp b/servers/physics/joints/generic_6dof_joint_sw.cpp
index 70cc549e2d..1e323be36c 100644
--- a/servers/physics/joints/generic_6dof_joint_sw.cpp
+++ b/servers/physics/joints/generic_6dof_joint_sw.cpp
@@ -219,9 +219,9 @@ Generic6DOFJointSW::Generic6DOFJointSW(BodySW *rbA, BodySW *rbB, const Transform
}
void Generic6DOFJointSW::calculateAngleInfo() {
- Basis relative_frame = m_calculatedTransformA.basis.inverse() * m_calculatedTransformB.basis;
+ Basis relative_frame = m_calculatedTransformB.basis.inverse() * m_calculatedTransformA.basis;
- m_calculatedAxisAngleDiff = relative_frame.get_euler();
+ m_calculatedAxisAngleDiff = relative_frame.get_euler_xyz();
// in euler angle mode we do not actually constrain the angular velocity
// along the axes axis[0] and axis[2] (although we do use axis[1]) :
diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp
index a7c31cf16c..5ba935d47c 100644
--- a/servers/physics/physics_server_sw.cpp
+++ b/servers/physics/physics_server_sw.cpp
@@ -233,14 +233,7 @@ void PhysicsServerSW::area_set_space(RID p_area, RID p_space) {
if (area->get_space() == space)
return; //pointless
- for (Set<ConstraintSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
- RID self = E->get()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
area->clear_constraints();
-
area->set_space(space);
};
@@ -494,14 +487,7 @@ void PhysicsServerSW::body_set_space(RID p_body, RID p_space) {
if (body->get_space() == space)
return; //pointless
- for (Map<ConstraintSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
- RID self = E->key()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
body->clear_constraint_map();
-
body->set_space(space);
};
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index df3bf72a31..5d3305c82d 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -299,14 +299,7 @@ void Physics2DServerSW::area_set_space(RID p_area, RID p_space) {
if (area->get_space() == space)
return; //pointless
- for (Set<Constraint2DSW *>::Element *E = area->get_constraints().front(); E; E = E->next()) {
- RID self = E->get()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
area->clear_constraints();
-
area->set_space(space);
};
@@ -551,14 +544,7 @@ void Physics2DServerSW::body_set_space(RID p_body, RID p_space) {
if (body->get_space() == space)
return; //pointless
- for (Map<Constraint2DSW *, int>::Element *E = body->get_constraint_map().front(); E; E = E->next()) {
- RID self = E->key()->get_self();
- if (!self.is_valid())
- continue;
- free(self);
- }
body->clear_constraint_map();
-
body->set_space(space);
};
diff --git a/servers/physics_2d_server.cpp b/servers/physics_2d_server.cpp
index b2e1d541ab..130c0583dc 100644
--- a/servers/physics_2d_server.cpp
+++ b/servers/physics_2d_server.cpp
@@ -28,7 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "physics_2d_server.h"
+#include "core/project_settings.h"
#include "print_string.h"
+
Physics2DServer *Physics2DServer::singleton = NULL;
void Physics2DDirectBodyState::integrate_forces() {
@@ -692,3 +694,68 @@ Physics2DServer::~Physics2DServer() {
singleton = NULL;
}
+
+Vector<Physics2DServerManager::ClassInfo> Physics2DServerManager::physics_2d_servers;
+int Physics2DServerManager::default_server_id = -1;
+int Physics2DServerManager::default_server_priority = -1;
+const String Physics2DServerManager::setting_property_name("physics/2d/physics_engine");
+
+void Physics2DServerManager::on_servers_changed() {
+
+ String physics_servers("DEFAULT");
+ for (int i = get_servers_count() - 1; 0 <= i; --i) {
+ physics_servers += "," + get_server_name(i);
+ }
+ ProjectSettings::get_singleton()->set_custom_property_info(setting_property_name, PropertyInfo(Variant::STRING, setting_property_name, PROPERTY_HINT_ENUM, physics_servers));
+}
+
+void Physics2DServerManager::register_server(const String &p_name, CreatePhysics2DServerCallback p_creat_callback) {
+
+ ERR_FAIL_COND(!p_creat_callback);
+ ERR_FAIL_COND(find_server_id(p_name) != -1);
+ physics_2d_servers.push_back(ClassInfo(p_name, p_creat_callback));
+ on_servers_changed();
+}
+
+void Physics2DServerManager::set_default_server(const String &p_name, int p_priority) {
+
+ const int id = find_server_id(p_name);
+ ERR_FAIL_COND(id == -1); // Not found
+ if (default_server_priority < p_priority) {
+ default_server_id = id;
+ default_server_priority = p_priority;
+ }
+}
+
+int Physics2DServerManager::find_server_id(const String &p_name) {
+
+ for (int i = physics_2d_servers.size() - 1; 0 <= i; --i) {
+ if (p_name == physics_2d_servers[i].name) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+int Physics2DServerManager::get_servers_count() {
+ return physics_2d_servers.size();
+}
+
+String Physics2DServerManager::get_server_name(int p_id) {
+ ERR_FAIL_INDEX_V(p_id, get_servers_count(), "");
+ return physics_2d_servers[p_id].name;
+}
+
+Physics2DServer *Physics2DServerManager::new_default_server() {
+ ERR_FAIL_COND_V(default_server_id == -1, NULL);
+ return physics_2d_servers[default_server_id].create_callback();
+}
+
+Physics2DServer *Physics2DServerManager::new_server(const String &p_name) {
+ int id = find_server_id(p_name);
+ if (id == -1) {
+ return NULL;
+ } else {
+ return physics_2d_servers[id].create_callback();
+ }
+}
diff --git a/servers/physics_2d_server.h b/servers/physics_2d_server.h
index 18f4f460b6..ddd1555768 100644
--- a/servers/physics_2d_server.h
+++ b/servers/physics_2d_server.h
@@ -590,6 +590,43 @@ public:
Physics2DTestMotionResult();
};
+typedef Physics2DServer *(*CreatePhysics2DServerCallback)();
+
+class Physics2DServerManager {
+ struct ClassInfo {
+ String name;
+ CreatePhysics2DServerCallback create_callback;
+
+ ClassInfo()
+ : name(""), create_callback(NULL) {}
+
+ ClassInfo(String p_name, CreatePhysics2DServerCallback p_create_callback)
+ : name(p_name), create_callback(p_create_callback) {}
+
+ ClassInfo(const ClassInfo &p_ci)
+ : name(p_ci.name), create_callback(p_ci.create_callback) {}
+ };
+
+ static Vector<ClassInfo> physics_2d_servers;
+ static int default_server_id;
+ static int default_server_priority;
+
+public:
+ static const String setting_property_name;
+
+private:
+ static void on_servers_changed();
+
+public:
+ static void register_server(const String &p_name, CreatePhysics2DServerCallback p_creat_callback);
+ static void set_default_server(const String &p_name, int p_priority = 0);
+ static int find_server_id(const String &p_name);
+ static int get_servers_count();
+ static String get_server_name(int p_id);
+ static Physics2DServer *new_default_server();
+ static Physics2DServer *new_server(const String &p_name);
+};
+
VARIANT_ENUM_CAST(Physics2DServer::ShapeType);
VARIANT_ENUM_CAST(Physics2DServer::SpaceParameter);
VARIANT_ENUM_CAST(Physics2DServer::AreaParameter);
diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp
index 360808ce8c..a3efe76e13 100644
--- a/servers/physics_server.cpp
+++ b/servers/physics_server.cpp
@@ -28,7 +28,9 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "physics_server.h"
+#include "core/project_settings.h"
#include "print_string.h"
+
PhysicsServer *PhysicsServer::singleton = NULL;
void PhysicsDirectBodyState::integrate_forces() {
@@ -732,3 +734,68 @@ PhysicsServer::~PhysicsServer() {
singleton = NULL;
}
+
+Vector<PhysicsServerManager::ClassInfo> PhysicsServerManager::physics_servers;
+int PhysicsServerManager::default_server_id = -1;
+int PhysicsServerManager::default_server_priority = -1;
+const String PhysicsServerManager::setting_property_name("physics/3d/physics_engine");
+
+void PhysicsServerManager::on_servers_changed() {
+
+ String physics_servers("DEFAULT");
+ for (int i = get_servers_count() - 1; 0 <= i; --i) {
+ physics_servers += "," + get_server_name(i);
+ }
+ ProjectSettings::get_singleton()->set_custom_property_info(setting_property_name, PropertyInfo(Variant::STRING, setting_property_name, PROPERTY_HINT_ENUM, physics_servers));
+}
+
+void PhysicsServerManager::register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback) {
+
+ ERR_FAIL_COND(!p_creat_callback);
+ ERR_FAIL_COND(find_server_id(p_name) != -1);
+ physics_servers.push_back(ClassInfo(p_name, p_creat_callback));
+ on_servers_changed();
+}
+
+void PhysicsServerManager::set_default_server(const String &p_name, int p_priority) {
+
+ const int id = find_server_id(p_name);
+ ERR_FAIL_COND(id == -1); // Not found
+ if (default_server_priority < p_priority) {
+ default_server_id = id;
+ default_server_priority = p_priority;
+ }
+}
+
+int PhysicsServerManager::find_server_id(const String &p_name) {
+
+ for (int i = physics_servers.size() - 1; 0 <= i; --i) {
+ if (p_name == physics_servers[i].name) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+int PhysicsServerManager::get_servers_count() {
+ return physics_servers.size();
+}
+
+String PhysicsServerManager::get_server_name(int p_id) {
+ ERR_FAIL_INDEX_V(p_id, get_servers_count(), "");
+ return physics_servers[p_id].name;
+}
+
+PhysicsServer *PhysicsServerManager::new_default_server() {
+ ERR_FAIL_COND_V(default_server_id == -1, NULL);
+ return physics_servers[default_server_id].create_callback();
+}
+
+PhysicsServer *PhysicsServerManager::new_server(const String &p_name) {
+ int id = find_server_id(p_name);
+ if (id == -1) {
+ return NULL;
+ } else {
+ return physics_servers[id].create_callback();
+ }
+}
diff --git a/servers/physics_server.h b/servers/physics_server.h
index 8cec125646..7cccd9b4cb 100644
--- a/servers/physics_server.h
+++ b/servers/physics_server.h
@@ -357,7 +357,7 @@ public:
BODY_MODE_STATIC,
BODY_MODE_KINEMATIC,
BODY_MODE_RIGID,
- //BODY_MODE_SOFT
+ BODY_MODE_SOFT,
BODY_MODE_CHARACTER
};
@@ -658,6 +658,43 @@ public:
~PhysicsServer();
};
+typedef PhysicsServer *(*CreatePhysicsServerCallback)();
+
+class PhysicsServerManager {
+ struct ClassInfo {
+ String name;
+ CreatePhysicsServerCallback create_callback;
+
+ ClassInfo()
+ : name(""), create_callback(NULL) {}
+
+ ClassInfo(String p_name, CreatePhysicsServerCallback p_create_callback)
+ : name(p_name), create_callback(p_create_callback) {}
+
+ ClassInfo(const ClassInfo &p_ci)
+ : name(p_ci.name), create_callback(p_ci.create_callback) {}
+ };
+
+ static Vector<ClassInfo> physics_servers;
+ static int default_server_id;
+ static int default_server_priority;
+
+public:
+ static const String setting_property_name;
+
+private:
+ static void on_servers_changed();
+
+public:
+ static void register_server(const String &p_name, CreatePhysicsServerCallback p_creat_callback);
+ static void set_default_server(const String &p_name, int p_priority = 0);
+ static int find_server_id(const String &p_name);
+ static int get_servers_count();
+ static String get_server_name(int p_id);
+ static PhysicsServer *new_default_server();
+ static PhysicsServer *new_server(const String &p_name);
+};
+
VARIANT_ENUM_CAST(PhysicsServer::ShapeType);
VARIANT_ENUM_CAST(PhysicsServer::SpaceParameter);
VARIANT_ENUM_CAST(PhysicsServer::AreaParameter);
diff --git a/servers/register_server_types.cpp b/servers/register_server_types.cpp
index 7a9328e30f..1ba9e7b174 100644
--- a/servers/register_server_types.cpp
+++ b/servers/register_server_types.cpp
@@ -49,6 +49,9 @@
#include "audio/effects/audio_effect_reverb.h"
#include "audio/effects/audio_effect_stereo_enhance.h"
#include "audio_server.h"
+#include "physics/physics_server_sw.h"
+#include "physics_2d/physics_2d_server_sw.h"
+#include "physics_2d/physics_2d_server_wrap_mt.h"
#include "physics_2d_server.h"
#include "physics_server.h"
#include "script_debugger_remote.h"
@@ -74,6 +77,14 @@ static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsag
ShaderTypes *shader_types = NULL;
+PhysicsServer *_createGodotPhysicsCallback() {
+ return memnew(PhysicsServerSW);
+}
+
+Physics2DServer *_createGodotPhysics2DCallback() {
+ return Physics2DServerWrapMT::init_server<Physics2DServerSW>();
+}
+
void register_server_types() {
ClassDB::register_virtual_class<VisualServer>();
@@ -82,12 +93,6 @@ void register_server_types() {
ClassDB::register_virtual_class<Physics2DServer>();
ClassDB::register_class<ARVRServer>();
- 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()));
-
shader_types = memnew(ShaderTypes);
ClassDB::register_virtual_class<ARVRInterface>();
@@ -144,9 +149,31 @@ void register_server_types() {
ClassDB::register_virtual_class<PhysicsShapeQueryResult>();
ScriptDebuggerRemote::resource_usage_func = _debugger_get_resource_usage;
+
+ // Physics 2D
+ GLOBAL_DEF(Physics2DServerManager::setting_property_name, "DEFAULT");
+ ProjectSettings::get_singleton()->set_custom_property_info(Physics2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Physics2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
+
+ Physics2DServerManager::register_server("GodotPhysics", &_createGodotPhysics2DCallback);
+ Physics2DServerManager::set_default_server("GodotPhysics");
+
+ // Physics 3D
+ GLOBAL_DEF(PhysicsServerManager::setting_property_name, "DEFAULT");
+ ProjectSettings::get_singleton()->set_custom_property_info(PhysicsServerManager::setting_property_name, PropertyInfo(Variant::STRING, PhysicsServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));
+
+ PhysicsServerManager::register_server("GodotPhysics", &_createGodotPhysicsCallback);
+ PhysicsServerManager::set_default_server("GodotPhysics");
}
void unregister_server_types() {
memdelete(shader_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()));
+}
diff --git a/servers/register_server_types.h b/servers/register_server_types.h
index 2b3ac816ac..e53626ca30 100644
--- a/servers/register_server_types.h
+++ b/servers/register_server_types.h
@@ -33,4 +33,6 @@
void register_server_types();
void unregister_server_types();
+void register_server_singletons();
+
#endif // REGISTER_SERVER_TYPES_H
diff --git a/servers/visual/visual_server_raster.cpp b/servers/visual/visual_server_raster.cpp
index c644fd2d55..69e2d1c162 100644
--- a/servers/visual/visual_server_raster.cpp
+++ b/servers/visual/visual_server_raster.cpp
@@ -102,6 +102,7 @@ void VisualServerRaster::draw() {
VSG::viewport->draw_viewports();
VSG::scene->render_probes();
+ _draw_margins();
VSG::rasterizer->end_frame();
while (frame_drawn_callbacks.front()) {
@@ -119,8 +120,6 @@ void VisualServerRaster::draw() {
frame_drawn_callbacks.pop_front();
}
-
- _draw_margins();
}
void VisualServerRaster::sync() {
}
diff --git a/servers/visual/visual_server_raster.h b/servers/visual/visual_server_raster.h
index 302f13ee4f..425381550e 100644
--- a/servers/visual/visual_server_raster.h
+++ b/servers/visual/visual_server_raster.h
@@ -281,7 +281,7 @@ class VisualServerRaster : public VisualServer {
Set<Instance*> owned_instances;
BakedLightSampler *sampler;
int resolution;
- Vector<Color> light_bufer;
+ Vector<Color> light_buffer;
RID sampled_light;
uint64_t last_pass;
Transform xform; // viewspace normal to lightspace, might not use one.