Package edu.cornell.gdiac.assets
Class ShaderParser
java.lang.Object
edu.cornell.gdiac.assets.ShaderParser
- All Implemented Interfaces:
AssetParser<Shader>
This class parses a JSON entry into a
Shader.
The parser converts JSON entries into ShaderLoader.ShaderParameters
values of the same name. In particular, the JSON entry allows the developer
to group the vertex shader with its fragment shader. It also allows the
developer to specify both GL20 and GL30 shaders for maximum flexibility.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if o is another ShaderParsergetType()Returns the asset type generated by this parserbooleanhasNext()Returns true if there are still assets left to generatevoidprocessNext(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.utils.ObjectMap<String, String> keymap) Processes the next available texture, loading it into the asset managervoidreset(com.badlogic.gdx.utils.JsonValue directory) Resets the parser iterator for the given directory.
-
Constructor Details
-
ShaderParser
public ShaderParser()
-
-
Method Details
-
getType
Returns the asset type generated by this parser- Specified by:
getTypein interfaceAssetParser<Shader>- Returns:
- the asset type generated by this parser
-
reset
public void reset(com.badlogic.gdx.utils.JsonValue directory) Resets the parser iterator for the given directory.The value directory is assumed to be the root of a larger JSON structure. The individual assets are defined by subtrees in this structure.
- Specified by:
resetin interfaceAssetParser<Shader>- Parameters:
directory- The JSON representation of the asset directory
-
hasNext
public boolean hasNext()Returns true if there are still assets left to generate- Specified by:
hasNextin interfaceAssetParser<Shader>- Returns:
- true if there are still assets left to generate
-
processNext
public void processNext(com.badlogic.gdx.assets.AssetManager manager, com.badlogic.gdx.utils.ObjectMap<String, String> keymap) Processes the next available texture, loading it into the asset managerThe parser converts JSON entries into
ShaderLoader.ShaderParametersvalues of the same name. The file will be the contents of the file entry. The key will be the name of the font object. This method fails silently if there are no available assets to process.- Specified by:
processNextin interfaceAssetParser<Shader>- Parameters:
manager- The asset manager to load an assetkeymap- The mapping of JSON keys to asset file names
-
equals
Returns true if o is another ShaderParser
-