pues eso, llevo varios dias intentandolo
ya he visto consejos de estos links
http://stackoverflow.com/questions/2245253/java-3d-unable-to-get-shape3d-to-be-affected-by-lights
http://stackoverflow.com/questions/4657504/java3d-lighting-problem
http://www.vrupl.evl.uic.edu/LabAccidents/java3d/lesson10/indexb.html
pero no hay manera
las figuras prefabricadas como las esferas, cubos etc, si les afecta la luz, pero las figuras que creo yo con shapes no les afecta la luz
he probado ya bastantes cosas, en el mismo branchgroup y en otra rama distinta, me rindo, espero que me ayuden y gracias de antemano :(
Aqui el codigo del Universo
private BranchGroup root = new BranchGroup();
private void _initialize() {
getViewingPlatform().setNominalViewingTransform();
addBranchGraph(root);
BranchGroup g = new BranchGroup();
Shape3D s = new UnisexBreastShape3D();
DirectionalLight l
= new DirectionalLight
(true,
new Color3f
(Color.
white),
new Vector3f
(-1,
-1,
-1)); AmbientLight a
= new AmbientLight
(true,
new Color3f
(Color.
white)); BoundingSphere sph = new BoundingSphere(new Point3d(0d,0d,0d),100d);
l.setInfluencingBounds(sph);
a.setInfluencingBounds(sph);
g.addChild(s);
g.addChild(l);
g.addChild(a);
root.addChild(g);
Y aqui el codigo del shape, por cierto, que disfruten de mi clase shape3d
QuadArray quad = new QuadArray(4*22, QuadArray.NORMALS | QuadArray.COORDINATES | QuadArray.COLOR_4 | QuadArray.ALLOW_COLOR_READ | QuadArray.ALLOW_COLOR_WRITE | QuadArray.ALLOW_COORDINATE_READ | QuadArray.ALLOW_COORDINATE_WRITE | QuadArray.ALLOW_TEXCOORD_READ | QuadArray.ALLOW_TEXCOORD_WRITE);
quad.setCoordinates(0, new Point3d[]{
new Point3d(-0.8, 0.6, 0.2),
new Point3d(-0.6, -0.4, 0.2),
new Point3d(0.0, -0.4, 0.4),
new Point3d(0.0, 0.4, 0.4),
new Point3d(0.9, 0.8, -0.1),
new Point3d(0.7, -0.4, 0.0),
new Point3d(0.7, -0.4, -0.15),
new Point3d(0.9, 0.8, -0.25),
new Point3d(-0.9, 0.8, -0.25),
new Point3d(-0.7, -0.4, -0.15),
new Point3d(-0.7, -0.4, 0.0),
new Point3d(-0.9, 0.8, -0.1),
new Point3d(0.8, 0.6, 0.2),
new Point3d(0.6, -0.4, 0.2),
new Point3d(0.7, -0.4, 0.0),
new Point3d(0.9, 0.8, -0.1),
new Point3d(-0.9, 0.8, -0.1),
new Point3d(-0.7, -0.4, 0.0),
new Point3d(-0.6, -0.4, 0.2),
new Point3d(-0.8, 0.6, 0.2),
new Point3d(-0.75, 0.6, -0.4),
new Point3d(-0.6, -0.4, -0.3),
new Point3d(-0.7, -0.4, -0.15),
new Point3d(-0.9, 0.8, -0.25),
new Point3d(0.75, 0.6, -0.4),
new Point3d(0.6, -0.4, -0.3),
new Point3d(0.0, -0.4, -0.4),
new Point3d(0.0, 0.7, -0.5),
new Point3d(0.9, 0.8, -0.25),
new Point3d(0.7, -0.4, -0.15),
new Point3d(0.6, -0.4, -0.3),
new Point3d(0.75, 0.6, -0.4),
new Point3d(0.0, -1.4, 0.0),
new Point3d(0.0, -1.4, 0.0),
new Point3d(0.0, -1.4, 0.0),
new Point3d(0.0, -1.4, 0.0),
new Point3d(-0.9, 0.8, -0.25),
new Point3d(-0.9, 0.8, -0.1),
new Point3d(0.0, 0.8, 0.1),
new Point3d(0.0, 1.0, -0.2),
new Point3d(0.0, 0.8, 0.1),
new Point3d(0.9, 0.8, -0.1),
new Point3d(0.9, 0.8, -0.25),
new Point3d(0.0, 1.0, -0.2),
new Point3d(0.9, 0.8, -0.1),
new Point3d(0.0, 0.8, 0.1),
new Point3d(0.0, 0.4, 0.4),
new Point3d(0.8, 0.6, 0.2),
new Point3d(-0.9, 0.8, -0.1),
new Point3d(-0.8, 0.6, 0.2),
new Point3d(0.0, 0.4, 0.4),
new Point3d(0.0, 0.8, 0.06),
new Point3d(0.0, 0.7, -0.5),
new Point3d(-0.75, 0.6, -0.4),
new Point3d(-0.9, 0.8, -0.25),
new Point3d(0.0, 1.0, -0.2),
new Point3d(0.9, 0.8, -0.25),
new Point3d(0.75, 0.6, -0.4),
new Point3d(0.0, 0.7, -0.5),
new Point3d(0.0, 1.0, -0.2),
new Point3d(0.0, 0.4, 0.4),
new Point3d(0.0, -0.4, 0.4),
new Point3d(0.6, -0.4, 0.2),
new Point3d(0.8, 0.6, 0.2),
new Point3d(0.0, 0.7, -0.5),
new Point3d(0.0, -0.4, -0.4),
new Point3d(-0.6, -0.4, -0.3),
new Point3d(-0.75, 0.6, -0.4),
new Point3d(0.0, -0.4, 0.4),
new Point3d(0.0, -0.8, -0.0),
new Point3d(0.7, -0.4, 0.0),
new Point3d(0.6, -0.4, 0.2),
new Point3d(-0.7, -0.4, 0.0),
new Point3d(0.0, -0.8, 0.0),
new Point3d(0.0, -0.4, 0.4),
new Point3d(-0.6, -0.4, 0.2),
new Point3d(0.7, -0.4, 0.0),
new Point3d(0.0, -0.8, 0.0),
new Point3d(0.6, -0.4, -0.3),
new Point3d(0.7, -0.4, -0.15),
new Point3d(0.6, -0.4, -0.3),
new Point3d(0.0, -0.8, 0.0),
new Point3d(-0.6, -0.4, -0.3),
new Point3d(0.0, -0.4, -0.4),
new Point3d(-0.6, -0.4, -0.3),
new Point3d(0.0, -0.8, 0.0),
new Point3d(-0.7, -0.4, 0.0),
new Point3d(-0.7, -0.4, -0.15)
});
Appearance app = new Appearance();
Material mat = new Material();
mat.setCapability(Material.ALLOW_COMPONENT_WRITE);
mat.setDiffuseColor(new Color3f(carne));
mat.
setAmbientColor(new Color3f
(new Color(32,
24,
0))); //mat.setEmissiveColor(new Color3f(Color.blue));
mat.
setSpecularColor(new Color3f
(Color.
white)); mat.setShininess(2);
mat.setLightingEnable(true);
app.setCapability(Appearance.ALLOW_MATERIAL_WRITE);
app.setMaterial(mat);
this.setCapability(Shape3D.ALLOW_APPEARANCE_WRITE);
this.setAppearance(app);
setGeometry(quad);
El resultado es que el ambient funciona, pero las direccionales no, las luces no hacen ningun efecto 3D, tratan a mi shape como si fuera plano :(
El mensaje 'No puedo usar luces con mis shape3D :( [SOLUCIONADO] (http://foro.elhacker.net/index.php?topic=396461)' fue bloqueado
Tópico superado. Gracias por traerlo a nuestro foro!
Leer reglas:
http://foro.elhacker.net/reglas