Browse Source

gpu: give access to the Texture behind a TileSet.

undefined
Sam Hocevar 11 years ago
parent
commit
c29058ac87
3 changed files with 9 additions and 3 deletions
  1. +6
    -1
      src/tileset.cpp
  2. +2
    -1
      src/tileset.h
  3. +1
    -1
      test/btphystest.cpp

+ 6
- 1
src/tileset.cpp View File

@@ -180,11 +180,16 @@ ivec2 TileSet::GetTextureSize() const
return m_data->m_texture_size; return m_data->m_texture_size;
} }


ShaderTexture TileSet::GetTexture() const
ShaderTexture TileSet::GetShaderTexture() const
{ {
return m_data->m_texture->GetTexture(); return m_data->m_texture->GetTexture();
} }


Texture const * TileSet::GetTexture() const
{
return m_data->m_texture;
}

void TileSet::Bind() void TileSet::Bind()
{ {
if (!m_data->m_image && m_data->m_texture) if (!m_data->m_image && m_data->m_texture)


+ 2
- 1
src/tileset.h View File

@@ -49,7 +49,8 @@ public:
ivec2 GetTileSize(int tileid) const; ivec2 GetTileSize(int tileid) const;


ivec2 GetTextureSize() const; ivec2 GetTextureSize() const;
ShaderTexture GetTexture() const;
ShaderTexture GetShaderTexture() const;
Texture const * GetTexture() const;
void Bind(); void Bind();
void Unbind(); void Unbind();
void BlitTile(uint32_t id, vec3 pos, int o, vec2 scale, float angle, void BlitTile(uint32_t id, vec3 pos, int o, vec2 scale, float angle,


+ 1
- 1
test/btphystest.cpp View File

@@ -585,7 +585,7 @@ void BtPhysTest::TickDraw(float seconds)
(1 << VertexUsage::TexCoord) | (1 << VertexUsage::TexCoord) |
(1 << VertexUsage::TexCoordExt)), (1 << VertexUsage::TexCoordExt)),
m_cat_shader); 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); m_cat_sdata->m_sprite_flip = ((rand(2) == 1)?(1.f):(0.f)) / (float)(NB_SPRITE * PARTICLE_SIZE);
PhysObj->SetCustomShaderData(m_cat_sdata); PhysObj->SetCustomShaderData(m_cat_sdata);
m_cat_sdata = NULL; m_cat_sdata = NULL;


Loading…
Cancel
Save