本文整理汇总了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);
}
示例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);
}
示例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);
}