Changeset 534 for trunk


Ignore:
Timestamp:
01/12/17 14:41:17 (8 years ago)
Author:
epyon
Message:

CONTINUED:

  • getting rid of size_t
  • datatypes now restricted to uint32 size
  • 64-bit compatibility
  • copyright updates where modified
Location:
trunk
Files:
58 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/core/logger.hh

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/core/random.hh

    r511 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    470470        };
    471471
    472 
    473472        class random : public random_mersenne
    474473        {
  • trunk/nv/formats/assimp_loader.hh

    r486 r534  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    2424                explicit assimp_loader( string_table* strings, const string_view& a_ext, uint32 a_assimp_flags = 0 );
    2525                virtual bool load( stream& source );
    26                 virtual data_channel_set* release_mesh_data( size_t index, data_node_info& info );
    27                 virtual size_t get_mesh_count() const { return m_mesh_count; }
     26                virtual data_channel_set* release_mesh_data( uint32 index, data_node_info& info );
     27                virtual uint32 get_mesh_count() const { return m_mesh_count; }
    2828                virtual ~assimp_loader();
    29                 virtual size_t get_nodes_data_count() const;
    30                 virtual mesh_nodes_data* release_mesh_nodes_data( size_t index = 0 );
    31                 virtual data_node_list* release_data_node_list( size_t = 0 );
    32                 virtual bool is_animated( size_t = 0 );
     29                virtual uint32 get_nodes_data_count() const;
     30                virtual mesh_nodes_data* release_mesh_nodes_data( uint32 index = 0 );
     31                virtual data_node_list* release_data_node_list( uint32 = 0 );
     32                virtual bool is_animated( uint32 = 0 );
    3333                void scene_report() const;
    3434        private:
     
    3636                void build_skeleton( vector< data_node_info >& skeleton, const void* node, sint16 parent_id );
    3737                data_node_list* release_merged_bones();
    38                 void load_mesh_data( data_channel_set* data, size_t index, data_node_info& info );
     38                void load_mesh_data( data_channel_set* data, uint32 index, data_node_info& info );
    3939                sint16 load_node( uint32 anim_id, array_ref< data_channel_set* > nodes, array_ref< data_node_info > infos, const void* vnode, sint16 this_id, sint16 parent_id );
    4040                void scan_nodes( const void* node ) const;
     
    5151                const_string m_ext;
    5252                uint32 m_assimp_flags;
    53                 size_t m_mesh_count;
     53                uint32 m_mesh_count;
    5454        };
    5555
  • trunk/nv/formats/nmd_loader.hh

    r485 r534  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    8484                explicit nmd_loader( string_table* strings ) : mesh_loader( strings ), /*m_node_data( nullptr ), */m_bone_data( nullptr ), m_pose_data_set( nullptr ) {}
    8585                virtual bool load( stream& source );
    86                 virtual data_channel_set* release_mesh_data( size_t index, data_node_info& info );
    87                 virtual size_t get_nodes_data_count() const { return 1; }
    88                 virtual mesh_nodes_data* release_mesh_nodes_data( size_t = 0 );
    89                 virtual data_node_list* release_data_node_list( size_t = 0 );
    90                 virtual bool is_animated( size_t = 0 );
    91                 virtual size_t get_mesh_count() const { return m_meshes.size(); }
     86                virtual data_channel_set* release_mesh_data( uint32 index, data_node_info& info );
     87                virtual uint32 get_nodes_data_count() const { return 1; }
     88                virtual mesh_nodes_data* release_mesh_nodes_data( uint32 = 0 );
     89                virtual data_node_list* release_data_node_list( uint32 = 0 );
     90                virtual bool is_animated( uint32 = 0 );
     91                virtual uint32 get_mesh_count() const { return m_meshes.size(); }
    9292                virtual ~nmd_loader();
    9393
  • trunk/nv/formats/obj_loader.hh

    r482 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    2727                obj_loader( string_table* strings, bool normals = true, bool tangents = false );
    2828                virtual bool load( stream& source );
    29                 virtual data_channel_set* release_mesh_data( size_t index, data_node_info& info );
    30                 virtual size_t get_mesh_count() const { return m_meshes.size(); }
     29                virtual data_channel_set* release_mesh_data( uint32 index, data_node_info& info );
     30                virtual uint32 get_mesh_count() const { return m_meshes.size(); }
    3131                ~obj_loader();
    3232        private:
  • trunk/nv/gfx/image.hh

    r395 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    4242                 * @arg[in] depth :  Depth of the image.
    4343                 */
    44                 image( ivec2 size, size_t depth );
     44                image( ivec2 size, uint32 depth );
    4545                /**
    4646                 * Constructor
     
    6161                 *      reversed or not.
    6262                 */
    63                 image( ivec2 size, size_t depth, const uint8 * data, bool reversed = false );
     63                image( ivec2 size, uint32 depth, const uint8 * data, bool reversed = false );
    6464                /**
    6565                 * Fills the image with a given value.
     
    114114                 * @return Returns depth of the image.
    115115                 */
    116                 size_t get_depth() const { return m_depth; }
     116                uint32 get_depth() const { return m_depth; }
    117117        protected:
    118118                ivec2  m_size;  //!< Defines the size of the image as a vector.
    119                 size_t m_depth; //!< Defines the depth of the image
     119                uint32 m_depth; //!< Defines the depth of the image
    120120                uint8* m_data;  //!< Holder for data
    121121        };
  • trunk/nv/gfx/skeleton_instance.hh

    r520 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    106106                skeleton_transforms() {}
    107107                const transform* xforms() const { return m_transforms.data(); }
    108                 size_t size() const { return m_transforms.size(); }
     108                uint32 size() const { return m_transforms.size(); }
    109109                void assign( const data_node_list* node_data );
    110110                void assign( const skeleton_transforms& other );
     
    149149                skeleton_instance() {}
    150150                const mat4* xforms() const { return m_matrix.data(); }
    151                 size_t size() const { return m_matrix.size(); }
     151                uint32 size() const { return m_matrix.size(); }
    152152                void assign( const skeleton_transforms& skeleton, const skeleton_binding& binding, const bone_transforms< value_type >& bones )
    153153                {
  • trunk/nv/gfx/sliced_buffer.hh

    r501 r534  
    2626                typedef sliced_buffer<T> cache_type;
    2727                typedef vector<T>        vector_type;
    28                 typedef size_t           size_type;
     28                typedef uint32           uint32ype;
    2929
    3030                buffer_slice( cache_type* c )
     
    6060                }
    6161
    62                 size_t get_offset() const
     62                uint32 get_offset() const
    6363                {
    6464                        return m_offset;
     
    8181                vector_type m_data;
    8282                cache_type* m_cache;
    83                 size_type   m_offset;
    84                 size_type   m_cached_size;
     83                uint32ype   m_offset;
     84                uint32ype   m_cached_size;
    8585                bool        m_locked;
    8686        };
     
    9292                typedef vector<T>  vector_type;
    9393                typedef T          value_type;
    94                 static const size_t value_type_size = sizeof(T);
    95 
    96                 sliced_buffer( context* ctx, buffer_type type, buffer_hint hint, size_t initial_size )
     94                static const uint32 value_type_size = sizeof(T);
     95
     96                sliced_buffer( context* ctx, buffer_type type, buffer_hint hint, uint32 initial_size )
    9797                        : m_context( ctx )
    9898                        , m_buffer()
     
    108108                }
    109109
    110                 bool commit( const vector_type& bv, bool updated, bool resized, size_t& offset )
     110                bool commit( const vector_type& bv, bool updated, bool resized, uint32& offset )
    111111                {
    112112                        if ( !m_full_update && resized )
    113113                        {
    114114                                m_data.erase( m_data.begin() + static_cast<int>( offset ), m_data.end() );
    115                                 m_min = nv::min<size_t>( m_min, offset );
     115                                m_min = nv::min<uint32>( m_min, offset );
    116116                                m_full_update = true;
    117117                        }
     
    125125//                              raw_copy( bv.cbegin(), bv.cend(), m_data.begin() + (int)offset );
    126126                                raw_copy( bv.data(), bv.data() + bv.size(), m_data.data() + static_cast<int>( offset ) );
    127                                 m_min = nv::min<size_t>( m_min, offset );
    128                                 m_max = nv::max<size_t>( m_max, offset + bv.size() );
     127                                m_min = nv::min<uint32>( m_min, offset );
     128                                m_max = nv::max<uint32>( m_max, offset + bv.size() );
    129129                        }
    130130                        return m_full_update;
     
    132132
    133133                template < typename V >
    134                 void add_offset( size_t size, size_t offset, V value )
     134                void add_offset( uint32 size, uint32 offset, V value )
    135135                {
    136136                        if ( size == 0 ) return;
     
    157157                {
    158158                        bool result = false;
    159                         size_t bsize = get_max_size();
     159                        uint32 bsize = get_max_size();
    160160
    161161                        if ( m_data.size() > bsize )
     
    170170                        if ( m_max > 0 )
    171171                        {
    172                                 size_t offset = m_min * value_type_size;
    173                                 size_t size   = (m_max-m_min) * value_type_size;
     172                                uint32 offset = m_min * value_type_size;
     173                                uint32 size   = (m_max-m_min) * value_type_size;
    174174                                m_context->update( m_buffer, m_data.data() + m_min, offset, size );
    175175                        }
     
    180180                }
    181181
    182                 size_t get_max_size() const
     182                uint32 get_max_size() const
    183183                {
    184184                        return m_capacity;
    185185                }
    186186
    187                 size_t get_size() const
     187                uint32 get_size() const
    188188                {
    189189                        return m_data.size();
     
    200200                }
    201201        private:
    202                 void create_buffer( size_t size )
     202                void create_buffer( uint32 size )
    203203                {
    204204                        m_capacity = size;
     
    217217                uint32      m_capacity;
    218218
    219                 size_t      m_min;
    220                 size_t      m_max;
     219                uint32      m_min;
     220                uint32      m_max;
    221221        };
    222222
  • trunk/nv/gfx/texture_atlas.hh

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/gl/gl_context.hh

    r530 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    4949                virtual texture create_texture( texture_type type, ivec3 size, image_format aformat, sampler asampler, const void* data = nullptr );
    5050
    51                 virtual buffer create_buffer( buffer_type type, buffer_hint hint, size_t size, const void* source = nullptr );
    52                 virtual void create_buffer( buffer, size_t, const void* = nullptr );
     51                virtual buffer create_buffer( buffer_type type, buffer_hint hint, uint32 size, const void* source = nullptr );
     52                virtual void create_buffer( buffer, uint32, const void* = nullptr );
    5353
    5454                virtual void set_draw_buffers( uint32 count, const output_slot* slots );
     
    6666                virtual void bind( framebuffer f, framebuffer_slot ft = FRAMEBUFFER );
    6767                virtual void bind( texture t, texture_slot slot );
    68                 virtual void bind( buffer b, uint32 index, size_t offset = 0, size_t size = 0 );
     68                virtual void bind( buffer b, uint32 index, uint32 offset = 0, uint32 size = 0 );
    6969                virtual void bind( buffer b, texture t );
    7070
    7171
    7272                virtual void update( texture t, const void* data );
    73                 virtual void update( buffer b, const void* data, size_t offset, size_t size );
    74                 virtual void* map_buffer( buffer, buffer_access, size_t /*offset*/, size_t /*length*/ );
     73                virtual void update( buffer b, const void* data, uint32 offset, uint32 size );
     74                virtual void* map_buffer( buffer, buffer_access, uint32 /*offset*/, uint32 /*length*/ );
    7575                virtual void unmap_buffer( buffer );
    7676
    77                 //              virtual void update( buffer b, uint32 index, const void* data, size_t offset, size_t size );
     77                //              virtual void update( buffer b, uint32 index, const void* data, uint32 offset, uint32 size );
    7878
    7979                virtual void clear( const clear_state& cs );
    8080                // temporary
    81                 virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, size_t count, size_t first = 0 );
    82                 virtual void draw_instanced( primitive prim, const render_state& rs, program p, size_t instances, vertex_array va, size_t count, size_t first = 0 );
     81                virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, uint32 count, uint32 first = 0 );
     82                virtual void draw_instanced( primitive prim, const render_state& rs, program p, uint32 instances, vertex_array va, uint32 count, uint32 first = 0 );
    8383
    8484                virtual const ivec4& get_viewport();
  • trunk/nv/gui/gui_gfx_renderer.hh

    r491 r534  
    5555                        virtual ~gfx_renderer();
    5656                private:
    57                         texture_font* get_font( size_t name ) const;
    58                         const image_info* get_image( size_t name ) const;
     57                        texture_font* get_font( uint32 name ) const;
     58                        const image_info* get_image( uint32 name ) const;
    5959
    60                         size_t load_font( const string_view& filename, size_t size );
    61                         size_t load_image( const string_view& filename );
     60                        uint32 load_font( const string_view& filename, uint32 size );
     61                        uint32 load_image( const string_view& filename );
    6262
    63                         typedef hash_store< shash64, size_t > names;
     63                        typedef hash_store< shash64, uint32 > names;
    6464                        typedef vector< texture_font* >              font_vector;
    6565                        typedef vector< image_info >                 image_vector;
  • trunk/nv/image/miniz.hh

    r520 r534  
    1 // Copyright (C) 2015-2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/interface/context.hh

    r525 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    107107
    108108                // TODO: should be private
    109                 void add_vertex_buffer( slot location, buffer buf, datatype datatype, size_t components, size_t offset = 0, size_t stride = 0, bool owner = true )
     109                void add_vertex_buffer( slot location, buffer buf, datatype datatype, uint32 components, uint32 offset = 0, uint32 stride = 0, bool owner = true )
    110110                {
    111111                        NV_ASSERT( count < uint16( MAX_ATTRIBUTES ), "MAX_ATTRIBUTES reached!" );
     
    184184                        return create_program( vs, fs );
    185185                }
    186                 virtual buffer create_buffer( buffer_type type, buffer_hint hint, size_t size, const void* source = nullptr ) = 0;
    187                 virtual void   create_buffer( buffer, size_t, const void* = nullptr ) = 0;
     186                virtual buffer create_buffer( buffer_type type, buffer_hint hint, uint32 size, const void* source = nullptr ) = 0;
     187                virtual void   create_buffer( buffer, uint32, const void* = nullptr ) = 0;
    188188
    189189
     
    204204                virtual void bind( framebuffer f, framebuffer_slot slot = FRAMEBUFFER ) = 0;
    205205                virtual void bind( texture, texture_slot ) = 0;
    206                 virtual void bind( buffer, uint32 /*index*/, size_t /*offset*/ = 0, size_t /*size */= 0 ) = 0;
     206                virtual void bind( buffer, uint32 /*index*/, uint32 /*offset*/ = 0, uint32 /*size */= 0 ) = 0;
    207207                virtual void bind( buffer, texture ) = 0;
    208208
    209209                virtual void update( texture, const void* ) = 0;
    210                 virtual void update( buffer, const void*, size_t /*offset*/, size_t /*size*/ ) = 0;
    211                 virtual void* map_buffer( buffer, buffer_access, size_t /*offset*/, size_t /*length*/ ) = 0;
     210                virtual void update( buffer, const void*, uint32 /*offset*/, uint32 /*size*/ ) = 0;
     211                virtual void* map_buffer( buffer, buffer_access, uint32 /*offset*/, uint32 /*length*/ ) = 0;
    212212                virtual void unmap_buffer( buffer ) = 0;
    213213
    214214
    215 //              virtual void update( buffer, uint32 /*index*/, const void* , size_t /*offset*/, size_t /*size*/ ) = 0;
     215//              virtual void update( buffer, uint32 /*index*/, const void* , uint32 /*offset*/, uint32 /*size*/ ) = 0;
    216216
    217217                virtual void clear( const clear_state& cs ) = 0;
    218218                // temporary
    219                 virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, size_t count, size_t first = 0 ) = 0;
    220                 virtual void draw_instanced( primitive prim, const render_state& rs, program p, size_t instances, vertex_array va, size_t count, size_t first = 0 ) = 0;
    221 
    222                 void draw( primitive prim, const render_state& rs, const scene_state& s, program p, vertex_array va, size_t count, size_t first = 0 )
     219                virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, uint32 count, uint32 first = 0 ) = 0;
     220                virtual void draw_instanced( primitive prim, const render_state& rs, program p, uint32 instances, vertex_array va, uint32 count, uint32 first = 0 ) = 0;
     221
     222                void draw( primitive prim, const render_state& rs, const scene_state& s, program p, vertex_array va, uint32 count, uint32 first = 0 )
    223223                {
    224224                        apply_engine_uniforms(p,s);
     
    250250
    251251                template < typename VTX >
    252                 vertex_array create_vertex_array( const VTX* v, size_t count, buffer_hint hint )
     252                vertex_array create_vertex_array( const VTX* v, uint32 count, buffer_hint hint )
    253253                {
    254254                        buffer       vb = create_buffer( VERTEX_BUFFER, hint, count * sizeof( VTX ), v );
     
    259259
    260260                template < typename VTX, typename IDX >
    261                 vertex_array create_vertex_array( const VTX* v, size_t vcount, const IDX* i, size_t icount, buffer_hint hint )
     261                vertex_array create_vertex_array( const VTX* v, uint32 vcount, const IDX* i, uint32 icount, buffer_hint hint )
    262262                {
    263263                        buffer       vb = this->create_buffer( VERTEX_BUFFER, hint, count * sizeof( VTX ), v );
  • trunk/nv/interface/data_channel.hh

    r532 r534  
    120120                }
    121121
    122                 size_t size() const { return m_size; }
    123 
    124                 const raw_data_channel* get_channel( size_t index ) const
     122                uint32 size() const { return m_size; }
     123
     124                const raw_data_channel* get_channel( uint32 index ) const
    125125                {
    126126                        if ( m_size > index ) return &m_channels[index];
  • trunk/nv/interface/image_data.hh

    r500 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    7575                void fill( uint8 value = 0 )
    7676                {
    77                         size_t bsize = static_cast<size_t>( m_size.x * m_size.y ) * get_depth();
     77                        uint32 bsize = static_cast<uint32>( m_size.x * m_size.y ) * get_depth();
    7878                        raw_fill_n( m_data, bsize, value );
    7979                }
     
    8282                const ivec2 get_size() const { return m_size; }
    8383                // TODO : better depth check (template?)
    84                 size_t get_depth() const { return m_format.format == RGB || m_format.format == BGR ? 3 : ( m_format.format == RED || m_format.format == R32F || m_format.format == R16F ? 1 : 4 ); }
     84                uint32 get_depth() const { return m_format.format == RGB || m_format.format == BGR ? 3 : ( m_format.format == RED || m_format.format == R32F || m_format.format == R16F ? 1 : 4 ); }
    8585                image_format get_format() const { return m_format; }
    8686                ~image_data() { if (m_data) delete[] m_data; }
     
    8888                void initialize( const uint8* data )
    8989                {
    90                         size_t bsize = static_cast<size_t>(m_size.x * m_size.y) * get_depth();
     90                        uint32 bsize = static_cast<uint32>(m_size.x * m_size.y) * get_depth();
    9191                        m_data = new uint8[ bsize ];
    9292                        if ( data )
  • trunk/nv/interface/mesh_loader.hh

    r482 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    3131                virtual ~mesh_loader() {}
    3232                virtual bool load( stream& source ) = 0;
    33                 virtual data_channel_set* release_mesh_data( size_t index, data_node_info& ) = 0;
    34                 virtual size_t get_mesh_count() const = 0;
    35                 virtual size_t get_nodes_data_count() const { return 0; }
    36                 virtual mesh_nodes_data* release_mesh_nodes_data( size_t = 0 ) { return nullptr; }
    37                 virtual data_node_list* release_data_node_list( size_t = 0 ) { return nullptr; }
    38                 virtual bool is_animated( size_t = 0 ) { return false; }
     33                virtual data_channel_set* release_mesh_data( uint32 index, data_node_info& ) = 0;
     34                virtual uint32 get_mesh_count() const = 0;
     35                virtual uint32 get_nodes_data_count() const { return 0; }
     36                virtual mesh_nodes_data* release_mesh_nodes_data( uint32 = 0 ) { return nullptr; }
     37                virtual data_node_list* release_data_node_list( uint32 = 0 ) { return nullptr; }
     38                virtual bool is_animated( uint32 = 0 ) { return false; }
    3939        protected:
    4040                inline shash64 make_name( const string_view& name )
  • trunk/nv/lib/assimp.hh

    r487 r534  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/lib/freetype2.hh

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/lua/lua_state.hh

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/lua/lua_values.hh

    r491 r534  
    131131                };
    132132
     133#if NV_ARCHITECTURE == NV_64BIT
     134                template <>
     135                struct pass_traits<sint32>
     136                {
     137                        static void push( lua_State *L, sint32 s ) { detail::push_integer( L, s ); }
     138                        static sint32 to( lua_State *L, int index ) { return static_cast< sint32 >( detail::to_integer( L, index ) ); }
     139                        static sint32 to( lua_State *L, int index, linteger def ) { return static_cast< sint32 >( detail::to_integer( L, index, def ) ); }
     140                };
     141
     142                template <>
     143                struct pass_traits<uint32>
     144                {
     145                        static void push( lua_State *L, uint32 s ) { detail::push_unsigned( L, s ); }
     146                        static uint32 to( lua_State *L, int index ) { return static_cast< uint32 >( detail::to_unsigned( L, index ) ); }
     147                        static uint32 to( lua_State *L, int index, lunsigned def ) { return static_cast< uint32 >( detail::to_unsigned( L, index, def ) ); }
     148                };
     149#endif
     150
    133151                template <>
    134152                struct pass_traits<lnumber>
     
    213231                        };
    214232
    215                         template <typename T>
    216                         struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_signed< T >::value > >
    217                         {
    218                                 typedef linteger type;
    219                         };
    220 
    221                         template <typename T>
    222                         struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_unsigned< T >::value > >
    223                         {
    224                                 typedef lunsigned type;
    225                         };
     233#if NV_ARCHITECTURE == NV_64BIT
     234                        template <typename T>
     235                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_signed< T >::value && sizeof( T ) < 8 > > { typedef sint32 type; };
     236
     237                        template <typename T>
     238                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_unsigned< T >::value && sizeof( T ) < 8 > > { typedef uint32 type; };
     239
     240                        template <typename T>
     241                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_signed< T >::value && sizeof( T ) >= 8 > > { typedef linteger type; };
     242
     243                        template <typename T>
     244                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_unsigned< T >::value && sizeof( T ) >= 8 > > { typedef lunsigned type; };
     245#else
     246                        template <typename T>
     247                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_signed< T >::value > > { typedef linteger type; };
     248
     249                        template <typename T>
     250                        struct lua_type_impl< T, enable_if_t< is_integral< T >::value && is_unsigned< T >::value > > { typedef lunsigned type; };
     251#endif
    226252
    227253                        template <typename T>
  • trunk/nv/stl/math/mat2.hh

    r486 r534  
    2828                        typedef tvec2<T> row_type;
    2929                        typedef tmat2<T> this_type;
    30                         typedef size_t   size_type;
     30                        typedef uint32   size_type;
    3131                        typedef T        value_type;
    3232
  • trunk/nv/stl/math/mat3.hh

    r486 r534  
    2727                        typedef tvec3<T> row_type;
    2828                        typedef tmat3<T> type;
    29                         typedef size_t   size_type;
     29                        typedef uint32   size_type;
    3030                        typedef T        value_type;
    3131
  • trunk/nv/stl/math/mat4.hh

    r471 r534  
    2828                        typedef tvec4<T> row_type;
    2929                        typedef tmat4<T> this_type;
    30                         typedef size_t   size_type;
     30                        typedef uint32   size_type;
    3131                        typedef T        value_type;
    3232
  • trunk/nv/stl/math/relational.hh

    r471 r534  
    1 // Copyright (C) 2015-2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    5959                {
    6060                        bool_vec_t<T> result( no_init );
    61                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     61                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    6262                                result[i] = lhs[i] < rhs[i];
    6363
     
    6969                {
    7070                        bool_vec_t<T> result( no_init );
    71                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     71                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    7272                                result[i] = lhs[i] <= rhs[i];
    7373                        return result;
     
    7878                {
    7979                        bool_vec_t<T> result( no_init );
    80                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     80                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    8181                                result[i] = lhs[i] > rhs[i];
    8282                        return result;
     
    8787                {
    8888                        bool_vec_t<T> result( no_init );
    89                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     89                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    9090                                result[i] = lhs[i] >= rhs[i];
    9191                        return result;
     
    9696                {
    9797                        bool_vec_t<T> result( no_init );
    98                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     98                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    9999                                result[i] = lhs[i] == rhs[i];
    100100                        return result;
     
    105105                {
    106106                        bool_vec_t<T> result( no_init );
    107                         for ( size_t i = 0; i < nv::size( lhs ); ++i )
     107                        for ( uint32 i = 0; i < nv::size( lhs ); ++i )
    108108                                result[i] = lhs[i] != rhs[i];
    109109                        return result;
     
    114114                {
    115115                        bool result = false;
    116                         for ( size_t i = 0; i < nv::size( v ); ++i )
     116                        for ( uint32 i = 0; i < nv::size( v ); ++i )
    117117                                result = result || v[i];
    118118                        return result;
     
    123123                {
    124124                        bool result = true;
    125                         for ( size_t i = 0; i < nv::size( v ); ++i )
     125                        for ( uint32 i = 0; i < nv::size( v ); ++i )
    126126                                result = result && v[i];
    127127                        return result;
     
    132132                {
    133133                        T result( no_init );
    134                         for ( size_t i = 0; i < nv::size( v ); ++i )
     134                        for ( uint32 i = 0; i < nv::size( v ); ++i )
    135135                                result[i] = !v[i];
    136136                        return result;
  • trunk/nv/stl/math/vec2.hh

    r486 r534  
    2828                        typedef T value_type;
    2929
    30                         static constexpr size_t SIZE = 2;
     30                        static constexpr uint32 SIZE = 2;
    3131
    3232                        union
     
    3737                        };
    3838
    39                         typedef size_t size_type;
     39                        typedef uint32 size_type;
    4040                        inline constexpr size_type size() const { return 2; }
    4141
  • trunk/nv/stl/math/vec3.hh

    r471 r534  
    2626                        typedef tvec3<T> type;
    2727                        typedef T value_type;
    28                         static constexpr size_t SIZE = 3;
     28                        static constexpr uint32 SIZE = 3;
    2929
    3030                        union
     
    3535                        };
    3636
    37                         typedef size_t size_type;
     37                        typedef uint32 size_type;
    3838                        inline constexpr size_type size() const { return 3; }
    3939
  • trunk/nv/stl/math/vec4.hh

    r471 r534  
    2727                        typedef tvec4<T> type;
    2828                        typedef T value_type;
    29                         static constexpr size_t SIZE = 4;
     29                        static constexpr uint32 SIZE = 4;
    3030
    3131                        union
     
    3636                        };
    3737
    38                         typedef size_t size_type;
     38                        typedef uint32 size_type;
    3939                        inline constexpr size_type size() const { return 4; }
    4040
  • trunk/nv/stl/string/string_base.hh

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/nv/stl/string/string_twine.hh

    r533 r534  
    1 // Copyright (C) 2015-2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/bullet/bullet_helper.hh

    r520 r534  
    1 // Copyright (C) 2016 ChaosForge Ltd
     1// Copyright (C) 2016-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/core/logger.cc

    r533 r534  
    1 // Copyright (C) 2011-2015 ChaosForge Ltd
     1// Copyright (C) 2011-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/core/profiler.cc

    r533 r534  
    1 // Copyright (C) 2012-2014 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/core/random.cc

    r533 r534  
    1 // Copyright (C) 2012-2014 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/engine/mesh_manager.cc

    r522 r534  
    3535        nv::string_view sub_mesh_name;
    3636        nv::string128 base_mesh_name( path );
    37         nv::size_t sub_mesh_pos = path.find( ":" );
    38         nv::size_t dot_pos = path.find( "." );
     37        nv::uint32 sub_mesh_pos = path.find( ":" );
     38        nv::uint32 dot_pos = path.find( "." );
    3939        if ( sub_mesh_pos != nv::string_view::npos )
    4040        {
  • trunk/src/engine/particle_engine.cc

    r532 r534  
    196196        datap->plane_normal = normalize_safe( datap->plane_normal, vec3(0.0f,1.0f,0.0f) );
    197197        datap->bounce       = table->get<float>("bounce", 0.0f );
    198         datap->distance     = -math::dot( datap->plane_normal, datap->plane_point ) / math::sqrt( math::dot( datap->plane_normal, datap->plane_normal ) );
     198        datap->distance     = -math::dot( datap->plane_normal, datap->plane_point ) / static_cast<float>( math::sqrt( math::dot( datap->plane_normal, datap->plane_normal ) ) );
    199199        return true;
    200200}
  • trunk/src/engine/program_manager.cc

    r505 r534  
    5050        stream* fstream = open_stream( fs, path );
    5151        if ( !fstream ) return const_string();
    52         uint32 size = fstream->size();
     52        uint32 size = static_cast< uint32 >( fstream->size() );
    5353        const_string result( nullptr, size );
    5454        fstream->read( const_cast<char*>( result.data() ), size, 1 );
  • trunk/src/formats/assimp_loader.cc

    r491 r534  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    107107        m_mesh_count = 0;
    108108        NV_LOG_NOTICE( "AssImp loading file..." );
    109         size_t size = source.size();
     109        uint32 size = static_cast< uint32 >( source.size() );
    110110        char* data  = new char[ size ];
    111111        source.read( data, size, 1 );
     
    143143}
    144144
    145 data_channel_set* nv::assimp_loader::release_mesh_data( size_t index, data_node_info& info )
     145data_channel_set* nv::assimp_loader::release_mesh_data( uint32 index, data_node_info& info )
    146146{
    147147        if ( index >= m_mesh_count ) return nullptr;
     
    149149        return m_meshes[index];
    150150}
    151 void nv::assimp_loader::load_mesh_data( data_channel_set* data, size_t index, data_node_info& info )
     151void nv::assimp_loader::load_mesh_data( data_channel_set* data, uint32 index, data_node_info& info )
    152152{
    153153        const aiMesh*  mesh  = m_data->scene->mMeshes[ index ];
     
    161161                desc.initialize< assimp_plain_vtx >();
    162162        data_channel_set_creator maccess( data );
    163         string64 name( mesh->mName.data, mesh->mName.length );
     163        string64 name( mesh->mName.data, static_cast< uint32 >( mesh->mName.length ) );
    164164        if ( mesh->mName.length == 0 )
    165165        {
     
    170170                                        if ( node->mMeshes[i] == index )
    171171                                        {
    172                                                 name.assign( node->mName.data, node->mName.length );
     172                                                name.assign( node->mName.data, static_cast< uint32 >( node->mName.length ) );
    173173                                                if ( i != 0 )
    174174                                                {
     
    215215                {
    216216                        aiBone* bone  = mesh->mBones[m];
    217                         for ( size_t w=0; w<bone->mNumWeights; w++)
     217                        for ( uint32 w=0; w<bone->mNumWeights; w++)
    218218                        {
    219219                                assimp_skinned_vtx& v = vtx[ bone->mWeights[w].mVertexId ];
    220220                                bool found = false;
    221                                 for ( size_t i = 0 ; i < 4; ++i )
     221                                for ( uint32 i = 0 ; i < 4; ++i )
    222222                                {
    223223                                        if ( v.boneweight[i] <= 0.0f )
     
    281281                        aiMesh* mesh = m_data->scene->mMeshes[mc];
    282282
    283                         NV_LOG_NOTICE( "Mesh #", mc, "   - ", string_view( static_cast<char*>( mesh->mName.data ), mesh->mName.length ) );
     283                        NV_LOG_NOTICE( "Mesh #", mc, "   - ", string_view( static_cast<char*>( mesh->mName.data ), static_cast< uint32 >( mesh->mName.length ) ) );
    284284                        NV_LOG_NOTICE( "  bones   - ", mesh->mNumBones );
    285285                        NV_LOG_NOTICE( "  uvs     - ", mesh->mNumUVComponents[0] );
     
    303303        for ( auto node : m_data->nodes )
    304304        {
    305                 NV_LOG_NOTICE( "Node : ", string_view( node->mName.data, node->mName.length ) );
     305                NV_LOG_NOTICE( "Node : ", string_view( node->mName.data, static_cast< uint32 >( node->mName.length ) ) );
    306306        }
    307307
    308308        for ( auto skeleton : m_data->skeletons )
    309309        {
    310                 NV_LOG_NOTICE( "Skeleton : ", string_view( skeleton->mName.data, skeleton->mName.length ) );
     310                NV_LOG_NOTICE( "Skeleton : ", string_view( skeleton->mName.data, static_cast< uint32 >( skeleton->mName.length ) ) );
    311311        }
    312312
     
    353353        }
    354354
    355         string_view name( ainode->mName.data, ainode->mName.length );
     355        string_view name( ainode->mName.data, static_cast< uint32 >( ainode->mName.length ) );
    356356        if ( name.starts_with( '_' ) ) return;
    357357
     
    409409                        {
    410410                                assimp_skinned_vtx& vertex = channel.data()[v];
    411                                 for ( size_t i = 0; i < 4; ++i )
     411                                for ( uint32 i = 0; i < 4; ++i )
    412412                                {
    413413                                        if ( vertex.boneweight[i] > 0.0f )
     
    430430                        int pid = bone_data[i].parent_id;
    431431                        if ( pid >= 0 )
    432                                 bone_data[i].transform = tr * bone_data[ size_t( pid ) ].transform;
     432                                bone_data[i].transform = tr * bone_data[uint32( pid ) ].transform;
    433433                        else
    434434                                bone_data[i].transform = tr;
     
    447447}
    448448
    449 mesh_nodes_data* nv::assimp_loader::release_mesh_nodes_data( size_t index /*= 0*/ )
     449mesh_nodes_data* nv::assimp_loader::release_mesh_nodes_data( uint32 index /*= 0*/ )
    450450{
    451451        if ( m_data->scene == nullptr ) return nullptr;
     
    484484}
    485485
    486 data_node_list* nv::assimp_loader::release_data_node_list( size_t /*= 0 */ )
     486data_node_list* nv::assimp_loader::release_data_node_list( uint32 /*= 0 */ )
    487487{
    488488        return release_merged_bones();
    489489}
    490490
    491 bool nv::assimp_loader::is_animated( size_t /*= 0 */ )
     491bool nv::assimp_loader::is_animated( uint32 /*= 0 */ )
    492492{
    493493        int this_is_incorrect;
     
    623623//      bool has_bones = false;
    624624//      data_channel_set* meshes = data_channel_set_creator::create_set_array( m_mesh_count, 2 );
    625 //      for ( size_t m = 0; m < m_mesh_count; ++m )
     625//      for ( uint32 m = 0; m < m_mesh_count; ++m )
    626626//      {
    627627//              const aiMesh* mesh = scene->mMeshes[ m ];
     
    635635// }
    636636
    637 nv::size_t nv::assimp_loader::get_nodes_data_count() const
     637uint32 nv::assimp_loader::get_nodes_data_count() const
    638638{
    639639        if ( m_data->scene == nullptr ) return 0;
  • trunk/src/formats/nmd_loader.cc

    r487 r534  
    1 // Copyright (C) 2014-2015 ChaosForge Ltd
     1// Copyright (C) 2014-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    4545}
    4646
    47 data_channel_set* nv::nmd_loader::release_mesh_data( size_t index, data_node_info& info )
     47data_channel_set* nv::nmd_loader::release_mesh_data( uint32 index, data_node_info& info )
    4848{
    4949        data_channel_set* result = m_meshes[ index ];
     
    158158}
    159159
    160 mesh_nodes_data* nv::nmd_loader::release_mesh_nodes_data( size_t )
     160mesh_nodes_data* nv::nmd_loader::release_mesh_nodes_data( uint32 )
    161161{
    162162        return nullptr;
    163163}
    164164
    165 data_node_list* nv::nmd_loader::release_data_node_list( size_t )
     165data_node_list* nv::nmd_loader::release_data_node_list( uint32 )
    166166{
    167167        data_node_list* result = m_bone_data;
     
    170170}
    171171
    172 bool nv::nmd_loader::is_animated( size_t /*= 0 */ )
     172bool nv::nmd_loader::is_animated( uint32 /*= 0 */ )
    173173{
    174174        return m_pose_data_set != nullptr;
  • trunk/src/formats/obj_loader.cc

    r482 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    5252        string32 next_name;
    5353
    54         nv::size_t size;
     54        uint32 size;
    5555        bool   eof;
    5656
    5757        obj_reader();
    5858        bool read_stream( stream& str );
    59         virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_t count ) = 0;
    60         virtual nv::size_t raw_size() const = 0;
     59        virtual uint32 add_face( uint32* vi, uint32* ti, uint32* ni, uint32 count ) = 0;
     60        virtual uint32 raw_size() const = 0;
    6161        virtual void reset() = 0;
    6262        virtual const uint8* raw_pointer() const = 0;
     
    126126                        string_view scan( cline );
    127127                        scan.remove_prefix( 2 );
    128                         size_t pos = 0;
     128                        uint32 pos = 0;
    129129                        while ( pos != string_view::npos )
    130130                        {
     
    176176{
    177177        mesh_data_reader( bool normals ) : m_normals( normals ) {}
    178         virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_t count )
     178        virtual uint32 add_face( uint32* vi, uint32* ti, uint32* ni, uint32 count )
    179179        {
    180180                if ( count < 3 ) return 0; // TODO : report error?
     
    182182                // TODO : support if normals not present;
    183183                vec3 nullvec;
    184                 nv::size_t result = 0;
     184                uint32 result = 0;
    185185                // Simple triangulation - obj's shouldn't have more than quads anyway
    186186
    187187                if ( m_normals )
    188188                {
    189                         for ( nv::size_t i = 2; i < count; ++i )
     189                        for ( uint32 i = 2; i < count; ++i )
    190190                        {
    191191                                result++;
     
    197197                else
    198198                {
    199                         for ( nv::size_t i = 2; i < count; ++i )
     199                        for ( uint32 i = 2; i < count; ++i )
    200200                        {
    201201                                result++;
     
    210210        vector< VTX > m_data;
    211211        virtual void reset() { m_data.clear(); }
    212         virtual nv::size_t raw_size() const { return m_data.size() * sizeof( VTX ); }
     212        virtual uint32 raw_size() const { return m_data.size() * sizeof( VTX ); }
    213213        virtual const uint8* raw_pointer() const { return reinterpret_cast< const uint8* >( m_data.data() ); }
    214214};
     
    232232        void calculate_tangents()
    233233        {
    234                 nv::size_t count = m_data.size();
    235                 nv::size_t tcount = count / 3;
     234                uint32 count = m_data.size();
     235                uint32 tcount = count / 3;
    236236
    237237                vector< vec3 > tan1( count );
    238238                vector< vec3 > tan2( count );
    239239
    240                 for ( nv::size_t a = 0; a < tcount; ++a )
    241                 {
    242                         nv::size_t i1 = a * 3;
    243                         nv::size_t i2 = a * 3 + 1;
    244                         nv::size_t i3 = a * 3 + 2;
     240                for ( uint32 a = 0; a < tcount; ++a )
     241                {
     242                        uint32 i1 = a * 3;
     243                        uint32 i2 = a * 3 + 1;
     244                        uint32 i3 = a * 3 + 2;
    245245                        obj_vertex_vtnt& vtx1 = m_data[ i1 ];
    246246                        obj_vertex_vtnt& vtx2 = m_data[ i2 ];
     
    277277                }
    278278
    279                 for ( nv::size_t a = 0; a < count; ++a )
     279                for ( uint32 a = 0; a < count; ++a )
    280280                {
    281281                        const vec3& nv = m_data[a].normal;
     
    347347}
    348348
    349 data_channel_set* nv::obj_loader::release_mesh_data( size_t index, data_node_info& info )
     349data_channel_set* nv::obj_loader::release_mesh_data( uint32 index, data_node_info& info )
    350350{
    351351        data_channel_set* result = m_meshes[ index ];
  • trunk/src/gfx/image.cc

    r505 r534  
    1 // Copyright (C) 2011-2015 ChaosForge Ltd
     1// Copyright (C) 2011-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    1010using namespace nv;
    1111
    12 image::image( ivec2 size, nv::size_t depth )
     12image::image( ivec2 size, uint32 depth )
    1313        : m_size( size ), m_depth( depth ), m_data( nullptr )
    1414{
     
    2323
    2424
    25 image::image( ivec2 size, nv::size_t depth, const uint8 * data, bool reversed )
     25image::image( ivec2 size, uint32 depth, const uint8 * data, bool reversed )
    2626        : m_size( size ), m_depth( depth ), m_data( nullptr )
    2727{
    2828        NV_ASSERT( size.x >= 0 && size.y >= 0, "bad parameters passed to image!" );
    2929        sint32 bsize = m_size.x * m_size.y * static_cast<sint32>( m_depth );
    30         m_data = new uint8[ size_t( bsize ) ];
     30        m_data = new uint8[ uint32( bsize ) ];
    3131
    3232        if ( reversed )
     
    9797        uint32 rsizey     = static_cast< uint32 >( r.size.y );
    9898        const uint8* data = idata->get_data();
    99         size_t depth      = idata->get_depth();
    100         size_t cdepth     = m_depth > depth ? depth : m_depth;
     99        uint32 depth      = idata->get_depth();
     100        uint32 cdepth     = m_depth > depth ? depth : m_depth;
    101101        uint32 dstride    = rsizex * depth;
    102102
     
    107107                {
    108108                        uint32 xy = pos + x * m_depth;
    109                         for( size_t e = 0; e < cdepth; ++e )
     109                        for( uint32 e = 0; e < cdepth; ++e )
    110110                        {
    111111                                m_data[ xy + e ] = data[ y*dstride + x * depth + e ];
  • trunk/src/gfx/mesh_creator.cc

    r532 r534  
    1515void nv::mesh_nodes_creator::merge_keys()
    1616{
    17         for ( size_t i = 0; i < m_data->size(); ++i )
     17        for ( uint32 i = 0; i < m_data->size(); ++i )
    1818        {
    1919                data_channel_set* old_keys = m_data->m_data[i];
    2020                if ( old_keys && old_keys->size() > 0 )
    2121                {
    22                         size_t chan_count = old_keys->size();
     22                        uint32 chan_count = old_keys->size();
    2323                        if ( chan_count == 1
    2424                                && old_keys->get_channel(0)->descriptor().size() == 1
     
    516516        NV_ASSERT( a.size() % frame_count == 0, "Merge - append first mesh empty!" );
    517517        NV_ASSERT( b.size() % frame_count == 0, "Merge - append second mesh empty!" );
    518         size_t vtx_size = a.element_size();
     518        uint32 vtx_size = a.element_size();
    519519
    520520        raw_data_channel result = data_channel_creator::create( a.descriptor(), a.size() + b.size() );
     
    523523        if ( frame_count == 1 )
    524524        {
    525                 size_t a_size = vtx_size * a.size();
     525                uint32 a_size = vtx_size * a.size();
    526526                raw_copy_n( a.raw_data(), a_size, rdata );
    527527                raw_copy_n( b.raw_data(), vtx_size * b.size(), rdata + a_size );
     
    529529        else
    530530        {
    531                 size_t frame_size_a = ( a.size() / frame_count ) * vtx_size;
    532                 size_t frame_size_b = ( b.size() / frame_count ) * vtx_size;
    533                 size_t pos_a = 0;
    534                 size_t pos_b = 0;
    535                 size_t pos   = 0;
    536                 for ( size_t i = 0; i < frame_count; ++i )
     531                uint32 frame_size_a = ( a.size() / frame_count ) * vtx_size;
     532                uint32 frame_size_b = ( b.size() / frame_count ) * vtx_size;
     533                uint32 pos_a = 0;
     534                uint32 pos_b = 0;
     535                uint32 pos   = 0;
     536                for ( uint32 i = 0; i < frame_count; ++i )
    537537                {
    538538                        raw_copy_n( a.raw_data() + pos_a, frame_size_a, rdata + pos );
  • trunk/src/gfx/skeleton_instance.cc

    r520 r534  
    1 // Copyright (C) 2011-2015 ChaosForge Ltd
     1// Copyright (C) 2011-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/gfx/texture_atlas.cc

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/gl/gl_context.cc

    r523 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    311311}
    312312
    313 void nv::gl_context::bind( buffer b, uint32 index, size_t offset /*= 0*/, size_t size /*= 0 */ )
     313void nv::gl_context::bind( buffer b, uint32 index, uint32 offset /*= 0*/, uint32 size /*= 0 */ )
    314314{
    315315        const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) );
     
    465465}
    466466
    467 void* nv::gl_context::map_buffer( buffer b, buffer_access ba, size_t offset, size_t length )
     467void* nv::gl_context::map_buffer( buffer b, buffer_access ba, uint32 offset, uint32 length )
    468468{
    469469        const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) );
     
    492492}
    493493
    494 // void nv::gl_context::update( buffer b, uint32 index, const void* data, size_t offset, size_t size )
     494// void nv::gl_context::update( buffer b, uint32 index, const void* data, uint32 offset, uint32 size )
    495495// {
    496496//      const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) );
     
    506506// }
    507507
    508 void gl_context::update( buffer b, const void* data, nv::size_t offset, nv::size_t size )
     508void gl_context::update( buffer b, const void* data, nv::uint32 offset, nv::uint32 size )
    509509{
    510510        const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) );
     
    10201020}
    10211021
    1022 nv::buffer nv::gl_context::create_buffer( buffer_type type, buffer_hint hint, size_t size, const void* source /*= nullptr */ )
     1022nv::buffer nv::gl_context::create_buffer( buffer_type type, buffer_hint hint, uint32 size, const void* source /*= nullptr */ )
    10231023{
    10241024        buffer result = static_cast<gl_device*>( m_device )->create_buffer( type, hint );
     
    10271027}
    10281028
    1029 void nv::gl_context::create_buffer( buffer b, size_t size, const void* source /*= nullptr */ )
     1029void nv::gl_context::create_buffer( buffer b, uint32 size, const void* source /*= nullptr */ )
    10301030{
    10311031        gl_buffer_info* info = static_cast<gl_device*>( m_device )->get_full_buffer_info( b );
     
    10671067}
    10681068
    1069 void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::size_t count, nv::size_t first )
     1069void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::uint32 count, nv::uint32 first )
    10701070{
    10711071        apply_render_state( rs );
     
    10771077                if ( info->index.is_valid() )
    10781078                {
    1079                         glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast< const void* >( get_datatype_info( info->index_type ).size * first ) );
     1079                        glDrawElements( primitive_to_enum(prim), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast< const void* >( size_t( get_datatype_info( info->index_type ).size * first ) ) );
    10801080                }
    10811081                else
     
    10881088}
    10891089
    1090 void nv::gl_context::draw_instanced( primitive prim, const render_state& rs, program p, size_t instances, vertex_array va, size_t count, size_t first /*= 0 */ )
     1090void nv::gl_context::draw_instanced( primitive prim, const render_state& rs, program p, uint32 instances, vertex_array va, uint32 count, uint32 first /*= 0 */ )
    10911091{
    10921092        apply_render_state( rs );
     
    10981098                if ( info->index.is_valid() )
    10991099                {
    1100                         glDrawElementsInstanced( primitive_to_enum( prim ), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast<const void*>( get_datatype_info( info->index_type ).size * first ), instances );
     1100                        glDrawElementsInstanced( primitive_to_enum( prim ), static_cast<GLsizei>( count ), datatype_to_gl_enum( info->index_type ), reinterpret_cast<const void*>( size_t( get_datatype_info( info->index_type ).size * first ) ), instances );
    11011101                }
    11021102                else
  • trunk/src/gl/gl_device.cc

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/gui/gui_gfx_renderer.cc

    r501 r534  
    109109{
    110110public:
    111         screen_render_data( context* actx, nv::size_t initial_size )
     111        screen_render_data( context* actx, nv::uint32 initial_size )
    112112                : buffer( actx, VERTEX_BUFFER, DYNAMIC_DRAW, initial_size ), ctx( actx ), varray(), shader()
    113113        {
     
    147147        m_area.dim( dimension( w->get_width(), w->get_height() ) );
    148148        region white = m_atlas.get_region( ivec2( 3, 3 ) );
    149         size_t wsize = m_atlas.get_depth() * 4 * 4;
     149        uint32 wsize = m_atlas.get_depth() * 4 * 4;
    150150        uint8* wfill = new uint8[m_atlas.get_depth() * 4 * 4];
    151151        raw_fill( wfill, wfill + wsize, 255 );
     
    178178}
    179179
    180 texture_font* gfx_renderer::get_font( nv::size_t name ) const
     180texture_font* gfx_renderer::get_font( nv::uint32 name ) const
    181181{
    182182        if ( name >= m_fonts.size() ) return nullptr;
     
    184184}
    185185
    186 const image_info* gfx_renderer::get_image( nv::size_t name ) const
     186const image_info* gfx_renderer::get_image( nv::uint32 name ) const
    187187{
    188188        if ( name >= m_images.size() ) return nullptr;
     
    190190}
    191191
    192 nv::size_t gfx_renderer::load_font( const string_view& filename, nv::size_t size )
     192nv::uint32 gfx_renderer::load_font( const string_view& filename, nv::uint32 size )
    193193{
    194194        string128 id( filename );
     
    199199                return i->second;
    200200        }
    201         size_t result = m_fonts.size();
     201        uint32 result = m_fonts.size();
    202202        texture_font* f = new texture_font( &m_atlas, filename.data(), static_cast<float>( size ) );
    203203        f->load_glyphs( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " );
     
    208208}
    209209
    210 nv::size_t gfx_renderer::load_image( const string_view& filename )
     210nv::uint32 gfx_renderer::load_image( const string_view& filename )
    211211{
    212212        auto i = m_image_names.find( filename );
     
    215215                return i->second;
    216216        }
    217         size_t result = m_images.size();
     217        uint32 result = m_images.size();
    218218        image_data* data = m_window->get_device()->create_image_data( filename );
    219219        // TODO: Repitching
     
    236236        }
    237237        element_render_data* er = reinterpret_cast< element_render_data* >( e->m_render_data );
    238         size_t size_before = er->buffer.data().size();
     238        uint32 size_before = er->buffer.data().size();
    239239
    240240        vector< gui_quad >& qvec = er->buffer.lock();
     
    254254                if ( m_style.get( e, "skin", selector, path ) )
    255255                {
    256                         size_t image_id = load_image( path );
     256                        uint32 image_id = load_image( path );
    257257                        const image_info* image = get_image( image_id );
    258258                        if ( image )
     
    319319                        if ( m_style.get( e, "text_color", selector, color ) && m_style.get( e, "text_font", selector, path ) && m_style.get( e, "text_size", selector, border ) )
    320320                        {
    321                                 size_t font_id = load_font( path, size_t( border ) );
     321                                uint32 font_id = load_font( path, uint32( border ) );
    322322                                texture_font* font = get_font( font_id );
    323323                                position p = abs.ul + position( 0, border );
  • trunk/src/gui/gui_style.cc

    r487 r534  
    3333        if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false;
    3434        vec = vec4();
    35         for ( size_t i = 0; i < 4; ++i )
     35        for ( uint32 i = 0; i < 4; ++i )
    3636        {
    3737                lua_rawgeti( m_lua, -1, int(i+1) );
  • trunk/src/image/miniz.cc

    r533 r534  
    11661166                        TINFL_GET_BYTE( 1, r->m_zhdr0 ); TINFL_GET_BYTE( 2, r->m_zhdr1 );
    11671167                        counter = ( ( ( r->m_zhdr0 * 256 + r->m_zhdr1 ) % 31 != 0 ) || ( r->m_zhdr1 & 32 ) || ( ( r->m_zhdr0 & 15 ) != 8 ) );
    1168                         if ( !( decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF ) ) counter |= ( ( ( 1U << ( 8U + ( r->m_zhdr0 >> 4 ) ) ) > 32768U ) || ( ( out_buf_size_mask + 1 ) < (size_t)( 1U << ( 8U + ( r->m_zhdr0 >> 4 ) ) ) ) );
     1168                        if ( !( decomp_flags & TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF ) ) counter |= ( ( ( 1U << ( 8U + ( r->m_zhdr0 >> 4 ) ) ) > 32768U ) || ( ( out_buf_size_mask + 1 ) < (uint32)( 1U << ( 8U + ( r->m_zhdr0 >> 4 ) ) ) ) );
    11691169                        if ( counter ) { TINFL_CR_RETURN_FOREVER( 36, TINFL_STATUS_FAILED ); }
    11701170                }
  • trunk/src/image/png_loader.cc

    r487 r534  
    1 // Copyright (C) 2015-2015 ChaosForge Ltd
     1// Copyright (C) 2015-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    251251        int remaining()
    252252        {
    253                 return m_img_buffer_end - m_img_buffer;
     253                return (int)( m_img_buffer_end - m_img_buffer );
    254254        }
    255255
     
    865865
    866866                case STBI__PNG_TYPE( 'I', 'E', 'N', 'D' ): {
    867                         uint32 raw_len, bpl;
     867                        size_t raw_len;
     868                        uint32 bpl;
    868869                        if ( first ) return stbi__err( "first not IHDR", "Corrupt PNG" );
    869870                        if ( scan != STBI__SCAN_load ) return 1;
     
    882883                        else
    883884                                s->img_out_n = s->img_n;
    884                         if ( !stbi__create_png_image( z, z->expanded, raw_len, s->img_out_n, depth, color, interlace ) ) return 0;
     885                        if ( !stbi__create_png_image( z, z->expanded, int( raw_len ), s->img_out_n, depth, color, interlace ) ) return 0;
    885886                        if ( has_trans )
    886887                                if ( !stbi__compute_transparency( z, tc, s->img_out_n ) ) return 0;
     
    977978static int stbi__stream_read( void *user, char *data, int size )
    978979{
    979         return reinterpret_cast<stream*>( user )->read( data, 1, size );
     980        return (int)reinterpret_cast<stream*>( user )->read( data, 1, size );
    980981}
    981982
     
    10221023        if ( stbi__png_info( &s, &x, &y, &comp ) == 1 )
    10231024        {
    1024                 str.seek( pos, origin::SET );
     1025                str.seek( (long)pos, origin::SET );
    10251026                format.type = UBYTE;
    10261027                switch ( comp )
  • trunk/src/image/png_writer.cc

    r529 r534  
    372372        ivec2 sz = data->get_size();
    373373        int len = 0;
    374         unsigned char* out = stbi_write_png_to_mem( data->get_data(), 0, sz.x, sz.y, data->get_depth(), &len );
     374        unsigned char* out = stbi_write_png_to_mem( data->get_data(), 0, sz.x, sz.y, (int)data->get_depth(), &len );
    375375        if ( !out ) return false;
    376376        s.write( out, 1, len );
  • trunk/src/io/c_file_system.cc

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
  • trunk/src/lua/lua_math.cc

    r529 r534  
    1111#include "nv/stl/type_traits/common.hh"
    1212
    13 static size_t nlua_swizzel_lookup[256];
     13using nv::uint32;
     14static nv::uint32 nlua_swizzel_lookup[256];
    1415
    1516using nv::lua::detail::is_vec;
     
    1819using nv::lua::detail::push_vec;
    1920
    20 inline bool nlua_is_swizzel( const unsigned char* str, size_t max )
     21inline bool nlua_is_swizzel( const unsigned char* str, nv::uint32 max )
    2122{
    2223        while (*str)
     
    229230{
    230231        T v = to_vec<T>( L, 1 );
    231         for ( size_t i = 0; i < v.size(); ++i )
     232        for ( uint32 i = 0; i < v.size(); ++i )
    232233        {
    233234                lua_pushnumber( L, v[i] );
     
    241242        T* v = to_pvec<T>( L, 1 );
    242243        size_t len  = 0;
    243         size_t vlen = v->size();
     244        uint32 vlen = v->size();
    244245        const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) );
    245         size_t idx = 255;
     246        uint32 idx = 255;
    246247
    247248        if ( len == 1 )
     
    279280        T* v = to_pvec<T>( L, 1 );
    280281        size_t len  = 0;
    281         size_t vlen = v->size();
     282        uint32 vlen = v->size();
    282283        const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) );
    283         size_t idx = 255;
     284        uint32 idx = 255;
    284285        if( len == 1 )
    285286        {
     
    294295        {
    295296                switch (len) {
    296                 case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0;
    297                 case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0;
    298                 case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( size_t i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0;
     297                case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v2[i]; } return 0;
     298                case 3 : { vec3 v3 = to_vec<vec3>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v3[i]; } return 0;
     299                case 4 : { vec4 v4 = to_vec<vec4>(L,3); for ( uint32 i = 0; i< len; ++i) (*v)[nlua_swizzel_lookup[key[i]]] = v4[i]; } return 0;
    299300                default: break;
    300301                }
     
    405406void nv::lua::register_math( lua::state* state )
    406407{
    407         for (size_t i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;
     408        for (uint32 i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;
    408409        using nv::uchar8;
    409410        nlua_swizzel_lookup[uchar8( 'x' )] = 0;
  • trunk/src/lua/lua_nova.cc

    r490 r534  
    9191                if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0)
    9292                {
    93                         luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) );
     93                        luaL_error( L, "lua.nova - \"%s.%s\" - type mismatch, %s expected, %s found!", lua_tolstring( L, iid, 0 ), lua_tolstring( L, ifield, 0 ), lua_typename( L, (int)lua_tointeger( L, itype ) ), lua_typename( L, lua_type( L, ivalue ) ) );
    9494                }
    9595                break;
     
    296296        lua_rawget( L, 1 );
    297297        int count = 0;
    298         if ( !lua_isnil( L, -1 ) ) count = lua_tointeger( L, -1 );
     298        if ( !lua_isnil( L, -1 ) ) count = (int)lua_tointeger( L, -1 );
    299299        lua_pop( L, 1 );
    300300        count++;
     
    358358static int nova_create_seq_function_closure( lua_State * L )
    359359{
    360         int fc   = lua_tointeger( L, lua_upvalueindex( 1 ) );
     360        int fc   = (int)lua_tointeger( L, lua_upvalueindex( 1 ) );
    361361        int args = lua_gettop( L );
    362362        for ( int fi = 1; fi <= fc; fi++ )
  • trunk/src/lua/lua_path.cc

    r490 r534  
    1616        string_view spath( m_elements[0].str, m_elements[0].length );
    1717        m_count = 0;
    18         size_t point = spath.find( '.' );
     18        uint32 point = spath.find( '.' );
    1919
    2020        while ( point != string_view::npos )
  • trunk/src/lua/lua_raw.cc

    r494 r534  
    331331int nlua_rawlen( lua_State* L, int index )
    332332{
    333         return lua_objlen( L, index );
     333        return static_cast<int>( lua_objlen( L, index ) );
    334334}
    335335
  • trunk/src/lua/lua_state.cc

    r533 r534  
    911911        if ( lua_type( state->get_raw(), index ) == LUA_TBOOLEAN )
    912912        {
    913                 *value = bool( lua_toboolean( state->get_raw(), index ) );
     913                *value = lua_toboolean( state->get_raw(), index ) != 0;
    914914                return true;
    915915        }
  • trunk/src/lua/lua_types.cc

    r503 r534  
    1 // Copyright (C) 2016-2016 ChaosForge Ltd
     1// Copyright (C) 2016-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
     
    8585                {
    8686                        int error; // proper type instead of sint32?
    87                         *(sint32*)object = lua_tointeger( lstate, index );
     87                        *(sint32*)object = (sint32)lua_tointeger( lstate, index );
    8888                        return true;
    8989                }
  • trunk/src/lua/lua_values.cc

    r533 r534  
    1 // Copyright (C) 2012-2015 ChaosForge Ltd
     1// Copyright (C) 2012-2017 ChaosForge Ltd
    22// http://chaosforge.org/
    33//
Note: See TracChangeset for help on using the changeset viewer.