com.jme3.material.RenderState.setCustomBlendFactors()方法的使用及代码示例

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

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

RenderState.setCustomBlendFactors介绍

[英]Sets the blend factors used for the source and destination color.

These factors will be multiplied with the color values of the input pixel and the pixel already in the color buffer, before both colors gets combined by the BlendEquation.

Note: This gets only used in BlendMode#Custom mode. All other blend modes will ignore this setting.
[中]设置用于源颜色和目标颜色的混合因子。
这些因子将与输入像素的颜色值和颜色缓冲区中已经存在的像素的颜色值相乘,然后这两种颜色通过混合方程式进行组合。
注意:这仅在BlendMode#自定义模式下使用。所有其他混合模式将忽略此设置。

代码示例

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

/**
 * Adds a "transparent" quad to the scene, that shows an inverse blue value sight of the scene behind.
 */
private void createLeftQuad() {
  Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  // This color creates a blue value image. The effect will have a strength of 80% (set by the alpha value).
  material.setColor("Color", new ColorRGBA(0f, 0f, 1f, 0.8f));
  // Result.RGB = Source.A * Source.RGB - Source.A * Destination.RGB
  // Result.A   = Destination.A
  material.getAdditionalRenderState().setBlendMode(RenderState.BlendMode.Custom);
  material.getAdditionalRenderState().setBlendEquation(RenderState.BlendEquation.Subtract);
  material.getAdditionalRenderState().setBlendEquationAlpha(RenderState.BlendEquationAlpha.Add);
  material.getAdditionalRenderState().setCustomBlendFactors(
      RenderState.BlendFunc.Src_Alpha, RenderState.BlendFunc.Src_Alpha,
      RenderState.BlendFunc.Zero, RenderState.BlendFunc.One);
  leftQuad = new Geometry("LeftQuad", new Quad(1f, 1f));
  leftQuad.setMaterial(material);
  leftQuad.setQueueBucket(RenderQueue.Bucket.Transparent);
  rootNode.attachChild(leftQuad);
}

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

state.blendMode = additionalState.blendMode;
if (additionalState.getBlendMode().equals(BlendMode.Custom)) {
  state.setCustomBlendFactors(
  additionalState.getCustomSfactorRGB(),
  additionalState.getCustomDfactorRGB(),

相关文章

微信公众号

最新文章

更多