• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SimpleUniverse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.j3d.utils.universe.SimpleUniverse的典型用法代码示例。如果您正苦于以下问题:Java SimpleUniverse类的具体用法?Java SimpleUniverse怎么用?Java SimpleUniverse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SimpleUniverse类属于com.sun.j3d.utils.universe包,在下文中一共展示了SimpleUniverse类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:tekrei,项目名称:JavaExamples,代码行数:20,代码来源:Java3DPanel.java


示例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);  
}
 
开发者ID:cowthan,项目名称:JavaAyo,代码行数:27,代码来源:J3dTest.java


示例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);
}
 
开发者ID:glaudiston,项目名称:project-bianca,代码行数:22,代码来源:Points3DPanel.java


示例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);
}
 
开发者ID:NeuroBox3D,项目名称:NeuGen,代码行数:24,代码来源:MainApp.java


示例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;
}
 
开发者ID:SOCR,项目名称:HTML5_WebSite,代码行数:18,代码来源:Plot3D.java


示例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);
}
 
开发者ID:MyRobotLab,项目名称:myrobotlab,代码行数:22,代码来源:Points3DPanel.java


示例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);
}
 
开发者ID:nerdouille,项目名称:silvie,代码行数:18,代码来源:ModelPreviewer.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:Main3D.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:MainPanel.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:Main.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:24,代码来源:Main.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:22,代码来源:CrystalBall.java


示例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);
}
 
开发者ID:aidiary,项目名称:javagame,代码行数:18,代码来源:RotatingCube.java


示例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();
}
 
开发者ID:hlg,项目名称:billie,代码行数:23,代码来源:ExplodedAxonometrie.java


示例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();
}
 
开发者ID:sleepyprof,项目名称:Fractal,代码行数:22,代码来源:Fractal3DPictureView.java


示例16: init

import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public void init()
{
setLayout(new BorderLayout());
GraphicsConfiguration config =
		SimpleUniverse.getPreferredConfiguration();

Canvas3D c = new Canvas3D(config);
add("Center", c);

// Create a simple scene and attach it to the virtual universe
BranchGroup scene = createSceneGraph();
u = new SimpleUniverse(c);

// This will move the ViewPlatform back a bit so the
// objects in the scene can be viewed.
u.getViewingPlatform().setNominalViewingTransform();

u.addBranchGraph(scene);
}
 
开发者ID:dhmay,项目名称:msInspect,代码行数:20,代码来源:SurfaceFrame.java


示例17: createOffscreenCanvas

import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
private void createOffscreenCanvas() {

        GraphicsConfiguration config = SimpleUniverse
                .getPreferredConfiguration();
        offScreenCanvas = new Canvas3D(config, true);

        Screen3D sOn = ScatterPlot3DGUI.plotCanvas.getScreen3D();
        Screen3D sOff = offScreenCanvas.getScreen3D();

        Dimension dim = sOn.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;

        sOff.setSize(dim);
        sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth()
                * OFF_SCREEN_SCALE);
        sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight()
                * OFF_SCREEN_SCALE);

    }
 
开发者ID:airalcorn2,项目名称:ScatterPlot3D,代码行数:21,代码来源:ScatterPlot3D.java


示例18: createUniverse

import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
/**
 * Returns a new 3D universe that displays <code>home</code> objects.
 */
private SimpleUniverse createUniverse(boolean displayShadowOnFloor, boolean listenToHomeUpdates,
		boolean waitForLoading)
{
	// Create a universe bound to no canvas 3D
	ViewingPlatform viewingPlatform = new ViewingPlatform();
	// Add an interpolator to view transform to get smooth transition 
	TransformGroup viewPlatformTransform = viewingPlatform.getViewPlatformTransform();
	CameraInterpolator cameraInterpolator = new CameraInterpolator(viewPlatformTransform);
	cameraInterpolator.setSchedulingBounds(new BoundingSphere(new Point3d(), 1E7));
	viewPlatformTransform.addChild(cameraInterpolator);
	viewPlatformTransform.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
	
	Viewer viewer = new Viewer(new Canvas3D[0]);
	SimpleUniverse universe = new SimpleUniverse(viewingPlatform, viewer);
	
	View view = viewer.getView();
	view.setTransparencySortingPolicy(View.TRANSPARENCY_SORT_GEOMETRY);
	
	// Update field of view from current camera
	updateView(view, this.home.getCamera(), this.home.getTopCamera() == this.home.getCamera());
	
	// Update point of view from current camera
	updateViewPlatformTransform(viewPlatformTransform, this.home.getCamera(), false);
	
	// Add camera listeners to update later point of view from camera
	if (listenToHomeUpdates)
	{
		addCameraListeners(view, viewPlatformTransform);
	}
	
	// Link scene matching home to universe
	universe.addBranchGraph(createSceneTree(displayShadowOnFloor, listenToHomeUpdates, waitForLoading));
	
	return universe;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:39,代码来源:HomeComponent3D.java


示例19: getOffScreenImage

import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
/**
 * Returns an image of the home viewed by this component at the given size.
 */
public BufferedImage getOffScreenImage(int width, int height)
{
	List<Selectable> selectedItems = this.home.getSelectedItems();
	SimpleUniverse offScreenImageUniverse = null;
	try
	{
		View view;
		if (this.offscreenUniverse == null)
		{
			offScreenImageUniverse = createUniverse(this.displayShadowOnFloor, false, true);
			view = offScreenImageUniverse.getViewer().getView();
			// Replace textures by clones because Java 3D doesn't accept all the time 
			// to share textures between offscreen and onscreen environments 
			Map<Texture, Texture> replacedTextures = new HashMap<Texture, Texture>();
			for (Enumeration it = offScreenImageUniverse.getLocale().getAllBranchGraphs(); it.hasMoreElements();)
			{
				cloneTexture((Node) it.nextElement(), replacedTextures);
			}
		}
		else
		{
			view = this.offscreenUniverse.getViewer().getView();
		}
		
		// Empty temporarily selection to create the off screen image
		List<Selectable> emptySelection = Collections.emptyList();
		this.home.setSelectedItems(emptySelection);
		return Component3DManager.getInstance().getOffScreenImage(view, width, height);
	}
	finally
	{
		// Restore selection
		this.home.setSelectedItems(selectedItems);
		if (offScreenImageUniverse != null)
		{
			offScreenImageUniverse.cleanup();
		}
	}
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:43,代码来源:HomeComponent3D.java


示例20: VolRend

import com.sun.j3d.utils.universe.SimpleUniverse; //导入依赖的package包/类
public VolRend(boolean timing, boolean debug)
{

	if (timing)
	{
		canvas = new TimingCanvas3D(
				SimpleUniverse.getPreferredConfiguration(), this);
	} else
	{
		canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
	}
	canvas.setMinimumSize(new Dimension(1,1));
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:14,代码来源:VolRend.java



注:本文中的com.sun.j3d.utils.universe.SimpleUniverse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SpelEvaluationException类代码示例发布时间:2022-05-21
下一篇:
Java RegisterRequestMessage类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap