Not sure if it safe to say I'm getting it but the explanation makes
sense ... it's just the detailed syntax again that is the problem ...
maybe :S

If a BitmapMaterial is BitmapData then why would the following produce
null for mybitmapmat ??

(btw I hope it's ok I pieced together some of your code I found with
Rob B's and others ... let me know if that is bad to do)

private function initGrabRect():void
{
//rectBitmap = new BitmapData( stage.width, stage.height, true );
mybitmapmat = new BitmapData( mybitmapmat.width, mybitmapmat.height,
true );
//addChild( new Bitmap( rectBitmap ) );
}

where mybitmapmat comes from:

[Embed(source="icosa_1_diff_blue.jpg")]public var mainboddiff0:Class;

public var mainobjarr:Array=[mainboddiff0];

mybitmapmat = new BitmapMaterial(Cast.bitmap(mainobjarr[0]));

... do I have to convert it from BitmapMaterial to BitmapData?


On May 23, 3:51 pm, Fabrice3D <[email protected]> wrote:
> the rectclip is directly linked to the bitmapdata concept.
>
> If you use the movieMaterial, each time you do call the update (if the  
> autoupdate property is false)
> the whole bitmapdata of the material is updated. Because internally  
> the information is stored into a bitmapdata.
> In your case you want just move an item on the earth texture. so why  
> draw the whole bitmap again?
> instead you pass a rectangle defining the region to update. as a  
> result, you can run huge texture and update them at much higher speed  
> using
> the cliprect.
>
> >  For example, "copy background
> > rect" or  "copy new part where you paste" code-wise what do you mean?
>
> The bitmapdata approach is the most complicated if you are not  
> familiar with the bitmapdata class.
> The principle is quite simple and the cliprect describe above is being  
> used again.
>
> you have your earth texture and your aircraft bitmap.
> using the bitmapdata class you can offset the x and y of the source  
> you copypixel into a destination bitmapdata.
> so if you copy the earth texture at the rect you want to paste the  
> aircraft first and save it for later. copypixel the aircraft into the  
> bitmapdata
> next iteration, you want update the aircraft again. if you would not  
> restore the background, you will get trails.
> so you need first to copypixel the background, copy a new piece of the  
> background equal to the new position of the aircraft, save it again,
> paste the aircraft at new location etc etc... no need to say its  
> highly recommanded to use the same size for both aircraft and  
> background patch bitmapdata's.
>
> the copypixel is fast so if you avoid to generate new bitmapdata's  
> each time, it will run as fast or even faster than the MovieMaterial.
>
> Fabrice
>
> On May 24, 2009, at 12:25 AM, Joseph wrote:
>
>
>
>
>
> > Thanks for the response Fabrice.
>
> > I can't seem to find Rob's earth/smiley example/code on away3d.com
> > anywhere ... :S
>
> > Also looked at AnimatedBitmapMaterial but that didn't seem the right
> > direction.
>
> > The whole rectclip concept isn't very clear as to what is going on
> > basically. Could you eloborate just a wee bit more for me and other
> > noobs?
>
> > I'm starting to realize my big problem (there are others I know I
> > know :S ) is the syntax for things. For example, "copy background
> > rect" or  "copy new part where you paste" code-wise what do you mean?
>
> > Thanks again Fabrice for being right here when all the noobs and
> > others need you. It's very appreciated :)
>
> > On May 23, 12:39 pm, Fabrice3D <[email protected]> wrote:
> >> yes you can do this way, there is another example that Rob made, very
> >> similar to what you want.
> >> its planet earth with smileys, look on away3d.com posts from 2008.
>
> >> but if its a little plane only...
> >> you just have to copy background rect,  paste your plane on source,
> >> next iteration, paste background back, copy new part where you paste,
> >> paste etc etc
> >> or use MovieMaterial. if you set the rectclip before the update, it
> >> will be easy on code and as fast as bmd only.
>
> >> Fabrice
>
> >> On May 22, 2009, at 11:14 PM, Joseph wrote:
>
> >>> I found this example from Rob Bateman ...
>
> >>> view = new View3D({session:new BitmapRenderSession(1), clip:new
> >>> RectangleClipping(-400, -300, 400, 300)});
> >>> var mybitmapData:BitmapData = view.getBitmapData();
>
> >>> where a bitmap "session" is used instead of a "scene" ... as opposed
> >>> to what I do currently:
>
> >>> view = new View3D({scene:scene,
> >>> camera:camera,renderer:Renderer.BASIC});
>
> >>> apparently this allows you to grab a bitmap image of the rendered  
> >>> view
> >>> then apply effects to it (here's the post):
> >>>http://groups.google.com/group/away3d-dev/msg/b7bd8151cbac34c0
>
> >>> However, I don't understand the difference between a view as a
> >>> "session" and a view as a "scene" ... ?
>
> >>> Is this even the right dirrection for what I want to do?
>
> >>> On May 22, 11:59 am, Joseph <[email protected]> wrote:
> >>>> I must be really bad at keyword searching because I've been  
> >>>> searching
> >>>> with no luck ... also I have nothing significant to give back to  
> >>>> the
> >>>> community code-wise so feel a bit guilty about asking more
> >>>> questions ... I'll donate $$ to the cause eventually or any other  
> >>>> way
> >>>> to give back let me know.
>
> >>>> I have a sphere with a bitmapfile material applied to it. I want to
> >>>> "project"/"draw"/"overlay" a smaller bitmap file onto the sphere
> >>>> bitmap. i.e. create the earth with bitmap file and sphere
> >>>> primitive ... now show a small airplane bitmap "flying" along the
> >>>> surface of the earth with position updated each frame render.
>
> >>>> I've looked at the Away3dTextureProjection demo and it's uber cool
> >>>> but
> >>>> I take a huge perf hit (I'm working with alot of objects).
>
> >>>> Using shaders to do "overlays" and I get a huge perf hit (working
> >>>> with
> >>>> alot of different objects).
>
> >>>> It seems like I should be able to "grab" the bitmap image on the
> >>>> sphere, place the smaller airplane on some point on the sphere  
> >>>> bitmap
> >>>> and put them together back on sphere each enter frame ... ???? If
> >>>> this
> >>>> is possible how do I get access to the bitmap and plop the airplane
> >>>> onto it?
>
> >>>> Cheers in advance.
>
> >>>> Joseph- Hide quoted text -
>
> >> - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

Reply via email to