Changeset 142 for trunk


Ignore:
Timestamp:
07/03/13 23:38:00 (12 years ago)
Author:
epyon
Message:
  • texture_atlas - optionally takes a border parameter (default 1)
  • texture_atlas - TODO: fix behavior for exact fits (10242 atlas only holds 9 2562 images...)
  • mesh - get_attribute fixed
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/gfx/texture_atlas.hh

    r121 r142  
    44// This file is part of NV Libraries.
    55// For conditions of distribution and use, see copyright notice in nv.hh
     6//
     7// TODO: fix behavior for exact fits (1024^2 atlas with border 0 only holds 9 256^2 images...)
    68
    79#ifndef NV_TEXTURE_ATLAS_HH
     
    1921        {
    2022        public:
    21                 texture_atlas( ivec2 size, size_t depth );
     23                texture_atlas( ivec2 size, size_t depth, size_t border = 1 );
    2224                region get_region( ivec2 size );
    2325                void clear();
  • trunk/nv/interface/mesh.hh

    r141 r142  
    9494                {
    9595                        map::iterator i = m_map.find( attr );
    96                         if ( i != m_map.end() && i->second->get_type() != type_to_enum<T>::type )
     96                        if ( i != m_map.end() && i->second->get_type() == type_to_enum<T>::type )
    9797                        {
    9898                                return ((vertex_attribute<T>*)(i->second));
  • trunk/src/gfx/texture_atlas.cc

    r121 r142  
    1212using namespace nv;
    1313
    14 texture_atlas::texture_atlas( glm::ivec2 size, size_t depth )
     14texture_atlas::texture_atlas( glm::ivec2 size, size_t depth, size_t border /*= 1*/ )
    1515        : image( size, depth ), m_used( 0 )
    1616{
    17         m_nodes.push_back( glm::ivec3( 1, 1, m_size.x - 2 ) );
     17        m_nodes.push_back( glm::ivec3( border, border, m_size.x - 2 * border ) );
    1818        fill( 0 );
    1919}
     
    7979        }
    8080        merge();
    81         m_used += static_cast<uint16>(size.x * size.y);
     81        m_used += static_cast<uint32>(size.x * size.y);
    8282        return r;
    8383}
Note: See TracChangeset for help on using the changeset viewer.