void DoBranch(int x, int y, int z, TreeOutput output) { int dx = rnd.Next(-maxExtent, maxExtent); int dz = rnd.Next(-maxExtent, maxExtent); int clusterSize = rnd.Next(1, maxCluster); int branchStart = rnd.Next(branchBaseHeight, height); int branchMax = branchStart + rnd.Next(3, maxBranchHeight); Vec3S32 p1 = new Vec3S32(x, y + branchStart, z); Vec3S32 p2 = new Vec3S32(x + dx, y + branchMax, z + dz); Line(p1, p2, output); int R = clusterSize; Vec3S32[] marks = new Vec3S32[] { new Vec3S32(x + dx - R, y + branchMax - R, z + dz - R), new Vec3S32(x + dx + R, y + branchMax + R, z + dz + R) }; DrawOp op = new EllipsoidDrawOp(); Brush brush = new SolidBrush(Block.Leaves); op.SetMarks(marks); op.Perform(marks, brush, b => output(b.X, b.Y, b.Z, (BlockRaw)b.Block)); }
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); DrawOp op = null; int brushOffset = cpos.mode == DrawMode.normal ? 0 : 1; Brush brush = GetBrush(p, cpos, brushOffset); if (brush == null) { return; } switch (cpos.mode) { case DrawMode.solid: case DrawMode.normal: op = new EllipsoidDrawOp(); break; case DrawMode.hollow: op = new EllipsoidHollowDrawOp(); break; case DrawMode.vertical: op = new CylinderDrawOp(); break; } if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z)) { return; } if (p.staticCommands) { p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); } }
protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) { RevertAndClearState(p, x, y, z); CatchPos cpos = (CatchPos)p.blockchangeObject; GetRealBlock(type, extType, p, ref cpos); DrawOp drawOp = null; Brush brush = new SolidBrush(cpos.type, cpos.extType); switch (cpos.solid) { case SolidType.solid: drawOp = new EllipsoidDrawOp(); break; case SolidType.hollow: drawOp = new EllipsoidHollowDrawOp(); break; case SolidType.vertical: drawOp = new CylinderDrawOp(); break; } ushort x1 = Math.Min(cpos.x, x), x2 = Math.Max(cpos.x, x); ushort y1 = Math.Min(cpos.y, y), y2 = Math.Max(cpos.y, y); ushort z1 = Math.Min(cpos.z, z), z2 = Math.Max(cpos.z, z); if (!DrawOp.DoDrawOp(drawOp, brush, p, x1, y1, z1, x2, y2, z2)) return; if (p.staticCommands) p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); }