Ejemplo n.º 1
0
void CC3LocalContentNode::setShouldDrawLocalContentWireframeBox( bool shouldDraw )
{	
	// Fetch the wireframe node from the child nodes.
	CC3WireframeBoundingBoxNode* wf = getLocalContentWireframeBoxNode();
	
	// If the wireframe exists, but should not, remove it
	if (wf && !shouldDraw) 
		wf->remove();
	
	// If there is no wireframe, but there should be, add it by creating a
	// CC3WireframeLocalContentBoundingBoxNode from the localContentBoundingBox
	// property and add it as a child of this node. If the bounding box is null,
	// don't create a wireframe. Since the local content of a node does not
	// normally change shape, the bounding box is NOT set to update its vertices
	// by default from the bounding box of this node on each update pass.
	if(!wf && shouldDraw) 
	{
		CC3Box mbb = getLocalContentBoundingBox();
		if ( !mbb.isNull() )
		{
			wf = CC3WireframeLocalContentBoundingBoxNode::nodeWithName( getLocalContentWireframeBoxName() );
			wf->populateAsWireBox( mbb );
			wf->setEmissionColor( getInitialLocalContentWireframeBoxColor() );
			addChild( wf );
		}
	}
}
Ejemplo n.º 2
0
void CC3TouchBox::setBox( const CC3Box& aBox )
{
	if ( aBox.isNull() ) {
		setMesh( NULL );
	} else {
		populateBox( aBox );
	}
}
Ejemplo n.º 3
0
/**
 * Overridden to return the parent's local content bounding box,
 * or kCC3BoxZero if no parent, or if parent doesn't have a bounding box.
 */
CC3Box CC3WireframeLocalContentBoundingBoxNode::getParentBoundingBox()
{
	if (m_pParent && m_pParent->hasLocalContent()) 
	{
		CC3Box pbb = ((CC3LocalContentNode*)m_pParent)->getLocalContentBoundingBox();
		if ( !pbb.isNull() )
			return pbb;
	}
    
	return CC3Box::kCC3BoxZero;
}
Ejemplo n.º 4
0
/**
 * Returns the parent's bounding box, or kCC3BoxZero if no parent,
 * or if parent doesn't have a bounding box.
 */
CC3Box CC3WireframeBoundingBoxNode::getParentBoundingBox()
{
	if ( m_pParent )
    {
		CC3Box pbb = m_pParent->getBoundingBox();
		if ( !pbb.isNull() )
            return pbb;
	}
    
	return CC3Box::kCC3BoxZero;
}
Ejemplo n.º 5
0
CC3Vector CC3LocalContentNode::getLocalContentCenterOfGeometry()
{
	CC3Box bb = getLocalContentBoundingBox();
	return bb.isNull() ? CC3Vector::kCC3VectorZero : bb.getCenter();
}