[Papervision3D] How to render application as texture using Papervision3

Qiao.Sherlock at inventec.com.cn Qiao.Sherlock at inventec.com.cn
Wed Aug 22 02:04:05 PDT 2007


Hello,
	I have changed the code to this
	movieClip.addChild(loader.content);

	But the error will at 
	material = new InteractiveMovieMaterial( movieClip );

	I think this matter is in MovieMaterial class. 
	If using this kind, the movieClip.width and height all is zero.
	The construction of BitmapData will be error.

	private function initBitmap( asset:*, transparent:Boolean ):*
	{
		this.movieTransparent = transparent || false;

		// Cleanup previous bitmap if needed
		if( bitmap )
			bitmap.dispose();

		// Create new bitmap
		bitmap = new BitmapData( asset.width, asset.height, this.movieTransparent );

		return asset;
	}

> 
> Message: 5
> Date: Wed, 22 Aug 2007 00:13:42 -0700
> From: "Bert Webster" <bert at lightsplasher.com>
> Subject: Re: [Papervision3D] How to render application as texture
> 	usingPapervision3D
> To: <papervision3d at osflash.org>
> Message-ID: <055701c7e48b$f8efca40$0300a8c0 at Condor>
> Content-Type: text/plain; format=flowed; charset="iso-8859-1";
> 	reply-type=original
> 
> Hi,
> You might try changing this:
> movieClip = loader.content as MovieClip;
> to this:
> movieClip.addChild(loader.content);
> 
> I'm kind of doing the same thing in the Away3D code but having trouble as
> well.  At least the first frame is showing up though.
> Bert
> 
> ----- Original Message -----
> From: <Qiao.Sherlock at inventec.com.cn>
> To: <papervision3d at osflash.org>
> Cc: <Luo.Jonathan at inventec.com.cn>
> Sent: Tuesday, August 21, 2007 11:02 PM
> Subject: Re: [Papervision3D] How to render application as texture
> usingPapervision3D
> 
> 
> > Hello:
> > I have loaded the swf into a moiveclip. But it still doesn't work.
> > Some codes at following, please tell me what error in it, thanks a lot.
> >
> > var movieClip : MovieClip;
> > var loader : Loader = new Loader();
> > var material : InteractiveMovieMaterial;
> >
> > loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
> > completeHandler);
> > loader.load(new URLRequest("sample.swf"));
> >
> > private function completeHandler(event:Event):void
> > {
> > movieClip = loader.content as MovieClip;
> > material = new InteractiveMovieMaterial( movieClip );
> >
> > material.animated = true;
> > material.smooth = true;
> >
> > var plane:Plane = new Plane(material, 250,250,8,8);
> > scene.addChild(plane);
> >
> > ObjectController.getInstance().registerStage(stage);
> >
> > addEventListener( Event.ENTER_FRAME, loop );
> > }
> >
> > private function loop(event:Event):void
> > {
> > material.movie.cacheAsBitmap = true;
> > scene.renderCamera( this.camera );
> > material.movie.cacheAsBitmap = false;
> > }
> >
> >
> >> Message: 4
> >> Date: Mon, 20 Aug 2007 07:10:23 -0500
> >> From: "John Grden" <neoriley at gmail.com>
> >> Subject: Re: [Papervision3D] How to render application as texture
> >> using Papervision3D
> >> To: "Luo.Jonathan at inventec.com.cn" <Luo.Jonathan at inventec.com.cn>
> >> Cc: papervision3d at osflash.org
> >> Message-ID:
> >> <814c1ea20708200510p5377cc6bh2407d02a00457cd5 at mail.gmail.com>
> >> Content-Type: text/plain; charset="gb2312"
> >>
> >> I would say you'd have to load the swf into a movieclip container, then
> >> when
> >> that load is complete, use that movieclip with an
> >> InteractiveMovieMaterial
> >> and set the animated property to true if there's animation.
> >>
> >>
> >> hth, let us know if that works,
> >>
> >> John
> >>
> >> On 8/20/07, Luo.Jonathan at inventec.com.cn <Luo.Jonathan at inventec.com.cn>
> >> wrote:
> >> >
> >> >  Dear John:
> >> >
> >> >
> >> >
> >> > The SWF file is in local PC. So there are no security issue. And can
> >> > you
> >> > tell me your solution on loading external SWF in the same PC.
> >> >
> >> >
> >> >
> >> > Thanks.
> >> >
> >> >
> >> >
> >> > Jonathan
> >> >
> >> > 2007/8/20
> >> >  ------------------------------
> >> >
> >> > *From:* John Grden [mailto:neoriley at gmail.com]
> >> > *Sent:* 2007?8?20? 19:47
> >> > *To:* papervision3d at osflash.org
> >> > *Cc:* Luo, Jonathan (??? IES)
> >> > *Subject:* Re: [Papervision3D] How to render application as texture
> >> > using
> >> > Papervision3D
> >> >
> >> >
> >> >
> >> > If you're trying to load an external SWF from another domain, there's
> >> > probably a security issue there and bitmapdata won't draw pixels from a
> >> > swf
> >> > from another domain.
> >> >
> >> > On 8/20/07, *Qiao.Sherlock at inventec.com.cn*
> >> <Qiao.Sherlock at inventec.com.cn>
> >> > wrote:
> >> >
> >> > Hello
> >> >
> >> >          I have a question about Using Papervision3D.
> >> >
> >> >          How to render application as texture using Papervision3D?
> >> >
> >> >          I have implemented Video/picture texture rendering, but can't
> >> render
> >> > a swf file or a web application.
> >> >
> >> >
> >> >
> >> >        I using "Loder" class to load a swf file, but can't map it to a
> >> > BitmapData.
> >> >
> >> >        But if I load a picture file, then I can map it to a BitmapData.
> >> >
> >> >        What's the matter of this?
> >> >
> >> >
> >> >
> >> >        Can you help me?
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Thanks in advance.
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > Sherlock
> >> >
> >> > 2007-8-20
> >> >
> >> >
> >> >
> >> >
> >> > _______________________________________________
> >> > Papervision3D mailing list
> >> > Papervision3D at osflash.org
> >> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >> >
> >> >
> >> >
> >> >
> >> > --
> >> > [  JPG  ]
> >> >
> >>
> >>
> >>
> >> --
> >> [  JPG  ]
> >> -------------- next part --------------
> >> An HTML attachment was scrubbed...
> >> URL:
> >>
> http://osflash.org/pipermail/papervision3d_osflash.org/attachments/2007082
> >> 0/3e430d5e/attachment.html
> >>
> >> ------------------------------
> >>
> >> _______________________________________________
> >> Papervision3D mailing list
> >> Papervision3D at osflash.org
> >> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >>
> >>
> >> End of Papervision3D Digest, Vol 11, Issue 102
> >> **********************************************
> >
> > _______________________________________________
> > Papervision3D mailing list
> > Papervision3D at osflash.org
> > http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> >
> 
> 
> 
> 
> ------------------------------
> 
> Message: 6
> Date: Wed, 22 Aug 2007 17:36:51 +1000
> From: "Andre Spierings" <aspierings at visualjazz.com.au>
> Subject: Re: [Papervision3D] Orbital Quaternion Camera
> To: <papervision3d at osflash.org>
> Message-ID:
> 	<669A75319E953A4FB48DA01CD3D2E55C71E147 at leela.vj.visualjazz.com.au>
> Content-Type: text/plain;	charset="us-ascii"
> 
> I needed a camera that did something simmilar... This is just a rough
> hack... But might be a good start for you.
> 
> You might want to chuck in the y cord... But I didn't require it for my
> project
> 
> private var currentAxisX:Number3D;
> 	private var currentAxisY:Number3D;
> 	private var currentAxisZ:Number3D;
> 
> 	public function lookAtWithDelay( targetObject:DisplayObject3D,
> delay:int, upAxis:Number3D=null ):void
> 	{
> 		var position :Number3D = new Number3D( this.x, this.y,
> this.z );
> 		var target   :Number3D = new Number3D( targetObject.x,
> targetObject.y, targetObject.z );
> 
> 		var zAxis    :Number3D = Number3D.sub( target, position
> );
> 		zAxis.normalize();
> 
> 		if( zAxis.modulo > 0.1 )
> 		{
> 			var xAxis :Number3D = Number3D.cross( zAxis,
> upAxis || UP );
> 			xAxis.normalize();
> 
> 			var yAxis :Number3D = Number3D.cross( zAxis,
> xAxis );
> 			yAxis.normalize();
> 
> 			var look  :Matrix3D = this.transform;
> 
> 
> 			if(currentAxisX == null) {
> 
> 				look.n11 = xAxis.x;
> 				look.n31 = xAxis.z;
> 
> 				look.n12 = -yAxis.x;
> 				look.n32 = -yAxis.z;
> 
> 				look.n13 = zAxis.x;
> 				look.n33 = zAxis.z;
> 
> 				// on the first loop set where the
> camera is pointing
> 				currentAxisX = xAxis;
> 
> 				currentAxisY = yAxis;
> 
> 				currentAxisZ = zAxis;
> 
> 
> 			} else {
> 				var maxCameraSpeed:Number = 1.0;
> 
> 				var offsetAxisX:Number3D = new
> Number3D();
> 				var offsetAxisY:Number3D = new
> Number3D();
> 				var offsetAxisZ:Number3D = new
> Number3D();
> 
> 				var differenceAxisX:Number3D = new
> Number3D();
> 				var differenceAxisY:Number3D = new
> Number3D();
> 				var differenceAxisZ:Number3D = new
> Number3D();
> 
> 				differenceAxisX.x = xAxis.x -
> currentAxisX.x;
> 				differenceAxisX.z = xAxis.z -
> currentAxisX.z;
> 
> 				differenceAxisY.x = yAxis.x -
> currentAxisY.x;
> 				differenceAxisY.z = yAxis.z -
> currentAxisY.z;
> 
> 				differenceAxisZ.x = zAxis.x -
> currentAxisZ.x;
> 				differenceAxisZ.z = zAxis.z -
> currentAxisZ.z;
> 
> 				var test:Number = 0
> 				test = Math.min(test,1)
> 				test = Math.max(-1,test)
> 
> 				offsetAxisX.x =
> (differenceAxisX.x)/delay;
> 				offsetAxisX.z =
> (differenceAxisX.z)/delay;
> 
> 				offsetAxisY.x =
> (differenceAxisY.x)/delay;
> 				offsetAxisY.z =
> (differenceAxisY.z)/delay;
> 
> 				offsetAxisZ.x =
> (differenceAxisZ.x)/delay;
> 				offsetAxisZ.z =
> (differenceAxisZ.z)/delay;
> 
> 
> 
> 				currentAxisX.x = currentAxisX.x +
> offsetAxisX.x;
> 				currentAxisX.z = currentAxisX.z+
> offsetAxisX.z;
> 
> 				currentAxisY.x = currentAxisY.x +
> offsetAxisY.x;
> 				currentAxisY.z = currentAxisY.z +
> offsetAxisY.z;
> 
> 				currentAxisZ.x = currentAxisZ.x +
> offsetAxisZ.x;
> 				currentAxisZ.z = currentAxisZ.z +
> offsetAxisZ.z;
> 
> 
> 				look.n11 = currentAxisX.x;
> 				look.n31 = currentAxisX.z;
> 
> 				look.n12 = -currentAxisY.x;
> 				look.n32 = -currentAxisY.z;
> 
> 				look.n13 = currentAxisZ.x;
> 				look.n33 = currentAxisZ.z;
> 			}
> 
> 			this._transformDirty = false;
> 			this._rotationDirty = true;
> 		}
> 		else
> 		{
> 			var log:XrayLog = new XrayLog();
> 			log.debug( "lookAt Error" );
> 		}
> 	}
> 
> Andre Spierings
> ph: (03) 9693 8333
> www.visualjazz.com.au
> 
> 
> -----Original Message-----
> From: papervision3d-bounces at osflash.org
> [mailto:papervision3d-bounces at osflash.org] On Behalf Of Gabriel Putnam
> Sent: Wednesday, 22 August 2007 4:32 PM
> To: papervision3d at osflash.org
> Subject: [Papervision3D] Orbital Quaternion Camera
> 
> Quick piece that came out of some other work I'm doing.
> 
> Made up a quaternion driven camera which can orbit about any arbitrarily
> picked object in an interactive scene and retains knowledge of its
> relational axis at any orientation.  Might be useful to somebody for
> modeling programs or just media where you want to be able to easily spin
> objects and look at any side of them.
> 
> One quirk right now in that it has a slight shift on selecting new
> objects.  Think there may be something going on behind the scenes in the
> base camera classes that I need to override as all the positions and
> angles are reading correctly in debug.
> 
> http://araesmojo.googlepages.com/OrbitalQuaternionCamera.html
> 
> Source at the same link [zip]
> 
> Oh, and both of the shadowing demos by Cedric and Andy look awesome.
> 
> 
> 
> 
> 
> 
> 
> ________________________________________________________________________
> ____________
> Got a little couch potato?
> Check out fun summer activities for kids.
> http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+ki
> ds&cs=bz
> 
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> 
> 
> 
> ------------------------------
> 
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
> 
> 
> End of Papervision3D Digest, Vol 11, Issue 130
> **********************************************



More information about the Papervision3D mailing list