thx for bug report, try update svn, should be fix by now ;) http://away3d.googlecode.com/svn/branches/lite/bin/ExParticlesPosition.swf
cheers On 9 August 2010 19:52, ConteZero <[email protected]> wrote: > I think there is a bug in particles clipping with away3dlite (lite > branch found in svn), particles behind the camera are not clipped > correctly. > I've changed ExParticlesPosition.as to show the problem > > package > { > import away3dlite.containers.Particles; > import away3dlite.core.base.Particle; > import away3dlite.materials.*; > import away3dlite.primitives.*; > import away3dlite.templates.*; > > import flash.display.*; > import flash.events.*; > import flash.filters.BlurFilter; > import flash.geom.Matrix; > > [SWF(backgroundColor="#000000", frameRate="30", width="800", > height="600")] > /** > * Particles Example > * @author katopz > */ > public class ExParticlesPosition extends BasicTemplate > { > private var _particles:Particles; > private var _particleMaterial:ParticleMaterial; > > private const radius:uint = 350; > private const max:int = 1000; > private const size:uint = 10; > > private const _totalFrames:uint = 30; > > override protected function onInit():void > { > title = "Away3DLite | Particles : " + max + " | > Click to toggle > Particles Draw mode (sprite/bitmap)"; > > // create materials > _particleMaterial = createParticleMaterial(size); > > // create particles > _particles = new Particles(); > scene.addChild(_particles); > > // positions > /* _particles.addParticle(new > Particle(_particleMaterial.clone(), > 100, 0, 0)); > _particles.addParticle(new > Particle(_particleMaterial.clone(), 0, > 100, 0)); > _particles.addParticle(new > Particle(_particleMaterial.clone(), 0, > 0, 100)); > > _particles.addParticle(new > Particle(_particleMaterial.clone(), > -100, 0, 0)); > _particles.addParticle(new > Particle(_particleMaterial.clone(), 0, > -100, 0));*/ // changed > _particles.addParticle(new > Particle(_particleMaterial.clone(), 0, > 0, -2500)); // changed > > // center > scene.addChild(new Sphere(null, 100, 6, 6)); > > // toggle > stage.addEventListener(MouseEvent.CLICK, onClick); > } > > private function > createParticleMaterial(radius:Number):ParticleMaterial > { > var bitmapData:BitmapData = new BitmapData(radius * > 2, radius * 2, > true, 0x00000000); > var _material:ParticleMaterial = new > ParticleMaterial(bitmapData, > radius * 2, radius * 2); > > var shape:Shape = new Shape(); > shape.graphics.lineStyle(); > shape.graphics.beginFill(0xFF00FF, 0.75); > shape.graphics.drawCircle(0, 0, radius); > shape.graphics.endFill(); > > bitmapData.draw(shape, new Matrix(1, 0, 0, 1, > radius, radius)); > > return _material; > } > > private function onClick(event:MouseEvent):void > { > if (!_particles.bitmap) > { > _particles.bitmap = new Bitmap(new > BitmapData(view.screenWidth, > view.screenHeight, true, 0x00000000)); > addChild(_particles.bitmap); > > // bitmap effect > _particles.bitmap.filters = [new > BlurFilter(8, 8)]; > _particles.bitmap.blendMode = BlendMode.ADD; > } > else > { > removeChild(_particles.bitmap); > _particles.bitmap.bitmapData.dispose(); > _particles.bitmap = null; > } > } > > override protected function onPreRender():void > { > // scene.rotationX += .5; // changed > scene.rotationY += .5; > // scene.rotationZ += .5; // changed > } > } > } -- Regards ----------------------------------------------------------- Todsaporn Banjerdkit, katopz, http://sleepydesign.com Away3DLite and JigLibFlash Developer Team
