本文整理汇总了Java中com.sun.j3d.utils.universe.SimpleUniverse类的典型用法代码示例。如果您正苦于以下问题:Java SimpleUniverse类的具体用法?Java SimpleUniverse怎么用?Java SimpleUniverse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleUniverse类属于com.sun.j3d.utils.universe包,在下文中一共展示了SimpleUniverse类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Java3DPanel
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
Java3DPanel() {
super();
setLayout(new BorderLayout());
Canvas3D canvas3D = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
add(canvas3D);
SimpleUniverse simpleU = new SimpleUniverse(canvas3D);
simpleU.getViewingPlatform().setNominalViewingTransform();
try {
BranchGroup branchGroup = new BranchGroup();
TransformGroup transformGroup = getInteractiveTransformGroup();
branchGroup.addChild(transformGroup);
buildScene(transformGroup);
branchGroup.compile();
simpleU.addBranchGraph(branchGroup);
} catch (Exception e) {
e.printStackTrace();
}
setVisible(true);
}
示例2: J3dTest
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public J3dTest(){
// 创建一个虚拟空间
SimpleUniverse universe = new SimpleUniverse();
// 创建一个用来包含对象的数据结构
BranchGroup group = new BranchGroup();
// 创建一个球并把它加入到group中
Sphere sphere = new Sphere(0.5f); // 小球的半径为0.5米
group.addChild(sphere);
Color3f light1Color = new Color3f(1.8f, 0.1f, 0.1f);
// 设置光线的颜色
BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0), 100.0);
// 设置光线的作用范围
Vector3f light1Direction = new Vector3f(4.0f, -7.0f, -12.0f);
// 设置光线的方向
DirectionalLight light1= new DirectionalLight(light1Color, light1Direction);
// 指定颜色和方向,产生单向光源
light1.setInfluencingBounds(bounds);
// 把光线的作用范围加入光源中
group.addChild(light1);
// 将光源加入group组,安放观察点
universe.getViewingPlatform().setNominalViewingTransform();
// 把group加入到虚拟空间中
universe.addBranchGraph(group);
}
示例3: Points3DPanel
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Points3DPanel(PointsShape ptsShape) {
setLayout(new BorderLayout());
setOpaque(false);
setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
canvas3D.setFocusable(true);
canvas3D.requestFocus(); // the canvas now has focus, so receives key
// events
su = new SimpleUniverse(canvas3D);
createSceneGraph(ptsShape);
initUserPosition(); // set user's viewpoint
orbitControls(canvas3D); // controls for moving the viewpoint
su.addBranchGraph(sceneBG);
}
示例4: MainApp
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
/** Creates a new instance of MainApp
* Create a simple scene and attach it to the virtual universe
*
*/
public MainApp(String[] args) {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
// SimpleUniverse is a Convenience Utility class
simpleU = new SimpleUniverse(canvas3D);
// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
simpleU.getViewingPlatform().setNominalViewingTransform();
BranchGroup scene = createSceneGraph(args.length > 0);
orbitControls(canvas3D);
simpleU.addBranchGraph(scene);
}
示例5: init
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
protected void init()
{
Node plot = createPlot();
BranchGroup scene = defineMouseBehaviour(plot);
setupLights(scene); // Surface plot wants an extra light
scene.compile();
universe = new SimpleUniverse(this);
universe.getViewingPlatform().setNominalViewingTransform();
universe.addBranchGraph(scene);
if (parallelProjection) {
setProjectionPolicy(universe, parallelProjection);
}
init = true;
}
示例6: Points3DPanel
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Points3DPanel(PointsShape ptsShape) {
setLayout(new BorderLayout());
setOpaque(false);
setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add("Center", canvas3D);
canvas3D.setFocusable(true);
canvas3D.requestFocus(); // the canvas now has focus, so receives key
// events
su = new SimpleUniverse(canvas3D);
createSceneGraph(ptsShape);
initUserPosition(); // set user's viewpoint
orbitControls(canvas3D); // controls for moving the viewpoint
su.addBranchGraph(sceneBG);
}
示例7: doPreview
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
@Override
public void doPreview() {
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
canvas.setPreferredSize(new Dimension(CANVAS_PREFERRED_WIDTH, CANVAS_PREFERRED_HEIGHT));
BranchGroup scene = createSceneGraph();
this.universe = new SimpleUniverse(canvas);
// Move the camera back on the z-axis
Transform3D cameraTransform = new Transform3D();
TransformGroup viewPlatformGroup = this.universe.getViewingPlatform().getViewPlatformTransform();
cameraTransform.setTranslation(new Vector3f(0, 0, CAMERA_Z_POSITION));
viewPlatformGroup.setTransform(cameraTransform);
// Necessary to see the whole model
this.universe.getViewer().getView().setBackClipDistance(BACK_CLIP_DISTANCE);
this.universe.addBranchGraph(scene);
super.preview.setCanvas(canvas, true);
}
示例8: Main3D
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Main3D() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例9: MainPanel
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public MainPanel() {
setPreferredSize(new Dimension(WIDTH, HEIGHT));
setLayout(new BorderLayout());
// 3D���f����`�悷��L�����p�X���쐬
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas3D = new Canvas3D(config);
add(canvas3D, BorderLayout.CENTER);
canvas3D.setFocusable(true);
canvas3D.requestFocus();
// ���E���쐬
universe = new SimpleUniverse(canvas3D);
createSceneGraph(); // ���E�i�V�[���O���t�j���\�z
initUserPosition(); // ���[�U�̎��_��������
orbitControls(canvas3D); // �}�E�X����
universe.addBranchGraph(sceneBG);
}
示例10: Main
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Main() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例11: Main
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Main() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
Transform3D viewPlatformTransform = new Transform3D();
viewPlatformTransform.setTranslation(new Vector3d(0.0, 0.0, 10.0));
universe.getViewingPlatform().getViewPlatformTransform().setTransform(viewPlatformTransform);
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例12: CrystalBall
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public CrystalBall() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse
.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
// �}�E�X����
orbitControls(canvas);
universe.addBranchGraph(scene);
}
示例13: RotatingCube
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public RotatingCube() {
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
Canvas3D canvas = new Canvas3D(config);
add(canvas, BorderLayout.CENTER);
SimpleUniverse universe = new SimpleUniverse(canvas);
// �V�[�����\�z
BranchGroup scene = createSceneGraph();
scene.compile();
// ���_���Z�b�g
universe.getViewingPlatform().setNominalViewingTransform();
universe.addBranchGraph(scene);
}
示例14: setupViews
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
@Override
public void setupViews() {
remove(loaderCanvas);
Panel multiviews = new Panel(new GridLayout(storeys.size(), 0));
multiviews.setSize(800, storeys.size() * 400);
int row = 0;
ScrollPane scrollPane = new ScrollPane();
scrollPane.add(multiviews);
for (ViewSpecificGroup storey : storeys) {
Canvas3D canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
canvas.setSize(800, 400);
AxonometricView view = new AxonometricView(canvas);
universe.addView(view);
view.zoomToExtent(storey, 1);
storey.addView(view.getView());
multiviews.add(canvas, row);
canvas.setVisible(true);
row++;
}
add(scrollPane, BorderLayout.CENTER);
validate();
}
示例15: Fractal3DPictureView
import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public Fractal3DPictureView(Fractal3DModel model, Fractal3DController controller) {
this.model = model;
this.controller = controller;
model.addObserver(this);
setPreferredSize(new Dimension(400, 400));
setLayout(new BorderLayout());
GraphicsConfiguration config = SimpleUniverse.getPreferredConfiguration();
canvas = new Canvas3D(config);
add(canvas);
universe = new SimpleUniverse(canvas);
universe.getViewingPlatform().setNominalViewingTransform();
canvas.addMouseListener(new MouseInteractionListener());
scene = null;
update();
}