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

@@ -13,9 +13,8 @@ struct Collision;
/// <seealso cref="Actor" />
API_CLASS(Abstract) class FLAXENGINE_API PhysicsColliderActor : public Actor
{
DECLARE_SCENE_OBJECT_ABSTRACT(PhysicsColliderActor);
DECLARE_SCENE_OBJECT_ABSTRACT(PhysicsColliderActor);
public:
/// <summary>
/// Occurs when a collision start gets registered for this collider (it collides with something).
/// </summary>
@@ -37,7 +36,6 @@ public:
API_EVENT() Delegate<PhysicsColliderActor*> TriggerExit;
public:
/// <summary>
/// Gets the attached rigid body.
/// </summary>
@@ -45,7 +43,6 @@ public:
API_PROPERTY() virtual RigidBody* GetAttachedRigidBody() const = 0;
public:
/// <summary>
/// Called when a collision start gets registered for this collider (it collides with something).
/// </summary>

View File

@@ -16,9 +16,8 @@ class Collider;
/// <seealso cref="Actor" />
API_CLASS() class FLAXENGINE_API RigidBody : public Actor, public IPhysicsActor
{
DECLARE_SCENE_OBJECT(RigidBody);
DECLARE_SCENE_OBJECT(RigidBody);
protected:
void* _actor;
Float3 _cachedScale;
@@ -40,7 +39,6 @@ protected:
int32 _isUpdatingTransform : 1;
public:
/// <summary>
/// Enables kinematic mode for the rigidbody.
/// </summary>
@@ -286,7 +284,6 @@ public:
API_PROPERTY() void SetConstraints(const RigidbodyConstraints value);
public:
/// <summary>
/// Gets the linear velocity of the rigidbody.
/// </summary>
@@ -374,7 +371,6 @@ public:
API_PROPERTY() bool IsSleeping() const;
public:
/// <summary>
/// Forces a rigidbody to sleep (for at least one frame).
/// </summary>
@@ -508,7 +504,6 @@ public:
API_FUNCTION() void ClosestPoint(const Vector3& position, API_PARAM(Out) Vector3& result) const;
public:
/// <summary>
/// Occurs when a collision start gets registered for this rigidbody (it collides with something).
/// </summary>
@@ -530,7 +525,6 @@ public:
API_EVENT() Delegate<PhysicsColliderActor*> TriggerExit;
public:
void OnCollisionEnter(const Collision& c);
void OnCollisionExit(const Collision& c);
@@ -551,7 +545,6 @@ public:
void UpdateScale();
public:
// [Actor]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
@@ -561,7 +554,6 @@ public:
void OnActiveTransformChanged() override;
protected:
// [Actor]
void BeginPlay(SceneBeginData* data) override;
void EndPlay() override;

View File

@@ -13,10 +13,9 @@ class Spline;
/// <seealso cref="Spline" />
API_CLASS() class FLAXENGINE_API SplineRopeBody : public Actor
{
API_AUTO_SERIALIZATION();
DECLARE_SCENE_OBJECT(SplineRopeBody);
API_AUTO_SERIALIZATION();
DECLARE_SCENE_OBJECT(SplineRopeBody);
private:
struct Mass
{
Vector3 Position;
@@ -30,7 +29,6 @@ private:
Array<Mass> _masses;
public:
/// <summary>
/// The target actor too attach the rope end to. If unset the rope end will run freely.
/// </summary>
@@ -62,11 +60,9 @@ public:
float SubstepTime = 0.02f;
private:
void Tick();
public:
// [Actor]
void OnEnable() override;
void OnDisable() override;

View File

@@ -13,7 +13,7 @@
API_CLASS() class FLAXENGINE_API WheeledVehicle : public RigidBody
{
friend class PhysicsBackend;
DECLARE_SCENE_OBJECT(WheeledVehicle);
DECLARE_SCENE_OBJECT(WheeledVehicle);
/// <summary>
/// Vehicle driving mode types.
@@ -33,8 +33,8 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
/// </summary>
API_STRUCT() struct EngineSettings : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(EngineSettings);
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(EngineSettings);
API_AUTO_SERIALIZATION();
/// <summary>
/// Moment of inertia of the engine around the axis of rotation. Specified in kilograms metres-squared (kg m^2).
@@ -76,8 +76,8 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
/// </summary>
API_STRUCT() struct DifferentialSettings : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(DifferentialSettings);
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(DifferentialSettings);
API_AUTO_SERIALIZATION();
/// <summary>
/// Type of differential.
@@ -120,8 +120,8 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
/// </summary>
API_STRUCT() struct GearboxSettings : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings);
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(GearboxSettings);
API_AUTO_SERIALIZATION();
/// <summary>
/// If enabled the vehicle gears will be changes automatically, otherwise it's fully manual.
@@ -163,8 +163,8 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
/// </summary>
API_STRUCT() struct Wheel : ISerializable
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Wheel);
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(Wheel);
API_AUTO_SERIALIZATION();
/// <summary>
/// Wheel placement type.
@@ -257,7 +257,7 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
/// </summary>
API_STRUCT() struct WheelState
{
DECLARE_SCRIPTING_TYPE_MINIMAL(WheelState);
DECLARE_SCRIPTING_TYPE_MINIMAL(WheelState);
/// <summary>
/// True if suspension travel limits forbid the wheel from touching the drivable surface.
@@ -313,7 +313,6 @@ DECLARE_SCENE_OBJECT(WheeledVehicle);
};
private:
struct WheelData
{
Collider* Collider;
@@ -331,7 +330,6 @@ private:
GearboxSettings _gearbox;
public:
/// <summary>
/// If checked, the negative throttle value will be used as brake and reverse to behave in a more arcade style where holding reverse also functions as brake. Disable it for more realistic driving controls.
/// </summary>
@@ -395,7 +393,6 @@ public:
API_PROPERTY() void SetGearbox(const GearboxSettings& value);
public:
/// <summary>
/// Sets the input for vehicle throttle. It is the analog accelerator pedal value in range (0,1) where 1 represents the pedal fully pressed and 0 represents the pedal in its rest state.
/// </summary>
@@ -426,7 +423,6 @@ public:
API_FUNCTION() void ClearInput();
public:
/// <summary>
/// Gets the current forward vehicle movement speed (along forward vector of the actor transform).
/// </summary>
@@ -475,13 +471,11 @@ public:
API_FUNCTION() void Setup();
private:
#if USE_EDITOR
void DrawPhysicsDebug(RenderView& view);
#endif
public:
// [Vehicle]
#if USE_EDITOR
void OnDebugDrawSelected() override;