Added texture data format support
This commit is contained in:
@ -55,11 +55,11 @@ void TiledSprite::onStart() {
|
||||
if(this->meshHost == nullptr || this->tileset == nullptr) return;
|
||||
auto tile = this->tileset->getTile(this->tile);
|
||||
|
||||
glm::vec2 size;
|
||||
glm::vec2 quadSize;
|
||||
|
||||
switch(this->sizeType) {
|
||||
case TILED_SPRITE_SIZE_TYPE_SCALE: {
|
||||
size = glm::vec2(
|
||||
quadSize = glm::vec2(
|
||||
this->tileset->getTileWidth(this->tile),
|
||||
this->tileset->getTileHeight(this->tile)
|
||||
) * (float_t)this->size;
|
||||
@ -68,15 +68,15 @@ void TiledSprite::onStart() {
|
||||
|
||||
case TILED_SPRITE_SIZE_TYPE_WIDTH_RATIO: {
|
||||
float_t rw = this->tileset->getTileHeight(this->tile) / this->tileset->getTileWidth(this->tile);
|
||||
size.x = (float_t)this->size;
|
||||
size.y = size.x * rw;
|
||||
quadSize.x = (float_t)this->size;
|
||||
quadSize.y = quadSize.x * rw;
|
||||
break;
|
||||
}
|
||||
|
||||
case TILED_SPRITE_SIZE_TYPE_HEIGHT_RATIO: {
|
||||
float_t rh = this->tileset->getTileWidth(this->tile) / this->tileset->getTileHeight(this->tile);
|
||||
size.y = (float_t)this->size;
|
||||
size.x = size.y * rh;
|
||||
quadSize.y = (float_t)this->size;
|
||||
quadSize.x = quadSize.y * rh;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -84,8 +84,8 @@ void TiledSprite::onStart() {
|
||||
assertUnreachable();
|
||||
}
|
||||
|
||||
this->meshHost->xy0 = -size;
|
||||
this->meshHost->xy1 = size;
|
||||
this->meshHost->xy0 = -quadSize;
|
||||
this->meshHost->xy1 = quadSize;
|
||||
}, {
|
||||
&this->tile,
|
||||
&this->meshHost,
|
||||
|
Reference in New Issue
Block a user