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

@@ -205,7 +205,7 @@ bool ENetDriver::PopEvent(NetworkEvent* eventPtr)
case ENET_EVENT_TYPE_RECEIVE:
eventPtr->EventType = NetworkEventType::Message;
// Acquire message and copy message data
// Acquire message and copy message data
eventPtr->Message = _networkHost->CreateMessage();
eventPtr->Message.Length = event.packet->dataLength;
Memory::CopyItems(eventPtr->Message.Buffer, event.packet->data, event.packet->dataLength);

View File

@@ -15,11 +15,14 @@
/// </summary>
API_CLASS(Namespace="FlaxEngine.Networking", Sealed) class FLAXENGINE_API ENetDriver : public ScriptingObject, public INetworkDriver
{
DECLARE_SCRIPTING_TYPE(ENetDriver);
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>
@@ -175,18 +170,18 @@ public:
switch (node->Type)
{
// == Tools ==
// == Tools ==
// Get Gameplay Global
// Get Gameplay Global
case GRAPH_NODE_MAKE_TYPE(7, 16):
{
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[0]);
break;
}
// === Particles ===
// === Particles ===
// Particle Attribute
// Particle Attribute
case GRAPH_NODE_MAKE_TYPE(14, 100):
case GRAPH_NODE_MAKE_TYPE(14, 303):
{
@@ -201,7 +196,7 @@ public:
static_assert(PARTICLE_EMITTER_MAX_ATTRIBUTES_REFS_PER_NODE >= 2, "Invalid node attributes count. Need more space for some data here.");
break;
}
// Particle Position
// Particle Position
case GRAPH_NODE_MAKE_TYPE(14, 101):
case GRAPH_NODE_MAKE_TYPE(14, 212):
{
@@ -209,62 +204,62 @@ public:
USE_ATTRIBUTE(Position, Float3, 0);
break;
}
// Particle Lifetime
// Particle Lifetime
case GRAPH_NODE_MAKE_TYPE(14, 102):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Lifetime, Float, 0);
break;
}
// Particle Age
// Particle Age
case GRAPH_NODE_MAKE_TYPE(14, 103):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Age, Float, 0);
break;
}
// Particle Color
// Particle Color
case GRAPH_NODE_MAKE_TYPE(14, 104):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Color, Float4, 0);
break;
}
// Particle Velocity
// Particle Velocity
case GRAPH_NODE_MAKE_TYPE(14, 105):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Velocity, Float3, 0);
break;
}
// Particle Sprite Size
// Particle Sprite Size
case GRAPH_NODE_MAKE_TYPE(14, 106):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(SpriteSize, Float2, 0);
break;
}
// Particle Mass
// Particle Mass
case GRAPH_NODE_MAKE_TYPE(14, 107):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Mass, Float, 0);
break;
}
// Particle Rotation
// Particle Rotation
case GRAPH_NODE_MAKE_TYPE(14, 108):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Rotation, Float3, 0);
break;
}
// Particle Angular Velocity
// Particle Angular Velocity
case GRAPH_NODE_MAKE_TYPE(14, 109):
{
USE_ATTRIBUTE(AngularVelocity, Float3, 0);
break;
}
// Particle Normalized Age
// Particle Normalized Age
case GRAPH_NODE_MAKE_TYPE(14, 110):
{
node->UsesParticleData = true;
@@ -272,14 +267,14 @@ public:
USE_ATTRIBUTE(Lifetime, Float, 1);
break;
}
// Particle Mass
// Particle Mass
case GRAPH_NODE_MAKE_TYPE(14, 111):
{
node->UsesParticleData = true;
USE_ATTRIBUTE(Radius, Float, 0);
break;
}
// Random
// Random
case GRAPH_NODE_MAKE_TYPE(14, 208):
case GRAPH_NODE_MAKE_TYPE(14, 209):
case GRAPH_NODE_MAKE_TYPE(14, 210):
@@ -292,19 +287,19 @@ public:
node->IsConstant = false;
break;
}
// Particle Emitter Function
// Particle Emitter Function
case GRAPH_NODE_MAKE_TYPE(14, 300):
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[0]);
node->UsesParticleData = true; // TODO: analyze emitter function graph to detect if it's actually using any particle data at all (even from inputs after inline)
break;
// Particle Index
// Particle Index
case GRAPH_NODE_MAKE_TYPE(14, 301):
node->UsesParticleData = true;
break;
// === Particle Modules ===
// === Particle Modules ===
// Orient Sprite
// Orient Sprite
case GRAPH_NODE_MAKE_TYPE(15, 201):
case GRAPH_NODE_MAKE_TYPE(15, 303):
{
@@ -316,27 +311,27 @@ public:
}
break;
}
// Orient Model
// Orient Model
case GRAPH_NODE_MAKE_TYPE(15, 213):
case GRAPH_NODE_MAKE_TYPE(15, 309):
{
USE_ATTRIBUTE(ModelFacingMode, Int, 0);
break;
}
// Update Age
// Update Age
case GRAPH_NODE_MAKE_TYPE(15, 300):
{
USE_ATTRIBUTE(Age, Float, 0);
break;
}
// Gravity/Force
// Gravity/Force
case GRAPH_NODE_MAKE_TYPE(15, 301):
case GRAPH_NODE_MAKE_TYPE(15, 304):
{
USE_ATTRIBUTE(Velocity, Float3, 0);
break;
}
// Linear Drag
// Linear Drag
case GRAPH_NODE_MAKE_TYPE(15, 310):
{
USE_ATTRIBUTE(Velocity, Float3, 0);
@@ -347,7 +342,7 @@ public:
}
break;
}
// Turbulence
// Turbulence
case GRAPH_NODE_MAKE_TYPE(15, 311):
{
USE_ATTRIBUTE(Position, Float3, 0);
@@ -355,7 +350,7 @@ public:
USE_ATTRIBUTE(Mass, Float, 2);
break;
}
// Position (plane/box surface/box volume/cylinder/line/sphere/circle/disc/torus/Global SDF)
// Position (plane/box surface/box volume/cylinder/line/sphere/circle/disc/torus/Global SDF)
case GRAPH_NODE_MAKE_TYPE(15, 202):
case GRAPH_NODE_MAKE_TYPE(15, 203):
case GRAPH_NODE_MAKE_TYPE(15, 204):
@@ -371,21 +366,21 @@ public:
USE_ATTRIBUTE(Position, Float3, 0);
break;
}
// Position (depth)
// Position (depth)
case GRAPH_NODE_MAKE_TYPE(15, 212):
{
USE_ATTRIBUTE(Position, Float3, 0);
USE_ATTRIBUTE(Lifetime, Float, 1);
break;
}
// Position (spiral)
// Position (spiral)
case GRAPH_NODE_MAKE_TYPE(15, 214):
{
USE_ATTRIBUTE(Position, Float3, 0);
USE_ATTRIBUTE(Velocity, Float3, 1);
break;
}
// Set Attribute
// Set Attribute
case GRAPH_NODE_MAKE_TYPE(15, 200):
case GRAPH_NODE_MAKE_TYPE(15, 302):
{
@@ -397,7 +392,7 @@ public:
node->Attributes[0] = idx;
break;
}
// Set Position/Lifetime/Age/..
// Set Position/Lifetime/Age/..
#define CASE_SET_PARTICLE_ATTRIBUTE(id0, id1, name, type) case GRAPH_NODE_MAKE_TYPE(15, id0): case GRAPH_NODE_MAKE_TYPE(15, id1): USE_ATTRIBUTE(name, type, 0); break
CASE_SET_PARTICLE_ATTRIBUTE(250, 350, Position, Float3);
CASE_SET_PARTICLE_ATTRIBUTE(251, 351, Lifetime, Float);
@@ -414,7 +409,7 @@ public:
CASE_SET_PARTICLE_ATTRIBUTE(262, 362, RibbonFacingVector, Float3);
CASE_SET_PARTICLE_ATTRIBUTE(263, 363, Radius, Float);
#undef CASE_SET_PARTICLE_ATTRIBUTE
// Conform to Sphere
// Conform to Sphere
case GRAPH_NODE_MAKE_TYPE(15, 305):
case GRAPH_NODE_MAKE_TYPE(15, 335): // Conform to Global SDF
{
@@ -423,14 +418,14 @@ public:
USE_ATTRIBUTE(Mass, Float, 2);
break;
}
// Kill (sphere/box)
// Kill (sphere/box)
case GRAPH_NODE_MAKE_TYPE(15, 306):
case GRAPH_NODE_MAKE_TYPE(15, 307):
{
USE_ATTRIBUTE(Position, Float3, 0);
break;
}
// Collision (plane/sphere/box/cylinder/depth/Global SDF)
// Collision (plane/sphere/box/cylinder/depth/Global SDF)
case GRAPH_NODE_MAKE_TYPE(15, 330):
case GRAPH_NODE_MAKE_TYPE(15, 331):
case GRAPH_NODE_MAKE_TYPE(15, 332):
@@ -443,7 +438,7 @@ public:
USE_ATTRIBUTE(Age, Float, 2);
break;
}
// Sprite Rendering
// Sprite Rendering
case GRAPH_NODE_MAKE_TYPE(15, 400):
{
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[2]);
@@ -452,7 +447,7 @@ public:
USE_ATTRIBUTE(SpriteSize, Float2, 2);
break;
}
// Sort
// Sort
case GRAPH_NODE_MAKE_TYPE(15, 402):
{
const auto sortMode = static_cast<ParticleSortMode>(node->Values[2].AsInt);
@@ -480,7 +475,7 @@ public:
}
break;
}
// Model Rendering
// Model Rendering
case GRAPH_NODE_MAKE_TYPE(15, 403):
{
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[2]);
@@ -490,7 +485,7 @@ public:
USE_ATTRIBUTE(Scale, Float3, 2);
break;
}
// Ribbon Rendering
// Ribbon Rendering
case GRAPH_NODE_MAKE_TYPE(15, 404):
{
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[2]);
@@ -499,7 +494,7 @@ public:
USE_ATTRIBUTE(Age, Float, 1);
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case GRAPH_NODE_MAKE_TYPE(15, 405):
{
node->Assets[0] = Content::LoadAsync<Asset>((Guid)node->Values[2]);
@@ -531,7 +526,6 @@ public:
}
public:
// [Graph]
void Clear() override
{
@@ -623,7 +617,7 @@ public:
ASSERT(!Root);
Root = n;
}
// Particle Modules (only if module is enabled)
// Particle Modules (only if module is enabled)
else if (n->GroupID == 15 && n->Values[0].AsBool)
{
const auto moduleType = static_cast<ModuleType>(n->Values[1].AsInt);

View File

@@ -14,10 +14,9 @@
/// </summary>
API_CLASS(NoSpawn) class ParticleEffectParameter : public ScriptingObject
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ParticleEffectParameter);
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>
@@ -137,9 +135,8 @@ public:
/// </summary>
API_CLASS() class FLAXENGINE_API ParticleEffect : public Actor
{
DECLARE_SCENE_OBJECT(ParticleEffect);
DECLARE_SCENE_OBJECT(ParticleEffect);
public:
/// <summary>
/// The particles simulation update modes.
/// </summary>
@@ -161,7 +158,7 @@ public:
/// </summary>
API_STRUCT() struct ParameterOverride
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ParameterOverride);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(ParameterOverride);
/// <summary>
/// The name of the track that has overriden parameter.
@@ -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

