Class CameraGroupStrategy
- java.lang.Object
-
- com.badlogic.gdx.graphics.g3d.decals.CameraGroupStrategy
-
- All Implemented Interfaces:
GroupStrategy,Disposable
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 Summary
Constructors Constructor Description CameraGroupStrategy(Camera camera)CameraGroupStrategy(Camera camera, java.util.Comparator<Decal> sorter)
-
Method Summary
All Methods Instance Methods Concrete 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 decalvoiddispose()Releases all resources of this object.CameragetCamera()ShaderProgramgetGroupShader(int group)Returns the shader to be used for the group.voidsetCamera(Camera camera)
-
-
-
Method Detail
-
setCamera
public void setCamera(Camera camera)
-
getCamera
public Camera getCamera()
-
decideGroup
public int decideGroup(Decal decal)
Description copied from interface:GroupStrategyAssigns a group to a decal- Specified by:
decideGroupin interfaceGroupStrategy- Parameters:
decal- Decal to assign group to- Returns:
- group assigned
-
beforeGroup
public void beforeGroup(int group, Array<Decal> contents)Description copied from interface:GroupStrategyInvoked directly before rendering the contents of a group- Specified by:
beforeGroupin interfaceGroupStrategy- Parameters:
group- Group that will be renderedcontents- Array of entries of arrays containing all the decals in the group
-
afterGroup
public void afterGroup(int group)
Description copied from interface:GroupStrategyInvoked directly after rendering of a group has completed- Specified by:
afterGroupin interfaceGroupStrategy- Parameters:
group- Group which completed rendering
-
beforeGroups
public void beforeGroups()
Description copied from interface:GroupStrategyInvoked before rendering any group- Specified by:
beforeGroupsin interfaceGroupStrategy
-
afterGroups
public void afterGroups()
Description copied from interface:GroupStrategyInvoked after having rendered all groups- Specified by:
afterGroupsin interfaceGroupStrategy
-
getGroupShader
public ShaderProgram getGroupShader(int group)
Description copied from interface:GroupStrategyReturns the shader to be used for the group. Can be null in which case the GroupStrategy doesn't support GLES 2.0- Specified by:
getGroupShaderin interfaceGroupStrategy- Parameters:
group- the group- Returns:
- the
ShaderProgram
-
dispose
public void dispose()
Description copied from interface:DisposableReleases all resources of this object.- Specified by:
disposein interfaceDisposable
-
-