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

@@ -17,9 +17,12 @@ API_CLASS(Namespace="FlaxEngine.Networking", Sealed) class FLAXENGINE_API ENetDr
{
DECLARE_SCRIPTING_TYPE(ENetDriver);
public:
// [INetworkDriver]
String DriverName() override { return String("ENetDriver"); }
String DriverName() override
{
return String("ENetDriver");
}
bool Initialize(NetworkPeer* host, const NetworkConfig& config) override;
void Dispose() override;
bool Listen() override;
@@ -32,14 +35,12 @@ public:
void SendMessage(NetworkChannelType channelType, const NetworkMessage& message, const Array<NetworkConnection, HeapAllocation>& targets) override;
private:
bool IsServer() const
{
return _host != nullptr && _peer == nullptr;
}
private:
NetworkConfig _config;
NetworkPeer* _networkHost;
void* _host = nullptr;

View File

@@ -27,7 +27,6 @@ template<class Base>
class ParticleEmitterGraphNode : public Base
{
public:
/// <summary>
/// True if node is used by the particles graph (is connected to the any module input or its a enabled module).
/// </summary>
@@ -56,7 +55,6 @@ template<class BaseType, class NodeType, class ValueType>
class ParticleEmitterGraph : public BaseType
{
public:
typedef ValueType Value;
enum class ModuleType
@@ -68,7 +66,6 @@ public:
};
protected:
// Attributes cache
int32 _attrPosition;
int32 _attrVelocity;
@@ -84,7 +81,6 @@ protected:
int32 _attrRadius;
public:
/// <summary>
/// The Particle Emitter Graph data version number. Used to sync the Particle Emitter Graph data with the instances state. Handles graph reloads to ensure data is valid.
/// </summary>
@@ -116,7 +112,6 @@ public:
Array<Variant, FixedAllocation<PARTICLE_ATTRIBUTES_MAX_COUNT>> AttributesDefaults;
public:
/// <summary>
/// The particles modules for Spawn context.
/// </summary>
@@ -531,7 +526,6 @@ public:
}
public:
// [Graph]
void Clear() override
{

View File

@@ -17,7 +17,6 @@ API_CLASS(NoSpawn) class ParticleEffectParameter : public ScriptingObject
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ParticleEffectParameter);
friend ParticleEffect;
private:
ParticleEffect* _effect = nullptr;
int32 _emitterIndex;
int32 _paramIndex;
@@ -25,7 +24,6 @@ private:
void Init(ParticleEffect* effect, int32 emitterIndex, int32 paramIndex);
public:
/// <summary>
/// Initializes a new instance of the <see cref="ParticleEffectParameter"/> class.
/// </summary>
@@ -139,7 +137,6 @@ API_CLASS() class FLAXENGINE_API ParticleEffect : public Actor
{
DECLARE_SCENE_OBJECT(ParticleEffect);
public:
/// <summary>
/// The particles simulation update modes.
/// </summary>
@@ -180,7 +177,6 @@ public:
};
private:
uint64 _lastUpdateFrame;
Real _lastMinDstSqr;
Matrix _world;
@@ -190,7 +186,6 @@ private:
Array<ParameterOverride> _parametersOverrides; // Cached parameter modifications to be applied to the parameters
public:
/// <summary>
/// The particle system to play.
/// </summary>
@@ -209,7 +204,6 @@ public:
ScriptingObjectReference<SceneRenderTask> CustomViewRenderTask;
public:
/// <summary>
/// The particles simulation update mode. Defines how to update particles emitter.
/// </summary>
@@ -262,7 +256,6 @@ public:
}
public:
/// <summary>
/// Gets the effect parameters collection. Those parameters are instanced from the <see cref="ParticleSystem"/> that contains a linear list of emitters and every emitter has a list of own parameters.
/// </summary>
@@ -311,7 +304,6 @@ public:
API_FUNCTION() void ResetParameters();
public:
/// <summary>
/// Gets the current time position of the particle system timeline animation playback (in seconds).
/// </summary>
@@ -370,7 +362,6 @@ protected:
#endif
private:
void Update();
#if USE_EDITOR
void UpdateExecuteInEditor();
@@ -381,7 +372,6 @@ private:
void OnParticleSystemLoaded();
public:
// [Actor]
bool HasContentLoaded() const override;
void Draw(RenderContext& renderContext) override;
@@ -400,7 +390,6 @@ public:
#endif
protected:
// [Actor]
void EndPlay() override;
void OnEnable() override;

