Example #1
0
ccBBox ccDrawableObject::getFitBB(ccGLMatrix& trans)
{
	//Default behavior: returns axis aligned bounding box!
	trans.toIdentity();
	return getBB(true,false,m_currentDisplay);

}
Example #2
0
void ccClipBox::get(ccBBox& extents, ccGLMatrix& transformation)
{
	extents = m_box;

	if (isGLTransEnabled())
	{
		transformation = m_glTrans;
	}
	else
	{
		transformation.toIdentity();
	}
}
//===============================================getAbsoluteGLTransformation===================================================//
//由祖先到子物体,将旋转矩阵依次累加
bool ccHObject::getAbsoluteGLTransformation(ccGLMatrix& trans) const
{
	trans.toIdentity();
	bool hasGLTrans = false;
	
	//recurse among ancestors to get the absolute GL transformation
	const ccHObject* obj = this;
	while (obj){
		if (obj->isGLTransEnabled()){ //是否可进行变换
			trans = trans * obj->getGLTransformation();
			hasGLTrans = true;
		}
		obj = obj->getParent();
	}

	return hasGLTrans;
}