Class TessellationShaderProgram
java.lang.Object
gaiasky.util.gdx.shader.ExtShaderProgram
gaiasky.util.gdx.shader.TessellationShaderProgram
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringstatic StringCode that is always added to the tessellation shaders, typically used to inject a #version line.static StringFields inherited from class ExtShaderProgram
attributeNames, attributes, attributeSizes, attributeTypes, byteBuffer, COLOR_ATTRIBUTE, format, fragmentShaderFile, fragmentShaderHandle, fragmentShaderSource, geometryShaderFile, geometryShaderSource, intBuffer, invalidated, isCompiled, isDisposed, isLazy, len, log, name, NORMAL_ATTRIBUTE, params, pedantic, POSITION_ATTRIBUTE, prependFragmentCode, prependGeometryCode, prependVertexCode, program, TEXCOORD_ATTRIBUTE, type, uniformNames, uniforms, uniformSizes, uniformTypes, vertexShaderFile, vertexShaderHandle, vertexShaderSourceModifier and TypeFieldDescriptionprotected String[]Attribute names.protected com.badlogic.gdx.utils.ObjectIntMap<String> Attribute lookup.protected com.badlogic.gdx.utils.ObjectIntMap<String> Attribute sizes.protected com.badlogic.gdx.utils.ObjectIntMap<String> Attribute types.protected ByteBufferByte buffer to get binary shaders.static final StringDefault name for color attributes.protected IntBufferInt for shader binary format.protected Stringprotected intFragment shader handle.protected StringFragment shader source.protected Stringprotected StringGeometry shader source.protected IntBufferAux integer buffer.protected booleanWhether this shader was invalidated.protected booleanWhether this program compiled successfully.protected booleanWhether this program has been disposed.protected booleanWhether lazy loading is activated for this shader.protected IntBufferInt for shader length.protected StringThe log.protected StringThe shader name, if any.static final StringDefault name for normal attribute.protected IntBufferInt buffer for parameters.static booleanFlag indicating whether attributes & uniforms must be present at all times.static final StringDefault name for position attributes.static StringCode that is always added to every fragment shader code, typically used to inject a #version line.static StringCode that is always added to the geometry shader code, typically used to inject a #version line.static StringCode that is always added to the vertex shader code, typically used to inject a #version line.protected intProgram handle.static final StringDefault name for texture coordinates attributes, append texture unit number.protected IntBufferInt buffer for types.protected String[]Uniform names.protected com.badlogic.gdx.utils.ObjectIntMap<String> Uniform lookup.protected com.badlogic.gdx.utils.ObjectIntMap<String> Uniform sizes.protected com.badlogic.gdx.utils.ObjectIntMap<String> Uniform types.protected Stringprotected intVertex shader handle.protected StringVertex shader source. -
Constructor Summary
ConstructorsConstructorDescriptionTessellationShaderProgram(String vertexShaderCode, String controlShaderCode, String evaluationShaderCode, String fragmentShaderCode) TessellationShaderProgram(String name, String vertexFile, String tessControlFile, String tessEvaluationFile, String fragmentFile, String vertexShaderCode, String controlShaderCode, String evaluationShaderCode, String fragmentShaderCode, boolean lazyLoading) Constructs a new shader program and immediately compiles it, if it is not lazy. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidclearAllShaderPrograms(com.badlogic.gdx.Application app) voidcompile()voiddispose()Disposes all resources associated with this shader.static Stringstatic intstatic voidinvalidateAllShaderPrograms(com.badlogic.gdx.Application app) Invalidates all shaders so the next time they are used new handles are generatedvoidMethods inherited from class ExtShaderProgram
begin, compile, disableVertexAttribute, disableVertexAttribute, enableVertexAttribute, enableVertexAttribute, end, fetchAttributeLocation, fetchAttributes, fetchUniformLocation, fetchUniformLocation, fetchUniforms, getAttributeLocation, getAttributes, getAttributeSize, getAttributeType, getFragmentShaderFileName, getFragmentShaderSource, getGeometryShaderFileName, getGeometryShaderSource, getLog, getName, getUniformLocation, getUniforms, getUniformSize, getUniformType, getVertexShaderFileName, getVertexShaderSource, hasAttribute, hasUniform, initializeLocalAssets, isCompiled, isLazy, setAttributef, setUniform1fv, setUniform1fv, setUniform2fv, setUniform2fv, setUniform3fv, setUniform3fv, setUniform4fv, setUniform4fv, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformf, setUniformi, setUniformi, setUniformi, setUniformi, setUniformi, setUniformi, setUniformi, setUniformi, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix, setUniformMatrix3fv, setUniformMatrix4fv, setUniformMatrix4fv, setUniformMatrix4fv, setVertexAttribute, setVertexAttribute, setVertexAttribute, setVertexAttribute, writeShaderModifier and TypeMethodDescriptionvoidbegin()Makes OpenGL ES 2.0 use this vertex and fragment shader pair.voidvoiddisableVertexAttribute(int location) voiddisableVertexAttribute(String name) Disables the vertex attribute with the given namevoidenableVertexAttribute(int location) voidenableVertexAttribute(String name) Enables the vertex attribute with the given namevoidend()Disables this shader.protected intfetchAttributeLocation(String name) protected voidprotected intfetchUniformLocation(String name) intfetchUniformLocation(String name, boolean pedantic) protected voidintgetAttributeLocation(String name) String[]intgetAttributeSize(String name) intgetAttributeType(String name) getLog()getName()intgetUniformLocation(String name) String[]intgetUniformSize(String name) intgetUniformType(String name) booleanhasAttribute(String name) booleanhasUniform(String name) protected voidbooleanbooleanisLazy()voidsetAttributef(String name, float value1, float value2, float value3, float value4) Sets the given attributevoidsetUniform1fv(int location, float[] values, int offset, int length) voidsetUniform1fv(String name, float[] values, int offset, int length) voidsetUniform2fv(int location, float[] values, int offset, int length) voidsetUniform2fv(String name, float[] values, int offset, int length) voidsetUniform3fv(int location, float[] values, int offset, int length) voidsetUniform3fv(String name, float[] values, int offset, int length) voidsetUniform4fv(int location, float[] values, int offset, int length) voidsetUniform4fv(String name, float[] values, int offset, int length) voidsetUniformf(int location, float value) voidsetUniformf(int location, float value1, float value2) voidsetUniformf(int location, float value1, float value2, float value3) voidsetUniformf(int location, float value1, float value2, float value3, float value4) voidsetUniformf(int location, com.badlogic.gdx.graphics.Color values) voidsetUniformf(int location, com.badlogic.gdx.math.Vector2 values) voidsetUniformf(int location, com.badlogic.gdx.math.Vector3 values) voidsetUniformf(String name, float value) Sets the uniform with the given name.voidsetUniformf(String name, float value1, float value2) Sets the uniform with the given name.voidsetUniformf(String name, float value1, float value2, float value3) Sets the uniform with the given name.voidsetUniformf(String name, float value1, float value2, float value3, float value4) Sets the uniform with the given name.voidsetUniformf(String name, com.badlogic.gdx.graphics.Color values) Sets the uniform with the given name.voidsetUniformf(String name, com.badlogic.gdx.math.Vector2 values) Sets the uniform with the given name.voidsetUniformf(String name, com.badlogic.gdx.math.Vector3 values) Sets the uniform with the given name.voidsetUniformf(String name, Vector3D values) Sets the uniform with the given name.voidsetUniformf(String name, Vector3Q values) Sets the uniform with the given name.voidsetUniformi(int location, int value) voidsetUniformi(int location, int value1, int value2) voidsetUniformi(int location, int value1, int value2, int value3) voidsetUniformi(int location, int value1, int value2, int value3, int value4) voidsetUniformi(String name, int value) Sets the uniform with the given name.voidsetUniformi(String name, int value1, int value2) Sets the uniform with the given name.voidsetUniformi(String name, int value1, int value2, int value3) Sets the uniform with the given name.voidsetUniformi(String name, int value1, int value2, int value3, int value4) Sets the uniform with the given name.voidsetUniformMatrix(int location, com.badlogic.gdx.math.Matrix3 matrix) voidsetUniformMatrix(int location, com.badlogic.gdx.math.Matrix3 matrix, boolean transpose) voidsetUniformMatrix(int location, com.badlogic.gdx.math.Matrix4 matrix) voidsetUniformMatrix(int location, com.badlogic.gdx.math.Matrix4 matrix, boolean transpose) voidsetUniformMatrix(String name, com.badlogic.gdx.math.Matrix3 matrix) Sets the uniform matrix with the given name.voidsetUniformMatrix(String name, com.badlogic.gdx.math.Matrix3 matrix, boolean transpose) Sets the uniform matrix with the given name.voidsetUniformMatrix(String name, com.badlogic.gdx.math.Matrix4 matrix) Sets the uniform matrix with the given name.voidsetUniformMatrix(String name, com.badlogic.gdx.math.Matrix4 matrix, boolean transpose) Sets the uniform matrix with the given name.voidsetUniformMatrix3fv(String name, FloatBuffer buffer, int count, boolean transpose) Sets an array of uniform matrices with the given name.voidsetUniformMatrix4fv(int location, float[] values, int offset, int length) voidsetUniformMatrix4fv(String name, float[] values, int offset, int length) voidsetUniformMatrix4fv(String name, FloatBuffer buffer, int count, boolean transpose) Sets an array of uniform matrices with the given name.voidsetVertexAttribute(int location, int size, int type, boolean normalize, int stride, int offset) voidsetVertexAttribute(int location, int size, int type, boolean normalize, int stride, Buffer buffer) voidsetVertexAttribute(String name, int size, int type, boolean normalize, int stride, int offset) Sets the vertex attribute with the given name.voidsetVertexAttribute(String name, int size, int type, boolean normalize, int stride, Buffer buffer) Sets the vertex attribute with the given name.static voidwriteShader(String name, String code)
-
Field Details
-
prependControlCode
Code that is always added to the tessellation shaders, typically used to inject a #version line. Note that this is added as-is, you should include a newline (`\n`) if needed. -
prependEvaluationCode
-
controlShaderFile
-
evaluationShaderFile
-
-
Constructor Details
-
TessellationShaderProgram
-
TessellationShaderProgram
public TessellationShaderProgram(String name, String vertexFile, String tessControlFile, String tessEvaluationFile, String fragmentFile, String vertexShaderCode, String controlShaderCode, String evaluationShaderCode, String fragmentShaderCode, boolean lazyLoading) Constructs a new shader program and immediately compiles it, if it is not lazy.- Parameters:
name- The shader name, if any.vertexFile- The vertex shader file.tessControlFile- The tessellation control shader file.tessEvaluationFile- The tessellation evaluation shader file.fragmentFile- The fragment shader file.vertexShaderCode- The vertex shader code.controlShaderCode- The tessellation control shader code.evaluationShaderCode- The tessellation evaluation shader code.fragmentShaderCode- The fragment shader code.lazyLoading- Whether to use lazy loading, only preparing the data without actually compiling the shaders.
-
-
Method Details
-
compile
public void compile() -
invalidateAllShaderPrograms
public static void invalidateAllShaderPrograms(com.badlogic.gdx.Application app) Invalidates all shaders so the next time they are used new handles are generated -
clearAllShaderPrograms
public static void clearAllShaderPrograms(com.badlogic.gdx.Application app) -
getManagedStatus
-
getNumManagedShaderPrograms
public static int getNumManagedShaderPrograms()- Returns:
- the number of managed shader programs currently loaded
-
getControlShaderSource
-
getControlShaderFileName
-
getEvaluationShaderSource
-
getEvaluationShaderFileName
-
dispose
public void dispose()Description copied from class:ExtShaderProgramDisposes all resources associated with this shader. Must be called when the shader is no longer used.- Specified by:
disposein interfacecom.badlogic.gdx.utils.Disposable- Overrides:
disposein classExtShaderProgram
-
writeShaders
public void writeShaders()- Overrides:
writeShadersin classExtShaderProgram
-