summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhillip <pacardon@u.washington.edu>2011-03-08 00:53:24 +0000
committerPhillip <pacardon@u.washington.edu>2011-03-08 00:53:24 +0000
commit47b4b9143bf45e7949d9b01751969d0f8780e004 (patch)
tree62f21cc63ca58d07eda7d69d381c198964b82b46 /src
parentd3b71c17fb5bac19b71ca6a486291bb65c55bec6 (diff)
Diffstat (limited to 'src')
-rw-r--r--src/tesseract/objects/Particle.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/tesseract/objects/Particle.java b/src/tesseract/objects/Particle.java
index 0edba3d..4977e39 100644
--- a/src/tesseract/objects/Particle.java
+++ b/src/tesseract/objects/Particle.java
@@ -4,6 +4,8 @@ import java.awt.Color;
import javax.media.j3d.Appearance;
import javax.media.j3d.ColoringAttributes;
+import javax.media.j3d.Material;
+import javax.media.j3d.Shape3D;
import javax.media.j3d.TransformGroup;
import javax.vecmath.Color3f;
import javax.vecmath.Vector3f;
@@ -62,6 +64,7 @@ public class Particle extends PhysicalObject {
* @return A sphere to visually represent the particle.
*/
private TransformGroup createShape(final Color3f theColor) {
+
Color3f color = theColor;
ColoringAttributes cAttr;
@@ -70,16 +73,35 @@ public class Particle extends PhysicalObject {
Color randomColor = Color.getHSBColor((float) Math.random(), 1, 1);
color = new Color3f(randomColor);
}
-
+ /*
cAttr = new ColoringAttributes(color, ColoringAttributes.FASTEST);
Appearance appearance = new Appearance();
+ Material mat = new Material();
+ mat.setAmbientColor(color);
+ mat.setDiffuseColor(color);
+ appearance.setMaterial(mat);
appearance.setColoringAttributes(cAttr);
+
Sphere sphere = new Sphere(RADIUS, Sphere.ENABLE_GEOMETRY_PICKING,
DIVISIONS, appearance);
+ */
+
+ Sphere sphere = new Sphere(RADIUS, Sphere.ENABLE_GEOMETRY_PICKING,
+ DIVISIONS);
+ Shape3D shape = sphere.getShape();
+ sphere.removeAllChildren();
+ Appearance meshApp = new Appearance();
+ Material surface = new Material();
+ surface.setDiffuseColor(color);
+ meshApp.setMaterial(surface);
+ meshApp.setColoringAttributes(new ColoringAttributes(color,
+ ColoringAttributes.FASTEST));
+ shape.setAppearance(meshApp);
+
TransformGroup tg = new TransformGroup();
tg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
tg.setCapability(TransformGroup.ENABLE_PICK_REPORTING);
- tg.addChild(sphere);
+ tg.addChild(shape);
return tg;
}
}