AssetLoader for ShaderProgram instances loaded from text files. If the file suffix is ".vert", it is assumed
to be a vertex shader, and a fragment shader is found using the same file name with a ".frag" suffix. And vice versa if the
file suffix is ".frag". These default suffixes can be changed in the ShaderProgramLoader constructor.
For all other file suffixes, the same file is used for both (and therefore should internally distinguish between the programs
using preprocessor directives and ShaderProgram#prependVertexCode and ShaderProgram#prependFragmentCode).
The above default behavior for finding the files can be overridden by explicitly setting the file names in a
ShaderProgramParameter. The parameter can also be used to prepend code to the programs.
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Access | Constructor and Description |
|---|---|
| public | |
| public | ShaderProgramLoader(FileHandleResolver resolver, String vertexFileSuffix, String fragmentFileSuffix)
|
| Modifier and Type | Method and Description |
|---|---|
| public Array | getDependencies(String fileName, FileHandle file, ShaderProgramLoader.
Implements abstract com. Returns the assets this asset requires to be loaded first. |
| public void | loadAsync(AssetManager manager, String fileName, FileHandle file, ShaderProgramLoader.
Implements abstract com. Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager. |
| public ShaderProgram | loadSync(AssetManager manager, String fileName, FileHandle file, ShaderProgramLoader.
Implements abstract com. Loads the OpenGL part of the asset. |
| fragmentFileSuffix | back to summary |
|---|---|
| private String fragmentFileSuffix | |
| vertexFileSuffix | back to summary |
|---|---|
| private String vertexFileSuffix | |
| ShaderProgramLoader | back to summary |
|---|---|
| public ShaderProgramLoader(FileHandleResolver resolver) | |
| ShaderProgramLoader | back to summary |
|---|---|
| public ShaderProgramLoader(FileHandleResolver resolver, String vertexFileSuffix, String fragmentFileSuffix) | |
| getDependencies | back to summary |
|---|---|
| public Array Implements abstract com. Doc from com. Returns the assets this asset requires to be loaded first. This method may be called on a thread other than the GL thread.
| |
| loadAsync | back to summary |
|---|---|
| public void loadAsync(AssetManager manager, String fileName, FileHandle file, ShaderProgramLoader. Implements abstract com. Doc from com. Loads the non-OpenGL part of the asset and injects any dependencies of the asset into the AssetManager.
| |
| loadSync | back to summary |
|---|---|
| public ShaderProgram loadSync(AssetManager manager, String fileName, FileHandle file, ShaderProgramLoader. Implements abstract com. Doc from com. Loads the OpenGL part of the asset.
| |
| Modifier and Type | Field and Description |
|---|---|
| public String | fragmentFile
File name to be used for the fragment program instead of the default determined by the file name used to submit this asset to AssetManager. |
| public boolean | logOnCompileFailure
Whether to log (at the error level) the shader's log if it fails to compile. |
| public String | prependFragmentCode
Code that is always added to the fragment shader code. |
| public String | prependVertexCode
Code that is always added to the vertex shader code. |
| public String | vertexFile
File name to be used for the vertex program instead of the default determined by the file name used to submit this asset to AssetManager. |
| Access | Constructor and Description |
|---|---|
| public |
| fragmentFile | back to summary |
|---|---|
| public String fragmentFile File name to be used for the fragment program instead of the default determined by the file name used to submit this asset to AssetManager. | |
| logOnCompileFailure | back to summary |
|---|---|
| public boolean logOnCompileFailure Whether to log (at the error level) the shader's log if it fails to compile. Default true. | |
| prependFragmentCode | back to summary |
|---|---|
| public String prependFragmentCode Code that is always added to the fragment shader code. This is added as-is, and you should include a newline (`\n`) if needed. ShaderProgram#prependFragmentCode is placed before this code. | |
| prependVertexCode | back to summary |
|---|---|
| public String prependVertexCode Code that is always added to the vertex shader code. This is added as-is, and you should include a newline (`\n`) if needed. ShaderProgram#prependVertexCode is placed before this code. | |
| vertexFile | back to summary |
|---|---|
| public String vertexFile File name to be used for the vertex program instead of the default determined by the file name used to submit this asset to AssetManager. | |
| ShaderProgramParameter | back to summary |
|---|---|
| public ShaderProgramParameter() | |