Exemplo n.º 1
0
void ccHObject::applyGLTransformation_recursive(const ccGLMatrix* transInput/*=NULL*/)
{
	ccGLMatrix transTemp;
	const ccGLMatrix* transToApply = transInput;

	if (m_glTransEnabled)
	{
		if (!transInput)
		{
			//if no transformation is provided (by father)
			//we initiate it with the current one
			transToApply = &m_glTrans;
		}
		else
		{
			transTemp = *transInput * m_glTrans;
			transToApply = &transTemp;
		}
	}

	if (transToApply)
	{
		applyGLTransformation(*transToApply);
		notifyGeometryUpdate();
	}

	for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it)
		(*it)->applyGLTransformation_recursive(transToApply);

	if (m_glTransEnabled)
		resetGLTransformation();
}
Exemplo n.º 2
0
void ccHObject::applyGLTransformation_recursive(ccGLMatrix* trans/*=NULL*/)
{
	ccGLMatrix* _trans = NULL;

	if (m_glTransEnabled)
	{
		if (!trans)
		{
			//if no transformation is provided (by father)
			//we initiate it with the current one
			trans = _trans = new ccGLMatrix(m_glTrans);
		}
		else
		{
			*trans *= m_glTrans;
		}
	}

	if (trans)
	{
		applyGLTransformation(*trans);
		notifyGeometryUpdate();
	}

	for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it)
		(*it)->applyGLTransformation_recursive(trans);

	if (_trans)
		delete _trans;

	if (m_glTransEnabled)
		resetGLTransformation();
}
Exemplo n.º 3
0
//==================================================applyGLTransformation_recursive======================================//
void ccHObject::applyGLTransformation_recursive(ccGLMatrix* trans/*=NULL*/)
{
	ccGLMatrix* _trans = NULL;

	if (m_glTransEnabled){
		if (!trans)	{
			//if no transformation is provided (by father)
			//we initiate it with the current one
			trans = _trans = new ccGLMatrix(m_glTrans);
		}
		else{
			//将trans 作用到m_glTrans
			*trans *= m_glTrans;
		}
	}

	//将trans作用到该物体,并提醒相互依赖的物体进行升级
	if (trans){
		applyGLTransformation(*trans);
		notifyGeometryUpdate();
	}

	//对于每一个子物体,进行递归变换
	for (Container::iterator it = m_children.begin(); it!=m_children.end(); ++it)
		(*it)->applyGLTransformation_recursive(trans);

	if (_trans)
		delete _trans;

	//变换完成后,进行禁止变换,对于递归函数非常重要
	if (m_glTransEnabled)
		resetGLTransformation();
}
Exemplo n.º 4
0
void ccClipBox::reset()
{
	m_box.clear();
	resetGLTransformation();

	if (m_associatedEntity)
	{
		m_box = m_associatedEntity->getOwnBB();
	}

	update();

	//send 'modified' signal
	emit boxModified(&m_box);
}
Exemplo n.º 5
0
void ccClipBox::reset()
{
	m_box.clear();
	resetGLTransformation();

	if (m_entityContainer.getChildrenNumber())
	{
		m_box = m_entityContainer.getBB_recursive();
	}

	update();

	//send 'modified' signal
	emit boxModified(&m_box);
}