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

Java Screen3D类代码示例

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

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



Screen3D类属于javax.media.j3d包,在下文中一共展示了Screen3D类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setOffScreenScale

import javax.media.j3d.Screen3D; //导入依赖的package包/类
/**
 * set the size of the off-screen canvas based on a scale of the on-screen
 * size
 * 
 * @param scale
 *            to be applied.
 */
public void setOffScreenScale(float offScreenScale)
{
	// set the size of the off-screen canvas based on a scale
	// of the on-screen size
	this.offScreenScale = offScreenScale;
	Screen3D sOn = canvas.getScreen3D();
	Screen3D sOff = this.getScreen3D();

	this.dim = sOn.getSize();
	dim.width *= offScreenScale;
	dim.height *= offScreenScale;
	sOff.setSize(dim);
	sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth()
			* offScreenScale);
	sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight()
			* offScreenScale);
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:25,代码来源:ScreenShot.java


示例2: getScreenshot

import javax.media.j3d.Screen3D; //导入依赖的package包/类
/**
   * Baut einen Screenshot
   * @return	null wenn nix geladen, sonst Screenshot
* Bsp: ImageIO.write(worldViewer.getScreenshot(), "png", File.createTempFile("screenshot", ".png"));
   */
  public BufferedImage getScreenshot() {
  	/*
 * Das hier ist sehr buerokratisch, aber leider hab ich keinen
 * einfacheren Weg gefunden. Was man mit Google findet sind i.d.R.
 * Beispiele, die java.awt.Robot.createScreenCapture() verwenden -- was
 * aber einen "echten Screenshot" macht, d.h. wenn einer ein anderes
 * Fenster ueber den ctSim geschoben hat, wird eben das abgelichtet. Die
 * Alternative, auf dem Canvas3D oder auf diesem Objekt paint(...)
 * aufzurufen, funktioniert nicht (ergibt immer einfarbig schwarze
 * Screenshots -- vermutlich ist Canvas3D eben doch keine ganz so
 * normale Swing-Komponente).
 */
  	Screen3D onScr = onScreenCanvas.getScreen3D();
  	Screen3D offScr = offScreenCanvas.getScreen3D();
  	offScreenCanvas.setOffScreenBuffer(new ImageComponent2D(ImageComponent2D.FORMAT_RGB, onScr.getSize().width, onScr.getSize().height));
  	offScr.setSize(onScr.getSize());
  	offScr.setPhysicalScreenHeight(onScr.getPhysicalScreenHeight());
  	offScr.setPhysicalScreenWidth(onScr.getPhysicalScreenWidth());
  	offScreenCanvas.renderOffScreenBuffer();
  	offScreenCanvas.waitForOffScreenRendering();
  	return offScreenCanvas.getOffScreenBuffer().getImage();
  }
 
开发者ID:tsandmann,项目名称:ct-sim,代码行数:28,代码来源:WorldViewer.java


示例3: getOffScreenCanvas3D

import javax.media.j3d.Screen3D; //导入依赖的package包/类
/**
 * Returns a new off screen <code>canva3D</code> at the given size. 
 * @throws IllegalRenderingStateException  if the canvas 3D couldn't be created.
 *    To avoid this exception, call {@link #isOffScreenImageSupported() isOffScreenImageSupported()} first.
 */
public Canvas3D getOffScreenCanvas3D(int width, int height)
{
	Canvas3D offScreenCanvas = getCanvas3D(null, true, null);
	// Configure canvas 3D for offscreen
	Screen3D screen3D = offScreenCanvas.getScreen3D();
	screen3D.setSize(width, height);
	screen3D.setPhysicalScreenWidth(2f);
	screen3D.setPhysicalScreenHeight(2f / width * height);
	BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
	ImageComponent2D imageComponent2D = new ImageComponent2D(ImageComponent2D.FORMAT_RGB, image);
	imageComponent2D.setCapability(ImageComponent2D.ALLOW_IMAGE_READ);
	offScreenCanvas.setOffScreenBuffer(imageComponent2D);
	return offScreenCanvas;
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:20,代码来源:Component3DManager.java


示例4: setOutputSize

import javax.media.j3d.Screen3D; //导入依赖的package包/类
public void setOutputSize(int width, int height)
{
	Screen3D sOff = owner.getScreen3D();
	Screen3D sOn = owner.canvas.getScreen3D();

	outSize.width = width;
	outSize.height = height;

	sOff.setSize(outSize);
	sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth() / 2);
	sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight() / 2);
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:13,代码来源:VideoRecorder.java


示例5: captureImage

