[Papervision3D] Papervision3D Digest, Vol 32, Issue 11

Andy Zupko azupko at zupko.info
Wed May 6 09:27:59 PDT 2009


You can do Number3D.sub(pointA, pointB).modulo (or moduloSquared for  
faster)


On May 6, 2009, at 11:08 AM, Gwilym Johnston wrote:

> Hi all,
>
> Quick question:
> is there an equivalent of Point.distance(pointA, pointB) in  
> Papervision?
>
> Thanks
>
> On 6 May 2009, at 10:30, Papervision3D-request at osflash.org wrote:
>
>> Send Papervision3D mailing list submissions to
>> 	papervision3d at osflash.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> 	http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>> or, via email, send a message with subject or body 'help' to
>> 	papervision3d-request at osflash.org
>>
>> You can reach the person managing the list at
>> 	papervision3d-owner at osflash.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Papervision3D digest..."
>>
>>
>> Today's Topics:
>>
>>   1. DAE Memory Leak (Ryan Kee)
>>   2. Detect Mouse Events in a viewport (Sandeep Menon)
>>   3. Re: Detect Mouse Events in a viewport (Steve D)
>>   4. Re: Detect Mouse Events in a viewport (Sandeep Menon)
>>   5. Re: Detect Mouse Events in a viewport (Steve D)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 5 May 2009 15:25:39 -0500
>> From: Ryan Kee <me at ryankee.com>
>> Subject: [Papervision3D] DAE Memory Leak
>> To: papervision3d at osflash.org
>> Message-ID: <A5C971FF-87AE-4960-824A-4588DA568B13 at ryankee.com>
>> Content-Type: text/plain; charset="us-ascii"; Format="flowed";
>> 	DelSp="yes"
>>
>> Hey everyone. I'm having an issue with a memory leak when dealing  
>> with
>> DAEs. At first I thought it was the same problem that older builds of
>> PV3D had with dictionary objects not using weak references (Seb fixed
>> those a few months ago:http://www.sebleedelisle.com/?p=309), but  
>> after
>> running side by side tests of adding and deleting primitives and  
>> DAEs,
>> the memory creep was only present with DAE files.
>>
>> For my current application I have the need to load and unload several
>> DAE models and apply the same texture to all of them. In theory,
>> something like this should work:
>> Code:
>>
>> import org.papervision3d.materials.ColorMaterial;
>> import org.papervision3d.materials.utils.MaterialsList;
>> import org.papervision3d.objects.parsers.DAE;
>> import org.papervision3d.view.Viewport3D;
>> import org.papervision3d.render.BasicRenderEngine;
>> import org.papervision3d.cameras.Camera3D;
>> import org.papervision3d.scenes.Scene3D;
>> import org.papervision3d.events.FileLoadEvent;
>> import org.papervision3d.view.stats.StatsView;
>>
>> public var SCENE:Scene3D = new Scene3D();
>> public var CAMERA:Camera3D = new Camera3D();
>> public var RENDERER:BasicRenderEngine = new BasicRenderEngine();
>> public var VIEWPORT:Viewport3D = new Viewport3D(640,480);
>> public var COLLADA:DAE;
>> public var MATERIALS:MaterialsList = new MaterialsList();
>> public var COLOR_MAT:ColorMaterial = new ColorMaterial();
>>
>> public function init():void
>> {
>> 	//add the viewport to the stage
>> 	stage.addChild(VIEWPORT);
>> 	//set up material list
>> 	MATERIALS.addMaterial(COLOR_MAT, 'TextureName');
>> 	//create collada
>> 	loadCollada();
>> 	//set up mouse event to unload the current dae and load another
>> 	stage.addEventListener(MouseEvent.CLICK, unloadCollada);
>> }
>>
>> public function loadCollada():void
>> {
>> 	COLLADA = new DAE();
>> 	COLLADA.load('dae/yourFileName.dae', MATERIALS);
>> 	COLLADA.addEventListener(FileLoadEvent.LOAD_COMPLETE, daeLoaded);
>> 	COLLADA.scale = 3500;
>> }
>>
>> public function unloadCollada(e:MouseEvent):void
>> {
>> 	//remove the collada from the scene and set everything to null
>> 	SCENE.removeChild(COLLADA);
>> 	COLLADA.geometry = null;
>> 	COLLADA.materials = null;
>> 	COLLADA.document = null;
>> 	COLLADA = null;
>> 	//load the collada again
>> 	loadCollada();
>> }
>>
>> public function daeLoaded(e:FileLoadEvent):void
>> {
>> 	//remove event listener
>> 	COLLADA.removeEventListener(FileLoadEvent.LOAD_COMPLETE, daeLoaded);
>> 	//add collada to the scene
>> 	SCENE.addChild(COLLADA);
>> 	//set up and start render timer
>> 	var TIMER:Timer = new Timer(20);
>> 	TIMER.addEventListener(TimerEvent.TIMER, renderScene);
>> 	TIMER.start();
>> }			
>>
>> public function renderScene(e:TimerEvent):void
>> {
>> 	RENDERER.renderScene(SCENE, CAMERA, VIEWPORT);
>> }
>>
>>
>> If you were to compile this, you'd see that the memory keeps building
>> every time you click the stage. If I replaced the DAE with a Cube,
>> there isn't any memory leak. Any ideas?
>>
>> Ryan
>>
>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090505/ad73caa8/attachment-0001.html 
>> >
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Wed, 6 May 2009 13:42:15 +0530
>> From: Sandeep Menon <sandeepmenon24 at gmail.com>
>> Subject: [Papervision3D] Detect Mouse Events in a viewport
>> To: papervision3d at osflash.org
>> Message-ID:
>> 	<6895a11c0905060112w4ccb1ad8ib472bfcb16ece8d6 at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> Hi,
>>
>> I've got the following setup in a papervision application I'm  
>> working on.
>>
>>   - A Viewport3D object, that's added as a child of a
>>   - UIComponent, that in turn is added as a child to a
>>   - A custom object, that's derived from a Canvas class
>>
>> What i want to do is detect any mouse events that happen within the
>> viewport, not just those that occur over any scene objects.
>>
>>
>> How would I go about handling this, by adding the listener to the  
>> viewport
>> itself or even the UIcomponent object, rather than dealing with it  
>> at the
>> Canvas-derived object?
>>
>> Thanks,
>> sm
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090506/21c11565/attachment-0001.html 
>> >
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Wed, 6 May 2009 01:48:08 -0700
>> From: Steve D <kruass at gmail.com>
>> Subject: Re: [Papervision3D] Detect Mouse Events in a viewport
>> To: papervision3d at osflash.org
>> Message-ID:
>> 	<f66fee040905060148q17a8235amcd0fba5e8e90a835 at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> If the UIComponent or Canvas have solid backgrounds, and they will  
>> detect a
>> hittest.  You can put your event listener on them.  If they are  
>> transparent
>> (as the viewport is), then you'll need the listener on the scene,  
>> and do
>> bounds checking in the event handler method.
>>
>>
>>
>> On Wed, May 6, 2009 at 1:12 AM, Sandeep Menon <sandeepmenon24 at gmail.com 
>> >wrote:
>>
>>> Hi,
>>>
>>> I've got the following setup in a papervision application I'm  
>>> working on.
>>>
>>>   - A Viewport3D object, that's added as a child of a
>>>   - UIComponent, that in turn is added as a child to a
>>>   - A custom object, that's derived from a Canvas class
>>>
>>> What i want to do is detect any mouse events that happen within the
>>> viewport, not just those that occur over any scene objects.
>>>
>>>
>>> How would I go about handling this, by adding the listener to the  
>>> viewport
>>> itself or even the UIcomponent object, rather than dealing with it  
>>> at the
>>> Canvas-derived object?
>>>
>>> Thanks,
>>> sm
>>>
>>>
>>> _______________________________________________
>>> Papervision3D mailing list
>>> Papervision3D at osflash.org
>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090506/cef39964/attachment-0001.html 
>> >
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Wed, 6 May 2009 14:48:24 +0530
>> From: Sandeep Menon <sandeepmenon24 at gmail.com>
>> Subject: Re: [Papervision3D] Detect Mouse Events in a viewport
>> To: papervision3d at osflash.org
>> Message-ID:
>> 	<6895a11c0905060218r1bc3179cxa2f0746f7406494d at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> so, if i have a viewport that's embedded in a UIComponent of the  
>> same size,
>> being transparent, I'll need to add the listener to the scene object
>> instead?
>>
>> On Wed, May 6, 2009 at 2:18 PM, Steve D <kruass at gmail.com> wrote:
>>
>>> If the UIComponent or Canvas have solid backgrounds, and they will  
>>> detect a
>>> hittest.  You can put your event listener on them.  If they are  
>>> transparent
>>> (as the viewport is), then you'll need the listener on the scene,  
>>> and do
>>> bounds checking in the event handler method.
>>>
>>>
>>>
>>> On Wed, May 6, 2009 at 1:12 AM, Sandeep Menon <sandeepmenon24 at gmail.com 
>>> >wrote:
>>>
>>>> Hi,
>>>>
>>>> I've got the following setup in a papervision application I'm  
>>>> working on.
>>>>
>>>>   - A Viewport3D object, that's added as a child of a
>>>>   - UIComponent, that in turn is added as a child to a
>>>>   - A custom object, that's derived from a Canvas class
>>>>
>>>> What i want to do is detect any mouse events that happen within the
>>>> viewport, not just those that occur over any scene objects.
>>>>
>>>>
>>>> How would I go about handling this, by adding the listener to the  
>>>> viewport
>>>> itself or even the UIcomponent object, rather than dealing with  
>>>> it at the
>>>> Canvas-derived object?
>>>>
>>>> Thanks,
>>>> sm
>>>>
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090506/c10d90cf/attachment-0001.html 
>> >
>>
>> ------------------------------
>>
>> Message: 5
>> Date: Wed, 6 May 2009 02:30:42 -0700
>> From: Steve D <kruass at gmail.com>
>> Subject: Re: [Papervision3D] Detect Mouse Events in a viewport
>> To: papervision3d at osflash.org
>> Message-ID:
>> 	<f66fee040905060230k15d8f44boe69540b79c7485c at mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> A Flash displayobject wont detect mouse events on any part of it  
>> that is
>> 100% transparent.  The typical way to get around this is to put the  
>> mouse
>> event on the scene, and then manually figure out if the mouse event  
>> should
>> be affecting the transparent displayobject.
>>
>>
>> On Wed, May 6, 2009 at 2:18 AM, Sandeep Menon <sandeepmenon24 at gmail.com 
>> >wrote:
>>
>>> so, if i have a viewport that's embedded in a UIComponent of the  
>>> same size,
>>> being transparent, I'll need to add the listener to the scene object
>>> instead?
>>>
>>>
>>> On Wed, May 6, 2009 at 2:18 PM, Steve D <kruass at gmail.com> wrote:
>>>
>>>> If the UIComponent or Canvas have solid backgrounds, and they  
>>>> will detect
>>>> a hittest.  You can put your event listener on them.  If they are
>>>> transparent (as the viewport is), then you'll need the listener  
>>>> on the
>>>> scene, and do bounds checking in the event handler method.
>>>>
>>>>
>>>>
>>>> On Wed, May 6, 2009 at 1:12 AM, Sandeep Menon <sandeepmenon24 at gmail.com 
>>>> >wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> I've got the following setup in a papervision application I'm  
>>>>> working on.
>>>>>
>>>>>   - A Viewport3D object, that's added as a child of a
>>>>>   - UIComponent, that in turn is added as a child to a
>>>>>   - A custom object, that's derived from a Canvas class
>>>>>
>>>>> What i want to do is detect any mouse events that happen within  
>>>>> the
>>>>> viewport, not just those that occur over any scene objects.
>>>>>
>>>>>
>>>>> How would I go about handling this, by adding the listener to the
>>>>> viewport itself or even the UIcomponent object, rather than  
>>>>> dealing with it
>>>>> at the Canvas-derived object?
>>>>>
>>>>> Thanks,
>>>>> sm
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Papervision3D mailing list
>>> Papervision3D at osflash.org
>>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>>
>>>
>> -------------- next part --------------
>> An HTML attachment was scrubbed...
>> URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090506/7fce51ff/attachment.html 
>> >
>>
>> ------------------------------
>>
>> _______________________________________________
>> Papervision3D mailing list
>> Papervision3D at osflash.org
>> http://osflash.org/mailman/listinfo/papervision3d_osflash.org
>>
>>
>> End of Papervision3D Digest, Vol 32, Issue 11
>> *********************************************
>
> Gwilym Johnston
>
> e: me at gwilym.com
> w: www.gwilym.com
> m: + 44 (0) 7595 727365
>
>
>
>
>
>
> _______________________________________________
> Papervision3D mailing list
> Papervision3D at osflash.org
> http://osflash.org/mailman/listinfo/papervision3d_osflash.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20090506/1a9b67b3/attachment-0001.html>


More information about the Papervision3D mailing list