UNPKG

the-world-engine

Version:

three.js based, unity like game engine for browser

1,238 lines (1,237 loc) 45.1 kB
export class b2GrowableBuffer { constructor(allocator: any); data: any[]; count: number; capacity: number; allocator: any; Append(): number; Reserve(newCapacity: any): void; Grow(): void; Free(): void; Shorten(newEnd: any): void; Data(): any[]; GetCount(): number; SetCount(newCount: any): void; GetCapacity(): number; RemoveIf(pred: any): void; Unique(pred: any): void; } export class b2FixtureParticleQueryCallback extends b2QueryCallback { constructor(system: any); m_system: any; ShouldQueryParticleSystem(system: any): boolean; ReportFixture(fixture: any): boolean; ReportParticle(system: any, index: any): boolean; ReportFixtureAndParticle(fixture: any, childIndex: any, index: any): void; } export class b2ParticleContact { indexA: number; indexB: number; weight: number; normal: b2Vec2; flags: number; SetIndices(a: any, b: any): void; SetWeight(w: any): void; SetNormal(n: any): void; SetFlags(f: any): void; GetIndexA(): number; GetIndexB(): number; GetWeight(): number; GetNormal(): b2Vec2; GetFlags(): number; IsEqual(rhs: any): boolean; IsNotEqual(rhs: any): boolean; ApproximatelyEqual(rhs: any): boolean; } export class b2ParticleBodyContact { index: number; weight: number; normal: b2Vec2; mass: number; } export class b2ParticlePair { indexA: number; indexB: number; flags: number; strength: number; distance: number; } export class b2ParticleTriad { indexA: number; indexB: number; indexC: number; flags: number; strength: number; pa: b2Vec2; pb: b2Vec2; pc: b2Vec2; ka: number; kb: number; kc: number; s: number; } export class b2ParticleSystemDef { /** * Enable strict Particle/Body contact check. * See SetStrictContactCheck for details. */ strictContactCheck: boolean; /** * Set the particle density. * See SetDensity for details. */ density: number; /** * Change the particle gravity scale. Adjusts the effect of the * global gravity vector on particles. Default value is 1.0f. */ gravityScale: number; /** * Particles behave as circles with this radius. In Box2D units. */ radius: number; /** * Set the maximum number of particles. * By default, there is no maximum. The particle buffers can * continue to grow while b2World's block allocator still has * memory. * See SetMaxParticleCount for details. */ maxCount: number; /** * Increases pressure in response to compression * Smaller values allow more compression */ pressureStrength: number; /** * Reduces velocity along the collision normal * Smaller value reduces less */ dampingStrength: number; /** * Restores shape of elastic particle groups * Larger values increase elastic particle velocity */ elasticStrength: number; /** * Restores length of spring particle groups * Larger values increase spring particle velocity */ springStrength: number; /** * Reduces relative velocity of viscous particles * Larger values slow down viscous particles more */ viscousStrength: number; /** * Produces pressure on tensile particles * 0~0.2. Larger values increase the amount of surface tension. */ surfaceTensionPressureStrength: number; /** * Smoothes outline of tensile particles * 0~0.2. Larger values result in rounder, smoother, * water-drop-like clusters of particles. */ surfaceTensionNormalStrength: number; /** * Produces additional pressure on repulsive particles * Larger values repulse more * Negative values mean attraction. The range where particles * behave stably is about -0.2 to 2.0. */ repulsiveStrength: number; /** * Produces repulsion between powder particles * Larger values repulse more */ powderStrength: number; /** * Pushes particles out of solid particle group * Larger values repulse more */ ejectionStrength: number; /** * Produces static pressure * Larger values increase the pressure on neighboring partilces * For a description of static pressure, see * http://en.wikipedia.org/wiki/Static_pressure#Static_pressure_in_fluid_dynamics */ staticPressureStrength: number; /** * Reduces instability in static pressure calculation * Larger values make stabilize static pressure with fewer * iterations */ staticPressureRelaxation: number; /** * Computes static pressure more precisely * See SetStaticPressureIterations for details */ staticPressureIterations: number; /** * Determines how fast colors are mixed * 1.0f ==> mixed immediately * 0.5f ==> mixed half way each simulation step (see * b2World::Step()) */ colorMixingStrength: number; /** * Whether to destroy particles by age when no more particles * can be created. See #b2ParticleSystem::SetDestructionByAge() * for more information. */ destroyByAge: boolean; /** * Granularity of particle lifetimes in seconds. By default * this is set to (1.0f / 60.0f) seconds. b2ParticleSystem uses * a 32-bit signed value to track particle lifetimes so the * maximum lifetime of a particle is (2^32 - 1) / (1.0f / * lifetimeGranularity) seconds. With the value set to 1/60 the * maximum lifetime or age of a particle is 2.27 years. */ lifetimeGranularity: number; Copy(def: any): b2ParticleSystemDef; Clone(): b2ParticleSystemDef; } export class b2ParticleSystem { static computeTag(x: any, y: any): number; static computeRelativeTag(tag: any, x: any, y: any): number; static IsSignificantForce(force: any): boolean; static ParticleCanBeConnected(flags: any, group: any): boolean; static ComparePairIndices(a: any, b: any): boolean; static MatchPairIndices(a: any, b: any): boolean; static CompareTriadIndices(a: any, b: any): boolean; static MatchTriadIndices(a: any, b: any): boolean; static InitializeParticleLists(group: any, nodeBuffer: any): void; static MergeParticleLists(listA: any, listB: any): void; static FindLongestParticleList(group: any, nodeBuffer: any): any; static MergeParticleListAndNode(list: any, node: any): void; static b2ParticleContactIsZombie(contact: any): boolean; static BodyContactCompare(lhs: any, rhs: any): boolean; constructor(def: any, world: any); m_paused: boolean; m_timestamp: number; m_allParticleFlags: number; m_needsUpdateAllParticleFlags: boolean; m_allGroupFlags: number; m_needsUpdateAllGroupFlags: boolean; m_hasForce: boolean; m_iterationIndex: number; m_inverseDensity: number; m_particleDiameter: number; m_inverseDiameter: number; m_squaredDiameter: number; m_count: number; m_internalAllocatedCapacity: number; /** * Allocator for b2ParticleHandle instances. */ /** * Maps particle indicies to handles. */ m_handleIndexBuffer: b2ParticleSystem_UserOverridableBuffer; m_flagsBuffer: b2ParticleSystem_UserOverridableBuffer; m_positionBuffer: b2ParticleSystem_UserOverridableBuffer; m_velocityBuffer: b2ParticleSystem_UserOverridableBuffer; m_forceBuffer: any[]; /** * this.m_weightBuffer is populated in ComputeWeight and used in * ComputeDepth(), SolveStaticPressure() and SolvePressure(). */ m_weightBuffer: any[]; /** * When any particles have the flag b2_staticPressureParticle, * this.m_staticPressureBuffer is first allocated and used in * SolveStaticPressure() and SolvePressure(). It will be * reallocated on subsequent CreateParticle() calls. */ m_staticPressureBuffer: any[]; /** * this.m_accumulationBuffer is used in many functions as a temporary * buffer for scalar values. */ m_accumulationBuffer: any[]; /** * When any particles have the flag b2_tensileParticle, * this.m_accumulation2Buffer is first allocated and used in * SolveTensile() as a temporary buffer for vector values. It * will be reallocated on subsequent CreateParticle() calls. */ m_accumulation2Buffer: any[]; /** * When any particle groups have the flag b2_solidParticleGroup, * this.m_depthBuffer is first allocated and populated in * ComputeDepth() and used in SolveSolid(). It will be * reallocated on subsequent CreateParticle() calls. */ m_depthBuffer: any[]; m_colorBuffer: b2ParticleSystem_UserOverridableBuffer; m_groupBuffer: any[]; m_userDataBuffer: b2ParticleSystem_UserOverridableBuffer; /** * Stuck particle detection parameters and record keeping */ m_stuckThreshold: number; m_lastBodyContactStepBuffer: b2ParticleSystem_UserOverridableBuffer; m_bodyContactCountBuffer: b2ParticleSystem_UserOverridableBuffer; m_consecutiveContactStepsBuffer: b2ParticleSystem_UserOverridableBuffer; m_stuckParticleBuffer: b2GrowableBuffer; m_proxyBuffer: b2GrowableBuffer; m_contactBuffer: b2GrowableBuffer; m_bodyContactBuffer: b2GrowableBuffer; m_pairBuffer: b2GrowableBuffer; m_triadBuffer: b2GrowableBuffer; /** * Time each particle should be destroyed relative to the last * time this.m_timeElapsed was initialized. Each unit of time * corresponds to b2ParticleSystemDef::lifetimeGranularity * seconds. */ m_expirationTimeBuffer: b2ParticleSystem_UserOverridableBuffer; /** * List of particle indices sorted by expiration time. */ m_indexByExpirationTimeBuffer: b2ParticleSystem_UserOverridableBuffer; /** * Time elapsed in 32:32 fixed point. Each non-fractional unit * of time corresponds to * b2ParticleSystemDef::lifetimeGranularity seconds. */ m_timeElapsed: number; /** * Whether the expiration time buffer has been modified and * needs to be resorted. */ m_expirationTimeBufferRequiresSorting: boolean; m_groupCount: number; m_groupList: any; m_def: any; m_prev: any; m_next: any; UpdateBodyContacts_callback: b2ParticleSystem_UpdateBodyContactsCallback | null; SolveCollision_callback: b2ParticleSystem_SolveCollisionCallback | null; m_world: any; Drop(): void; /** * Create a particle whose properties have been defined. * * No reference to the definition is retained. * * A simulation step must occur before it's possible to interact * with a newly created particle. For example, * DestroyParticleInShape() will not destroy a particle until * b2World::Step() has been called. * * warning: This function is locked during callbacks. */ CreateParticle(def: any): number; /** * Retrieve a handle to the particle at the specified index. * * Please see #b2ParticleHandle for why you might want a handle. */ GetParticleHandleFromIndex(index: any): any; /** * Destroy a particle. * * The particle is removed after the next simulation step (see * b2World::Step()). * * @param index Index of the particle to destroy. * @param callDestructionListener Whether to call the * destruction listener just before the particle is * destroyed. */ DestroyParticle(index: any, callDestructionListener?: boolean): void; /** * Destroy the Nth oldest particle in the system. * * The particle is removed after the next b2World::Step(). * * @param index 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. * @param callDestructionListener Whether to call the * destruction listener just before the particle is * destroyed. */ DestroyOldestParticle(index: any, callDestructionListener?: boolean): void; /** * Destroy particles inside a shape. * * warning: This function is locked during callbacks. * * In addition, this function immediately destroys particles in * the shape in constrast to DestroyParticle() which defers the * destruction until the next simulation step. * * @return Number of particles destroyed. * @param shape Shape which encloses particles * that should be destroyed. * @param xf Transform applied to the shape. * @param callDestructionListener Whether to call the * world b2DestructionListener for each particle * destroyed. */ DestroyParticlesInShape(shape: any, xf: any, callDestructionListener?: boolean): number; /** * Create a particle group whose properties have been defined. * * No reference to the definition is retained. * * warning: This function is locked during callbacks. */ CreateParticleGroup(groupDef: any): any; /** * Join two particle groups. * * warning: This function is locked during callbacks. * * @param groupA the first group. Expands to encompass the second group. * @param groupB the second group. It is destroyed. */ JoinParticleGroups(groupA: any, groupB: any): void; /** * Split particle group into multiple disconnected groups. * * warning: This function is locked during callbacks. * * @param group the group to be split. */ SplitParticleGroup(group: any): void; /** * Get the world particle group list. With the returned group, * use b2ParticleGroup::GetNext to get the next group in the * world list. * * A null group indicates the end of the list. * * @return the head of the world particle group list. */ GetParticleGroupList(): any; /** * Get the number of particle groups. */ GetParticleGroupCount(): number; /** * Get the number of particles. */ GetParticleCount(): number; /** * Get the maximum number of particles. */ GetMaxParticleCount(): any; /** * Set the maximum number of particles. * * A value of 0 means there is no maximum. The particle buffers * can continue to grow while b2World's block allocator still * has memory. * * Note: If you try to CreateParticle() with more than this * count, b2_invalidParticleIndex is returned unless * SetDestructionByAge() is used to enable the destruction of * the oldest particles in the system. */ SetMaxParticleCount(count: any): void; /** * Get all existing particle flags. */ GetAllParticleFlags(): number; /** * Get all existing particle group flags. */ GetAllGroupFlags(): number; /** * Pause or unpause the particle system. When paused, * b2World::Step() skips over this particle system. All * b2ParticleSystem function calls still work. * * @param paused paused is true to pause, false to un-pause. */ SetPaused(paused: any): void; /** * Initially, true, then, the last value passed into * SetPaused(). * * @return true if the particle system is being updated in b2World::Step(). */ GetPaused(): boolean; /** * Change the particle density. * * Particle density affects the mass of the particles, which in * turn affects how the particles interact with b2Bodies. Note * that the density does not affect how the particles interact * with each other. */ SetDensity(density: any): void; /** * Get the particle density. */ GetDensity(): any; /** * Change the particle gravity scale. Adjusts the effect of the * global gravity vector on particles. */ SetGravityScale(gravityScale: any): void; /** * Get the particle gravity scale. */ GetGravityScale(): any; /** * Damping is used to reduce the velocity of particles. The * damping parameter can be larger than 1.0f but the damping * effect becomes sensitive to the time step when the damping * parameter is large. */ SetDamping(damping: any): void; /** * Get damping for particles */ GetDamping(): any; /** * Change the number of iterations when calculating the static * pressure of particles. By default, 8 iterations. You can * reduce the number of iterations down to 1 in some situations, * but this may cause instabilities when many particles come * together. If you see particles popping away from each other * like popcorn, you may have to increase the number of * iterations. * * For a description of static pressure, see * http://en.wikipedia.org/wiki/Static_pressure#Static_pressure_in_fluid_dynamics */ SetStaticPressureIterations(iterations: any): void; /** * Get the number of iterations for static pressure of * particles. */ GetStaticPressureIterations(): any; /** * Change the particle radius. * * You should set this only once, on world start. * If you change the radius during execution, existing particles * may explode, shrink, or behave unexpectedly. */ SetRadius(radius: any): void; /** * Get the particle radius. */ GetRadius(): number; /** * Get the position of each particle * * Array is length GetParticleCount() * * @return the pointer to the head of the particle positions array. */ GetPositionBuffer(): any; /** * Get the velocity of each particle * * Array is length GetParticleCount() * * @return the pointer to the head of the particle velocities array. */ GetVelocityBuffer(): any; /** * Get the color of each particle * * Array is length GetParticleCount() * * @return the pointer to the head of the particle colors array. */ GetColorBuffer(): any; /** * Get the particle-group of each particle. * * Array is length GetParticleCount() * * @return the pointer to the head of the particle group array. */ GetGroupBuffer(): any[]; /** * Get the weight of each particle * * Array is length GetParticleCount() * * @return the pointer to the head of the particle positions array. */ GetWeightBuffer(): any[]; /** * Get the user-specified data of each particle. * * Array is length GetParticleCount() * * @return the pointer to the head of the particle user-data array. */ GetUserDataBuffer(): any; /** * Get the flags for each particle. See the b2ParticleFlag enum. * * Array is length GetParticleCount() * * @return the pointer to the head of the particle-flags array. */ GetFlagsBuffer(): any; /** * Set flags for a particle. See the b2ParticleFlag enum. */ SetParticleFlags(index: any, newFlags: any): void; /** * Get flags for a particle. See the b2ParticleFlag enum. */ GetParticleFlags(index: any): any; /** * Set an external buffer for particle data. * * Normally, the b2World's block allocator is used for particle * data. However, sometimes you may have an OpenGL or Java * buffer for particle data. To avoid data duplication, you may * supply this external buffer. * * Note that, when b2World's block allocator is used, the * particle data buffers can grow as required. However, when * external buffers are used, the maximum number of particles is * clamped to the size of the smallest external buffer. * * @param buffer a pointer to a block of memory. * @param capacity the number of values in the block. */ SetFlagsBuffer(buffer: any): void; SetPositionBuffer(buffer: any): void; SetVelocityBuffer(buffer: any): void; SetColorBuffer(buffer: any): void; SetUserDataBuffer(buffer: any): void; /** * Get contacts between particles * Contact data can be used for many reasons, for example to * trigger rendering or audio effects. */ GetContacts(): any[]; GetContactCount(): number; /** * Get contacts between particles and bodies * * Contact data can be used for many reasons, for example to * trigger rendering or audio effects. */ GetBodyContacts(): any[]; GetBodyContactCount(): number; /** * Get array of particle pairs. The particles in a pair: * (1) are contacting, * (2) are in the same particle group, * (3) are part of a rigid particle group, or are spring, elastic, * or wall particles. * (4) have at least one particle that is a spring or barrier * particle (i.e. one of the types in k_pairFlags), * (5) have at least one particle that returns true for * ConnectionFilter::IsNecessary, * (6) are not zombie particles. * * Essentially, this is an array of spring or barrier particles * that are interacting. The array is sorted by b2ParticlePair's * indexA, and then indexB. There are no duplicate entries. */ GetPairs(): any[]; GetPairCount(): number; /** * Get array of particle triads. The particles in a triad: * (1) are in the same particle group, * (2) are in a Voronoi triangle together, * (3) are within b2_maxTriadDistance particle diameters of each * other, * (4) return true for ConnectionFilter::ShouldCreateTriad * (5) have at least one particle of type elastic (i.e. one of the * types in k_triadFlags), * (6) are part of a rigid particle group, or are spring, elastic, * or wall particles. * (7) are not zombie particles. * * Essentially, this is an array of elastic particles that are * interacting. The array is sorted by b2ParticleTriad's indexA, * then indexB, then indexC. There are no duplicate entries. */ GetTriads(): any[]; GetTriadCount(): number; /** * 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". Setting to zero or less disables. */ SetStuckThreshold(steps: any): void; /** * 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 */ GetStuckCandidates(): any[]; /** * Get the number of stuck particle candidates from the last * step. */ GetStuckCandidateCount(): number; /** * Compute the kinetic energy that can be lost by damping force */ ComputeCollisionEnergy(): number; /** * Set strict Particle/Body contact check. * * This is an option that will help ensure correct behavior if * there are corners in the world model where Particle/Body * contact is ambiguous. This option scales at n*log(n) of the * number of Particle/Body contacts, so it is best to only * enable if it is necessary for your geometry. Enable if you * see strange particle behavior around b2Body intersections. */ SetStrictContactCheck(enabled: any): void; /** * Get the status of the strict contact check. */ GetStrictContactCheck(): any; /** * Set the lifetime (in seconds) of a particle relative to the * current time. A lifetime of less than or equal to 0.0f * results in the particle living forever until it's manually * destroyed by the application. */ SetParticleLifetime(index: any, lifetime: any): void; /** * Get the lifetime (in seconds) of a particle relative to the * current time. A value > 0.0f is returned if the particle is * scheduled to be destroyed in the future, values <= 0.0f * indicate the particle has an infinite lifetime. */ GetParticleLifetime(index: any): number; /** * Enable / disable destruction of particles in CreateParticle() * when no more particles can be created due to a prior call to * SetMaxParticleCount(). When this is enabled, the oldest * particle is destroyed in CreateParticle() favoring the * destruction of particles with a finite lifetime over * particles with infinite lifetimes. This feature is enabled by * default when particle lifetimes are tracked. Explicitly * enabling this feature using this function enables particle * lifetime tracking. */ SetDestructionByAge(enable: any): void; /** * Get whether the oldest particle will be destroyed in * CreateParticle() when the maximum number of particles are * present in the system. */ GetDestructionByAge(): any; /** * Get the array of particle expiration times indexed by * particle index. * * GetParticleCount() items are in the returned array. */ GetExpirationTimeBuffer(): any; /** * Convert a expiration time value in returned by * GetExpirationTimeBuffer() to a time in seconds relative to * the current simulation time. */ ExpirationTimeToLifetime(expirationTime: any): number; /** * Get the array of particle indices ordered by reverse * lifetime. The oldest particle indexes are at the end of the * array with the newest at the start. Particles with infinite * lifetimes (i.e expiration times less than or equal to 0) are * placed at the start of the array. * ExpirationTimeToLifetime(GetExpirationTimeBuffer()[index]) is * equivalent to GetParticleLifetime(index). * * GetParticleCount() items are in the returned array. */ GetIndexByExpirationTimeBuffer(): any; /** * Apply an impulse to one particle. This immediately modifies * the velocity. Similar to b2Body::ApplyLinearImpulse. * * @param index the particle that will be modified. * @param impulse impulse the world impulse vector, usually in N-seconds or kg-m/s. */ ParticleApplyLinearImpulse(index: any, impulse: any): void; /** * Apply an impulse to all particles between 'firstIndex' and * 'lastIndex'. This immediately modifies the velocity. Note * that the impulse is applied to the total mass of all * particles. So, calling ParticleApplyLinearImpulse(0, impulse) * and ParticleApplyLinearImpulse(1, impulse) will impart twice * as much velocity as calling just ApplyLinearImpulse(0, 1, * impulse). * * @param firstIndex the first particle to be modified. * @param lastIndex the last particle to be modified. * @param impulse the world impulse vector, usually in N-seconds or kg-m/s. */ ApplyLinearImpulse(firstIndex: any, lastIndex: any, impulse: any): void; /** * Apply a force to the center of a particle. * * @param index the particle that will be modified. * @param force the world force vector, usually in Newtons (N). */ ParticleApplyForce(index: any, force: any): void; /** * Distribute a force across several particles. The particles * must not be wall particles. Note that the force is * distributed across all the particles, so calling this * function for indices 0..N is not the same as calling * ParticleApplyForce(i, force) for i in 0..N. * * @param firstIndex the first particle to be modified. * @param lastIndex the last particle to be modified. * @param force the world force vector, usually in Newtons (N). */ ApplyForce(firstIndex: any, lastIndex: any, force: any): void; /** * Get the next particle-system in the world's particle-system * list. */ GetNext(): any; /** * Query the particle system for all particles that potentially * overlap the provided AABB. * b2QueryCallback::ShouldQueryParticleSystem is ignored. * * @param callback a user implemented callback class. * @param aabb the query box. */ QueryAABB(callback: any, aabb: any): void; /** * Query the particle system for all particles that potentially * overlap the provided shape's AABB. Calls QueryAABB * internally. b2QueryCallback::ShouldQueryParticleSystem is * ignored. * * @param callback a user implemented callback class. * @param shape the query shape * @param xf the transform of the AABB * @param childIndex */ QueryShapeAABB(callback: any, shape: any, xf: any, childIndex?: number): void; QueryPointAABB(callback: any, point: any, slop?: number): void; /** * Ray-cast the particle system for all particles in the path of * the ray. Your callback controls whether you get the closest * point, any point, or n-points. The ray-cast ignores particles * that contain the starting point. * b2RayCastCallback::ShouldQueryParticleSystem is ignored. * * @param callback a user implemented callback class. * @param point1 the ray starting point * @param point2 the ray ending point */ RayCast(callback: any, point1: any, point2: any): void; /** * Compute the axis-aligned bounding box for all particles * contained within this particle system. * @param aabb Returns the axis-aligned bounding box of the system. */ ComputeAABB(aabb: any): void; FreeBuffer(b: any, capacity: any): void; FreeUserOverridableBuffer(b: any): void; /** * Reallocate a buffer */ ReallocateBuffer3(oldBuffer: any, oldCapacity: any, newCapacity: any): any; /** * Reallocate a buffer */ ReallocateBuffer5(buffer: any, userSuppliedCapacity: any, oldCapacity: any, newCapacity: any, deferred: any): any; /** * Reallocate a buffer */ ReallocateBuffer4(buffer: any, oldCapacity: any, newCapacity: any, deferred: any): any; RequestBuffer(buffer: any): any; /** * Reallocate the handle / index map and schedule the allocation * of a new pool for handle allocation. */ ReallocateHandleBuffers(newCapacity: any): void; ReallocateInternalAllocatedBuffers(capacity: any): void; CreateParticleForGroup(groupDef: any, xf: any, p: any): void; CreateParticlesStrokeShapeForGroup(shape: any, groupDef: any, xf: any): void; CreateParticlesFillShapeForGroup(shape: any, groupDef: any, xf: any): void; CreateParticlesWithShapeForGroup(shape: any, groupDef: any, xf: any): void; CreateParticlesWithShapesForGroup(shapes: any, shapeCount: any, groupDef: any, xf: any): void; CloneParticle(oldIndex: any, group: any): number; DestroyParticlesInGroup(group: any, callDestructionListener?: boolean): void; DestroyParticleGroup(group: any): void; UpdatePairsAndTriads(firstIndex: any, lastIndex: any, filter: any): void; UpdatePairsAndTriadsWithReactiveParticles(): void; MergeParticleListsInContact(group: any, nodeBuffer: any): void; MergeZombieParticleListNodes(group: any, nodeBuffer: any, survivingList: any): void; CreateParticleGroupsFromParticleList(group: any, nodeBuffer: any, survivingList: any): void; UpdatePairsAndTriadsWithParticleList(group: any, nodeBuffer: any): void; ComputeDepth(): void; GetInsideBoundsEnumerator(aabb: any): b2ParticleSystem_InsideBoundsEnumerator; UpdateAllParticleFlags(): void; UpdateAllGroupFlags(): void; AddContact(a: any, b: any, contacts: any): void; FindContacts_Reference(contacts: any): void; FindContacts(contacts: any): void; UpdateProxies_Reference(proxies: any): void; UpdateProxies(proxies: any): void; SortProxies(proxies: any): void; FilterContacts(contacts: any): void; NotifyContactListenerPreContact(particlePairs: any): void; NotifyContactListenerPostContact(particlePairs: any): void; UpdateContacts(exceptZombie: any): void; NotifyBodyContactListenerPreContact(fixtureSet: any): void; NotifyBodyContactListenerPostContact(fixtureSet: any): void; UpdateBodyContacts(): void; Solve(step: any): void; SolveCollision(step: any): void; LimitVelocity(step: any): void; SolveGravity(step: any): void; SolveBarrier(step: any): void; SolveStaticPressure(step: any): void; ComputeWeight(): void; SolvePressure(step: any): void; SolveDamping(step: any): void; SolveRigidDamping(): void; SolveExtraDamping(): void; SolveWall(): void; SolveRigid(step: any): void; SolveElastic(step: any): void; SolveSpring(step: any): void; SolveTensile(step: any): void; SolveViscous(): void; SolveRepulsive(step: any): void; SolvePowder(step: any): void; SolveSolid(step: any): void; SolveForce(step: any): void; SolveColorMixing(): void; SolveZombie(): void; /** * Destroy all particles which have outlived their lifetimes set * by SetParticleLifetime(). */ SolveLifetimes(step: any): void; RotateBuffer(start: any, mid: any, end: any): void; GetCriticalVelocity(step: any): number; GetCriticalVelocitySquared(step: any): number; GetCriticalPressure(step: any): number; GetParticleStride(): number; GetParticleMass(): number; GetParticleInvMass(): number; /** * Get the world's contact filter if any particles with the * b2_contactFilterParticle flag are present in the system. */ GetFixtureContactFilter(): any; /** * Get the world's contact filter if any particles with the * b2_particleContactFilterParticle flag are present in the * system. */ GetParticleContactFilter(): any; /** * Get the world's contact listener if any particles with the * b2_fixtureContactListenerParticle flag are present in the * system. */ GetFixtureContactListener(): any; /** * Get the world's contact listener if any particles with the * b2_particleContactListenerParticle flag are present in the * system. */ GetParticleContactListener(): any; SetUserOverridableBuffer(buffer: any, data: any): void; SetGroupFlags(group: any, newFlags: any): void; RemoveSpuriousBodyContacts(): void; DetectStuckParticle(particle: any): void; /** * Determine whether a particle index is valid. */ ValidateParticleIndex(index: any): boolean; /** * Get the time elapsed in * b2ParticleSystemDef::lifetimeGranularity. */ GetQuantizedTimeElapsed(): number; /** * Convert a lifetime in seconds to an expiration time. */ LifetimeToExpirationTime(lifetime: any): number; ForceCanBeApplied(flags: any): boolean; PrepareForceBuffer(): void; IsRigidGroup(group: any): boolean; GetLinearVelocity(group: any, particleIndex: any, point: any, out: any): any; InitDampingParameter(invMass: any, invInertia: any, tangentDistance: any, mass: any, inertia: any, center: any, point: any, normal: any): void; InitDampingParameterWithRigidGroupOrParticle(invMass: any, invInertia: any, tangentDistance: any, isRigidGroup: any, group: any, particleIndex: any, point: any, normal: any): void; ComputeDampingImpulse(invMassA: any, invInertiaA: any, tangentDistanceA: any, invMassB: any, invInertiaB: any, tangentDistanceB: any, normalVelocity: any): number; ApplyDamping(invMass: any, invInertia: any, tangentDistance: any, isRigidGroup: any, group: any, particleIndex: any, impulse: any, normal: any): void; } export namespace b2ParticleSystem { const xTruncBits: number; const yTruncBits: number; const tagBits: number; const yOffset: number; const yShift: number; const xShift: number; const xScale: number; const xOffset: number; const yMask: number; const xMask: number; const DestroyParticlesInShape_s_aabb: b2AABB; const CreateParticleGroup_s_transform: b2Transform; const ComputeCollisionEnergy_s_v: b2Vec2; const QueryShapeAABB_s_aabb: b2AABB; const QueryPointAABB_s_aabb: b2AABB; const RayCast_s_aabb: b2AABB; const RayCast_s_p: b2Vec2; const RayCast_s_v: b2Vec2; const RayCast_s_n: b2Vec2; const RayCast_s_point: b2Vec2; const k_pairFlags: b2ParticleFlag; const k_triadFlags: b2ParticleFlag; const k_noPressureFlags: number; const k_extraDampingFlags: b2ParticleFlag; const k_barrierWallFlags: number; const CreateParticlesStrokeShapeForGroup_s_edge: b2EdgeShape; const CreateParticlesStrokeShapeForGroup_s_d: b2Vec2; const CreateParticlesStrokeShapeForGroup_s_p: b2Vec2; const CreateParticlesFillShapeForGroup_s_aabb: b2AABB; const CreateParticlesFillShapeForGroup_s_p: b2Vec2; const UpdatePairsAndTriads_s_dab: b2Vec2; const UpdatePairsAndTriads_s_dbc: b2Vec2; const UpdatePairsAndTriads_s_dca: b2Vec2; const AddContact_s_d: b2Vec2; const UpdateBodyContacts_s_aabb: b2AABB; const Solve_s_subStep: b2TimeStep; const SolveCollision_s_aabb: b2AABB; const SolveGravity_s_gravity: b2Vec2; const SolveBarrier_s_aabb: b2AABB; const SolveBarrier_s_va: b2Vec2; const SolveBarrier_s_vb: b2Vec2; const SolveBarrier_s_pba: b2Vec2; const SolveBarrier_s_vba: b2Vec2; const SolveBarrier_s_vc: b2Vec2; const SolveBarrier_s_pca: b2Vec2; const SolveBarrier_s_vca: b2Vec2; const SolveBarrier_s_qba: b2Vec2; const SolveBarrier_s_qca: b2Vec2; const SolveBarrier_s_dv: b2Vec2; const SolveBarrier_s_f: b2Vec2; const SolvePressure_s_f: b2Vec2; const SolveDamping_s_v: b2Vec2; const SolveDamping_s_f: b2Vec2; const SolveRigidDamping_s_t0: b2Vec2; const SolveRigidDamping_s_t1: b2Vec2; const SolveRigidDamping_s_p: b2Vec2; const SolveRigidDamping_s_v: b2Vec2; const SolveExtraDamping_s_v: b2Vec2; const SolveExtraDamping_s_f: b2Vec2; const SolveRigid_s_position: b2Vec2; const SolveRigid_s_rotation: b2Rot; const SolveRigid_s_transform: b2Transform; const SolveRigid_s_velocityTransform: b2Transform; const SolveElastic_s_pa: b2Vec2; const SolveElastic_s_pb: b2Vec2; const SolveElastic_s_pc: b2Vec2; const SolveElastic_s_r: b2Rot; const SolveElastic_s_t0: b2Vec2; const SolveSpring_s_pa: b2Vec2; const SolveSpring_s_pb: b2Vec2; const SolveSpring_s_d: b2Vec2; const SolveSpring_s_f: b2Vec2; const SolveTensile_s_weightedNormal: b2Vec2; const SolveTensile_s_s: b2Vec2; const SolveTensile_s_f: b2Vec2; const SolveViscous_s_v: b2Vec2; const SolveViscous_s_f: b2Vec2; const SolveRepulsive_s_f: b2Vec2; const SolvePowder_s_f: b2Vec2; const SolveSolid_s_f: b2Vec2; const RemoveSpuriousBodyContacts_s_n: b2Vec2; const RemoveSpuriousBodyContacts_s_pos: b2Vec2; const RemoveSpuriousBodyContacts_s_normal: b2Vec2; } export class b2ParticleSystem_UserOverridableBuffer { _data: any; userSuppliedCapacity: number; set data(arg: any); get data(): any; } export class b2ParticleSystem_Proxy { static CompareProxyProxy(a: any, b: any): boolean; static CompareTagProxy(a: any, b: any): boolean; static CompareProxyTag(a: any, b: any): boolean; index: number; tag: number; } export class b2ParticleSystem_InsideBoundsEnumerator { /** * InsideBoundsEnumerator enumerates all particles inside the * given bounds. * * Construct an enumerator with bounds of tags and a range of * proxies. */ constructor(system: any, lower: any, upper: any, first: any, last: any); m_system: any; m_xLower: number; m_xUpper: number; m_yLower: number; m_yUpper: number; m_first: any; m_last: any; /** * Get index of the next particle. Returns * b2_invalidParticleIndex if there are no more particles. */ GetNext(): any; } export class b2ParticleSystem_ParticleListNode { /** * The next node in the list. */ next: any; /** * Number of entries in the list. Valid only for the node at the * head of the list. */ count: number; /** * Particle index. */ index: number; } /** * @constructor */ export class b2ParticleSystem_FixedSetAllocator { Allocate(itemSize: any, count: any): any; Clear(): void; GetCount(): number; Invalidate(itemIndex: any): void; GetValidBuffer(): never[]; GetBuffer(): never[]; SetCount(count: any): void; } export class b2ParticleSystem_FixtureParticle { constructor(fixture: any, particle: any); second: any; first: any; } export class b2ParticleSystem_FixtureParticleSet extends b2ParticleSystem_FixedSetAllocator { Initialize(bodyContactBuffer: any, flagsBuffer: any): void; Find(pair: any): number; } export class b2ParticleSystem_ParticlePair { constructor(particleA: any, particleB: any); first: any; second: any; } export class b2ParticlePairSet extends b2ParticleSystem_FixedSetAllocator { Initialize(contactBuffer: any, flagsBuffer: any): void; Find(pair: any): number; } export class b2ParticleSystem_ConnectionFilter { /** * Is the particle necessary for connection? * A pair or a triad should contain at least one 'necessary' * particle. */ IsNecessary(index: any): boolean; /** * An additional condition for creating a pair. */ ShouldCreatePair(a: any, b: any): boolean; /** * An additional condition for creating a triad. */ ShouldCreateTriad(a: any, b: any, c: any): boolean; } export class b2ParticleSystem_DestroyParticlesInShapeCallback extends b2QueryCallback { constructor(system: any, shape: any, xf: any, callDestructionListener: any); m_callDestructionListener: any; m_destroyed: number; m_system: any; m_shape: any; m_xf: any; ReportFixture(fixture: any): boolean; ReportParticle(particleSystem: any, index: any): boolean; Destroyed(): number; } export class b2ParticleSystem_JoinParticleGroupsFilter extends b2ParticleSystem_ConnectionFilter { constructor(threshold: any); m_threshold: any; } export class b2ParticleSystem_CompositeShape extends b2Shape { constructor(shapes: any, shapeCount?: any); m_shapeCount: any; m_shapes: any; Clone(): void; /** * @see b2Shape::TestPoint */ TestPoint(xf: any, p: any): boolean; /** * @see b2Shape::ComputeDistance */ ComputeDistance(xf: any, p: any, normal: any, childIndex: any): number; /** * Implement b2Shape. */ RayCast(output: any, input: any, xf: any, childIndex: any): boolean; /** * @see b2Shape::ComputeAABB */ ComputeAABB(aabb: any, xf: any, childIndex: any): void; /** * @see b2Shape::ComputeMass */ ComputeMass(massData: any, density: any): void; SetupDistanceProxy(proxy: any, index: any): void; ComputeSubmergedArea(normal: any, offset: any, xf: any, c: any): number; Dump(log: any): void; } export class b2ParticleSystem_ReactiveFilter extends b2ParticleSystem_ConnectionFilter { constructor(flagsBuffer: any); m_flagsBuffer: any; } export class b2ParticleSystem_UpdateBodyContactsCallback extends b2FixtureParticleQueryCallback { constructor(system: any, contactFilter?: null); m_contactFilter: any; ShouldCollideFixtureParticle(fixture: any, particleSystem: any, particleIndex: any): any; } export namespace b2ParticleSystem_UpdateBodyContactsCallback { const ReportFixtureAndParticle_s_n: b2Vec2; const ReportFixtureAndParticle_s_rp: b2Vec2; } export class b2ParticleSystem_SolveCollisionCallback extends b2FixtureParticleQueryCallback { constructor(system: any, step: any); m_step: any; } export namespace b2ParticleSystem_SolveCollisionCallback { const ReportFixtureAndParticle_s_p1: b2Vec2; const ReportFixtureAndParticle_s_output: b2RayCastOutput; const ReportFixtureAndParticle_s_input: b2RayCastInput; const ReportFixtureAndParticle_s_p: b2Vec2; const ReportFixtureAndParticle_s_v: b2Vec2; const ReportFixtureAndParticle_s_f: b2Vec2; } import { b2QueryCallback } from "../dynamics/b2_world_callbacks.js"; import { b2Vec2 } from "../common/b2_math.js"; import { b2AABB } from "../collision/b2_collision.js"; import { b2Transform } from "../common/b2_math.js"; import { b2ParticleFlag } from "./b2_particle.js"; import { b2EdgeShape } from "../collision/b2_edge_shape.js"; import { b2TimeStep } from "../dynamics/b2_time_step.js"; import { b2Rot } from "../common/b2_math.js"; import { b2Shape } from "../collision/b2_shape.js"; import { b2RayCastOutput } from "../collision/b2_collision.js"; import { b2RayCastInput } from "../collision/b2_collision.js";