Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | List of all members
SpriteBatch Class Reference

`#include <SpriteBatch.h>`

Inheritance diagram for SpriteBatch:

## Public Member Functions
| SpriteBatch ()
virtual | ~SpriteBatch ()
virtual bool | onAdd ()
virtual void | onRemove ()
void | prepareRender (SceneRenderObject *pSceneRenderObject, const SceneRenderState *pSceneRenderState, SceneRenderQueue *pSceneRenderQueue)
void | render (const SceneRenderState *pSceneRenderState, const SceneRenderRequest *pSceneRenderRequest, BatchRender *pBatchRenderer)
void | setBatchTransformDirty (void)
bool | getBatchTransformDirty (void) const
U32 | getBatchTransformId (void)
const b2Transform & | getBatchTransform (void) const
void | setLocalExtentsDirty (void)
bool | getLocalExtentsDirty (void) const
const Vector2 & | getLocalExtents (void)
void | createQueryProxy (SpriteBatchItem *pSpriteBatchItem)
void | destroyQueryProxy (SpriteBatchItem *pSpriteBatchItem)
void | moveQueryProxy (SpriteBatchItem *pSpriteBatchItem, const b2AABB &localAABB)
SpriteBatchQuery * | getSpriteBatchQuery (const bool clearQuery=false)
virtual void | copyTo (SpriteBatch *pSpriteBatch) const
U32 | getSpriteCount (void)
U32 | addSprite (const SpriteBatchItem::LogicalPosition &logicalPosition)
bool | removeSprite (void)
virtual void | clearSprites (void)
void | setBatchSortMode (SceneRenderQueue::RenderSort sortMode)
SceneRenderQueue::RenderSort | getBatchSortMode (void) const
void | setBatchCulling (const bool batchCulling)
bool | getBatchCulling (void) const
void | setDefaultSpriteStride (const Vector2 &defaultStride)
const Vector2 & | getDefaultSpriteStride (void) const
void | setDefaultSpriteSize (const Vector2 &defaultSize)
const Vector2 & | getDefaultSpriteSize (void) const
void | setDefaultSpriteAngle (const F32 defaultAngle)
F32 | getDefaultSpriteAngle (void) const
bool | selectSprite (const SpriteBatchItem::LogicalPosition &logicalPosition)
bool | selectSpriteId (const U32 batchId)
bool | selectSpriteName (const char *pName)
void | deselectSprite (void)
bool | isSpriteSelected (void) const
U32 | getSpriteId (void) const
void | setSpriteImage (const char *pAssetId, const U32 imageFrame)
void | setSpriteImage (const char *pAssetId, const char *namedFrame)
StringTableEntry | getSpriteImage (void) const
void | setSpriteImageFrame (const U32 imageFrame)
U32 | getSpriteImageFrame (void) const
void | setSpriteNamedImageFrame (const char *namedFrame)
StringTableEntry | getSpriteNamedImageFrame (void) const
void | setSpriteAnimation (const char *pAssetId)
StringTableEntry | getSpriteAnimation (void) const
void | setSpriteAnimationFrame (const U32 animationFrame)
U32 | getSpriteAnimationFrame (void) const
void | clearSpriteAsset (void)
void | setSpriteVisible (const bool visible)
bool | getSpriteVisible (void) const
void | setSpriteLocalPosition (const Vector2 &localPosition)
Vector2 | getSpriteLocalPosition (void)
const SpriteBatchItem::LogicalPosition | getSpriteLogicalPosition (void) const
void | setSpriteAngle (const F32 localAngle)
F32 | getSpriteAngle (void) const
void | setSpriteDepth (const F32 depth)
F32 | getSpriteDepth (void) const
void | setSpriteSize (const Vector2 &size)
Vector2 | getSpriteSize (void) const
void | setSpriteFlipX (const bool flipX)
bool | getSpriteFlipX (void) const
void | setSpriteFlipY (const bool flipY)
bool | getSpriteFlipY (void) const
void | setSpriteSortPoint (const Vector2 &sortPoint)
Vector2 | getSpriteSortPoint (void) const
void | setSpriteRenderGroup (const char *pRenderGroup)
StringTableEntry | getSpriteRenderGroup (void) const
void | setSpriteBlendMode (const bool blendMode)
bool | getSpriteBlendMode (void) const
void | setSpriteSrcBlendFactor (GLenum srcBlendFactor)
GLenum | getSpriteSrcBlendFactor (void) const
void | setSpriteDstBlendFactor (GLenum dstBlendFactor)
GLenum | getSpriteDstBlendFactor (void) const
void | setSpriteBlendColor (const ColorF &blendColor)
const ColorF & | getSpriteBlendColor (void) const
void | setSpriteBlendAlpha (const F32 alpha)
F32 | getSpriteBlendAlpha (void) const
void | setSpriteAlphaTest (const F32 alphaTestMode)
F32 | getSpriteAlphaTest (void) const
void | setSpriteDataObject (SimObject *pDataObject)
SimObject * | getSpriteDataObject (void) const
void | setUserData (void *pUserData)
void * | getUserData (void) const
void | setSpriteName (const char *pName)
StringTableEntry | getSpriteName (void) const

