MaplyParticleBatch
Objective-C
@interface MaplyParticleBatch : NSObject
Swift
class MaplyParticleBatch : NSObject
A particle batch adds a set number of particles to the system.
The particle batch holds the number of particles defined in the MaplyParticleSystem batchSize property. Each attribute array is added individually via an NSData object. All attributes must be present or the batch is invalid and won’t be passed through the system.
-
The particle system this batch belongs to.
Declaration
Objective-C
@property (nonatomic, weak) MaplyParticleSystem *_Nullable partSys;
Swift
weak var partSys: MaplyParticleSystem? { get set }
-
The current time.
This will be set by default. However, you can control what the time basis for a particle batch is.
Declaration
Objective-C
@property (nonatomic) NSTimeInterval time;
Swift
var time: TimeInterval { get set }
-
Initialize with the particle system.
The batch is initialized with its particle system. You must then call addAttribute:values: repeatedly with attribute arrays.
Declaration
Objective-C
- (nonnull instancetype)initWithParticleSystem: (MaplyParticleSystem *_Nonnull)partSys;
Swift
init(particleSystem partSys: MaplyParticleSystem)
-
OpenGL ES only.
Add an attribute array of the given name.
Each attribute in the MaplyParticleSystem must be filled in here. The name must correspond and the length of the data must match.
Declaration
Objective-C
- (_Bool)addAttribute:(NSString *_Nonnull)attrName values:(NSData *_Nonnull)data;
Swift
func addAttribute(_ attrName: String, values data: Data) -> Bool
Return Value
Returns true if the attribute array was valid, false otherwise.
-
Metal only.
We add the batch as a single blob of data. Format is up to you and your shader.
Declaration
Objective-C
- (void)addData:(NSData *_Nonnull)data;
Swift
func add(_ data: Data)
-
Tests if the batch is valid.
This checks if all the attribute arrays are present and valid.
Declaration
Objective-C
- (_Bool)isValid;
Swift
func isValid() -> Bool