com.jme3.renderer.Renderer.setFrameBuffer()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.1k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中com.jme3.renderer.Renderer.setFrameBuffer方法的一些代码示例,展示了Renderer.setFrameBuffer的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Renderer.setFrameBuffer方法的具体详情如下:
包路径:com.jme3.renderer.Renderer
类名称:Renderer
方法名:setFrameBuffer

Renderer.setFrameBuffer介绍

[英]Sets the framebuffer that will be drawn to. If the framebuffer has not been initialized yet, it will be created and its render surfaces and attached textures will be allocated.
[中]设置要绘制到的帧缓冲区。如果帧缓冲区尚未初始化,则将创建帧缓冲区,并分配其渲染曲面和附加纹理。

代码示例

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void simpleRender(RenderManager rm){
  Renderer r = rm.getRenderer();
  //do FBO rendering
  r.setFrameBuffer(fb);
  rm.setCamera(cam, false); // FBO uses current camera
  r.clearBuffers(true, true, true);
  rm.renderScene(fbNode, viewPort);
  rm.flushQueue(viewPort);
  //go back to default rendering and let
  //SimpleApplication render the default scene
  r.setFrameBuffer(null);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
public void simpleRender(RenderManager rm){
  Renderer r = rm.getRenderer();
  //do FBO rendering
  r.setFrameBuffer(fb);
  rm.setCamera(cam, false); // FBO uses current camera
  r.clearBuffers(true, true, true);
  rm.renderScene(fbNode, viewPort);
  rm.flushQueue(viewPort);
  //go back to default rendering and let
  //SimpleApplication render the default scene
  r.setFrameBuffer(null);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void postFrame(FrameBuffer out) {
  FrameBuffer sceneBuffer = renderFrameBuffer;
  if (renderFrameBufferMS != null && !renderer.getCaps().contains(Caps.OpenGL32)) {
    renderer.copyFrameBuffer(renderFrameBufferMS, renderFrameBuffer, true);
  } else if (renderFrameBufferMS != null) {
    sceneBuffer = renderFrameBufferMS;
  }
  renderFilterChain(renderer, sceneBuffer);
  renderer.setFrameBuffer(outputBuffer);
  
  //viewport can be null if no filters are enabled
  if (viewPort != null) {
    renderManager.setCamera(viewPort.getCamera(), false);
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void postQueue(RenderQueue queue) {
  if(!approximateNormals) {
    Renderer r = renderManager.getRenderer();
    r.setFrameBuffer(normalPass.getRenderFrameBuffer());
    renderManager.getRenderer().clearBuffers(true, true, true);
    renderManager.setForcedTechnique("PreNormalPass");
    renderManager.renderViewPortQueues(viewPort, false);
    renderManager.setForcedTechnique(null);
    renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void postQueue(RenderQueue queue) {
  Renderer r = renderManager.getRenderer();
  r.setFrameBuffer(normalPass.getRenderFrameBuffer());
  renderManager.getRenderer().clearBuffers(true, true, true);
  renderManager.setForcedTechnique("PreNormalPass");
  renderManager.renderViewPortQueues(viewPort, false);
  renderManager.setForcedTechnique(null);
  renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void postQueue(RenderQueue queue) {
  if (glowMode != GlowMode.Scene) {           
    renderManager.getRenderer().setBackgroundColor(ColorRGBA.BlackNoAlpha);            
    renderManager.getRenderer().setFrameBuffer(preGlowPass.getRenderFrameBuffer());
    renderManager.getRenderer().clearBuffers(true, true, true);
    renderManager.setForcedTechnique("Glow");
    renderManager.renderViewPortQueues(viewPort, false);         
    renderManager.setForcedTechnique(null);
    renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());
  }
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@Override
protected void postFrame(RenderManager renderManager, ViewPort viewPort, FrameBuffer prevFilterBuffer, FrameBuffer sceneBuffer) {
  renderManager.setCamera(viewPort.getCamera(), false);
  if (prevFilterBuffer != sceneBuffer) {
    renderManager.getRenderer().copyFrameBuffer(prevFilterBuffer, sceneBuffer, false);
  }
  renderManager.getRenderer().setFrameBuffer(sceneBuffer);
  viewPort.getQueue().renderQueue(RenderQueue.Bucket.Translucent, renderManager, viewPort.getCamera());
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

} else {
  r.setFrameBuffer(normalPass.getRenderFrameBuffer());
  renderManager.getRenderer().clearBuffers(true, true, true);
  if( renderManager.getRenderer().getCaps().contains(Caps.GLSL150) ) {
renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void renderShadowMap(int shadowMapIndex) {
  shadowMapOccluders = getOccludersToRender(shadowMapIndex, shadowMapOccluders);
  Camera shadowCam = getShadowCam(shadowMapIndex);
  //saving light view projection matrix for this split            
  lightViewProjectionsMatrices[shadowMapIndex].set(shadowCam.getViewProjectionMatrix());
  renderManager.setCamera(shadowCam, false);
  renderManager.getRenderer().setFrameBuffer(shadowFB[shadowMapIndex]);
  renderManager.getRenderer().clearBuffers(true, true, true);
  renderManager.setForcedRenderState(forcedRenderState);
  // render shadow casters to shadow map
  viewPort.getQueue().renderShadowQueue(shadowMapOccluders, renderManager, shadowCam, true);
  renderManager.setForcedRenderState(null);
}
boolean debugfrustums = false;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

protected void renderShadowMap(int shadowMapIndex) {
  shadowMapOccluders = getOccludersToRender(shadowMapIndex, shadowMapOccluders);
  Camera shadowCam = getShadowCam(shadowMapIndex);
  //saving light view projection matrix for this split            
  lightViewProjectionsMatrices[shadowMapIndex].set(shadowCam.getViewProjectionMatrix());
  renderManager.setCamera(shadowCam, false);
  renderManager.getRenderer().setFrameBuffer(shadowFB[shadowMapIndex]);
  renderManager.getRenderer().clearBuffers(true, true, true);
  renderManager.setForcedRenderState(forcedRenderState);
  // render shadow casters to shadow map
  viewPort.getQueue().renderShadowQueue(shadowMapOccluders, renderManager, shadowCam, true);
  renderManager.setForcedRenderState(null);
}
boolean debugfrustums = false;

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void postQueue(RenderQueue rq) {
  //we need special treatement for the sky because it must not be clipped
  rm.getRenderer().setFrameBuffer(reflectionBuffer);
  reflectionCam.setProjectionMatrix(null);
  rm.setCamera(reflectionCam, false);
  rm.getRenderer().clearBuffers(true, true, true);
  //Rendering the sky whithout clipping
  rm.getRenderer().setDepthRange(1, 1);
  vp.getQueue().renderQueue(RenderQueue.Bucket.Sky, rm, reflectionCam, true);
  rm.getRenderer().setDepthRange(0, 1);
  //setting the clip plane to the cam
  reflectionCam.setClipPlane(reflectionClipPlane, Plane.Side.Positive);//,1
  rm.setCamera(reflectionCam, false);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

renderer.setFrameBuffer(vp.getOutputFrameBuffer());
setCamera(vp.getCamera(), false);
if (vp.isClearDepth() || vp.isClearColor() || vp.isClearStencil()) {

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@SuppressWarnings("fallthrough")
public void postQueue(RenderQueue rq) {
  lightReceivers.clear();
  skipPostPass = false;
  if ( !checkCulling(viewPort.getCamera()) ) {
    skipPostPass = true;
    return;
  }
  updateShadowCams(viewPort.getCamera());
  
  Renderer r = renderManager.getRenderer();
  renderManager.setForcedMaterial(preshadowMat);
  renderManager.setForcedTechnique("PreShadow");
  for (int shadowMapIndex = 0; shadowMapIndex < nbShadowMaps; shadowMapIndex++) {
      if (debugfrustums) {
        doDisplayFrustumDebug(shadowMapIndex);
      }
      renderShadowMap(shadowMapIndex);
    }
  debugfrustums = false;
  //restore setting for future rendering
  r.setFrameBuffer(viewPort.getOutputFrameBuffer());
  renderManager.setForcedMaterial(null);
  renderManager.setForcedTechnique(null);
  renderManager.setCamera(viewPort.getCamera(), false);
  
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

@SuppressWarnings("fallthrough")
public void postQueue(RenderQueue rq) {
  lightReceivers.clear();
  skipPostPass = false;
  if ( !checkCulling(viewPort.getCamera()) ) {
    skipPostPass = true;
    return;
  }
  updateShadowCams(viewPort.getCamera());
  
  Renderer r = renderManager.getRenderer();
  renderManager.setForcedMaterial(preshadowMat);
  renderManager.setForcedTechnique("PreShadow");
  for (int shadowMapIndex = 0; shadowMapIndex < nbShadowMaps; shadowMapIndex++) {
      if (debugfrustums) {
        doDisplayFrustumDebug(shadowMapIndex);
      }
      renderShadowMap(shadowMapIndex);
    }
  debugfrustums = false;
  //restore setting for future rendering
  r.setFrameBuffer(viewPort.getOutputFrameBuffer());
  renderManager.setForcedMaterial(null);
  renderManager.setForcedTechnique(null);
  renderManager.setCamera(viewPort.getCamera(), false);
  
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

private void renderProcessing(Renderer r, FrameBuffer dst, Material mat){
  if (dst == null){
    fsQuad.setWidth(mainSceneFB.getWidth());
    fsQuad.setHeight(mainSceneFB.getHeight());
    fbCam.resize(mainSceneFB.getWidth(), mainSceneFB.getHeight(), true);
  }else{
    fsQuad.setWidth(dst.getWidth());
    fsQuad.setHeight(dst.getHeight());
    fbCam.resize(dst.getWidth(), dst.getHeight(), true);
  }
  fsQuad.setMaterial(mat);
  fsQuad.updateGeometricState();
  renderManager.setCamera(fbCam, true);
  r.setFrameBuffer(dst);
  r.clearBuffers(true, true, true);
  renderManager.renderGeometry(fsQuad);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

renderManager.setForcedMaterial(preshadowMat);
r.setFrameBuffer(shadowFB);
r.clearBuffers(true, true, true);
viewPort.getQueue().renderShadowQueue(shadowOccluders, renderManager, shadowCam, true);
r.setFrameBuffer(viewPort.getOutputFrameBuffer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

renderManager.getRenderer().setFrameBuffer(viewPort.getOutputFrameBuffer());

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

public void postQueue(RenderQueue rq) {
  Camera sceneCam = rm.getCurrentCamera();
  //update refraction cam
  refractionCam.setLocation(sceneCam.getLocation());
  refractionCam.setRotation(sceneCam.getRotation());
  refractionCam.setFrustum(sceneCam.getFrustumNear(),
      sceneCam.getFrustumFar(),
      sceneCam.getFrustumLeft(),
      sceneCam.getFrustumRight(),
      sceneCam.getFrustumTop(),
      sceneCam.getFrustumBottom());
  refractionCam.setParallelProjection(sceneCam.isParallelProjection());
  //update reflection cam
  WaterUtils.updateReflectionCam(reflectionCam, plane, sceneCam);
  
  //Rendering reflection and refraction
  rm.renderViewPort(reflectionView, savedTpf);
  rm.renderViewPort(refractionView, savedTpf);
  rm.getRenderer().setFrameBuffer(vp.getOutputFrameBuffer());
  rm.setCamera(sceneCam, false);
}

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

r.setFrameBuffer(shadowFB[i]);
  r.clearBuffers(true, true, true);
r.setFrameBuffer(viewPort.getOutputFrameBuffer());
renderManager.setForcedMaterial(null);
renderManager.setForcedTechnique(null);

代码示例来源:origin: jMonkeyEngine/jmonkeyengine

fsQuad.updateGeometricState();
r.setFrameBuffer(buff);        
r.clearBuffers(true, true, true);
renderManager.renderGeometry(fsQuad);

相关文章