## Static Public Member Functions
static void | WriteCustomTamlSchema (const AbstractClassRep *pClassRep, TiXmlElement *pParentElement)

## Static Public Attributes
static const S32 | INVALID_SPRITE_PROXY = -1

## Protected Types
typedef HashMap< U32, SpriteBatchItem * > | typeSpriteBatchHash
typedef HashMap< SpriteBatchItem::LogicalPosition, SpriteBatchItem * > | typeSpritePositionHash
typedef HashMap< StringTableEntry, SpriteBatchItem * > | typeSpriteNameHash

## Protected Member Functions
SpriteBatchItem * | createSprite (void)
SpriteBatchItem * | createSprite (const Vector2 *explicitVertices)
SpriteBatchItem * | findSpritePosition (const SpriteBatchItem::LogicalPosition &logicalPosition)
SpriteBatchItem * | findSpriteId (const U32 batchId)
SpriteBatchItem * | findSpriteName (const char *pName)
virtual SpriteBatchItem * | createSprite (const SpriteBatchItem::LogicalPosition &logicalPosition)
void | setBatchTransform (const b2Transform &batchTransform)
void | updateLocalExtents (void)
void | createSpriteBatchQuery (void)
void | destroySpriteBatchQuery (void)
void | onTamlCustomWrite (TamlCustomNodes &customNodes)
void | onTamlCustomRead (const TamlCustomNodes &customNodes)

## Protected Attributes
typeSpriteBatchHash | mSprites
typeSpritePositionHash | mSpritePositions
typeSpriteNameHash | mSpriteNames
SpriteBatchItem * | mSelectedSprite
SceneRenderQueue::RenderSort | mBatchSortMode
bool | mBatchCulling
Vector2 | mDefaultSpriteStride
Vector2 | mDefaultSpriteSize
F32 | mDefaultSpriteAngle

## Member Typedef Documentation

typedef HashMap< U32, SpriteBatchItem* > typeSpriteBatchHash
| protected

typedef HashMap< StringTableEntry, SpriteBatchItem* > typeSpriteNameHash
| protected

typedef HashMap< SpriteBatchItem::LogicalPosition, SpriteBatchItem* > typeSpritePositionHash
| protected

## Constructor & Destructor Documentation

SpriteBatch | ( |  | ) |

~SpriteBatch | ( |  | ) |
| virtual

## Member Function Documentation

U32 addSprite | ( | const SpriteBatchItem::LogicalPosition & | logicalPosition | ) |

void clearSpriteAsset | ( | void |  | ) |

void clearSprites | ( | void |  | ) |
| virtual

void copyTo | ( | SpriteBatch * | pSpriteBatch | ) | const
| virtual

void createQueryProxy | ( | SpriteBatchItem * | pSpriteBatchItem | ) |

SpriteBatchItem * createSprite | ( | void |  | ) |
| protected

SpriteBatchItem * createSprite | ( | const Vector2 * | explicitVertices | ) |
| protected

