当前位置: 首页>>代码示例>>Java>>正文


Java FrameBuffer.setColorTexture方法代码示例

本文整理汇总了Java中com.jme3.texture.FrameBuffer.setColorTexture方法的典型用法代码示例。如果您正苦于以下问题:Java FrameBuffer.setColorTexture方法的具体用法?Java FrameBuffer.setColorTexture怎么用?Java FrameBuffer.setColorTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.jme3.texture.FrameBuffer的用法示例。


在下文中一共展示了FrameBuffer.setColorTexture方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: simpleInitApp

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
@Override
public void simpleInitApp() {
    int w = settings.getWidth();
    int h = settings.getHeight();

    //setup framebuffer
    fb = new FrameBuffer(w, h, 1);

    Texture2D fbTex = new Texture2D(w, h, Format.RGBA8);
    fb.setDepthBuffer(Format.Depth);
    fb.setColorTexture(fbTex);

    // setup framebuffer's scene
    Sphere sphMesh = new Sphere(20, 20, 1);
    Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m");

    Geometry sphere = new Geometry("sphere", sphMesh);
    sphere.setMaterial(solidColor);
    fbNode.attachChild(sphere);

    //setup main scene
    Picture p = new Picture("Picture");
    p.setPosition(0, 0);
    p.setWidth(w);
    p.setHeight(h);
    p.setTexture(assetManager, fbTex, false);

    rootNode.attachChild(p);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:30,代码来源:TestFBOPassthrough.java

示例2: setupOffscreenView

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public Texture setupOffscreenView(){
    Camera offCamera = new Camera(512, 512);

    offView = renderManager.createPreView("Offscreen View", offCamera);
    offView.setClearFlags(true, true, true);
    offView.setBackgroundColor(ColorRGBA.DarkGray);

    // create offscreen framebuffer
    FrameBuffer offBuffer = new FrameBuffer(512, 512, 1);

    //setup framebuffer's cam
    offCamera.setFrustumPerspective(45f, 1f, 1f, 1000f);
    offCamera.setLocation(new Vector3f(0f, 0f, -5f));
    offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);

    //setup framebuffer's texture
    Texture2D offTex = new Texture2D(512, 512, Format.RGBA8);
    offTex.setMinFilter(Texture.MinFilter.Trilinear);
    offTex.setMagFilter(Texture.MagFilter.Bilinear);

    //setup framebuffer to use texture
    offBuffer.setDepthBuffer(Format.Depth);
    offBuffer.setColorTexture(offTex);
    
    //set viewport to render to offscreen framebuffer
    offView.setOutputFrameBuffer(offBuffer);

    // setup framebuffer's scene
    Box boxMesh = new Box(Vector3f.ZERO, 1,1,1);
    Material material = assetManager.loadMaterial("Interface/Logo/Logo.j3m");
    offBox = new Geometry("box", boxMesh);
    offBox.setMaterial(material);

    // attach the scene to the viewport to be rendered
    offView.attachScene(offBox);
    
    return offTex;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:39,代码来源:TestRenderToTexture.java

示例3: simpleInitApp

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void simpleInitApp() {
   ViewPort niftyView = renderManager.createPreView("NiftyView", new Camera(1024, 768));
   niftyView.setClearFlags(true, true, true);
    NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager,
                                                      inputManager,
                                                      audioRenderer,
                                                      niftyView);
    nifty = niftyDisplay.getNifty();
    nifty.fromXml("all/intro.xml", "start");
    niftyView.addProcessor(niftyDisplay);

    Texture2D depthTex = new Texture2D(1024, 768, Format.Depth);
    FrameBuffer fb = new FrameBuffer(1024, 768, 1);
    fb.setDepthTexture(depthTex);

    Texture2D tex = new Texture2D(1024, 768, Format.RGBA8);
    tex.setMinFilter(MinFilter.Trilinear);
    tex.setMagFilter(MagFilter.Bilinear);

    fb.setColorTexture(tex);
    niftyView.setClearFlags(true, true, true);
    niftyView.setOutputFrameBuffer(fb);

    Box b = new Box(Vector3f.ZERO, 1, 1, 1);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setTexture("ColorMap", tex);
    geom.setMaterial(mat);
    rootNode.attachChild(geom);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:31,代码来源:TestNiftyToMesh.java

示例4: createPreViews

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
protected void createPreViews() {
    reflectionCam = new Camera(renderWidth, renderHeight);
    refractionCam = new Camera(renderWidth, renderHeight);

    // create a pre-view. a view that is rendered before the main view
    reflectionView = new ViewPort("Reflection View", reflectionCam);
    reflectionView.setClearFlags(true, true, true);
    reflectionView.setBackgroundColor(ColorRGBA.Black);
    // create offscreen framebuffer
    reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
    //setup framebuffer to use texture
    reflectionBuffer.setDepthBuffer(Format.Depth);
    reflectionBuffer.setColorTexture(reflectionTexture);

    //set viewport to render to offscreen framebuffer
    reflectionView.setOutputFrameBuffer(reflectionBuffer);
    reflectionView.addProcessor(new ReflectionProcessor(reflectionCam, reflectionBuffer, reflectionClipPlane));
    // attach the scene to the viewport to be rendered
    reflectionView.attachScene(reflectionScene);

    // create a pre-view. a view that is rendered before the main view
    refractionView = new ViewPort("Refraction View", refractionCam);
    refractionView.setClearFlags(true, true, true);
    refractionView.setBackgroundColor(ColorRGBA.Black);
    // create offscreen framebuffer
    refractionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
    //setup framebuffer to use texture
    refractionBuffer.setDepthBuffer(Format.Depth);
    refractionBuffer.setColorTexture(refractionTexture);
    refractionBuffer.setDepthTexture(depthTexture);
    //set viewport to render to offscreen framebuffer
    refractionView.setOutputFrameBuffer(refractionBuffer);
    refractionView.addProcessor(new RefractionProcessor());
    // attach the scene to the viewport to be rendered
    refractionView.attachScene(reflectionScene);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:37,代码来源:SimpleWaterProcessor.java

示例5: SubScreenBridge

import com.jme3.texture.FrameBuffer; //导入方法依赖的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

示例6: createPreViews

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
protected void createPreViews() {
        reflectionCam = new Camera(renderWidth, renderHeight);
//        refractionCam = new Camera(renderWidth, renderHeight);

        // create a pre-view. a view that is rendered before the main view
        reflectionView = new ViewPort("Reflection View", reflectionCam);
        reflectionView.setClearFlags(true, true, true);
        reflectionView.setBackgroundColor(ColorRGBA.Black);
        // create offscreen framebuffer
        reflectionBuffer = new FrameBuffer(renderWidth, renderHeight, 1);
        //setup framebuffer to use texture
        reflectionBuffer.setColorTexture(reflectionTexture);
        
        // remove20160704,不要使用DepthBuffer,这在Android下无法支持
//        reflectionBuffer.setDepthBuffer(Format.Depth);
        
        //set viewport to render to offscreen framebuffer
        reflectionView.setOutputFrameBuffer(reflectionBuffer);
        reflectionView.addProcessor(new ReflectionProcessor(reflectionCam, reflectionBuffer, reflectionClipPlane));
        
        // attach the scene to the viewport to be rendered
        if (!tempReflectionScenes.isEmpty()) {
            for (Spatial scene : tempReflectionScenes) {
                addReflectionScene(scene);
            }
            tempReflectionScenes.clear();
        }
    }
 
开发者ID:huliqing,项目名称:LuoYing,代码行数:29,代码来源:VerySimpleWaterProcessor.java

示例7: SubScreenBridge

import com.jme3.texture.FrameBuffer; //导入方法依赖的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 (!Screen.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 (!Screen.isAndroid())
		offBuffer.setDepthBuffer(Image.Format.Depth);
	
	offBuffer.setColorTexture(tex);

	vp.setOutputFrameBuffer(offBuffer);
	
	setSpatial(root);
	vp.attachScene(root);
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:29,代码来源:SubScreenBridge.java

示例8: initialize

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp){
    if (!enabled)
        return;

    renderer = rm.getRenderer();
    renderManager = rm;
    viewPort = vp;

    // loadInitial()
    fsQuad = new Picture("HDR Fullscreen Quad");

    Format lumFmt = Format.Luminance8;
    scene64FB = new FrameBuffer(64, 64, 1);
    scene64 = new Texture2D(64, 64, lumFmt);
    scene64FB.setColorTexture(scene64);
    scene64.setMagFilter(fbMagFilter);
    scene64.setMinFilter(fbMinFilter);

    scene8FB = new FrameBuffer(8, 8, 1);
    scene8 = new Texture2D(8, 8, lumFmt);
    scene8FB.setColorTexture(scene8);
    scene8.setMagFilter(fbMagFilter);
    scene8.setMinFilter(fbMinFilter);

    scene1FB[0] = new FrameBuffer(1, 1, 1);
    scene1[0] = new Texture2D(1, 1, lumFmt);
    scene1FB[0].setColorTexture(scene1[0]);

    scene1FB[1] = new FrameBuffer(1, 1, 1);
    scene1[1] = new Texture2D(1, 1, lumFmt);
    scene1FB[1].setColorTexture(scene1[1]);

    // prepare tonemap shader
    tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
    tone.setFloat("A", 0.18f);
    tone.setFloat("White", 100);

    // load();
    int w = vp.getCamera().getWidth();
    int h = vp.getCamera().getHeight();
    reshape(vp, w, h);

    
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:45,代码来源:HDRRenderer.java

示例9: OSRBridge

import com.jme3.texture.FrameBuffer; //导入方法依赖的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

示例10: OSRBridge

import com.jme3.texture.FrameBuffer; //导入方法依赖的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 (!Screen.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 (!Screen.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:meltzow,项目名称:tonegodgui,代码行数:43,代码来源:OSRBridge.java

示例11: initialize

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
@Override
    public void initialize(RenderManager rm, ViewPort vp) {
        renderManager = rm;
        viewPort = vp;

        fogShapeMaterial = assetManager
                .loadMaterial("Materials/OccluderFogShape.j3m");
        fogProcessMaterial = assetManager
                .loadMaterial("Materials/OccluderFogProcess.j3m");

        fogShapeMaterial.getAdditionalRenderState()
                .setFaceCullMode(RenderState.FaceCullMode.Off);
        fogShapeMaterial.getAdditionalRenderState().setDepthWrite(false);
        fogShapeMaterial.getAdditionalRenderState().setDepthTest(false);

        int width = 1024;
        int height = 1024;

        // TODO: Find a way to use custom width and height.
        // If for example 1024, 1024 is used, screen ends up looking wrong and mouse doesn't work correctly
        // If resolution is big and I use screen width and height, performance suffers
        width = viewPort.getCamera().getWidth();
        height = viewPort.getCamera().getHeight();

        fogFb = new FrameBuffer(width, height, 1);
        colorTexture = new Texture2D(width, height, Image.Format.RGBA8);
        fogFb.setColorTexture(colorTexture);
//        fogFb.setDepthTexture(new Texture2D(width, height, Image.Format.Depth));
        fogProcessMaterial.setTexture("FogShape", colorTexture);

        app.enqueue(() -> {
            Quad front = new Quad(viewPort.getCamera().getWidth(),
                    viewPort.getCamera().getHeight());
            screenQuad = new Geometry("front-quad", front);
            screenQuad.setMaterial(fogProcessMaterial);
            ((SimpleApplication) app).getRootNode().attachChild(screenQuad);
            screenQuad.setQueueBucket(RenderQueue.Bucket.Gui);
            return null;
        });

        initialized = true;
    }
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:43,代码来源:ClientFog.java

示例12: initialize

import com.jme3.texture.FrameBuffer; //导入方法依赖的package包/类
public void initialize(RenderManager rm, ViewPort vp){
    if (!enabled)
        return;

    renderer = rm.getRenderer();
    renderManager = rm;
    viewPort = vp;

    // loadInitial()
    fsQuad = new Picture("HDR Fullscreen Quad");

    Format lumFmt = Format.RGB8;
    scene64FB = new FrameBuffer(64, 64, 1);
    scene64 = new Texture2D(64, 64, lumFmt);
    scene64FB.setColorTexture(scene64);
    scene64.setMagFilter(fbMagFilter);
    scene64.setMinFilter(fbMinFilter);

    scene8FB = new FrameBuffer(8, 8, 1);
    scene8 = new Texture2D(8, 8, lumFmt);
    scene8FB.setColorTexture(scene8);
    scene8.setMagFilter(fbMagFilter);
    scene8.setMinFilter(fbMinFilter);

    scene1FB[0] = new FrameBuffer(1, 1, 1);
    scene1[0] = new Texture2D(1, 1, lumFmt);
    scene1FB[0].setColorTexture(scene1[0]);

    scene1FB[1] = new FrameBuffer(1, 1, 1);
    scene1[1] = new Texture2D(1, 1, lumFmt);
    scene1FB[1].setColorTexture(scene1[1]);

    // prepare tonemap shader
    tone = new Material(manager, "Common/MatDefs/Hdr/ToneMap.j3md");
    tone.setFloat("A", 0.18f);
    tone.setFloat("White", 100);

    // load();
    int w = vp.getCamera().getWidth();
    int h = vp.getCamera().getHeight();
    reshape(vp, w, h);

    
}
 
开发者ID:chototsu,项目名称:MikuMikuStudio,代码行数:45,代码来源:HDRRenderer.java


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