Merge pull request #52679 from nekomatata/world-boundary-shape

Rename WorldMarginShape to WorldBoundaryShape
This commit is contained in:
Camille Mohr-Daurat 2021-09-15 16:02:40 -07:00 committed by GitHub
commit 1852afb6b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 214 additions and 215 deletions

View file

@ -87,8 +87,8 @@ RID BulletPhysicsServer3D::shape_create(ShapeType p_shape) {
ShapeBullet *shape = nullptr;
switch (p_shape) {
case SHAPE_PLANE: {
shape = bulletnew(PlaneShapeBullet);
case SHAPE_WORLD_BOUNDARY: {
shape = bulletnew(WorldBoundaryShapeBullet);
} break;
case SHAPE_SPHERE: {
shape = bulletnew(SphereShapeBullet);

View file

@ -110,7 +110,7 @@ btEmptyShape *ShapeBullet::create_shape_empty() {
return bulletnew(btEmptyShape);
}
btStaticPlaneShape *ShapeBullet::create_shape_plane(const btVector3 &planeNormal, btScalar planeConstant) {
btStaticPlaneShape *ShapeBullet::create_shape_world_boundary(const btVector3 &planeNormal, btScalar planeConstant) {
return bulletnew(btStaticPlaneShape(planeNormal, planeConstant));
}
@ -164,32 +164,32 @@ btRayShape *ShapeBullet::create_shape_ray(real_t p_length, bool p_slips_on_slope
return r;
}
/* PLANE */
/* World boundary */
PlaneShapeBullet::PlaneShapeBullet() :
WorldBoundaryShapeBullet::WorldBoundaryShapeBullet() :
ShapeBullet() {}
void PlaneShapeBullet::set_data(const Variant &p_data) {
void WorldBoundaryShapeBullet::set_data(const Variant &p_data) {
setup(p_data);
}
Variant PlaneShapeBullet::get_data() const {
Variant WorldBoundaryShapeBullet::get_data() const {
return plane;
}
PhysicsServer3D::ShapeType PlaneShapeBullet::get_type() const {
return PhysicsServer3D::SHAPE_PLANE;
PhysicsServer3D::ShapeType WorldBoundaryShapeBullet::get_type() const {
return PhysicsServer3D::SHAPE_WORLD_BOUNDARY;
}
void PlaneShapeBullet::setup(const Plane &p_plane) {
void WorldBoundaryShapeBullet::setup(const Plane &p_plane) {
plane = p_plane;
notifyShapeChanged();
}
btCollisionShape *PlaneShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
btCollisionShape *WorldBoundaryShapeBullet::create_bt_shape(const btVector3 &p_implicit_scale, real_t p_extra_edge) {
btVector3 btPlaneNormal;
G_TO_B(plane.normal, btPlaneNormal);
return prepare(PlaneShapeBullet::create_shape_plane(btPlaneNormal, plane.d));
return prepare(WorldBoundaryShapeBullet::create_shape_world_boundary(btPlaneNormal, plane.d));
}
/* Sphere */

View file

@ -81,7 +81,7 @@ public:
public:
static class btEmptyShape *create_shape_empty();
static class btStaticPlaneShape *create_shape_plane(const btVector3 &planeNormal, btScalar planeConstant);
static class btStaticPlaneShape *create_shape_world_boundary(const btVector3 &planeNormal, btScalar planeConstant);
static class btSphereShape *create_shape_sphere(btScalar radius);
static class btBoxShape *create_shape_box(const btVector3 &boxHalfExtents);
static class btCapsuleShape *create_shape_capsule(btScalar radius, btScalar height);
@ -93,11 +93,11 @@ public:
static class btRayShape *create_shape_ray(real_t p_length, bool p_slips_on_slope);
};
class PlaneShapeBullet : public ShapeBullet {
class WorldBoundaryShapeBullet : public ShapeBullet {
Plane plane;
public:
PlaneShapeBullet();
WorldBoundaryShapeBullet();
virtual void set_data(const Variant &p_data);
virtual Variant get_data() const;

View file

@ -45,7 +45,7 @@
#include "scene/resources/primitive_meshes.h"
#include "scene/resources/shape_3d.h"
#include "scene/resources/sphere_shape_3d.h"
#include "scene/resources/world_margin_shape_3d.h"
#include "scene/resources/world_boundary_shape_3d.h"
#ifdef TOOLS_ENABLED
#include "editor/editor_node.h"