Draw sprites in batch to reduce the number of draw calls, state setup etc. More...
Public Member Functions | |
SpriteList (TextureInfo texture_info) | |
SpriteList constructor. | |
override void | DrawHierarchy () |
This called by Director only, but PushTransform, Draw, and PopTransform can be overriden. | |
Public Attributes | |
bool | EnableLocalTransform = true |
If EnableLocalTransform flag is true, the children sprite's local transform matrices get used, but vertices get partly transformed on the cpu. | |
Vector4 | Color = Colors.White |
The color that will be used for all sprites in the Children list. | |
BlendMode | BlendMode = BlendMode.Normal |
The blend mode that will be used for all sprites in the Children list. | |
TextureInfo | TextureInfo |
The TextureInfo object that will be used for all sprites in the Children list. | |
SpriteRenderer.ISpriteShader | Shader = (SpriteRenderer.ISpriteShader)Director.Instance.SpriteRenderer.DefaultShader |
The shader that will be used for all sprites in the Children list. |
Draw sprites in batch to reduce the number of draw calls, state setup etc.
Just adding SpriteUV or SpriteTile objects as children of a SpriteList with AddChild() will enable batch rendering, with the limitation that the TextureInfo, BlendMode, and Color property of the sprites will be ignored in favor of the parent SpriteList's TextureInfo, BlendMode, and Color properties.
Important: some functions in SpriteUV and SpriteTile use their local TextureInfo instead of the parent's SpriteTile one, so you probably want to set both to be safe.
SpriteList | ( | TextureInfo | texture_info | ) |
SpriteList constructor.
TextureInfo must be specified in constructor since there is no default for it.
bool EnableLocalTransform = true |
If EnableLocalTransform flag is true, the children sprite's local transform matrices get used, but vertices get partly transformed on the cpu.
You can turn this behavior off to ignore the local transform matrix to save a little bit of cpu processing (and rely on Sprite's Quad only to position the sprite). In that case (EnableLocalTransform=false) the Position, Scale, Skew, Pivot will be ignored.