Esempio n. 1
0
void MScene::updateObjectsMatrices(void)
{
	unsigned int i;
	unsigned int oSize = getObjectsNumber();
	for(i=0; i<oSize; i++)
	{
		MObject3d * object = getObjectByIndex(i);
		if(! object->isActive())
			continue;

		if(! object->hasParent())
		{
			if(object->needToUpdate())
				object->computeLocalMatrix();
			object->computeChildsMatrices();
		}
	}
}
Esempio n. 2
0
void MObject3d::computeChildsMatrices(void)
{
	unsigned int i;
	unsigned int childSize = m_childs.size();
	MObject3d * childObject = NULL;

	for(i=0; i<childSize; i++) // for all childs
	{
		childObject = m_childs[i];

		// compute parenting (parent matrix * child local matrix)
		if(m_needToUpdate || childObject->needToUpdate())
		{
			childObject->computeLocalMatrix();
			childObject->m_matrix = m_matrix * childObject->m_matrix;
			childObject->m_needToUpdate = true;
		}
		childObject->computeChildsMatrices();
	}

	m_needToUpdate = false;
}