Beruflich Dokumente
Kultur Dokumente
import java.awt.Graphics;
/* * To change this template, choose Tools | Templates * and open the template in the editor. */
/** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT
modify this code. The content of this method is * always regenerated by the Form Editor. */
@SuppressWarnings("unchecked") //
import java.awt.Graphics;
/*
*/
/*
* bola.java *
/*
* @author user */
/*
*/
@SuppressWarnings("unchecked")
//
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
pack(); }
java.awt.EventQueue.invokeLater(
new Runnable() {
new Bola().setVisible(true); } } );
}
Piramid
import java.awt.Color;
import com.sun.j3d.utils.geometry.GeometryInfo;
import com.sun.j3d.utils.geometry.NormalGenerator;
import com.sun.j3d.utils.universe.SimpleUniverse;
import javax.media.j3d.*;
import javax.vecmath.*;
// An Egyptian pyramid
TriangleArray.COORDINATES);
pyramidGeometry.setCoordinate(0, e);
pyramidGeometry.setCoordinate(1, t);
pyramidGeometry.setCoordinate(2, s);
pyramidGeometry.setCoordinate(3, s);
pyramidGeometry.setCoordinate(4, t);
pyramidGeometry.setCoordinate(5, w);
pyramidGeometry.setCoordinate(6, w);
pyramidGeometry.setCoordinate(7, t);
pyramidGeometry.setCoordinate(8, n);
pyramidGeometry.setCoordinate(9, n);
pyramidGeometry.setCoordinate(10, t);
pyramidGeometry.setCoordinate(11, e);
pyramidGeometry.setCoordinate(12, e);
pyramidGeometry.setCoordinate(13, s);
pyramidGeometry.setCoordinate(14, w);
pyramidGeometry.setCoordinate(15, w);
pyramidGeometry.setCoordinate(16, n);
pyramidGeometry.setCoordinate(17, e);
ng.generateNormals(geometryInfo);
// yellow appearance
Appearance appearance = new Appearance();
texAttr.setTextureMode(TextureAttributes.MODULATE);
texture.setBoundaryModeS(Texture.WRAP);
texture.setBoundaryModeT(Texture.WRAP);
appearance.setTextureAttributes(texAttr);
appearance.setMaterial(mat);
appearance.setTexture(texture);
group.addChild(shape);
// above pyramid
viewTranslation.z = 3;
viewTranslation.x = 0f;
viewTranslation.y = .3f;
viewTransform.setTranslation(viewTranslation);
rotation.rotX(-Math.PI / 12.0d);
rotation.mul(viewTransform);
universe.getViewingPlatform().getViewPlatformTransform().setTransform(
rotation);
universe.getViewingPlatform().getViewPlatformTransform().getTransform(
viewTransform);
// lights
1000.0);
light1.setInfluencingBounds(bounds);
group.addChild(light1);
ambientLightNode.setInfluencingBounds(bounds);
group.addChild(ambientLightNode);
universe.addBranchGraph(group);