Class ShaderProgramProvider
- java.lang.Object
-
- com.badlogic.gdx.assets.loaders.AssetLoader<T,P>
-
- com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<ExtShaderProgram,ShaderProgramProvider.ShaderProgramParameter>
-
- gaia.cu9.ari.gaiaorbit.util.gdx.shader.ShaderProgramProvider
-
public class ShaderProgramProvider extends com.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<ExtShaderProgram,ShaderProgramProvider.ShaderProgramParameter>
AssetLoader
forExtShaderProgram
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
ExtShaderProgram.prependVertexCode
andExtShaderProgram.prependFragmentCode
).The above default behavior for finding the files can be overridden by explicitly setting the file names in a
ShaderProgramProvider.ShaderProgramParameter
. The parameter can also be used to prepend code to the programs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShaderProgramProvider.ShaderProgramParameter
-
Constructor Summary
Constructors Constructor Description ShaderProgramProvider(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
ShaderProgramProvider(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver, java.lang.String vertexFileSuffix, java.lang.String fragmentFileSuffix)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor>
getDependencies(java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
static java.lang.String
getShaderCode(java.lang.String prefix, java.lang.String code)
void
loadAsync(com.badlogic.gdx.assets.AssetManager manager, java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
ExtShaderProgram
loadSync(com.badlogic.gdx.assets.AssetManager manager, java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
-
-
-
Constructor Detail
-
ShaderProgramProvider
public ShaderProgramProvider(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver)
-
ShaderProgramProvider
public ShaderProgramProvider(com.badlogic.gdx.assets.loaders.FileHandleResolver resolver, java.lang.String vertexFileSuffix, java.lang.String fragmentFileSuffix)
-
-
Method Detail
-
getDependencies
public com.badlogic.gdx.utils.Array<com.badlogic.gdx.assets.AssetDescriptor> getDependencies(java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
- Specified by:
getDependencies
in classcom.badlogic.gdx.assets.loaders.AssetLoader<ExtShaderProgram,ShaderProgramProvider.ShaderProgramParameter>
-
loadAsync
public void loadAsync(com.badlogic.gdx.assets.AssetManager manager, java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
- Specified by:
loadAsync
in classcom.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<ExtShaderProgram,ShaderProgramProvider.ShaderProgramParameter>
-
loadSync
public ExtShaderProgram loadSync(com.badlogic.gdx.assets.AssetManager manager, java.lang.String fileName, com.badlogic.gdx.files.FileHandle file, ShaderProgramProvider.ShaderProgramParameter parameter)
- Specified by:
loadSync
in classcom.badlogic.gdx.assets.loaders.AsynchronousAssetLoader<ExtShaderProgram,ShaderProgramProvider.ShaderProgramParameter>
-
getShaderCode
public static java.lang.String getShaderCode(java.lang.String prefix, java.lang.String code)
-
-