public static void BreakToParticles(this SpriteRenderer spr, float pixelSize, Material material) { var points = ArrayPool <Vector3> .Get(particleBufferSize); spr.Rasterize(Rasterizer2D.CreateTarget(pixelSize), (point, uv) => { points.Push(point); }); var go = new GameObject(); var ps = go.AddComponent <ParticleSystem>(); ps.Stop(); var psmain = ps.main; psmain.loop = false; psmain.maxParticles = (int)points.length; psmain.duration = 20; psmain.gravityModifier = 1; var psemit = ps.emission; psemit.enabled = false; var pscol = ps.collision; pscol.enabled = true; pscol.mode = ParticleSystemCollisionMode.Collision2D; pscol.type = ParticleSystemCollisionType.World; pscol.bounce = 0.3f; pscol.lifetimeLoss = 0.1f; pscol.dampen = 0.1f; var psr = ps.GetComponent <ParticleSystemRenderer>(); psr.material = material; ps.Emit((int)points.length); var particles = ArrayPool <ParticleSystem.Particle> .Get(points.length); particles.Resize(points.length); ps.GetParticles(particles.array); for (int i = 0; i < particles.length; ++i) { particles.array[i].position = points[i]; particles.array[i].startSize = pixelSize; particles.array[i].velocity = new Vector3(1, 1, 0) * Random.insideUnitCircle * 0.2f; } ps.SetParticles(particles.array, (int)particles.length); ps.Play(); ArrayPool <Vector3> .Release(points); ArrayPool <ParticleSystem.Particle> .Release(particles); }
public void Draw( Graphics graphics, Rasterizer2D fastRasterizer, Class335 coloredPath, bool fill, Matrix4D transform, Class385 context) { Point2D point2D = transform.TransformTo2D(this.vector4D_0); fastRasterizer.DrawPoint(point2D.X, point2D.Y, (uint)coloredPath.Color.ToArgb()); }
public void Draw( Graphics graphics, Rasterizer2D fastRasterizer, Class335 coloredPath, bool fill, Matrix4D transform, Class385 context) { Point2D p1 = transform.TransformTo2D(this.vector4D_0); Point2D p2 = transform.TransformTo2D(this.vector4D_1); fastRasterizer.DrawLineSegment(p1, p2, (uint)coloredPath.Color.ToArgb()); }
public Class386( GraphicsConfig graphicsConfig, Graphics graphics, Rasterizer2D fastRasterizer, SmoothingMode?textSmoothingMode, BlinnClipper4D drawingBoundsClipper, Matrix4D transform, Interface38 textLineWeightScaler, Interface38 nonTextLineWeightScaler, float fixedTextPenWidth, float fixedNonTextPenWidth, Interface22 nonTextColorContext, Interface22 textColorContext) : base(graphicsConfig, graphics, textSmoothingMode, drawingBoundsClipper, transform, textLineWeightScaler, nonTextLineWeightScaler, fixedTextPenWidth, fixedNonTextPenWidth, nonTextColorContext, textColorContext) { this.rasterizer2D_0 = fastRasterizer; }
public void Draw( Graphics graphics, Rasterizer2D fastRasterizer, Class335 coloredPath, bool fill, Matrix4D transform, Class385 context) { this.method_0(transform); if (fill && this.bool_0) { graphics.FillPolygon((Brush)coloredPath.method_3(context), this.pointF_0); } Point2D p1 = (Point2D)(this.bool_0 ? this.pointF_0[this.pointF_0.Length - 1] : this.pointF_0[0]); uint argb = (uint)coloredPath.Color.ToArgb(); for (int index = this.bool_0 ? 0 : 1; index < this.pointF_0.Length; ++index) { Point2D p2 = (Point2D)this.pointF_0[index]; fastRasterizer.DrawLineSegment(p1, p2, argb); p1 = p2; } }
internal void Draw( Graphics graphics, Rasterizer2D fastRasterizer, Rectangle drawingBounds, System.Drawing.Color backColor) { GDIGraphics3D.smethod_0(); GraphicsConfig config = (GraphicsConfig)this.graphicsConfig_0.Clone(); config.BackColor = (ArgbColor)backColor; BlinnClipper4D drawingBoundsClipper = new BlinnClipper4D((double)drawingBounds.Left, (double)drawingBounds.Right, (double)drawingBounds.Top, (double)drawingBounds.Bottom, 0.0, 0.0, false, true); using (Class386 context = new Class386(this.graphicsConfig_0, graphics, fastRasterizer, this.nullable_0, drawingBoundsClipper, this.matrix4D_0, this.method_5(), this.method_6(), this.float_0, this.float_1, Class1002.Create(config, this.float_1), Class1002.Create(config, this.float_0))) { foreach (Interface12 nterface12 in this.linkedList_0) { nterface12.Draw(context); } foreach (Interface12 nterface12 in this.linkedList_1) { nterface12.Draw(context); } } if (this.nodeCollection_0 == null || this.nodeCollection_0.Count <= 0) { return; } foreach (WW.Cad.Drawing.Node node in (List <WW.Cad.Drawing.Node>) this.nodeCollection_0) { using (Pen pen = new Pen((System.Drawing.Color) this.graphicsConfig_0.NodeColor, node.HighLighted ? 2f : 1f)) { WW.Math.Point2D position = this.matrix4D_0.TransformTo2D(node.Position); GdiDrawUtil.DrawEditHandle(graphics, pen, position, this.graphicsConfig_0.NodeSize); } } }