Exemple #1
0
void ccSubMesh::getBoundingBox(PointCoordinateType bbMin[], PointCoordinateType bbMax[])
{
	getMyOwnBB(); //forces BB refresh if necessary
    
	memcpy(bbMin, m_bBox.minCorner().u, 3*sizeof(PointCoordinateType));
    memcpy(bbMax, m_bBox.maxCorner().u, 3*sizeof(PointCoordinateType));
}
ccBBox ccIndexedTransformationBuffer::getDisplayBB()
{
	ccBBox box = getMyOwnBB();
	if (m_showTrihedrons && box.isValid())
	{
		box.minCorner() -= CCVector3(m_trihedronsScale,m_trihedronsScale,m_trihedronsScale);
		box.maxCorner() += CCVector3(m_trihedronsScale,m_trihedronsScale,m_trihedronsScale);
	}

	return box;
}
Exemple #3
0
ccBBox ccHObject::getBB(bool relative/*=true*/, bool withGLfeatures/*=false*/, const ccGenericGLDisplay* display/* = NULL*/)
{
	ccBBox box;

	//if (!isEnabled())
	//	return box;

	if (!display || m_currentDisplay == display)
		box = (withGLfeatures ? getDisplayBB() : getMyOwnBB());

	for (Container::iterator it = m_children.begin(); it != m_children.end(); ++it)
	{
		if ((*it)->isEnabled())
			box += (*it)->getBB(false, withGLfeatures, display);
	}

	//apply GL transformation afterwards!
	if (!display || m_currentDisplay == display)
		if (!relative && m_glTransEnabled && box.isValid())
			box = box*m_glTrans;

	return box;
}
Exemple #4
0
bool ccKdTree::getNeighborLeaves(ccKdTree::BaseNode* cell, ccKdTree::LeafSet& neighbors, const int* userDataFilter/*=0*/)
{
	if (!m_root)
		return false;

	//determine the cell bounding box
	ccBBox cellBox = getCellBBox(cell);
	if (!cellBox.isValid())
		return false;

	try
	{
		GetNeighborLeavesVisitor visitor(cell, neighbors, cellBox, getMyOwnBB());
		if (userDataFilter)
			visitor.setUserDataFilter(*userDataFilter);
		visitor.visit(m_root);
	}
	catch (std::bad_alloc)
	{
		return false;
	}

	return true;
}
Exemple #5
0
ccBBox ccHObject::getDisplayBB()
{
	//by default, this is the same bbox as the "geometrical" one
	return getMyOwnBB();
}