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

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

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

Renderer.getCaps介绍

[英]Get the capabilities of the renderer.
[中]获取渲染器的功能。

代码示例

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

public HDRRenderer(AssetManager manager, Renderer renderer){
  this.manager = manager;
  this.renderer = renderer;
  
  Collection<Caps> caps = renderer.getCaps();
  if (caps.contains(Caps.PackedFloatColorBuffer))
    bufFormat = Format.RGB111110F;
  else if (caps.contains(Caps.FloatColorBuffer))
    bufFormat = Format.RGB16F;
  else{
    enabled = false;
    return;
  }
}

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

public void setupBasicShadow(){
  if (renderer.getCaps().contains(Caps.GLSL100)){
    dlsr = new DirectionalLightShadowRenderer(assetManager, 1024, 1);
    viewPort.addProcessor(dlsr);
  }
}

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

public void setupSkyBox(){
  Texture envMap;
  if (renderer.getCaps().contains(Caps.FloatTexture)){
    envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr");
  }else{
    envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
  }
  rootNode.attachChild(SkyFactory.createSky(assetManager, envMap, 
      new Vector3f(-1,-1,-1), SkyFactory.EnvMapType.SphereMap));
}

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

public void setupSkyBox() {
  Texture envMap;
  if (renderer.getCaps().contains(Caps.FloatTexture)) {
    envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.hdr");
  } else {
    envMap = assetManager.loadTexture("Textures/Sky/St Peters/StPeters.jpg");
  }
  Spatial sky = SkyFactory.createSky(assetManager, envMap, 
      new Vector3f(-1f, -1f, -1f), EnvMapType.SphereMap);
  rootNode.attachChild(sky);
}

代码示例来源: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

public void setupFilters() {
  if (renderer.getCaps().contains(Caps.GLSL100)) {
    fpp = new FilterPostProcessor(assetManager);
    //     fpp.setNumSamples(4);
    // fpp.setNumSamples(4);
    //fpp.addFilter(new ColorOverlayFilter(ColorRGBA.LightGray));
    fpp.addFilter(new RadialBlurFilter());
    fade = new FadeFilter(1.0f);
    fpp.addFilter(fade);
    viewPort.addProcessor(fpp);
  }
}

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

public void setupHdr(){
  if (renderer.getCaps().contains(Caps.GLSL100)){
    toneMapFilter = new ToneMapFilter();
    toneMapFilter.setWhitePoint(new Vector3f(3f, 3f, 3f));
    FilterPostProcessor fpp = new FilterPostProcessor(assetManager);
    fpp.addFilter(toneMapFilter);
    viewPort.addProcessor(fpp);
//        setPauseOnLostFocus(false);
  }
}

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

public void setupFilters(){
  if (renderer.getCaps().contains(Caps.GLSL100)){
    fpp=new FilterPostProcessor(assetManager);
    //fpp.setNumSamples(4);
    int numSamples = getContext().getSettings().getSamples();
    if( numSamples > 0 ) {
      fpp.setNumSamples(numSamples); 
    }
    CartoonEdgeFilter toon=new CartoonEdgeFilter();
    toon.setEdgeColor(ColorRGBA.Yellow);
    fpp.addFilter(toon);
    viewPort.addProcessor(fpp);
  }
}

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

public void initialize(RenderManager rm, ViewPort vp) {
  renderManager = rm;
  renderer = rm.getRenderer();
  viewPort = vp;
  fsQuad = new Picture("filter full screen quad");
  fsQuad.setWidth(1);
  fsQuad.setHeight(1);
  if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) {
    if (!renderer.getCaps().contains(Caps.FloatTexture)) {
      fbFormat = Format.RGB8;
    } else {
      fbFormat = Format.RGB16F;
    }
  }
  
  Camera cam = vp.getCamera();
  //save view port diensions
  left = cam.getViewPortLeft();
  right = cam.getViewPortRight();
  top = cam.getViewPortTop();
  bottom = cam.getViewPortBottom();
  originalWidth = cam.getWidth();
  originalHeight = cam.getHeight();
  //first call to reshape
  reshape(vp, cam.getWidth(), cam.getHeight());
}

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

EnumSet<Caps> rendererCaps = renderManager.getRenderer().getCaps();
List<TechniqueDef> techDefs = def.getTechniqueDefs(name);
if (techDefs == null || techDefs.isEmpty()) {

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

@Override
  public void simpleInitApp() {
    flyCam.setMoveSpeed(20);
    Logger.getLogger("com.jme3").setLevel(Level.WARNING);
    Box boxshape1 = new Box(1f, 1f, 1f);
    Geometry cube_tex = new Geometry("A Textured Box", boxshape1);
    Texture tex = assetManager.loadTexture("Interface/Logo/Monkey.jpg");

    Material mat = new Material(assetManager, "Common/MatDefs/Misc/UnshadedNodes.j3md");
    mat.selectTechnique(TechniqueDef.DEFAULT_TECHNIQUE_NAME, renderManager);
    Technique t = mat.getActiveTechnique();

    for (Shader.ShaderSource shaderSource : t.getDef().getShader(assetManager, renderer.getCaps(), t.getDynamicDefines()).getSources()) {
      System.out.println(shaderSource.getSource());
    }
    
    mat.setColor("Color", ColorRGBA.Yellow);
    mat.setTexture("ColorMap", tex);
    cube_tex.setMaterial(mat);
    rootNode.attachChild(cube_tex);
  }
}

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

