- Timestamp:
- 06/13/15 11:20:22 (10 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/formats/md5_loader.cc
r395 r398 31 31 } 32 32 33 static void unit_quat_w( glm::quat& quat )33 static void unit_quat_w( nv::quat& quat ) 34 34 { 35 35 float t = 1.0f - ( quat.x * quat.x ) - ( quat.y * quat.y ) - ( quat.z * quat.z ); … … 343 343 md5_vtx_pnt& vtc = vtcs[i]; 344 344 345 vtc.position = glm::vec3(0);346 vtc.normal = glm::vec3(0);347 vtc.tangent = glm::vec3(0);345 vtc.position = vec3(0); 346 vtc.normal = vec3(0); 347 vtc.tangent = vec3(0); 348 348 349 349 stable_sort( weights + start_weight, weights + start_weight + weight_count, [] ( const md5_weight& a, const md5_weight& b ) -> bool { return a.bias > b.bias; } ); … … 386 386 const mesh_node_data& joint = nodes[weight.joint_id]; 387 387 const transform tr = transform( joint.transform ).inverse(); 388 glm::vec3 rot_pos = tr.get_orientation() * weight.pos;388 vec3 rot_pos = tr.get_orientation() * weight.pos; 389 389 390 390 vtc.position += ( tr.get_position() + rot_pos ) * weight.bias; … … 404 404 uint32 ti2 = idata[ i * 3 + 2 ]; 405 405 406 glm::vec3 v1 = vtcs[ ti0 ].position;407 glm::vec3 v2 = vtcs[ ti1 ].position;408 glm::vec3 v3 = vtcs[ ti2 ].position;409 glm::vec3 xyz1 = v3 - v1;410 glm::vec3 xyz2 = v2 - v1;411 412 glm::vec3 normal = glm::cross( xyz1, xyz2 );406 vec3 v1 = vtcs[ ti0 ].position; 407 vec3 v2 = vtcs[ ti1 ].position; 408 vec3 v3 = vtcs[ ti2 ].position; 409 vec3 xyz1 = v3 - v1; 410 vec3 xyz2 = v2 - v1; 411 412 vec3 normal = glm::cross( xyz1, xyz2 ); 413 413 414 414 vtcs[ ti0 ].normal += normal; … … 436 436 md5_vtx_pntiw& vdata = vtx_data[i]; 437 437 438 glm::vec3 normal = glm::normalize( vtcs[i].normal );439 glm::vec3 tangent = glm::normalize( vtcs[i].tangent );438 vec3 normal = glm::normalize( vtcs[i].normal ); 439 vec3 tangent = glm::normalize( vtcs[i].tangent ); 440 440 vtcs[i].normal = normal; 441 441 vtcs[i].tangent = tangent; 442 442 443 443 vdata.position = vtcs[i].position; 444 vdata.normal = glm::vec3(0);445 vdata.tangent = glm::vec3(0);444 vdata.normal = vec3(0); 445 vdata.tangent = vec3(0); 446 446 447 447 for ( size_t j = 0; j < 4; ++j ) … … 484 484 transform ptr; 485 485 if ( pjoint.data->get_channel(0)->count > index ) ptr = ptv[ index ]; 486 glm::vec3 rot_pos = ptr.get_orientation() * pos;486 vec3 rot_pos = ptr.get_orientation() * pos; 487 487 488 488 pos = ptr.get_position() + rot_pos; -
trunk/src/gfx/image.cc
r395 r398 10 10 using namespace nv; 11 11 12 image::image( glm::ivec2 size, nv::size_t depth )12 image::image( ivec2 size, nv::size_t depth ) 13 13 : m_size( size ), m_depth( depth ), m_data( nullptr ) 14 14 { … … 23 23 24 24 25 image::image( glm::ivec2 size, nv::size_t depth, const uint8 * data, bool reversed )25 image::image( ivec2 size, nv::size_t depth, const uint8 * data, bool reversed ) 26 26 : m_size( size ), m_depth( depth ), m_data( nullptr ) 27 27 { -
trunk/src/gfx/mesh_creator.cc
r395 r398 21 21 size_t count = ( keys ? keys->get_channel(0)->count : 0 ); 22 22 size_t pcount = ( pkeys ? pkeys->get_channel(0)->count : 0 ); 23 max_frames = glm::max<uint32>( count, max_frames );23 max_frames = nv::max<uint32>( count, max_frames ); 24 24 if ( pkeys && pkeys->get_channel_count() > 0 && keys && keys->get_channel_count() > 0 ) 25 25 { … … 28 28 for ( unsigned n = 0; n < count; ++n ) 29 29 { 30 channel[n].tform = pchannel[ glm::min( n, pcount-1 ) ].tform * channel[n].tform;30 channel[n].tform = pchannel[ nv::min( n, pcount-1 ) ].tform * channel[n].tform; 31 31 } 32 32 } … … 63 63 for ( size_t c = 0; c < chan_count; ++c ) 64 64 { 65 max_keys = glm::max( max_keys, old_keys->get_channel(c)->count );65 max_keys = nv::max( max_keys, old_keys->get_channel(c)->count ); 66 66 } 67 67 … … 79 79 for ( uint16 c = 0; c < chan_count; ++c ) 80 80 { 81 size_t idx = glm::min( old_keys->get_channel(c)->count - 1, n );81 size_t idx = nv::min( old_keys->get_channel(c)->count - 1, n ); 82 82 pkey += old_keys->get_channel(c)->get_raw( idx, pkey ); 83 83 } … … 119 119 void nv::mesh_data_creator::transform( float scale, const mat3& r33 ) 120 120 { 121 vec3 vertex_offset = glm::vec3();121 vec3 vertex_offset = vec3(); 122 122 mat3 vertex_transform = scale * r33; 123 123 mat3 normal_transform = r33; … … 297 297 vec3 xyz2 = v2 - v1; 298 298 299 // glm::vec3 normal = glm::cross( xyz1, xyz2 );299 //vec3 normal = glm::cross( xyz1, xyz2 ); 300 300 // 301 301 //vtcs[ ti0 ].normal += normal; -
trunk/src/gfx/texture_atlas.cc
r395 r398 11 11 using namespace nv; 12 12 13 texture_atlas::texture_atlas( glm::ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ )13 texture_atlas::texture_atlas( ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ ) 14 14 : image( size, depth ), m_used( 0 ), m_border( border ) 15 15 { 16 m_nodes.push_back( glm::ivec3( m_border, m_border, m_size.x - 2 * static_cast<int>( m_border ) ) );16 m_nodes.push_back( ivec3( m_border, m_border, m_size.x - 2 * static_cast<int>( m_border ) ) ); 17 17 fill( 0 ); 18 18 } 19 19 20 region texture_atlas::get_region( glm::ivec2 size )20 region texture_atlas::get_region( ivec2 size ) 21 21 { 22 region r ( glm::ivec2(0,0), size );22 region r ( ivec2(0,0), size ); 23 23 24 24 int best_height = INT_MAX; … … 31 31 if ( y >= 0 ) 32 32 { 33 glm::ivec3 node = m_nodes[ i ];33 ivec3 node = m_nodes[ i ]; 34 34 if ( ( (y + size.y) < best_height ) || 35 35 ( ((y + size.y) == best_height) && (node.z < best_width)) ) … … 46 46 if ( best_index == -1 ) 47 47 { 48 return region( glm::ivec2( -1, -1 ), glm::ivec2( 0, 0 ) );48 return region( ivec2( -1, -1 ), ivec2( 0, 0 ) ); 49 49 } 50 50 51 m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) );51 m_nodes.insert( m_nodes.begin() + best_index, ivec3( r.pos.x, r.pos.y + size.y, size.x ) ); 52 52 53 53 for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i ) 54 54 { 55 glm::ivec3 node = m_nodes[ i ];56 glm::ivec3 prev = m_nodes[ i-1 ];55 ivec3 node = m_nodes[ i ]; 56 ivec3 prev = m_nodes[ i-1 ]; 57 57 58 58 if ( node.x < prev.x + prev.z ) … … 82 82 } 83 83 84 int texture_atlas::fit( nv::size_t index, glm::ivec2 size )84 int texture_atlas::fit( nv::size_t index, ivec2 size ) 85 85 { 86 glm::ivec3 node = m_nodes[ index ];86 ivec3 node = m_nodes[ index ]; 87 87 88 88 if ( node.x + size.x > m_size.x - static_cast<int>( m_border ) ) … … 128 128 m_nodes.clear(); 129 129 m_used = 0; 130 m_nodes.push_back( glm::ivec3( 1, 1, m_size.x - 2 ) );130 m_nodes.push_back( ivec3( 1, 1, m_size.x - 2 ) ); 131 131 fill( 0 ); 132 132 } -
trunk/src/gfx/texture_font.cc
r395 r398 94 94 bool texture_font::load_glyphs( string_ref codes ) 95 95 { 96 FT_Face face 97 size_t depth 98 glm::ivec2 asize= m_atlas->get_size();96 FT_Face face = (FT_Face)(m_rface); 97 size_t depth = m_atlas->get_depth(); 98 ivec2 asize = m_atlas->get_size(); 99 99 FT_Int32 flags = 0; 100 100 flags |= FT_LOAD_RENDER; … … 137 137 int reg_width = ft_bitmap_width / (depth > 3 ? 3 : (int)depth); 138 138 139 glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 );139 ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); 140 140 region r = m_atlas->get_region( gsize ); 141 141 if ( r.pos.x < 0 ) … … 164 164 g->charcode = c; 165 165 g->size = gsize; 166 g->offset = glm::ivec2( ft_glyph_left, ft_glyph_top );167 g->tl = glm::vec2( r.pos.x/(float)asize.x, r.pos.y/(float)asize.y );168 g->br = glm::vec2( ( r.pos.x + gsize.x )/(float)asize.x, (r.pos.y + gsize.y )/(float)asize.y );166 g->offset = ivec2( ft_glyph_left, ft_glyph_top ); 167 g->tl = vec2( r.pos.x/(float)asize.x, r.pos.y/(float)asize.y ); 168 g->br = vec2( ( r.pos.x + gsize.x )/(float)asize.x, (r.pos.y + gsize.y )/(float)asize.y ); 169 169 170 170 // Discard hinting to get advance 171 171 FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING); 172 172 slot = face->glyph; 173 g->advance = glm::ivec2( slot->advance.x/64.0, slot->advance.y/64.0 );173 g->advance = ivec2( slot->advance.x/64.0, slot->advance.y/64.0 ); 174 174 } 175 175 generate_kerning(); -
trunk/src/gl/gl_context.cc
r395 r398 731 731 } 732 732 unsigned int buffers[8]; 733 count = glm::min<uint32>( count, 8 );733 count = nv::min<uint32>( count, 8 ); 734 734 for ( uint32 i = 0; i < count; ++i ) 735 735 { -
trunk/src/gl/gl_device.cc
r395 r398 53 53 assert( image->format->BytesPerPixel > 2 ); 54 54 image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE ); 55 image_data* data = new image_data( format, glm::ivec2( image->w, image->h ), (nv::uint8*)image->pixels );55 image_data* data = new image_data( format, ivec2( image->w, image->h ), (nv::uint8*)image->pixels ); 56 56 return data; 57 57 } … … 71 71 assert( image->format->BytesPerPixel > 2 ); 72 72 image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE ); 73 image_data* idata = new image_data( format, glm::ivec2( image->w, image->h ), ( nv::uint8* )image->pixels );73 image_data* idata = new image_data( format, ivec2( image->w, image->h ), ( nv::uint8* )image->pixels ); 74 74 return idata; 75 75 } -
trunk/src/rogue/fov_recursive_shadowcasting.cc
r395 r398 24 24 { 25 25 position max_radius = m_size-m_position; 26 max_radius.x=glm::max(max_radius.x,m_position.x); 27 max_radius.y=glm::max(max_radius.y,m_position.y); 28 m_radius = (int)glm::length((glm::vec2)max_radius)+1; 26 max_radius = glm::max(max_radius,m_position); 27 m_radius = (int)glm::length((vec2)max_radius)+1; 29 28 } 30 29 m_radius2 = m_radius * m_radius;
Note: See TracChangeset
for help on using the changeset viewer.