import javax.media.j3d.Screen3D; //导入依赖的package包/类
@Override
public void captureImage( int maxSize, RenderingViewer.ImageCapture capture )
{
    if ( mCanvas .isOffScreen() )
    {
        BufferedImage bImage = new BufferedImage( maxSize, maxSize * 4 / 5, BufferedImage.TYPE_INT_ARGB );

        ImageComponent2D buffer = new ImageComponent2D( ImageComponent.FORMAT_RGB, bImage );

        Screen3D sOff = mCanvas .getScreen3D();
        Dimension dim = new Dimension( 1024, 768 );
        sOff .setSize( dim );
        sOff .setPhysicalScreenWidth( 1024 );
        sOff .setPhysicalScreenHeight( 768 );

        mCanvas .setOffScreenLocation( 0, 0 );
        mCanvas .setOffScreenBuffer( buffer );
        mCanvas .renderOffScreenBuffer();
        mCanvas .waitForOffScreenRendering();
        capture .captureImage( mCanvas .getOffScreenBuffer() .getImage() );
    }
    else
    {
        mCanvas .maxImageSize = maxSize;
        mCanvas .m_imageHandler = capture;
        mCanvas .repaint();
    }
    //mCanvas .m_imageHandler = null; mCanvas .maxImageSize = -1; // will be done by canvas, on another thread
}
 
开发者ID:vZome,项目名称:vzome-desktop,代码行数:30,代码来源:Java3dRenderingViewer.java


示例6: init

import javax.media.j3d.Screen3D; //导入依赖的package包/类
public void init() {

    // set up a NumFormat object to print out float with only 3 fraction
    // digits
    nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(3);

    setLayout(new BorderLayout());
    GraphicsConfiguration config = SimpleUniverse
        .getPreferredConfiguration();

    canvas = new Canvas3D(config);

    add("Center", canvas);

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

    if (isApplication) {
      offScreenCanvas = new OffScreenCanvas3D(config, true);
      // set the size of the off-screen canvas based on a scale
      // of the on-screen size
      Screen3D sOn = canvas.getScreen3D();
      Screen3D sOff = offScreenCanvas.getScreen3D();
      Dimension dim = sOn.getSize();
      dim.width *= 1.0f;
      dim.height *= 1.0f;
      sOff.setSize(dim);
      sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth()
          * offScreenScale);
      sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight()
          * offScreenScale);

      // attach the offscreen canvas to the view
      u.getViewer().getView().addCanvas3D(offScreenCanvas);
    }

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

    view = u.getViewer().getView();

    add("South", guiPanel());
  }
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:48,代码来源:LineTypes.java


示例7: SurfacePanel

import javax.media.j3d.Screen3D; //导入依赖的package包/类
public SurfacePanel(Organism<UV, Point3d> organism) {
	_organism = organism;
	
	this.setLayout(new BorderLayout());
	this.setPreferredSize(new Dimension(720, 720));
	
	GraphicsConfiguration config = 
		SimpleUniverse.getPreferredConfiguration();
	
	//Set up on screen canvas 
	_canvas3D = new Canvas3D(config);
	
	BranchGroup scene = createSceneGraph();
	
	_simpleU = new SimpleUniverse(_canvas3D);
	_simpleU.getViewingPlatform().setNominalViewingTransform();
	_simpleU.addBranchGraph(scene);
	
	//Set up off screen canvas
	_offScreenCanvas3D = new OffScreenCanvas3D(config);
	
	//Set the off screen to match the on screen
    Screen3D screenOn = _canvas3D.getScreen3D();
    Screen3D screenOff = _offScreenCanvas3D.getScreen3D();
    screenOff.setSize(screenOn.getSize());
    screenOff.setPhysicalScreenWidth(screenOn.getPhysicalScreenWidth());
    screenOff.setPhysicalScreenHeight(screenOn.getPhysicalScreenHeight());
	
	_simpleU.getViewer().getView().addCanvas3D(_offScreenCanvas3D);
	
	_infoPane = new JTextPane();
	_infoPane.setEditable(false);
	_infoPane.setBackground(Color.black);
	MutableAttributeSet aSet = new SimpleAttributeSet();
	StyleConstants.setAlignment(aSet, StyleConstants.ALIGN_CENTER);
	StyleConstants.setForeground(aSet, Color.white);
	_infoPane.setParagraphAttributes(aSet, true);
	_infoPane.setText("Genotype: " + _organism.nodes().toString());
	
	this.add(BorderLayout.NORTH, _infoPane);
	this.add(BorderLayout.CENTER, _canvas3D);
}
 
开发者ID:wolfmanstout,项目名称:jene,代码行数:43,代码来源:SurfacePanel.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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