- Timestamp:
- 01/12/17 14:41:17 (8 years ago)
- Location:
- trunk
- Files:
-
- 58 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/logger.hh
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/core/random.hh
r511 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 470 470 }; 471 471 472 473 472 class random : public random_mersenne 474 473 { -
trunk/nv/formats/assimp_loader.hh
r486 r534 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 24 24 explicit assimp_loader( string_table* strings, const string_view& a_ext, uint32 a_assimp_flags = 0 ); 25 25 virtual bool load( stream& source ); 26 virtual data_channel_set* release_mesh_data( size_tindex, data_node_info& info );27 virtual size_tget_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; } 28 28 virtual ~assimp_loader(); 29 virtual size_tget_nodes_data_count() const;30 virtual mesh_nodes_data* release_mesh_nodes_data( size_tindex = 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 ); 33 33 void scene_report() const; 34 34 private: … … 36 36 void build_skeleton( vector< data_node_info >& skeleton, const void* node, sint16 parent_id ); 37 37 data_node_list* release_merged_bones(); 38 void load_mesh_data( data_channel_set* data, size_tindex, data_node_info& info );38 void load_mesh_data( data_channel_set* data, uint32 index, data_node_info& info ); 39 39 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 ); 40 40 void scan_nodes( const void* node ) const; … … 51 51 const_string m_ext; 52 52 uint32 m_assimp_flags; 53 size_tm_mesh_count;53 uint32 m_mesh_count; 54 54 }; 55 55 -
trunk/nv/formats/nmd_loader.hh
r485 r534 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 84 84 explicit nmd_loader( string_table* strings ) : mesh_loader( strings ), /*m_node_data( nullptr ), */m_bone_data( nullptr ), m_pose_data_set( nullptr ) {} 85 85 virtual bool load( stream& source ); 86 virtual data_channel_set* release_mesh_data( size_tindex, data_node_info& info );87 virtual size_tget_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_tget_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(); } 92 92 virtual ~nmd_loader(); 93 93 -
trunk/nv/formats/obj_loader.hh
r482 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 27 27 obj_loader( string_table* strings, bool normals = true, bool tangents = false ); 28 28 virtual bool load( stream& source ); 29 virtual data_channel_set* release_mesh_data( size_tindex, data_node_info& info );30 virtual size_tget_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(); } 31 31 ~obj_loader(); 32 32 private: -
trunk/nv/gfx/image.hh
r395 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 42 42 * @arg[in] depth : Depth of the image. 43 43 */ 44 image( ivec2 size, size_tdepth );44 image( ivec2 size, uint32 depth ); 45 45 /** 46 46 * Constructor … … 61 61 * reversed or not. 62 62 */ 63 image( ivec2 size, size_tdepth, const uint8 * data, bool reversed = false );63 image( ivec2 size, uint32 depth, const uint8 * data, bool reversed = false ); 64 64 /** 65 65 * Fills the image with a given value. … … 114 114 * @return Returns depth of the image. 115 115 */ 116 size_tget_depth() const { return m_depth; }116 uint32 get_depth() const { return m_depth; } 117 117 protected: 118 118 ivec2 m_size; //!< Defines the size of the image as a vector. 119 size_tm_depth; //!< Defines the depth of the image119 uint32 m_depth; //!< Defines the depth of the image 120 120 uint8* m_data; //!< Holder for data 121 121 }; -
trunk/nv/gfx/skeleton_instance.hh
r520 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 106 106 skeleton_transforms() {} 107 107 const transform* xforms() const { return m_transforms.data(); } 108 size_tsize() const { return m_transforms.size(); }108 uint32 size() const { return m_transforms.size(); } 109 109 void assign( const data_node_list* node_data ); 110 110 void assign( const skeleton_transforms& other ); … … 149 149 skeleton_instance() {} 150 150 const mat4* xforms() const { return m_matrix.data(); } 151 size_tsize() const { return m_matrix.size(); }151 uint32 size() const { return m_matrix.size(); } 152 152 void assign( const skeleton_transforms& skeleton, const skeleton_binding& binding, const bone_transforms< value_type >& bones ) 153 153 { -
trunk/nv/gfx/sliced_buffer.hh
r501 r534 26 26 typedef sliced_buffer<T> cache_type; 27 27 typedef vector<T> vector_type; 28 typedef size_t size_type;28 typedef uint32 uint32ype; 29 29 30 30 buffer_slice( cache_type* c ) … … 60 60 } 61 61 62 size_tget_offset() const62 uint32 get_offset() const 63 63 { 64 64 return m_offset; … … 81 81 vector_type m_data; 82 82 cache_type* m_cache; 83 size_type m_offset;84 size_type m_cached_size;83 uint32ype m_offset; 84 uint32ype m_cached_size; 85 85 bool m_locked; 86 86 }; … … 92 92 typedef vector<T> vector_type; 93 93 typedef T value_type; 94 static const size_tvalue_type_size = sizeof(T);95 96 sliced_buffer( context* ctx, buffer_type type, buffer_hint hint, size_tinitial_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 ) 97 97 : m_context( ctx ) 98 98 , m_buffer() … … 108 108 } 109 109 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 ) 111 111 { 112 112 if ( !m_full_update && resized ) 113 113 { 114 114 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 ); 116 116 m_full_update = true; 117 117 } … … 125 125 // raw_copy( bv.cbegin(), bv.cend(), m_data.begin() + (int)offset ); 126 126 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() ); 129 129 } 130 130 return m_full_update; … … 132 132 133 133 template < typename V > 134 void add_offset( size_t size, size_toffset, V value )134 void add_offset( uint32 size, uint32 offset, V value ) 135 135 { 136 136 if ( size == 0 ) return; … … 157 157 { 158 158 bool result = false; 159 size_tbsize = get_max_size();159 uint32 bsize = get_max_size(); 160 160 161 161 if ( m_data.size() > bsize ) … … 170 170 if ( m_max > 0 ) 171 171 { 172 size_toffset = m_min * value_type_size;173 size_tsize = (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; 174 174 m_context->update( m_buffer, m_data.data() + m_min, offset, size ); 175 175 } … … 180 180 } 181 181 182 size_tget_max_size() const182 uint32 get_max_size() const 183 183 { 184 184 return m_capacity; 185 185 } 186 186 187 size_tget_size() const187 uint32 get_size() const 188 188 { 189 189 return m_data.size(); … … 200 200 } 201 201 private: 202 void create_buffer( size_tsize )202 void create_buffer( uint32 size ) 203 203 { 204 204 m_capacity = size; … … 217 217 uint32 m_capacity; 218 218 219 size_tm_min;220 size_tm_max;219 uint32 m_min; 220 uint32 m_max; 221 221 }; 222 222 -
trunk/nv/gfx/texture_atlas.hh
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/gl/gl_context.hh
r530 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 49 49 virtual texture create_texture( texture_type type, ivec3 size, image_format aformat, sampler asampler, const void* data = nullptr ); 50 50 51 virtual buffer create_buffer( buffer_type type, buffer_hint hint, size_tsize, 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 ); 53 53 54 54 virtual void set_draw_buffers( uint32 count, const output_slot* slots ); … … 66 66 virtual void bind( framebuffer f, framebuffer_slot ft = FRAMEBUFFER ); 67 67 virtual void bind( texture t, texture_slot slot ); 68 virtual void bind( buffer b, uint32 index, size_t offset = 0, size_tsize = 0 );68 virtual void bind( buffer b, uint32 index, uint32 offset = 0, uint32 size = 0 ); 69 69 virtual void bind( buffer b, texture t ); 70 70 71 71 72 72 virtual void update( texture t, const void* data ); 73 virtual void update( buffer b, const void* data, size_t offset, size_tsize );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*/ ); 75 75 virtual void unmap_buffer( buffer ); 76 76 77 // virtual void update( buffer b, uint32 index, const void* data, size_t offset, size_tsize );77 // virtual void update( buffer b, uint32 index, const void* data, uint32 offset, uint32 size ); 78 78 79 79 virtual void clear( const clear_state& cs ); 80 80 // temporary 81 virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, size_t count, size_tfirst = 0 );82 virtual void draw_instanced( primitive prim, const render_state& rs, program p, size_t instances, vertex_array va, size_t count, size_tfirst = 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 ); 83 83 84 84 virtual const ivec4& get_viewport(); -
trunk/nv/gui/gui_gfx_renderer.hh
r491 r534 55 55 virtual ~gfx_renderer(); 56 56 private: 57 texture_font* get_font( size_tname ) const;58 const image_info* get_image( size_tname ) const;57 texture_font* get_font( uint32 name ) const; 58 const image_info* get_image( uint32 name ) const; 59 59 60 size_t load_font( const string_view& filename, size_tsize );61 size_tload_image( const string_view& filename );60 uint32 load_font( const string_view& filename, uint32 size ); 61 uint32 load_image( const string_view& filename ); 62 62 63 typedef hash_store< shash64, size_t> names;63 typedef hash_store< shash64, uint32 > names; 64 64 typedef vector< texture_font* > font_vector; 65 65 typedef vector< image_info > image_vector; -
trunk/nv/image/miniz.hh
r520 r534 1 // Copyright (C) 2015-201 5ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/interface/context.hh
r525 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 107 107 108 108 // TODO: should be private 109 void add_vertex_buffer( slot location, buffer buf, datatype datatype, size_t components, size_t offset = 0, size_tstride = 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 ) 110 110 { 111 111 NV_ASSERT( count < uint16( MAX_ATTRIBUTES ), "MAX_ATTRIBUTES reached!" ); … … 184 184 return create_program( vs, fs ); 185 185 } 186 virtual buffer create_buffer( buffer_type type, buffer_hint hint, size_tsize, 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; 188 188 189 189 … … 204 204 virtual void bind( framebuffer f, framebuffer_slot slot = FRAMEBUFFER ) = 0; 205 205 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; 207 207 virtual void bind( buffer, texture ) = 0; 208 208 209 209 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; 212 212 virtual void unmap_buffer( buffer ) = 0; 213 213 214 214 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; 216 216 217 217 virtual void clear( const clear_state& cs ) = 0; 218 218 // temporary 219 virtual void draw( primitive prim, const render_state& rs, program p, vertex_array va, size_t count, size_tfirst = 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_tfirst = 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_tfirst = 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 ) 223 223 { 224 224 apply_engine_uniforms(p,s); … … 250 250 251 251 template < typename VTX > 252 vertex_array create_vertex_array( const VTX* v, size_tcount, buffer_hint hint )252 vertex_array create_vertex_array( const VTX* v, uint32 count, buffer_hint hint ) 253 253 { 254 254 buffer vb = create_buffer( VERTEX_BUFFER, hint, count * sizeof( VTX ), v ); … … 259 259 260 260 template < typename VTX, typename IDX > 261 vertex_array create_vertex_array( const VTX* v, size_t vcount, const IDX* i, size_ticount, buffer_hint hint )261 vertex_array create_vertex_array( const VTX* v, uint32 vcount, const IDX* i, uint32 icount, buffer_hint hint ) 262 262 { 263 263 buffer vb = this->create_buffer( VERTEX_BUFFER, hint, count * sizeof( VTX ), v ); -
trunk/nv/interface/data_channel.hh
r532 r534 120 120 } 121 121 122 size_tsize() const { return m_size; }123 124 const raw_data_channel* get_channel( size_tindex ) const122 uint32 size() const { return m_size; } 123 124 const raw_data_channel* get_channel( uint32 index ) const 125 125 { 126 126 if ( m_size > index ) return &m_channels[index]; -
trunk/nv/interface/image_data.hh
r500 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 75 75 void fill( uint8 value = 0 ) 76 76 { 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(); 78 78 raw_fill_n( m_data, bsize, value ); 79 79 } … … 82 82 const ivec2 get_size() const { return m_size; } 83 83 // TODO : better depth check (template?) 84 size_tget_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 ); } 85 85 image_format get_format() const { return m_format; } 86 86 ~image_data() { if (m_data) delete[] m_data; } … … 88 88 void initialize( const uint8* data ) 89 89 { 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(); 91 91 m_data = new uint8[ bsize ]; 92 92 if ( data ) -
trunk/nv/interface/mesh_loader.hh
r482 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 31 31 virtual ~mesh_loader() {} 32 32 virtual bool load( stream& source ) = 0; 33 virtual data_channel_set* release_mesh_data( size_tindex, data_node_info& ) = 0;34 virtual size_tget_mesh_count() const = 0;35 virtual size_tget_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; } 39 39 protected: 40 40 inline shash64 make_name( const string_view& name ) -
trunk/nv/lib/assimp.hh
r487 r534 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/lib/freetype2.hh
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/lua/lua_state.hh
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/lua/lua_values.hh
r491 r534 131 131 }; 132 132 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 133 151 template <> 134 152 struct pass_traits<lnumber> … … 213 231 }; 214 232 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 226 252 227 253 template <typename T> -
trunk/nv/stl/math/mat2.hh
r486 r534 28 28 typedef tvec2<T> row_type; 29 29 typedef tmat2<T> this_type; 30 typedef size_tsize_type;30 typedef uint32 size_type; 31 31 typedef T value_type; 32 32 -
trunk/nv/stl/math/mat3.hh
r486 r534 27 27 typedef tvec3<T> row_type; 28 28 typedef tmat3<T> type; 29 typedef size_tsize_type;29 typedef uint32 size_type; 30 30 typedef T value_type; 31 31 -
trunk/nv/stl/math/mat4.hh
r471 r534 28 28 typedef tvec4<T> row_type; 29 29 typedef tmat4<T> this_type; 30 typedef size_tsize_type;30 typedef uint32 size_type; 31 31 typedef T value_type; 32 32 -
trunk/nv/stl/math/relational.hh
r471 r534 1 // Copyright (C) 2015-201 5ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 59 59 { 60 60 bool_vec_t<T> result( no_init ); 61 for ( size_ti = 0; i < nv::size( lhs ); ++i )61 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 62 62 result[i] = lhs[i] < rhs[i]; 63 63 … … 69 69 { 70 70 bool_vec_t<T> result( no_init ); 71 for ( size_ti = 0; i < nv::size( lhs ); ++i )71 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 72 72 result[i] = lhs[i] <= rhs[i]; 73 73 return result; … … 78 78 { 79 79 bool_vec_t<T> result( no_init ); 80 for ( size_ti = 0; i < nv::size( lhs ); ++i )80 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 81 81 result[i] = lhs[i] > rhs[i]; 82 82 return result; … … 87 87 { 88 88 bool_vec_t<T> result( no_init ); 89 for ( size_ti = 0; i < nv::size( lhs ); ++i )89 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 90 90 result[i] = lhs[i] >= rhs[i]; 91 91 return result; … … 96 96 { 97 97 bool_vec_t<T> result( no_init ); 98 for ( size_ti = 0; i < nv::size( lhs ); ++i )98 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 99 99 result[i] = lhs[i] == rhs[i]; 100 100 return result; … … 105 105 { 106 106 bool_vec_t<T> result( no_init ); 107 for ( size_ti = 0; i < nv::size( lhs ); ++i )107 for ( uint32 i = 0; i < nv::size( lhs ); ++i ) 108 108 result[i] = lhs[i] != rhs[i]; 109 109 return result; … … 114 114 { 115 115 bool result = false; 116 for ( size_ti = 0; i < nv::size( v ); ++i )116 for ( uint32 i = 0; i < nv::size( v ); ++i ) 117 117 result = result || v[i]; 118 118 return result; … … 123 123 { 124 124 bool result = true; 125 for ( size_ti = 0; i < nv::size( v ); ++i )125 for ( uint32 i = 0; i < nv::size( v ); ++i ) 126 126 result = result && v[i]; 127 127 return result; … … 132 132 { 133 133 T result( no_init ); 134 for ( size_ti = 0; i < nv::size( v ); ++i )134 for ( uint32 i = 0; i < nv::size( v ); ++i ) 135 135 result[i] = !v[i]; 136 136 return result; -
trunk/nv/stl/math/vec2.hh
r486 r534 28 28 typedef T value_type; 29 29 30 static constexpr size_tSIZE = 2;30 static constexpr uint32 SIZE = 2; 31 31 32 32 union … … 37 37 }; 38 38 39 typedef size_tsize_type;39 typedef uint32 size_type; 40 40 inline constexpr size_type size() const { return 2; } 41 41 -
trunk/nv/stl/math/vec3.hh
r471 r534 26 26 typedef tvec3<T> type; 27 27 typedef T value_type; 28 static constexpr size_tSIZE = 3;28 static constexpr uint32 SIZE = 3; 29 29 30 30 union … … 35 35 }; 36 36 37 typedef size_tsize_type;37 typedef uint32 size_type; 38 38 inline constexpr size_type size() const { return 3; } 39 39 -
trunk/nv/stl/math/vec4.hh
r471 r534 27 27 typedef tvec4<T> type; 28 28 typedef T value_type; 29 static constexpr size_tSIZE = 4;29 static constexpr uint32 SIZE = 4; 30 30 31 31 union … … 36 36 }; 37 37 38 typedef size_tsize_type;38 typedef uint32 size_type; 39 39 inline constexpr size_type size() const { return 4; } 40 40 -
trunk/nv/stl/string/string_base.hh
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/nv/stl/string/string_twine.hh
r533 r534 1 // Copyright (C) 2015-201 5ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/bullet/bullet_helper.hh
r520 r534 1 // Copyright (C) 2016 ChaosForge Ltd1 // Copyright (C) 2016-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/core/logger.cc
r533 r534 1 // Copyright (C) 2011-201 5ChaosForge Ltd1 // Copyright (C) 2011-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/core/profiler.cc
r533 r534 1 // Copyright (C) 2012-201 4ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/core/random.cc
r533 r534 1 // Copyright (C) 2012-201 4ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/engine/mesh_manager.cc
r522 r534 35 35 nv::string_view sub_mesh_name; 36 36 nv::string128 base_mesh_name( path ); 37 nv:: size_tsub_mesh_pos = path.find( ":" );38 nv:: size_tdot_pos = path.find( "." );37 nv::uint32 sub_mesh_pos = path.find( ":" ); 38 nv::uint32 dot_pos = path.find( "." ); 39 39 if ( sub_mesh_pos != nv::string_view::npos ) 40 40 { -
trunk/src/engine/particle_engine.cc
r532 r534 196 196 datap->plane_normal = normalize_safe( datap->plane_normal, vec3(0.0f,1.0f,0.0f) ); 197 197 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 ) ) ); 199 199 return true; 200 200 } -
trunk/src/engine/program_manager.cc
r505 r534 50 50 stream* fstream = open_stream( fs, path ); 51 51 if ( !fstream ) return const_string(); 52 uint32 size = fstream->size();52 uint32 size = static_cast< uint32 >( fstream->size() ); 53 53 const_string result( nullptr, size ); 54 54 fstream->read( const_cast<char*>( result.data() ), size, 1 ); -
trunk/src/formats/assimp_loader.cc
r491 r534 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 107 107 m_mesh_count = 0; 108 108 NV_LOG_NOTICE( "AssImp loading file..." ); 109 size_t size = source.size();109 uint32 size = static_cast< uint32 >( source.size() ); 110 110 char* data = new char[ size ]; 111 111 source.read( data, size, 1 ); … … 143 143 } 144 144 145 data_channel_set* nv::assimp_loader::release_mesh_data( size_tindex, data_node_info& info )145 data_channel_set* nv::assimp_loader::release_mesh_data( uint32 index, data_node_info& info ) 146 146 { 147 147 if ( index >= m_mesh_count ) return nullptr; … … 149 149 return m_meshes[index]; 150 150 } 151 void nv::assimp_loader::load_mesh_data( data_channel_set* data, size_tindex, data_node_info& info )151 void nv::assimp_loader::load_mesh_data( data_channel_set* data, uint32 index, data_node_info& info ) 152 152 { 153 153 const aiMesh* mesh = m_data->scene->mMeshes[ index ]; … … 161 161 desc.initialize< assimp_plain_vtx >(); 162 162 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 ) ); 164 164 if ( mesh->mName.length == 0 ) 165 165 { … … 170 170 if ( node->mMeshes[i] == index ) 171 171 { 172 name.assign( node->mName.data, node->mName.length);172 name.assign( node->mName.data, static_cast< uint32 >( node->mName.length ) ); 173 173 if ( i != 0 ) 174 174 { … … 215 215 { 216 216 aiBone* bone = mesh->mBones[m]; 217 for ( size_tw=0; w<bone->mNumWeights; w++)217 for ( uint32 w=0; w<bone->mNumWeights; w++) 218 218 { 219 219 assimp_skinned_vtx& v = vtx[ bone->mWeights[w].mVertexId ]; 220 220 bool found = false; 221 for ( size_ti = 0 ; i < 4; ++i )221 for ( uint32 i = 0 ; i < 4; ++i ) 222 222 { 223 223 if ( v.boneweight[i] <= 0.0f ) … … 281 281 aiMesh* mesh = m_data->scene->mMeshes[mc]; 282 282 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 ) ) ); 284 284 NV_LOG_NOTICE( " bones - ", mesh->mNumBones ); 285 285 NV_LOG_NOTICE( " uvs - ", mesh->mNumUVComponents[0] ); … … 303 303 for ( auto node : m_data->nodes ) 304 304 { 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 ) ) ); 306 306 } 307 307 308 308 for ( auto skeleton : m_data->skeletons ) 309 309 { 310 NV_LOG_NOTICE( "Skeleton : ", string_view( skeleton->mName.data, s keleton->mName.length) );310 NV_LOG_NOTICE( "Skeleton : ", string_view( skeleton->mName.data, static_cast< uint32 >( skeleton->mName.length ) ) ); 311 311 } 312 312 … … 353 353 } 354 354 355 string_view name( ainode->mName.data, ainode->mName.length);355 string_view name( ainode->mName.data, static_cast< uint32 >( ainode->mName.length ) ); 356 356 if ( name.starts_with( '_' ) ) return; 357 357 … … 409 409 { 410 410 assimp_skinned_vtx& vertex = channel.data()[v]; 411 for ( size_ti = 0; i < 4; ++i )411 for ( uint32 i = 0; i < 4; ++i ) 412 412 { 413 413 if ( vertex.boneweight[i] > 0.0f ) … … 430 430 int pid = bone_data[i].parent_id; 431 431 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; 433 433 else 434 434 bone_data[i].transform = tr; … … 447 447 } 448 448 449 mesh_nodes_data* nv::assimp_loader::release_mesh_nodes_data( size_tindex /*= 0*/ )449 mesh_nodes_data* nv::assimp_loader::release_mesh_nodes_data( uint32 index /*= 0*/ ) 450 450 { 451 451 if ( m_data->scene == nullptr ) return nullptr; … … 484 484 } 485 485 486 data_node_list* nv::assimp_loader::release_data_node_list( size_t/*= 0 */ )486 data_node_list* nv::assimp_loader::release_data_node_list( uint32 /*= 0 */ ) 487 487 { 488 488 return release_merged_bones(); 489 489 } 490 490 491 bool nv::assimp_loader::is_animated( size_t/*= 0 */ )491 bool nv::assimp_loader::is_animated( uint32 /*= 0 */ ) 492 492 { 493 493 int this_is_incorrect; … … 623 623 // bool has_bones = false; 624 624 // data_channel_set* meshes = data_channel_set_creator::create_set_array( m_mesh_count, 2 ); 625 // for ( size_tm = 0; m < m_mesh_count; ++m )625 // for ( uint32 m = 0; m < m_mesh_count; ++m ) 626 626 // { 627 627 // const aiMesh* mesh = scene->mMeshes[ m ]; … … 635 635 // } 636 636 637 nv::size_tnv::assimp_loader::get_nodes_data_count() const637 uint32 nv::assimp_loader::get_nodes_data_count() const 638 638 { 639 639 if ( m_data->scene == nullptr ) return 0; -
trunk/src/formats/nmd_loader.cc
r487 r534 1 // Copyright (C) 2014-201 5ChaosForge Ltd1 // Copyright (C) 2014-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 45 45 } 46 46 47 data_channel_set* nv::nmd_loader::release_mesh_data( size_tindex, data_node_info& info )47 data_channel_set* nv::nmd_loader::release_mesh_data( uint32 index, data_node_info& info ) 48 48 { 49 49 data_channel_set* result = m_meshes[ index ]; … … 158 158 } 159 159 160 mesh_nodes_data* nv::nmd_loader::release_mesh_nodes_data( size_t)160 mesh_nodes_data* nv::nmd_loader::release_mesh_nodes_data( uint32 ) 161 161 { 162 162 return nullptr; 163 163 } 164 164 165 data_node_list* nv::nmd_loader::release_data_node_list( size_t)165 data_node_list* nv::nmd_loader::release_data_node_list( uint32 ) 166 166 { 167 167 data_node_list* result = m_bone_data; … … 170 170 } 171 171 172 bool nv::nmd_loader::is_animated( size_t/*= 0 */ )172 bool nv::nmd_loader::is_animated( uint32 /*= 0 */ ) 173 173 { 174 174 return m_pose_data_set != nullptr; -
trunk/src/formats/obj_loader.cc
r482 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 52 52 string32 next_name; 53 53 54 nv::size_tsize;54 uint32 size; 55 55 bool eof; 56 56 57 57 obj_reader(); 58 58 bool read_stream( stream& str ); 59 virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_tcount ) = 0;60 virtual nv::size_traw_size() const = 0;59 virtual uint32 add_face( uint32* vi, uint32* ti, uint32* ni, uint32 count ) = 0; 60 virtual uint32 raw_size() const = 0; 61 61 virtual void reset() = 0; 62 62 virtual const uint8* raw_pointer() const = 0; … … 126 126 string_view scan( cline ); 127 127 scan.remove_prefix( 2 ); 128 size_tpos = 0;128 uint32 pos = 0; 129 129 while ( pos != string_view::npos ) 130 130 { … … 176 176 { 177 177 mesh_data_reader( bool normals ) : m_normals( normals ) {} 178 virtual nv::size_t add_face( uint32* vi, uint32* ti, uint32* ni, nv::size_tcount )178 virtual uint32 add_face( uint32* vi, uint32* ti, uint32* ni, uint32 count ) 179 179 { 180 180 if ( count < 3 ) return 0; // TODO : report error? … … 182 182 // TODO : support if normals not present; 183 183 vec3 nullvec; 184 nv::size_tresult = 0;184 uint32 result = 0; 185 185 // Simple triangulation - obj's shouldn't have more than quads anyway 186 186 187 187 if ( m_normals ) 188 188 { 189 for ( nv::size_ti = 2; i < count; ++i )189 for ( uint32 i = 2; i < count; ++i ) 190 190 { 191 191 result++; … … 197 197 else 198 198 { 199 for ( nv::size_ti = 2; i < count; ++i )199 for ( uint32 i = 2; i < count; ++i ) 200 200 { 201 201 result++; … … 210 210 vector< VTX > m_data; 211 211 virtual void reset() { m_data.clear(); } 212 virtual nv::size_traw_size() const { return m_data.size() * sizeof( VTX ); }212 virtual uint32 raw_size() const { return m_data.size() * sizeof( VTX ); } 213 213 virtual const uint8* raw_pointer() const { return reinterpret_cast< const uint8* >( m_data.data() ); } 214 214 }; … … 232 232 void calculate_tangents() 233 233 { 234 nv::size_tcount = m_data.size();235 nv::size_ttcount = count / 3;234 uint32 count = m_data.size(); 235 uint32 tcount = count / 3; 236 236 237 237 vector< vec3 > tan1( count ); 238 238 vector< vec3 > tan2( count ); 239 239 240 for ( nv::size_ta = 0; a < tcount; ++a )241 { 242 nv::size_ti1 = a * 3;243 nv::size_ti2 = a * 3 + 1;244 nv::size_ti3 = 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; 245 245 obj_vertex_vtnt& vtx1 = m_data[ i1 ]; 246 246 obj_vertex_vtnt& vtx2 = m_data[ i2 ]; … … 277 277 } 278 278 279 for ( nv::size_ta = 0; a < count; ++a )279 for ( uint32 a = 0; a < count; ++a ) 280 280 { 281 281 const vec3& nv = m_data[a].normal; … … 347 347 } 348 348 349 data_channel_set* nv::obj_loader::release_mesh_data( size_tindex, data_node_info& info )349 data_channel_set* nv::obj_loader::release_mesh_data( uint32 index, data_node_info& info ) 350 350 { 351 351 data_channel_set* result = m_meshes[ index ]; -
trunk/src/gfx/image.cc
r505 r534 1 // Copyright (C) 2011-201 5ChaosForge Ltd1 // Copyright (C) 2011-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 10 10 using namespace nv; 11 11 12 image::image( ivec2 size, nv::size_tdepth )12 image::image( ivec2 size, uint32 depth ) 13 13 : m_size( size ), m_depth( depth ), m_data( nullptr ) 14 14 { … … 23 23 24 24 25 image::image( ivec2 size, nv::size_tdepth, const uint8 * data, bool reversed )25 image::image( ivec2 size, uint32 depth, const uint8 * data, bool reversed ) 26 26 : m_size( size ), m_depth( depth ), m_data( nullptr ) 27 27 { 28 28 NV_ASSERT( size.x >= 0 && size.y >= 0, "bad parameters passed to image!" ); 29 29 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 ) ]; 31 31 32 32 if ( reversed ) … … 97 97 uint32 rsizey = static_cast< uint32 >( r.size.y ); 98 98 const uint8* data = idata->get_data(); 99 size_tdepth = idata->get_depth();100 size_tcdepth = m_depth > depth ? depth : m_depth;99 uint32 depth = idata->get_depth(); 100 uint32 cdepth = m_depth > depth ? depth : m_depth; 101 101 uint32 dstride = rsizex * depth; 102 102 … … 107 107 { 108 108 uint32 xy = pos + x * m_depth; 109 for( size_te = 0; e < cdepth; ++e )109 for( uint32 e = 0; e < cdepth; ++e ) 110 110 { 111 111 m_data[ xy + e ] = data[ y*dstride + x * depth + e ]; -
trunk/src/gfx/mesh_creator.cc
r532 r534 15 15 void nv::mesh_nodes_creator::merge_keys() 16 16 { 17 for ( size_ti = 0; i < m_data->size(); ++i )17 for ( uint32 i = 0; i < m_data->size(); ++i ) 18 18 { 19 19 data_channel_set* old_keys = m_data->m_data[i]; 20 20 if ( old_keys && old_keys->size() > 0 ) 21 21 { 22 size_tchan_count = old_keys->size();22 uint32 chan_count = old_keys->size(); 23 23 if ( chan_count == 1 24 24 && old_keys->get_channel(0)->descriptor().size() == 1 … … 516 516 NV_ASSERT( a.size() % frame_count == 0, "Merge - append first mesh empty!" ); 517 517 NV_ASSERT( b.size() % frame_count == 0, "Merge - append second mesh empty!" ); 518 size_tvtx_size = a.element_size();518 uint32 vtx_size = a.element_size(); 519 519 520 520 raw_data_channel result = data_channel_creator::create( a.descriptor(), a.size() + b.size() ); … … 523 523 if ( frame_count == 1 ) 524 524 { 525 size_ta_size = vtx_size * a.size();525 uint32 a_size = vtx_size * a.size(); 526 526 raw_copy_n( a.raw_data(), a_size, rdata ); 527 527 raw_copy_n( b.raw_data(), vtx_size * b.size(), rdata + a_size ); … … 529 529 else 530 530 { 531 size_tframe_size_a = ( a.size() / frame_count ) * vtx_size;532 size_tframe_size_b = ( b.size() / frame_count ) * vtx_size;533 size_tpos_a = 0;534 size_tpos_b = 0;535 size_tpos = 0;536 for ( size_ti = 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 ) 537 537 { 538 538 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-201 5ChaosForge Ltd1 // Copyright (C) 2011-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/gfx/texture_atlas.cc
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/gl/gl_context.cc
r523 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 311 311 } 312 312 313 void nv::gl_context::bind( buffer b, uint32 index, size_t offset /*= 0*/, size_tsize /*= 0 */ )313 void nv::gl_context::bind( buffer b, uint32 index, uint32 offset /*= 0*/, uint32 size /*= 0 */ ) 314 314 { 315 315 const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) ); … … 465 465 } 466 466 467 void* nv::gl_context::map_buffer( buffer b, buffer_access ba, size_t offset, size_tlength )467 void* nv::gl_context::map_buffer( buffer b, buffer_access ba, uint32 offset, uint32 length ) 468 468 { 469 469 const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) ); … … 492 492 } 493 493 494 // void nv::gl_context::update( buffer b, uint32 index, const void* data, size_t offset, size_tsize )494 // void nv::gl_context::update( buffer b, uint32 index, const void* data, uint32 offset, uint32 size ) 495 495 // { 496 496 // const gl_buffer_info* info = static_cast<const gl_buffer_info*>( m_device->get_buffer_info( b ) ); … … 506 506 // } 507 507 508 void gl_context::update( buffer b, const void* data, nv:: size_t offset, nv::size_tsize )508 void gl_context::update( buffer b, const void* data, nv::uint32 offset, nv::uint32 size ) 509 509 { 510 510 const gl_buffer_info* info = static_cast< const gl_buffer_info* >( m_device->get_buffer_info( b ) ); … … 1020 1020 } 1021 1021 1022 nv::buffer nv::gl_context::create_buffer( buffer_type type, buffer_hint hint, size_tsize, const void* source /*= nullptr */ )1022 nv::buffer nv::gl_context::create_buffer( buffer_type type, buffer_hint hint, uint32 size, const void* source /*= nullptr */ ) 1023 1023 { 1024 1024 buffer result = static_cast<gl_device*>( m_device )->create_buffer( type, hint ); … … 1027 1027 } 1028 1028 1029 void nv::gl_context::create_buffer( buffer b, size_tsize, const void* source /*= nullptr */ )1029 void nv::gl_context::create_buffer( buffer b, uint32 size, const void* source /*= nullptr */ ) 1030 1030 { 1031 1031 gl_buffer_info* info = static_cast<gl_device*>( m_device )->get_full_buffer_info( b ); … … 1067 1067 } 1068 1068 1069 void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv:: size_t count, nv::size_tfirst )1069 void gl_context::draw( primitive prim, const render_state& rs, program p, vertex_array va, nv::uint32 count, nv::uint32 first ) 1070 1070 { 1071 1071 apply_render_state( rs ); … … 1077 1077 if ( info->index.is_valid() ) 1078 1078 { 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 ) ) ); 1080 1080 } 1081 1081 else … … 1088 1088 } 1089 1089 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_tfirst /*= 0 */ )1090 void nv::gl_context::draw_instanced( primitive prim, const render_state& rs, program p, uint32 instances, vertex_array va, uint32 count, uint32 first /*= 0 */ ) 1091 1091 { 1092 1092 apply_render_state( rs ); … … 1098 1098 if ( info->index.is_valid() ) 1099 1099 { 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 ); 1101 1101 } 1102 1102 else -
trunk/src/gl/gl_device.cc
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/gui/gui_gfx_renderer.cc
r501 r534 109 109 { 110 110 public: 111 screen_render_data( context* actx, nv:: size_tinitial_size )111 screen_render_data( context* actx, nv::uint32 initial_size ) 112 112 : buffer( actx, VERTEX_BUFFER, DYNAMIC_DRAW, initial_size ), ctx( actx ), varray(), shader() 113 113 { … … 147 147 m_area.dim( dimension( w->get_width(), w->get_height() ) ); 148 148 region white = m_atlas.get_region( ivec2( 3, 3 ) ); 149 size_twsize = m_atlas.get_depth() * 4 * 4;149 uint32 wsize = m_atlas.get_depth() * 4 * 4; 150 150 uint8* wfill = new uint8[m_atlas.get_depth() * 4 * 4]; 151 151 raw_fill( wfill, wfill + wsize, 255 ); … … 178 178 } 179 179 180 texture_font* gfx_renderer::get_font( nv:: size_tname ) const180 texture_font* gfx_renderer::get_font( nv::uint32 name ) const 181 181 { 182 182 if ( name >= m_fonts.size() ) return nullptr; … … 184 184 } 185 185 186 const image_info* gfx_renderer::get_image( nv:: size_tname ) const186 const image_info* gfx_renderer::get_image( nv::uint32 name ) const 187 187 { 188 188 if ( name >= m_images.size() ) return nullptr; … … 190 190 } 191 191 192 nv:: size_t gfx_renderer::load_font( const string_view& filename, nv::size_tsize )192 nv::uint32 gfx_renderer::load_font( const string_view& filename, nv::uint32 size ) 193 193 { 194 194 string128 id( filename ); … … 199 199 return i->second; 200 200 } 201 size_tresult = m_fonts.size();201 uint32 result = m_fonts.size(); 202 202 texture_font* f = new texture_font( &m_atlas, filename.data(), static_cast<float>( size ) ); 203 203 f->load_glyphs( "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ " ); … … 208 208 } 209 209 210 nv:: size_tgfx_renderer::load_image( const string_view& filename )210 nv::uint32 gfx_renderer::load_image( const string_view& filename ) 211 211 { 212 212 auto i = m_image_names.find( filename ); … … 215 215 return i->second; 216 216 } 217 size_tresult = m_images.size();217 uint32 result = m_images.size(); 218 218 image_data* data = m_window->get_device()->create_image_data( filename ); 219 219 // TODO: Repitching … … 236 236 } 237 237 element_render_data* er = reinterpret_cast< element_render_data* >( e->m_render_data ); 238 size_tsize_before = er->buffer.data().size();238 uint32 size_before = er->buffer.data().size(); 239 239 240 240 vector< gui_quad >& qvec = er->buffer.lock(); … … 254 254 if ( m_style.get( e, "skin", selector, path ) ) 255 255 { 256 size_timage_id = load_image( path );256 uint32 image_id = load_image( path ); 257 257 const image_info* image = get_image( image_id ); 258 258 if ( image ) … … 319 319 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 ) ) 320 320 { 321 size_t font_id = load_font( path, size_t( border ) );321 uint32 font_id = load_font( path, uint32( border ) ); 322 322 texture_font* font = get_font( font_id ); 323 323 position p = abs.ul + position( 0, border ); -
trunk/src/gui/gui_style.cc
r487 r534 33 33 if ( !resolve( e->m_id, e->m_class, cselector, centry, LUA_TTABLE ) ) return false; 34 34 vec = vec4(); 35 for ( size_ti = 0; i < 4; ++i )35 for ( uint32 i = 0; i < 4; ++i ) 36 36 { 37 37 lua_rawgeti( m_lua, -1, int(i+1) ); -
trunk/src/image/miniz.cc
r533 r534 1166 1166 TINFL_GET_BYTE( 1, r->m_zhdr0 ); TINFL_GET_BYTE( 2, r->m_zhdr1 ); 1167 1167 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 ) ) ) ) ); 1169 1169 if ( counter ) { TINFL_CR_RETURN_FOREVER( 36, TINFL_STATUS_FAILED ); } 1170 1170 } -
trunk/src/image/png_loader.cc
r487 r534 1 // Copyright (C) 2015-201 5ChaosForge Ltd1 // Copyright (C) 2015-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 251 251 int remaining() 252 252 { 253 return m_img_buffer_end - m_img_buffer;253 return (int)( m_img_buffer_end - m_img_buffer ); 254 254 } 255 255 … … 865 865 866 866 case STBI__PNG_TYPE( 'I', 'E', 'N', 'D' ): { 867 uint32 raw_len, bpl; 867 size_t raw_len; 868 uint32 bpl; 868 869 if ( first ) return stbi__err( "first not IHDR", "Corrupt PNG" ); 869 870 if ( scan != STBI__SCAN_load ) return 1; … … 882 883 else 883 884 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; 885 886 if ( has_trans ) 886 887 if ( !stbi__compute_transparency( z, tc, s->img_out_n ) ) return 0; … … 977 978 static int stbi__stream_read( void *user, char *data, int size ) 978 979 { 979 return reinterpret_cast<stream*>( user )->read( data, 1, size );980 return (int)reinterpret_cast<stream*>( user )->read( data, 1, size ); 980 981 } 981 982 … … 1022 1023 if ( stbi__png_info( &s, &x, &y, &comp ) == 1 ) 1023 1024 { 1024 str.seek( pos, origin::SET );1025 str.seek( (long)pos, origin::SET ); 1025 1026 format.type = UBYTE; 1026 1027 switch ( comp ) -
trunk/src/image/png_writer.cc
r529 r534 372 372 ivec2 sz = data->get_size(); 373 373 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 ); 375 375 if ( !out ) return false; 376 376 s.write( out, 1, len ); -
trunk/src/io/c_file_system.cc
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // -
trunk/src/lua/lua_math.cc
r529 r534 11 11 #include "nv/stl/type_traits/common.hh" 12 12 13 static size_t nlua_swizzel_lookup[256]; 13 using nv::uint32; 14 static nv::uint32 nlua_swizzel_lookup[256]; 14 15 15 16 using nv::lua::detail::is_vec; … … 18 19 using nv::lua::detail::push_vec; 19 20 20 inline bool nlua_is_swizzel( const unsigned char* str, size_tmax )21 inline bool nlua_is_swizzel( const unsigned char* str, nv::uint32 max ) 21 22 { 22 23 while (*str) … … 229 230 { 230 231 T v = to_vec<T>( L, 1 ); 231 for ( size_ti = 0; i < v.size(); ++i )232 for ( uint32 i = 0; i < v.size(); ++i ) 232 233 { 233 234 lua_pushnumber( L, v[i] ); … … 241 242 T* v = to_pvec<T>( L, 1 ); 242 243 size_t len = 0; 243 size_tvlen = v->size();244 uint32 vlen = v->size(); 244 245 const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) ); 245 size_tidx = 255;246 uint32 idx = 255; 246 247 247 248 if ( len == 1 ) … … 279 280 T* v = to_pvec<T>( L, 1 ); 280 281 size_t len = 0; 281 size_tvlen = v->size();282 uint32 vlen = v->size(); 282 283 const unsigned char * key = reinterpret_cast<const unsigned char *>( lua_tolstring( L, 2, &len ) ); 283 size_tidx = 255;284 uint32 idx = 255; 284 285 if( len == 1 ) 285 286 { … … 294 295 { 295 296 switch (len) { 296 case 2 : { vec2 v2 = to_vec<vec2>(L,3); for ( size_ti = 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_ti = 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_ti = 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; 299 300 default: break; 300 301 } … … 405 406 void nv::lua::register_math( lua::state* state ) 406 407 { 407 for ( size_ti = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255;408 for (uint32 i = 0; i < 256; ++i ) nlua_swizzel_lookup[i] = 255; 408 409 using nv::uchar8; 409 410 nlua_swizzel_lookup[uchar8( 'x' )] = 0; -
trunk/src/lua/lua_nova.cc
r490 r534 91 91 if (lua_tointeger( L, itype ) != lua_type( L, ivalue ) && lua_tointeger( L, itype ) > 0) 92 92 { 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 ) ) ); 94 94 } 95 95 break; … … 296 296 lua_rawget( L, 1 ); 297 297 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 ); 299 299 lua_pop( L, 1 ); 300 300 count++; … … 358 358 static int nova_create_seq_function_closure( lua_State * L ) 359 359 { 360 int fc = lua_tointeger( L, lua_upvalueindex( 1 ) );360 int fc = (int)lua_tointeger( L, lua_upvalueindex( 1 ) ); 361 361 int args = lua_gettop( L ); 362 362 for ( int fi = 1; fi <= fc; fi++ ) -
trunk/src/lua/lua_path.cc
r490 r534 16 16 string_view spath( m_elements[0].str, m_elements[0].length ); 17 17 m_count = 0; 18 size_tpoint = spath.find( '.' );18 uint32 point = spath.find( '.' ); 19 19 20 20 while ( point != string_view::npos ) -
trunk/src/lua/lua_raw.cc
r494 r534 331 331 int nlua_rawlen( lua_State* L, int index ) 332 332 { 333 return lua_objlen( L, index);333 return static_cast<int>( lua_objlen( L, index ) ); 334 334 } 335 335 -
trunk/src/lua/lua_state.cc
r533 r534 911 911 if ( lua_type( state->get_raw(), index ) == LUA_TBOOLEAN ) 912 912 { 913 *value = bool( lua_toboolean( state->get_raw(), index ) );913 *value = lua_toboolean( state->get_raw(), index ) != 0; 914 914 return true; 915 915 } -
trunk/src/lua/lua_types.cc
r503 r534 1 // Copyright (C) 2016-201 6ChaosForge Ltd1 // Copyright (C) 2016-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 // … … 85 85 { 86 86 int error; // proper type instead of sint32? 87 *(sint32*)object = lua_tointeger( lstate, index );87 *(sint32*)object = (sint32)lua_tointeger( lstate, index ); 88 88 return true; 89 89 } -
trunk/src/lua/lua_values.cc
r533 r534 1 // Copyright (C) 2012-201 5ChaosForge Ltd1 // Copyright (C) 2012-2017 ChaosForge Ltd 2 2 // http://chaosforge.org/ 3 3 //
Note: See TracChangeset
for help on using the changeset viewer.