com.jme3.scene.plugins.blender.textures.blending
Class TextureBlenderLuminance

java.lang.Object
  extended by com.jme3.scene.plugins.blender.textures.blending.TextureBlenderLuminance
All Implemented Interfaces:
TextureBlender

public class TextureBlenderLuminance
extends java.lang.Object

The class that is responsible for blending the following texture types:

  • Luminance8
  • Luminance8Alpha8 Not yet supported (but will be):
  • Luminance16:
  • Luminance16Alpha16:
  • Luminance16F:
  • Luminance16FAlpha16F:
  • Luminance32F:


    Field Summary
    protected  float blendFactor
               
    protected  int blendType
               
    protected  float[] color
               
    protected  int flag
               
    protected  float[] materialColor
               
    protected  boolean negateTexture
               
     
    Fields inherited from interface com.jme3.scene.plugins.blender.textures.blending.TextureBlender
    MTEX_ADD, MTEX_BLEND, MTEX_BLEND_COLOR, MTEX_BLEND_HUE, MTEX_BLEND_SAT, MTEX_BLEND_VAL, MTEX_DARK, MTEX_DIFF, MTEX_DIV, MTEX_LIGHT, MTEX_MUL, MTEX_NUM_BLENDTYPES, MTEX_OVERLAY, MTEX_SCREEN, MTEX_SUB
     
    Constructor Summary
    TextureBlenderLuminance(int flag, boolean negateTexture, int blendType, float[] materialColor, float[] color, float blendFactor)
               
     
    Method Summary
     Image blend(Image image, Image baseImage, BlenderContext blenderContext)
              This method blends the given texture with material color and the defined color in 'map to' panel.
    protected  void blendHSV(int type, float[] materialRGB, float fac, float[] pixelColor, BlenderContext blenderContext)
              The method that performs the ramp blending.
    protected  void blendPixel(float[] result, float[] materialColor, float[] color, float textureIntensity, float textureFactor, int blendtype, BlenderContext blenderContext)
              This method blends the texture with an appropriate color.
     void copyBlendingData(TextureBlender textureBlender)
              Copies blending data.
    protected  void getTinAndAlpha(java.nio.ByteBuffer data, Image.Format imageFormat, boolean neg, float[] result)
              This method return texture intensity and alpha value.
    protected  void prepareImagesForBlending(Image target, Image source)
              The method prepares images for blending.
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    flag

    protected int flag

    negateTexture

    protected boolean negateTexture

    blendType

    protected int blendType

    materialColor

    protected float[] materialColor

    color

    protected float[] color

    blendFactor

    protected float blendFactor
    Constructor Detail

    TextureBlenderLuminance

    public TextureBlenderLuminance(int flag,
                                   boolean negateTexture,
                                   int blendType,
                                   float[] materialColor,
                                   float[] color,
                                   float blendFactor)
    Method Detail

    blend

    public Image blend(Image image,
                       Image baseImage,
                       BlenderContext blenderContext)
    Description copied from interface: TextureBlender
    This method blends the given texture with material color and the defined color in 'map to' panel. As a result of this method a new texture is created. The input texture is NOT.

    Parameters:
    image - the image we use in blending
    baseImage - the texture that is underneath the current texture (its pixels will be used instead of material color)
    blenderContext - the blender context
    Returns:
    new image that was created after the blending

    getTinAndAlpha

    protected void getTinAndAlpha(java.nio.ByteBuffer data,
                                  Image.Format imageFormat,
                                  boolean neg,
                                  float[] result)
    This method return texture intensity and alpha value.

    Parameters:
    data - the texture data
    imageFormat - the image format
    neg - indicates if the texture is negated
    result - the table (2 elements) where the result is being stored

    blendPixel

    protected void blendPixel(float[] result,
                              float[] materialColor,
                              float[] color,
                              float textureIntensity,
                              float textureFactor,
                              int blendtype,
                              BlenderContext blenderContext)
    This method blends the texture with an appropriate color.

    Parameters:
    result - the result color (variable 'in' in blender source code)
    materialColor - the texture color (variable 'out' in blender source coude)
    color - the previous color (variable 'tex' in blender source code)
    textureIntensity - texture intensity (variable 'fact' in blender source code)
    textureFactor - texture affection factor (variable 'facg' in blender source code)
    blendtype - the blend type
    blenderContext - the blender context

    blendHSV

    protected void blendHSV(int type,
                            float[] materialRGB,
                            float fac,
                            float[] pixelColor,
                            BlenderContext blenderContext)
    The method that performs the ramp blending.

    Parameters:
    type - the blend type
    materialRGB - the rgb value of the material, here the result is stored too
    fac - color affection factor
    pixelColor - the texture color
    blenderContext - the blender context

    copyBlendingData

    public void copyBlendingData(TextureBlender textureBlender)
    Description copied from interface: TextureBlender
    Copies blending data. Used for blending type format changing.

    Specified by:
    copyBlendingData in interface TextureBlender
    Parameters:
    textureBlender - the blend data that should be copied

    prepareImagesForBlending

    protected void prepareImagesForBlending(Image target,
                                            Image source)
    The method prepares images for blending. It generates mipmaps if one of the images has them defined and the other one has not.

    Parameters:
    target - the image where the blending result is stored
    source - the image that is being read only