Axmol Engine 2.4.0-258ceca
|
A class that implements a Texture Atlas. More...
#include <TextureAtlas.h>
Inherits Object.
Public Member Functions | |
TextureAtlas () | |
@js ctor | |
virtual | ~TextureAtlas () |
@js NA @lua NA | |
bool | initWithFile (std::string_view file, ssize_t capacity) |
Initializes a TextureAtlas with a filename and with a certain capacity for Quads. | |
bool | initWithTexture (Texture2D *texture, ssize_t capacity) |
Initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads. | |
void | updateQuad (const V3F_C4B_T2F_Quad &quad, ssize_t index) |
Updates a Quad (texture, vertex and color) at a certain index. | |
void | insertQuad (const V3F_C4B_T2F_Quad &quad, ssize_t index) |
Inserts a Quad (texture, vertex and color) at a certain index. | |
void | insertQuads (V3F_C4B_T2F_Quad *quads, ssize_t index, ssize_t amount) |
Inserts a c array of quads at a given index. | |
void | insertQuadFromIndex (ssize_t fromIndex, ssize_t newIndex) |
Removes the quad that is located at a certain index and inserts it at a new index. | |
void | removeQuadAtIndex (ssize_t index) |
Removes a quad at a given index number. | |
void | removeQuadsAtIndex (ssize_t index, ssize_t amount) |
Removes a amount of quads starting from index. | |
void | removeAllQuads () |
Removes all Quads. | |
bool | resizeCapacity (ssize_t capacity) |
Resize the capacity of the TextureAtlas. | |
void | increaseTotalQuadsWith (ssize_t amount) |
Used internally by ParticleBatchNode. | |
void | moveQuadsFromIndex (ssize_t oldIndex, ssize_t amount, ssize_t newIndex) |
Moves an amount of quads from oldIndex at newIndex. | |
void | moveQuadsFromIndex (ssize_t index, ssize_t newIndex) |
Moves quads from index till totalQuads to the newIndex. | |
void | fillWithEmptyQuadsFromIndex (ssize_t index, ssize_t amount) |
Ensures that after a realloc quads are still empty. | |
bool | isDirty () |
Whether or not the array buffer of the VBO needs to be updated. | |
void | setDirty (bool bDirty) |
Specify if the array buffer of the VBO needs to be updated. | |
virtual std::string | getDescription () const |
Get quads total amount. | |
size_t | getTotalQuads () const |
Gets the quantity of quads that are going to be drawn. | |
size_t | getCapacity () const |
Gets the quantity of quads that can be stored with the current texture atlas size. | |
Texture2D * | getTexture () const |
Gets the texture of the texture atlas. | |
void | setTexture (Texture2D *texture) |
Sets the texture for the texture atlas. | |
V3F_C4B_T2F_Quad * | getQuads () |
Gets the quads that are going to be rendered. | |
void | setQuads (V3F_C4B_T2F_Quad *quads) |
Sets the quads that are going to be rendered. | |
![]() | |
void | retain () |
Retains the ownership. | |
void | release () |
Releases the ownership immediately. | |
Object * | autorelease () |
Releases the ownership sometime soon automatically. | |
unsigned int | getReferenceCount () const |
Returns the Object's current reference count. | |
virtual | ~Object () |
Destructor. | |
Static Public Member Functions | |
static TextureAtlas * | create (std::string_view file, ssize_t capacity) |
Creates a TextureAtlas with an filename and with an initial capacity for Quads. | |
static TextureAtlas * | createWithTexture (Texture2D *texture, ssize_t capacity) |
Creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads. | |
Additional Inherited Members | |
![]() | |
unsigned int | _ID |
object id, ScriptSupport need public _ID | |
int | _luaID |
Lua reference id. | |
A class that implements a Texture Atlas.
Supported features: The atlas file can be a PVRTC, PNG or any other format supported by Texture2D Quads can be updated in runtime Quads can be added in runtime Quads can be removed in runtime Quads can be re-ordered in runtime The TextureAtlas capacity can be increased or decreased in runtime OpenGL component: V3F, C4B, T2F. The quads are rendered using an OpenGL ES VBO. To render the quads using an interleaved vertex array list, you should modify the Config.h file
|
static |
Creates a TextureAtlas with an filename and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
file | The file path. |
capacity | Capacity for Quads. |
|
static |
Creates a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for n Quads.
The TextureAtlas capacity can be increased in runtime.
texture | A texture2D object pointer. |
capacity | Capacity for Quads. |
bool initWithFile | ( | std::string_view | file, |
ssize_t | capacity ) |
Initializes a TextureAtlas with a filename and with a certain capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
file | The file path. |
capacity | Capacity for Quads. |
bool initWithTexture | ( | Texture2D * | texture, |
ssize_t | capacity ) |
Initializes a TextureAtlas with a previously initialized Texture2D object, and with an initial capacity for Quads.
The TextureAtlas capacity can be increased in runtime.
texture | A texture2D object pointer. |
capacity | Capacity for Quads. |
void updateQuad | ( | const V3F_C4B_T2F_Quad & | quad, |
ssize_t | index ) |
Updates a Quad (texture, vertex and color) at a certain index.
quad | Quad that are going to be rendered. |
index | Index must be between 0 and the atlas capacity - 1. |
void insertQuad | ( | const V3F_C4B_T2F_Quad & | quad, |
ssize_t | index ) |
Inserts a Quad (texture, vertex and color) at a certain index.
quad | Quad that are going to be rendered. |
index | Index must be between 0 and the atlas capacity - 1. |
void insertQuads | ( | V3F_C4B_T2F_Quad * | quads, |
ssize_t | index, | ||
ssize_t | amount ) |
Inserts a c array of quads at a given index.
quads | Quad that are going to be rendered. |
index | Index must be between 0 and the atlas capacity - 1. |
amount | The quads array amount. |
void insertQuadFromIndex | ( | ssize_t | fromIndex, |
ssize_t | newIndex ) |
Removes the quad that is located at a certain index and inserts it at a new index.
This operation is faster than removing and inserting in a quad in 2 different steps.
void removeQuadAtIndex | ( | ssize_t | index | ) |
Removes a quad at a given index number.
The capacity remains the same, but the total number of quads to be drawn is reduced in 1.
void removeQuadsAtIndex | ( | ssize_t | index, |
ssize_t | amount ) |
Removes a amount of quads starting from index.
void removeAllQuads | ( | ) |
Removes all Quads.
The TextureAtlas capacity remains untouched. No memory is freed. The total number of quads to be drawn will be 0.
bool resizeCapacity | ( | ssize_t | capacity | ) |
Resize the capacity of the TextureAtlas.
The new capacity can be lower or higher than the current one. It returns true if the resize was successful. If it fails to resize the capacity it will return false with a new capacity of 0.
capacity | Capacity for Quads. |
void increaseTotalQuadsWith | ( | ssize_t | amount | ) |
void moveQuadsFromIndex | ( | ssize_t | oldIndex, |
ssize_t | amount, | ||
ssize_t | newIndex ) |
Moves an amount of quads from oldIndex at newIndex.
void moveQuadsFromIndex | ( | ssize_t | index, |
ssize_t | newIndex ) |
Moves quads from index till totalQuads to the newIndex.
Used internally by ParticleBatchNode. This method doesn't enlarge the array if newIndex + quads to be moved > capacity.
void fillWithEmptyQuadsFromIndex | ( | ssize_t | index, |
ssize_t | amount ) |
|
virtual |
Get quads total amount.
@js NA @lua NA