If I have:
// define lights, view, ect..
(...)
var merge:Merge = new Merge(false, false);
var meshes:Vector.<Mesh> = new Vector.<Mesh>();
// recieving empty mesh
var recieverMesh:Mesh = new Mesh();
// cube base mesh
var cube:Cube = new Cube(null, 80, 80, 80);
var clonedMesh:Mesh;
// clone meshes and add to meshes vector
for (var i:uint = 0; i < 100, i++) {
clonedMesh = cube.clone() as Mesh;
clonedMesh.x = 40 * i;
meshes.push(clonedMesh);
}
// merge meshes
var mergedMesh:Mesh = merge.applyToMeshes(recieverMesh, meshes);
// create and apply material
var material:ColorMaterial = new ColorMaterial(0xcccccc);
material.lights = [light];
// crashes - fixed if commented out
material.shadowMethod = new SoftShadowMapMethod(light);
mergedMesh.material = material;
mergedMesh.castsShadows = true;
view.scene.addChild(mergedMesh);
The problem with the above code is that it crashes with the line:
material.shadowMethod = new SoftShadowMapMethod(light);
If we remove it, the merged mesh works properly. Is there a limitation or a bug?
Error: More usages removed than exist!
at RegisterPool/removeUsage()[E:Programming ResourcesAway3D FP11srcaway3dmaterialsutilsRegisterPool.as:97]
at away3d.materials.utils::ShaderRegisterCache/removeFragmentTempUsage()[E:Programming ResourcesAway3D FP11srcaway3dmaterialsutilsShaderRegisterCache.as:73]
at away3d.materials.passes::DefaultScreenPass/compileLightingCode()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesDefaultScreenPass.as:956]
at away3d.materials.passes::DefaultScreenPass/compile()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesDefaultScreenPass.as:574]
at away3d.materials.passes::DefaultScreenPass/reset()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesDefaultScreenPass.as:531]
at away3d.materials.passes::DefaultScreenPass/updateProgram()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesDefaultScreenPass.as:480]
at away3d.materials.passes::MaterialPassBase/activate()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesMaterialPassBase.as:260]
at away3d.materials.passes::DefaultScreenPass/activate()[E:Programming ResourcesAway3D FP11srcaway3dmaterialspassesDefaultScreenPass.as:346]
at away3d.materials::MaterialBase/activatePass()[E:Programming ResourcesAway3D FP11srcaway3dmaterialsMaterialBase.as:320]
at away3d.core.render::DefaultRenderer/drawRenderables()[E:Programming ResourcesAway3D FP11srcaway3dcorerenderDefaultRenderer.as:106]
at away3d.core.render::DefaultRenderer/draw()[E:Programming ResourcesAway3D FP11srcaway3dcorerenderDefaultRenderer.as:62]
at away3d.core.render::RendererBase/executeRender()[E:Programming ResourcesAway3D FP11srcaway3dcorerenderRendererBase.as:335]
at away3d.core.render::RendererBase/render()[E:Programming ResourcesAway3D FP11srcaway3dcorerenderRendererBase.as:310]
at away3d.containers::View3D/render()[E:Programming ResourcesAway3D FP11srcaway3dcontainersView3D.as:363]