public float GetSquaredViewDepth( Camera camera )
{
// First of all, check the cached value
// NB this is manually invalidated by parent each _notifyCurrentCamera call
// Done this here rather than there since we only need this for transparent objects
if ( cachedCamera == camera )
return cachedCameraDist;
Node node = Parent.ParentNode;
Debug.Assert( node != null );
Real dist;
#warning SubMesh.ExtremityPoints implementation needed.
//if (!subMesh.extremityPoints.empty())
//{
// const Vector3 &cp = cam->getDerivedPosition();
// const Matrix4 &l2w = mParentEntity->_getParentNodeFullTransform();
// dist = std::numeric_limits<Real>::infinity();
// for (vector<Vector3>::type::const_iterator i = mSubMesh->extremityPoints.begin();
// i != mSubMesh->extremityPoints.end (); ++i)
// {
// Vector3 v = l2w * (*i);
// Real d = (v - cp).squaredLength();
// dist = std::min(d, dist);
// }
//}
//else
{
dist = node.GetSquaredViewDepth( camera );
}
cachedCameraDist = dist;
cachedCamera = camera;
return dist;
}