Hi again,
I've managed to avoid the exception.
I think there is a bug in View3D.as: In render method there is no
check for null context before calling updateLights and
renderSceneDepth.
Here is the modification I made in View3D.as:
Before (at line 317):
updateLights(_entityCollector);
if (_requireDepthRender)
renderSceneDepth(_entityCollector);
After:
if(context)
{
updateLights(_entityCollector);
if (_requireDepthRender)
renderSceneDepth(_entityCollector);
}
After making this change a new exception arises at
popModelViewProjection in Entity.as, caused by the call to
_entityCollector.cleanUp() at line 338 in render method:
RangeError: Error #1125: The index 1 is out of range 1.
at away3d.entities::Entity/pushModelViewProjection()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\entities
\Entity.as:157]
at away3d.core.partition::EntityNode/isInFrustum()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\EntityNode.as:70]
at away3d.core.traverse::EntityCollector/enterNode()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\traverse
\EntityCollector.as:133]
at away3d.core.partition::MeshNode/acceptTraverser()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\MeshNode.as:39]
at away3d.core.partition::NodeBase/acceptTraverser()[C:\Downloads
\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\NodeBase.as:100]
at away3d.core.partition::Partition3D/traverse()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\core\partition
\Partition3D.as:38]
at away3d.containers::Scene3D/traversePartitions()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\Scene3D.as:
52]
at away3d.lights.shadowmaps::DirectionalShadowMapper/drawDepthMap()[C:
\Downloads\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\lights
\shadowmaps\DirectionalShadowMapper.as:46]
at away3d.lights.shadowmaps::ShadowMapperBase/renderDepthMap()[C:
\Downloads\Flash\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\lights
\shadowmaps\ShadowMapperBase.as:90]
at away3d.containers::View3D/updateLights()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
398]
at away3d.containers::View3D/render()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Away3D\src\away3d\containers\View3D.as:
319]
at SoftShadowTest/_handleEnterFrame()[C:\Downloads\Flash
\away3d_4_0_0_svn\broomstick\Examples\Away3D\as\src\SoftShadowTest.as:
156]
To solve it I've added a check before decreasing _mvpIndex:
public function popModelViewProjection() : void
{
if(_mvpIndex>0)
--_mvpIndex;
}
I think this deserves a deeper insight because there are more pops
than pushes, something misssed there.
With these changes I have removed the exception but the shadows
continue rendering in software mode.
Hope this helps.