Format more engine code

This commit is contained in:
Wojtek Figat
2022-06-14 20:26:33 +02:00
parent b49e5e9984
commit 2bf6fac77d
37 changed files with 120 additions and 304 deletions

View File

@@ -124,7 +124,7 @@ API_ENUM() enum class D6JointDriveType
/// </summary>
API_STRUCT() struct D6JointDrive
{
DECLARE_SCRIPTING_TYPE_MINIMAL(D6JointDrive);
DECLARE_SCRIPTING_TYPE_MINIMAL(D6JointDrive);
/// <summary>
/// The spring strength. Force proportional to the position error.
@@ -147,7 +147,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(D6JointDrive);
API_FIELD() bool Acceleration = false;
public:
bool operator==(const D6JointDrive& other) const
{
return Stiffness == other.Stiffness && Damping == other.Damping && ForceLimit == other.ForceLimit && Acceleration == other.Acceleration;
@@ -163,9 +162,8 @@ public:
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API D6Joint : public Joint
{
DECLARE_SCENE_OBJECT(D6Joint);
DECLARE_SCENE_OBJECT(D6Joint);
private:
D6JointMotion _motion[static_cast<int32>(D6JointAxis::MAX)];
D6JointDrive _drive[static_cast<int32>(D6JointDriveType::MAX)];
LimitLinear _limitLinear;
@@ -173,7 +171,6 @@ private:
LimitConeRange _limitSwing;
public:
/// <summary>
/// Gets the motion type around the specified axis.
/// </summary>
@@ -215,7 +212,6 @@ public:
API_FUNCTION() void SetDrive(const D6JointDriveType index, const D6JointDrive& value);
public:
/// <summary>
/// Determines the linear limit used for constraining translation degrees of freedom.
/// </summary>
@@ -259,7 +255,6 @@ public:
API_PROPERTY() void SetLimitSwing(const LimitConeRange& value);
public:
/// <summary>
/// Gets the drive's target position relative to the joint's first body.
/// </summary>
@@ -301,7 +296,6 @@ public:
API_PROPERTY() void SetDriveAngularVelocity(const Vector3& value);
public:
/// <summary>
/// Gets the twist angle of the joint (in the range (-2*Pi, 2*Pi]).
/// </summary>
@@ -318,7 +312,6 @@ public:
API_PROPERTY() float GetCurrentSwingZ() const;
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -327,7 +320,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -39,9 +39,8 @@ DECLARE_ENUM_OPERATORS(DistanceJointFlag);
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API DistanceJoint : public Joint
{
DECLARE_SCENE_OBJECT(DistanceJoint);
DECLARE_SCENE_OBJECT(DistanceJoint);
private:
DistanceJointFlag _flags;
float _minDistance;
float _maxDistance;
@@ -49,7 +48,6 @@ private:
SpringParameters _spring;
public:
/// <summary>
/// Gets the joint mode flags. Controls joint behaviour.
/// </summary>
@@ -139,14 +137,12 @@ public:
API_PROPERTY() void SetSpringParameters(const SpringParameters& value);
public:
/// <summary>
/// Gets the current distance of the joint.
/// </summary>
API_PROPERTY() float GetCurrentDistance() const;
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -155,7 +151,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -10,16 +10,14 @@
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API FixedJoint : public Joint
{
DECLARE_SCENE_OBJECT(FixedJoint);
DECLARE_SCENE_OBJECT(FixedJoint);
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
#endif
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -33,7 +33,7 @@ DECLARE_ENUM_OPERATORS(HingeJointFlag);
/// </summary>
API_STRUCT() struct HingeJointDrive
{
DECLARE_SCRIPTING_TYPE_MINIMAL(HingeJointDrive);
DECLARE_SCRIPTING_TYPE_MINIMAL(HingeJointDrive);
/// <summary>
/// Target velocity of the joint.
@@ -57,7 +57,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(HingeJointDrive);
API_FIELD() bool FreeSpin = false;
public:
/// <summary>
/// Compares two objects.
/// </summary>
@@ -78,15 +77,13 @@ public:
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API HingeJoint : public Joint
{
DECLARE_SCENE_OBJECT(HingeJoint);
DECLARE_SCENE_OBJECT(HingeJoint);
private:
HingeJointFlag _flags;
LimitAngularRange _limit;
HingeJointDrive _drive;
public:
/// <summary>
/// Gets the joint mode flags. Controls joint behaviour.
/// </summary>
@@ -142,7 +139,6 @@ public:
API_PROPERTY() void SetDrive(const HingeJointDrive& value);
public:
/// <summary>
/// Gets the current angle of the joint (in radians, in the range (-Pi, Pi]).
/// </summary>
@@ -154,7 +150,6 @@ public:
API_PROPERTY() float GetCurrentVelocity() const;
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -163,7 +158,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -18,9 +18,8 @@ class IPhysicsActor;
/// <seealso cref="Actor" />
API_CLASS(Abstract) class FLAXENGINE_API Joint : public Actor
{
DECLARE_SCENE_OBJECT_ABSTRACT(Joint);
DECLARE_SCENE_OBJECT_ABSTRACT(Joint);
protected:
void* _joint;
float _breakForce;
float _breakTorque;
@@ -30,7 +29,6 @@ protected:
bool _enableAutoAnchor = false;
public:
/// <summary>
/// The target actor for the joint. It has to be IPhysicsActor type (eg. RigidBody or CharacterController).
/// </summary>
@@ -131,7 +129,6 @@ public:
API_PROPERTY() void SetTargetAnchorRotation(const Quaternion& value);
public:
/// <summary>
/// Gets the native physics backend object.
/// </summary>
@@ -174,7 +171,6 @@ public:
virtual void OnJointBreak();
protected:
Vector3 GetTargetPosition() const;
Quaternion GetTargetOrientation() const;
virtual void* CreateJoint(const struct PhysicsJointDesc& desc) = 0;
@@ -183,13 +179,11 @@ protected:
#endif
private:
void Delete();
void SetActors();
void OnTargetChanged();
public:
// [Actor]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -198,7 +192,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Actor]
void BeginPlay(SceneBeginData* data) override;
void EndPlay() override;

View File

@@ -10,7 +10,7 @@
/// </summary>
API_STRUCT() struct SpringParameters
{
DECLARE_SCRIPTING_TYPE_MINIMAL(SpringParameters);
DECLARE_SCRIPTING_TYPE_MINIMAL(SpringParameters);
/// <summary>
/// The spring strength. Force proportional to the position error.
@@ -23,7 +23,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(SpringParameters);
API_FIELD() float Damping;
public:
/// <summary>
/// Constructs a spring with no force.
/// </summary>
@@ -45,7 +44,6 @@ public:
}
public:
bool operator==(const SpringParameters& other) const
{
return Stiffness == other.Stiffness && Damping == other.Damping;
@@ -57,7 +55,7 @@ public:
/// </summary>
API_STRUCT() struct LimitLinearRange
{
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinearRange);
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinearRange);
/// <summary>
/// Distance from the limit at which it becomes active. Allows the solver to activate earlier than the limit is reached to avoid breaking the limit.
@@ -85,7 +83,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinearRange);
API_FIELD() float Upper = 0.0f;
public:
/// <summary>
/// Constructs an empty limit.
/// </summary>
@@ -122,7 +119,6 @@ public:
}
public:
bool operator==(const LimitLinearRange& other) const
{
return Lower == other.Lower && Upper == other.Upper && ContactDist == other.ContactDist && Restitution == other.Restitution && Spring == other.Spring;
@@ -134,7 +130,7 @@ public:
/// </summary>
API_STRUCT() struct LimitLinear
{
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinear);
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinear);
/// <summary>
/// Distance from the limit at which it becomes active. Allows the solver to activate earlier than the limit is reached to avoid breaking the limit.
@@ -157,7 +153,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LimitLinear);
API_FIELD() float Extent = 0.0f;
public:
/// <summary>
/// Constructs an empty limit.
/// </summary>
@@ -190,7 +185,6 @@ public:
}
public:
bool operator==(const LimitLinear& other) const
{
return Extent == other.Extent && ContactDist == other.ContactDist && Restitution == other.Restitution && Spring == other.Spring;
@@ -202,7 +196,7 @@ public:
/// </summary>
API_STRUCT() struct LimitAngularRange
{
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitAngularRange);
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitAngularRange);
/// <summary>
/// Distance from the limit at which it becomes active. Allows the solver to activate earlier than the limit is reached to avoid breaking the limit.
@@ -230,7 +224,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LimitAngularRange);
API_FIELD() float Upper = 0.0f;
public:
/// <summary>
/// Constructs an empty limit.
/// </summary>
@@ -267,7 +260,6 @@ public:
}
public:
bool operator==(const LimitAngularRange& other) const
{
return Lower == other.Lower && Upper == other.Upper && ContactDist == other.ContactDist && Restitution == other.Restitution && Spring == other.Spring;
@@ -279,7 +271,7 @@ public:
/// </summary>
API_STRUCT() struct LimitConeRange
{
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitConeRange);
DECLARE_SCRIPTING_TYPE_MINIMAL(LimitConeRange);
/// <summary>
/// Distance from the limit at which it becomes active. Allows the solver to activate earlier than the limit is reached to avoid breaking the limit.
@@ -307,7 +299,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(LimitConeRange);
API_FIELD(Attributes="Limit(0.0f, 180.0f)") float ZLimitAngle = 90.0f;
public:
/// <summary>
/// Constructs a limit with a 45 degree cone.
/// </summary>
@@ -344,7 +335,6 @@ public:
}
public:
bool operator==(const LimitConeRange& other) const
{
return YLimitAngle == other.YLimitAngle && ZLimitAngle == other.ZLimitAngle && ContactDist == other.ContactDist && Restitution == other.Restitution && Spring == other.Spring;

View File

@@ -29,14 +29,12 @@ DECLARE_ENUM_OPERATORS(SliderJointFlag);
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API SliderJoint : public Joint
{
DECLARE_SCENE_OBJECT(SliderJoint);
DECLARE_SCENE_OBJECT(SliderJoint);
private:
SliderJointFlag _flags;
LimitLinearRange _limit;
public:
/// <summary>
/// Gets the joint mode flags. Controls joint behaviour.
/// </summary>
@@ -72,7 +70,6 @@ public:
API_PROPERTY() void SetLimit(const LimitLinearRange& value);
public:
/// <summary>
/// Gets the current displacement of the joint along its axis.
/// </summary>
@@ -84,7 +81,6 @@ public:
API_PROPERTY() float GetCurrentVelocity() const;
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -93,7 +89,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -31,14 +31,12 @@ DECLARE_ENUM_OPERATORS(SphericalJointFlag);
/// <seealso cref="Joint" />
API_CLASS() class FLAXENGINE_API SphericalJoint : public Joint
{
DECLARE_SCENE_OBJECT(SphericalJoint);
DECLARE_SCENE_OBJECT(SphericalJoint);
private:
SphericalJointFlag _flags;
LimitConeRange _limit;
public:
/// <summary>
/// Gets the joint mode flags. Controls joint behaviour.
/// </summary>
@@ -74,7 +72,6 @@ public:
API_PROPERTY() void SetLimit(const LimitConeRange& value);
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -83,7 +80,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};