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

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

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

Renderer.setTexture介绍

[英]Sets the texture to use for the given texture unit.
[中]设置要用于给定纹理单元的纹理。

代码示例

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

private int setProbeData(RenderManager rm, int lastTexUnit, Uniform lightProbeData, Uniform shCoeffs, Uniform lightProbePemMap, LightProbe lightProbe) {
  lightProbeData.setValue(VarType.Matrix4, lightProbe.getUniformMatrix());
      //setVector4InArray(lightProbe.getPosition().x, lightProbe.getPosition().y, lightProbe.getPosition().z, 1f / area.getRadius() + lightProbe.getNbMipMaps(), 0);
  shCoeffs.setValue(VarType.Vector3Array, lightProbe.getShCoeffs());
  //assigning new texture indexes
  int pemUnit = lastTexUnit++;
  rm.getRenderer().setTexture(pemUnit, lightProbe.getPrefilteredEnvMap());
  lightProbePemMap.setValue(VarType.Int, pemUnit);
  return lastTexUnit;
}

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

private int applyOverrides(Renderer renderer, Shader shader, SafeArrayList<MatParamOverride> overrides, int unit) {
  for (MatParamOverride override : overrides.getArray()) {
    VarType type = override.getVarType();
    MatParam paramDef = def.getMaterialParam(override.getName());
    if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) {
      continue;
    }
    Uniform uniform = shader.getUniform(override.getPrefixedName());
    if (override.getValue() != null) {
      if (type.isTextureType()) {
        renderer.setTexture(unit, (Texture) override.getValue());
        uniform.setValue(VarType.Int, unit);
        unit++;
      } else {
        uniform.setValue(type, override.getValue());
      }
    } else {
      uniform.clearValue();
    }
  }
  return unit;
}

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

renderer.setTexture(unit, (Texture) param.getValue());
uniform.setValue(VarType.Int, unit);
unit++;

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

@Override
public void apply(Renderer r, Technique technique, int paramIndex) {
  TechniqueDef techDef = technique.getDef();
  r.setTexture(getUnit(), getTextureValue());
  if (techDef.isUsingShaders()) {
    technique.updateUniformParam(paramIndex, getVarType(), getUnit(), true);
  }
}
@Override

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

@Override
public void apply(Renderer r, Technique technique) {
  TechniqueDef techDef = technique.getDef();
  r.setTexture(getUnit(), getTextureValue());
  if (techDef.isUsingShaders()) {
    technique.updateUniformParam(getPrefixedName(), getVarType(), getUnit(), true);
  }
}
@Override

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

private int updateShaderMaterialParameters(Renderer renderer, Shader shader,
                      SafeArrayList<MatParamOverride> worldOverrides, SafeArrayList<MatParamOverride> forcedOverrides) {
  int unit = 0;
  if (worldOverrides != null) {
    unit = applyOverrides(renderer, shader, worldOverrides, unit);
  }
  if (forcedOverrides != null) {
    unit = applyOverrides(renderer, shader, forcedOverrides, unit);
  }
  for (int i = 0; i < paramValues.size(); i++) {
    MatParam param = paramValues.getValue(i);
    VarType type = param.getVarType();
    Uniform uniform = shader.getUniform(param.getPrefixedName());
    if (uniform.isSetByCurrentMaterial()) {
      continue;
    }
    if (type.isTextureType()) {
      renderer.setTexture(unit, (Texture) param.getValue());
      uniform.setValue(VarType.Int, unit);
      unit++;
    } else {
      uniform.setValue(type, param.getValue());
    }
  }
  //TODO HACKY HACK remove this when texture unit is handled by the uniform.
  return unit;
}

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

if (param instanceof MatParamTexture) {
  MatParamTexture texParam = (MatParamTexture) param;
  r.setTexture(0, texParam.getTextureValue());
} else {
  if (!techDef.isUsingShaders()) {

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

private int applyOverrides(Renderer renderer, Shader shader, SafeArrayList<MatParamOverride> overrides, int unit) {
  for (MatParamOverride override : overrides.getArray()) {
    VarType type = override.getVarType();
    MatParam paramDef = def.getMaterialParam(override.getName());
    if (paramDef == null || paramDef.getVarType() != type || !override.isEnabled()) {
      continue;
    }
    Uniform uniform = shader.getUniform(override.getPrefixedName());
    if (override.getValue() != null) {
      if (type.isTextureType()) {
        renderer.setTexture(unit, (Texture) override.getValue());
        uniform.setValue(VarType.Int, unit);
        unit++;
      } else {
        uniform.setValue(type, override.getValue());
      }
    } else {
      uniform.clearValue();
    }
  }
  return unit;
}

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

rm.getRenderer().setTexture(pemUnit, lightProbe.getPrefilteredEnvMap());
  lightProbePemMap.setValue(VarType.Int, pemUnit);
} else {

相关文章