Flint Particle System Forum - Images in PixelRenderer? Tue, 13 Dec 2011 10:10:11 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=126#Comment_126 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=126#Comment_126 Thu, 08 May 2008 22:29:47 +0100 ericr
SharedBitmapData:package org.flintparticles.initializers
{
import flash.display.BitmapData;

import org.flintparticles.emitters.Emitter;
import org.flintparticles.particles.Particle;

public class SharedBitmapData extends Initializer
{
private var _bitmapData:BitmapData;
private var curX:uint = 0;
private var curY:uint = 0;

public function SharedBitmapData( bmd:BitmapData )
{
_bitmapData = bmd;
}

override public function initialize( emitter:Emitter, particle:Particle ):void
{
particle.x += curX;
particle.y += curY;

particle.color = _bitmapData.getPixel32(curX, curY);

// Update curX and curY.
if (curX >= _bitmapData.width - 1)
{
if (curY >= _bitmapData.height - 1)
{
curX, curY = 0;
}
else
{
curX = 0;
++curY;
}
}
else
{
curX++;
}
}
}
}

Example Implementation Snippet:var renderer:PixelRenderer = new PixelRenderer(new Rectangle(0, 0, 100, 100));
renderer.addFilter(new BlurFilter(4, 4, 1));
addChild(renderer);

var bmd:BitmapData = someBitmapDataObjectWotWasLoadedElsewhere;
emitter = new Emitter();
emitter.counter = new Blast(bmd.width * bmd.height);

emitter.addInitializer(new Position(new PointZone(new Point(renderer.width/2 - bmd.width/2, renderer.height/2 - bmd.height/2))));
emitter.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 30, 30)));
emitter.addInitializer(new Lifetime(1, 1.5));
emitter.addInitializer(new SharedBitmapData(bmd));

emitter.addAction(new Move());
emitter.addAction(new Age());
emitter.addAction(new DeathZone(new DiscZone(new Point(0, 0), 50, 50)));
emitter.renderer = renderer;
emitter.start();

Of specific import is the line involving the counter. You are essentially adding the number of pixels located in the image to the emitter (one particle per pixel). This is calculated simply by Width times Height. Cake.

The above effect will explode your loaded image into pixel-particles. They will blur and fade as they go. The entire effect lasts around 1.5 seconds.

Thoughts? Anyone have any ideas on how to better implement this kind of thing? ]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=129#Comment_129 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=129#Comment_129 Sat, 10 May 2008 15:59:34 +0100 Richard Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=130#Comment_130 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=130#Comment_130 Mon, 12 May 2008 18:12:42 +0100 ericr this. How about creating an emitter that can handle that kind of thing ;)

They apparently use a class called Particle3D. Are you working on something similar for the 3D-capable version of Flint or is it more making the particle effects renderable (put the renderers on texture/normal maps, etc)?

Also, did the other developer provide any test implementation code? I'd like to compare notes if so ;D ]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=131#Comment_131 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=131#Comment_131 Mon, 12 May 2008 23:11:48 +0100 Richard
The plan for 3d is a full 3d space for the particle system, with particles rendered on billboards or as 3d objects, with stand-alone renderers plus renderers for Papervision3D and Sandy in the library and a renderer interface that enables the creation of renderers for other 3d systems too. It may take awhile to get there but I believe it is a good plan and I hope to have something very rough to show by the end of this month - time permitting.

P.S. The other developer hasn't sent me any code yet. He was working on a more general system of zones and renderers that included initialising particles based on the properties of an image. I'm hoping he will send me some code or better still share it on this forum. ]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1198#Comment_1198 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1198#Comment_1198 Wed, 12 May 2010 12:30:32 +0100 jmp909
thanks
j ]]>
Images in PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1211#Comment_1211 http://flintparticles.org/forum/comments.php?DiscussionID=26&Focus=1211#Comment_1211 Wed, 19 May 2010 07:49:01 +0100 Richard Particle2DUtils.createPixelParticlesFromBirmapData(). ]]>