// Copyright (c) Craftwork Games. All rights reserved.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
using System.Runtime.InteropServices;
namespace MonoGame.Extended.Particles.Data;
///
/// Represents an individual particle within the particle system.
///
///
/// The struct uses sequential layout with tight packing to optimize memory usage and performance.
/// The fixed arrays are used to store positional, velocity, and color data efficiently in unmanaged memory.
///
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public unsafe struct Particle
{
///
/// The time (in seconds) when this particle was created.
///
public float Inception;
///
/// The current age (in seconds) of this particle.
///
public float Age;
///
/// The current position of this particle in 2D space [X, Y].
///
public fixed float Position[2];
///
/// The current velocity vector of this particle [X, Y].
///
public fixed float Velocity[2];
///
/// The color of this particle in RGB format [R, G, B].
///
public fixed float Color[3];
///
/// The scale factor applied to this particle's visual representation.
///
public fixed float Scale[2];
///
/// The position where this particle was triggered or emitted from [X, Y].
///
public fixed float TriggeredPos[2];
///
/// The opacity (alpha) value of this particle, ranging from 0.0 (transparent) to 1.0 (opaque).
///
public float Opacity;
///
/// The rotation of this particle in radians.
///
public float Rotation;
///
/// The mass of this particle used during physics calculations.
///
public float Mass;
///
/// The depth at which this particle is rendered, used for layering particles.
///
///
/// Values range from 0.0 (front) to 1.0 (back).
///
public float LayerDepth;
///
/// The size of the struct in bytes.
///
///
/// Used for memory allocations and buffer operations.
///
public static readonly int SizeInBytes = Marshal.SizeOf();
}