Package icyllis.arc3d.granite.shading

# Class ShaderBuilderBase

java.lang.Object
icyllis.arc3d.granite.shading.ShaderBuilderBase

All Implemented Interfaces:
  `ShaderBuilder`

Direct Known Subclasses:
  `FragmentShaderBuilder`, `VertexShaderBuilder`

public abstract class ShaderBuilderBase extends Object implements ShaderBuilder
Base class for all shaders builders.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final int`
  `CODE`
  `protected static final int`
  `DEFINITIONS`
  `protected static final int`
  `FUNCTIONS`
  `protected static final int`
  `INPUTS`
  `protected static final int`
  `LAYOUT_QUALIFIERS`
  `protected int`
  `mCodeIndex`
  `protected final GraphicsPipelineBuilder`
  `mPipelineBuilder`
  `protected final StringBuilder[]`
  `mShaderStrings`
  `protected static final int`
  `OUTPUTS`
  `protected static final int`
  `PREALLOC`
  `protected static final int`
  `UNIFORMS`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ShaderBuilderBase(GraphicsPipelineBuilder pipelineBuilder)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addExtension(String extensionName)`
  `protected final StringBuilder`
  `code()`
  `void`
  `codeAppend(String str)`
  Writes the specified string to one of the shaders.
  `void`
  `codeAppendf(String format, Object... args)`
  Writes a formatted string to one of the shaders using the specified format string and arguments.
  `void`
  `codePrependf(String format, Object... args)`
  Similar to `codeAppendf(String, Object...)`, but writes at the beginning.
  `void`
  `declAppend(ShaderVar var)`
  Appends a variable declaration to one of the shaders
  `protected final StringBuilder`
  `definitions()`
  `protected final void`
  `deleteStage()`
  `final void`
  `finish()`
  Complete this builder and do post-processing before getting the result.
  `protected final StringBuilder`
  `functions()`
  `final int`
  `getCount()`
  `final Map<String,String>`
  `getExtensions()`
  `String`
  `getMangledName(String baseName)`
  Generates a mangled name for a helper function in the fragment shader.
  `final CharSequence[]`
  `getStrings()`
  `protected final StringBuilder`
  `inputs()`
  `protected final StringBuilder`
  `layoutQualifiers()`
  `protected final void`
  `nextStage()`
  `protected abstract void`
  `onFinish()`
  `protected final StringBuilder`
  `outputs()`
  `final String`
  `toString()`
  `final ByteBuffer`
  `toUTF8()`
  `protected final StringBuilder`
  `uniforms()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DEFINITIONS

    protected static final int DEFINITIONS
    See Also:
      - Constant Field Values

  - ### LAYOUT_QUALIFIERS

    protected static final int LAYOUT_QUALIFIERS
    See Also:
      - Constant Field Values

  - ### UNIFORMS

    protected static final int UNIFORMS
    See Also:
      - Constant Field Values

  - ### INPUTS

    protected static final int INPUTS
    See Also:
      - Constant Field Values

  - ### OUTPUTS

    protected static final int OUTPUTS
    See Also:
      - Constant Field Values

  - ### FUNCTIONS

    protected static final int FUNCTIONS
    See Also:
      - Constant Field Values

  - ### CODE

    protected static final int CODE
    See Also:
      - Constant Field Values

  - ### PREALLOC

    protected static final int PREALLOC
    See Also:
      - Constant Field Values

  - ### mPipelineBuilder

    protected final GraphicsPipelineBuilder mPipelineBuilder

  - ### mShaderStrings

    protected final StringBuilder[] mShaderStrings

  - ### mCodeIndex

    protected int mCodeIndex

- ## Constructor Details

  - ### ShaderBuilderBase

    public ShaderBuilderBase(GraphicsPipelineBuilder pipelineBuilder)

- ## Method Details

  - ### codeAppend

    public void codeAppend(String str)
    Writes the specified string to one of the shaders.
    Specified by:
      `codeAppend` in interface `ShaderBuilder`

  - ### codeAppendf

    public void codeAppendf(String format, Object... args)
    Writes a formatted string to one of the shaders using the specified format string and arguments.
    Specified by:
      `codeAppendf` in interface `ShaderBuilder`
    See Also:
      - `Formatter.format(String, Object...)`

  - ### codePrependf

    public void codePrependf(String format, Object... args)
    Similar to `codeAppendf(String, Object...)`, but writes at the beginning.
    Specified by:
      `codePrependf` in interface `ShaderBuilder`

  - ### declAppend

    public void declAppend(ShaderVar var)
    Appends a variable declaration to one of the shaders

  - ### getMangledName

    public String getMangledName(String baseName)
    Description copied from interface: `ShaderBuilder`
    Generates a mangled name for a helper function in the fragment shader. Will give consistent results if called more than once.
    Specified by:
      `getMangledName` in interface `ShaderBuilder`

  - ### nextStage

    protected final void nextStage()

  - ### deleteStage

    protected final void deleteStage()

  - ### definitions

    protected final StringBuilder definitions()

  - ### layoutQualifiers

    protected final StringBuilder layoutQualifiers()

  - ### uniforms

    protected final StringBuilder uniforms()

  - ### inputs

    protected final StringBuilder inputs()

  - ### outputs

    protected final StringBuilder outputs()

  - ### functions

    protected final StringBuilder functions()

  - ### code

    protected final StringBuilder code()

  - ### addExtension

    public void addExtension(@Nullable String extensionName)

  - ### finish

    public final void finish()
    Complete this builder and do post-processing before getting the result.

  - ### getStrings

    public final CharSequence[] getStrings()

  - ### getCount

    public final int getCount()

  - ### getExtensions

    public final Map<String,String> getExtensions()

  - ### toUTF8

    @Nonnull public final ByteBuffer toUTF8()

  - ### toString

    public final String toString()
    Overrides:
      `toString` in class `Object`

  - ### onFinish

    protected abstract void onFinish()