Class CameraGroupStrategy

  • All Implemented Interfaces:
    com.badlogic.gdx.graphics.g3d.decals.GroupStrategy, com.badlogic.gdx.utils.Disposable

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

      Constructors 
      Constructor Description
      CameraGroupStrategy​(com.badlogic.gdx.graphics.Camera camera)  
      CameraGroupStrategy​(com.badlogic.gdx.graphics.Camera camera, java.util.Comparator<com.badlogic.gdx.graphics.g3d.decals.Decal> 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<com.badlogic.gdx.graphics.g3d.decals.Decal> contents)  
      void beforeGroups()  
      int decideGroup​(com.badlogic.gdx.graphics.g3d.decals.Decal decal)  
      void dispose()  
      com.badlogic.gdx.graphics.Camera getCamera()  
      com.badlogic.gdx.graphics.glutils.ShaderProgram getGroupShader​(int group)  
      void setCamera​(com.badlogic.gdx.graphics.Camera camera)  
      • Methods inherited from class java.lang.Object

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

      • CameraGroupStrategy

        public CameraGroupStrategy​(com.badlogic.gdx.graphics.Camera camera)
      • CameraGroupStrategy

        public CameraGroupStrategy​(com.badlogic.gdx.graphics.Camera camera,
                                   java.util.Comparator<com.badlogic.gdx.graphics.g3d.decals.Decal> sorter)
    • Method Detail

      • setCamera

        public void setCamera​(com.badlogic.gdx.graphics.Camera camera)
      • getCamera

        public com.badlogic.gdx.graphics.Camera getCamera()
      • decideGroup

        public int decideGroup​(com.badlogic.gdx.graphics.g3d.decals.Decal decal)
        Specified by:
        decideGroup in interface com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
      • beforeGroup

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

        public void afterGroup​(int group)
        Specified by:
        afterGroup in interface com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
      • beforeGroups

        public void beforeGroups()
        Specified by:
        beforeGroups in interface com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
      • afterGroups

        public void afterGroups()
        Specified by:
        afterGroups in interface com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
      • getGroupShader

        public com.badlogic.gdx.graphics.glutils.ShaderProgram getGroupShader​(int group)
        Specified by:
        getGroupShader in interface com.badlogic.gdx.graphics.g3d.decals.GroupStrategy
      • dispose

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