APIdia Launch Partner
Top Description Inners Fields Constructors Methods
com.badlogic.gdx.graphics.g3d.particles

public Class ParticleShader

extends BaseShader
Class Inheritance
Imports
com.badlogic.gdx.Application.ApplicationType, .Gdx, com.badlogic.gdx.graphics.Camera, .GL20, com.badlogic.gdx.graphics.g3d.Attribute, .Attributes, .Material, .Renderable, .Shader, com.badlogic.gdx.graphics.g3d.attributes.BlendingAttribute, .DepthTestAttribute, .IntAttribute, .TextureAttribute, com.badlogic.gdx.graphics.g3d.shaders.BaseShader, .DefaultShader, com.badlogic.gdx.graphics.g3d.utils.RenderContext, com.badlogic.gdx.graphics.glutils.ShaderProgram, com.badlogic.gdx.math.Matrix4, .Vector3, com.badlogic.gdx.utils.GdxRuntimeException

This is a custom shader to render the particles. Usually is not required, because the DefaultShader will be used instead. This shader will be used when dealing with billboards using GPU mode or point sprites.
Author
inferno

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
public static class
public static class
public static enum
public static class

Field Summary

Modifier and TypeField and Description
protected final ParticleShader.Config
pack-priv Material
private static String
private static String
protected static long
private long
private static final long
optionalAttributes

Material attributes which are not required but always supported.

private Renderable
renderable

The renderable used to create this shader, invalid after the call to init

pack-priv static final Vector3
private long
Inherited from com.badlogic.gdx.graphics.g3d.shaders.BaseShader:
cameracontextprogram

Constructor Summary

AccessConstructor and Description
public
ParticleShader(final Renderable renderable)

public
ParticleShader(final Renderable renderable, final ParticleShader.Config config)

public
ParticleShader(final Renderable renderable, final ParticleShader.Config config, final String prefix)

public
ParticleShader(final Renderable renderable, final ParticleShader.Config config, final String prefix, final String vertexShader, final String fragmentShader)

public
ParticleShader(final Renderable renderable, final ParticleShader.Config config, final ShaderProgram shaderProgram)

Method Summary

Modifier and TypeMethod and Description
public void
begin(final Camera camera, final RenderContext context)

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.begin.

Implements com.badlogic.gdx.graphics.g3d.Shader.begin.

Initializes the context for exclusive rendering by this shader.

protected void
bindMaterial(final Renderable renderable)

public boolean
canRender(final Renderable renderable)

Implements com.badlogic.gdx.graphics.g3d.Shader.canRender.

Checks whether this shader is intended to render the Renderable.

public int
compareTo(Shader other)

Implements com.badlogic.gdx.graphics.g3d.Shader.compareTo.

Compare this shader against the other, used for sorting, light weight shaders are rendered first.

public static String
createPrefix(final Renderable renderable, final ParticleShader.Config config)

public void
public void
end()

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.end.

Implements com.badlogic.gdx.graphics.g3d.Shader.end.

Cleanup the context so other shaders can render.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public boolean
public int
public int
public static String
public static String
public void
init()

Implements com.badlogic.gdx.graphics.g3d.Shader.init.

Initializes the Shader, must be called before the Shader can be used.

public void
public void
setDefaultCullFace(int cullFace)

public void
setDefaultDepthFunc(int depthFunc)

Inherited from com.badlogic.gdx.graphics.g3d.shaders.BaseShader:
getUniformAliasgetUniformIDhasinitlocregisterregisterregisterregisterregisterregisterrendersetsetsetsetsetsetsetsetsetsetsetsetsetsetset

Field Detail

configback to summary
protected final ParticleShader.Config config
currentMaterialback to summary
pack-priv Material currentMaterial
defaultFragmentShaderback to summary
private static String defaultFragmentShader
defaultVertexShaderback to summary
private static String defaultVertexShader
implementedFlagsback to summary
protected static long implementedFlags
materialMaskback to summary
private long materialMask
optionalAttributesback to summary
private static final long optionalAttributes

Material attributes which are not required but always supported.

renderableback to summary
private Renderable renderable

The renderable used to create this shader, invalid after the call to init

TMP_VECTOR3back to summary
pack-priv static final Vector3 TMP_VECTOR3
vertexMaskback to summary
private long vertexMask

Constructor Detail

ParticleShaderback to summary
public ParticleShader(final Renderable renderable)
ParticleShaderback to summary
public ParticleShader(final Renderable renderable, final ParticleShader.Config config)
ParticleShaderback to summary
public ParticleShader(final Renderable renderable, final ParticleShader.Config config, final String prefix)
ParticleShaderback to summary
public ParticleShader(final Renderable renderable, final ParticleShader.Config config, final String prefix, final String vertexShader, final String fragmentShader)
ParticleShaderback to summary
public ParticleShader(final Renderable renderable, final ParticleShader.Config config, final ShaderProgram shaderProgram)

Method Detail

beginback to summary
public void begin(final Camera camera, final RenderContext context)

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.begin.

Implements com.badlogic.gdx.graphics.g3d.Shader.begin.

Doc from com.badlogic.gdx.graphics.g3d.Shader.begin.

Initializes the context for exclusive rendering by this shader. Use the render(Renderable) method to render a Renderable. When done rendering the end() method must be called.

Annotations
@Override
bindMaterialback to summary
protected void bindMaterial(final Renderable renderable)
canRenderback to summary
public boolean canRender(final Renderable renderable)

Implements com.badlogic.gdx.graphics.g3d.Shader.canRender.

Doc from com.badlogic.gdx.graphics.g3d.Shader.canRender.

Checks whether this shader is intended to render the Renderable. Use this to make sure a call to the 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.

Annotations
@Override
compareToback to summary
public int compareTo(Shader other)

Implements com.badlogic.gdx.graphics.g3d.Shader.compareTo.

Doc from com.badlogic.gdx.graphics.g3d.Shader.compareTo.

Compare this shader against the other, used for sorting, light weight shaders are rendered first.

Annotations
@Override
createPrefixback to summary
public static String createPrefix(final Renderable renderable, final ParticleShader.Config config)
disposeback to summary
public void dispose()

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.dispose.

Implements com.badlogic.gdx.utils.Disposable.dispose.

Doc from com.badlogic.gdx.utils.Disposable.dispose.

Releases all resources of this object.

Annotations
@Override
endback to summary
public void end()

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.end.

Implements com.badlogic.gdx.graphics.g3d.Shader.end.

Doc from com.badlogic.gdx.graphics.g3d.Shader.end.

Cleanup the context so other shaders can render. Must be called when done rendering using the render(Renderable) method, which must be preceded by a call to begin(Camera, RenderContext). After a call to this method an call to the render(Renderable) method will fail until the begin(Camera, RenderContext) is called.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
equalsback to summary
public boolean equals(ParticleShader obj)
getDefaultCullFaceback to summary
public int getDefaultCullFace()
getDefaultDepthFuncback to summary
public int getDefaultDepthFunc()
getDefaultFragmentShaderback to summary
public static String getDefaultFragmentShader()
getDefaultVertexShaderback to summary
public static String getDefaultVertexShader()
initback to summary
public void init()

Implements com.badlogic.gdx.graphics.g3d.Shader.init.

Doc from com.badlogic.gdx.graphics.g3d.Shader.init.

Initializes the Shader, must be called before the Shader can be used. This typically compiles a ShaderProgram, fetches uniform locations and performs other preparations for usage of the Shader.

Annotations
@Override
renderback to summary
public void render(final Renderable renderable)

Overrides com.badlogic.gdx.graphics.g3d.shaders.BaseShader.render.

Implements com.badlogic.gdx.graphics.g3d.Shader.render.

Doc from com.badlogic.gdx.graphics.g3d.Shader.render.

Renders the Renderable, must be called between begin(Camera, RenderContext) and end(). The Shader instance might not be able to render every type of Renderables. Use the canRender(Renderable) method to check if the Shader is capable of rendering a specific Renderable.

Annotations
@Override
setDefaultCullFaceback to summary
public void setDefaultCullFace(int cullFace)
setDefaultDepthFuncback to summary
public void setDefaultDepthFunc(int depthFunc)
com.badlogic.gdx.graphics.g3d.particles back to summary

public final Enum ParticleShader.AlignMode

