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

public Class CameraGroupStrategy

extends Object
implements GroupStrategy, Disposable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.Disposable, com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
Imports
java.util.Comparator, com.badlogic.gdx.Gdx, com.badlogic.gdx.graphics.Camera, .GL20, com.badlogic.gdx.graphics.glutils.ShaderProgram, com.badlogic.gdx.utils.Array, .Disposable, .ObjectMap, .Pool

Minimalistic grouping strategy that splits decals into opaque and transparent ones enabling and disabling blending as needed. Opaque decals are rendered first (decal color is ignored in opacity check).
Use this strategy only if the vast majority of your decals are opaque and the few transparent ones are unlikely to overlap.

Can produce invisible artifacts when transparent decals overlap each other.

Needs to be explicitly disposed as it might allocate a ShaderProgram when GLSL 2.0 is used.

States (* = any, EV = entry value - same as value before flush):

expects exits on
glDepthMask true EV
GL_DEPTH_TEST enabled EV
glDepthFunc GL_LESS | GL_LEQUAL EV
GL_BLEND disabled EV | disabled
glBlendFunc * *
GL_TEXTURE_2D * disabled

Field Summary

Modifier and TypeField and Description
pack-priv Pool<Array<Decal>>
pack-priv Camera
private final Comparator<Decal>
private static final int
private static final int
pack-priv ObjectMap<DecalMaterial, Array<Decal>>
pack-priv ShaderProgram
pack-priv Array<Array<Decal>>

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public void
afterGroup(int group)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroup.

Invoked directly after rendering of a group has completed

public void
afterGroups()

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroups.

Invoked after having rendered all groups

public void
beforeGroup(int group, Array<Decal> contents)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroup.

Invoked directly before rendering the contents of a group

public void
beforeGroups()

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroups.

Invoked before rendering any group

private void
public int
public void
dispose()

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

Releases all resources of this object.

public Camera
public ShaderProgram
getGroupShader(int group)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.getGroupShader.

Returns the shader to be used for the group.

public void
setCamera(Camera camera)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

arrayPoolback to summary
pack-priv Pool<Array<Decal>> arrayPool
cameraback to summary
pack-priv Camera camera
cameraSorterback to summary
private final Comparator<Decal> cameraSorter
GROUP_BLENDback to summary
private static final int GROUP_BLEND
GROUP_OPAQUEback to summary
private static final int GROUP_OPAQUE
materialGroupsback to summary
pack-priv ObjectMap<DecalMaterial, Array<Decal>> materialGroups
shaderback to summary
pack-priv ShaderProgram shader
usedArraysback to summary
pack-priv Array<Array<Decal>> usedArrays

Constructor Detail

CameraGroupStrategyback to summary
public CameraGroupStrategy(Camera camera)
CameraGroupStrategyback to summary
public CameraGroupStrategy(Camera camera, Comparator<Decal> sorter)

Method Detail

afterGroupback to summary
public void afterGroup(int group)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroup.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroup.

Invoked directly after rendering of a group has completed

Annotations
@Override
afterGroupsback to summary
public void afterGroups()

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroups.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.afterGroups.

Invoked after having rendered all groups

Annotations
@Override
beforeGroupback to summary
public void beforeGroup(int group, Array<Decal> contents)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroup.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroup.

Invoked directly before rendering the contents of a group

Annotations
@Override
beforeGroupsback to summary
public void beforeGroups()

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroups.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.beforeGroups.

Invoked before rendering any group

Annotations
@Override
createDefaultShaderback to summary
private void createDefaultShader()
decideGroupback to summary
public int decideGroup(Decal decal)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.decideGroup.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.decideGroup.

Assigns a group to a decal

Annotations
@Override
disposeback to summary
public void dispose()

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

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

Releases all resources of this object.

Annotations
@Override
getCameraback to summary
public Camera getCamera()
getGroupShaderback to summary
public ShaderProgram getGroupShader(int group)

Implements com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.getGroupShader.

Doc from com.badlogic.gdx.graphics.g3d.decals.GroupStrategy.getGroupShader.

Returns the shader to be used for the group. Can be null in which case the GroupStrategy doesn't support GLES 2.0

Annotations
@Override
setCameraback to summary
public void setCamera(Camera camera)