summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/bullet/godot_result_callbacks.cpp22
-rw-r--r--modules/bullet/godot_result_callbacks.h29
-rw-r--r--modules/bullet/space_bullet.cpp204
-rw-r--r--modules/bullet/space_bullet.h8
-rw-r--r--modules/enet/networked_multiplayer_enet.cpp2
-rw-r--r--modules/gdnative/SCsub13
-rw-r--r--modules/gdnative/gdnative.cpp45
-rw-r--r--modules/gdnative/gdnative.h8
-rw-r--r--modules/gdnative/gdnative/aabb.cpp217
-rw-r--r--modules/gdnative/gdnative/gdnative.cpp32
-rw-r--r--modules/gdnative/gdnative/rect3.cpp217
-rw-r--r--modules/gdnative/gdnative/string.cpp5
-rw-r--r--modules/gdnative/gdnative/transform.cpp16
-rw-r--r--modules/gdnative/gdnative/variant.cpp12
-rw-r--r--modules/gdnative/gdnative_api.json161
-rw-r--r--modules/gdnative/include/gdnative/aabb.h117
-rw-r--r--modules/gdnative/include/gdnative/gdnative.h24
-rw-r--r--modules/gdnative/include/gdnative/rect3.h117
-rw-r--r--modules/gdnative/include/gdnative/string.h2
-rw-r--r--modules/gdnative/include/gdnative/transform.h4
-rw-r--r--modules/gdnative/include/gdnative/variant.h8
-rw-r--r--modules/gdnative/register_types.cpp2
-rw-r--r--modules/gdscript/gdscript_functions.cpp2
-rw-r--r--modules/gdscript/gdscript_parser.cpp78
-rw-r--r--modules/gdscript/gdscript_tokenizer.cpp10
-rw-r--r--modules/gridmap/grid_map_editor_plugin.cpp2
-rw-r--r--modules/mono/csharp_script.cpp2
-rw-r--r--modules/mono/editor/bindings_generator.cpp4
-rw-r--r--modules/mono/glue/cs_files/AABB.cs (renamed from modules/mono/glue/cs_files/Rect3.cs)44
-rw-r--r--modules/mono/godotsharp_dirs.cpp12
-rw-r--r--modules/mono/mono_gd/gd_mono_field.cpp8
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp18
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.h8
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.cpp6
-rw-r--r--modules/mono/mono_gd/gd_mono_utils.h4
-rw-r--r--modules/regex/doc_classes/RegExMatch.xml2
-rw-r--r--modules/visual_script/visual_script_builtin_funcs.cpp2
-rw-r--r--modules/visual_script/visual_script_editor.cpp4
38 files changed, 806 insertions, 665 deletions
diff --git a/modules/bullet/godot_result_callbacks.cpp b/modules/bullet/godot_result_callbacks.cpp
index bc60c9cb6b..cbf30c8a2e 100644
--- a/modules/bullet/godot_result_callbacks.cpp
+++ b/modules/bullet/godot_result_callbacks.cpp
@@ -77,7 +77,7 @@ btScalar GodotAllConvexResultCallback::addSingleResult(btCollisionWorld::LocalCo
PhysicsDirectSpaceState::ShapeResult &result = m_results[count];
- result.shape = convexResult.m_localShapeInfo->m_shapePart;
+ result.shape = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
result.rid = gObj->get_self();
result.collider_id = gObj->get_instance_id();
result.collider = 0 == result.collider_id ? NULL : ObjectDB::get_instance(result.collider_id);
@@ -122,7 +122,7 @@ bool GodotClosestConvexResultCallback::needsCollision(btBroadphaseProxy *proxy0)
btScalar GodotClosestConvexResultCallback::addSingleResult(btCollisionWorld::LocalConvexResult &convexResult, bool normalInWorldSpace) {
btScalar res = btCollisionWorld::ClosestConvexResultCallback::addSingleResult(convexResult, normalInWorldSpace);
- m_shapePart = convexResult.m_localShapeInfo->m_shapePart;
+ m_shapeId = convexResult.m_localShapeInfo->m_triangleIndex; // "m_triangleIndex" Is a odd name but contains the compound shape ID
return res;
}
@@ -242,3 +242,21 @@ btScalar GodotRestInfoContactResultCallback::addSingleResult(btManifoldPoint &cp
return cp.getDistance();
}
+
+void GodotDeepPenetrationContactResultCallback::addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorldOnB, btScalar depth) {
+
+ if (depth < 0) {
+ // Has penetration
+ if (m_most_penetrated_distance > depth) {
+
+ bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject();
+
+ m_most_penetrated_distance = depth;
+ m_pointCollisionObject = (isSwapped ? m_body0Wrap : m_body1Wrap)->getCollisionObject();
+ m_other_compound_shape_index = isSwapped ? m_index1 : m_index0;
+ m_pointNormalWorld = isSwapped ? normalOnBInWorld * -1 : normalOnBInWorld;
+ m_pointWorld = isSwapped ? (pointInWorldOnB + normalOnBInWorld * depth) : pointInWorldOnB;
+ m_penetration_distance = depth;
+ }
+ }
+}
diff --git a/modules/bullet/godot_result_callbacks.h b/modules/bullet/godot_result_callbacks.h
index 68dff5b12a..ba5142676b 100644
--- a/modules/bullet/godot_result_callbacks.h
+++ b/modules/bullet/godot_result_callbacks.h
@@ -88,7 +88,7 @@ public:
struct GodotClosestConvexResultCallback : public btCollisionWorld::ClosestConvexResultCallback {
public:
const Set<RID> *m_exclude;
- int m_shapePart;
+ int m_shapeId;
GodotClosestConvexResultCallback(const btVector3 &convexFromWorld, const btVector3 &convexToWorld, const Set<RID> *p_exclude)
: btCollisionWorld::ClosestConvexResultCallback(convexFromWorld, convexToWorld), m_exclude(p_exclude) {}
@@ -149,4 +149,31 @@ public:
virtual btScalar addSingleResult(btManifoldPoint &cp, const btCollisionObjectWrapper *colObj0Wrap, int partId0, int index0, const btCollisionObjectWrapper *colObj1Wrap, int partId1, int index1);
};
+struct GodotDeepPenetrationContactResultCallback : public btManifoldResult {
+ btVector3 m_pointNormalWorld;
+ btVector3 m_pointWorld;
+ btScalar m_penetration_distance;
+ int m_other_compound_shape_index;
+ const btCollisionObject *m_pointCollisionObject;
+
+ btScalar m_most_penetrated_distance;
+
+ GodotDeepPenetrationContactResultCallback(const btCollisionObjectWrapper *body0Wrap, const btCollisionObjectWrapper *body1Wrap)
+ : btManifoldResult(body0Wrap, body1Wrap),
+ m_pointCollisionObject(NULL),
+ m_penetration_distance(0),
+ m_other_compound_shape_index(0),
+ m_most_penetrated_distance(1e20) {}
+
+ void reset() {
+ m_pointCollisionObject = NULL;
+ m_most_penetrated_distance = 1e20;
+ }
+
+ bool hasHit() {
+ return m_pointCollisionObject;
+ }
+
+ virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth);
+};
#endif // GODOT_RESULT_CALLBACKS_H
diff --git a/modules/bullet/space_bullet.cpp b/modules/bullet/space_bullet.cpp
index 9df01aee3e..853906063b 100644
--- a/modules/bullet/space_bullet.cpp
+++ b/modules/bullet/space_bullet.cpp
@@ -115,12 +115,13 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_xform.basis.get_scale(), scale_with_margin);
@@ -147,12 +148,13 @@ int BulletPhysicsDirectSpaceState::intersect_shape(const RID &p_shape, const Tra
bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transform &p_xform, const Vector3 &p_motion, float p_margin, float &p_closest_safe, float &p_closest_unsafe, const Set<RID> &p_exclude, uint32_t p_collision_layer, uint32_t p_object_type_mask, ShapeRestInfo *r_info) {
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *bt_convex_shape = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!bt_convex_shape) {
- bulletdelete(bt_convex_shape);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *bt_convex_shape = static_cast<btConvexShape *>(btShape);
btVector3 bt_motion;
G_TO_B(p_motion, bt_motion);
@@ -174,16 +176,18 @@ bool BulletPhysicsDirectSpaceState::cast_motion(const RID &p_shape, const Transf
space->dynamicsWorld->convexSweepTest(bt_convex_shape, bt_xform_from, bt_xform_to, btResult, 0.002);
if (btResult.hasHit()) {
- if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) {
- B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity);
- }
- CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer());
p_closest_safe = p_closest_unsafe = btResult.m_closestHitFraction;
- B_TO_G(btResult.m_hitPointWorld, r_info->point);
- B_TO_G(btResult.m_hitNormalWorld, r_info->normal);
- r_info->rid = collision_object->get_self();
- r_info->collider_id = collision_object->get_instance_id();
- r_info->shape = btResult.m_shapePart;
+ if (r_info) {
+ if (btCollisionObject::CO_RIGID_BODY == btResult.m_hitCollisionObject->getInternalType()) {
+ B_TO_G(static_cast<const btRigidBody *>(btResult.m_hitCollisionObject)->getVelocityInLocalPoint(btResult.m_hitPointWorld), r_info->linear_velocity);
+ }
+ CollisionObjectBullet *collision_object = static_cast<CollisionObjectBullet *>(btResult.m_hitCollisionObject->getUserPointer());
+ B_TO_G(btResult.m_hitPointWorld, r_info->point);
+ B_TO_G(btResult.m_hitNormalWorld, r_info->normal);
+ r_info->rid = collision_object->get_self();
+ r_info->collider_id = collision_object->get_instance_id();
+ r_info->shape = btResult.m_shapeId;
+ }
}
bulletdelete(bt_convex_shape);
@@ -197,12 +201,13 @@ bool BulletPhysicsDirectSpaceState::collide_shape(RID p_shape, const Transform &
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_shape_xform.basis.get_scale(), scale_with_margin);
@@ -231,12 +236,13 @@ bool BulletPhysicsDirectSpaceState::rest_info(RID p_shape, const Transform &p_sh
ShapeBullet *shape = space->get_physics_server()->get_shape_owner()->get(p_shape);
- btConvexShape *btConvex = dynamic_cast<btConvexShape *>(shape->create_bt_shape());
- if (!btConvex) {
- bulletdelete(btConvex);
+ btCollisionShape *btShape = shape->create_bt_shape();
+ if (!btShape->isConvex()) {
+ bulletdelete(btShape);
ERR_PRINTS("The shape is not a convex shape, then is not supported: shape type: " + itos(shape->get_type()));
return 0;
}
+ btConvexShape *btConvex = static_cast<btConvexShape *>(btShape);
btVector3 scale_with_margin;
G_TO_B(p_shape_xform.basis.get_scale() + Vector3(p_margin, p_margin, p_margin), scale_with_margin);
@@ -777,7 +783,8 @@ void SpaceBullet::check_body_collision() {
void SpaceBullet::update_gravity() {
btVector3 btGravity;
G_TO_B(gravityDirection * gravityMagnitude, btGravity);
- dynamicsWorld->setGravity(btGravity);
+ //dynamicsWorld->setGravity(btGravity);
+ dynamicsWorld->setGravity(btVector3(0, 0, 0));
if (soft_body_world_info) {
soft_body_world_info->m_gravity = btGravity;
}
@@ -877,11 +884,11 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
continue;
}
- btConvexShape *convex_shape_test(dynamic_cast<btConvexShape *>(p_body->get_bt_shape(shIndex)));
- if (!convex_shape_test) {
+ if (!p_body->get_bt_shape(shIndex)->isConvex()) {
// Skip no convex shape
continue;
}
+ btConvexShape *convex_shape_test(static_cast<btConvexShape *>(p_body->get_bt_shape(shIndex)));
btTransform shape_world_from;
G_TO_B(p_body->get_shape_transform(shIndex), shape_world_from);
@@ -910,26 +917,26 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
{ /// Phase three - Recover + contact test with margin
- RecoverResult recover_result;
+ RecoverResult r_recover_result;
- hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &recover_result);
+ hasPenetration = recover_from_penetration(p_body, body_safe_position, recovered_motion, &r_recover_result);
if (r_result) {
B_TO_G(recovered_motion + recover_initial_position, r_result->motion);
if (hasPenetration) {
- const btRigidBody *btRigid = static_cast<const btRigidBody *>(recover_result.other_collision_object);
+ const btRigidBody *btRigid = static_cast<const btRigidBody *>(r_recover_result.other_collision_object);
CollisionObjectBullet *collisionObject = static_cast<CollisionObjectBullet *>(btRigid->getUserPointer());
r_result->remainder = p_motion - r_result->motion; // is the remaining movements
- B_TO_G(recover_result.pointWorld, r_result->collision_point);
- B_TO_G(recover_result.pointNormalWorld, r_result->collision_normal);
- B_TO_G(btRigid->getVelocityInLocalPoint(recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
+ B_TO_G(r_recover_result.pointWorld, r_result->collision_point);
+ B_TO_G(r_recover_result.pointNormalWorld, r_result->collision_normal);
+ B_TO_G(btRigid->getVelocityInLocalPoint(r_recover_result.pointWorld - btRigid->getWorldTransform().getOrigin()), r_result->collider_velocity); // It calculates velocity at point and assign it using special function Bullet_to_Godot
r_result->collider = collisionObject->get_self();
r_result->collider_id = collisionObject->get_instance_id();
- r_result->collider_shape = recover_result.other_compound_shape_index;
- r_result->collision_local_shape = recover_result.local_shape_most_recovered;
+ r_result->collider_shape = r_recover_result.other_compound_shape_index;
+ r_result->collision_local_shape = r_recover_result.local_shape_most_recovered;
//{ /// Add manifold point to manage collisions
// btPersistentManifold* manifold = dynamicsWorld->getDispatcher()->getNewManifold(p_body->getBtBody(), btRigid);
@@ -995,7 +1002,7 @@ public:
}
};
-bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &out_recover_position, RecoverResult *recover_result) {
+bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_body_position, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
RecoverPenetrationBroadPhaseCallback recover_broad_result(p_body->get_bt_collision_object(), p_body->get_collision_layer(), p_body->get_collision_mask());
@@ -1005,9 +1012,6 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
// Broad phase support
btVector3 minAabb, maxAabb;
- // GJK support
- btGjkPairDetector::ClosestPointInput gjk_input;
-
bool penetration = false;
// For each shape
@@ -1022,7 +1026,7 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
body_shape_position = p_body_position * kin_shape.transform;
body_shape_position_recovered = body_shape_position;
- body_shape_position_recovered.getOrigin() += out_recover_position;
+ body_shape_position_recovered.getOrigin() += r_recover_position;
kin_shape.shape->getAabb(body_shape_position_recovered, minAabb, maxAabb);
dynamicsWorld->getBroadphase()->aabbTest(minAabb, maxAabb, recover_broad_result);
@@ -1032,66 +1036,33 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
if (!p_body->get_bt_collision_object()->checkCollideWith(otherObject) || !otherObject->checkCollideWith(p_body->get_bt_collision_object()))
continue;
- if (otherObject->getCollisionShape()->isCompound()) { /// Execute GJK test against all shapes
+ if (otherObject->getCollisionShape()->isCompound()) {
// Each convex shape
btCompoundShape *cs = static_cast<btCompoundShape *>(otherObject->getCollisionShape());
for (int x = cs->getNumChildShapes() - 1; 0 <= x; --x) {
- if (!cs->getChildShape(x)->isConvex())
- continue;
+ if (cs->getChildShape(x)->isConvex()) {
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), otherObject, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) {
- // Initialize GJK input
- gjk_input.m_transformA = body_shape_position;
- gjk_input.m_transformA.getOrigin() += out_recover_position;
- gjk_input.m_transformB = otherObject->getWorldTransform() * cs->getChildTransform(x);
+ penetration = true;
+ }
+ } else {
+ if (RFP_convex_world_test(kin_shape.shape, cs->getChildShape(x), p_body->get_bt_collision_object(), otherObject, kinIndex, x, body_shape_position, otherObject->getWorldTransform() * cs->getChildTransform(x), r_recover_position, r_recover_result)) {
- // Perform GJK test
- btPointCollector result;
- btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(cs->getChildShape(x)), gjk_simplex_solver, gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
- if (0 > result.m_distance) {
- // Has penetration
- out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
- penetration = true;
-
- if (recover_result) {
-
- recover_result->hasPenetration = true;
- recover_result->other_collision_object = otherObject;
- recover_result->other_compound_shape_index = x;
- recover_result->penetration_distance = result.m_distance;
- recover_result->pointNormalWorld = result.m_normalOnBInWorld;
- recover_result->pointWorld = result.m_pointInWorld;
+ penetration = true;
}
}
}
-
} else if (otherObject->getCollisionShape()->isConvex()) { /// Execute GJK test against object shape
+ if (RFP_convex_convex_test(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), otherObject, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) {
- // Initialize GJK input
- gjk_input.m_transformA = body_shape_position;
- gjk_input.m_transformA.getOrigin() += out_recover_position;
- gjk_input.m_transformB = otherObject->getWorldTransform();
-
- // Perform GJK test
- btPointCollector result;
- btGjkPairDetector gjk_pair_detector(kin_shape.shape, static_cast<const btConvexShape *>(otherObject->getCollisionShape()), gjk_simplex_solver, gjk_epa_pen_solver);
- gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
- if (0 > result.m_distance) {
- // Has penetration
- out_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
penetration = true;
+ }
+ } else {
+ if (RFP_convex_world_test(kin_shape.shape, otherObject->getCollisionShape(), p_body->get_bt_collision_object(), otherObject, kinIndex, 0, body_shape_position, otherObject->getWorldTransform(), r_recover_position, r_recover_result)) {
- if (recover_result) {
-
- recover_result->hasPenetration = true;
- recover_result->other_collision_object = otherObject;
- recover_result->other_compound_shape_index = 0;
- recover_result->penetration_distance = result.m_distance;
- recover_result->pointNormalWorld = result.m_normalOnBInWorld;
- recover_result->pointWorld = result.m_pointInWorld;
- }
+ penetration = true;
}
}
}
@@ -1099,3 +1070,70 @@ bool SpaceBullet::recover_from_penetration(RigidBodyBullet *p_body, const btTran
return penetration;
}
+
+bool SpaceBullet::RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
+
+ // Initialize GJK input
+ btGjkPairDetector::ClosestPointInput gjk_input;
+ gjk_input.m_transformA = p_transformA;
+ gjk_input.m_transformA.getOrigin() += r_recover_position;
+ gjk_input.m_transformB = p_transformB;
+
+ // Perform GJK test
+ btPointCollector result;
+ btGjkPairDetector gjk_pair_detector(p_shapeA, p_shapeB, gjk_simplex_solver, gjk_epa_pen_solver);
+ gjk_pair_detector.getClosestPoints(gjk_input, result, 0);
+ if (0 > result.m_distance) {
+ // Has penetration
+ r_recover_position += result.m_normalOnBInWorld * (result.m_distance * -1);
+
+ if (r_recover_result) {
+
+ r_recover_result->hasPenetration = true;
+ r_recover_result->other_collision_object = p_objectB;
+ r_recover_result->other_compound_shape_index = p_shapeId_B;
+ r_recover_result->penetration_distance = result.m_distance;
+ r_recover_result->pointNormalWorld = result.m_normalOnBInWorld;
+ r_recover_result->pointWorld = result.m_pointInWorld;
+ }
+ return true;
+ }
+ return false;
+}
+
+bool SpaceBullet::RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result) {
+
+ /// Contact test
+
+ btTransform p_recovered_transformA(p_transformA);
+ p_recovered_transformA.getOrigin() += r_recover_position;
+
+ btCollisionObjectWrapper obA(NULL, p_shapeA, p_objectA, p_recovered_transformA, -1, p_shapeId_A);
+ btCollisionObjectWrapper obB(NULL, p_shapeB, p_objectB, p_transformB, -1, p_shapeId_B);
+
+ btCollisionAlgorithm *algorithm = dispatcher->findAlgorithm(&obA, &obB, NULL, BT_CLOSEST_POINT_ALGORITHMS);
+ if (algorithm) {
+ GodotDeepPenetrationContactResultCallback contactPointResult(&obA, &obB);
+ //discrete collision detection query
+ algorithm->processCollision(&obA, &obB, dynamicsWorld->getDispatchInfo(), &contactPointResult);
+
+ algorithm->~btCollisionAlgorithm();
+ dispatcher->freeCollisionAlgorithm(algorithm);
+
+ if (contactPointResult.hasHit()) {
+ r_recover_position += contactPointResult.m_pointNormalWorld * (contactPointResult.m_penetration_distance * -1);
+
+ if (r_recover_result) {
+
+ r_recover_result->hasPenetration = true;
+ r_recover_result->other_collision_object = p_objectB;
+ r_recover_result->other_compound_shape_index = p_shapeId_B;
+ r_recover_result->penetration_distance = contactPointResult.m_penetration_distance;
+ r_recover_result->pointNormalWorld = contactPointResult.m_pointNormalWorld;
+ r_recover_result->pointWorld = contactPointResult.m_pointWorld;
+ }
+ return true;
+ }
+ }
+ return false;
+}
diff --git a/modules/bullet/space_bullet.h b/modules/bullet/space_bullet.h
index d9206f8046..9acac9a7d6 100644
--- a/modules/bullet/space_bullet.h
+++ b/modules/bullet/space_bullet.h
@@ -189,6 +189,12 @@ private:
: hasPenetration(false) {}
};
- bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &out_recover_position, RecoverResult *recover_result = NULL);
+ bool recover_from_penetration(RigidBodyBullet *p_body, const btTransform &p_from, btVector3 &r_recover_position, RecoverResult *r_recover_result = NULL);
+ /// This is an API that recover a kinematic object from penetration
+ /// This allow only Convex Convex test and it always use GJK algorithm, With this API we don't benefit of Bullet special accelerated functions
+ bool RFP_convex_convex_test(const btConvexShape *p_shapeA, const btConvexShape *p_shapeB, btCollisionObject *p_objectB, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result);
+ /// This is an API that recover a kinematic object from penetration
+ /// Using this we leave Bullet to select the best algorithm, For example GJK in case we have Convex Convex, or a Bullet accelerated algorithm
+ bool RFP_convex_world_test(const btConvexShape *p_shapeA, const btCollisionShape *p_shapeB, btCollisionObject *p_objectA, btCollisionObject *p_objectB, int p_shapeId_A, int p_shapeId_B, const btTransform &p_transformA, const btTransform &p_transformB, btVector3 &r_recover_position, RecoverResult *r_recover_result);
};
#endif
diff --git a/modules/enet/networked_multiplayer_enet.cpp b/modules/enet/networked_multiplayer_enet.cpp
index c50886ad3c..1e18ec0d18 100644
--- a/modules/enet/networked_multiplayer_enet.cpp
+++ b/modules/enet/networked_multiplayer_enet.cpp
@@ -505,7 +505,7 @@ uint32_t NetworkedMultiplayerENet::_gen_unique_id() const {
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_unix_time(), hash);
hash = hash_djb2_one_32(
- (uint32_t)OS::get_singleton()->get_data_dir().hash64(), hash);
+ (uint32_t)OS::get_singleton()->get_user_data_dir().hash64(), hash);
/*
hash = hash_djb2_one_32(
(uint32_t)OS::get_singleton()->get_unique_id().hash64(), hash );
diff --git a/modules/gdnative/SCsub b/modules/gdnative/SCsub
index 66b8d5cbdd..485bf4b9df 100644
--- a/modules/gdnative/SCsub
+++ b/modules/gdnative/SCsub
@@ -49,19 +49,6 @@ def _build_gdnative_api_struct_header(api):
'extern "C" {',
'#endif',
'',
- 'typedef struct godot_gdnative_api_version {',
- '\tunsigned int major;',
- '\tunsigned int minor;',
- '} godot_gdnative_api_version;',
- '',
- 'typedef struct godot_gdnative_api_struct godot_gdnative_api_struct;',
- '',
- 'struct godot_gdnative_api_struct {',
- '\tunsigned int type;',
- '\tgodot_gdnative_api_version version;',
- '\tconst godot_gdnative_api_struct *next;',
- '};',
- '',
'enum GDNATIVE_API_TYPES {',
'\tGDNATIVE_' + api['core']['type'] + ','
]
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 44d6dffc85..f98a16a5d7 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -64,7 +64,6 @@ void GDNativeLibrary::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_current_library_path"), &GDNativeLibrary::get_current_library_path);
ClassDB::bind_method(D_METHOD("get_current_dependencies"), &GDNativeLibrary::get_current_dependencies);
- ClassDB::bind_method(D_METHOD("is_current_library_statically_linked"), &GDNativeLibrary::is_current_library_statically_linked);
ClassDB::bind_method(D_METHOD("should_load_once"), &GDNativeLibrary::should_load_once);
ClassDB::bind_method(D_METHOD("is_singleton"), &GDNativeLibrary::is_singleton);
@@ -109,6 +108,9 @@ Ref<GDNativeLibrary> GDNative::get_library() {
return library;
}
+extern "C" void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have);
+extern "C" void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what);
+
bool GDNative::initialize() {
if (library.is_null()) {
ERR_PRINT("No library set, can't initialize GDNative object");
@@ -116,7 +118,7 @@ bool GDNative::initialize() {
}
String lib_path = library->get_current_library_path();
- if (lib_path.empty() && !library->is_current_library_statically_linked()) {
+ if (lib_path.empty()) {
ERR_PRINT("No library set for this platform");
return false;
}
@@ -137,7 +139,7 @@ bool GDNative::initialize() {
}
Error err = OS::get_singleton()->open_dynamic_library(path, native_handle);
- if (err != OK && !library->is_current_library_statically_linked()) {
+ if (err != OK) {
return false;
}
@@ -151,8 +153,7 @@ bool GDNative::initialize() {
initialized = false;
if (err || !library_init) {
- if (!library->is_current_library_statically_linked())
- OS::get_singleton()->close_dynamic_library(native_handle);
+ OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
return false;
@@ -168,6 +169,8 @@ bool GDNative::initialize() {
options.core_api_hash = ClassDB::get_api_hash(ClassDB::API_CORE);
options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
+ options.report_version_mismatch = &_gdnative_report_version_mismatch;
+ options.report_loading_error = &_gdnative_report_loading_error;
options.gd_native_library = (godot_object *)(get_library().ptr());
options.active_library_path = (godot_string *)&path;
@@ -369,40 +372,8 @@ RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_or
}
}
- bool is_statically_linked = false;
- {
-
- List<String> static_linking_keys;
- config->get_section_keys("static_linking", &static_linking_keys);
-
- for (List<String>::Element *E = static_linking_keys.front(); E; E = E->next()) {
- String key = E->get();
-
- Vector<String> tags = key.split(".");
-
- bool skip = false;
-
- for (int i = 0; i < tags.size(); i++) {
- bool has_feature = OS::get_singleton()->has_feature(tags[i]);
-
- if (!has_feature) {
- skip = true;
- break;
- }
- }
-
- if (skip) {
- continue;
- }
-
- is_statically_linked = config->get_value("static_linking", key);
- break;
- }
- }
-
lib->current_library_path = entry_lib_path;
lib->current_dependencies = dependency_paths;
- lib->current_library_statically_linked = is_statically_linked;
return lib;
}
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index 061dff9267..052ce1fef1 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -55,7 +55,6 @@ class GDNativeLibrary : public Resource {
String current_library_path;
Vector<String> current_dependencies;
- bool current_library_statically_linked;
bool singleton;
bool load_once;
@@ -75,9 +74,6 @@ public:
_FORCE_INLINE_ Vector<String> get_current_dependencies() const {
return current_dependencies;
}
- _FORCE_INLINE_ bool is_current_library_statically_linked() const {
- return current_library_statically_linked;
- }
// things that are a property of the library itself, not platform specific
_FORCE_INLINE_ bool should_load_once() const {
@@ -103,12 +99,10 @@ public:
static void _bind_methods();
};
-typedef godot_variant (*native_call_cb)(void *, godot_array *);
-
struct GDNativeCallRegistry {
static GDNativeCallRegistry *singleton;
- inline GDNativeCallRegistry *get_singleton() {
+ inline static GDNativeCallRegistry *get_singleton() {
return singleton;
}
diff --git a/modules/gdnative/gdnative/aabb.cpp b/modules/gdnative/gdnative/aabb.cpp
new file mode 100644
index 0000000000..6c89bcdceb
--- /dev/null
+++ b/modules/gdnative/gdnative/aabb.cpp
@@ -0,0 +1,217 @@
+/*************************************************************************/
+/* aabb.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 "gdnative/aabb.h"
+
+#include "core/math/aabb.h"
+#include "core/variant.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
+ const Vector3 *pos = (const Vector3 *)p_pos;
+ const Vector3 *size = (const Vector3 *)p_size;
+ AABB *dest = (AABB *)r_dest;
+ *dest = AABB(*pos, *size);
+}
+
+godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self) {
+ godot_vector3 raw_ret;
+ const AABB *self = (const AABB *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->position;
+ return raw_ret;
+}
+
+void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v) {
+ AABB *self = (AABB *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->position = *v;
+}
+
+godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self) {
+ godot_vector3 raw_ret;
+ const AABB *self = (const AABB *)p_self;
+ Vector3 *ret = (Vector3 *)&raw_ret;
+ *ret = self->size;
+ return raw_ret;
+}
+
+void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v) {
+ AABB *self = (AABB *)p_self;
+ const Vector3 *v = (const Vector3 *)p_v;
+ self->size = *v;
+}
+
+godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self) {
+ godot_string ret;
+ const AABB *self = (const AABB *)p_self;
+ memnew_placement(&ret, String(*self));
+ return ret;
+}
+
+godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_area();
+}
+
+godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->has_no_area();
+}
+
+godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->has_no_surface();
+}
+
+godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ return self->intersects(*with);
+}
+
+godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ return self->encloses(*with);
+}
+
+godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ *((AABB *)&dest) = self->merge(*with);
+ return dest;
+}
+
+godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const AABB *with = (const AABB *)p_with;
+ *((AABB *)&dest) = self->intersection(*with);
+ return dest;
+}
+
+godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane) {
+ const AABB *self = (const AABB *)p_self;
+ const Plane *plane = (const Plane *)p_plane;
+ return self->intersects_plane(*plane);
+}
+
+godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *from = (const Vector3 *)p_from;
+ const Vector3 *to = (const Vector3 *)p_to;
+ return self->intersects_segment(*from, *to);
+}
+
+godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point) {
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *point = (const Vector3 *)p_point;
+ return self->has_point(*point);
+}
+
+godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *dir = (const Vector3 *)p_dir;
+ *((Vector3 *)&dest) = self->get_support(*dir);
+ return dest;
+}
+
+godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ *((Vector3 *)&dest) = self->get_longest_axis();
+ return dest;
+}
+
+godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_longest_axis_index();
+}
+
+godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_longest_axis_size();
+}
+
+godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+ *((Vector3 *)&dest) = self->get_shortest_axis();
+ return dest;
+}
+
+godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_shortest_axis_index();
+}
+
+godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self) {
+ const AABB *self = (const AABB *)p_self;
+ return self->get_shortest_axis_size();
+}
+
+godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+ const Vector3 *to_point = (const Vector3 *)p_to_point;
+ *((AABB *)&dest) = self->expand(*to_point);
+ return dest;
+}
+
+godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by) {
+ godot_aabb dest;
+ const AABB *self = (const AABB *)p_self;
+
+ *((AABB *)&dest) = self->grow(p_by);
+ return dest;
+}
+
+godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx) {
+ godot_vector3 dest;
+ const AABB *self = (const AABB *)p_self;
+
+ *((Vector3 *)&dest) = self->get_endpoint(p_idx);
+ return dest;
+}
+
+godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b) {
+ const AABB *self = (const AABB *)p_self;
+ const AABB *b = (const AABB *)p_b;
+ return *self == *b;
+}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/modules/gdnative/gdnative/gdnative.cpp b/modules/gdnative/gdnative/gdnative.cpp
index 6dfa7ec20b..92a88e354b 100644
--- a/modules/gdnative/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative/gdnative.cpp
@@ -36,6 +36,8 @@
#include "os/os.h"
#include "variant.h"
+#include "modules/gdnative/gdnative.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -113,6 +115,10 @@ godot_dictionary GDAPI godot_get_global_constants() {
}
// System functions
+void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback) {
+ GDNativeCallRegistry::get_singleton()->register_native_call_type(StringName(p_call_type), p_callback);
+}
+
void GDAPI *godot_alloc(int p_bytes) {
return memalloc(p_bytes);
}
@@ -137,6 +143,32 @@ void GDAPI godot_print(const godot_string *p_message) {
print_line(*(String *)p_message);
}
+void _gdnative_report_version_mismatch(const godot_object *p_library, const char *p_ext, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have) {
+ String message = "Error loading GDNative file ";
+ GDNativeLibrary *library = (GDNativeLibrary *)p_library;
+
+ message += library->get_current_library_path() + ": Extension \"" + p_ext + "\" can't be loaded.\n";
+
+ Dictionary versions;
+ versions["have_major"] = p_have.major;
+ versions["have_minor"] = p_have.minor;
+ versions["want_major"] = p_want.major;
+ versions["want_minor"] = p_want.minor;
+
+ message += String("Got version {have_major}.{have_minor} but needs {want_major}.{want_minor}!").format(versions);
+
+ _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr());
+}
+
+void _gdnative_report_loading_error(const godot_object *p_library, const char *p_what) {
+ String message = "Error loading GDNative file ";
+ GDNativeLibrary *library = (GDNativeLibrary *)p_library;
+
+ message += library->get_current_library_path() + ": " + p_what;
+
+ _err_print_error("gdnative_init", library->get_current_library_path().utf8().ptr(), 0, message.utf8().ptr());
+}
+
#ifdef __cplusplus
}
#endif
diff --git a/modules/gdnative/gdnative/rect3.cpp b/modules/gdnative/gdnative/rect3.cpp
deleted file mode 100644
index 8e088743b4..0000000000
--- a/modules/gdnative/gdnative/rect3.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-/*************************************************************************/
-/* rect3.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 "gdnative/rect3.h"
-
-#include "core/math/rect3.h"
-#include "core/variant.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size) {
- const Vector3 *pos = (const Vector3 *)p_pos;
- const Vector3 *size = (const Vector3 *)p_size;
- Rect3 *dest = (Rect3 *)r_dest;
- *dest = Rect3(*pos, *size);
-}
-
-godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self) {
- godot_vector3 raw_ret;
- const Rect3 *self = (const Rect3 *)p_self;
- Vector3 *ret = (Vector3 *)&raw_ret;
- *ret = self->position;
- return raw_ret;
-}
-
-void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v) {
- Rect3 *self = (Rect3 *)p_self;
- const Vector3 *v = (const Vector3 *)p_v;
- self->position = *v;
-}
-
-godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self) {
- godot_vector3 raw_ret;
- const Rect3 *self = (const Rect3 *)p_self;
- Vector3 *ret = (Vector3 *)&raw_ret;
- *ret = self->size;
- return raw_ret;
-}
-
-void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v) {
- Rect3 *self = (Rect3 *)p_self;
- const Vector3 *v = (const Vector3 *)p_v;
- self->size = *v;
-}
-
-godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self) {
- godot_string ret;
- const Rect3 *self = (const Rect3 *)p_self;
- memnew_placement(&ret, String(*self));
- return ret;
-}
-
-godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_area();
-}
-
-godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->has_no_area();
-}
-
-godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->has_no_surface();
-}
-
-godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- return self->intersects(*with);
-}
-
-godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- return self->encloses(*with);
-}
-
-godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- *((Rect3 *)&dest) = self->merge(*with);
- return dest;
-}
-
-godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *with = (const Rect3 *)p_with;
- *((Rect3 *)&dest) = self->intersection(*with);
- return dest;
-}
-
-godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Plane *plane = (const Plane *)p_plane;
- return self->intersects_plane(*plane);
-}
-
-godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *from = (const Vector3 *)p_from;
- const Vector3 *to = (const Vector3 *)p_to;
- return self->intersects_segment(*from, *to);
-}
-
-godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *point = (const Vector3 *)p_point;
- return self->has_point(*point);
-}
-
-godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *dir = (const Vector3 *)p_dir;
- *((Vector3 *)&dest) = self->get_support(*dir);
- return dest;
-}
-
-godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- *((Vector3 *)&dest) = self->get_longest_axis();
- return dest;
-}
-
-godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_longest_axis_index();
-}
-
-godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_longest_axis_size();
-}
-
-godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- *((Vector3 *)&dest) = self->get_shortest_axis();
- return dest;
-}
-
-godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_shortest_axis_index();
-}
-
-godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self) {
- const Rect3 *self = (const Rect3 *)p_self;
- return self->get_shortest_axis_size();
-}
-
-godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
- const Vector3 *to_point = (const Vector3 *)p_to_point;
- *((Rect3 *)&dest) = self->expand(*to_point);
- return dest;
-}
-
-godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by) {
- godot_rect3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
-
- *((Rect3 *)&dest) = self->grow(p_by);
- return dest;
-}
-
-godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx) {
- godot_vector3 dest;
- const Rect3 *self = (const Rect3 *)p_self;
-
- *((Vector3 *)&dest) = self->get_endpoint(p_idx);
- return dest;
-}
-
-godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b) {
- const Rect3 *self = (const Rect3 *)p_self;
- const Rect3 *b = (const Rect3 *)p_b;
- return *self == *b;
-}
-
-#ifdef __cplusplus
-}
-#endif
diff --git a/modules/gdnative/gdnative/string.cpp b/modules/gdnative/gdnative/string.cpp
index 781b8754bd..67a037736c 100644
--- a/modules/gdnative/gdnative/string.cpp
+++ b/modules/gdnative/gdnative/string.cpp
@@ -89,11 +89,6 @@ wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, cons
return self->operator[](p_idx);
}
-const char GDAPI *godot_string_c_str(const godot_string *p_self) {
- const String *self = (const String *)p_self;
- return self->utf8().get_data();
-}
-
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self) {
const String *self = (const String *)p_self;
return self->c_str();
diff --git a/modules/gdnative/gdnative/transform.cpp b/modules/gdnative/gdnative/transform.cpp
index 96b2ec8a7a..b07fcffcb6 100644
--- a/modules/gdnative/gdnative/transform.cpp
+++ b/modules/gdnative/gdnative/transform.cpp
@@ -198,20 +198,20 @@ godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_s
return raw_dest;
}
-godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
- godot_rect3 raw_dest;
- Rect3 *dest = (Rect3 *)&raw_dest;
+godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
+ godot_aabb raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
const Transform *self = (const Transform *)p_self;
- const Rect3 *v = (const Rect3 *)p_v;
+ const AABB *v = (const AABB *)p_v;
*dest = self->xform(*v);
return raw_dest;
}
-godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v) {
- godot_rect3 raw_dest;
- Rect3 *dest = (Rect3 *)&raw_dest;
+godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v) {
+ godot_aabb raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
const Transform *self = (const Transform *)p_self;
- const Rect3 *v = (const Rect3 *)p_v;
+ const AABB *v = (const AABB *)p_v;
*dest = self->xform_inv(*v);
return raw_dest;
}
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 0c31bc643c..6483d19d74 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -118,10 +118,10 @@ void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_qua
memnew_placement_custom(dest, Variant, Variant(*quat));
}
-void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3) {
+void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb) {
Variant *dest = (Variant *)r_dest;
- Rect3 *rect3 = (Rect3 *)p_rect3;
- memnew_placement_custom(dest, Variant, Variant(*rect3));
+ AABB *aabb = (AABB *)p_aabb;
+ memnew_placement_custom(dest, Variant, Variant(*aabb));
}
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis) {
@@ -304,10 +304,10 @@ godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self) {
return raw_dest;
}
-godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self) {
- godot_rect3 raw_dest;
+godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self) {
+ godot_aabb raw_dest;
const Variant *self = (const Variant *)p_self;
- Rect3 *dest = (Rect3 *)&raw_dest;
+ AABB *dest = (AABB *)&raw_dest;
*dest = *self;
return raw_dest;
}
diff --git a/modules/gdnative/gdnative_api.json b/modules/gdnative/gdnative_api.json
index 770fb429c7..007c7955d4 100644
--- a/modules/gdnative/gdnative_api.json
+++ b/modules/gdnative/gdnative_api.json
@@ -3221,209 +3221,209 @@
]
},
{
- "name": "godot_rect3_new",
+ "name": "godot_aabb_new",
"return_type": "void",
"arguments": [
- ["godot_rect3 *", "r_dest"],
+ ["godot_aabb *", "r_dest"],
["const godot_vector3 *", "p_pos"],
["const godot_vector3 *", "p_size"]
]
},
{
- "name": "godot_rect3_get_position",
+ "name": "godot_aabb_get_position",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_set_position",
+ "name": "godot_aabb_set_position",
"return_type": "void",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_v"]
]
},
{
- "name": "godot_rect3_get_size",
+ "name": "godot_aabb_get_size",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_set_size",
+ "name": "godot_aabb_set_size",
"return_type": "void",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_v"]
]
},
{
- "name": "godot_rect3_as_string",
+ "name": "godot_aabb_as_string",
"return_type": "godot_string",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_area",
+ "name": "godot_aabb_get_area",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_has_no_area",
+ "name": "godot_aabb_has_no_area",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_has_no_surface",
+ "name": "godot_aabb_has_no_surface",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_intersects",
+ "name": "godot_aabb_intersects",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_encloses",
+ "name": "godot_aabb_encloses",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_merge",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_merge",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_intersection",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_intersection",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_with"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_with"]
]
},
{
- "name": "godot_rect3_intersects_plane",
+ "name": "godot_aabb_intersects_plane",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_plane *", "p_plane"]
]
},
{
- "name": "godot_rect3_intersects_segment",
+ "name": "godot_aabb_intersects_segment",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_from"],
["const godot_vector3 *", "p_to"]
]
},
{
- "name": "godot_rect3_has_point",
+ "name": "godot_aabb_has_point",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_point"]
]
},
{
- "name": "godot_rect3_get_support",
+ "name": "godot_aabb_get_support",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_dir"]
]
},
{
- "name": "godot_rect3_get_longest_axis",
+ "name": "godot_aabb_get_longest_axis",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_longest_axis_index",
+ "name": "godot_aabb_get_longest_axis_index",
"return_type": "godot_int",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_longest_axis_size",
+ "name": "godot_aabb_get_longest_axis_size",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis",
+ "name": "godot_aabb_get_shortest_axis",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis_index",
+ "name": "godot_aabb_get_shortest_axis_index",
"return_type": "godot_int",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_get_shortest_axis_size",
+ "name": "godot_aabb_get_shortest_axis_size",
"return_type": "godot_real",
"arguments": [
- ["const godot_rect3 *", "p_self"]
+ ["const godot_aabb *", "p_self"]
]
},
{
- "name": "godot_rect3_expand",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_expand",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_vector3 *", "p_to_point"]
]
},
{
- "name": "godot_rect3_grow",
- "return_type": "godot_rect3",
+ "name": "godot_aabb_grow",
+ "return_type": "godot_aabb",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_real", "p_by"]
]
},
{
- "name": "godot_rect3_get_endpoint",
+ "name": "godot_aabb_get_endpoint",
"return_type": "godot_vector3",
"arguments": [
- ["const godot_rect3 *", "p_self"],
+ ["const godot_aabb *", "p_self"],
["const godot_int", "p_idx"]
]
},
{
- "name": "godot_rect3_operator_equal",
+ "name": "godot_aabb_operator_equal",
"return_type": "godot_bool",
"arguments": [
- ["const godot_rect3 *", "p_self"],
- ["const godot_rect3 *", "p_b"]
+ ["const godot_aabb *", "p_self"],
+ ["const godot_aabb *", "p_b"]
]
},
{
@@ -3632,19 +3632,19 @@
]
},
{
- "name": "godot_transform_xform_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_transform_xform_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_transform *", "p_self"],
- ["const godot_rect3 *", "p_v"]
+ ["const godot_aabb *", "p_v"]
]
},
{
- "name": "godot_transform_xform_inv_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_transform_xform_inv_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_transform *", "p_self"],
- ["const godot_rect3 *", "p_v"]
+ ["const godot_aabb *", "p_v"]
]
},
{
@@ -3930,11 +3930,11 @@
]
},
{
- "name": "godot_variant_new_rect3",
+ "name": "godot_variant_new_aabb",
"return_type": "void",
"arguments": [
["godot_variant *", "r_dest"],
- ["const godot_rect3 *", "p_rect3"]
+ ["const godot_aabb *", "p_aabb"]
]
},
{
@@ -4135,8 +4135,8 @@
]
},
{
- "name": "godot_variant_as_rect3",
- "return_type": "godot_rect3",
+ "name": "godot_variant_as_aabb",
+ "return_type": "godot_aabb",
"arguments": [
["const godot_variant *", "p_self"]
]
@@ -4362,13 +4362,6 @@
]
},
{
- "name": "godot_string_c_str",
- "return_type": "const char *",
- "arguments": [
- ["const godot_string *", "p_self"]
- ]
- },
- {
"name": "godot_string_unicode_str",
"return_type": "const wchar_t *",
"arguments": [
@@ -5556,6 +5549,14 @@
]
},
{
+ "name": "godot_register_native_call_type",
+ "return_type": "void",
+ "arguments": [
+ ["const char *", "call_type"],
+ ["native_call_cb", "p_callback"]
+ ]
+ },
+ {
"name": "godot_alloc",
"return_type": "void *",
"arguments": [
diff --git a/modules/gdnative/include/gdnative/aabb.h b/modules/gdnative/include/gdnative/aabb.h
new file mode 100644
index 0000000000..34339fa242
--- /dev/null
+++ b/modules/gdnative/include/gdnative/aabb.h
@@ -0,0 +1,117 @@
+/*************************************************************************/
+/* aabb.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. */
+/*************************************************************************/
+#ifndef GODOT_AABB_H
+#define GODOT_AABB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#define GODOT_AABB_SIZE 24
+
+#ifndef GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
+#define GODOT_CORE_API_GODOT_AABB_TYPE_DEFINED
+typedef struct {
+ uint8_t _dont_touch_that[GODOT_AABB_SIZE];
+} godot_aabb;
+#endif
+
+// reduce extern "C" nesting for VS2013
+#ifdef __cplusplus
+}
+#endif
+
+#include <gdnative/gdnative.h>
+#include <gdnative/plane.h>
+#include <gdnative/vector3.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void GDAPI godot_aabb_new(godot_aabb *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
+
+godot_vector3 GDAPI godot_aabb_get_position(const godot_aabb *p_self);
+void GDAPI godot_aabb_set_position(const godot_aabb *p_self, const godot_vector3 *p_v);
+
+godot_vector3 GDAPI godot_aabb_get_size(const godot_aabb *p_self);
+void GDAPI godot_aabb_set_size(const godot_aabb *p_self, const godot_vector3 *p_v);
+
+godot_string GDAPI godot_aabb_as_string(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_area(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_has_no_area(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_has_no_surface(const godot_aabb *p_self);
+
+godot_bool GDAPI godot_aabb_intersects(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_bool GDAPI godot_aabb_encloses(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_aabb GDAPI godot_aabb_merge(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_aabb GDAPI godot_aabb_intersection(const godot_aabb *p_self, const godot_aabb *p_with);
+
+godot_bool GDAPI godot_aabb_intersects_plane(const godot_aabb *p_self, const godot_plane *p_plane);
+
+godot_bool GDAPI godot_aabb_intersects_segment(const godot_aabb *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
+
+godot_bool GDAPI godot_aabb_has_point(const godot_aabb *p_self, const godot_vector3 *p_point);
+
+godot_vector3 GDAPI godot_aabb_get_support(const godot_aabb *p_self, const godot_vector3 *p_dir);
+
+godot_vector3 GDAPI godot_aabb_get_longest_axis(const godot_aabb *p_self);
+
+godot_int GDAPI godot_aabb_get_longest_axis_index(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_longest_axis_size(const godot_aabb *p_self);
+
+godot_vector3 GDAPI godot_aabb_get_shortest_axis(const godot_aabb *p_self);
+
+godot_int GDAPI godot_aabb_get_shortest_axis_index(const godot_aabb *p_self);
+
+godot_real GDAPI godot_aabb_get_shortest_axis_size(const godot_aabb *p_self);
+
+godot_aabb GDAPI godot_aabb_expand(const godot_aabb *p_self, const godot_vector3 *p_to_point);
+
+godot_aabb GDAPI godot_aabb_grow(const godot_aabb *p_self, const godot_real p_by);
+
+godot_vector3 GDAPI godot_aabb_get_endpoint(const godot_aabb *p_self, const godot_int p_idx);
+
+godot_bool GDAPI godot_aabb_operator_equal(const godot_aabb *p_self, const godot_aabb *p_b);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // GODOT_AABB_H
diff --git a/modules/gdnative/include/gdnative/gdnative.h b/modules/gdnative/include/gdnative/gdnative.h
index a479eced16..0a884e6106 100644
--- a/modules/gdnative/include/gdnative/gdnative.h
+++ b/modules/gdnative/include/gdnative/gdnative.h
@@ -169,9 +169,9 @@ typedef void godot_object;
#include <gdnative/quat.h>
-/////// Rect3
+/////// AABB
-#include <gdnative/rect3.h>
+#include <gdnative/aabb.h>
/////// Basis
@@ -229,13 +229,28 @@ void GDAPI godot_method_bind_ptrcall(godot_method_bind *p_method_bind, godot_obj
godot_variant GDAPI godot_method_bind_call(godot_method_bind *p_method_bind, godot_object *p_instance, const godot_variant **p_args, const int p_arg_count, godot_variant_call_error *p_call_error);
////// Script API
-struct godot_gdnative_api_struct; // Forward declaration
+typedef struct godot_gdnative_api_version {
+ unsigned int major;
+ unsigned int minor;
+} godot_gdnative_api_version;
+
+typedef struct godot_gdnative_api_struct godot_gdnative_api_struct;
+
+struct godot_gdnative_api_struct {
+ unsigned int type;
+ godot_gdnative_api_version version;
+ const godot_gdnative_api_struct *next;
+};
+
+#define GDNATIVE_VERSION_COMPATIBLE(want, have) (want.major == have.major && want.minor <= have.minor)
typedef struct {
godot_bool in_editor;
uint64_t core_api_hash;
uint64_t editor_api_hash;
uint64_t no_api_hash;
+ void (*report_version_mismatch)(const godot_object *p_library, const char *p_what, godot_gdnative_api_version p_want, godot_gdnative_api_version p_have);
+ void (*report_loading_error)(const godot_object *p_library, const char *p_what);
godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized
const struct godot_gdnative_core_api_struct *api_struct;
const godot_string *active_library_path;
@@ -259,6 +274,9 @@ typedef godot_variant (*godot_gdnative_procedure_fn)(godot_array *);
////// System Functions
+typedef godot_variant (*native_call_cb)(void *, godot_array *);
+void GDAPI godot_register_native_call_type(const char *p_call_type, native_call_cb p_callback);
+
//using these will help Godot track how much memory is in use in debug mode
void GDAPI *godot_alloc(int p_bytes);
void GDAPI *godot_realloc(void *p_ptr, int p_bytes);
diff --git a/modules/gdnative/include/gdnative/rect3.h b/modules/gdnative/include/gdnative/rect3.h
deleted file mode 100644
index f603a9268a..0000000000
--- a/modules/gdnative/include/gdnative/rect3.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*************************************************************************/
-/* rect3.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. */
-/*************************************************************************/
-#ifndef GODOT_RECT3_H
-#define GODOT_RECT3_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-
-#define GODOT_RECT3_SIZE 24
-
-#ifndef GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
-#define GODOT_CORE_API_GODOT_RECT3_TYPE_DEFINED
-typedef struct {
- uint8_t _dont_touch_that[GODOT_RECT3_SIZE];
-} godot_rect3;
-#endif
-
-// reduce extern "C" nesting for VS2013
-#ifdef __cplusplus
-}
-#endif
-
-#include <gdnative/gdnative.h>
-#include <gdnative/plane.h>
-#include <gdnative/vector3.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-void GDAPI godot_rect3_new(godot_rect3 *r_dest, const godot_vector3 *p_pos, const godot_vector3 *p_size);
-
-godot_vector3 GDAPI godot_rect3_get_position(const godot_rect3 *p_self);
-void GDAPI godot_rect3_set_position(const godot_rect3 *p_self, const godot_vector3 *p_v);
-
-godot_vector3 GDAPI godot_rect3_get_size(const godot_rect3 *p_self);
-void GDAPI godot_rect3_set_size(const godot_rect3 *p_self, const godot_vector3 *p_v);
-
-godot_string GDAPI godot_rect3_as_string(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_area(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_has_no_area(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_has_no_surface(const godot_rect3 *p_self);
-
-godot_bool GDAPI godot_rect3_intersects(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_bool GDAPI godot_rect3_encloses(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_rect3 GDAPI godot_rect3_merge(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_rect3 GDAPI godot_rect3_intersection(const godot_rect3 *p_self, const godot_rect3 *p_with);
-
-godot_bool GDAPI godot_rect3_intersects_plane(const godot_rect3 *p_self, const godot_plane *p_plane);
-
-godot_bool GDAPI godot_rect3_intersects_segment(const godot_rect3 *p_self, const godot_vector3 *p_from, const godot_vector3 *p_to);
-
-godot_bool GDAPI godot_rect3_has_point(const godot_rect3 *p_self, const godot_vector3 *p_point);
-
-godot_vector3 GDAPI godot_rect3_get_support(const godot_rect3 *p_self, const godot_vector3 *p_dir);
-
-godot_vector3 GDAPI godot_rect3_get_longest_axis(const godot_rect3 *p_self);
-
-godot_int GDAPI godot_rect3_get_longest_axis_index(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_longest_axis_size(const godot_rect3 *p_self);
-
-godot_vector3 GDAPI godot_rect3_get_shortest_axis(const godot_rect3 *p_self);
-
-godot_int GDAPI godot_rect3_get_shortest_axis_index(const godot_rect3 *p_self);
-
-godot_real GDAPI godot_rect3_get_shortest_axis_size(const godot_rect3 *p_self);
-
-godot_rect3 GDAPI godot_rect3_expand(const godot_rect3 *p_self, const godot_vector3 *p_to_point);
-
-godot_rect3 GDAPI godot_rect3_grow(const godot_rect3 *p_self, const godot_real p_by);
-
-godot_vector3 GDAPI godot_rect3_get_endpoint(const godot_rect3 *p_self, const godot_int p_idx);
-
-godot_bool GDAPI godot_rect3_operator_equal(const godot_rect3 *p_self, const godot_rect3 *p_b);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif // GODOT_RECT3_H
diff --git a/modules/gdnative/include/gdnative/string.h b/modules/gdnative/include/gdnative/string.h
index 29510313c9..10358ceade 100644
--- a/modules/gdnative/include/gdnative/string.h
+++ b/modules/gdnative/include/gdnative/string.h
@@ -51,6 +51,7 @@ typedef struct {
}
#endif
+#include <gdnative/array.h>
#include <gdnative/gdnative.h>
#include <gdnative/variant.h>
@@ -67,7 +68,6 @@ void GDAPI godot_string_get_data(const godot_string *p_self, char *p_dest, int *
wchar_t GDAPI *godot_string_operator_index(godot_string *p_self, const godot_int p_idx);
wchar_t GDAPI godot_string_operator_index_const(const godot_string *p_self, const godot_int p_idx);
-const char GDAPI *godot_string_c_str(const godot_string *p_self);
const wchar_t GDAPI *godot_string_unicode_str(const godot_string *p_self);
godot_bool GDAPI godot_string_operator_equal(const godot_string *p_self, const godot_string *p_b);
diff --git a/modules/gdnative/include/gdnative/transform.h b/modules/gdnative/include/gdnative/transform.h
index 8f50b01fb5..3b5c189bdf 100644
--- a/modules/gdnative/include/gdnative/transform.h
+++ b/modules/gdnative/include/gdnative/transform.h
@@ -98,9 +98,9 @@ godot_vector3 GDAPI godot_transform_xform_vector3(const godot_transform *p_self,
godot_vector3 GDAPI godot_transform_xform_inv_vector3(const godot_transform *p_self, const godot_vector3 *p_v);
-godot_rect3 GDAPI godot_transform_xform_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
+godot_aabb GDAPI godot_transform_xform_aabb(const godot_transform *p_self, const godot_aabb *p_v);
-godot_rect3 GDAPI godot_transform_xform_inv_rect3(const godot_transform *p_self, const godot_rect3 *p_v);
+godot_aabb GDAPI godot_transform_xform_inv_aabb(const godot_transform *p_self, const godot_aabb *p_v);
#ifdef __cplusplus
}
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 3d744ef1f2..06cafcfa63 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -62,7 +62,7 @@ typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_TRANSFORM2D,
GODOT_VARIANT_TYPE_PLANE,
GODOT_VARIANT_TYPE_QUAT, // 10
- GODOT_VARIANT_TYPE_RECT3,
+ GODOT_VARIANT_TYPE_AABB,
GODOT_VARIANT_TYPE_BASIS,
GODOT_VARIANT_TYPE_TRANSFORM,
@@ -104,6 +104,7 @@ typedef struct godot_variant_call_error {
}
#endif
+#include <gdnative/aabb.h>
#include <gdnative/array.h>
#include <gdnative/basis.h>
#include <gdnative/color.h>
@@ -113,7 +114,6 @@ typedef struct godot_variant_call_error {
#include <gdnative/pool_arrays.h>
#include <gdnative/quat.h>
#include <gdnative/rect2.h>
-#include <gdnative/rect3.h>
#include <gdnative/rid.h>
#include <gdnative/string.h>
#include <gdnative/transform.h>
@@ -145,7 +145,7 @@ void GDAPI godot_variant_new_vector3(godot_variant *r_dest, const godot_vector3
void GDAPI godot_variant_new_transform2d(godot_variant *r_dest, const godot_transform2d *p_t2d);
void GDAPI godot_variant_new_plane(godot_variant *r_dest, const godot_plane *p_plane);
void GDAPI godot_variant_new_quat(godot_variant *r_dest, const godot_quat *p_quat);
-void GDAPI godot_variant_new_rect3(godot_variant *r_dest, const godot_rect3 *p_rect3);
+void GDAPI godot_variant_new_aabb(godot_variant *r_dest, const godot_aabb *p_aabb);
void GDAPI godot_variant_new_basis(godot_variant *r_dest, const godot_basis *p_basis);
void GDAPI godot_variant_new_transform(godot_variant *r_dest, const godot_transform *p_trans);
void GDAPI godot_variant_new_color(godot_variant *r_dest, const godot_color *p_color);
@@ -173,7 +173,7 @@ godot_vector3 GDAPI godot_variant_as_vector3(const godot_variant *p_self);
godot_transform2d GDAPI godot_variant_as_transform2d(const godot_variant *p_self);
godot_plane GDAPI godot_variant_as_plane(const godot_variant *p_self);
godot_quat GDAPI godot_variant_as_quat(const godot_variant *p_self);
-godot_rect3 GDAPI godot_variant_as_rect3(const godot_variant *p_self);
+godot_aabb GDAPI godot_variant_as_aabb(const godot_variant *p_self);
godot_basis GDAPI godot_variant_as_basis(const godot_variant *p_self);
godot_transform GDAPI godot_variant_as_transform(const godot_variant *p_self);
godot_color GDAPI godot_variant_as_color(const godot_variant *p_self);
diff --git a/modules/gdnative/register_types.cpp b/modules/gdnative/register_types.cpp
index 29b0a6719c..8af643df50 100644
--- a/modules/gdnative/register_types.cpp
+++ b/modules/gdnative/register_types.cpp
@@ -371,7 +371,7 @@ void unregister_gdnative_types() {
print_line(String("poolarray:\t") + itos(sizeof(PoolByteArray)));
print_line(String("quat:\t") + itos(sizeof(Quat)));
print_line(String("rect2:\t") + itos(sizeof(Rect2)));
- print_line(String("rect3:\t") + itos(sizeof(Rect3)));
+ print_line(String("aabb:\t") + itos(sizeof(AABB)));
print_line(String("rid:\t") + itos(sizeof(RID)));
print_line(String("string:\t") + itos(sizeof(String)));
print_line(String("transform:\t") + itos(sizeof(Transform)));
diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp
index 467dbf3e56..c6066ceefb 100644
--- a/modules/gdscript/gdscript_functions.cpp
+++ b/modules/gdscript/gdscript_functions.cpp
@@ -642,7 +642,7 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
}
//str+="\n";
- OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+ print_error(str);
r_ret = Variant();
} break;
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 29b9865b1d..1e677f11c4 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -3758,22 +3758,82 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
current_export.hint = PROPERTY_HINT_NONE;
}
- } else if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER) {
+ } else {
- String identifier = tokenizer->get_token_identifier();
- if (!ClassDB::is_parent_class(identifier, "Resource")) {
+ parenthesis++;
+ Node *subexpr = _parse_and_reduce_expression(p_class, true, true);
+ if (!subexpr) {
+ if (_recover_from_completion()) {
+ break;
+ }
+ return;
+ }
+ parenthesis--;
+ if (subexpr->type != Node::TYPE_CONSTANT) {
current_export = PropertyInfo();
- _set_error("Export hint not a type or resource.");
+ _set_error("Expected a constant expression.");
}
- current_export.type = Variant::OBJECT;
- current_export.hint = PROPERTY_HINT_RESOURCE_TYPE;
- current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
+ Variant constant = static_cast<ConstantNode *>(subexpr)->value;
- current_export.hint_string = identifier;
+ if (constant.get_type() == Variant::OBJECT) {
+ GDScriptNativeClass *native_class = Object::cast_to<GDScriptNativeClass>(constant);
- tokenizer->advance();
+ if (native_class && ClassDB::is_parent_class(native_class->get_name(), "Resource")) {
+ current_export.type = Variant::OBJECT;
+ current_export.hint = PROPERTY_HINT_RESOURCE_TYPE;
+ current_export.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE;
+
+ current_export.hint_string = native_class->get_name();
+
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Export hint not a resource type.");
+ }
+ } else if (constant.get_type() == Variant::DICTIONARY) {
+ // Enumeration
+ bool is_flags = false;
+
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_COMMA) {
+ tokenizer->advance();
+
+ if (tokenizer->get_token() == GDScriptTokenizer::TK_IDENTIFIER && tokenizer->get_token_identifier() == "FLAGS") {
+ is_flags = true;
+ tokenizer->advance();
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Expected 'FLAGS' after comma.");
+ }
+ }
+
+ current_export.type = Variant::INT;
+ current_export.hint = is_flags ? PROPERTY_HINT_FLAGS : PROPERTY_HINT_ENUM;
+ Dictionary enum_values = constant;
+
+ List<Variant> keys;
+ enum_values.get_key_list(&keys);
+
+ bool first = true;
+ for (List<Variant>::Element *E = keys.front(); E; E = E->next()) {
+ if (enum_values[E->get()].get_type() == Variant::INT) {
+ if (!first)
+ current_export.hint_string += ",";
+ else
+ first = false;
+
+ current_export.hint_string += E->get().operator String().camelcase_to_underscore(true).capitalize().xml_escape();
+ if (!is_flags) {
+ current_export.hint_string += ":";
+ current_export.hint_string += enum_values[E->get()].operator String().xml_escape();
+ }
+ }
+ }
+ } else {
+ current_export = PropertyInfo();
+ _set_error("Expected type for export.");
+ return;
+ }
}
if (tokenizer->get_token() != GDScriptTokenizer::TK_PARENTHESIS_CLOSE) {
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp
index 174bb02967..e3a0af8ee6 100644
--- a/modules/gdscript/gdscript_tokenizer.cpp
+++ b/modules/gdscript/gdscript_tokenizer.cpp
@@ -148,7 +148,7 @@ static const _bit _type_list[] = {
{ Variant::RECT2, "Rect2" },
{ Variant::TRANSFORM2D, "Transform2D" },
{ Variant::VECTOR3, "Vector3" },
- { Variant::RECT3, "Rect3" },
+ { Variant::AABB, "AABB" },
{ Variant::PLANE, "Plane" },
{ Variant::QUAT, "Quat" },
{ Variant::BASIS, "Basis" },
@@ -253,9 +253,9 @@ bool GDScriptTokenizer::is_token_literal(int p_offset, bool variable_safe) const
case TK_BUILT_IN_FUNC:
case TK_OP_IN:
- //case TK_OP_NOT:
- //case TK_OP_OR:
- //case TK_OP_AND:
+ //case TK_OP_NOT:
+ //case TK_OP_OR:
+ //case TK_OP_AND:
case TK_PR_CLASS:
case TK_PR_CONST:
@@ -1125,7 +1125,7 @@ void GDScriptTokenizerText::advance(int p_amount) {
_advance();
}
-//////////////////////////////////////////////////////////////////////////////////////////////////////
+ //////////////////////////////////////////////////////////////////////////////////////////////////////
#define BYTECODE_VERSION 12
diff --git a/modules/gridmap/grid_map_editor_plugin.cpp b/modules/gridmap/grid_map_editor_plugin.cpp
index bceb2b7db7..491adb31ee 100644
--- a/modules/gridmap/grid_map_editor_plugin.cpp
+++ b/modules/gridmap/grid_map_editor_plugin.cpp
@@ -1137,7 +1137,7 @@ GridMapEditor::GridMapEditor(EditorNode *p_editor) {
for (int i = 0; i < 12; i++) {
- Rect3 base(Vector3(0, 0, 0), Vector3(1, 1, 1));
+ AABB base(Vector3(0, 0, 0), Vector3(1, 1, 1));
Vector3 a, b;
base.get_edge(i, a, b);
lines.push_back(a);
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index 161e130a07..dfa5e720ae 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -346,7 +346,7 @@ static String variant_type_to_managed_name(const String &p_var_type_name) {
Variant::TRANSFORM2D,
Variant::PLANE,
Variant::QUAT,
- Variant::RECT3,
+ Variant::AABB,
Variant::BASIS,
Variant::TRANSFORM,
Variant::COLOR,
diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp
index a293cc2c50..59a2b73dbc 100644
--- a/modules/mono/editor/bindings_generator.cpp
+++ b/modules/mono/editor/bindings_generator.cpp
@@ -1721,7 +1721,7 @@ void BindingsGenerator::_default_argument_from_variant(const Variant &p_val, Arg
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
break;
case Variant::PLANE:
- case Variant::RECT3:
+ case Variant::AABB:
case Variant::COLOR:
r_iarg.default_argument = "new Color(1, 1, 1, 1)";
r_iarg.def_param_mode = ArgumentInterface::NULLABLE_VAL;
@@ -1793,7 +1793,7 @@ void BindingsGenerator::_populate_builtin_type_interfaces() {
INSERT_STRUCT_TYPE(Basis, "real_t*")
INSERT_STRUCT_TYPE(Quat, "real_t*")
INSERT_STRUCT_TYPE(Transform, "real_t*")
- INSERT_STRUCT_TYPE(Rect3, "real_t*")
+ INSERT_STRUCT_TYPE(AABB, "real_t*")
INSERT_STRUCT_TYPE(Color, "real_t*")
INSERT_STRUCT_TYPE(Plane, "real_t*")
diff --git a/modules/mono/glue/cs_files/Rect3.cs b/modules/mono/glue/cs_files/AABB.cs
index 617d33e7fd..6ee3bbe53a 100644
--- a/modules/mono/glue/cs_files/Rect3.cs
+++ b/modules/mono/glue/cs_files/AABB.cs
@@ -1,15 +1,15 @@
using System;
-// file: core/math/rect3.h
+// file: core/math/aabb.h
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
-// file: core/math/rect3.cpp
+// file: core/math/aabb.cpp
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
namespace Godot
{
- public struct Rect3 : IEquatable<Rect3>
+ public struct AABB : IEquatable<AABB>
{
private Vector3 position;
private Vector3 size;
@@ -38,7 +38,7 @@ namespace Godot
}
}
- public bool encloses(Rect3 with)
+ public bool encloses(AABB with)
{
Vector3 src_min = position;
Vector3 src_max = position + size;
@@ -53,7 +53,7 @@ namespace Godot
(src_max.z > dst_max.z));
}
- public Rect3 expand(Vector3 to_point)
+ public AABB expand(Vector3 to_point)
{
Vector3 begin = position;
Vector3 end = position + size;
@@ -72,7 +72,7 @@ namespace Godot
if (to_point.z > end.z)
end.z = to_point.z;
- return new Rect3(begin, end - begin);
+ return new AABB(begin, end - begin);
}
public float get_area()
@@ -222,9 +222,9 @@ namespace Godot
(dir.z > 0f) ? -half_extents.z : half_extents.z);
}
- public Rect3 grow(float by)
+ public AABB grow(float by)
{
- Rect3 res = this;
+ AABB res = this;
res.position.x -= by;
res.position.y -= by;
@@ -264,7 +264,7 @@ namespace Godot
return true;
}
- public Rect3 intersection(Rect3 with)
+ public AABB intersection(AABB with)
{
Vector3 src_min = position;
Vector3 src_max = position + size;
@@ -275,7 +275,7 @@ namespace Godot
if (src_min.x > dst_max.x || src_max.x < dst_min.x)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -285,7 +285,7 @@ namespace Godot
if (src_min.y > dst_max.y || src_max.y < dst_min.y)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -295,7 +295,7 @@ namespace Godot
if (src_min.z > dst_max.z || src_max.z < dst_min.z)
{
- return new Rect3();
+ return new AABB();
}
else
{
@@ -303,10 +303,10 @@ namespace Godot
max.z = (src_max.z < dst_max.z) ? src_max.z : dst_max.z;
}
- return new Rect3(min, max - min);
+ return new AABB(min, max - min);
}
- public bool intersects(Rect3 with)
+ public bool intersects(AABB with)
{
if (position.x >= (with.position.x + with.size.x))
return false;
@@ -398,7 +398,7 @@ namespace Godot
return true;
}
- public Rect3 merge(Rect3 with)
+ public AABB merge(AABB with)
{
Vector3 beg_1 = position;
Vector3 beg_2 = with.position;
@@ -417,36 +417,36 @@ namespace Godot
(end_1.z > end_2.z) ? end_1.z : end_2.z
);
- return new Rect3(min, max - min);
+ return new AABB(min, max - min);
}
- public Rect3(Vector3 position, Vector3 size)
+ public AABB(Vector3 position, Vector3 size)
{
this.position = position;
this.size = size;
}
- public static bool operator ==(Rect3 left, Rect3 right)
+ public static bool operator ==(AABB left, AABB right)
{
return left.Equals(right);
}
- public static bool operator !=(Rect3 left, Rect3 right)
+ public static bool operator !=(AABB left, AABB right)
{
return !left.Equals(right);
}
public override bool Equals(object obj)
{
- if (obj is Rect3)
+ if (obj is AABB)
{
- return Equals((Rect3)obj);
+ return Equals((AABB)obj);
}
return false;
}
- public bool Equals(Rect3 other)
+ public bool Equals(AABB other)
{
return position == other.position && size == other.size;
}
diff --git a/modules/mono/godotsharp_dirs.cpp b/modules/mono/godotsharp_dirs.cpp
index 7cc2168b70..a0c2508b0d 100644
--- a/modules/mono/godotsharp_dirs.cpp
+++ b/modules/mono/godotsharp_dirs.cpp
@@ -57,7 +57,7 @@ String _get_expected_build_config() {
String _get_mono_user_dir() {
#ifdef TOOLS_ENABLED
if (EditorSettings::get_singleton()) {
- return EditorSettings::get_singleton()->get_settings_path().plus_file("mono");
+ return EditorSettings::get_singleton()->get_data_dir().plus_file("mono");
} else {
String settings_path;
@@ -68,19 +68,13 @@ String _get_mono_user_dir() {
// contain yourself
settings_path = exe_dir.plus_file("editor_data");
} else {
- if (OS::get_singleton()->has_environment("APPDATA")) {
- String app_data = OS::get_singleton()->get_environment("APPDATA").replace("\\", "/");
- settings_path = app_data.plus_file(String(_MKSTR(VERSION_SHORT_NAME)).capitalize());
- } else if (OS::get_singleton()->has_environment("HOME")) {
- String home = OS::get_singleton()->get_environment("HOME");
- settings_path = home.plus_file("." + String(_MKSTR(VERSION_SHORT_NAME)).to_lower());
- }
+ settings_path = OS::get_singleton()->get_data_path().plus_file(OS::get_singleton()->get_godot_dir_name());
}
return settings_path.plus_file("mono");
}
#else
- return OS::get_singleton()->get_data_dir().plus_file("mono");
+ return OS::get_singleton()->get_user_data_dir().plus_file("mono");
#endif
}
diff --git a/modules/mono/mono_gd/gd_mono_field.cpp b/modules/mono/mono_gd/gd_mono_field.cpp
index 1643f8cfc5..eb34f9dd3f 100644
--- a/modules/mono/mono_gd/gd_mono_field.cpp
+++ b/modules/mono/mono_gd/gd_mono_field.cpp
@@ -41,7 +41,7 @@ void GDMonoField::set_value_raw(MonoObject *p_object, void *p_ptr) {
void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
#define SET_FROM_STRUCT_AND_BREAK(m_type) \
{ \
- const m_type &val = p_value.operator m_type(); \
+ const m_type &val = p_value.operator ::m_type(); \
MARSHALLED_OUT(m_type, val, raw); \
mono_field_set_value(p_object, mono_field, raw); \
break; \
@@ -129,8 +129,8 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
if (tclass == CACHED_CLASS(Transform))
SET_FROM_STRUCT_AND_BREAK(Transform);
- if (tclass == CACHED_CLASS(Rect3))
- SET_FROM_STRUCT_AND_BREAK(Rect3);
+ if (tclass == CACHED_CLASS(AABB))
+ SET_FROM_STRUCT_AND_BREAK(AABB);
if (tclass == CACHED_CLASS(Color))
SET_FROM_STRUCT_AND_BREAK(Color);
@@ -229,7 +229,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
case Variant::TRANSFORM2D: SET_FROM_STRUCT_AND_BREAK(Transform2D);
case Variant::PLANE: SET_FROM_STRUCT_AND_BREAK(Plane);
case Variant::QUAT: SET_FROM_STRUCT_AND_BREAK(Quat);
- case Variant::RECT3: SET_FROM_STRUCT_AND_BREAK(Rect3);
+ case Variant::AABB: SET_FROM_STRUCT_AND_BREAK(AABB);
case Variant::BASIS: SET_FROM_STRUCT_AND_BREAK(Basis);
case Variant::TRANSFORM: SET_FROM_STRUCT_AND_BREAK(Transform);
case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index 01392447f3..8bc2bb5096 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -36,7 +36,7 @@ namespace GDMonoMarshal {
#define RETURN_BOXED_STRUCT(m_t, m_var_in) \
{ \
- const m_t &m_in = m_var_in->operator m_t(); \
+ const m_t &m_in = m_var_in->operator ::m_t(); \
MARSHALLED_OUT(m_t, m_in, raw); \
return mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(m_t), raw); \
}
@@ -104,8 +104,8 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Transform))
return Variant::TRANSFORM;
- if (tclass == CACHED_CLASS(Rect3))
- return Variant::RECT3;
+ if (tclass == CACHED_CLASS(AABB))
+ return Variant::AABB;
if (tclass == CACHED_CLASS(Color))
return Variant::COLOR;
@@ -297,8 +297,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
if (tclass == CACHED_CLASS(Transform))
RETURN_BOXED_STRUCT(Transform, p_var);
- if (tclass == CACHED_CLASS(Rect3))
- RETURN_BOXED_STRUCT(Rect3, p_var);
+ if (tclass == CACHED_CLASS(AABB))
+ RETURN_BOXED_STRUCT(AABB, p_var);
if (tclass == CACHED_CLASS(Color))
RETURN_BOXED_STRUCT(Color, p_var);
@@ -394,8 +394,8 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
RETURN_BOXED_STRUCT(Plane, p_var);
case Variant::QUAT:
RETURN_BOXED_STRUCT(Quat, p_var);
- case Variant::RECT3:
- RETURN_BOXED_STRUCT(Rect3, p_var);
+ case Variant::AABB:
+ RETURN_BOXED_STRUCT(AABB, p_var);
case Variant::BASIS:
RETURN_BOXED_STRUCT(Basis, p_var);
case Variant::TRANSFORM:
@@ -518,8 +518,8 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Transform))
RETURN_UNBOXED_STRUCT(Transform, p_obj);
- if (tclass == CACHED_CLASS(Rect3))
- RETURN_UNBOXED_STRUCT(Rect3, p_obj);
+ if (tclass == CACHED_CLASS(AABB))
+ RETURN_UNBOXED_STRUCT(AABB, p_obj);
if (tclass == CACHED_CLASS(Color))
RETURN_UNBOXED_STRUCT(Color, p_obj);
diff --git a/modules/mono/mono_gd/gd_mono_marshal.h b/modules/mono/mono_gd/gd_mono_marshal.h
index 9f403b787f..443e947fb5 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.h
+++ b/modules/mono/mono_gd/gd_mono_marshal.h
@@ -197,10 +197,10 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
Basis(m_in[0], m_in[1], m_in[2], m_in[3], m_in[4], m_in[5], m_in[6], m_in[7], m_in[8]), \
Vector3(m_in[9], m_in[10], m_in[11]));
-// Rect3
+// AABB
-#define MARSHALLED_OUT_Rect3(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
-#define MARSHALLED_IN_Rect3(m_in, m_out) Rect3 m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
+#define MARSHALLED_OUT_AABB(m_in, m_out) real_t m_out[6] = { m_in.position.x, m_in.position.y, m_in.position.z, m_in.size.x, m_in.size.y, m_in.size.z };
+#define MARSHALLED_IN_AABB(m_in, m_out) AABB m_out(Vector3(m_in[0], m_in[1], m_in[2]), Vector3(m_in[3], m_in[4], m_in[5]));
// Color
@@ -214,6 +214,6 @@ Dictionary mono_object_to_Dictionary(MonoObject *p_dict);
#endif
-} // GDMonoMarshal
+} // namespace GDMonoMarshal
#endif // GDMONOMARSHAL_H
diff --git a/modules/mono/mono_gd/gd_mono_utils.cpp b/modules/mono/mono_gd/gd_mono_utils.cpp
index 53e45002c4..1cccd0ad9d 100644
--- a/modules/mono/mono_gd/gd_mono_utils.cpp
+++ b/modules/mono/mono_gd/gd_mono_utils.cpp
@@ -80,7 +80,7 @@ void MonoCache::clear_members() {
class_Basis = NULL;
class_Quat = NULL;
class_Transform = NULL;
- class_Rect3 = NULL;
+ class_AABB = NULL;
class_Color = NULL;
class_Plane = NULL;
class_NodePath = NULL;
@@ -147,7 +147,7 @@ void update_godot_api_cache() {
CACHE_CLASS_AND_CHECK(Basis, GODOT_API_CLASS(Basis));
CACHE_CLASS_AND_CHECK(Quat, GODOT_API_CLASS(Quat));
CACHE_CLASS_AND_CHECK(Transform, GODOT_API_CLASS(Transform));
- CACHE_CLASS_AND_CHECK(Rect3, GODOT_API_CLASS(Rect3));
+ CACHE_CLASS_AND_CHECK(AABB, GODOT_API_CLASS(AABB));
CACHE_CLASS_AND_CHECK(Color, GODOT_API_CLASS(Color));
CACHE_CLASS_AND_CHECK(Plane, GODOT_API_CLASS(Plane));
CACHE_CLASS_AND_CHECK(NodePath, GODOT_API_CLASS(NodePath));
@@ -364,4 +364,4 @@ String get_exception_name_and_message(MonoObject *p_ex) {
return res;
}
-}
+} // namespace GDMonoUtils
diff --git a/modules/mono/mono_gd/gd_mono_utils.h b/modules/mono/mono_gd/gd_mono_utils.h
index ebb5d28e4d..c38f8c5af5 100644
--- a/modules/mono/mono_gd/gd_mono_utils.h
+++ b/modules/mono/mono_gd/gd_mono_utils.h
@@ -82,7 +82,7 @@ struct MonoCache {
GDMonoClass *class_Basis;
GDMonoClass *class_Quat;
GDMonoClass *class_Transform;
- GDMonoClass *class_Rect3;
+ GDMonoClass *class_AABB;
GDMonoClass *class_Color;
GDMonoClass *class_Plane;
GDMonoClass *class_NodePath;
@@ -166,7 +166,7 @@ MonoDomain *create_domain(const String &p_friendly_name);
String get_exception_name_and_message(MonoObject *p_ex);
-} // GDMonoUtils
+} // namespace GDMonoUtils
#define NATIVE_GDMONOCLASS_NAME(m_class) (GDMonoMarshal::mono_string_to_godot((MonoString *)m_class->get_field(BINDINGS_NATIVE_NAME_FIELD)->get_value(NULL)))
diff --git a/modules/regex/doc_classes/RegExMatch.xml b/modules/regex/doc_classes/RegExMatch.xml
index 354febf89a..8c6951fea2 100644
--- a/modules/regex/doc_classes/RegExMatch.xml
+++ b/modules/regex/doc_classes/RegExMatch.xml
@@ -4,7 +4,7 @@
Contains the results of a regex search.
</brief_description>
<description>
- Contains the results of a single regex match returned by [method RegEx.search] and [method.RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.
+ Contains the results of a single regex match returned by [method RegEx.search] and [method RegEx.search_all]. It can be used to find the position and range of the match and its capturing groups, and it can extract its sub-string for you.
</description>
<tutorials>
</tutorials>
diff --git a/modules/visual_script/visual_script_builtin_funcs.cpp b/modules/visual_script/visual_script_builtin_funcs.cpp
index 7c9d306831..8f7fe58bee 100644
--- a/modules/visual_script/visual_script_builtin_funcs.cpp
+++ b/modules/visual_script/visual_script_builtin_funcs.cpp
@@ -1109,7 +1109,7 @@ void VisualScriptBuiltinFunc::exec_func(BuiltinFunc p_func, const Variant **p_in
String str = *p_inputs[0];
//str+="\n";
- OS::get_singleton()->printerr("%s\n", str.utf8().get_data());
+ print_error(str);
} break;
case VisualScriptBuiltinFunc::TEXT_PRINTRAW: {
diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp
index 86cf5b27e6..83b8d8da2d 100644
--- a/modules/visual_script/visual_script_editor.cpp
+++ b/modules/visual_script/visual_script_editor.cpp
@@ -349,7 +349,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::TRANSFORM2D: color = Color::html("#c4ec69"); break;
case Variant::PLANE: color = Color::html("#f77070"); break;
case Variant::QUAT: color = Color::html("#ec69a3"); break;
- case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::AABB: color = Color::html("#ee7991"); break;
case Variant::BASIS: color = Color::html("#e3ec69"); break;
case Variant::TRANSFORM: color = Color::html("#f6a86e"); break;
@@ -386,7 +386,7 @@ static Color _color_from_type(Variant::Type p_type, bool dark_theme = true) {
case Variant::TRANSFORM2D: color = Color::html("#96ce1a"); break;
case Variant::PLANE: color = Color::html("#f77070"); break;
case Variant::QUAT: color = Color::html("#ec69a3"); break;
- case Variant::RECT3: color = Color::html("#ee7991"); break;
+ case Variant::AABB: color = Color::html("#ee7991"); break;
case Variant::BASIS: color = Color::html("#b2bb19"); break;
case Variant::TRANSFORM: color = Color::html("#f49047"); break;