?? vrml_loader.java
字號:
/*
* Created on 2005-7-17
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package Loader;
/**
* @author carso
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
import javax.media.j3d.*;
import javax.vecmath.*;
import org.jdesktop.j3d.loaders.vrml97.VrmlLoader;
import org.jdesktop.j3d.loaders.vrml97.VrmlScene;
import com.sun.j3d.loaders.Scene;
public class Vrml_loader {
public TransformGroup LoadFile_graph(String filename) {
TransformGroup Vrml_lorder_objScale = new TransformGroup();
Transform3D Vrml_lorder_t3d = new Transform3D();
Vrml_lorder_t3d.setTranslation(new Vector3d(0,-1,0));
Vrml_lorder_t3d.setScale(0.001);
Vrml_lorder_objScale.setTransform(Vrml_lorder_t3d);
Color3f Vrml_lorder_light1Color = new Color3f(1.0f, 1.0f, 0.9f);
Vector3f Vrml_lorder_light1Direction = new Vector3f(0.0f, -80.0f, 0.0f);
BoundingSphere Vrml_lorder_bounds =
new BoundingSphere(new Point3d(0.0,0.0,0.0),400.0);
DirectionalLight Vrml_lorder_light1
= new DirectionalLight(Vrml_lorder_light1Color, Vrml_lorder_light1Direction);
Vrml_lorder_light1.setInfluencingBounds(Vrml_lorder_bounds);
Vrml_lorder_objScale.addChild(Vrml_lorder_light1);
TransformGroup Vrml_lorder_TransG = new TransformGroup();
Vrml_lorder_TransG.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
Vrml_lorder_objScale.addChild(Vrml_lorder_TransG);
VrmlLoader Vrml_lorder_loader = new VrmlLoader();
Scene s = null;
try {
s = Vrml_lorder_loader.load(filename);
} catch (Exception e) {
System.err.println(e);
System.exit(1);
}
Vrml_lorder_TransG.addChild(s.getSceneGroup());
return Vrml_lorder_objScale;
}
public Vrml_loader(){
System.out.println("This Class Loader.Vrml_loader load a file from a vrml97 filee");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -