- Timestamp:
- 06/02/15 20:56:15 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/assimp_loader.cc
r382 r383 188 188 } 189 189 190 bool nv::assimp_loader::load_bones( size_t index, std::vector< mesh_node_data >&bones )190 bool nv::assimp_loader::load_bones( size_t index, array_ref< mesh_node_data > bones ) 191 191 { 192 192 if ( m_scene == nullptr ) return false; … … 285 285 { 286 286 const aiScene* scene = (const aiScene*)m_scene; 287 std::vector< mesh_node_data > final_bones;287 vector< mesh_node_data > final_bones; 288 288 std::unordered_map< std::string, uint16 > names; 289 289 for ( unsigned int m = 0; m < m_mesh_count; ++m ) 290 290 { 291 291 uint16 translate[MAX_BONES]; 292 std::vector< mesh_node_data > bones;292 vector< mesh_node_data > bones; 293 293 const aiMesh* mesh = scene->mMeshes[ m ]; 294 294 if ( mesh->mNumBones != 0 ) … … 334 334 } 335 335 mesh_node_data* bones = new mesh_node_data[ final_bones.size() ]; 336 std::copy( final_bones.begin(), final_bones.end(), bones );336 nv::raw_copy( final_bones.begin(), final_bones.end(), bones ); 337 337 return new mesh_nodes_data( "bones", final_bones.size(), bones ); 338 338 } -
trunk/src/formats/md2_loader.cc
r376 r383 251 251 uint32 stats_collision = 0; 252 252 253 std::vector< sint32 > index_translation( static_cast< uint32 >( md2->header.num_vertices ), -1 );253 vector< sint32 > index_translation( static_cast< uint32 >( md2->header.num_vertices ), -1 ); 254 254 255 255 m_new_indexes.clear(); … … 364 364 { 365 365 uint16* icp = (uint16*)ic->data; 366 std::copy_n( m_new_indexes.data(), m_new_indexes.size(), icp );366 raw_copy_n( m_new_indexes.data(), m_new_indexes.size(), icp ); 367 367 } 368 368 -
trunk/src/formats/md3_loader.cc
r376 r383 198 198 md3->tags = new md3_tag_t [ md3->header.num_tags * md3->header.num_frames ]; 199 199 md3->surfaces = new md3_surface_t[ md3->header.num_surfaces ]; 200 std::memset( md3->surfaces, 0, static_cast< nv::size_t >( md3->header.num_surfaces ) * sizeof( md3_surface_t) );200 nv::raw_zero_n( md3->surfaces, static_cast< nv::size_t >( md3->header.num_surfaces ) ); 201 201 202 202 source.seek( md3->header.ofs_frames, origin::SET ); … … 285 285 } 286 286 287 nv::key_raw_channel* nv::md3_loader::load_tags( const st d::string& tag )287 nv::key_raw_channel* nv::md3_loader::load_tags( const string_ref& tag ) 288 288 { 289 289 md3_t* md3 = (md3_t*)m_md3; … … 295 295 { 296 296 const md3_tag_t& rtag = md3->tags[i + md3->header.num_tags * f]; 297 st d::stringrname((char*)(rtag.name));297 string_ref rname((char*)(rtag.name)); 298 298 if (rname == tag) 299 299 { … … 421 421 md3_t* md3 = (md3_t*)m_md3; 422 422 uint32 node_count = (uint32)md3->header.num_tags; 423 if ( node_count == 0 ) return nullptr; ;423 if ( node_count == 0 ) return nullptr; 424 424 mesh_node_data* nodes = new mesh_node_data[ node_count ]; 425 425 for ( uint32 i = 0; i < node_count; ++i ) 426 426 { 427 427 const md3_tag_t& rtag = md3->tags[i]; 428 st d::stringname( (char*)(rtag.name) );428 string_ref name( (char*)(rtag.name) ); 429 429 430 430 nodes[i].transform = mat4(); 431 nodes[i].name = name ;431 nodes[i].name = name.to_string(); 432 432 nodes[i].parent_id = -1; 433 433 nodes[i].target_id = -1; -
trunk/src/formats/md5_loader.cc
r376 r383 48 48 49 49 // MESH data 50 std::vector<md5_joint_info> joint_infos;51 std::vector<transform>base_frames;50 dynamic_array< md5_joint_info > joint_infos; 51 vector< transform > base_frames; 52 52 size_t num_animated_components = 0; 53 53 size_t frame_rate = 0; … … 301 301 else if ( command == "frame" ) 302 302 { 303 std::vector<float> frame;303 vector<float> frame; 304 304 uint32 frame_id; 305 305 sstream >> frame_id; … … 454 454 } 455 455 456 void md5_loader::build_frame_skeleton( mesh_node_data* nodes, uint32 index, const std::vector<md5_joint_info>& joint_infos, const std::vector<transform>& base_frames, const std::vector<float>& frame_data )456 void md5_loader::build_frame_skeleton( mesh_node_data* nodes, uint32 index, const const_array_ref<md5_joint_info>& joint_infos, const const_array_ref<transform>& base_frames, const const_array_ref<float>& frame_data ) 457 457 { 458 458 assert( m_type == ANIMATION ); -
trunk/src/formats/nmd_loader.cc
r368 r383 162 162 static void nmd_dump_mesh( const mesh_data* mesh, stream& stream_out ) 163 163 { 164 const std::vector< mesh_raw_channel* >&data = mesh->get_raw_channels();164 const_array_ref< mesh_raw_channel* > data = mesh->get_raw_channels(); 165 165 166 166 uint32 size = sizeof( nmd_element_header ); -
trunk/src/formats/obj_loader.cc
r382 r383 44 44 struct obj_reader 45 45 { 46 std::vector< vec3 > v;47 std::vector< vec3 > n;48 std::vector< vec2 > t;46 vector< vec3 > v; 47 vector< vec3 > n; 48 vector< vec2 > t; 49 49 50 50 std::string line; … … 204 204 } 205 205 bool m_normals; 206 std::vector< VTX > m_data;206 vector< VTX > m_data; 207 207 virtual void reset() { m_data.clear(); } 208 208 virtual nv::size_t raw_size() const { return m_data.size() * sizeof( VTX ); } … … 228 228 void calculate_tangents() 229 229 { 230 // const std::vector< vec3 >& vp = m_mesh->get_positions();231 // const std::vector< vec2 >& vt = m_mesh->get_texcoords();232 // const std::vector< vec3 >& vn = m_mesh->get_normals();233 // std::vector< vec3 >& tg = m_mesh->get_tangents();234 235 230 nv::size_t count = m_data.size(); 236 231 nv::size_t tcount = count / 3; 237 232 238 std::vector< vec3 > tan1( count );239 std::vector< vec3 > tan2( count );233 vector< vec3 > tan1( count ); 234 vector< vec3 > tan2( count ); 240 235 241 236 for ( nv::size_t a = 0; a < tcount; ++a ) … … 335 330 { 336 331 data = new uint8[ reader->raw_size() ]; 337 std::copy_n( reader->raw_pointer(), reader->raw_size(), data );332 raw_copy_n( reader->raw_pointer(), reader->raw_size(), data ); 338 333 } 339 334 channel->data = data; -
trunk/src/gfx/image.cc
r376 r383 4 4 5 5 #include "nv/gfx/image.hh" 6 #include "nv/stl/algorithm.hh" 6 7 7 8 using namespace nv; … … 31 32 for( int i = 0; i < m_size.y; ++i ) 32 33 { 33 std::copy( data + i * bline, data + (i + 1) * bline, m_data + bsize - ( i + 1 ) * bline );34 raw_copy( data + i * bline, data + (i + 1) * bline, m_data + bsize - ( i + 1 ) * bline ); 34 35 } 35 36 … … 37 38 else 38 39 { 39 std::copy( data, data + bsize, m_data );40 raw_copy( data, data + bsize, m_data ); 40 41 } 41 42 } … … 43 44 void image::fill( uint8 value ) 44 45 { 45 std::fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value );46 raw_fill( m_data, m_data + m_size.x * m_size.y * (int)m_depth, value ); 46 47 } 47 48 … … 56 57 { 57 58 // TODO: test 58 std::fill( m_data + bpos + bline * i, m_data + bpos + bline * i + stride, value );59 raw_fill( m_data + bpos + bline * i, m_data + bpos + bline * i + stride, value ); 59 60 } 60 61 } … … 73 74 // memcpy( m_data+((r.pos.y+i)*m_size.x + r.pos.x ) * m_depth, 74 75 // data + (i*stride), r.size.x * m_depth ); 75 std::copy( data + i*stride, data + (i+1)*stride, m_data + bpos + bline * i );76 raw_copy( data + i*stride, data + (i+1)*stride, m_data + bpos + bline * i ); 76 77 } 77 78 } -
trunk/src/gfx/mesh_creator.cc
r323 r383 350 350 for ( uint32 i = 0; i < count; ++i ) 351 351 { 352 std::copy_n( a->data + i * adesc.size, adesc.size, data + i*desc.size );353 std::copy_n( b->data + i * bdesc.size, bdesc.size, data + i*desc.size + adesc.size );352 raw_copy_n( a->data + i * adesc.size, adesc.size, data + i*desc.size ); 353 raw_copy_n( b->data + i * bdesc.size, bdesc.size, data + i*desc.size + adesc.size ); 354 354 } 355 355 mesh_raw_channel* result = new mesh_raw_channel; … … 373 373 { 374 374 size_t a_size = vtx_size * a->count; 375 std::copy_n( a->data, a_size, data );376 std::copy_n( b->data, vtx_size * b->count, data + a_size );375 raw_copy_n( a->data, a_size, data ); 376 raw_copy_n( b->data, vtx_size * b->count, data + a_size ); 377 377 } 378 378 else … … 385 385 for ( size_t i = 0; i < frame_count; ++i ) 386 386 { 387 std::copy_n( a->data + pos_a, frame_size_a, data + pos );388 std::copy_n( b->data + pos_b, frame_size_b, data + pos + frame_size_a ); pos_a += frame_size_a;387 raw_copy_n( a->data + pos_a, frame_size_a, data + pos ); 388 raw_copy_n( b->data + pos_b, frame_size_b, data + pos + frame_size_a ); pos_a += frame_size_a; 389 389 pos_b += frame_size_b; 390 390 pos += frame_size_a + frame_size_b; -
trunk/src/gfx/skeletal_mesh.cc
r367 r383 43 43 } 44 44 45 std::fill( m_pntdata.raw_data(), m_pntdata.raw_data() + m_pntdata.raw_size(), 0 );45 fill( m_pntdata.raw_data(), m_pntdata.raw_data() + m_pntdata.raw_size(), 0 ); 46 46 for ( unsigned int i = 0; i < vertex_count; ++i ) 47 47 { -
trunk/src/gl/gl_device.cc
r380 r383 221 221 const gl_program_info* info = m_programs.get( p ); 222 222 { 223 uniform_map::const_iterator i = info->m_uniform_map.find( name );223 nv::uniform_map::const_iterator i = info->m_uniform_map.find( name ); 224 224 if ( i != info->m_uniform_map.end() ) 225 225 { -
trunk/src/io/string_table.cc
r281 r383 6 6 7 7 #include "nv/io/string_table.hh" 8 #include <array> 8 9 9 10 nv::string_table_creator::string_table_creator() -
trunk/src/lua/lua_map_tile.cc
r378 r383 118 118 new_tile->ascii = new nv::uchar8[ size ]; 119 119 } 120 std::copy( old_tile->data, old_tile->data +size, new_tile->data );121 if ( old_tile->ascii ) std::copy( old_tile->ascii, old_tile->ascii +size, new_tile->ascii );120 nv::raw_copy_n( old_tile->data, size, new_tile->data ); 121 if ( old_tile->ascii ) nv::raw_copy_n( old_tile->ascii, size, new_tile->ascii ); 122 122 123 123 luaL_getmetatable( L, NLUA_MAP_TILE_METATABLE ); … … 237 237 map_tile* tile = nlua_to_pmap_tile( L, 1 ); 238 238 // assert( tile^.ascii == nullptr ); 239 std::vector< nv::uint8 > sizes_x = nlua_tobytearray( L, 2 ); 240 std::vector< nv::uint8 > sizes_y = ( lua_istable( L, 3 ) ? nlua_tobytearray( L, 3 ) : sizes_x ); 239 nv::vector< nv::uint8 > sizes_x = nlua_tobytearray( L, 2 ); 240 nv::vector< nv::uint8 > sizes_y; 241 if ( lua_istable( L, 3 ) ) 242 sizes_y = nlua_tobytearray( L, 2 ); 243 else 244 sizes_y.assign( sizes_x ); 241 245 242 246 nv::uint16 org_x = tile->size_x; -
trunk/src/lua/lua_raw.cc
r380 r383 262 262 } 263 263 264 std::vector<nv::uint8> nlua_tobytearray( lua_State *L, int index )265 { 266 index = lua_absindex( L, index ); 267 std::vector<nv::uint8> result;264 nv::vector<nv::uint8> nlua_tobytearray( lua_State *L, int index ) 265 { 266 index = lua_absindex( L, index ); 267 nv::vector<nv::uint8> result; 268 268 if ( lua_istable( L, index ) ) 269 269 {
Note: See TracChangeset
for help on using the changeset viewer.