Changeset 2439


Ignore:
Timestamp:
Feb 19, 2013, 12:07:53 AM (7 years ago)
Author:
touky
Message:

EasyMesh : vdecl/vbo flag test fixup.
Tileset : added GetTileSize().

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/easymesh/easymesh.cpp

    r2438 r2439  
    242242    new_vbo->Unlock();
    243243
    244     if (vdecl_flags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
    245                         (1 << VertexUsage::Color)    | (1 << VertexUsage::TexCoordExt)))
     244    uint16_t baseflag = (1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | (1 << VertexUsage::Color);
     245    if (vdecl_flags == (baseflag | (1 << VertexUsage::TexCoordExt)) ||
     246        vdecl_flags == (baseflag | (1 << VertexUsage::TexCoord) |
     247                                   (1 << VertexUsage::TexCoordExt)))
    246248    {
    247249        new_vdecl = new VertexDeclaration(
     
    265267        COPY_VBO;
    266268    }
    267     else if (vdecl_flags ==  ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
    268                               (1 << VertexUsage::Color)    | (1 << VertexUsage::TexCoord)))
     269    else if (vdecl_flags ==  (baseflag | (1 << VertexUsage::TexCoord)))
    269270    {
    270271        new_vdecl = new VertexDeclaration(
     
    288289        COPY_VBO;
    289290    }
    290     else if (vdecl_flags ==  ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
    291                               (1 << VertexUsage::Color)))
     291    else if (vdecl_flags == baseflag)
    292292    {
    293293        new_vdecl = new VertexDeclaration(
     
    336336    vdecl->Bind();
    337337
    338     if (vflags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
    339                    (1 << VertexUsage::Color)    | (1 << VertexUsage::TexCoord)))
     338    uint16_t baseflag = (1 << VertexUsage::Position) | (1 << VertexUsage::Normal) | (1 << VertexUsage::Color);
     339    if (vflags == (baseflag | (1 << VertexUsage::TexCoord)) ||
     340        vflags == (baseflag | (1 << VertexUsage::TexCoordExt)) ||
     341        vflags == (baseflag | (1 << VertexUsage::TexCoord) |
     342                              (1 << VertexUsage::TexCoordExt)))
     343                   
    340344    {
    341345        vdecl->SetStream(vbo, *gpu_sd.GetAttribute(lol::String("in_Vertex")),
     
    344348                              *gpu_sd.GetAttribute(lol::String("in_TexCoord")));
    345349    }
    346     else if (vflags == ((1 << VertexUsage::Position) | (1 << VertexUsage::Normal) |
    347                         (1 << VertexUsage::Color)))
     350    else if (vflags == baseflag)
    348351    {
    349352        vdecl->SetStream(vbo, *gpu_sd.GetAttribute(lol::String("in_Vertex")),
  • trunk/src/tileset.cpp

    r2416 r2439  
    175175}
    176176
     177vec2 TileSet::GetTileSize() const
     178{
     179    return vec2(data->tx, data->ty);
     180}
     181
    177182ShaderTexture TileSet::GetTexture() const
    178183{
  • trunk/src/tileset.h

    r2414 r2439  
    4444    ivec2 GetCount() const;
    4545    ivec2 GetSize(int tileid) const;
     46    vec2 GetTileSize() const;
    4647    ShaderTexture GetTexture() const;
    4748    void Bind();
Note: See TracChangeset for help on using the changeset viewer.