extends Enum<ParticleShader.AlignMode>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ParticleShader.AlignMode
public static final ParticleShader.AlignMode

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ParticleShader.AlignMode
public static ParticleShader.AlignMode[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Screenback to summary
public static final ParticleShader.AlignMode Screen
ViewPointback to summary
public static final ParticleShader.AlignMode ViewPoint

Constructor Detail

AlignModeback to summary
private AlignMode()

Method Detail

valueOfback to summary
public static ParticleShader.AlignMode valueOf(String name)
valuesback to summary
public static ParticleShader.AlignMode[] values()
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParticleShader.Config

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ParticleShader.Config

Field Summary

Modifier and TypeField and Description
public ParticleShader.AlignMode
public int
defaultCullFace

Set to 0 to disable culling

public int
defaultDepthFunc

Set to 0 to disable depth test

public String
fragmentShader

The uber fragment shader to use, null to use the default fragment shader.

public boolean
public ParticleShader.ParticleType
public String
vertexShader

The uber vertex shader to use, null to use the default vertex shader.

Constructor Summary

AccessConstructor and Description
public
public
public
public
public
Config(final String vertexShader, final String fragmentShader)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

alignback to summary
public ParticleShader.AlignMode align
defaultCullFaceback to summary
public int defaultCullFace

Set to 0 to disable culling

defaultDepthFuncback to summary
public int defaultDepthFunc

Set to 0 to disable depth test

fragmentShaderback to summary
public String fragmentShader

The uber fragment shader to use, null to use the default fragment shader.

ignoreUnimplementedback to summary
public boolean ignoreUnimplemented
typeback to summary
public ParticleShader.ParticleType type
vertexShaderback to summary
public String vertexShader

The uber vertex shader to use, null to use the default vertex shader.

Constructor Detail

Configback to summary
public Config()
Configback to summary
public Config(ParticleShader.AlignMode align, ParticleShader.ParticleType type)
Configback to summary
public Config(ParticleShader.AlignMode align)
Configback to summary
public Config(ParticleShader.ParticleType type)
Configback to summary
public Config(final String vertexShader, final String fragmentShader)
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParticleShader.Inputs

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ParticleShader.Inputs

Field Summary

Modifier and TypeField and Description
public static final BaseShader.Uniform
public static final BaseShader.Uniform
public static final BaseShader.Uniform
public static final BaseShader.Uniform

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cameraInvDirectionback to summary
public static final BaseShader.Uniform cameraInvDirection
cameraRightback to summary
public static final BaseShader.Uniform cameraRight
regionSizeback to summary
public static final BaseShader.Uniform regionSize
screenWidthback to summary
public static final BaseShader.Uniform screenWidth

Constructor Detail

Inputsback to summary
public Inputs()
com.badlogic.gdx.graphics.g3d.particles back to summary

public final Enum ParticleShader.ParticleType

extends Enum<ParticleShader.ParticleType>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final ParticleShader.ParticleType
public static final ParticleShader.ParticleType

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static ParticleShader.ParticleType
public static ParticleShader.ParticleType[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

Billboardback to summary
public static final ParticleShader.ParticleType Billboard
Pointback to summary
public static final ParticleShader.ParticleType Point

Constructor Detail

ParticleTypeback to summary
private ParticleType()

Method Detail

valueOfback to summary
public static ParticleShader.ParticleType valueOf(String name)
valuesback to summary
public static ParticleShader.ParticleType[] values()
com.badlogic.gdx.graphics.g3d.particles back to summary

public Class ParticleShader.Setters

extends Object
Class Inheritance
  • java.lang.Object
  • com.badlogic.gdx.graphics.g3d.particles.ParticleShader.Setters

Field Summary

Modifier and TypeField and Description
public static final BaseShader.Setter
public static final BaseShader.Setter
public static final BaseShader.Setter
public static final BaseShader.Setter
public static final BaseShader.Setter
public static final BaseShader.Setter

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cameraInvDirectionback to summary
public static final BaseShader.Setter cameraInvDirection
cameraPositionback to summary
public static final BaseShader.Setter cameraPosition
cameraRightback to summary
public static final BaseShader.Setter cameraRight
cameraUpback to summary
public static final BaseShader.Setter cameraUp
screenWidthback to summary
public static final BaseShader.Setter screenWidth
worldViewTransback to summary
public static final BaseShader.Setter worldViewTrans

Constructor Detail

Settersback to summary
public Setters()