Interface GroupStrategy
-
- All Known Implementing Classes:
CameraGroupStrategy,PluggableGroupStrategy,SimpleOrthoGroupStrategy
public interface GroupStrategyThis class provides hooks which are invoked by
DecalBatchto 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 toafterGroup(int).
A call tobeforeGroup()is always followed by a call toafterGroup().
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 alwaysbeforeGroups(), 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 entailedDecalMaterial.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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidafterGroup(int group)Invoked directly after rendering of a group has completedvoidafterGroups()Invoked after having rendered all groupsvoidbeforeGroup(int group, Array<Decal> contents)Invoked directly before rendering the contents of a groupvoidbeforeGroups()Invoked before rendering any groupintdecideGroup(Decal decal)Assigns a group to a decalShaderProgramgetGroupShader(int group)Returns the shader to be used for the group.
-
-
-
Method Detail
-
getGroupShader
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- the group- Returns:
- the
ShaderProgram
-
decideGroup
int decideGroup(Decal decal)
Assigns a group to a decal- Parameters:
decal- Decal to assign group to- Returns:
- group assigned
-
beforeGroup
void beforeGroup(int group, Array<Decal> contents)Invoked directly before rendering the contents of a group- Parameters:
group- Group that will be renderedcontents- Array of entries of arrays containing all the decals in the group
-
afterGroup
void afterGroup(int group)
Invoked directly after rendering of a group has completed- Parameters:
group- Group which completed rendering
-
beforeGroups
void beforeGroups()
Invoked before rendering any group
-
afterGroups
void afterGroups()
Invoked after having rendered all groups
-
-