blob: 80e5e1d78fce152d38d1bd955a81825cfc63c758 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
package tesseract.generators;
import javax.vecmath.Vector3f;
import tesseract.World;
import tesseract.objects.Particle;
import tesseract.objects.Sphere;
/**
* Generate a field of random particles.
*
* @author jesse
*/
public class ParticleField extends MenuItem {
private static final int FIELD_SIZE = 100;
public ParticleField(World theWorld) {
super("Particle Field", theWorld);
}
/**
* Generate the field.
*
* @param theWorld Where to put them
*/
public void generate(final World theWorld) {
for (int i = 0; i < FIELD_SIZE; i++) {
Vector3f position = new Vector3f((float) Math.random() - 0.5f,
(float) Math.random() - 0.5f, (float) Math.random() - 0.5f);
Particle p = new Particle(position, null);
theWorld.addObject(p);
}
}
}
|