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

    • CommentAuthormpelham
    • CommentTimeFeb 13th 2009
     
    FLINT is a great engine that supports most 3D classes available. One of the fastest and more beginner friendly 3D engines that I've come across in my experimentation with these platforms is the Alternativa Engine.
    The Alternativa Engine is, unfortunately, closed source. This could make development difficult, however, much of the structure is deja-vu inducingly familiar to PV3D and Away3D. I've begun writing an AlternativaRenderer, but am coming across a few issues getting the Particles mapped to Object3Ds (DisplayObject3D/Containers in Alternativa's Lingo) and am thinking the better choice is the Sprite3D class. This class can be extended for multiple phases (IE a timeline) relatively easily, supports transparency and is native to the engine.

    Maybe I'm the only one out here craving this confluence, but I'll post my delvings here in the hopes that some other braver and wiser soul comes across it:
    package {
    import flash.display.*;

    import org.flintparticles.common.particles.Particle;
    import org.flintparticles.common.renderers.RendererBase;
    import org.flintparticles.common.utils.Maths;
    import org.flintparticles.threeD.papervision3d.utils.Convert;
    import org.flintparticles.threeD.particles.Particle3D;

    //import org.papervision3d.core.math.Number3D;
    //import org.papervision3d.core.math.Quaternion;
    import alternativa.utils.MathUtils;

    //import org.papervision3d.objects.DisplayObject3D;
    //import org.papervision3d.core.proto.DisplayObjectContainer3D;
    import alternativa.engine3d.core.Object3D;
    import alternativa.engine3d.core.Sprite3D;

    //import org.papervision3d.materials.MovieMaterial;
    import alternativa.engine3d.materials.SpriteTextureMaterial;
    import alternativa.types.Texture;

    //import org.papervision3d.objects.primitives.Plane;
    import alternativa.engine3d.primitives.Plane;

    /**
    * Renders the particles in a Papervision3D scene.
    *
    * <p>To use this renderer, the particles' image properties should be
    * Papervision3D objects, renderable in a Papervision3D scene. This renderer
    * doesn't update the scene, but copies each particle's properties
    * to its image object so next time the Papervision3D scene is rendered the
    * image objects are drawn according to the state of the particle
    * system.</p>
    */
    public class AlternativaRenderer extends RendererBase {
    private var _container:Object3D;
    public function AlternativaRenderer( container:Object3D ) {
    super();
    _container = container;
    }
    override protected function renderParticles( particles:Array ):void {

    var o:Sprite3D;
    var texture:Texture;
    var textureMaterial:SpriteTextureMaterial;
    var bd:BitmapData;
    for each (var p:Particle3D in particles) {
    bd = new BitmapData(DisplayObject(p.image).width, DisplayObject(p.image).height, true, 0x000000);
    bd.draw(p.image);

    texture = new Texture(bd);

    textureMaterial = new SpriteTextureMaterial(texture);
    o.material = textureMaterial;

    trace(o+":"+o.material); // THIS DOES NOT TRACE - ERROR

    o.x = p.position.x;
    o.y = p.position.y;
    o.z = p.position.z;
    o.scaleX = o.scaleY = o.scaleZ = p.scale;

    // rotation
    /* var r:Number3D = Convert.QuaternionToPV3D( p.rotation ).toEuler();
    o.rotationX = Maths.asDegrees( r.x );
    o.rotationY = Maths.asDegrees( r.y );
    o.rotationZ = Maths.asDegrees( r.z );*/
    }
    }

    override protected function addParticle( particle:Particle ):void {
    _container.addChild( Sprite3D( particle.image ) ); //ERROR
    }

    override protected function removeParticle( particle:Particle ):void {
    _container.removeChild( Sprite3D( particle.image ) ); //ERROR
    }
    }
    }
    • CommentAuthorRichard
    • CommentTimeFeb 14th 2009
     
    Hi

    I'd like to get Flint working with Alternativa3D, but it's not currently a priority for me so it's great that you're doing it. If you need some pointers, I would be very happy to make suggestions.

    One thought - you'll need some Alternativa3D specific initializers to initialize the image to a Sprite3D object and to set this object's texture, similar to the classes in Flint's papervision3D initializers.

    Keep posting issues and updates here and hopefully we can encourage you to keep working on it and help you out as necessary.

    Richard
    • CommentAuthormpelham
    • CommentTimeMar 8th 2009
     
    I've got some classes together that should be shared.
    I'll host them on my site tonight or tomorrow.
    • CommentAuthormpelham
    • CommentTimeMar 8th 2009
     
    Ok, here's some useful stuff. It's not finished but its getting a lot smoother.
    It will currently take any DisplayObject and pass on to the needed ImageClass. No 3D support but hey, I moved on to other projects, sue me :D.
    There is a particle test included.

    http://www.mattpelham.com/AX/
    • CommentAuthormpelham
    • CommentTimeMar 8th 2009
     
    The most important are the Renderer, Convert and Types. Multiphase is for animated sprites but is not implemented.