Class BaseIntShader
- java.lang.Object
-
- gaia.cu9.ari.gaiaorbit.util.gdx.shader.BaseIntShader
-
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,IntShader
- Direct Known Subclasses:
AtmosphereShader
,DefaultIntShader
public abstract class BaseIntShader extends java.lang.Object implements IntShader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BaseIntShader.GlobalSetter
static class
BaseIntShader.LocalSetter
static interface
BaseIntShader.Setter
static class
BaseIntShader.Uniform
static interface
BaseIntShader.Validator
-
Field Summary
Fields Modifier and Type Field Description com.badlogic.gdx.graphics.Camera
camera
com.badlogic.gdx.graphics.g3d.utils.RenderContext
context
ExtShaderProgram
program
-
Constructor Summary
Constructors Constructor Description BaseIntShader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
begin(com.badlogic.gdx.graphics.Camera camera, com.badlogic.gdx.graphics.g3d.utils.RenderContext context)
Initializes the context for exclusive rendering by this shader.void
dispose()
void
end()
Cleanup the context so other shaders can render.java.lang.String
getUniformAlias(int id)
int
getUniformID(java.lang.String alias)
boolean
has(int inputID)
Whether this IntShader instance implements the specified uniform, only valid after a call to init().void
init(ExtShaderProgram program, IntRenderable renderable)
Initialize this shader, causing all registered uniforms/attributes to be fetched.int
loc(int inputID)
int
register(BaseIntShader.Uniform uniform)
int
register(BaseIntShader.Uniform uniform, BaseIntShader.Setter setter)
int
register(java.lang.String alias)
int
register(java.lang.String alias, BaseIntShader.Setter setter)
int
register(java.lang.String alias, BaseIntShader.Validator validator)
int
register(java.lang.String alias, BaseIntShader.Validator validator, BaseIntShader.Setter setter)
Register an uniform which might be used by this shader.void
render(IntRenderable renderable)
Renders theIntRenderable
, must be called betweenIntShader.begin(Camera, RenderContext)
andIntShader.end()
.void
render(IntRenderable renderable, com.badlogic.gdx.graphics.g3d.Attributes combinedAttributes)
void
renderMesh(ExtShaderProgram program, IntMeshPart meshPart)
If necessary, overrideboolean
set(int uniform, float value)
boolean
set(int uniform, float v1, float v2)
boolean
set(int uniform, float v1, float v2, float v3)
boolean
set(int uniform, float v1, float v2, float v3, float v4)
boolean
set(int uniform, int value)
boolean
set(int uniform, int v1, int v2)
boolean
set(int uniform, int v1, int v2, int v3)
boolean
set(int uniform, int v1, int v2, int v3, int v4)
boolean
set(int uniform, com.badlogic.gdx.graphics.Color value)
boolean
set(int uniform, com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor textureDesc)
boolean
set(int uniform, com.badlogic.gdx.graphics.GLTexture texture)
boolean
set(int uniform, com.badlogic.gdx.math.Matrix3 value)
boolean
set(int uniform, com.badlogic.gdx.math.Matrix4 value)
boolean
set(int uniform, com.badlogic.gdx.math.Vector2 value)
boolean
set(int uniform, com.badlogic.gdx.math.Vector3 value)
-
-
-
Field Detail
-
program
public ExtShaderProgram program
-
context
public com.badlogic.gdx.graphics.g3d.utils.RenderContext context
-
camera
public com.badlogic.gdx.graphics.Camera camera
-
-
Method Detail
-
register
public int register(java.lang.String alias, BaseIntShader.Validator validator, BaseIntShader.Setter setter)
Register an uniform which might be used by this shader. Only possible prior to the call to init().- Returns:
- The ID of the uniform to use in this shader.
-
register
public int register(java.lang.String alias, BaseIntShader.Validator validator)
-
register
public int register(java.lang.String alias, BaseIntShader.Setter setter)
-
register
public int register(java.lang.String alias)
-
register
public int register(BaseIntShader.Uniform uniform, BaseIntShader.Setter setter)
-
register
public int register(BaseIntShader.Uniform uniform)
-
getUniformID
public int getUniformID(java.lang.String alias)
- Returns:
- the ID of the input or negative if not available.
-
getUniformAlias
public java.lang.String getUniformAlias(int id)
- Returns:
- The input at the specified id.
-
init
public void init(ExtShaderProgram program, IntRenderable renderable)
Initialize this shader, causing all registered uniforms/attributes to be fetched.
-
begin
public void begin(com.badlogic.gdx.graphics.Camera camera, com.badlogic.gdx.graphics.g3d.utils.RenderContext context)
Description copied from interface:IntShader
Initializes the context for exclusive rendering by this shader. Use theIntShader.render(IntRenderable)
method to render aIntRenderable
. When done rendering theIntShader.end()
method must be called.- Specified by:
begin
in interfaceIntShader
- Parameters:
camera
- The camera to use when renderingcontext
- The context to be used, which must be exclusive available for the shader until the call to theIntShader.end()
method.
-
render
public void render(IntRenderable renderable)
Description copied from interface:IntShader
Renders theIntRenderable
, must be called betweenIntShader.begin(Camera, RenderContext)
andIntShader.end()
. The IntShader instance might not be able to render every type ofIntRenderable
s. Use theIntShader.canRender(IntRenderable)
method to check if the IntShader is capable of rendering a specificIntRenderable
.- Specified by:
render
in interfaceIntShader
- Parameters:
renderable
- The renderable to render, all required fields (e.g.IntRenderable.material
and others) must be set. TheIntRenderable.shader
field will be ignored.
-
render
public void render(IntRenderable renderable, com.badlogic.gdx.graphics.g3d.Attributes combinedAttributes)
-
renderMesh
public void renderMesh(ExtShaderProgram program, IntMeshPart meshPart)
If necessary, override- Parameters:
program
-meshPart
-
-
end
public void end()
Description copied from interface:IntShader
Cleanup the context so other shaders can render. Must be called when done rendering using theIntShader.render(IntRenderable)
method, which must be preceded by a call toIntShader.begin(Camera, RenderContext)
. After a call to this method an call to theIntShader.render(IntRenderable)
method will fail until theIntShader.begin(Camera, RenderContext)
is called.
-
dispose
public void dispose()
- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
-
has
public final boolean has(int inputID)
Whether this IntShader instance implements the specified uniform, only valid after a call to init().
-
loc
public final int loc(int inputID)
-
set
public final boolean set(int uniform, com.badlogic.gdx.math.Matrix4 value)
-
set
public final boolean set(int uniform, com.badlogic.gdx.math.Matrix3 value)
-
set
public final boolean set(int uniform, com.badlogic.gdx.math.Vector3 value)
-
set
public final boolean set(int uniform, com.badlogic.gdx.math.Vector2 value)
-
set
public final boolean set(int uniform, com.badlogic.gdx.graphics.Color value)
-
set
public final boolean set(int uniform, float value)
-
set
public final boolean set(int uniform, float v1, float v2)
-
set
public final boolean set(int uniform, float v1, float v2, float v3)
-
set
public final boolean set(int uniform, float v1, float v2, float v3, float v4)
-
set
public final boolean set(int uniform, int value)
-
set
public final boolean set(int uniform, int v1, int v2)
-
set
public final boolean set(int uniform, int v1, int v2, int v3)
-
set
public final boolean set(int uniform, int v1, int v2, int v3, int v4)
-
set
public final boolean set(int uniform, com.badlogic.gdx.graphics.g3d.utils.TextureDescriptor textureDesc)
-
set
public final boolean set(int uniform, com.badlogic.gdx.graphics.GLTexture texture)
-
-