@NoOffset @Properties(inherit=liquidfun.class) public class b2ParticleSystem extends Pointer
Pointer.CustomDeallocator, Pointer.Deallocator, Pointer.NativeDeallocator, Pointer.ReferenceCounter
Modifier and Type | Field and Description |
---|---|
static int |
b2_bufferTooSmall
enum b2ParticleSystem::b2ExceptionType
|
static int |
b2_noExceptions
enum b2ParticleSystem::b2ExceptionType
|
static int |
b2_numErrors
enum b2ParticleSystem::b2ExceptionType
|
static int |
b2_particleIndexOutOfBounds
enum b2ParticleSystem::b2ExceptionType
|
Constructor and Description |
---|
b2ParticleSystem(Pointer p)
Pointer cast constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
ApplyForce(int firstIndex,
int lastIndex,
b2Vec2 force)
Distribute a force across several particles.
|
void |
ApplyLinearImpulse(int firstIndex,
int lastIndex,
b2Vec2 impulse)
Apply an impulse to all particles between 'firstIndex' and 'lastIndex'.
|
void |
ComputeAABB(b2AABB aabb)
Compute the axis-aligned bounding box for all particles contained
within this particle system.
|
float |
ComputeCollisionEnergy()
Compute the kinetic energy that can be lost by damping force
|
int |
CopyColorBuffer(int startIndex,
int numParticles,
Pointer outBuf,
int size)
Copy color buffer into a specified buffer, starting from startIndex.
|
int |
CopyPositionBuffer(int startIndex,
int numParticles,
Pointer outBuf,
int size)
Copy position buffer into a specified buffer, starting from startIndex.
|
int |
CopyWeightBuffer(int startIndex,
int numParticles,
Pointer outBuf,
int size)
Copy color buffer into a specified buffer, starting from startIndex.
|
int |
CreateParticle(b2ParticleDef def)
Create a particle whose properties have been defined.
|
b2ParticleGroup |
CreateParticleGroup(b2ParticleGroupDef def)
Create a particle group whose properties have been defined.
|
void |
DestroyOldestParticle(int index,
boolean callDestructionListener)
Destroy the Nth oldest particle in the system.
|
void |
DestroyParticle(int index)
Destroy a particle.
|
void |
DestroyParticle(int index,
boolean callDestructionListener)
Destroy a particle.
|
int |
DestroyParticlesInShape(b2Shape shape,
b2Transform xf)
Destroy particles inside a shape without enabling the destruction
callback for destroyed particles.
|
int |
DestroyParticlesInShape(b2Shape shape,
b2Transform xf,
boolean callDestructionListener)
Destroy particles inside a shape.
|
float |
ExpirationTimeToLifetime(int expirationTime)
Convert a expiration time value in returned by
GetExpirationTimeBuffer() to a time in seconds relative to the
current simulation time.
|
long |
GetAllGroupFlags()
Get all existing particle group flags.
|
long |
GetAllParticleFlags()
Get all existing particle flags.
|
int |
GetBodyContactCount() |
b2ParticleBodyContact |
GetBodyContacts()
Get contacts between particles and bodies
Contact data can be used for many reasons, for example to trigger
rendering or audio effects.
|
b2ParticleColor |
GetColorBuffer()
Get the color of each particle
Array is length GetParticleCount()
|
int |
GetContactCount() |
b2ParticleContact |
GetContacts()
Get contacts between particles
Contact data can be used for many reasons, for example to trigger
rendering or audio effects.
|
float |
GetDamping()
Get damping for particles
|
float |
GetDensity()
Get the particle density.
|
boolean |
GetDestructionByAge()
Get whether the oldest particle will be destroyed in CreateParticle()
when the maximum number of particles are present in the system.
|
IntPointer |
GetExpirationTimeBuffer()
Get the array of particle expiration times indexed by particle index.
|
IntPointer |
GetFlagsBuffer()
Get the flags for each particle.
|
float |
GetGravityScale()
Get the particle gravity scale.
|
PointerPointer |
GetGroupBuffer()
Get the particle-group of each particle.
|
IntPointer |
GetIndexByExpirationTimeBuffer()
Get the array of particle indices ordered by reverse lifetime.
|
int |
GetMaxParticleCount()
Get the maximum number of particles.
|
b2ParticleSystem |
GetNext()
Get the next particle-system in the world's particle-system list.
|
int |
GetPairCount() |
b2ParticlePair |
GetPairs()
Get array of particle pairs.
|
int |
GetParticleCount()
Get the number of particles.
|
long |
GetParticleFlags(int index)
Get flags for a particle.
|
int |
GetParticleGroupCount()
Get the number of particle groups.
|
b2ParticleGroup |
GetParticleGroupList()
Get the world particle group list.
|
b2ParticleHandle |
GetParticleHandleFromIndex(int index)
Retrieve a handle to the particle at the specified index.
|
float |
GetParticleLifetime(int index)
Get the lifetime (in seconds) of a particle relative to the current
time.
|
float |
GetParticlePositionX(int index)
Get the x-coordinate of particle at index.
|
float |
GetParticlePositionY(int index)
Get the y-coordinate of particle at index.
|
boolean |
GetPaused() |
b2Vec2 |
GetPositionBuffer()
Get the position of each particle
Array is length GetParticleCount()
|
float |
GetRadius()
Get the particle radius.
|
int |
GetStaticPressureIterations()
Get the number of iterations for static pressure of particles.
|
boolean |
GetStrictContactCheck()
Get the status of the strict contact check.
|
int |
GetStuckCandidateCount()
Get the number of stuck particle candidates from the last step.
|
IntPointer |
GetStuckCandidates()
Get potentially stuck particles from the last step; the user must
decide if they are stuck or not, and if so, delete or move them
|
int |
GetTriadCount() |
b2ParticleTriad |
GetTriads()
Get array of particle triads.
|
PointerPointer |
GetUserDataBuffer()
Get the user-specified data of each particle.
|
b2Vec2 |
GetVelocityBuffer()
Get the velocity of each particle
Array is length GetParticleCount()
|
FloatPointer |
GetWeightBuffer()
Get the weight of each particle
Array is length GetParticleCount()
|
void |
JoinParticleGroups(b2ParticleGroup groupA,
b2ParticleGroup groupB)
Join two particle groups.
|
void |
ParticleApplyForce(int index,
b2Vec2 force)
Apply a force to the center of a particle.
|
void |
ParticleApplyLinearImpulse(int index,
b2Vec2 impulse)
Apply an impulse to one particle.
|
void |
QueryAABB(b2QueryCallback callback,
b2AABB aabb)
Query the particle system for all particles that potentially overlap
the provided AABB.
|
void |
QueryShapeAABB(b2QueryCallback callback,
b2Shape shape,
b2Transform xf)
Query the particle system for all particles that potentially overlap
the provided shape's AABB.
|
void |
RayCast(b2RayCastCallback callback,
b2Vec2 point1,
b2Vec2 point2)
Ray-cast the particle system for all particles in the path of the ray.
|
void |
SetColorBuffer(b2ParticleColor buffer,
int _capacity) |
void |
SetDamping(float damping)
Damping is used to reduce the velocity of particles.
|
void |
SetDensity(float density)
Change the particle density.
|
void |
SetDestructionByAge(boolean enable)
Enable / disable destruction of particles in CreateParticle() when
no more particles can be created due to a prior call to
SetMaxParticleCount().
|
void |
SetFlagsBuffer(int[] buffer,
int _capacity) |
void |
SetFlagsBuffer(IntBuffer buffer,
int _capacity) |
void |
SetFlagsBuffer(IntPointer buffer,
int _capacity)
Set an external buffer for particle data.
|
void |
SetGravityScale(float gravityScale)
Change the particle gravity scale.
|
void |
SetMaxParticleCount(int count)
Set the maximum number of particles.
|
void |
SetParticleFlags(int index,
long flags)
Set flags for a particle.
|
void |
SetParticleLifetime(int index,
float lifetime)
Set the lifetime (in seconds) of a particle relative to the current
time.
|
void |
SetParticleVelocity(int index,
float vx,
float vy)
Set the velocity of particle at index with direct floats.
|
void |
SetPaused(boolean paused)
Pause or unpause the particle system.
|
void |
SetPositionBuffer(b2Vec2 buffer,
int _capacity) |
void |
SetRadius(float radius)
Change the particle radius.
|
void |
SetStaticPressureIterations(int iterations)
Change the number of iterations when calculating the static pressure of
particles.
|
void |
SetStrictContactCheck(boolean enabled)
Set strict Particle/Body contact check.
|
void |
SetStuckThreshold(int iterations)
Set an optional threshold for the maximum number of
consecutive particle iterations that a particle may contact
multiple bodies before it is considered a candidate for being
"stuck".
|
void |
SetUserDataBuffer(Pointer buffer,
int _capacity) |
void |
SetUserDataBuffer(PointerPointer buffer,
int _capacity) |
void |
SetVelocityBuffer(b2Vec2 buffer,
int _capacity) |
void |
SplitParticleGroup(b2ParticleGroup group)
Split particle group into multiple disconnected groups.
|
address, asBuffer, asByteBuffer, availablePhysicalBytes, calloc, capacity, capacity, close, deallocate, deallocate, deallocateReferences, deallocator, deallocator, equals, fill, formatBytes, free, getDirectBufferAddress, getPointer, getPointer, getPointer, getPointer, hashCode, interruptDeallocatorThread, isNull, isNull, limit, limit, malloc, maxBytes, maxPhysicalBytes, memchr, memcmp, memcpy, memmove, memset, offsetAddress, offsetof, offsetof, parseBytes, physicalBytes, physicalBytesInaccurate, position, position, put, realloc, referenceCount, releaseReference, retainReference, setNull, sizeof, sizeof, toString, totalBytes, totalCount, totalPhysicalBytes, withDeallocator, zero
public static final int b2_bufferTooSmall
public static final int b2_particleIndexOutOfBounds
public static final int b2_numErrors
public static final int b2_noExceptions
public b2ParticleSystem(Pointer p)
Pointer(Pointer)
.@Cast(value="int32") public int CreateParticle(@Const @ByRef b2ParticleDef def)
@Const public b2ParticleHandle GetParticleHandleFromIndex(@Cast(value="const int32") int index)
public void DestroyParticle(@Cast(value="int32") int index)
public void DestroyParticle(@Cast(value="int32") int index, @Cast(value="bool") boolean callDestructionListener)
Index
- of the particle to destroy.Whether
- to call the destruction listener just before the
particle is destroyed.public void DestroyOldestParticle(@Cast(value="const int32") int index, @Cast(value="const bool") boolean callDestructionListener)
Index
- of the Nth oldest particle to destroy, 0 will destroy the
oldest particle in the system, 1 will destroy the next oldest
particle etc.Whether
- to call the destruction listener just before the
particle is destroyed.@Cast(value="int32") public int DestroyParticlesInShape(@Const @ByRef b2Shape shape, @Const @ByRef b2Transform xf)
Shape
- which encloses particles that should be destroyed.Transform
- applied to the shape.
\warning This function is locked during callbacks.@Cast(value="int32") public int DestroyParticlesInShape(@Const @ByRef b2Shape shape, @Const @ByRef b2Transform xf, @Cast(value="bool") boolean callDestructionListener)
Shape
- which encloses particles that should be destroyed.Transform
- applied to the shape.Whether
- to call the world b2DestructionListener for each
particle destroyed.
\warning This function is locked during callbacks.public b2ParticleGroup CreateParticleGroup(@Const @ByRef b2ParticleGroupDef def)
public void JoinParticleGroups(b2ParticleGroup groupA, b2ParticleGroup groupB)
the
- first group. Expands to encompass the second group.the
- second group. It is destroyed.
\warning This function is locked during callbacks.public void SplitParticleGroup(b2ParticleGroup group)
the
- group to be split.
\warning This function is locked during callbacks.public b2ParticleGroup GetParticleGroupList()
@Cast(value="int32") public int GetParticleGroupCount()
@Cast(value="int32") public int GetMaxParticleCount()
public void SetMaxParticleCount(@Cast(value="int32") int count)
@Cast(value="uint32") public long GetAllParticleFlags()
@Cast(value="uint32") public long GetAllGroupFlags()
public void SetPaused(@Cast(value="bool") boolean paused)
paused
- is true to pause, false to un-pause.@Cast(value="bool") public boolean GetPaused()
public void SetDensity(@Cast(value="float32") float density)
public void SetGravityScale(@Cast(value="float32") float gravityScale)
@Cast(value="float32") public float GetGravityScale()
public void SetDamping(@Cast(value="float32") float damping)
public void SetStaticPressureIterations(@Cast(value="int32") int iterations)
@Cast(value="int32") public int GetStaticPressureIterations()
public void SetRadius(@Cast(value="float32") float radius)
public b2Vec2 GetPositionBuffer()
public b2Vec2 GetVelocityBuffer()
public b2ParticleColor GetColorBuffer()
@Cast(value="b2ParticleGroup*const*") public PointerPointer GetGroupBuffer()
@Cast(value="float32*") public FloatPointer GetWeightBuffer()
@Cast(value="void**") public PointerPointer GetUserDataBuffer()
@Cast(value="const uint32*") public IntPointer GetFlagsBuffer()
public void SetParticleFlags(@Cast(value="int32") int index, @Cast(value="uint32") long flags)
@Cast(value="uint32") public long GetParticleFlags(@Cast(value="const int32") int index)
public void SetFlagsBuffer(@Cast(value="uint32*") IntPointer buffer, @Cast(value="int32") int _capacity)
buffer
- is a pointer to a block of memory.size
- is the number of values in the block.public void SetFlagsBuffer(@Cast(value="uint32*") IntBuffer buffer, @Cast(value="int32") int _capacity)
public void SetFlagsBuffer(@Cast(value="uint32*") int[] buffer, @Cast(value="int32") int _capacity)
public void SetColorBuffer(b2ParticleColor buffer, @Cast(value="int32") int _capacity)
public void SetUserDataBuffer(@Cast(value="void**") PointerPointer buffer, @Cast(value="int32") int _capacity)
public void SetUserDataBuffer(@Cast(value="void**") @ByPtrPtr Pointer buffer, @Cast(value="int32") int _capacity)
@Const public b2ParticleContact GetContacts()
@Const public b2ParticleBodyContact GetBodyContacts()
@Const public b2ParticlePair GetPairs()
@Const public b2ParticleTriad GetTriads()
public void SetStuckThreshold(@Cast(value="int32") int iterations)
@Cast(value="const int32*") public IntPointer GetStuckCandidates()
@Cast(value="int32") public int GetStuckCandidateCount()
@Cast(value="float32") public float ComputeCollisionEnergy()
public void SetStrictContactCheck(@Cast(value="bool") boolean enabled)
@Cast(value="bool") public boolean GetStrictContactCheck()
public void SetParticleLifetime(@Cast(value="const int32") int index, @Cast(value="const float32") float lifetime)
@Cast(value="float32") public float GetParticleLifetime(@Cast(value="const int32") int index)
public void SetDestructionByAge(@Cast(value="const bool") boolean enable)
@Cast(value="bool") public boolean GetDestructionByAge()
@Cast(value="const int32*") public IntPointer GetExpirationTimeBuffer()
@Cast(value="float32") public float ExpirationTimeToLifetime(@Cast(value="const int32") int expirationTime)
@Cast(value="const int32*") public IntPointer GetIndexByExpirationTimeBuffer()
public void ParticleApplyLinearImpulse(@Cast(value="int32") int index, @Const @ByRef b2Vec2 impulse)
index
- the particle that will be modified.impulse
- the world impulse vector, usually in N-seconds or
kg-m/s.public void ApplyLinearImpulse(@Cast(value="int32") int firstIndex, @Cast(value="int32") int lastIndex, @Const @ByRef b2Vec2 impulse)
firstIndex
- the first particle to be modified.lastIndex
- the last particle to be modified.impulse
- the world impulse vector, usually in N-seconds or
kg-m/s.public void ParticleApplyForce(@Cast(value="int32") int index, @Const @ByRef b2Vec2 force)
index
- the particle that will be modified.force
- the world force vector, usually in Newtons (N).public void ApplyForce(@Cast(value="int32") int firstIndex, @Cast(value="int32") int lastIndex, @Const @ByRef b2Vec2 force)
firstIndex
- the first particle to be modified.lastIndex
- the last particle to be modified.force
- the world force vector, usually in Newtons (N).public b2ParticleSystem GetNext()
public void QueryAABB(b2QueryCallback callback, @Const @ByRef b2AABB aabb)
callback
- a user implemented callback class.aabb
- the query box.public void QueryShapeAABB(b2QueryCallback callback, @Const @ByRef b2Shape shape, @Const @ByRef b2Transform xf)
callback
- a user implemented callback class.shape
- the query shapexf
- the transform of the AABBpublic void RayCast(b2RayCastCallback callback, @Const @ByRef b2Vec2 point1, @Const @ByRef b2Vec2 point2)
callback
- a user implemented callback class.point1
- the ray starting pointpoint2
- the ray ending pointpublic void ComputeAABB(b2AABB aabb)
aabb
- Returns the axis-aligned bounding box of the system.public void SetParticleVelocity(@Cast(value="int32") int index, @Cast(value="float32") float vx, @Cast(value="float32") float vy)
public float GetParticlePositionX(@Cast(value="int32") int index)
public float GetParticlePositionY(@Cast(value="int32") int index)
public int CopyPositionBuffer(int startIndex, int numParticles, Pointer outBuf, int size)
public int CopyColorBuffer(int startIndex, int numParticles, Pointer outBuf, int size)
public int CopyWeightBuffer(int startIndex, int numParticles, Pointer outBuf, int size)
Copyright © 2022. All rights reserved.