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 |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv Pool | |
| pack-priv Camera | |
| private final Comparator | |
| private static final int | |
| private static final int | |
| pack-priv ObjectMap | |
| pack-priv ShaderProgram | |
| pack-priv Array |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterGroup(int group)
Implements com. Invoked directly after rendering of a group has completed |
| public void | afterGroups()
Implements com. Invoked after having rendered all groups |
| public void | beforeGroup(int group, Array<Decal> contents)
Implements com. Invoked directly before rendering the contents of a group |
| public void | beforeGroups()
Implements com. Invoked before rendering any group |
| private void | |
| public int | decideGroup(Decal decal)
Implements com. Assigns a group to a decal |
| public void | dispose()
Implements com. Releases all resources of this object. |
| public Camera | |
| public ShaderProgram | getGroupShader(int group)
Implements com. Returns the shader to be used for the group. |
| public void |
| arrayPool | back to summary |
|---|---|
| pack-priv Pool<Array<Decal>> arrayPool | |
| camera | back to summary |
|---|---|
| pack-priv Camera camera | |
| cameraSorter | back to summary |
|---|---|
| private final Comparator<Decal> cameraSorter | |
| GROUP_BLEND | back to summary |
|---|---|
| private static final int GROUP_BLEND | |
| GROUP_OPAQUE | back to summary |
|---|---|
| private static final int GROUP_OPAQUE | |
| materialGroups | back to summary |
|---|---|
| pack-priv ObjectMap<DecalMaterial, Array<Decal>> materialGroups | |
| shader | back to summary |
|---|---|
| pack-priv ShaderProgram shader | |
| usedArrays | back to summary |
|---|---|
| pack-priv Array<Array<Decal>> usedArrays | |
| CameraGroupStrategy | back to summary |
|---|---|
| public CameraGroupStrategy(Camera camera) | |
| CameraGroupStrategy | back to summary |
|---|---|
| public CameraGroupStrategy(Camera camera, Comparator<Decal> sorter) | |
| afterGroup | back to summary |
|---|---|
| public void afterGroup(int group) Implements com. Doc from com. Invoked directly after rendering of a group has completed
| |
| afterGroups | back to summary |
|---|---|
| public void afterGroups() Implements com. Doc from com. Invoked after having rendered all groups
| |
| beforeGroup | back to summary |
|---|---|
| public void beforeGroup(int group, Array<Decal> contents) Implements com. Doc from com. Invoked directly before rendering the contents of a group
| |
| beforeGroups | back to summary |
|---|---|
| public void beforeGroups() Implements com. Doc from com. Invoked before rendering any group
| |
| createDefaultShader | back to summary |
|---|---|
| private void createDefaultShader() | |
| decideGroup | back to summary |
|---|---|
| public int decideGroup(Decal decal) Implements com. Doc from com. Assigns a group to a decal
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object.
| |
| getCamera | back to summary |
|---|---|
| public Camera getCamera() | |
| getGroupShader | back to summary |
|---|---|
| public ShaderProgram getGroupShader(int group) Implements com. Doc from com. Returns the shader to be used for the group. Can be null in which case the GroupStrategy doesn't support GLES 2.0
| |
| setCamera | back to summary |
|---|---|
| public void setCamera(Camera camera) | |