From c29058ac871e8392d397695f2a9dfb74cfa9fbb1 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Mon, 5 May 2014 16:26:24 +0000 Subject: [PATCH] gpu: give access to the Texture behind a TileSet. --- src/tileset.cpp | 7 ++++++- src/tileset.h | 3 ++- test/btphystest.cpp | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/tileset.cpp b/src/tileset.cpp index 3e37b4f5..523872d5 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -180,11 +180,16 @@ ivec2 TileSet::GetTextureSize() const return m_data->m_texture_size; } -ShaderTexture TileSet::GetTexture() const +ShaderTexture TileSet::GetShaderTexture() const { return m_data->m_texture->GetTexture(); } +Texture const * TileSet::GetTexture() const +{ + return m_data->m_texture; +} + void TileSet::Bind() { if (!m_data->m_image && m_data->m_texture) diff --git a/src/tileset.h b/src/tileset.h index 21ac224e..b98558ea 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -49,7 +49,8 @@ public: ivec2 GetTileSize(int tileid) const; ivec2 GetTextureSize() const; - ShaderTexture GetTexture() const; + ShaderTexture GetShaderTexture() const; + Texture const * GetTexture() const; void Bind(); void Unbind(); void BlitTile(uint32_t id, vec3 pos, int o, vec2 scale, float angle, diff --git a/test/btphystest.cpp b/test/btphystest.cpp index 3884d484..9d973c8d 100644 --- a/test/btphystest.cpp +++ b/test/btphystest.cpp @@ -585,7 +585,7 @@ void BtPhysTest::TickDraw(float seconds) (1 << VertexUsage::TexCoord) | (1 << VertexUsage::TexCoordExt)), m_cat_shader); - m_cat_sdata->m_shader_texture = m_cat_texture->GetTexture(); + m_cat_sdata->m_shader_texture = m_cat_texture->GetShaderTexture(); m_cat_sdata->m_sprite_flip = ((rand(2) == 1)?(1.f):(0.f)) / (float)(NB_SPRITE * PARTICLE_SIZE); PhysObj->SetCustomShaderData(m_cat_sdata); m_cat_sdata = NULL;