Ok so I've been trying to use PhongBitmapMaterialCache or
PhongColorMaterialCache as a material on some objects in my scene
because the lights are static and the objects don't move, but every
time I use them, I run into an error when the view attempts to render.
The error looks like this:
TypeError: Error #1009: Cannot access a property or method of a null
object reference.
at flash.geom::Matrix/concat()
at away3d.materials.shaders::DiffusePhongShader/renderShader()
at away3d.materials.shaders::AbstractShader/renderBitmapLayer()
at away3d.materials::BitmapMaterialContainer/renderBitmapLayer()
at away3d.materials::BitmapMaterialContainer/getMapping()
at away3d.materials::BitmapMaterial/renderTriangle()
at away3d.core.draw::DrawTriangle/render()
at away3d.core.render::BasicRenderer/render()
at away3d.core.render::AbstractRenderSession/render()
at away3d.core.render::AbstractRenderSession/render()
at away3d.core.render::AbstractRenderSession/render()
at away3d.containers::View3D/render()
at Test1()
Now, I'm not sure, this could possibly be a result of me incorrectly
using Cache materials, but I tried moving things around and fixing my
code yet the error persists no matter what. I traced the issue through
the engine and the problem seems to be with the renderBitmapLayer
function in the BitmapMaterialContainer class. It appears that the
_containerVO variable is initialized as a new FaceMaterialVO but it's
invtexturemapping and texturemapping matrices are never assigned and
as a result, when it's passed as an argument to the renderBitmapLayer
function of DiffusePhongShader it results in a null object reference
error because this function requires the invtexturemappping matrix to
work. I'm sorry if this all sounds very convoluted, but any input
would be much appreciated. I could be totally off and just doing
something entirely wrong in my code that's causing this problem but
I've tried everything to fix i and nothing's worked. I really need
the PhongBitmapMaterialCache to work for my project, so if anyone has
gotten it to work without problems, or can perhaps help me fix the
problem that would be great. Also, I'm using the most recent flash
player 9 version of the engine, but I have tried to get this to work
in the flash player 10 version and encountered the same problem. If
you think you need to see my code to help, just let me know and I'll
post it.