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 = stringWithFormat( "%s-SV-%s", getName().c_str(), aLight->getName().c_str() ); //CC3Node<CC3ShadowProtocol>* sv = [[self shadowVolumeClass] 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 ); }
void CC3Billboard::addShadowVolumesForLight( CC3Light* aLight ) { if (!m_pMesh) populateAsBoundingRectangle(); super::addShadowVolumesForLight( aLight ); CC3ShadowVolumeMeshNode* sv = getShadowVolumeForLight( aLight ); if ( sv ) { sv->setShouldShadowBackFaces( true ); sv->setShadowOffsetUnits( 0 ); sv->setShadowVolumeVertexOffsetFactor( kCC3DefaultShadowVolumeVertexOffsetFactor ); } }