From 7bf857f863ee3ad28b239abd23694395e4eef051 Mon Sep 17 00:00:00 2001 From: Steve Date: Fri, 18 Mar 2011 04:17:57 +0000 Subject: modified appearance structure of fin still not serialzing color --- src/tesseract/objects/blimp/Blimp.java | 31 ++----------------------------- src/tesseract/objects/blimp/BlimpFin.java | 17 +++++++---------- 2 files changed, 9 insertions(+), 39 deletions(-) diff --git a/src/tesseract/objects/blimp/Blimp.java b/src/tesseract/objects/blimp/Blimp.java index 3d044e2..9c1c16a 100644 --- a/src/tesseract/objects/blimp/Blimp.java +++ b/src/tesseract/objects/blimp/Blimp.java @@ -152,35 +152,8 @@ public class Blimp extends RemoteObject { vectors = gi.getNormals(); //fin1 - /*TextureLoader tl = new TextureLoader("lava.jpg", null); - ImageComponent2D image = tl.getImage(); - int width = image.getWidth(); - int height = image.getHeight(); - Texture2D texture = new Texture2D(Texture.MULTI_LEVEL_MIPMAP, Texture.RGB, width, height); - - int imageLevel = 0; - texture.setImage(imageLevel, image); - while (width > 1 || height > 1) { - imageLevel++; - if (width > 1) width /= 2; - if (height > 1) height /= 2; - texture.setImage(imageLevel, tl.getScaledImage(width, height)); - } - texture.setMagFilter(Texture2D.NICEST); - texture.setMinFilter(Texture2D.NICEST);*/ - //Material mat = new Material(); - ///mat.setDiffuseColor(1, 1, 1); - - Appearance appearance = new Appearance(); - //appearance.setTexture(texture); - //appearance.setMaterial(mat); - - appearance.setColoringAttributes(new ColoringAttributes(new Color3f(.1f,.1f,.3f), - ColoringAttributes.FASTEST)); - - BlimpFin fin = new BlimpFin(1, new Vector3f(0f * my_scale, - 0f * my_scale, -.165f * my_scale), .1f * my_scale, appearance); + 0f * my_scale, -.165f * my_scale), .1f * my_scale); Transform3D rotate = new Transform3D(); rotate.rotZ(Math.PI / 2); TransformGroup tgFin = new TransformGroup(rotate); @@ -190,7 +163,7 @@ public class Blimp extends RemoteObject { //fin2 BlimpFin fin2 = new BlimpFin(1, new Vector3f(0f * my_scale, - 0f * my_scale, -.165f * my_scale), .1f * my_scale, appearance); + 0f * my_scale, -.165f * my_scale), .1f * my_scale); Transform3D rotate2 = new Transform3D(); //rotate2.rotZ(Math.PI / 2); TransformGroup tgFin2 = new TransformGroup(rotate2); diff --git a/src/tesseract/objects/blimp/BlimpFin.java b/src/tesseract/objects/blimp/BlimpFin.java index 4de5b09..9d62bd8 100644 --- a/src/tesseract/objects/blimp/BlimpFin.java +++ b/src/tesseract/objects/blimp/BlimpFin.java @@ -8,6 +8,7 @@ package tesseract.objects.blimp; import javax.media.j3d.Appearance; +import javax.media.j3d.ColoringAttributes; import javax.media.j3d.Geometry; import javax.media.j3d.ImageComponent2D; import javax.media.j3d.Material; @@ -44,11 +45,6 @@ public class BlimpFin extends PhysicalObject { */ public static final int DEFAULT_DIVISIONS = 4; - /** - * The appearance of this fin - */ - private Appearance my_appearance; - /** * Create a new Ellipsoid. * @@ -58,11 +54,9 @@ public class BlimpFin extends PhysicalObject { * @param divisions an in for the shape divisions. */ public BlimpFin( final float mass, final Vector3f position, - final float radius, final Appearance appearance) { + final float radius) { super(position, mass); - my_appearance = appearance; - setShape(createShape(radius, DEFAULT_DIVISIONS)); /*if (inverseMass != 0) { @@ -96,11 +90,14 @@ public class BlimpFin extends PhysicalObject { new NormalGenerator().generateNormals(gInfo); gInfo.convertToIndexedTriangles(); Shape3D fin = new Shape3D(gInfo.getGeometryArray()); + Appearance appearance = new Appearance(); + appearance.setColoringAttributes(new ColoringAttributes(new Color3f(.1f,.1f,.3f), + ColoringAttributes.FASTEST)); PolygonAttributes polyAttr = new PolygonAttributes(PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0); - my_appearance.setPolygonAttributes(polyAttr); + appearance.setPolygonAttributes(polyAttr); geometry.setCapability(Geometry.ALLOW_INTERSECT); - fin = new Shape3D(geometry, my_appearance); + fin = new Shape3D(geometry, appearance); Transform3D rotate = new Transform3D(); rotate.rotY(Math.PI / 4); TransformGroup tg = new TransformGroup(rotate); -- cgit v1.2.3