SpriteBatchItem * createSprite | ( | const SpriteBatchItem::LogicalPosition & | logicalPosition | ) |
| protected virtual

Reimplemented in CompositeSprite.

void createSpriteBatchQuery | ( | void |  | ) |
| protected

void deselectSprite | ( | void |  | ) |
| inline

void destroyQueryProxy | ( | SpriteBatchItem * | pSpriteBatchItem | ) |

void destroySpriteBatchQuery | ( | void |  | ) |
| protected

SpriteBatchItem * findSpriteId | ( | const U32 | batchId | ) |
| protected

SpriteBatchItem * findSpriteName | ( | const char * | pName | ) |
| protected

SpriteBatchItem * findSpritePosition | ( | const SpriteBatchItem::LogicalPosition & | logicalPosition | ) |
| protected

bool getBatchCulling | ( | void |  | ) | const
| inline

SceneRenderQueue::RenderSort getBatchSortMode | ( | void |  | ) | const
| inline

const b2Transform& getBatchTransform | ( | void |  | ) | const
| inline

bool getBatchTransformDirty | ( | void |  | ) | const
| inline

U32 getBatchTransformId | ( | void |  | ) |
| inline

F32 getDefaultSpriteAngle | ( | void |  | ) | const
| inline

const Vector2& getDefaultSpriteSize | ( | void |  | ) | const
| inline

const Vector2& getDefaultSpriteStride | ( | void |  | ) | const
| inline

const Vector2& getLocalExtents | ( | void |  | ) |
| inline

bool getLocalExtentsDirty | ( | void |  | ) | const
| inline

F32 getSpriteAlphaTest | ( | void |  | ) | const

F32 getSpriteAngle | ( | void |  | ) | const

StringTableEntry getSpriteAnimation | ( | void |  | ) | const

U32 getSpriteAnimationFrame | ( | void |  | ) | const

SpriteBatchQuery * getSpriteBatchQuery | ( | const bool | clearQuery = `false` | ) |

F32 getSpriteBlendAlpha | ( | void |  | ) | const

const ColorF & getSpriteBlendColor | ( | void |  | ) | const

bool getSpriteBlendMode | ( | void |  | ) | const

U32 getSpriteCount | ( | void |  | ) |
| inline

SimObject * getSpriteDataObject | ( | void |  | ) | const

F32 getSpriteDepth | ( | void |  | ) | const

GLenum getSpriteDstBlendFactor | ( | void |  | ) | const

bool getSpriteFlipX | ( | void |  | ) | const

bool getSpriteFlipY | ( | void |  | ) | const

U32 getSpriteId | ( | void |  | ) | const

StringTableEntry getSpriteImage | ( | void |  | ) | const

U32 getSpriteImageFrame | ( | void |  | ) | const

Vector2 getSpriteLocalPosition | ( | void |  | ) |

const SpriteBatchItem::LogicalPosition getSpriteLogicalPosition | ( | void |  | ) | const

StringTableEntry getSpriteName | ( | void |  | ) | const

StringTableEntry getSpriteNamedImageFrame | ( | void |  | ) | const

StringTableEntry getSpriteRenderGroup | ( | void |  | ) | const

Vector2 getSpriteSize | ( | void |  | ) | const

Vector2 getSpriteSortPoint | ( | void |  | ) | const

GLenum getSpriteSrcBlendFactor | ( | void |  | ) | const

bool getSpriteVisible | ( | void |  | ) | const

void * getUserData | ( | void |  | ) | const

bool isSpriteSelected | ( | void |  | ) | const
| inline

void moveQueryProxy | ( | SpriteBatchItem * | pSpriteBatchItem,
|  | const b2AABB & | localAABB
| ) |  |

bool onAdd | ( | void |  | ) |
| virtual

Reimplemented in CompositeSprite.

void onRemove | ( |  | ) |
| virtual

Reimplemented in CompositeSprite.

void onTamlCustomRead | ( | const TamlCustomNodes & | customNodes | ) |
| protected

void onTamlCustomWrite | ( | TamlCustomNodes & | customNodes | ) |
| protected

