Class LegacyNormalMapHelper

java.lang.Object
org.boxutil.helper.legacy.LegacyNormalMapHelper

public class LegacyNormalMapHelper extends Object
For example:
 
 AnyStruct[] todoTex; // {int texID; int texWidth; int texHeight;};
 List<Integer> resultTex;
 LegacyNormalMapHelper helper;
 NormalMapGenParam param;

 if (helper.isValid()) {
     int tmp;
     helper.glBeginProcess();
     helper.glPutParameter(param); // Required and not null.

     for (AnyStruct tex : todoTex) {
         if (helper.glPutSourceTexture(tex.texID, tex.texLocalWidth, tex.texLocalHeight, tex.texGLWidth, tex.texGLHeight, true, true)) {
             tmp = helper.glGenerateMap();
             if (tmp > 0) resultTex.add(tmp);
         }
     }

     helper.glEndProcess();
 }

 // ***

 if (helper.isValid()) helper.destroy(); // REQUIRED!!! if no need after.
 
 
  • Field Details

    • _FBO

      protected final int _FBO
    • _VBO

      protected final int _VBO
    • _programUpdate

      protected final FloatBuffer _programUpdate
    • _programBlur

      protected final BaseShaderData _programBlur
    • _programResult

      protected final BaseShaderData _programResult
    • _lastSwapTex

      protected final int _lastSwapTex
    • _valid

      protected boolean _valid
    • _lastSrcTex

      protected int _lastSrcTex
    • _lastGenTex

      protected int _lastGenTex
    • _currWidth

      protected int _currWidth
    • _currHeight

      protected int _currHeight
    • _currLocalWidth

      protected int _currLocalWidth
    • _currLocalHeight

      protected int _currLocalHeight
    • _lastSwapWidth

      protected int _lastSwapWidth
    • _lastSwapHeight

      protected int _lastSwapHeight
    • _currResultWidth

      protected int _currResultWidth
    • _currResultHeight

      protected int _currResultHeight
    • _currLocalU_Div

      protected float _currLocalU_Div
    • _currLocalV_Div

      protected float _currLocalV_Div
    • _notBlur

      protected boolean _notBlur
    • _textureStorage

      protected boolean _textureStorage
    • _genMipmapAfter

      protected boolean _genMipmapAfter
  • Constructor Details

    • LegacyNormalMapHelper

      public LegacyNormalMapHelper()
  • Method Details

    • destroy

      public void destroy()
    • isValid

      public boolean isValid()
    • glBeginProcess

      public void glBeginProcess()
    • glPutParameter

      public void glPutParameter(ShaderUtil.NormalMapGenParam param)
      Note: without "bilateral filter", "volume", "details"
    • glPutSourceTexture

      public boolean glPutSourceTexture(int texture, int localWidth, int localHeight, int resultWidth, int resultHeight, boolean alignPOT, boolean tryMipmap)
      Only for make the new normal map texture directly, use it with glGenerateMap().
      Parameters:
      alignPOT - will force true when NPOT texture was not supported.
    • glPutSourceTexture

      public boolean glPutSourceTexture(int texture, int localWidth, int localHeight, int resultTex)
      Only for if you hava a RGBA8 result texture, use it with glGenerateMap().
    • glGenerateMapRegion

      public int glGenerateMapRegion(int sourceOffsetX, int sourceOffsetY, int sourceFullWidth, int sourceFullHeight, int resultOffsetX, int resultOffsetY, int resultFullWidth, int resultFullHeight)
      Only for make normal map and write into a existing texture, must be use it with glPutSourceTexture(int, int, int, int).
      Parameters:
      sourceOffsetX - the source texture region left-bottom origin x-position.
      sourceOffsetY - the source texture region left-bottom origin y-position.
      sourceFullWidth - the source full-texture width.
      sourceFullHeight - the source full-texture height.
      resultOffsetX - the result texture region left-bottom origin x-position.
      resultOffsetY - the result texture region left-bottom origin x-position.
      resultFullWidth - the result full-texture width.
      resultFullHeight - the result full-texture height.
      Returns:
      the result texture that have been set before calls
    • glGenerateMap

      public int glGenerateMap()
      Only for make a new texture, must be use it with glPutSourceTexture(int, int, int, int, int, boolean, boolean).
      Returns:
      new normal map texture
    • glEndProcess

      public void glEndProcess()