アットウィキロゴ

ch819

import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;

public class pro{

public pro() {

SimpleUniverse universe = new SimpleUniverse();
BranchGroup group = new BranchGroup();

Appearance appearance = new Appearance( );
Material material = new Material( );
appearance.setMaterial( material );
Cone cone = new Cone( 0.3f, 0.6f, Cone.GENERATE_NORMALS, appearance );

TransformGroup transformGroup = new TransformGroup( );
Transform3D transform3D = new Transform3D( );
Vector3d vector3d = new Vector3d( 0.5, 0.5, 0.5 );
transform3D.setScale( vector3d );
transformGroup.setTransform( transform3D );
transformGroup.addChild( cone );
group.addChild( transformGroup );

BoundingSphere boundingSphere = new BoundingSphere( );
Color3f color3f = new Color3f( 0.5f,0.7f, 0.3f );
Vector3f vector3f = new Vector3f( -1.0f, -1.0f, -1.0f );
DirectionalLight directionalLight = new DirectionalLight( color3f, vector3f );
directionalLight.setInfluencingBounds( boundingSphere );
group.addChild( directionalLight );

Color3f cg = new Color3f( 0.5f, 0.5f, 0.5f );
Background background = new Background( cg );
group.addChild(background);
background.setApplicationBounds( boundingSphere );

universe.getViewingPlatform().setNominalViewingTransform();

universe.addBranchGraph(group);
}

public static void main(String[] args) {
new pro();
}
}
最終更新:2010年10月01日 14:41