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

public Interface GroupStrategy

Known Direct Implementers
com.badlogic.gdx.graphics.g3d.decals.PluggableGroupStrategy, com.badlogic.gdx.graphics.g3d.decals.SimpleOrthoGroupStrategy, com.badlogic.gdx.graphics.g3d.decals.CameraGroupStrategy
Imports
com.badlogic.gdx.graphics.glutils.ShaderProgram, com.badlogic.gdx.utils.Array

This class provides hooks which are invoked by DecalBatch to evaluate the group a sprite falls into, as well as to adjust settings before and after rendering a group.

A group is identified by an integer. The beforeGroup() method provides the strategy with a list of all the decals, which are contained in the group itself, and will be rendered before the associated call to afterGroup(int).
A call to beforeGroup() is always followed by a call to afterGroup().
Groups are always invoked based on their ascending int values. Group -10 will be rendered before group -5, group -5 before group 0, group 0 before group 6 and so on.
The call order for a single flush is always beforeGroups(), beforeGroup1(), afterGroup1(), ... beforeGroupN(), afterGroupN(), afterGroups().

The contents of the beforeGroup() call can be modified at will to realize view frustum culling, material & depth sorting, ... all based on the requirements of the current group. The batch itself does not change OpenGL settings except for whichever changes are entailed DecalMaterial#set(). If the group requires a special shader, blending, getGroupShader(int) should return it so that DecalBatch can apply it while rendering the group.

Method Summary

Modifier and TypeMethod and Description
public void
afterGroup(int
Group which completed rendering
group
)

Invoked directly after rendering of a group has completed

public void
afterGroups()

Invoked after having rendered all groups

public void
beforeGroup(int
Group that will be rendered
group
,
Array<Decal>
Array of entries of arrays containing all the decals in the group
contents
)

Invoked directly before rendering the contents of a group

public void
beforeGroups()

Invoked before rendering any group

public int

Returns:

group assigned
decideGroup
(Decal
Decal to assign group to
decal
)

Assigns a group to a decal

public ShaderProgram

Returns:

the ShaderProgram
getGroupShader
(int
the group
group
)

Returns the shader to be used for the group.

Method Detail

afterGroupback to summary
public void afterGroup(int group)

Invoked directly after rendering of a group has completed

Parameters
group:int

Group which completed rendering

afterGroupsback to summary
public void afterGroups()

Invoked after having rendered all groups

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

Invoked directly before rendering the contents of a group

Parameters
group:int

Group that will be rendered

contents:Array<Decal>

Array of entries of arrays containing all the decals in the group

beforeGroupsback to summary
public void beforeGroups()

Invoked before rendering any group

decideGroupback to summary
public int decideGroup(Decal decal)

Assigns a group to a decal

Parameters
decal:Decal

Decal to assign group to

Returns:int

group assigned

getGroupShaderback to summary
public ShaderProgram getGroupShader(int group)

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

Parameters
group:int

the group

Returns:ShaderProgram

the ShaderProgram