public class CameraGroupStrategy extends java.lang.Object implements GroupStrategy, Disposable
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 |
| Constructor and Description |
|---|
CameraGroupStrategy(Camera camera) |
CameraGroupStrategy(Camera camera,
java.util.Comparator<Decal> sorter) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterGroup(int group)
Invoked directly after rendering of a group has completed
|
void |
afterGroups()
Invoked after having rendered all groups
|
void |
beforeGroup(int group,
Array<Decal> contents)
Invoked directly before rendering the contents of a group
|
void |
beforeGroups()
Invoked before rendering any group
|
int |
decideGroup(Decal decal)
Assigns a group to a decal
|
void |
dispose()
Releases all resources of this object.
|
Camera |
getCamera() |
ShaderProgram |
getGroupShader(int group)
Returns the shader to be used for the group.
|
void |
setCamera(Camera camera) |
public CameraGroupStrategy(Camera camera)
public void setCamera(Camera camera)
public Camera getCamera()
public int decideGroup(Decal decal)
GroupStrategydecideGroup in interface GroupStrategydecal - Decal to assign group topublic void beforeGroup(int group,
Array<Decal> contents)
GroupStrategybeforeGroup in interface GroupStrategygroup - Group that will be renderedcontents - Array of entries of arrays containing all the decals in the grouppublic void afterGroup(int group)
GroupStrategyafterGroup in interface GroupStrategygroup - Group which completed renderingpublic void beforeGroups()
GroupStrategybeforeGroups in interface GroupStrategypublic void afterGroups()
GroupStrategyafterGroups in interface GroupStrategypublic ShaderProgram getGroupShader(int group)
GroupStrategygetGroupShader in interface GroupStrategygroup - the groupShaderProgrampublic void dispose()
Disposabledispose in interface Disposable