brlrt / away3d

Automatically exported from code.google.com/p/away3d
0 stars 0 forks source link

Issue by using transparent hitAreas on MovieMaterials (or rather any other Material) #119

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a new MovieMaterial
2. Set the "transparent" property to "true"
3. Use a transparent hitarea (a black rectangular Sprite with alpha 0) in
the MovieClip (or Sprite) as hidden Hitarea for the Material.

What is the expected output? What do you see instead?
The hitArea Sprite should expand the clickable area on the rendered
MovieMaterial. 
As the rendered Material draws all transparent pixels as empty pixels (so
no pixel is really drawn) the hitArea is completely ignored!

What version of the product are you using? On what operating system?
I´m using Windows 7 as operating system and the latest away3d svn
revision(2527).

Please provide any additional information below.
Currenty I fixed this issue using a workaround.
I replaced the following code-line 196 in MovieMaterial.as:

_renderBitmap.fillRect(rectsource, 0x00FFFFFF);

with:

_renderBitmap.fillRect(rectsource, 0x01FFFFFF);

This little modification causes that if the "transparent" property is set
to "true" a hitarea is drawn with a inperceptible low opacity to achieve
that "transparent" pixels are drawn and the hitarea takes effect. This
technique is also used for TextField3D.as in addHitBox() by setting the
alpha value of the ColorMatarial to .001!

Actually  I didn´t realize what sense it makes in the original code that
there is drawn a completely transparent rectangle if "transparent" is set
to "true" as it will be completly ignored on rendering. Is there an
explanation for that?

Original issue reported on code.google.com by cacafu...@googlemail.com on 26 May 2010 at 10:10