當前位置: 首頁>>代碼示例>>Java>>正文


Java RenderManager.createPreView方法代碼示例

本文整理匯總了Java中com.jme3.renderer.RenderManager.createPreView方法的典型用法代碼示例。如果您正苦於以下問題:Java RenderManager.createPreView方法的具體用法?Java RenderManager.createPreView怎麽用?Java RenderManager.createPreView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.jme3.renderer.RenderManager的用法示例。


在下文中一共展示了RenderManager.createPreView方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ImageCapturer

import com.jme3.renderer.RenderManager; //導入方法依賴的package包/類
public ImageCapturer(Camera cam, RenderManager renderManager, Node camNode, Node rootNode) {
        this.cam = cam;
        this.renderManager = renderManager;
        this.camNode = camNode;

//        bbuf = BufferUtils.createByteBuffer(cam.getWidth() * cam.getHeight() * 4);
        bbuf = BufferUtils.createByteBuffer(cam.getWidth() * cam.getHeight() * 4);
        image = new BufferedImage(cam.getWidth(), cam.getHeight(), IMAGE_TYPE);

        vp = renderManager.createPreView(cam.getName() + " recorder", cam);
        vp.setBackgroundColor(ColorRGBA.Black);
        vp.setClearFlags(true, true, true);
        fbuf = new FrameBuffer(cam.getWidth(), cam.getHeight(), 1);
        fbuf.setDepthBuffer(Format.Depth);
        fbuf.setColorBuffer(Format.RGBA8);
        vp.setOutputFrameBuffer(fbuf);
        vp.attachScene(rootNode);                
    }
 
開發者ID:dwhuang,項目名稱:SMILE,代碼行數:19,代碼來源:ImageCapturer.java

示例2: SubScreenBridge

import com.jme3.renderer.RenderManager; //導入方法依賴的package包/類
public SubScreenBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);
	cam.setParallelProjection(true);
	cam.setFrustumPerspective(45, 90, 0, 1);
	
	vp = rm.createPreView("Offscreen View", cam);
	if (!ToolKit.isAndroid())	vp.setClearFlags(true, true, true);
	else						vp.setClearFlags(true, false, false);
	
	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);
	
	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!ToolKit.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:29,代碼來源:SubScreenBridge.java

示例3: OSRBridge

import com.jme3.renderer.RenderManager; //導入方法依賴的package包/類
public OSRBridge(RenderManager rm, int width, int height, Node root) {
	this.rm = rm;
	this.root = root;

	cam = new Camera(width, height);

	vp = rm.createPreView("Offscreen View", cam);
	if (!ToolKit.isAndroid())
		vp.setClearFlags(true, true, true);
	else
		vp.setClearFlags(true, false, false);

	FrameBuffer offBuffer = new FrameBuffer(width, height, 1);

	tex = new Texture2D(width, height, Image.Format.RGBA8);
	tex.setMinFilter(Texture.MinFilter.BilinearNoMipMaps);
	tex.setMagFilter(Texture.MagFilter.Bilinear);

	if (!ToolKit.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);

	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);

	setSpatial(root);
	vp.attachScene(root);

	chaseCam = new ChaseCamera(cam, root) {
		@Override
		public void setDragToRotate(boolean dragToRotate) {
			this.dragToRotate = dragToRotate;
			this.canRotate = !dragToRotate;
		}
	};
	chaseCam.setDefaultDistance(5f);
	chaseCam.setMaxDistance(340f);
	chaseCam.setDefaultHorizontalRotation(90 * FastMath.DEG_TO_RAD);
	chaseCam.setDefaultVerticalRotation(0f);
	cam.setFrustumFar(36000f);
	float aspect = (float) cam.getWidth() / (float) cam.getHeight();
	cam.setFrustumPerspective(45f, aspect, 0.1f, cam.getFrustumFar());
	chaseCam.setUpVector(Vector3f.UNIT_Y);
}
 
開發者ID:rockfireredmoon,項目名稱:icetone,代碼行數:45,代碼來源:OSRBridge.java


注:本文中的com.jme3.renderer.RenderManager.createPreView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。