Ejemplo n.º 1
0
void read( INetReader	&r, CDB::MODEL &m )
{
	verts.clear();
	tris.clear();
	r_pod_vector( r, verts );
	u32 tris_count = r.r_u32();
	tris.resize( tris_count );
	for( u32 i = 0; i < tris_count; ++i)
		::read( r, tris[i] );
	m.build( &*verts.begin(), (int)verts.size(), &*tris.begin(), (int)tris.size() );
	verts.clear();
	tris.clear();
}
void xrMU_Model::calc_lighting	()
{
	// BB
	Fbox			BB; 
	BB.invalidate	();
	for (v_vertices_it vit=m_vertices.begin(); vit!=m_vertices.end(); vit++)
		BB.modify	((*vit)->P);

	// Export CForm
	CDB::CollectorPacked	CL	(BB,(u32)m_vertices.size(),(u32)m_faces.size());
	export_cform_rcast		(CL,Fidentity);

	CDB::MODEL*				M	= xr_new<CDB::MODEL>	();
	M->build				(CL.getV(),(u32)CL.getVS(),CL.getT(),(u32)CL.getTS());

	calc_lighting			(color,Fidentity,M,inlc_global_data()->L_static(),LP_dont_rgb+LP_dont_sun);

	xr_delete				(M);

	clMsg					("model '%s' - REF_lighted.",*m_name);
}