public class DefaultShader extends BaseShader
Modifier and Type | Class and Description |
---|---|
static class |
DefaultShader.Config |
static class |
DefaultShader.Inputs |
static class |
DefaultShader.Setters |
BaseShader.Setter, BaseShader.Uniform, BaseShader.Validator
Modifier and Type | Field and Description |
---|---|
static int |
defaultCullFace
Deprecated.
Replaced by
DefaultShader.Config.defaultCullFace Set to 0 to disable culling |
static int |
defaultDepthFunc
Deprecated.
Replaced by
DefaultShader.Config.defaultDepthFunc Set to 0 to disable depth test |
int |
u_alphaTest |
int |
u_bones |
int |
u_cameraDirection |
int |
u_cameraPosition |
int |
u_cameraUp |
int |
u_diffuseColor |
int |
u_diffuseTexture |
int |
u_emissiveColor |
int |
u_normalMatrix |
int |
u_normalTexture |
int |
u_opacity |
int |
u_projTrans |
int |
u_projViewTrans |
int |
u_projViewWorldTrans |
int |
u_reflectionColor |
int |
u_shininess |
int |
u_specularColor |
int |
u_specularTexture |
int |
u_time |
int |
u_viewTrans |
int |
u_viewWorldTrans |
int |
u_worldTrans |
context, program
Constructor and Description |
---|
DefaultShader(Renderable renderable) |
DefaultShader(Renderable renderable,
DefaultShader.Config config) |
DefaultShader(Renderable renderable,
DefaultShader.Config config,
ShaderProgram shaderProgram) |
DefaultShader(Renderable renderable,
DefaultShader.Config config,
String prefix) |
DefaultShader(Renderable renderable,
DefaultShader.Config config,
String prefix,
String vertexShader,
String fragmentShader) |
Modifier and Type | Method and Description |
---|---|
void |
begin(Camera camera,
RenderContext context)
Initializes the context for exclusive rendering by this shader.
|
boolean |
canRender(Renderable renderable)
Checks whether this shader is intended to render the
Renderable . |
int |
compareTo(Shader other)
Compare this shader against the other, used for sorting, light weight shaders are rendered first.
|
static String |
createPrefix(Renderable renderable,
DefaultShader.Config config) |
void |
dispose()
Releases all resources of this object.
|
void |
end()
Cleanup the context so other shaders can render.
|
boolean |
equals(DefaultShader obj) |
boolean |
equals(Object obj) |
int |
getDefaultCullFace() |
int |
getDefaultDepthFunc() |
static String |
getDefaultFragmentShader() |
static String |
getDefaultVertexShader() |
void |
init()
Initializes the Shader, must be called before the Shader can be used.
|
void |
render(Renderable renderable)
Renders the
Renderable , must be called between Shader.begin(Camera, RenderContext) and Shader.end() . |
void |
setDefaultCullFace(int cullFace) |
void |
setDefaultDepthFunc(int depthFunc) |
@Deprecated public static int defaultCullFace
DefaultShader.Config.defaultCullFace
Set to 0 to disable culling@Deprecated public static int defaultDepthFunc
DefaultShader.Config.defaultDepthFunc
Set to 0 to disable depth testpublic final int u_projTrans
public final int u_viewTrans
public final int u_projViewTrans
public final int u_cameraPosition
public final int u_cameraDirection
public final int u_cameraUp
public final int u_time
public final int u_worldTrans
public final int u_viewWorldTrans
public final int u_projViewWorldTrans
public final int u_normalMatrix
public final int u_bones
public final int u_shininess
public final int u_opacity
public final int u_diffuseColor
public final int u_diffuseTexture
public final int u_specularColor
public final int u_specularTexture
public final int u_emissiveColor
public final int u_reflectionColor
public final int u_normalTexture
public final int u_alphaTest
public DefaultShader(Renderable renderable)
public DefaultShader(Renderable renderable, DefaultShader.Config config)
public DefaultShader(Renderable renderable, DefaultShader.Config config, String prefix)
public DefaultShader(Renderable renderable, DefaultShader.Config config, String prefix, String vertexShader, String fragmentShader)
public DefaultShader(Renderable renderable, DefaultShader.Config config, ShaderProgram shaderProgram)
public static String getDefaultVertexShader()
public static String getDefaultFragmentShader()
public void init()
Shader
ShaderProgram
,
fetches uniform locations and performs other preparations for usage of the Shader.public static String createPrefix(Renderable renderable, DefaultShader.Config config)
public boolean canRender(Renderable renderable)
Shader
Renderable
. Use this to make sure a call to the
Shader.render(Renderable)
method will succeed. This is expected to be a fast, non-blocking method. Note that this method
will only return true if it is intended to be used. Even when it returns false the Shader might still be capable of
rendering, but it's not preferred to do so.renderable
- The renderable to check against this shader.Renderable
, false otherwise.public int compareTo(Shader other)
Shader
public boolean equals(DefaultShader obj)
public void begin(Camera camera, RenderContext context)
Shader
Shader.render(Renderable)
method to render a
Renderable
. When done rendering the Shader.end()
method must be called.begin
in interface Shader
begin
in class BaseShader
camera
- The camera to use when renderingcontext
- The context to be used, which must be exclusive available for the shader until the call to the Shader.end()
method.public void render(Renderable renderable)
Shader
Renderable
, must be called between Shader.begin(Camera, RenderContext)
and Shader.end()
. The Shader
instance might not be able to render every type of Renderable
s. Use the Shader.canRender(Renderable)
method to
check if the Shader is capable of rendering a specific Renderable
.render
in interface Shader
render
in class BaseShader
renderable
- The renderable to render, all required fields (e.g. Renderable.mesh
, Renderable.material
and others) must be set. The Renderable.shader
field will be ignored.public void end()
Shader
Shader.render(Renderable)
method, which must be preceded by a call to Shader.begin(Camera, RenderContext)
. After a call to this method an call to
the Shader.render(Renderable)
method will fail until the Shader.begin(Camera, RenderContext)
is called.end
in interface Shader
end
in class BaseShader
public void dispose()
Disposable
dispose
in interface Disposable
dispose
in class BaseShader
public int getDefaultCullFace()
public void setDefaultCullFace(int cullFace)
public int getDefaultDepthFunc()
public void setDefaultDepthFunc(int depthFunc)
Copyright © 2014. All Rights Reserved.