Class CameraGroupStrategy

  • All Implemented Interfaces:, com.badlogic.gdx.utils.Disposable

    public class CameraGroupStrategy
    extends java.lang.Object
    implements, com.badlogic.gdx.utils.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

      Constructor Description
      CameraGroupStrategy​( camera)  
      CameraGroupStrategy​( camera, java.util.Comparator<> sorter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterGroup​(int group)  
      void afterGroups()  
      void beforeGroup​(int group, com.badlogic.gdx.utils.Array<> contents)  
      void beforeGroups()  
      int decideGroup​( decal)  
      void dispose() getCamera() getGroupShader​(int group)  
      void setCamera​( camera)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CameraGroupStrategy

        public CameraGroupStrategy​( camera)
      • CameraGroupStrategy

        public CameraGroupStrategy​( camera,
                                   java.util.Comparator<> sorter)
    • Method Detail

      • setCamera

        public void setCamera​( camera)
      • getCamera

        public getCamera()
      • decideGroup

        public int decideGroup​( decal)
        Specified by:
        decideGroup in interface
      • beforeGroup

        public void beforeGroup​(int group,
                                com.badlogic.gdx.utils.Array<> contents)
        Specified by:
        beforeGroup in interface
      • afterGroup

        public void afterGroup​(int group)
        Specified by:
        afterGroup in interface
      • beforeGroups

        public void beforeGroups()
        Specified by:
        beforeGroups in interface
      • afterGroups

        public void afterGroups()
        Specified by:
        afterGroups in interface
      • getGroupShader

        public getGroupShader​(int group)
        Specified by:
        getGroupShader in interface
      • dispose

        public void dispose()
        Specified by:
        dispose in interface com.badlogic.gdx.utils.Disposable