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

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

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

Renderer.setShader介绍

[英]Sets the shader to use for rendering. If the shader has not been uploaded yet, it is compiled and linked. If it has been uploaded, then the uniform data is updated and the shader is set.
[中]设置要用于渲染的着色器。如果着色器尚未上载,则会对其进行编译和链接。如果已上载,则会更新统一数据并设置着色器。

代码示例

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

@Override
  public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
    Renderer renderer = renderManager.getRenderer();
    renderer.setShader(shader);
    renderMeshFromGeometry(renderer, geometry);
  }
}

代码示例来源:origin: info.projectkyoto/mms-engine

r.setShader(shader);

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

@Override
public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
  Renderer renderer = renderManager.getRenderer();
  Matrix4f viewMatrix = renderManager.getCurrentCamera().getViewMatrix();
  updateLightListUniforms(viewMatrix, shader, lights);
  renderer.setShader(shader);
  renderMeshFromGeometry(renderer, geometry);
}

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

@Override
  public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
    int nbRenderedLights = 0;
    Renderer renderer = renderManager.getRenderer();
    int batchSize = renderManager.getSinglePassLightBatchSize();
    if (lights.size() == 0) {
      updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, 0);
      renderer.setShader(shader);
      renderMeshFromGeometry(renderer, geometry);
    } else {
      while (nbRenderedLights < lights.size()) {
        nbRenderedLights = updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, nbRenderedLights);
        renderer.setShader(shader);
        renderMeshFromGeometry(renderer, geometry);
      }
    }
  }
}

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

@Override
public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
  int nbRenderedLights = 0;
  Renderer renderer = renderManager.getRenderer();
  int batchSize = renderManager.getSinglePassLightBatchSize();
  if (lights.size() == 0) {
    updateLightListUniforms(shader, geometry, lights,batchSize, renderManager, 0, lastTexUnit);
    renderer.setShader(shader);
    renderMeshFromGeometry(renderer, geometry);
  } else {
    while (nbRenderedLights < lights.size()) {
      nbRenderedLights = updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, nbRenderedLights, lastTexUnit);
      renderer.setShader(shader);
      renderMeshFromGeometry(renderer, geometry);
    }
  }
  return;
}

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

r.setShader(shader);
renderMeshFromGeometry(r, geometry);
lightColor.setValue(VarType.Vector4, ColorRGBA.BlackNoAlpha);
lightPos.setValue(VarType.Vector4, NULL_DIR_LIGHT);
r.setShader(shader);
renderMeshFromGeometry(r, geometry);

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
  public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
    Renderer renderer = renderManager.getRenderer();
    renderer.setShader(shader);
    renderMeshFromGeometry(renderer, geometry);
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
  Renderer renderer = renderManager.getRenderer();
  Matrix4f viewMatrix = renderManager.getCurrentCamera().getViewMatrix();
  updateLightListUniforms(viewMatrix, shader, lights);
  renderer.setShader(shader);
  renderMeshFromGeometry(renderer, geometry);
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
  int nbRenderedLights = 0;
  Renderer renderer = renderManager.getRenderer();
  int batchSize = renderManager.getSinglePassLightBatchSize();
  if (lights.size() == 0) {
    updateLightListUniforms(shader, geometry, lights,batchSize, renderManager, 0, lastTexUnit);
    renderer.setShader(shader);
    renderMeshFromGeometry(renderer, geometry);
  } else {
    while (nbRenderedLights < lights.size()) {
      nbRenderedLights = updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, nbRenderedLights, lastTexUnit);
      renderer.setShader(shader);
      renderMeshFromGeometry(renderer, geometry);
    }
  }
  return;
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

@Override
  public void render(RenderManager renderManager, Shader shader, Geometry geometry, LightList lights, int lastTexUnit) {
    int nbRenderedLights = 0;
    Renderer renderer = renderManager.getRenderer();
    int batchSize = renderManager.getSinglePassLightBatchSize();
    if (lights.size() == 0) {
      updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, 0);
      renderer.setShader(shader);
      renderMeshFromGeometry(renderer, geometry);
    } else {
      while (nbRenderedLights < lights.size()) {
        nbRenderedLights = updateLightListUniforms(shader, geometry, lights, batchSize, renderManager, nbRenderedLights);
        renderer.setShader(shader);
        renderMeshFromGeometry(renderer, geometry);
      }
    }
  }
}

代码示例来源:origin: org.jmonkeyengine/jme3-core

/**
 * 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) {
  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;
  }
  Shader shader = technique.makeCurrent(renderManager, null, null, null, rendererCaps);
  updateShaderMaterialParameters(renderer, shader, null, null);
  renderManager.getRenderer().setShader(shader);
}

代码示例来源:origin: info.projectkyoto/mms-engine

r.setShader(shader);

代码示例来源:origin: org.jmonkeyengine/jme3-core

r.setShader(shader);
renderMeshFromGeometry(r, geometry);
lightColor.setValue(VarType.Vector4, ColorRGBA.BlackNoAlpha);
lightPos.setValue(VarType.Vector4, NULL_DIR_LIGHT);
r.setShader(shader);
renderMeshFromGeometry(r, geometry);

代码示例来源:origin: info.projectkyoto/mms-engine

r.setShader(shader);
r.renderMesh(g.getMesh(), g.getLodLevel(), 1);
lightColor.setValue(VarType.Vector4, ColorRGBA.BlackNoAlpha);
lightPos.setValue(VarType.Vector4, nullDirLight);
r.setShader(shader);
r.renderMesh(g.getMesh(), g.getLodLevel(), 1);

相关文章