Package org.boxutil.helper.legacy
Class LegacyNormalMapHelper
java.lang.Object
org.boxutil.helper.legacy.LegacyNormalMapHelper
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 Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected intprotected floatprotected floatprotected intprotected intprotected intprotected intprotected final intprotected booleanprotected intprotected intprotected intprotected final intprotected intprotected booleanprotected final BaseShaderDataprotected final BaseShaderDataprotected final FloatBufferprotected booleanprotected booleanprotected final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()voidvoidintOnly for make a new texture, must be use it withglPutSourceTexture(int, int, int, int, int, boolean, boolean).intglGenerateMapRegion(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 withglPutSourceTexture(int, int, int, int).voidNote: without "bilateral filter", "volume", "details"booleanglPutSourceTexture(int texture, int localWidth, int localHeight, int resultTex) Only for if you hava aRGBA8result texture, use it withglGenerateMap().booleanglPutSourceTexture(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 withglGenerateMap().booleanisValid()
-
Field Details
-
_FBO
protected final int _FBO -
_VBO
protected final int _VBO -
_programUpdate
-
_programBlur
-
_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
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 withglGenerateMap().- 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 aRGBA8result texture, use it withglGenerateMap(). -
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 withglPutSourceTexture(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 withglPutSourceTexture(int, int, int, int, int, boolean, boolean).- Returns:
- new normal map texture
-
glEndProcess
public void glEndProcess()
-