Unravel Engine C++ Reference
|
#include <cube_atlas.h>
Classes | |
struct | PackedLayer |
Public Member Functions | |
Atlas (uint16_t _textureSize, uint16_t _maxRegionsCount=4096) | |
Atlas (uint16_t _textureSize, const uint8_t *_textureBuffer, uint16_t _regionCount, const uint8_t *_regionBuffer, uint16_t _maxRegionsCount=4096) | |
~Atlas () | |
uint16_t | addRegion (uint16_t _width, uint16_t _height, const uint8_t *_bitmapBuffer, AtlasRegion::Type _type=AtlasRegion::TYPE_BGRA8, uint16_t outline=0) |
add a region to the atlas, and copy the content of mem to the underlying texture | |
void | updateRegion (const AtlasRegion &_region, const uint8_t *_bitmapBuffer) |
update a preallocated region | |
void | packUV (uint16_t _regionHandle, uint8_t *_vertexBuffer, uint32_t _offset, uint32_t _stride) const |
void | packUV (const AtlasRegion &_region, uint8_t *_vertexBuffer, uint32_t _offset, uint32_t _stride) const |
void | packFaceLayerUV (uint32_t _idx, uint8_t *_vertexBuffer, uint32_t _offset, uint32_t _stride) const |
Same as packUV but pack a whole face of the atlas cube, mostly used for debugging and visualizing atlas. | |
bgfx::TextureHandle | getTextureHandle () const |
return the TextureHandle (cube) of the atlas | |
const AtlasRegion & | getRegion (uint16_t _handle) const |
uint16_t | getTextureSize () const |
retrieve the size of side of a texture in pixels | |
uint16_t | getRegionCount () const |
retrieve the usage ratio of the atlas | |
const AtlasRegion * | getRegionBuffer () const |
retrieve a pointer to the region buffer (in order to serialize it) | |
uint32_t | getTextureBufferSize () const |
retrieve the byte size of the texture | |
const uint8_t * | getTextureBuffer () const |
retrieve the mirrored texture buffer (to serialize it) | |
Definition at line 55 of file cube_atlas.h.
gfx::Atlas::Atlas | ( | uint16_t | _textureSize, |
uint16_t | _maxRegionsCount = 4096 ) |
create an empty dynamic atlas (region can be updated and added)
textureSize | an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA) ) |
maxRegionCount | maximum number of region allowed in the atlas |
Definition at line 246 of file cube_atlas.cpp.
gfx::Atlas::Atlas | ( | uint16_t | _textureSize, |
const uint8_t * | _textureBuffer, | ||
uint16_t | _regionCount, | ||
const uint8_t * | _regionBuffer, | ||
uint16_t | _maxRegionsCount = 4096 ) |
initialize a static atlas with serialized data (region can be updated but not added)
textureSize | an atlas creates a texture cube of 6 faces with size equal to (textureSize*textureSize * sizeof(RGBA) ) |
textureBuffer | buffer of size 6*textureSize*textureSize*sizeof(uint32_t) (will be copied) |
regionCount | number of region in the Atlas |
regionBuffer | buffer containing the region (will be copied) |
maxRegionCount | maximum number of region allowed in the atlas |
Definition at line 271 of file cube_atlas.cpp.
gfx::Atlas::~Atlas | ( | ) |
Definition at line 303 of file cube_atlas.cpp.
uint16_t gfx::Atlas::addRegion | ( | uint16_t | _width, |
uint16_t | _height, | ||
const uint8_t * | _bitmapBuffer, | ||
AtlasRegion::Type | _type = AtlasRegion::TYPE_BGRA8, | ||
uint16_t | outline = 0 ) |
add a region to the atlas, and copy the content of mem to the underlying texture
Definition at line 312 of file cube_atlas.cpp.
|
inline |
Definition at line 112 of file cube_atlas.h.
|
inline |
retrieve a pointer to the region buffer (in order to serialize it)
Definition at line 133 of file cube_atlas.h.
|
inline |
retrieve the usage ratio of the atlas
retrieve the numbers of region in the atlas
Definition at line 127 of file cube_atlas.h.
|
inline |
retrieve the mirrored texture buffer (to serialize it)
Definition at line 145 of file cube_atlas.h.
|
inline |
retrieve the byte size of the texture
Definition at line 139 of file cube_atlas.h.
|
inline |
return the TextureHandle (cube) of the atlas
Definition at line 106 of file cube_atlas.h.
|
inline |
retrieve the size of side of a texture in pixels
Definition at line 118 of file cube_atlas.h.
void gfx::Atlas::packFaceLayerUV | ( | uint32_t | _idx, |
uint8_t * | _vertexBuffer, | ||
uint32_t | _offset, | ||
uint32_t | _stride ) const |
Same as packUV but pack a whole face of the atlas cube, mostly used for debugging and visualizing atlas.
Definition at line 435 of file cube_atlas.cpp.
void gfx::Atlas::packUV | ( | const AtlasRegion & | _region, |
uint8_t * | _vertexBuffer, | ||
uint32_t | _offset, | ||
uint32_t | _stride ) const |
Definition at line 455 of file cube_atlas.cpp.
void gfx::Atlas::packUV | ( | uint16_t | _regionHandle, |
uint8_t * | _vertexBuffer, | ||
uint32_t | _offset, | ||
uint32_t | _stride ) const |
Pack the UV coordinates of the four corners of a region to a vertex buffer using the supplied vertex format. v0 – v3 | | encoded in that order: v0,v1,v2,v3 v1 – v2
handle | handle to the region we are interested in |
vertexBuffer | address of the first vertex we want to update. Must be valid up to vertexBuffer + offset + 3*stride + 4*sizeof(int16_t), which means the buffer must contains at least 4 vertex includind the first. |
offset | byte offset to the first uv coordinate of the vertex in the buffer |
stride | stride between tho UV coordinates, usually size of a Vertex. |
Definition at line 440 of file cube_atlas.cpp.
void gfx::Atlas::updateRegion | ( | const AtlasRegion & | _region, |
const uint8_t * | _bitmapBuffer ) |
update a preallocated region
Definition at line 381 of file cube_atlas.cpp.