コード例 #1
0
ファイル: CC3MeshNode.cpp プロジェクト: yecaokinux/cocos3d-x
void CC3MeshNode::addShadowVolumesForLight( CC3Light* aLight )
{
	// If I shouldn't cast a shadow, or if I already have a shadow volume, just leave.
	if ( !shouldCastShadows() || getShadowVolumeForLight( aLight ) )
		return;

#pragma _NOTE_TODO( "CC3MeshNode::addShadowVolumesForLight( CC3Light* aLight )" )
	std::string svName = CC3String::stringWithFormat( "%s-SV-%s", getName().c_str(), aLight->getName().c_str() );
	CC3ShadowVolumeMeshNode* sv = CC3ShadowVolumeMeshNode::nodeWithName( svName );
	sv->selectShaders();

	// Retain data required to build shadow volume mesh
	retainVertexLocations();
	retainVertexIndices();
	setShouldCacheFaces( true );

	prewarmForShadowVolumes();		// Force heavy face calcs now instead of lazily during drawing.

	// Set the active camera to infinite depth of field to accomodate infinite shadow volumes
	getActiveCamera()->setHasInfiniteDepthOfField( true );

	aLight->addShadow( sv );			// Add to light before notifying scene a descendant has been added
	addChild( sv );			// The last thing we do is add the SV to the scene...
	// ...because we might be doing this on a background thread.
	//LogTrace(@"Added shadow volume %@ to %@", sv, self);

	super::addShadowVolumesForLight( aLight );
}
コード例 #2
0
void CC3SimpleLineNode::initWithTag( GLuint aTag, const std::string& aName )
{
	super::initWithTag( aTag, aName );
	{
		m_lineVertices[0] = CC3Vector::kCC3VectorZero;
		m_lineVertices[1] = CC3Vector::kCC3VectorZero;
		populateAsLineStripWith( 2, m_lineVertices, false );
		retainVertexLocations();
	}
}
コード例 #3
0
void CC3WireframeBoundingBoxNode::releaseRedundantContent()
{
	retainVertexLocations();
	super::releaseRedundantContent();
}