Package gaiasky.util.gdx.shader
Class AtmosphereShader
java.lang.Object
gaiasky.util.gdx.shader.BaseIntShader
gaiasky.util.gdx.shader.AtmosphereShader
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,IntShader
public class AtmosphereShader extends BaseIntShader
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AtmosphereShader.Config
static class
AtmosphereShader.Inputs
static class
AtmosphereShader.Setters
Nested classes/interfaces inherited from class gaiasky.util.gdx.shader.BaseIntShader
BaseIntShader.GlobalSetter, BaseIntShader.LocalSetter, BaseIntShader.Setter, BaseIntShader.Uniform, BaseIntShader.Validator
-
Field Summary
Fields Modifier and Type Field Description protected long
attributesMask
The attributes that this shader supportsprotected AtmosphereShader.Config
config
static int
defaultCullFace
Deprecated.static int
defaultDepthFunc
Deprecated.Replaced byAtmosphereShader.Config.defaultDepthFunc
Set to 0 to disable depth testint
fAlpha
int
fCameraHeight
int
fInnerRadius
int
fKm4PI
int
fKmESun
int
fKr4PI
int
fKrESun
int
fOuterRadius
int
fScale
int
fScaleDepth
int
fScaleOverScaleDepth
int
g
protected static long
implementedFlags
int
nSamples
int
u_cameraDirection
int
u_cameraK
int
u_cameraNearFar
int
u_cameraPosition
int
u_cameraUp
int
u_gw
int
u_gwmat3
int
u_hterms
int
u_normalMatrix
int
u_omgw
int
u_projTrans
int
u_projViewTrans
int
u_projViewWorldTrans
int
u_ts
int
u_vc
int
u_velDir
int
u_viewTrans
int
u_viewWorldTrans
int
u_worldTrans
int
v3CameraPos
int
v3InvWavelength
int
v3LightPos
int
v3PlanetPos
Fields inherited from class gaiasky.util.gdx.shader.BaseIntShader
camera, context, program
-
Constructor Summary
Constructors Constructor Description AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config)
AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, ExtShaderProgram shaderProgram)
AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, java.lang.String prefix)
AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, java.lang.String prefix, java.lang.String vertexShader, java.lang.String fragmentShader)
-
Method Summary
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.protected void
bindMaterial(IntRenderable renderable)
boolean
canRender(IntRenderable renderable)
Checks whether this shader is intended to render theIntRenderable
.int
compareTo(IntShader other)
Compare this shader against the other, used for sorting, light weight shaders are rendered first.static java.lang.String
createPrefix(IntRenderable renderable)
void
dispose()
void
end()
Cleanup the context so other shaders can render.boolean
equals(AtmosphereShader obj)
boolean
equals(java.lang.Object obj)
int
getDefaultCullFace()
int
getDefaultDepthFunc()
static java.lang.String
getDefaultFragmentShader()
static java.lang.String
getDefaultVertexShader()
int
hashCode()
void
init()
Initializes the IntShader, must be called before the IntShader can be used.void
render(IntRenderable renderable)
Renders theIntRenderable
, must be called betweenIntShader.begin(Camera, RenderContext)
andIntShader.end()
.void
setDefaultCullFace(int cullFace)
void
setDefaultDepthFunc(int depthFunc)
Methods inherited from class gaiasky.util.gdx.shader.BaseIntShader
getUniformAlias, getUniformID, has, init, loc, register, register, register, register, register, register, render, renderMesh, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
implementedFlags
protected static long implementedFlags -
defaultCullFace
@Deprecated public static int defaultCullFaceDeprecated.Replaced byAtmosphereShader.Config.defaultCullFace
Set to 0 to disable culling -
defaultDepthFunc
@Deprecated public static int defaultDepthFuncDeprecated.Replaced byAtmosphereShader.Config.defaultDepthFunc
Set to 0 to disable depth test -
u_projTrans
public final int u_projTrans -
u_viewTrans
public final int u_viewTrans -
u_projViewTrans
public final int u_projViewTrans -
u_cameraPosition
public final int u_cameraPosition -
u_cameraDirection
public final int u_cameraDirection -
u_cameraUp
public final int u_cameraUp -
u_cameraNearFar
public final int u_cameraNearFar -
u_cameraK
public final int u_cameraK -
u_worldTrans
public final int u_worldTrans -
u_viewWorldTrans
public final int u_viewWorldTrans -
u_projViewWorldTrans
public final int u_projViewWorldTrans -
u_normalMatrix
public final int u_normalMatrix -
fAlpha
public final int fAlpha -
fCameraHeight
public final int fCameraHeight -
fOuterRadius
public final int fOuterRadius -
fInnerRadius
public final int fInnerRadius -
fKrESun
public final int fKrESun -
fKmESun
public final int fKmESun -
fKr4PI
public final int fKr4PI -
fKm4PI
public final int fKm4PI -
fScale
public final int fScale -
fScaleDepth
public final int fScaleDepth -
fScaleOverScaleDepth
public final int fScaleOverScaleDepth -
nSamples
public final int nSamples -
g
public final int g -
v3PlanetPos
public final int v3PlanetPos -
v3LightPos
public final int v3LightPos -
v3CameraPos
public final int v3CameraPos -
v3InvWavelength
public final int v3InvWavelength -
u_vc
public final int u_vc -
u_velDir
public final int u_velDir -
u_hterms
public final int u_hterms -
u_gw
public final int u_gw -
u_gwmat3
public final int u_gwmat3 -
u_ts
public final int u_ts -
u_omgw
public final int u_omgw -
attributesMask
protected final long attributesMaskThe attributes that this shader supports -
config
-
-
Constructor Details
-
AtmosphereShader
-
AtmosphereShader
public AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, java.lang.String prefix) -
AtmosphereShader
public AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, java.lang.String prefix, java.lang.String vertexShader, java.lang.String fragmentShader) -
AtmosphereShader
public AtmosphereShader(IntRenderable renderable, AtmosphereShader.Config config, ExtShaderProgram shaderProgram)
-
-
Method Details
-
getDefaultVertexShader
public static java.lang.String getDefaultVertexShader() -
getDefaultFragmentShader
public static java.lang.String getDefaultFragmentShader() -
init
public void init()Description copied from interface:IntShader
Initializes the IntShader, must be called before the IntShader can be used. This typically compiles aShaderProgram
, fetches uniform locations and performs other preparations for usage of the IntShader. -
createPrefix
-
canRender
Description copied from interface:IntShader
Checks whether this shader is intended to render theIntRenderable
. Use this to make sure a call to theIntShader.render(IntRenderable)
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 IntShader might still be capable of rendering, but it's not preferred to do so.- Parameters:
renderable
- The renderable to check against this shader.- Returns:
- true if this shader is intended to render the
IntRenderable
, false otherwise.
-
compareTo
Description copied from interface:IntShader
Compare this shader against the other, used for sorting, light weight shaders are rendered first. -
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classjava.lang.Object
-
equals
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
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
- Overrides:
begin
in classBaseIntShader
- 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
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
- Overrides:
render
in classBaseIntShader
- Parameters:
renderable
- The renderable to render, all required fields (e.g.IntRenderable.material
and others) must be set. TheIntRenderable.shader
field will be ignored.
-
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.- Specified by:
end
in interfaceIntShader
- Overrides:
end
in classBaseIntShader
-
bindMaterial
-
dispose
public void dispose()- Specified by:
dispose
in interfacecom.badlogic.gdx.utils.Disposable
- Overrides:
dispose
in classBaseIntShader
-
getDefaultCullFace
public int getDefaultCullFace() -
setDefaultCullFace
public void setDefaultCullFace(int cullFace) -
getDefaultDepthFunc
public int getDefaultDepthFunc() -
setDefaultDepthFunc
public void setDefaultDepthFunc(int depthFunc)
-
AtmosphereShader.Config.defaultCullFace
Set to 0 to disable culling