summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/bullet_physics_server.cpp8
-rw-r--r--modules/bullet/bullet_physics_server.h4
-rw-r--r--modules/bullet/rigid_body_bullet.cpp43
-rw-r--r--modules/bullet/rigid_body_bullet.h6
-rw-r--r--modules/thekla_unwrap/SCsub68
-rw-r--r--modules/thekla_unwrap/config.py7
-rw-r--r--modules/thekla_unwrap/register_types.cpp34
-rw-r--r--modules/thekla_unwrap/register_types.h31
8 files changed, 162 insertions, 39 deletions
diff --git a/modules/bullet/bullet_physics_server.cpp b/modules/bullet/bullet_physics_server.cpp
index 26c879fddb..339dccce33 100644
--- a/modules/bullet/bullet_physics_server.cpp
+++ b/modules/bullet/bullet_physics_server.cpp
@@ -723,15 +723,15 @@ void BulletPhysicsServer::body_set_axis_velocity(RID p_body, const Vector3 &p_ax
body->set_linear_velocity(v);
}
-void BulletPhysicsServer::body_set_axis_lock(RID p_body, PhysicsServer::BodyAxisLock p_lock) {
+void BulletPhysicsServer::body_set_axis_lock(RID p_body, int axis, bool p_lock) {
RigidBodyBullet *body = rigid_body_owner.get(p_body);
ERR_FAIL_COND(!body);
- body->set_axis_lock(p_lock);
+ body->set_axis_lock(axis, p_lock);
}
-PhysicsServer::BodyAxisLock BulletPhysicsServer::body_get_axis_lock(RID p_body) const {
+bool BulletPhysicsServer::body_get_axis_lock(RID p_body) const {
const RigidBodyBullet *body = rigid_body_owner.get(p_body);
- ERR_FAIL_COND_V(!body, BODY_AXIS_LOCK_DISABLED);
+ ERR_FAIL_COND_V(!body, 0);
return body->get_axis_lock();
}
diff --git a/modules/bullet/bullet_physics_server.h b/modules/bullet/bullet_physics_server.h
index ad8137ee2f..ed5acb9041 100644
--- a/modules/bullet/bullet_physics_server.h
+++ b/modules/bullet/bullet_physics_server.h
@@ -226,8 +226,8 @@ public:
virtual void body_apply_torque_impulse(RID p_body, const Vector3 &p_impulse);
virtual void body_set_axis_velocity(RID p_body, const Vector3 &p_axis_velocity);
- virtual void body_set_axis_lock(RID p_body, BodyAxisLock p_lock);
- virtual BodyAxisLock body_get_axis_lock(RID p_body) const;
+ virtual void body_set_axis_lock(RID p_body, int axis, bool p_lock);
+ virtual bool body_get_axis_lock(RID p_body) const;
virtual void body_add_collision_exception(RID p_body, RID p_body_b);
virtual void body_remove_collision_exception(RID p_body, RID p_body_b);
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index b134bd3a36..843bdab31f 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -277,7 +277,7 @@ RigidBodyBullet::RigidBodyBullet() :
setupBulletCollisionObject(btBody);
set_mode(PhysicsServer::BODY_MODE_RIGID);
- set_axis_lock(PhysicsServer::BODY_AXIS_LOCK_DISABLED);
+ set_axis_lock(0, locked_axis[0]);
areasWhereIam.resize(maxAreasWhereIam);
for (int i = areasWhereIam.size() - 1; 0 <= i; --i) {
@@ -498,25 +498,25 @@ void RigidBodyBullet::set_mode(PhysicsServer::BodyMode p_mode) {
switch (p_mode) {
case PhysicsServer::BODY_MODE_KINEMATIC:
mode = PhysicsServer::BODY_MODE_KINEMATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ set_axis_lock(0, locked_axis[0]); // Reload axis lock
_internal_set_mass(0);
init_kinematic_utilities();
break;
case PhysicsServer::BODY_MODE_STATIC:
mode = PhysicsServer::BODY_MODE_STATIC;
- set_axis_lock(axis_lock); // Reload axis lock
+ set_axis_lock(0, locked_axis[0]); // Reload axis lock
_internal_set_mass(0);
break;
case PhysicsServer::BODY_MODE_RIGID: {
mode = PhysicsServer::BODY_MODE_RIGID;
- set_axis_lock(axis_lock); // Reload axis lock
+ set_axis_lock(0, locked_axis[0]); // Reload axis lock
_internal_set_mass(0 == mass ? 1 : mass);
scratch_space_override_modificator();
break;
}
case PhysicsServer::BODY_MODE_CHARACTER: {
mode = PhysicsServer::BODY_MODE_CHARACTER;
- set_axis_lock(axis_lock); // Reload axis lock
+ set_axis_lock(0, locked_axis[0]); // Reload axis lock
_internal_set_mass(0 == mass ? 1 : mass);
scratch_space_override_modificator();
break;
@@ -655,22 +655,14 @@ Vector3 RigidBodyBullet::get_applied_torque() const {
return gTotTorq;
}
-void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) {
- axis_lock = p_lock;
+void RigidBodyBullet::set_axis_lock(int axis, bool p_lock) {
+ locked_axis[axis] = p_lock;
- if (PhysicsServer::BODY_AXIS_LOCK_DISABLED == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 1.));
+ btBody->setLinearFactor(btVector3(locked_axis[0] ? 0 : 1., locked_axis[1] ? 0 : 1., locked_axis[2] ? 0 : 1.));
+ if (locked_axis[0] || locked_axis[1] || locked_axis[2])
+ btBody->setAngularFactor(btVector3(locked_axis[0] ? 1. : 0, locked_axis[1] ? 1. : 0, locked_axis[2] ? 1. : 0));
+ else
btBody->setAngularFactor(btVector3(1., 1., 1.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_X == axis_lock) {
- btBody->setLinearFactor(btVector3(0., 1., 1.));
- btBody->setAngularFactor(btVector3(1., 0., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Y == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 0., 1.));
- btBody->setAngularFactor(btVector3(0., 1., 0.));
- } else if (PhysicsServer::BODY_AXIS_LOCK_Z == axis_lock) {
- btBody->setLinearFactor(btVector3(1., 1., 0.));
- btBody->setAngularFactor(btVector3(0., 0., 1.));
- }
if (PhysicsServer::BODY_MODE_CHARACTER == mode) {
/// When character lock angular
@@ -678,17 +670,8 @@ void RigidBodyBullet::set_axis_lock(PhysicsServer::BodyAxisLock p_lock) {
}
}
-PhysicsServer::BodyAxisLock RigidBodyBullet::get_axis_lock() const {
- btVector3 vec = btBody->getLinearFactor();
- if (0. == vec.x()) {
- return PhysicsServer::BODY_AXIS_LOCK_X;
- } else if (0. == vec.y()) {
- return PhysicsServer::BODY_AXIS_LOCK_Y;
- } else if (0. == vec.z()) {
- return PhysicsServer::BODY_AXIS_LOCK_Z;
- } else {
- return PhysicsServer::BODY_AXIS_LOCK_DISABLED;
- }
+bool RigidBodyBullet::get_axis_lock() const {
+ return locked_axis;
}
void RigidBodyBullet::set_continuous_collision_detection(bool p_enable) {
diff --git a/modules/bullet/rigid_body_bullet.h b/modules/bullet/rigid_body_bullet.h
index c54b5784b5..fde8b21e17 100644
--- a/modules/bullet/rigid_body_bullet.h
+++ b/modules/bullet/rigid_body_bullet.h
@@ -184,7 +184,7 @@ private:
KinematicUtilities *kinematic_utilities;
PhysicsServer::BodyMode mode;
- PhysicsServer::BodyAxisLock axis_lock;
+ bool locked_axis[3] = { false, false, false };
GodotMotionState *godotMotionState;
btRigidBody *btBody;
real_t mass;
@@ -269,8 +269,8 @@ public:
void set_applied_torque(const Vector3 &p_torque);
Vector3 get_applied_torque() const;
- void set_axis_lock(PhysicsServer::BodyAxisLock p_lock);
- PhysicsServer::BodyAxisLock get_axis_lock() const;
+ void set_axis_lock(int axis, bool p_lock);
+ bool get_axis_lock() const;
/// Doc:
/// http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Anti_tunneling_by_Motion_Clamping
diff --git a/modules/thekla_unwrap/SCsub b/modules/thekla_unwrap/SCsub
new file mode 100644
index 0000000000..2b1349a15f
--- /dev/null
+++ b/modules/thekla_unwrap/SCsub
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+Import('env')
+Import('env_modules')
+
+env_thekla_unwrap = env_modules.Clone()
+
+# Thirdparty source files
+if env['builtin_thekla_atlas']:
+ thirdparty_dir = "#thirdparty/thekla_atlas/"
+ thirdparty_sources = [
+ "nvcore/Memory.cpp",
+ "nvcore/Debug.cpp",
+ "nvcore/StrLib.cpp",
+ "nvcore/FileSystem.cpp",
+ "nvcore/RadixSort.cpp",
+ "nvmath/Basis.cpp",
+ "nvmath/ConvexHull.cpp",
+ "nvmath/Fitting.cpp",
+ "nvmath/Plane.cpp",
+ "nvmath/ProximityGrid.cpp",
+ "nvmath/Random.cpp",
+ "nvmath/Solver.cpp",
+ "nvmath/Sparse.cpp",
+ "nvmath/TypeSerialization.cpp",
+ "poshlib/posh.c",
+ "nvimage/BitMap.cpp",
+ "nvimage/Image.cpp",
+ "nvmesh/BaseMesh.cpp",
+ "nvmesh/MeshBuilder.cpp",
+ "nvmesh/TriMesh.cpp",
+ "nvmesh/QuadTriMesh.cpp",
+ "nvmesh/MeshTopology.cpp",
+ "nvmesh/halfedge/Edge.cpp",
+ "nvmesh/halfedge/Mesh.cpp",
+ "nvmesh/halfedge/Face.cpp",
+ "nvmesh/halfedge/Vertex.cpp",
+ "nvmesh/geometry/Bounds.cpp",
+ "nvmesh/geometry/Measurements.cpp",
+ "nvmesh/raster/Raster.cpp",
+ "nvmesh/param/Atlas.cpp",
+ "nvmesh/param/AtlasBuilder.cpp",
+ "nvmesh/param/AtlasPacker.cpp",
+ "nvmesh/param/LeastSquaresConformalMap.cpp",
+ "nvmesh/param/OrthogonalProjectionMap.cpp",
+ "nvmesh/param/ParameterizationQuality.cpp",
+ "nvmesh/param/SingleFaceMap.cpp",
+ "nvmesh/param/Util.cpp",
+ "nvmesh/weld/VertexWeld.cpp",
+ "nvmesh/weld/Snap.cpp"
+ ]
+ thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
+
+ env_thekla_unwrap.add_source_files(env.modules_sources, thirdparty_sources)
+ env_thekla_unwrap.Append(CPPPATH=[thirdparty_dir, thirdparty_dir + "/poshlib", thirdparty_dir + "/nvcore", thirdparty_dir + "/nvmesh"])
+
+ # upstream uses c++11
+ env_thekla_unwrap.Append(CXXFLAGS="-std=gnu++11")
+
+ if env["platform"] == 'x11':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_LINUX"])
+ elif env["platform"] == 'osx':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_DARWIN"])
+ elif env["platform"] == 'windows':
+ env_thekla_unwrap.Append(CCFLAGS=["-DNV_OS_WIN32"])
+
+# Godot source files
+env_thekla_unwrap.add_source_files(env.modules_sources, "*.cpp")
diff --git a/modules/thekla_unwrap/config.py b/modules/thekla_unwrap/config.py
new file mode 100644
index 0000000000..b1ce7d4b91
--- /dev/null
+++ b/modules/thekla_unwrap/config.py
@@ -0,0 +1,7 @@
+def can_build(platform):
+ return platform != "android" and platform != "ios"
+
+def configure(env):
+ if not env['tools']:
+ env['builtin_thekla_atlas'] = False
+ env.disabled_modules.append("thekla_unwrap")
diff --git a/modules/thekla_unwrap/register_types.cpp b/modules/thekla_unwrap/register_types.cpp
new file mode 100644
index 0000000000..8a9f8341e8
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.cpp
@@ -0,0 +1,34 @@
+/*************************************************************************/
+/* register_types.cpp */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+#include "register_types.h"
+
+void register_thekla_unwrap_types() {}
+
+void unregister_thekla_unwrap_types() {}
diff --git a/modules/thekla_unwrap/register_types.h b/modules/thekla_unwrap/register_types.h
new file mode 100644
index 0000000000..2bc3d16c64
--- /dev/null
+++ b/modules/thekla_unwrap/register_types.h
@@ -0,0 +1,31 @@
+/*************************************************************************/
+/* register_types.h */
+/*************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/*************************************************************************/
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/*************************************************************************/
+void register_thekla_unwrap_types();
+void unregister_thekla_unwrap_types();