Index: trunk/src/gfx/mesh_creator.cc
===================================================================
--- trunk/src/gfx/mesh_creator.cc	(revision 398)
+++ trunk/src/gfx/mesh_creator.cc	(revision 406)
@@ -24,6 +24,6 @@
 		if ( pkeys && pkeys->get_channel_count() > 0 && keys && keys->get_channel_count() > 0 )
 		{
-			nv_key_transform*  channel = ((nv_key_transform*)(keys->get_channel(0)->data));
-			nv_key_transform* pchannel = ((nv_key_transform*)(pkeys->get_channel(0)->data));
+			nv_key_transform*  channel = reinterpret_cast<nv_key_transform*>(keys->get_channel(0)->data);
+			nv_key_transform* pchannel = reinterpret_cast<nv_key_transform*>(pkeys->get_channel(0)->data);
 			for ( unsigned n = 0; n < count; ++n )
 			{
@@ -37,5 +37,5 @@
 	{
 		m_data->m_frame_rate = 32;
-		m_data->m_duration   = (float)max_frames;
+		m_data->m_duration   = static_cast<float>( max_frames );
 	}
 
@@ -69,5 +69,5 @@
 			key_data* new_keys = new key_data;
 			new_keys->add_channel( raw_channel );
-			nv_key_transform* channel = ((nv_key_transform*)(raw_channel->data));
+			nv_key_transform* channel = reinterpret_cast<nv_key_transform*>(raw_channel->data);
 			key_descriptor final_key = old_keys->get_final_key();
 
@@ -110,5 +110,5 @@
 				for ( size_t n = 0; n < channel->count; ++n )
 				{
-					transform_key_raw( channel->desc, (uint8*)(channel->data + n * key_size), scale, r33, ri33 );
+					transform_key_raw( channel->desc, channel->data + n * key_size, scale, r33, ri33 );
 				}
 			}
@@ -135,7 +135,7 @@
 			switch ( desc.slots[i].vslot )
 			{
-				case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = (int)desc.slots[i].offset; break;
-				case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = (int)desc.slots[i].offset; break;
-				case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = (int)desc.slots[i].offset; break;
+				case slot::POSITION : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) p_offset = int(desc.slots[i].offset); break;
+				case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) n_offset = int(desc.slots[i].offset); break;
+				case slot::TANGENT  : if ( desc.slots[i].etype == FLOAT_VECTOR_4 ) t_offset = int(desc.slots[i].offset); break;
 				default             : break;
 			}
@@ -144,5 +144,5 @@
 			for ( uint32 i = 0; i < channel->count; i++)
 			{
-				vec3& p = *((vec3*)(raw_data + vtx_size*i + p_offset ));
+				vec3& p = *reinterpret_cast<vec3*>( raw_data + vtx_size*i + p_offset );
 				p = vertex_transform * p + vertex_offset;
 			}
@@ -151,5 +151,5 @@
 			for ( uint32 i = 0; i < channel->count; i++)
 			{
-				vec3& n = *((vec3*)(raw_data + vtx_size*i + n_offset ));
+				vec3& n = *reinterpret_cast<vec3*>( raw_data + vtx_size*i + n_offset );
 				n = glm::normalize( normal_transform * n );
 			}
@@ -157,5 +157,5 @@
 			for ( uint32 i = 0; i < channel->count; i++)
 			{
-				vec4& t = *((vec4*)(raw_data + vtx_size*i + t_offset ));
+				vec4& t = *reinterpret_cast<vec4*>(raw_data + vtx_size*i + t_offset );
 				t = vec4( glm::normalize( normal_transform * vec3(t) ), t[3] );
 			}
@@ -173,5 +173,5 @@
 	size_t n_offset = 0;
 	if ( ch_n == -1 ) return;
-	mesh_raw_channel* channel = m_data->m_channels[ (unsigned) ch_n ];
+	mesh_raw_channel* channel = m_data->m_channels[ unsigned( ch_n ) ];
 	for ( uint32 i = 0; i < channel->desc.count; ++i )
 		if ( channel->desc.slots[i].vslot == slot::NORMAL )
@@ -182,5 +182,5 @@
 	for ( uint32 i = 0; i < channel->count; ++i )
 	{
-		vec3& normal = *(vec3*)(channel->data + channel->desc.size * i + n_offset);
+		vec3& normal = *reinterpret_cast<vec3*>( channel->data + channel->desc.size * i + n_offset );
 		normal = -normal;
 	}
@@ -211,5 +211,5 @@
 				if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 
 				{
-					p_offset  = (int)desc.slots[i].offset; 
+					p_offset  = int( desc.slots[i].offset );
 					p_channel = channel;
 				}
