Changeset 504 for trunk/src


Ignore:
Timestamp:
07/04/16 20:05:33 (9 years ago)
Author:
epyon
Message:
  • temporary add_base_path for image manager
  • random - warning fix
  • debug_draw - shader upgrade
Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/random.cc

    r503 r504  
    271271nv::random_base::seed_type nv::random_xor128::set_seed( seed_type seed /*= 0 */ )
    272272{
    273         uint32 s = 4294967296 - seed;
     273        uint32 s = uint32( 4294967296 - seed );
    274274        m_state[0] = 123456789 * s;
    275275        m_state[1] = 362436069 * s;
  • trunk/src/engine/image_manager.cc

    r484 r504  
    1212using namespace nv;
    1313
     14void nv::image_manager::add_base_path( const string_view& path )
     15{
     16        m_paths.emplace_back( path );
     17}
     18
    1419bool image_manager::load_resource( const string_view& filename )
    1520{
    1621        png_loader loader;
    1722        c_file_system fs;
    18         stream* file = fs.open( filename );
    19         image_data* result = loader.load( *file );
    20         delete file;
    21         add( filename, result );
     23        image_data* result = nullptr;
     24        if ( fs.exists( filename ) )
     25        {
     26                stream* file = fs.open( filename );
     27                result = loader.load( *file );
     28                delete file;
     29        }
     30        else if ( m_paths.size() > 0 )
     31        {
     32                for ( const auto& path : m_paths )
     33                {
     34                        string128 fpath = path;
     35                        fpath.append( filename );
     36                        if ( fs.exists( fpath ) )
     37                        {
     38                                stream* file = fs.open( fpath );
     39                                result = loader.load( *file );
     40                                delete file;
     41                                break;
     42                        }
     43                }
     44        }
     45        if ( result )
     46                add( filename, result );
    2247        return result != nullptr;
    2348}
  • trunk/src/gfx/debug_draw.cc

    r501 r504  
    1111
    1212static const char *nv_debug_draw_vertex_shader = R"(
    13 #version 120
    14 attribute vec3 nv_position;
    15 attribute vec3 nv_color;
    16 varying vec3 v_color;
     13#version 330
     14in vec3 nv_position;
     15in vec3 nv_color;
     16out vec3 v_color;
    1717uniform mat4 nv_m_mvp;
    1818void main(void)
     
    2323)";
    2424static const char *nv_debug_draw_fragment_shader = R"(
    25 #version 120
    26 varying vec3 v_color;
     25#version 330
     26in vec3 v_color;
    2727out vec4 o_frag_color;
    2828void main(void)
Note: See TracChangeset for help on using the changeset viewer.