Class SourceFile
java.lang.Object
com.jozufozu.flywheel.backend.glsl.SourceFile
- All Implemented Interfaces:
SourceComponent
Immutable class representing a shader file.
This class parses shader files and generates what is effectively a high level AST of the source.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal com.google.common.collect.ImmutableMap<String,ShaderField> final Stringfinal com.google.common.collect.ImmutableMap<String,ShaderFunction> Function lookup by name.final com.google.common.collect.ImmutableList<Import>Includes ordered as defined in the source.final List<SourceFile>final net.minecraft.resources.ResourceLocationfinal SourceLinesfinal com.google.common.collect.ImmutableMap<String,ShaderStruct> Struct lookup by name. -
Method Summary
Modifier and TypeMethodDescriptionstatic LoadResultempty(net.minecraft.resources.ResourceLocation name) booleanfindFunction(String name) Search this file and recursively search all imports to find a function definition matching the given name.findStructByName(String name) Search this file and recursively search all imports to find a struct definition matching the given name.getLineSpan(int lineNo) getLineSpanMatching(int line, @Nullable String match) getLineSpanNoWhitespace(int line) inthashCode()Collection<? extends SourceComponent>included()name()static LoadResultparse(ShaderSources sourceFinder, net.minecraft.resources.ResourceLocation name, String stringSource) source()toString()
-
Field Details
-
name
public final net.minecraft.resources.ResourceLocation name -
source
-
functions
Function lookup by name. -
structs
Struct lookup by name. -
imports
Includes ordered as defined in the source. -
fields
-
included
-
finalSource
-
-
Method Details
-
empty
-
parse
public static LoadResult parse(ShaderSources sourceFinder, net.minecraft.resources.ResourceLocation name, String stringSource) -
included
- Specified by:
includedin interfaceSourceComponent
-
source
- Specified by:
sourcein interfaceSourceComponent
-
name
- Specified by:
namein interfaceSourceComponent
-
getLineSpan
-
getLineSpanNoWhitespace
-
getLineSpanMatching
-
findStructByName
Search this file and recursively search all imports to find a struct definition matching the given name.- Parameters:
name- The name of the struct to find.- Returns:
- null if no definition matches the name.
-
findFunction
Search this file and recursively search all imports to find a function definition matching the given name.- Parameters:
name- The name of the function to find.- Returns:
- Optional#empty() if no definition matches the name.
-
toString
-
equals
-
hashCode
public int hashCode()
-