@@ -217,5 +217,5 @@
 			case slot::NORMAL   : if ( desc.slots[i].etype == FLOAT_VECTOR_3 ) 
 				{
-					n_offset  = (int)desc.slots[i].offset; 
+					n_offset  = int( desc.slots[i].offset );
 					n_channel = m_data->m_channels[ c ];
 					n_channel_index = c;
@@ -224,5 +224,5 @@
 			case slot::TEXCOORD : if ( desc.slots[i].etype == FLOAT_VECTOR_2 ) 
 				{
-					t_offset  = (int)desc.slots[i].offset; 
+					t_offset  = int( desc.slots[i].offset );
 					t_channel = channel;
 				}
@@ -246,5 +246,5 @@
 
 	mesh_raw_channel* g_channel = mesh_raw_channel::create<vertex_g>( p_channel->count );
-	vec4* tangents              = (vec4*)g_channel->data;
+	vec4* tangents              = reinterpret_cast<vec4*>( g_channel->data );
 	vec3* tangents2             = new vec3[ p_channel->count ];
 	uint32 tri_count = i_channel ? i_channel->count / 3 : t_channel->count / 3;
@@ -259,5 +259,5 @@
 		if ( i_type == UINT )
 		{
-			const uint32* idata = (const uint32*)i_channel->data;
+			const uint32* idata = reinterpret_cast<const uint32*>( i_channel->data );
 			ti0 = idata[ i * 3 ];
 			ti1 = idata[ i * 3 + 1 ];
@@ -266,5 +266,5 @@
 		else if ( i_type == USHORT )
 		{
-			const uint16* idata = (const uint16*)i_channel->data;
+			const uint16* idata = reinterpret_cast<const uint16*>( i_channel->data );
 			ti0 = idata[ i * 3 ];
 			ti1 = idata[ i * 3 + 1 ];
@@ -278,7 +278,7 @@
 		}
 
-		const vec2& w1 = *((vec2*)(t_channel->data + t_channel->desc.size*ti0 + t_offset ));
-		const vec2& w2 = *((vec2*)(t_channel->data + t_channel->desc.size*ti1 + t_offset ));
-		const vec2& w3 = *((vec2*)(t_channel->data + t_channel->desc.size*ti2 + t_offset ));
+		const vec2& w1 = *reinterpret_cast<vec2*>(t_channel->data + t_channel->desc.size*ti0 + t_offset );
+		const vec2& w2 = *reinterpret_cast<vec2*>(t_channel->data + t_channel->desc.size*ti1 + t_offset );
+		const vec2& w3 = *reinterpret_cast<vec2*>(t_channel->data + t_channel->desc.size*ti2 + t_offset );
 		vec2 st1 = w3 - w1;
 		vec2 st2 = w2 - w1;
@@ -291,7 +291,7 @@
 			uint32 nti1 = t_channel->count * set + ti1;
 			uint32 nti2 = t_channel->count * set + ti2;
-			vec3 v1 = *((vec3*)(p_channel->data + p_channel->desc.size*nti0 + p_offset ));
-			vec3 v2 = *((vec3*)(p_channel->data + p_channel->desc.size*nti1 + p_offset ));
-			vec3 v3 = *((vec3*)(p_channel->data + p_channel->desc.size*nti2 + p_offset ));
+			vec3 v1 = *reinterpret_cast<vec3*>(p_channel->data + p_channel->desc.size*nti0 + p_offset );
+			vec3 v2 = *reinterpret_cast<vec3*>(p_channel->data + p_channel->desc.size*nti1 + p_offset );
+			vec3 v3 = *reinterpret_cast<vec3*>(p_channel->data + p_channel->desc.size*nti2 + p_offset );
 			vec3 xyz1 = v3 - v1;
 			vec3 xyz2 = v2 - v1;
@@ -317,5 +317,5 @@
 	for ( unsigned int i = 0; i < vtx_count; ++i )
 	{
-		const vec3 n = *((vec3*)(n_channel->data + n_channel->desc.size*i + n_offset ));
+		const vec3 n = *reinterpret_cast<vec3*>( n_channel->data + n_channel->desc.size*i + n_offset );
 		const vec3 t = vec3(tangents[i]);
 		if ( ! ( t.x == 0.0f && t.y == 0.0f && t.z == 0.0f ) )
@@ -420,8 +420,8 @@
 	int och_ti = other->get_channel_index( slot::TEXCOORD );
 	if ( ch_pi == -1 || ch_ti == -1 ) return;
-	size_t size   = m_data->m_channels[ (unsigned)ch_ti ]->count;
-	size_t osize  =  other->m_channels[ (unsigned)och_ti ]->count;
-	size_t count  = m_data->m_channels[ (unsigned)ch_pi ]->count;
-	size_t ocount =  other->m_channels[ (unsigned)och_pi ]->count;
+	size_t size   = m_data->m_channels[ unsigned(ch_ti) ]->count;
+	size_t osize  =  other->m_channels[ unsigned(och_ti) ]->count;
+	size_t count  = m_data->m_channels[ unsigned(ch_pi) ]->count;
+	size_t ocount =  other->m_channels[ unsigned(och_pi) ]->count;
 	if ( count % size != 0 || ocount % osize != 0 ) return;
 	if ( count / size != ocount / osize ) return;
@@ -440,7 +440,7 @@
 				{
 					NV_ASSERT( size + osize < uint16(-1), "Index out of range!" );
-					uint16* indexes = (uint16*)m_data->m_channels[c]->data;
-					for ( uint16 i = (uint16)old->count; i < m_data->m_channels[c]->count; ++i )
-						indexes[i] += (uint16)size;
+					uint16* indexes = reinterpret_cast<uint16*>( m_data->m_channels[c]->data );
+					for ( uint16 i = uint16( old->count ); i < m_data->m_channels[c]->count; ++i )
+						indexes[i] += uint16( size );
 
 				}
@@ -448,5 +448,5 @@
 			case UINT   : 
 				{
-					uint32* indexes = (uint32*)m_data->m_channels[c]->data;
+					uint32* indexes = reinterpret_cast<uint32*>( m_data->m_channels[c]->data );
 					for ( uint32 i = old->count; i < m_data->m_channels[c]->count; ++i )
 						indexes[i] += size;