View File

@@ -20,7 +20,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API ParticleEmitter : public ShaderAssetType
{
DECLARE_BINARY_ASSET_HEADER(ParticleEmitter, ShadersSerializedVersion);
public:
/// <summary>
/// The loaded particle graph.
/// </summary>
@@ -76,7 +75,6 @@ public:
#endif
public:
/// <summary>
/// Tries to load surface graph from the asset.
/// </summary>
@@ -96,7 +94,6 @@ public:
#endif
public:
/// <summary>
/// Spawns the particles at the given location.
/// </summary>
@@ -172,7 +169,6 @@ public:
API_FUNCTION() ParticleEffect* Spawn(Actor* parent, const Transform& transform, float duration = MAX_float, bool autoDestroy = false);
public:
// [BinaryAsset]
#if USE_EDITOR
void GetReferences(Array<Guid>& output) const override
@@ -185,7 +181,6 @@ public:
#endif
protected:
// [ParticleEmitterBase]
LoadResult load() override;
void unload(bool isReloading) override;

View File

@@ -15,7 +15,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API ParticleEmitterFunction : public BinaryA
{
DECLARE_BINARY_ASSET_HEADER(ParticleEmitterFunction, 1);
public:
/// <summary>
/// The loaded CPU particle function graph.
/// </summary>
@@ -79,7 +78,6 @@ public:
#endif
protected:
// [BinaryAsset]
LoadResult load() override;
void unload(bool isReloading) override;

View File

@@ -14,7 +14,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API ParticleSystem : public BinaryAsset
{
DECLARE_BINARY_ASSET_HEADER(ParticleSystem, 1);
public:
/// <summary>
/// The particle system timeline track data.
/// </summary>
@@ -100,7 +99,6 @@ public:
typedef Pair<int32, Guid> EmitterParameterOverrideKey;
public:
/// <summary>
/// The asset data version number. Used to sync the data with the instances state. Incremented each time asset gets loaded.
/// </summary>
@@ -140,7 +138,6 @@ public:
Array<Track> Tracks;
public:
/// <summary>
/// Initializes the particle system that plays a single particles emitter. This can be used only for virtual assets.
/// </summary>
@@ -167,7 +164,6 @@ public:
#endif
public:
/// <summary>
/// Spawns the particles at the given location.
/// </summary>
@@ -237,7 +233,6 @@ public:
API_FUNCTION() ParticleEffect* Spawn(Actor* parent, const Transform& transform, bool autoDestroy = false);
public:
// [BinaryAsset]
void InitAsVirtual() override;
#if USE_EDITOR
@@ -245,7 +240,6 @@ public:
#endif
protected:
// [ParticleSystemBase]
LoadResult load() override;
void unload(bool isReloading) override;

View File

@@ -38,14 +38,12 @@ struct SpriteParticleVertex
class SpriteParticleRenderer
{
public:
GPUBuffer* VB = nullptr;
GPUBuffer* IB = nullptr;
const static int32 VertexCount = 4;
const static int32 IndexCount = 6;
public:
bool Init()
{
if (VB)
@@ -120,7 +118,6 @@ namespace ParticlesDrawCPU
class ParticleManagerService : public EngineService
{
public:
ParticleManagerService()
: EngineService(TEXT("Particle Manager"), 65)
{

View File

@@ -28,7 +28,6 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Particles);
API_FIELD(ReadOnly) static TaskGraphSystem* System;
public:
/// <summary>
/// Updates the effect during next particles simulation tick.
/// </summary>
@@ -42,7 +41,6 @@ public:
static void OnEffectDestroy(ParticleEffect* effect);
public:
/// <summary>
/// Draws the particles.
/// </summary>
@@ -51,7 +49,6 @@ public:
static void DrawParticles(RenderContext& renderContext, ParticleEffect* effect);
public:
/// <summary>
/// Enables or disables particle buffer pooling.
/// </summary>

View File

@@ -78,7 +78,6 @@ struct ParticleAttribute
class ParticleLayout
{
public:
/// <summary>
/// The total particle data stride size (in bytes). Defines the required memory amount for a single particle.
/// </summary>
@@ -90,7 +89,6 @@ public:
Array<ParticleAttribute, FixedAllocation<PARTICLE_ATTRIBUTES_MAX_COUNT>> Attributes;
public:
/// <summary>
/// Clears the layout data.
/// </summary>
@@ -217,7 +215,6 @@ public:
class FLAXENGINE_API ParticleBuffer
{
public:
/// <summary>
/// The emitter graph version (cached on Init). Used to discard pooled buffers that has been created for older emitter graph.
/// </summary>
@@ -331,7 +328,6 @@ public:
} GPU;
public:
/// <summary>
/// Initializes a new instance of the <see cref="ParticleBuffer"/> class.
/// </summary>
@@ -384,12 +380,10 @@ public:
struct ParticleBufferCPUDataAccessorBase
{
protected:
ParticleBuffer* _buffer;
int32 _offset;
public:
ParticleBufferCPUDataAccessorBase()
: _buffer(nullptr)
, _offset(-1)
@@ -403,7 +397,6 @@ public:
}
public:
FORCE_INLINE bool IsValid() const
{
return _buffer != nullptr && _offset != -1;
@@ -414,7 +407,6 @@ template<typename T>
struct ParticleBufferCPUDataAccessor : ParticleBufferCPUDataAccessorBase
{
public:
ParticleBufferCPUDataAccessor<T>()
{
}
@@ -425,7 +417,6 @@ public:
}
public:
FORCE_INLINE T operator[](int32 index) const
{
return Get(index);

View File

@@ -18,7 +18,6 @@ class GPUBuffer;
class FLAXENGINE_API ParticleSystemParameter : public GraphParameter
{
public:
ParticleSystemParameter()
: GraphParameter(SpawnParams(Guid::New(), TypeInitializer))
{
@@ -47,7 +46,6 @@ public:
class FLAXENGINE_API ParticleEmitterInstance
{
public:
struct SpawnerData
{
/// <summary>
@@ -62,7 +60,6 @@ public:
};
public:
/// <summary>
/// The instance data version number. Used to sync the Particle Emitter Graph data with the instance state. Handles Particle Emitter reloads to enure data is valid.
/// </summary>
@@ -107,7 +104,6 @@ public:
ParticleBuffer* Buffer = nullptr;
public:
/// <summary>
/// Initializes a new instance of the <see cref="ParticleEmitterInstance"/> class.
/// </summary>
@@ -138,7 +134,6 @@ public:
class FLAXENGINE_API ParticleSystemInstance
{
public:
/// <summary>
/// The instance data version number. Used to sync the Particle System data with the instance state. Handles Particle System reloads to enure data is valid.
/// </summary>
@@ -170,7 +165,6 @@ public:
mutable GPUBuffer* GPUParticlesCountReadback = nullptr;
public:
/// <summary>
/// Finalizes an instance of the <see cref="ParticleSystemInstance"/> class.
/// </summary>

View File

@@ -15,7 +15,6 @@ API_CLASS(Abstract) class FLAXENGINE_API PhysicsColliderActor : public Actor
{
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

@@ -18,7 +18,6 @@ API_CLASS() class FLAXENGINE_API RigidBody : public Actor, public IPhysicsActor
{
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

@@ -16,7 +16,6 @@ API_CLASS() class FLAXENGINE_API SplineRopeBody : public Actor
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

@@ -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;

View File

@@ -13,12 +13,10 @@ API_CLASS() class FLAXENGINE_API BoxCollider : public Collider
{
DECLARE_SCENE_OBJECT(BoxCollider);
private:
Float3 _size;
OrientedBoundingBox _bounds;
public:
/// <summary>
/// Gets the size of the box, measured in the object's local space.
/// </summary>
@@ -48,7 +46,6 @@ public:
}
public:
// [Collider]
#if USE_EDITOR
void OnDebugDraw() override;
@@ -59,7 +56,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Collider]
void UpdateBounds() override;
void GetGeometry(CollisionShape& collision) override;

View File

@@ -16,13 +16,11 @@ API_CLASS() class FLAXENGINE_API CapsuleCollider : public Collider
{
DECLARE_SCENE_OBJECT(CapsuleCollider);
private:
float _radius;
float _height;
OrientedBoundingBox _orientedBox;
public:
/// <summary>
/// Gets the radius of the sphere, measured in the object's local space.
/// </summary>
@@ -64,7 +62,6 @@ public:
API_PROPERTY() void SetHeight(float value);
public:
// [Collider]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -74,7 +71,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Collider]
void UpdateBounds() override;
void GetGeometry(CollisionShape& collision) override;

View File

@@ -13,7 +13,6 @@ API_CLASS() class FLAXENGINE_API CharacterController : public Collider, public I
{
DECLARE_SCENE_OBJECT(CharacterController);
public:
/// <summary>
/// Specifies which sides a character is colliding with.
/// </summary>
@@ -57,7 +56,6 @@ public:
};
private:
void* _controller;
float _stepOffset;
float _slopeLimit;
@@ -148,7 +146,6 @@ public:
API_PROPERTY() void SetMinMoveDistance(float value);
public:
/// <summary>
/// Gets the linear velocity of the Character Controller. This allows tracking how fast the character is actually moving, for instance when it is stuck at a wall this value will be the near zero vector.
/// </summary>
@@ -165,7 +162,6 @@ public:
API_PROPERTY() CollisionFlags GetFlags() const;
public:
/// <summary>
/// Moves the character with the given speed. Gravity is automatically applied. It will slide along colliders. Result collision flags is the summary of collisions that occurred during the Move.
/// </summary>
@@ -181,7 +177,6 @@ public:
API_FUNCTION() CollisionFlags Move(const Vector3& displacement);
protected:
/// <summary>
/// Creates the physics actor.
/// </summary>
@@ -198,7 +193,6 @@ protected:
void UpdateSize() const;
public:
// [Collider]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -216,7 +210,6 @@ public:
void* GetPhysicsActor() const override;
protected:
// [PhysicsActor]
void UpdateGeometry() override;
void GetGeometry(CollisionShape& collision) override;

View File

@@ -19,7 +19,6 @@ API_CLASS(Abstract) class FLAXENGINE_API Collider : public PhysicsColliderActor
{
DECLARE_SCENE_OBJECT_ABSTRACT(Collider);
protected:
Vector3 _center;
bool _isTrigger;
void* _shape;
@@ -30,7 +29,6 @@ protected:
Quaternion _cachedLocalPoseRot;
public:
/// <summary>
/// Gets the native physics backend object.
/// </summary>
@@ -97,7 +95,6 @@ public:
AssetReference<JsonAsset> Material;
public:
/// <summary>
/// Performs a raycast against this collider shape.
/// </summary>
@@ -146,7 +143,6 @@ public:
API_FUNCTION() static bool ComputePenetration(const Collider* colliderA, const Collider* colliderB, API_PARAM(Out) Vector3& direction, API_PARAM(Out) float& distance);
public:
/// <summary>
/// Determines whether this collider can be attached the specified rigid body.
/// </summary>
@@ -167,7 +163,6 @@ public:
void Attach(RigidBody* rigidBody);
protected:
/// <summary>
/// Updates the shape actor collisions/queries layer mask bits.
/// </summary>
@@ -209,18 +204,15 @@ protected:
#endif
private:
void OnMaterialChanged();
public:
// [PhysicsColliderActor]
void Serialize(SerializeStream& stream, const void* otherObj) override;
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
RigidBody* GetAttachedRigidBody() const override;
protected:
// [PhysicsColliderActor]
#if USE_EDITOR
void OnEnable() override;

View File

@@ -14,7 +14,6 @@ API_CLASS() class FLAXENGINE_API MeshCollider : public Collider
{
DECLARE_SCENE_OBJECT(MeshCollider);
public:
/// <summary>
/// Linked collision data asset that contains convex mesh or triangle mesh used to represent a mesh collider shape.
/// </summary>
@@ -22,12 +21,10 @@ public:
AssetReference<CollisionData> CollisionData;
private:
void OnCollisionDataChanged();
void OnCollisionDataLoaded();
public:
// [Collider]
bool CanAttach(RigidBody* rigidBody) const override;
bool CanBeTrigger() const override;
@@ -39,7 +36,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Collider]
#if USE_EDITOR
void DrawPhysicsDebug(RenderView& view) override;

View File

@@ -12,11 +12,9 @@ API_CLASS() class FLAXENGINE_API SphereCollider : public Collider
{
DECLARE_SCENE_OBJECT(SphereCollider);
private:
float _radius;
public:
/// <summary>
/// Gets the radius of the sphere, measured in the object's local space.
/// </summary>
@@ -38,7 +36,6 @@ public:
API_PROPERTY() void SetRadius(float value);
public:
// [Collider]
#if USE_EDITOR
void OnDebugDrawSelected() override;
@@ -48,7 +45,6 @@ public:
void Deserialize(DeserializeStream& stream, ISerializeModifier* modifier) override;
protected:
// [Collider]
#if USE_EDITOR
void DrawPhysicsDebug(RenderView& view) override;

View File

@@ -24,7 +24,6 @@ private:
Transform _preTransform = Transform::Identity;
public:
/// <summary>
/// Linked collision data asset that contains convex mesh or triangle mesh used to represent a spline collider shape.
/// </summary>
@@ -50,13 +49,11 @@ public:
void ExtractGeometry(Array<Float3>& vertexBuffer, Array<int32>& indexBuffer) const;
private:
void OnCollisionDataChanged();
void OnCollisionDataLoaded();
void OnSplineUpdated();
public:
// [Collider]
bool CanAttach(RigidBody* rigidBody) const override;
bool CanBeTrigger() const override;
@@ -70,7 +67,6 @@ public:
void EndPlay() override;
protected:
// [Collider]
#if USE_EDITOR
void DrawPhysicsDebug(RenderView& view) override;

View File

@@ -139,7 +139,6 @@ API_CLASS(NoSpawn) class FLAXENGINE_API CollisionData : public BinaryAsset
{
DECLARE_BINARY_ASSET_HEADER(CollisionData, 1);
public:
/// <summary>
/// A raw structure stored in the binary asset. It has fixed size so it's easier to add new parameters to it. It's loaded and changed into Options structure used at runtime.
/// </summary>
@@ -157,13 +156,11 @@ public:
static_assert(sizeof(SerializedOptions) == 128, "Invalid collision data options size. Change the padding.");
private:
CollisionDataOptions _options;
void* _convexMesh;
void* _triangleMesh;
public:
/// <summary>
/// Gets the options.
/// </summary>
@@ -189,7 +186,6 @@ public:
}
public:
#if COMPILE_WITH_PHYSICS_COOKING
/// <summary>
@@ -268,7 +264,6 @@ public:
API_FUNCTION() void ExtractGeometry(API_PARAM(Out) Array<Float3>& vertexBuffer, API_PARAM(Out) Array<int32>& indexBuffer) const;
public:
// MeshCollider is drawing debug view of the collision data, allow to share it across instances
#if USE_EDITOR
private:
@@ -282,11 +277,9 @@ public:
#endif
private:
LoadResult load(const SerializedOptions* options, byte* dataPtr, int32 dataSize);
protected:
// [BinaryAsset]
LoadResult load() override;
void unload(bool isReloading) override;

View File

@@ -84,7 +84,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(Collision);
API_FIELD(Private, NoArray) ContactPoint Contacts[COLLISION_NAX_CONTACT_POINTS];
public:
/// <summary>
/// Gets the relative linear velocity of the two colliding objects.
/// </summary>

View File

@@ -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;
@@ -165,7 +164,6 @@ API_CLASS() class FLAXENGINE_API D6Joint : public Joint
{
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

@@ -41,7 +41,6 @@ API_CLASS() class FLAXENGINE_API DistanceJoint : public Joint
{
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

@@ -12,14 +12,12 @@ API_CLASS() class FLAXENGINE_API FixedJoint : public Joint
{
DECLARE_SCENE_OBJECT(FixedJoint);
public:
// [Joint]
#if USE_EDITOR
void OnDebugDrawSelected() override;
#endif
protected:
// [Joint]
void* CreateJoint(const PhysicsJointDesc& desc) override;
};

View File

@@ -57,7 +57,6 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(HingeJointDrive);
API_FIELD() bool FreeSpin = false;
public:
/// <summary>
/// Compares two objects.
/// </summary>
@@ -80,13 +79,11 @@ API_CLASS() class FLAXENGINE_API HingeJoint : public Joint
{
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

@@ -20,7 +20,6 @@ API_CLASS(Abstract) class FLAXENGINE_API Joint : public Actor
{
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

@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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

@@ -31,12 +31,10 @@ API_CLASS() class FLAXENGINE_API SliderJoint : public Joint
{
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

@@ -33,12 +33,10 @@ API_CLASS() class FLAXENGINE_API SphericalJoint : public Joint
{
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;
};

View File

@@ -14,7 +14,6 @@ class MultiThreadStepper;
class PhysicsStepper
{
public:
PhysicsStepper()
{
}
@@ -24,7 +23,6 @@ public:
}
public:
virtual bool advance(PxScene* scene, PxReal dt, void* scratchBlock, PxU32 scratchBlockSize) = 0;
virtual void wait(PxScene* scene) = 0;
virtual void substepStrategy(const PxReal stepSize, PxU32& substepCount, PxReal& substepSize) = 0;
@@ -41,7 +39,6 @@ public:
class StepperTask : public PxLightCpuTask
{
public:
void setStepper(MultiThreadStepper* stepper)
{
mStepper = stepper;
@@ -58,7 +55,6 @@ public:
}
public:
// [PxLightCpuTask]
const char* getName() const override
{
@@ -68,7 +64,6 @@ public:
void run() override;
protected:
MultiThreadStepper* mStepper = nullptr;
};
@@ -79,7 +74,6 @@ protected:
class StepperTaskSimulate : public StepperTask
{
public:
/// <summary>
/// Initializes a new instance of the <see cref="StepperTaskSimulate"/> class.
/// </summary>
@@ -88,7 +82,6 @@ public:
}
public:
// [StepperTask]
void run() override;
};
@@ -96,7 +89,6 @@ public:
class MultiThreadStepper : public PhysicsStepper
{
public:
MultiThreadStepper()
: mFirstCompletionPending(false)
, mScene(nullptr)
@@ -135,7 +127,6 @@ public:
}
protected:
void substep(StepperTask& completionTask);
// we need two completion tasks because when multistepping we can't submit completion0 from the
@@ -170,13 +161,11 @@ protected:
class FixedStepper : public MultiThreadStepper
{
protected:
PxReal mAccumulator;
PxReal mFixedSubStepSize;
PxU32 mMaxSubSteps;
public:
/// <summary>
/// Initializes a new instance of the <see cref="FixedStepper"/> class.
/// </summary>
@@ -189,7 +178,6 @@ public:
}
public:
/// <summary>
/// Setups the specified step size and the maximum amount of them.
/// </summary>
@@ -202,7 +190,6 @@ public:
}
public:
// [MultiThreadStepper]
void substepStrategy(const PxReal stepSize, PxU32& substepCount, PxReal& substepSize) override;

View File

@@ -17,7 +17,6 @@
class SimulationEventCallback : public PxSimulationEventCallback
{
public:
typedef Pair<PhysicsColliderActor*, PhysicsColliderActor*> CollidersPair;
typedef Dictionary<CollidersPair, Collision> CollisionsPool;
@@ -57,7 +56,6 @@ public:
Array<Joint*> BrokenJoints;
public:
/// <summary>
/// Clears the data.
/// </summary>
@@ -98,7 +96,6 @@ public:
void OnJointRemoved(Joint* joint);
public:
// [PxSimulationEventCallback]
void onConstraintBreak(PxConstraintInfo* constraints, PxU32 count) override;
void onWake(PxActor** actors, PxU32 count) override;

View File

@@ -13,11 +13,9 @@ API_CLASS() class FLAXENGINE_API PhysicalMaterial final : public ISerializable
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(PhysicalMaterial);
private:
void* _material;
public:
/// <summary>
/// Initializes a new instance of the <see cref="PhysicalMaterial"/> class.
/// </summary>
@@ -29,7 +27,6 @@ public:
~PhysicalMaterial();
public:
/// <summary>
/// The friction value of surface, controls how easily things can slide on this surface.
/// </summary>
@@ -73,7 +70,6 @@ public:
float Density = 1000.0f;
public:
/// <summary>
/// Gets the PhysX material.
/// </summary>

View File

@@ -13,7 +13,6 @@ API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings", NoConstructor) class
{
DECLARE_SCRIPTING_TYPE_MINIMAL(PhysicsSettings);
public:
/// <summary>
/// The default gravity force value (in cm^2/s).
/// </summary>
@@ -93,14 +92,12 @@ public:
bool SupportCookingAtRuntime = false;
public:
/// <summary>
/// The collision layers masks. Used to define layer-based collision detection.
/// </summary>
uint32 LayerMasks[32];
public:
/// <summary>
/// Initializes a new instance of the <see cref="PhysicsSettings"/> class.
/// </summary>