@@ -18,9 +18,8 @@ class ParticleEmitterInstance;
/// </summary>
API_CLASS(NoSpawn) class FLAXENGINE_API ParticleEmitter : public ShaderAssetTypeBase<BinaryAsset>
{
DECLARE_BINARY_ASSET_HEADER(ParticleEmitter, ShadersSerializedVersion);
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

@@ -13,9 +13,8 @@
/// </summary>
API_CLASS(NoSpawn) class FLAXENGINE_API ParticleEmitterFunction : public BinaryAsset
{
DECLARE_BINARY_ASSET_HEADER(ParticleEmitterFunction, 1);
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

@@ -12,9 +12,8 @@
/// </summary>
API_CLASS(NoSpawn) class FLAXENGINE_API ParticleSystem : public BinaryAsset
{
DECLARE_BINARY_ASSET_HEADER(ParticleSystem, 1);
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)
{
@@ -251,7 +248,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
}
#if !BUILD_RELEASE
default:
CRASH;
CRASH;
#endif
}
@@ -406,7 +403,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
switch (module->TypeID)
{
// Sprite Rendering
// Sprite Rendering
case 400:
{
const auto material = (MaterialBase*)module->Assets[0].Get();
@@ -420,7 +417,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Model Rendering
// Model Rendering
case 403:
{
const auto model = (Model*)module->Assets[0].Get();
@@ -446,7 +443,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Ribbon Rendering
// Ribbon Rendering
case 404:
{
if (ribbonModulesDrawIndicesCount[ribbonModuleIndex] == 0)
@@ -504,7 +501,7 @@ void DrawEmitterCPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case 405:
{
const auto material = (MaterialBase*)module->Assets[0].Get();
@@ -666,7 +663,7 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
}
#if !BUILD_RELEASE
default:
CRASH;
CRASH;
return;
#endif
}
@@ -691,13 +688,13 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
auto module = emitter->Graph.RenderModules[moduleIndex];
switch (module->TypeID)
{
// Sprite Rendering
// Sprite Rendering
case 400:
{
drawCalls++;
break;
}
// Model Rendering
// Model Rendering
case 403:
{
const auto model = (Model*)module->Assets[0].Get();
@@ -717,13 +714,13 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Ribbon Rendering
// Ribbon Rendering
case 404:
{
// Not supported
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case 405:
{
// Not supported
@@ -749,7 +746,7 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
auto module = emitter->Graph.RenderModules[moduleIndex];
switch (module->TypeID)
{
// Sprite Rendering
// Sprite Rendering
case 400:
{
GPUDrawIndexedIndirectArgs indirectArgsBufferInitData{ SpriteParticleRenderer::IndexCount, 1, 0, 0, 0 };
@@ -760,7 +757,7 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
indirectDrawCallIndex++;
break;
}
// Model Rendering
// Model Rendering
case 403:
{
const auto model = (Model*)module->Assets[0].Get();
@@ -784,13 +781,13 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Ribbon Rendering
// Ribbon Rendering
case 404:
{
// Not supported
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case 405:
{
// Not supported
@@ -809,7 +806,7 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
switch (module->TypeID)
{
// Sprite Rendering
// Sprite Rendering
case 400:
{
const auto material = (MaterialBase*)module->Assets[0].Get();
@@ -826,7 +823,7 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Model Rendering
// Model Rendering
case 403:
{
const auto model = (Model*)module->Assets[0].Get();
@@ -855,13 +852,13 @@ void DrawEmitterGPU(RenderContext& renderContext, ParticleBuffer* buffer, DrawCa
break;
}
// Ribbon Rendering
// Ribbon Rendering
case 404:
{
// Not supported
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case 405:
{
// Not supported
@@ -921,7 +918,7 @@ void Particles::DrawParticles(RenderContext& renderContext, ParticleEffect* effe
switch (module->TypeID)
{
// Sprite Rendering
// Sprite Rendering
case 400:
{
const auto material = (MaterialBase*)module->Assets[0].Get();
@@ -935,7 +932,7 @@ void Particles::DrawParticles(RenderContext& renderContext, ParticleEffect* effe
renderModulesIndices.Add(moduleIndex);
break;
}
// Model Rendering
// Model Rendering
case 403:
{
const auto model = (Model*)module->Assets[0].Get();
@@ -954,7 +951,7 @@ void Particles::DrawParticles(RenderContext& renderContext, ParticleEffect* effe
renderModulesIndices.Add(moduleIndex);
break;
}
// Ribbon Rendering
// Ribbon Rendering
case 404:
{
const auto material = (MaterialBase*)module->Assets[0].Get();
@@ -968,7 +965,7 @@ void Particles::DrawParticles(RenderContext& renderContext, ParticleEffect* effe
renderModulesIndices.Add(moduleIndex);
break;
}
// Volumetric Fog Rendering
// Volumetric Fog Rendering
case 405:
{
const auto material = (MaterialBase*)module->Assets[0].Get();

View File

@@ -20,7 +20,7 @@ class Actor;
/// </summary>
API_CLASS(Static) class FLAXENGINE_API Particles
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Particles);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(Particles);
/// <summary>
/// The system for Particles update.
@@ -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

@@ -71,7 +71,7 @@ bool ParticleBuffer::Init(ParticleEmitter* emitter)
}
#endif
default:
CRASH;
CRASH;
}
return false;
@@ -107,7 +107,7 @@ bool ParticleBuffer::AllocateSortBuffer()
}
#endif
default:
CRASH;
CRASH;
return true;
}
@@ -133,6 +133,6 @@ void ParticleBuffer::Clear()
}
#endif
default:
CRASH;
CRASH;
}
}

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

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

View File

@@ -11,14 +11,12 @@
/// <seealso cref="Collider" />
API_CLASS() class FLAXENGINE_API BoxCollider : public Collider
{
DECLARE_SCENE_OBJECT(BoxCollider);
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

@@ -14,15 +14,13 @@
/// <seealso cref="Collider" />
API_CLASS() class FLAXENGINE_API CapsuleCollider : public Collider
{
DECLARE_SCENE_OBJECT(CapsuleCollider);
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

@@ -11,9 +11,8 @@
/// <seealso cref="Collider" />
API_CLASS() class FLAXENGINE_API CharacterController : public Collider, public IPhysicsActor
{
DECLARE_SCENE_OBJECT(CharacterController);
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

@@ -17,9 +17,8 @@ class RigidBody;
/// <seealso cref="PhysicsColliderActor" />
API_CLASS(Abstract) class FLAXENGINE_API Collider : public PhysicsColliderActor
{
DECLARE_SCENE_OBJECT_ABSTRACT(Collider);
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

@@ -12,9 +12,8 @@
/// <seealso cref="Collider" />
API_CLASS() class FLAXENGINE_API MeshCollider : public Collider
{
DECLARE_SCENE_OBJECT(MeshCollider);
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

@@ -10,13 +10,11 @@
/// <seealso cref="Collider" />
API_CLASS() class FLAXENGINE_API SphereCollider : public Collider
{
DECLARE_SCENE_OBJECT(SphereCollider);
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

@@ -15,7 +15,7 @@ class Spline;
/// <seealso cref="Spline" />
API_CLASS() class FLAXENGINE_API SplineCollider : public Collider
{
DECLARE_SCENE_OBJECT(SplineCollider);
DECLARE_SCENE_OBJECT(SplineCollider);
private:
Spline* _spline = nullptr;
void* _triangleMesh = nullptr;
@@ -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

@@ -94,7 +94,7 @@ DECLARE_ENUM_OPERATORS(ConvexMeshGenerationFlags);
/// </summary>
API_STRUCT() struct CollisionDataOptions
{
DECLARE_SCRIPTING_TYPE_NO_SPAWN(CollisionDataOptions);
DECLARE_SCRIPTING_TYPE_NO_SPAWN(CollisionDataOptions);
/// <summary>
/// The data type.
@@ -137,9 +137,8 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(CollisionDataOptions);
/// </summary>
API_CLASS(NoSpawn) class FLAXENGINE_API CollisionData : public BinaryAsset
{
DECLARE_BINARY_ASSET_HEADER(CollisionData, 1);
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

@@ -11,7 +11,7 @@ class PhysicsColliderActor;
/// </summary>
API_STRUCT() struct FLAXENGINE_API ContactPoint
{
DECLARE_SCRIPTING_TYPE_MINIMAL(ContactPoint);
DECLARE_SCRIPTING_TYPE_MINIMAL(ContactPoint);
/// <summary>
/// The contact point location in the world space.
@@ -43,7 +43,7 @@ struct TIsPODType<ContactPoint>
/// </summary>
API_STRUCT() struct FLAXENGINE_API Collision
{
DECLARE_SCRIPTING_TYPE_MINIMAL(Collision);
DECLARE_SCRIPTING_TYPE_MINIMAL(Collision);
/// <summary>
/// The first collider (this instance).
@@ -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

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

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

@@ -10,14 +10,12 @@
/// </summary>
API_CLASS() class FLAXENGINE_API PhysicalMaterial final : public ISerializable
{
API_AUTO_SERIALIZATION();
DECLARE_SCRIPTING_TYPE_MINIMAL(PhysicalMaterial);
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

@@ -11,9 +11,8 @@
/// </summary>
API_CLASS(sealed, Namespace="FlaxEditor.Content.Settings", NoConstructor) class FLAXENGINE_API PhysicsSettings : public SettingsBase
{
DECLARE_SCRIPTING_TYPE_MINIMAL(PhysicsSettings);
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>