Package com.prineside.tdi2.systems
Class CachedRenderingSystem
java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.GameSystem
com.prineside.tdi2.systems.CachedRenderingSystem
- All Implemented Interfaces:
Disposable
,KryoSerializable
Allows to define layers of static / cached graphics.
Suits best for the graphics that do not change every frame (for example, tiles on map / static parts of towers).
Uses SpriteCache and stores graphics on GPU - CPU won't have to send vertex data every frame.
Does nothing by itself, layers must be rendered manually.
It is just a convenience system for SpriteCaches
-
Field Summary
Fields inherited from class com.prineside.tdi2.Registrable
S
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddLayer
(String name, int sizePerCache, ShaderProgram shaderProgram, boolean useIndices) boolean
getOrAddLayer
(String name, int sizePerCache, ShaderProgram shaderProgram, boolean useIndices) Will recreate existing layer if its parameters do not match.boolean
void
removeLayer
(String name) void
setLayerDirty
(String name) If layer exists, it will be marked dirtyMethods inherited from class com.prineside.tdi2.GameSystem
dispose, getFastStateHash, postSetup, postStateRestore, profileUpdate, setup, update
Methods inherited from class com.prineside.tdi2.Registrable
isRegistered, read, setRegistered, setUnregistered, write
-
Constructor Details
-
CachedRenderingSystem
public CachedRenderingSystem()
-
-
Method Details
-
removeLayer
-
setLayerDirty
If layer exists, it will be marked dirty -
isDirty
- Returns:
- true if layer is marked as dirty or not exists
-
getLayer
- Returns:
- null if no layer found with this name
-
getOrAddLayer
public SpriteCacheExtended.CacheArray getOrAddLayer(String name, int sizePerCache, ShaderProgram shaderProgram, boolean useIndices) Will recreate existing layer if its parameters do not match. If no layer exists with this name, creates one. -
addLayer
public SpriteCacheExtended.CacheArray addLayer(String name, int sizePerCache, ShaderProgram shaderProgram, boolean useIndices) -
affectsGameState
public boolean affectsGameState()- Specified by:
affectsGameState
in classGameSystem
-
getSystemName
- Specified by:
getSystemName
in classGameSystem
-