Esempio n. 1
0
																																					//
// Updates the mesh by calling the optimizeInPlace method
// of the D3DX object and reloading attribute information
void DirectX::Mesh::update( )
{
	DWORD* adjacencyInfo = new DWORD[m_mesh->GetNumFaces( )*sizeof(DWORD)];
	m_mesh->ConvertPointRepsToAdjacency( NULL, adjacencyInfo );
	m_mesh->OptimizeInplace( D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_COMPACT, adjacencyInfo, NULL, NULL, NULL );
	delete[] adjacencyInfo;

	if( m_attributeTable ) delete[] m_attributeTable;
	m_mesh->GetAttributeTable( NULL, &m_nAttributes );
	m_attributeTable = new D3DXATTRIBUTERANGE[m_nAttributes];
	m_mesh->GetAttributeTable( m_attributeTable, &m_nAttributes );

	calculateBoundingSphere( );
	calculateBoundingBox( );
}
Esempio n. 2
0
	nvmath::Sphere3f const& Drawable::getBoundingSphere (bool recalc) const
	{
		if (recalc)
			m_boundingSphere = calculateBoundingSphere ();
		return m_boundingSphere;
	}
Esempio n. 3
0
Sphere Sphere::calculateBoundingSphere( const vector<vec3> &points )
{
	return calculateBoundingSphere( points.data(), points.size() );
}