What for?
- learn to modify more complicate package
- x-mas fun/gift ;D
Required?
- PaperVision3D 2.0 GreatWhite rev 385
- John Grden Shader demo : http://www.rockonflash.com/blog/?p=92
- 2 brains
- i don't want to mess up original "Particle" , so just clone "all" packages that related to "Particle "
- hange "Particle" to "Clip" packages
- merge MovieMaterial to ClipMaterial then i got "MovieClipMaterial" (huh?)
- add "size" to "ParticleField" (call ClipField for now)
MovieClipMaterial.as
after finish doing this, i found this thing useless in "snow" case lol,
package org.papervision3d.materials.special
{
import flash.display.BitmapData;
import flash.display.DisplayObject;
import flash.display.Graphics;
import flash.geom.Matrix;
import org.papervision3d.materials.MovieMaterial;
import org.papervision3d.core.geom.renderables.Clip;
import org.papervision3d.core.render.data.RenderSessionData;
import org.papervision3d.core.render.draw.IClipDrawer;
public class MovieClipMaterial extends ClipMaterial implements IClipDrawer
{
private var scaleMatrix : Matrix;
private var movie : DisplayObject;
private var movieMaterial : MovieMaterial;
public function MovieClipMaterial( movieAsset:DisplayObject=null, transparent:Boolean=false, animated:Boolean=false )
{
super(0, 0);
this.movie = movieAsset;
this.movieMaterial = new MovieMaterial( movie, transparent, animated );
this.bitmap = movieMaterial.bitmap;
this.scaleMatrix = new Matrix();
}
override public function drawClip(clip:Clip, graphics:Graphics, renderSessionData:RenderSessionData):void
{
this.bitmap = movieMaterial.bitmap;
scaleMatrix.a = clip.renderScale;
scaleMatrix.d = clip.renderScale;
scaleMatrix.tx = clip.vertex3D.vertex3DInstance.x;
scaleMatrix.ty = clip.vertex3D.vertex3DInstance.y;
graphics.beginBitmapFill(this.bitmap, scaleMatrix, false, smooth);
graphics.drawRect(clip.vertex3D.vertex3DInstance.x, clip.vertex3D.vertex3DInstance.y,clip.renderScale*this.bitmap.width,clip.renderScale*this.bitmap.height);
graphics.endFill();
renderSessionData.renderStatistics.particles++;
}
}
}
maybe it's better to use 2d particles for "Environment effect" like rain, snow or wot ever
full source code 'll be release later (actually nothing just rename) it's too dirty for now
and need to clean/add method for another case (more useful lol)
happy coding!
No comments:
Post a Comment