Forgive my ignorance, but is it possible to use Away3D materials in Away3D Lite, or are they completely incompatible?
On Oct 15, 11:21 pm, Justin Lawerance Mills <[email protected]> wrote: > Sorry my misunderstanding... but there are possible parallels in the > moviemesh and a moviematerial, you can have a mesh and material > timeline, but really you only need one you just need to be able to > stop and start updates/changes of each. > > On 16 Oct 2009, at 06:56, Justin Lawerance Mills wrote: > > > > > > > Another approach might be extending mesh, and using MovieMesh as > > inspiration? > > > On 15 Oct 2009, at 06:40, Alexander wrote: > > >> It's not there (yet), here is a simple usable implementation: > > >> package away3dlite.materials > >> { > >> import flash.display.BitmapData; > >> import flash.display.DisplayObject; > >> import flash.display.Graphics; > >> import flash.geom.Matrix; > >> import flash.geom.Rectangle; > > >> public class MovieMaterial extends BitmapMaterial > >> { > >> public var movie:DisplayObject; > >> public var movieTransparent:Boolean; > >> private var userClipRect:Rectangle; > >> private var transRect:Matrix; > > >> public function MovieMaterial( movieAsset:DisplayObject, > >> transparent:Boolean=false, rect:Rectangle=null ) > >> { > >> movieTransparent = transparent; > >> movie = movieAsset; > >> initRect(rect); > >> createBitmap(movie); > >> drawBitmap(); > >> } > > >> protected function initRect(rect:Rectangle=null):void > >> { > >> userClipRect = rect || movie.getBounds(movie); > >> transRect = new Matrix(1, 0, 0, 1, -userClipRect.x, > >> - > >> userClipRect.y); > >> } > > >> protected function createBitmap(asset:DisplayObject):void > >> { > >> if(_graphicsBitmapFill.bitmapData) > >> _graphicsBitmapFill.bitmapData.dispose(); > > >> if (userClipRect) > >> { > >> _graphicsBitmapFill.bitmapData = new > >> BitmapData(int > >> (userClipRect.width+0.5), int(userClipRect.height+0.5), > >> movieTransparent, 0x000000); > >> } > >> else if (asset.width == 0 || asset.height == 0) > >> { > >> _graphicsBitmapFill.bitmapData = new > >> BitmapData(256, 256, > >> movieTransparent, 0x000000); > >> } > >> else > >> { > >> _graphicsBitmapFill.bitmapData = new > >> BitmapData(int(asset.width > >> +0.5), int(asset.height+0.5), movieTransparent, 0x000000); > >> } > >> } > > >> public function drawBitmap():void > >> { > >> _graphicsBitmapFill.bitmapData.fillRect > >> (_graphicsBitmapFill.bitmapData.rect, 0x000000); > >> _graphicsBitmapFill.bitmapData.draw(movie, > >> transRect, > >> movie.transform.colorTransform, null); > >> } > > >> } > >> }
