MaplyParticleSystem
@interface MaplyParticleSystem : NSObject
A particle system is used to spawn large numbers of small moving objects.
The particle system defines what the objects are and how they’re controlled. Actual data is handled through the MaplyParticleBatch.
You set up a particle system and then add MaplyParticleBatches via a view controller.
-
Name of the particle system.
The particle system name is used for performance debugging.
Declaration
Objective-C
@property (readwrite, strong, nonatomic) NSString *_Nullable name;
Swift
var name: String? { get set }
-
The type of the particle system.
At present particle systems are just point geometry.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) MaplyParticleSystemType type;
Swift
var type: MaplyParticleSystemType { get set }
-
Name of the shader to use for the particles.
This should be a shader already registered with the toolkit.
Declaration
Objective-C
@property (readwrite, strong, nonatomic) NSString *_Nullable shader;
Swift
var shader: String? { get set }
-
Individual particle lifetime.
The created particles will last only a certain amount of time.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) NSTimeInterval lifetime;
Swift
var lifetime: TimeInterval { get set }
-
The base that particle time is measured from.
Individual particles will measure their own lifetime against this base value.
Declaration
Objective-C
@property (readonly, nonatomic) NSTimeInterval baseTime;
Swift
var baseTime: TimeInterval { get }
-
Total number of particles to be represented at once.
This is the most particles we’ll have on the screen at any time. Space will be allocated for them, so don’t overdo it.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int totalParticles;
Swift
var totalParticles: Int32 { get set }
-
Batch size for MaplyParticleBatch.
Particles need to be created in large batches for efficiency. This is the size of individual batches.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int batchSize;
Swift
var batchSize: Int32 { get set }
-
Turn on/off the continuous rendering for particles.
Normally particle systems force the renderer to draw every frame. That’s how the particles move. You can turn that behavior off by setting this to false.
Declaration
Objective-C
@property (assign, readwrite, nonatomic) _Bool continuousUpdate;
Swift
var continuousUpdate: Bool { get set }
-
Initialize a particle system with a name.
The particle system needs the name for performance and debugging. The rest of the values can left to their defaults.
Declaration
Objective-C
- (nonnull instancetype)initWithName:(NSString *_Nonnull)name;
Swift
init(name: String)
-
Add an attribute we’ll be expecting in each batch.
Adds an attribute name and type which will be present in each batch.
Declaration
Objective-C
- (void)addAttribute:(NSString *_Nonnull)attrName type:(MaplyShaderAttrType)type;
Swift
func addAttribute(_ attrName: String, type: MaplyShaderAttrType)
-
Add a texture to the particle system.
All the textures will be handed over to the shader.
Declaration
Objective-C
- (void)addTexture:(id _Nonnull)image;
Swift
func addTexture(_ image: Any)