/**
 * init the pass called internally
 * @param renderer
 * @param width
 * @param height
 * @param textureFormat
 * @param depthBufferFormat
 * @param numSamples
 */
public void init(Renderer renderer, int width, int height, Format textureFormat, Format depthBufferFormat, int numSamples, boolean renderDepth) {
  Collection<Caps> caps = renderer.getCaps();
  if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample) && caps.contains(Caps.OpenGL31)) {
    renderFrameBuffer = new FrameBuffer(width, height, numSamples);                
    renderedTexture = new Texture2D(width, height, numSamples, textureFormat);
    renderFrameBuffer.setDepthBuffer(depthBufferFormat);
    if (renderDepth) {
      depthTexture = new Texture2D(width, height, numSamples, depthBufferFormat);
      renderFrameBuffer.setDepthTexture(depthTexture);
    }
  } else {
    renderFrameBuffer = new FrameBuffer(width, height, 1);
    renderedTexture = new Texture2D(width, height, textureFormat);
    renderFrameBuffer.setDepthBuffer(depthBufferFormat);
    if (renderDepth) {
      depthTexture = new Texture2D(width, height, depthBufferFormat);
      renderFrameBuffer.setDepthTexture(depthTexture);
    }
  }
  renderFrameBuffer.setColorTexture(renderedTexture);
}

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

Collection<Caps> caps = renderer.getCaps();

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

public void reshape(ViewPort vp, int w, int h){
  if (mainSceneFB != null){
    renderer.deleteFrameBuffer(mainSceneFB);
  }
  mainSceneFB = new FrameBuffer(w, h, 1);
  mainScene = new Texture2D(w, h, bufFormat);
  mainSceneFB.setDepthBuffer(Format.Depth);
  mainSceneFB.setColorTexture(mainScene);
  mainScene.setMagFilter(fbMagFilter);
  mainScene.setMinFilter(fbMinFilter);
  if (msFB != null){
    renderer.deleteFrameBuffer(msFB);
  }
  tone.setTexture("Texture", mainScene);
  
  Collection<Caps> caps = renderer.getCaps();
  if (numSamples > 1 && caps.contains(Caps.FrameBufferMultisample)){
    msFB = new FrameBuffer(w, h, numSamples);
    msFB.setDepthBuffer(Format.Depth);
    msFB.setColorBuffer(bufFormat);
    vp.setOutputFrameBuffer(msFB);
  }else{
    if (numSamples > 1)
      logger.warning("FBO multisampling not supported on this GPU, request ignored.");
    vp.setOutputFrameBuffer(mainSceneFB);
  }
  createLumShaders();
}

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

/**
 * Preloads this material for the given render manager.
 * <p>
 * Preloading the material can ensure that when the material is first
 * used for rendering, there won't be any delay since the material has
 * been already been setup for rendering.
 *
 * @param renderManager The render manager to preload for
 */
public void preload(RenderManager renderManager, Geometry geometry) {
  if (technique == null) {
    selectTechnique(TechniqueDef.DEFAULT_TECHNIQUE_NAME, renderManager);
  }
  TechniqueDef techniqueDef = technique.getDef();
  Renderer renderer = renderManager.getRenderer();
  EnumSet<Caps> rendererCaps = renderer.getCaps();
  if (techniqueDef.isNoRender()) {
    return;
  }
  // Get world overrides
  SafeArrayList<MatParamOverride> overrides = geometry.getWorldMatParamOverrides();
  Shader shader = technique.makeCurrent(renderManager, overrides, null, null, rendererCaps);
  updateShaderMaterialParameters(renderer, shader, overrides, null);
  renderManager.getRenderer().setShader(shader);
}

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

for (Caps caps : renderManager.getRenderer().getCaps()) {
  System.out.println(caps.name());
if(!renderManager.getRenderer().getCaps().contains(Caps.TextureArray)){
  throw new UnsupportedOperationException("Your hardware does not support TextureArray");

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

for (Caps caps : renderManager.getRenderer().getCaps()) {
  System.out.println(caps.name());
if(!renderManager.getRenderer().getCaps().contains(Caps.TextureArray)){
  throw new UnsupportedOperationException("Your hardware does not support TextureArray");

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

if( renderManager.getRenderer().getCaps().contains(Caps.GLSL150) ) {
  renderManager.setForcedTechnique("PreNormalPass15");
} else {

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

EnumSet<Caps> rendererCaps = renderer.getCaps();

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

fpp.addFilter(fade);
if (renderer.getCaps().contains(Caps.GLSL100)) {
  DirectionalLightShadowRenderer dlsr
      = new DirectionalLightShadowRenderer(assetManager, 512, 1);

相关文章