void prepareRender | ( | SceneRenderObject * | pSceneRenderObject,
|  | const SceneRenderState * | pSceneRenderState,
|  | SceneRenderQueue * | pSceneRenderQueue
| ) |  |

bool removeSprite | ( | void |  | ) |

void render | ( | const SceneRenderState * | pSceneRenderState,
|  | const SceneRenderRequest * | pSceneRenderRequest,
|  | BatchRender * | pBatchRenderer
| ) |  |

bool selectSprite | ( | const SpriteBatchItem::LogicalPosition & | logicalPosition | ) |

bool selectSpriteId | ( | const U32 | batchId | ) |

bool selectSpriteName | ( | const char * | pName | ) |

void setBatchCulling | ( | const bool | batchCulling | ) |

void setBatchSortMode | ( | SceneRenderQueue::RenderSort | sortMode | ) |
| inline

void setBatchTransform | ( | const b2Transform & | batchTransform | ) |
| protected

void setBatchTransformDirty | ( | void |  | ) |
| inline

void setDefaultSpriteAngle | ( | const F32 | defaultAngle | ) |
| inline

void setDefaultSpriteSize | ( | const Vector2 & | defaultSize | ) |
| inline

void setDefaultSpriteStride | ( | const Vector2 & | defaultStride | ) |
| inline

void setLocalExtentsDirty | ( | void |  | ) |
| inline

void setSpriteAlphaTest | ( | const F32 | alphaTestMode | ) |

void setSpriteAngle | ( | const F32 | localAngle | ) |

void setSpriteAnimation | ( | const char * | pAssetId | ) |

void setSpriteAnimationFrame | ( | const U32 | animationFrame | ) |

void setSpriteBlendAlpha | ( | const F32 | alpha | ) |

void setSpriteBlendColor | ( | const ColorF & | blendColor | ) |

void setSpriteBlendMode | ( | const bool | blendMode | ) |

void setSpriteDataObject | ( | SimObject * | pDataObject | ) |

void setSpriteDepth | ( | const F32 | depth | ) |

void setSpriteDstBlendFactor | ( | GLenum | dstBlendFactor | ) |

void setSpriteFlipX | ( | const bool | flipX | ) |

void setSpriteFlipY | ( | const bool | flipY | ) |

void setSpriteImage | ( | const char * | pAssetId,
|  | const U32 | imageFrame
| ) |  |

void setSpriteImage | ( | const char * | pAssetId,
|  | const char * | namedFrame
| ) |  |

void setSpriteImageFrame | ( | const U32 | imageFrame | ) |

void setSpriteLocalPosition | ( | const Vector2 & | localPosition | ) |

void setSpriteName | ( | const char * | pName | ) |

void setSpriteNamedImageFrame | ( | const char * | namedFrame | ) |

void setSpriteRenderGroup | ( | const char * | pRenderGroup | ) |

void setSpriteSize | ( | const Vector2 & | size | ) |

void setSpriteSortPoint | ( | const Vector2 & | sortPoint | ) |

void setSpriteSrcBlendFactor | ( | GLenum | srcBlendFactor | ) |

void setSpriteVisible | ( | const bool | visible | ) |

void setUserData | ( | void * | pUserData | ) |

void updateLocalExtents | ( | void |  | ) |
| protected

void WriteCustomTamlSchema | ( | const AbstractClassRep * | pClassRep,
|  | TiXmlElement * | pParentElement
| ) |  |
| static

## Member Data Documentation

const S32 INVALID_SPRITE_PROXY = -1
| static

bool mBatchCulling
| protected

SceneRenderQueue::RenderSort mBatchSortMode
| protected

F32 mDefaultSpriteAngle
| protected

Vector2 mDefaultSpriteSize
| protected

Vector2 mDefaultSpriteStride
| protected

SpriteBatchItem* mSelectedSprite
| protected

typeSpriteNameHash mSpriteNames
| protected

typeSpritePositionHash mSpritePositions
| protected

typeSpriteBatchHash mSprites
| protected

The documentation for this class was generated from the following files:

- 2d/core/SpriteBatch.h
- 2d/core/SpriteBatch.cc