com.badlogic.gdx.graphics.g3d.decals
Class DefaultGroupStrategy

java.lang.Object
  extended by com.badlogic.gdx.graphics.g3d.decals.DefaultGroupStrategy
All Implemented Interfaces:
GroupStrategy

public class DefaultGroupStrategy
extends Object
implements GroupStrategy

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.

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
DefaultGroupStrategy()
           
 
Method Summary
 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
 ShaderProgram getGroupShader(int group)
          Returns the shader to be used for the group.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGroupStrategy

public DefaultGroupStrategy()
Method Detail

decideGroup

public int decideGroup(Decal decal)
Description copied from interface: GroupStrategy
Assigns a group to a decal

Specified by:
decideGroup in interface GroupStrategy
Parameters:
decal - Decal to assign group to
Returns:
group assigned

beforeGroup

public void beforeGroup(int group,
                        Array<Decal> contents)
Description copied from interface: GroupStrategy
Invoked directly before rendering the contents of a group

Specified by:
beforeGroup in interface GroupStrategy
Parameters:
group - Group that will be rendered
contents - Array of entries of arrays containing all the decals in the group

afterGroup

public void afterGroup(int group)
Description copied from interface: GroupStrategy
Invoked directly after rendering of a group has completed

Specified by:
afterGroup in interface GroupStrategy
Parameters:
group - Group which completed rendering

beforeGroups

public void beforeGroups()
Description copied from interface: GroupStrategy
Invoked before rendering any group

Specified by:
beforeGroups in interface GroupStrategy

afterGroups

public void afterGroups()
Description copied from interface: GroupStrategy
Invoked after having rendered all groups

Specified by:
afterGroups in interface GroupStrategy

getGroupShader

public ShaderProgram getGroupShader(int group)
Description copied from interface: GroupStrategy
Returns the shader to be used for the group. Can be null in which case the GroupStrategy doesn't support GLES 2.0

Specified by:
getGroupShader in interface GroupStrategy
Parameters:
group - the group
Returns:
the ShaderProgram


Copyright © 2013. All Rights Reserved.