Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthormind
    • CommentTimeNov 13th 2008
     
    Hello,

    i took the fountain example from google code and changed the renderer from Pixelrenderer to PV3DParticleRenderer. I also have put a StatsView to see how it is going. FIrst everything seems to be normal, it makes 25 Fps or so. But memory usage gets constantly higher (it does drop sometimes a little but not back normal again) and after a while (some minutes) the Fps also drops down to 10 and even lower. It starts with using 7 MB and after a minutes its 30 MB and growing..

    Any ideas?

    Here is the code i am using:



    package
    {
    import flash.display.Sprite;
    import flash.events.Event;
    import org.flintparticles.threeD.emitters.Emitter3D;
    import org.flintparticles.threeD.papervision3d.PV3DParticleRenderer;
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.core.geom.Particles;
    import org.papervision3d.render.BasicRenderEngine;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.view.Viewport3D;
    import org.papervision3d.view.stats.StatsView;

    [SWF(width='500', height='500', frameRate='61', backgroundColor='#000000')]

    public class flintfountain extends Sprite
    {
    private var viewport:Viewport3D;
    private var emitter:Emitter3D;
    private var pv3dRenderer:BasicRenderEngine;
    private var flintRenderer:PV3DParticleRenderer;
    private var scene:Scene3D;
    private var camera:Camera3D;

    public var particles:Particles;

    public function flintfountain()
    {
    viewport = new Viewport3D( 500, 500 );
    addChild( viewport );
    pv3dRenderer = new BasicRenderEngine();
    scene = new Scene3D();
    camera = new Camera3D();
    camera.z = -300;

    addChild(new StatsView(pv3dRenderer));
    particles = new Particles();
    scene.addChild(particles);
    emitter = new Fountain();
    emitter.position.y = -100;
    flintRenderer = new PV3DParticleRenderer(particles );
    flintRenderer.addEmitter( emitter );
    emitter.start();
    addEventListener( Event.ENTER_FRAME, render, false, 0, true );
    }

    private function render( ev:Event ):void
    {
    // render the view
    pv3dRenderer.renderScene( scene, camera, viewport);
    }
    }
    }

    import org.flintparticles.common.actions.*;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.threeD.actions.*;
    import org.flintparticles.threeD.emitters.Emitter3D;
    import org.flintparticles.threeD.geom.Vector3D;
    import org.flintparticles.threeD.initializers.*;
    import org.flintparticles.threeD.zones.*;
    import org.papervision3d.core.geom.renderables.Particle;
    import org.flintparticles.threeD.papervision3d.initializers.PV3DObjectClass;
    import org.flintparticles.threeD.papervision3d.initializers.ApplyMaterial;
    import org.papervision3d.materials.special.ParticleMaterial;

    class Fountain extends Emitter3D
    {
    public function Fountain()
    {
    counter = new Steady( 500 );
    addInitializer( new PV3DObjectClass( Particle, null, 4 ) );
    addInitializer( new ApplyMaterial( ParticleMaterial, 0x666666, 1, ParticleMaterial.SHAPE_CIRCLE ) );

    addInitializer( new ColorInit( 0xFFCCCCFF, 0xFF6666FF ) );
    addInitializer( new Velocity( new DiscZone( new Vector3D( 0, 250, 0 ), new Vector3D( 0, 1, 0 ), 60 ) ) );
    addInitializer( new Lifetime( 3.2 ) );

    addAction( new Move() );
    addAction( new Accelerate( new Vector3D( 0, -150, 0 ) ) );
    addAction( new Age() );
    }
    }
    • CommentAuthorRichard
    • CommentTimeNov 13th 2008 edited
     
    I ran your code with no problem. Then, just to check, I dropped back to an earlier version of Papervision and ran it and had the problem you observe. When using the original papervision 2.0 beta the particle material objects aren't garbage collected and memory use steadily increases. When using the latest version of papervision, checked out from trunk, I ran your code for two hours at a stable 10Mb memory use. Don't know what the PV3D team did, but I'm glad they did it.
    • CommentAuthormind
    • CommentTimeNov 14th 2008
     
    wow, thanks a lot that's good news! i go get the latest revision.
    sorry i did not think of that before.

    btw great work with the whole library, respect.

    Balazs