public class ParticleSystem
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
java.util.ArrayList<Force> |
F
List of Force objects.
|
static java.lang.String[] |
FRAG_SOURCE
Filename of fragment shader source.
|
java.util.ArrayList<Particle> |
P
List of Particle objects.
|
double |
time
Current simulation time.
|
static java.lang.String[] |
VERT_SOURCE
Filename of vertex shader source.
|
Constructor and Description |
---|
ParticleSystem()
Basic constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addForce(Force f)
Adds a force object (until removed)
|
void |
advanceTime(double dt)
Incomplete/Debugging implementation of Forward-Euler
step.
|
Particle |
createParticle(javax.vecmath.Point3d p0)
Creates particle and adds it to the particle system.
|
void |
display(GL2 gl)
Displays Particle and Force objects.
|
Particle |
getNearestParticle(javax.vecmath.Point3d x)
Helper-function that computes nearest particle to the specified
(deformed) position.
|
void |
init(GL2 gl)
Set up the GLSL program.
|
void |
removeForce(Force f)
Useful for removing temporary forces, such as user-interaction
spring forces.
|
void |
reset()
Moves all particles to undeformed/materials positions, and
sets all velocities to zero.
|
public double time
public java.util.ArrayList<Particle> P
public java.util.ArrayList<Force> F
public static final java.lang.String[] VERT_SOURCE
public static final java.lang.String[] FRAG_SOURCE
public void init(GL2 gl)
public void addForce(Force f)
public void removeForce(Force f)
public Particle createParticle(javax.vecmath.Point3d p0)
p0
- Undeformed/material position.public Particle getNearestParticle(javax.vecmath.Point3d x)
public void reset()
public void advanceTime(double dt)
public void display(GL2 gl)