diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index 8c3ffdde..d1afd05d 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -241,8 +241,10 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh) memcpy(mesh, vbo_data, vbo_bytes); \ new_vbo->Unlock(); - if (vdecl_flags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | - (1 << VertexUsage::Color) | (1 << VertexUsage::TexCoordExt))) + uint16_t baseflag = (1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | (1 << VertexUsage::Color); + if (vdecl_flags == (baseflag | (1 << VertexUsage::TexCoordExt)) || + vdecl_flags == (baseflag | (1 << VertexUsage::TexCoord) | + (1 << VertexUsage::TexCoordExt))) { new_vdecl = new VertexDeclaration( VertexStream( @@ -264,8 +266,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh) COPY_VBO; } - else if (vdecl_flags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | - (1 << VertexUsage::Color) | (1 << VertexUsage::TexCoord))) + else if (vdecl_flags == (baseflag | (1 << VertexUsage::TexCoord))) { new_vdecl = new VertexDeclaration( VertexStream( @@ -287,8 +288,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh) COPY_VBO; } - else if (vdecl_flags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | - (1 << VertexUsage::Color))) + else if (vdecl_flags == baseflag) { new_vdecl = new VertexDeclaration( VertexStream( @@ -335,16 +335,19 @@ void GpuEasyMeshData::RenderMeshData(mat4 const &model) vdecl->Bind(); - if (vflags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | - (1 << VertexUsage::Color) | (1 << VertexUsage::TexCoord))) + uint16_t baseflag = (1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | (1 << VertexUsage::Color); + if (vflags == (baseflag | (1 << VertexUsage::TexCoord)) || + vflags == (baseflag | (1 << VertexUsage::TexCoordExt)) || + vflags == (baseflag | (1 << VertexUsage::TexCoord) | + (1 << VertexUsage::TexCoordExt))) + { vdecl->SetStream(vbo, *gpu_sd.GetAttribute(lol::String("in_Vertex")), *gpu_sd.GetAttribute(lol::String("in_Normal")), *gpu_sd.GetAttribute(lol::String("in_Color")), *gpu_sd.GetAttribute(lol::String("in_TexCoord"))); } - else if (vflags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | - (1 << VertexUsage::Color))) + else if (vflags == baseflag) { vdecl->SetStream(vbo, *gpu_sd.GetAttribute(lol::String("in_Vertex")), *gpu_sd.GetAttribute(lol::String("in_Normal")), diff --git a/src/tileset.cpp b/src/tileset.cpp index c48b3c3d..0132e622 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -174,6 +174,11 @@ ivec2 TileSet::GetSize(int tileid) const return data->size; } +vec2 TileSet::GetTileSize() const +{ + return vec2(data->tx, data->ty); +} + ShaderTexture TileSet::GetTexture() const { return data->m_texture->GetTexture(); diff --git a/src/tileset.h b/src/tileset.h index fc6a630b..0b8984fc 100644 --- a/src/tileset.h +++ b/src/tileset.h @@ -43,6 +43,7 @@ public: /* New methods */ ivec2 GetCount() const; ivec2 GetSize(int tileid) const; + vec2 GetTileSize() const; ShaderTexture GetTexture() const; void Bind(); void Unbind();