import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.*;
public class game0823{
Color3f lightc;
Vector3f lightd,vector;
DirectionalLight light;
BranchGroup group;
TransformGroup tg;
Transform3D transform;
game0823(){
int n;
float x;
SimpleUniverse univ = new SimpleUniverse();
group = new BranchGroup();
tg = new TransformGroup();
transform = new Transform3D();
for(n=1;n<10;n++){
x=0.1f*n;
vector= new Vector3f(x, 0.0f, 0.0f);
transform.setTranslation(vector);
tg.setTransform(transform);
}
tg.addChild(new ColorCube(0.3));
group.addChild(tg);
light3d();
univ.getViewingPlatform().setNominalViewingTransform();
univ.addBranchGraph(group);
}
public static void main( String[] args ) {
new game0823();
}
void light3d(){
lightc = new Color3f(1.8f, 0.1f, 0.1f);
BoundingSphere bounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
lightd = new Vector3f(4.0f, -7.0f, -12.0f);
light= new DirectionalLight(lightc, lightd);
light.setInfluencingBounds(bounds);
group.addChild(light);
}
}
最終更新:2011年03月01日 21:03