Exemplo n.º 1
0
 public BlockItemEntity(Region tregion, BlockInternal orig, Location pos)
     : base(tregion)
 {
     SetMass(20);
     CGroup = CollisionUtil.Item;
     Original = orig;
     Location offset;
     Shape = BlockShapeRegistry.BSD[orig.BlockData].GetShape(orig.Damage, out offset, true);
     SetPosition(pos.GetBlockLocation() + offset);
 }
Exemplo n.º 2
0
        public virtual KeyValuePair <List <Vector4>, List <Vector4> > GetStretchData(Vector3 blockpos, List <Vector3> vertices, BlockInternal XP, BlockInternal XM,
                                                                                     BlockInternal YP, BlockInternal YM, BlockInternal ZP, BlockInternal ZM, bool bxp, bool bxm, bool byp, bool bym, bool bzp, bool bzm)
        {
            List <Vector4> stretchvals = new List <Vector4>();
            List <Vector4> stretchweis = new List <Vector4>();

            for (int i = 0; i < vertices.Count; i++)
            {
                stretchvals.Add(new Vector4(0, 0, 0, 0));
                stretchweis.Add(new Vector4(0, 0, 0, 0));
            }
            return(new KeyValuePair <List <Vector4>, List <Vector4> >(stretchvals, stretchweis));
        }
Exemplo n.º 3
0
 public void LiquidPhysics(Location block, BlockInternal c)
 {
     Material cmat = c.Material;
     if (!cmat.ShouldSpread())
     {
         return;
     }
     Material spreadAs = cmat.GetBigSpreadsAs();
     if (spreadAs == Material.AIR)
     {
         spreadAs = cmat;
     }
     byte cpaint = c.BlockPaint;
     if (c.BlockData > 5 || c.Damage != BlockDamage.NONE)
     {
         PhysicsSetBlock(block, cmat, 0, cpaint, BlockDamage.NONE);
         return;
     }
     Location block_below = block + new Location(0, 0, -1);
     BlockInternal below = GetBlockInternal(block_below);
     Material below_mat = below.Material;
     if (below_mat == Material.AIR)
     {
         PhysicsSetBlock(block_below, spreadAs, 0, cpaint, BlockDamage.NONE);
         return;
     }
     byte below_paint = below.BlockPaint;
     if ((below_mat == spreadAs || below_mat == cmat) && below_paint == cpaint)
     {
         if (below.BlockData != 0)
         {
             PhysicsSetBlock(block_below, below_mat, 0, cpaint, BlockDamage.NONE);
         }
         return;
     }
     // TODO: What happens when one liquid is on top of another of a different type?!
     // For liquid on top of gas, we can swap their places to make the gas rise...
     // But for the rest?
     if (c.BlockData == 5)
     {
         return;
     }
     TryLiquidSpreadSide(block, c, cmat, cpaint, spreadAs, block + new Location(1, 0, 0));
     TryLiquidSpreadSide(block, c, cmat, cpaint, spreadAs, block + new Location(-1, 0, 0));
     TryLiquidSpreadSide(block, c, cmat, cpaint, spreadAs, block + new Location(0, 1, 0));
     TryLiquidSpreadSide(block, c, cmat, cpaint, spreadAs, block + new Location(0, -1, 0));
 }
Exemplo n.º 4
0
 public override Entity Create(Region tregion, byte[] data)
 {
     int xwidth = (int)Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength, 4));
     int ywidth = (int)Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength + 4, 4));
     int zwidth = (int)Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength + 4 + 4, 4));
     BlockInternal[] bi = new BlockInternal[xwidth * ywidth * zwidth];
     for (int i = 0; i < bi.Length; i++)
     {
         bi[i]._BlockMaterialInternal = Utilities.BytesToUshort(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + i * 2, 2));
         bi[i].BlockData = data[PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 2 + i];
         bi[i].BlockPaint = data[PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 3 + i];
     }
     BGETraceMode tm = (BGETraceMode)data[PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 4];
     BlockGroupEntity bge = new BlockGroupEntity(tregion, tm, bi, xwidth, ywidth, zwidth, Location.FromDoubleBytes(data, PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 4 + 1 + 4));
     bge.Color = System.Drawing.Color.FromArgb(Utilities.BytesToInt(Utilities.BytesPartial(data, PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 4 + 1, 4)));
     bge.scale = Location.FromDoubleBytes(data, PhysicsEntity.PhysicsNetworkDataLength + (4 + 4 + 4) + bi.Length * 4 + 1 + 4 + 24);
     bge.ApplyPhysicsNetworkData(data);
     return bge;
 }
Exemplo n.º 5
0
 public BlockGroupEntity(Region tregion, BGETraceMode mode, BlockInternal[] blocks, int xwidth, int ywidth, int zwidth, Location sOffs)
     : base(tregion, true, true)
 {
     SetMass(blocks.Length);
     XWidth = xwidth;
     YWidth = ywidth;
     ZWidth = zwidth;
     Blocks = blocks;
     TraceMode = mode;
     if (TraceMode == BGETraceMode.PERFECT)
     {
         Vector3 shoffs;
         Shape = new MobileChunkShape(new Vector3i(xwidth, ywidth, zwidth), blocks, out shoffs);
     }
     else
     {
         Shape = CalculateHullShape(out shapeOffs);
     }
     SysConsole.Output(OutputType.INFO, "Shape offs : " + shapeOffs + " vs " + sOffs);
     shapeOffs = sOffs;
 }
Exemplo n.º 6
0
 // TODO: EFficiency needed so much!
 public override void Execute(PlayerCommandEntry entry)
 {
     if (entry.InputArguments.Count < 1)
     {
         entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "/blockship <convex/perfect> [scale]");
         return;
     }
     BGETraceMode tm = BGETraceMode.CONVEX;
     if (entry.InputArguments[0].ToLowerFast() == "perfect")
     {
         tm = BGETraceMode.PERFECT;
     }
     double maxRad = 20; // TODO: Config!
     Location start = (entry.Player.GetPosition() + new Location(0, 0, -0.1)).GetBlockLocation();
     List<KeyValuePair<Location, BlockInternal>> blocks = new List<KeyValuePair<Location, BlockInternal>>();
     AABB extent = new AABB() { Min = start, Max = start };
     if (!FloodFrom(entry.Player.TheRegion, start, blocks, maxRad, extent) || blocks.Count == 0)
     {
         entry.Player.SendMessage(TextChannel.COMMAND_RESPONSE, "Invalid flood-search!");
         return;
     }
     Location size = extent.Max - extent.Min;
     int xwidth = (int)size.X + 1;
     int ywidth = (int)size.Y + 1;
     int zwidth = (int)size.Z + 1;
     int xsub = (int)extent.Min.X;
     int ysub = (int)extent.Min.Y;
     int zsub = (int)extent.Min.Z;
     BlockInternal[] blocksin = new BlockInternal[xwidth * ywidth * zwidth];
     foreach (KeyValuePair<Location, BlockInternal> block in blocks)
     {
         entry.Player.TheRegion.SetBlockMaterial(block.Key, Material.AIR, 0, 0, 1, 0, true, true, true);
         blocksin[(int)(block.Key.Z - zsub) * ywidth * xwidth + (int)(block.Key.Y - ysub) * xwidth + (int)(block.Key.X - xsub)] = block.Value;
     }
     BlockGroupEntity bge = new BlockGroupEntity(extent.Min, tm, entry.Player.TheRegion, blocksin, xwidth, ywidth, zwidth);
     bge.scale = entry.InputArguments.Count < 2 ? Location.One : Location.FromString(entry.InputArguments[1]);
     entry.Player.TheRegion.SpawnEntity(bge);
 }
Exemplo n.º 7
0
 public BlockGroupEntity(Location baseloc, BGETraceMode mode, Region tregion, BlockInternal[] blocks, int xwidth, int ywidth, int zwidth, Location torigin = default(Location))
     : base(tregion)
 {
     SetMass(blocks.Length * 10f);
     XWidth = xwidth;
     YWidth = ywidth;
     ZWidth = zwidth;
     Blocks = blocks;
     TraceMode = mode;
     Origin = torigin;
     if (TraceMode == BGETraceMode.PERFECT)
     {
         Vector3 shoffs;
         Shape = new MobileChunkShape(new Vector3i(xwidth, ywidth, zwidth), blocks, out shoffs); // TODO: Anything offset related needed here?
         shapeOffs = -new Location(shoffs);
     }
     else
     {
         Shape = CalculateHullShape(out shapeOffs);
         shapeOffs = -shapeOffs;
     }
     SetPosition(baseloc - shapeOffs);
 }
Exemplo n.º 8
0
 public void TryLiquidSpreadSide(Location block, BlockInternal c, Material cmat, byte cpaint, Material spreadAs, Location two)
 {
     BlockInternal tc = GetBlockInternal(two);
     Material tmat = tc.Material;
     if (tmat == Material.AIR)
     {
         PhysicsSetBlock(two, spreadAs, (byte)(c.BlockData + 1), cpaint, BlockDamage.NONE);
         return;
     }
     byte tpaint = tc.BlockPaint;
     if ((tmat == cmat || tmat == spreadAs) && tpaint == cpaint)
     {
         if (tc.BlockData > c.BlockData + 1)
         {
             PhysicsSetBlock(two, tmat, (byte)(c.BlockData + 1), cpaint, BlockDamage.NONE);
         }
         return;
     }
 }
Exemplo n.º 9
0
 void VBOHInternal(Chunk c_zp, Chunk c_zm, Chunk c_yp, Chunk c_ym, Chunk c_xp, Chunk c_xm, Chunk c_zpxp, Chunk c_zpxm, Chunk c_zpyp, Chunk c_zpym, List<Chunk> potentials)
 {
     try
     {
         bool shaped = OwningRegion.TheClient.CVars.r_noblockshapes.ValueB;
         Object locky = new Object();
         ChunkRenderHelper rh;
         lock (locky)
         {
             rh = new ChunkRenderHelper();
         }
         if (DENIED)
         {
             return;
         }
         //bool light = OwningRegion.TheClient.CVars.r_fallbacklighting.ValueB
         BlockInternal t_air = new BlockInternal((ushort)Material.AIR, 0, 0, 255);
         List<Vector3> poses = new List<Vector3>();
         List<Vector4> colorses = new List<Vector4>();
         for (int x = 0; x < CSize; x++)
         {
             for (int y = 0; y < CSize; y++)
             {
                 for (int z = 0; z < CSize; z++)
                 {
                     BlockInternal c = GetBlockAt(x, y, z);
                     if ((c.Material).RendersAtAll())
                     {
                         BlockInternal zp = z + 1 < CSize ? GetBlockAt(x, y, z + 1) : (c_zp == null ? t_air : GetLODRelative(c_zp, x, y, z + 1 - CSize));
                         BlockInternal zm = z > 0 ? GetBlockAt(x, y, z - 1) : (c_zm == null ? t_air : GetLODRelative(c_zm, x, y, z - 1 + CSize));
                         BlockInternal yp = y + 1 < CSize ? GetBlockAt(x, y + 1, z) : (c_yp == null ? t_air : GetLODRelative(c_yp, x, y + 1 - CSize, z));
                         BlockInternal ym = y > 0 ? GetBlockAt(x, y - 1, z) : (c_ym == null ? t_air : GetLODRelative(c_ym, x, y - 1 + CSize, z));
                         BlockInternal xp = x + 1 < CSize ? GetBlockAt(x + 1, y, z) : (c_xp == null ? t_air : GetLODRelative(c_xp, x + 1 - CSize, y, z));
                         BlockInternal xm = x > 0 ? GetBlockAt(x - 1, y, z) : (c_xm == null ? t_air : GetLODRelative(c_xm, x - 1 + CSize, y, z));
                         bool rAS = !((Material)c.BlockMaterial).GetCanRenderAgainstSelf();
                         bool pMatters = !c.IsOpaque();
                         bool zps = (zp.IsOpaque() || (rAS && (zp.BlockMaterial == c.BlockMaterial && (pMatters || zp.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : zp.BlockData].OccupiesBOTTOM();
                         bool zms = (zm.IsOpaque() || (rAS && (zm.BlockMaterial == c.BlockMaterial && (pMatters || zm.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : zm.BlockData].OccupiesTOP();
                         bool xps = (xp.IsOpaque() || (rAS && (xp.BlockMaterial == c.BlockMaterial && (pMatters || xp.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : xp.BlockData].OccupiesXM();
                         bool xms = (xm.IsOpaque() || (rAS && (xm.BlockMaterial == c.BlockMaterial && (pMatters || xm.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : xm.BlockData].OccupiesXP();
                         bool yps = (yp.IsOpaque() || (rAS && (yp.BlockMaterial == c.BlockMaterial && (pMatters || yp.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : yp.BlockData].OccupiesYM();
                         bool yms = (ym.IsOpaque() || (rAS && (ym.BlockMaterial == c.BlockMaterial && (pMatters || ym.BlockPaint == c.BlockPaint)))) && BlockShapeRegistry.BSD[shaped ? 0 : ym.BlockData].OccupiesYP();
                         if (zps && zms && xps && xms && yps && yms)
                         {
                             continue;
                         }
                         BlockInternal zpyp;
                         BlockInternal zpym;
                         BlockInternal zpxp;
                         BlockInternal zpxm;
                         if (z + 1 >= CSize)
                         {
                             zpyp = y + 1 < CSize ? (c_zp == null ? t_air : GetLODRelative(c_zp, x, y + 1, z + 1 - CSize)) : (c_zpyp == null ? t_air : GetLODRelative(c_zpyp, x, y + 1 - CSize, z + 1 - CSize));
                             zpym = y > 0 ? (c_zp == null ? t_air : GetLODRelative(c_zp, x, y - 1, z + 1 - CSize)) : (c_zpym == null ? t_air : GetLODRelative(c_zpym, x, y - 1 + CSize, z + 1 - CSize));
                             zpxp = x + 1 < CSize ? (c_zp == null ? t_air : GetLODRelative(c_zp, x + 1, y, z + 1 - CSize)) : (c_zpxp == null ? t_air : GetLODRelative(c_zpxp, x + 1 - CSize, y, z + 1 - CSize));
                             zpxm = x > 0 ? (c_zp == null ? t_air : GetLODRelative(c_zp, x - 1, y, z + 1 - CSize)) : (c_zpxm == null ? t_air : GetLODRelative(c_zpxm, x - 1 + CSize, y, z + 1 - CSize));
                         }
                         else
                         {
                             zpyp = y + 1 < CSize ? GetBlockAt(x, y + 1, z + 1) : (c_yp == null ? t_air : GetLODRelative(c_yp, x, y + 1 - CSize, z + 1));
                             zpym = y > 0 ? GetBlockAt(x, y - 1, z + 1) : (c_ym == null ? t_air : GetLODRelative(c_ym, x, y - 1 + CSize, z + 1));
                             zpxp = x + 1 < CSize ? GetBlockAt(x + 1, y, z + 1) : (c_xp == null ? t_air : GetLODRelative(c_xp, x + 1 - CSize, y, z + 1));
                             zpxm = x > 0 ? GetBlockAt(x - 1, y, z + 1) : (c_xm == null ? t_air : GetLODRelative(c_xm, x - 1 + CSize, y, z + 1));
                         }
                         int index_bssd = (xps ? 1 : 0) | (xms ? 2 : 0) | (yps ? 4 : 0) | (yms ? 8 : 0) | (zps ? 16 : 0) | (zms ? 32 : 0);
                         List<BEPUutilities.Vector3> vecsi = BlockShapeRegistry.BSD[shaped ? 0 : c.BlockData].BSSD.Verts[index_bssd];
                         List<BEPUutilities.Vector3> normsi = BlockShapeRegistry.BSD[shaped ? 0 : c.BlockData].BSSD.Norms[index_bssd];
                         BEPUutilities.Vector3[] tci = BlockShapeRegistry.BSD[shaped ? 0 : c.BlockData].GetTCoordsQuick(index_bssd, c.Material);
                         KeyValuePair<List<BEPUutilities.Vector4>, List<BEPUutilities.Vector4>> ths = !c.BlockShareTex ? default(KeyValuePair<List<BEPUutilities.Vector4>, List<BEPUutilities.Vector4>>) :
                             BlockShapeRegistry.BSD[shaped ? 0 : c.BlockData].GetStretchData(new BEPUutilities.Vector3(x, y, z), vecsi, xp, xm, yp, ym, zp, zm, xps, xms, yps, yms, zps, zms);
                         for (int i = 0; i < vecsi.Count; i++)
                         {
                             Vector3 vt = new Vector3((float)(x + vecsi[i].X) * PosMultiplier, (float)(y + vecsi[i].Y) * PosMultiplier, (float)(z + vecsi[i].Z) * PosMultiplier);
                             rh.Vertices.Add(vt);
                             Vector3 nt = new Vector3((float)normsi[i].X, (float)normsi[i].Y, (float)normsi[i].Z);
                             rh.Norms.Add(nt);
                             rh.TCoords.Add(new Vector3((float)tci[i].X, (float)tci[i].Y, (float)tci[i].Z));
                             byte reldat = 255;
                             if (nt.X > 0.6)
                             {
                                 reldat = zpxp.BlockLocalData;
                             }
                             else if (nt.X < -0.6)
                             {
                                 reldat = zpxm.BlockLocalData;
                             }
                             else if (nt.Y > 0.6)
                             {
                                 reldat = zpyp.BlockLocalData;
                             }
                             else if (nt.Y < -0.6)
                             {
                                 reldat = zpym.BlockLocalData;
                             }
                             else if (nt.Z < 0)
                             {
                                 reldat = c.BlockLocalData;
                             }
                             else
                             {
                                 reldat = zp.BlockLocalData;
                             }
                             Location lcol = OwningRegion.GetLightAmountForSkyValue(ClientUtilities.Convert(vt) + WorldPosition.ToLocation() * CHUNK_SIZE, ClientUtilities.Convert(nt), potentials, reldat / 255f);
                             rh.Cols.Add(new Vector4((float)lcol.X, (float)lcol.Y, (float)lcol.Z, 1));
                             rh.TCols.Add(OwningRegion.TheClient.Rendering.AdaptColor(ClientUtilities.ConvertD(WorldPosition.ToLocation()) * CHUNK_SIZE + ClientUtilities.ConvertToD(vt), Colors.ForByte(c.BlockPaint)));
                             if (ths.Key != null)
                             {
                                 rh.THVs.Add(new Vector4((float)ths.Key[i].X, (float)ths.Key[i].Y, (float)ths.Key[i].Z, (float)ths.Key[i].W));
                                 rh.THWs.Add(new Vector4((float)ths.Value[i].X, (float)ths.Value[i].Y, (float)ths.Value[i].Z, (float)ths.Value[i].W));
                             }
                             else
                             {
                                 rh.THVs.Add(new Vector4(0, 0, 0, 0));
                                 rh.THWs.Add(new Vector4(0, 0, 0, 0));
                             }
                         }
                         if (!c.IsOpaque() && BlockShapeRegistry.BSD[shaped ? 0 : c.BlockData].BackTextureAllowed)
                         {
                             int tf = rh.Cols.Count - vecsi.Count;
                             for (int i = vecsi.Count - 1; i >= 0; i--)
                             {
                                 Vector3 vt = new Vector3((float)(x + vecsi[i].X) * PosMultiplier, (float)(y + vecsi[i].Y) * PosMultiplier, (float)(z + vecsi[i].Z) * PosMultiplier);
                                 rh.Vertices.Add(vt);
                                 int tx = tf + i;
                                 rh.Cols.Add(rh.Cols[tx]);
                                 rh.TCols.Add(rh.TCols[tx]);
                                 rh.Norms.Add(new Vector3((float)-normsi[i].X, (float)-normsi[i].Y, (float)-normsi[i].Z));
                                 rh.TCoords.Add(new Vector3((float)tci[i].X, (float)tci[i].Y, (float)tci[i].Z));
                                 if (ths.Key != null)
                                 {
                                     rh.THVs.Add(new Vector4((float)ths.Key[i].X, (float)ths.Key[i].Y, (float)ths.Key[i].Z, (float)ths.Key[i].W));
                                     rh.THWs.Add(new Vector4((float)ths.Value[i].X, (float)ths.Value[i].Y, (float)ths.Value[i].Z, (float)ths.Value[i].W));
                                 }
                                 else
                                 {
                                     rh.THVs.Add(new Vector4(0, 0, 0, 0));
                                     rh.THWs.Add(new Vector4(0, 0, 0, 0));
                                 }
                             }
                         }
                         if (PosMultiplier == 1 && c.Material.GetPlant() != null && !zp.Material.RendersAtAll() && zp.Material.GetSolidity() == MaterialSolidity.NONSOLID)
                         {
                             if (BlockShapeRegistry.BSD[c.BlockData].Coll == null)
                             {
                                 // TODO: BSD-level precompute this?
                                 Location offset;
                                 BEPUphysics.CollisionShapes.EntityShape es = BlockShapeRegistry.BSD[c.BlockData].GetShape(c.Damage, out offset, false);
                                 BlockShapeRegistry.BSD[c.BlockData].Coll = es.GetCollidableInstance();
                                 BlockShapeRegistry.BSD[c.BlockData].Coll.LocalPosition = -offset.ToBVector();
                             }
                             Location skylight = OwningRegion.GetLightAmountForSkyValue(new Location(WorldPosition.X * Chunk.CHUNK_SIZE + x + 0.5, WorldPosition.Y * Chunk.CHUNK_SIZE + y + 0.5,
                                 WorldPosition.Z * Chunk.CHUNK_SIZE + z + 1.0), Location.UnitZ, potentials, zp.BlockLocalData / 255f);
                             for (int plx = 0; plx < 3; plx++)
                             {
                                 for (int ply = 0; ply < 3; ply++)
                                 {
                                     BEPUutilities.RayHit rayhit;
                                     if (!BlockShapeRegistry.BSD[c.BlockData].Coll.RayCast(new BEPUutilities.Ray(new BEPUutilities.Vector3(0.3333f * plx, 0.3333f * ply, 3), new BEPUutilities.Vector3(0, 0, -1)), 5, out rayhit))
                                     {
                                         rayhit.Location = new BEPUutilities.Vector3(0.3333 * plx, 0.3333 * ply, 1.0);
                                     }
                                     poses.Add(new Vector3(x + (float)rayhit.Location.X, y + (float)rayhit.Location.Y, z + (float)rayhit.Location.Z));
                                     colorses.Add(new Vector4((float)skylight.X, (float)skylight.Y, (float)skylight.Z, 1.0f));
                                 }
                             }
                         }
                     }
                 }
             }
         }
         for (int i = 0; i < rh.Vertices.Count; i += 3)
         {
             Vector3 v1 = rh.Vertices[i];
             Vector3 dv1 = rh.Vertices[i + 1] - v1;
             Vector3 dv2 = rh.Vertices[i + 2] - v1;
             Vector3 t1 = rh.TCoords[i];
             Vector3 dt1 = rh.TCoords[i + 1] - t1;
             Vector3 dt2 = rh.TCoords[i + 2] - t1;
             Vector3 tangent = (dv1 * dt2.Y - dv2 * dt1.Y) / (dt1.X * dt2.Y - dt1.Y * dt2.X);
             Vector3 normal = rh.Norms[i];
             tangent = (tangent - normal * Vector3.Dot(normal, tangent)).Normalized(); // TODO: Necessity of this correction?
             rh.Tangs.Add(tangent);
             rh.Tangs.Add(tangent);
             rh.Tangs.Add(tangent);
         }
         if (rh.Vertices.Count == 0)
         {
             OwningRegion.TheClient.Schedule.ScheduleSyncTask(() =>
             {
                 if (_VBO != null)
                 {
                     VBO tV = _VBO;
                     lock (OwningRegion.TheClient.vbos)
                     {
                         if (OwningRegion.TheClient.vbos.Count < 40)
                         {
                             OwningRegion.TheClient.vbos.Push(tV);
                         }
                         else
                         {
                             tV.Destroy();
                         }
                     }
                 }
                 IsAir = true;
                 _VBO = null;
             });
             OwningRegion.DoneRendering(this);
             return;
         }
         uint[] inds = new uint[rh.Vertices.Count];
         for (uint i = 0; i < rh.Vertices.Count; i++)
         {
             inds[i] = i;
         }
         VBO tVBO;
         lock (locky)
         {
             lock (OwningRegion.TheClient.vbos)
             {
                 if (OwningRegion.TheClient.vbos.Count > 0)
                 {
                     tVBO = OwningRegion.TheClient.vbos.Pop();
                 }
                 else
                 {
                     tVBO = new VBO();
                     //tVBO.BufferMode = OpenTK.Graphics.OpenGL4.BufferUsageHint.StreamDraw;
                 }
             }
             tVBO.indices = inds;
             tVBO.Vertices = rh.Vertices;
             tVBO.Normals = rh.Norms;
             tVBO.TexCoords = rh.TCoords;
             tVBO.Colors = rh.Cols;
             tVBO.TCOLs = rh.TCols;
             tVBO.THVs = rh.THVs;
             tVBO.THWs = rh.THWs;
             tVBO.Tangents = rh.Tangs;
             tVBO.BoneWeights = null;
             tVBO.BoneIDs = null;
             tVBO.BoneWeights2 = null;
             tVBO.BoneIDs2 = null;
             tVBO.oldvert();
         }
         Vector3[] posset = poses.ToArray();
         Vector4[] colorset = colorses.ToArray();
         uint[] posind = new uint[posset.Length];
         for (uint i = 0; i < posind.Length; i++)
         {
             posind[i] = i;
         }
         OwningRegion.TheClient.Schedule.ScheduleSyncTask(() =>
         {
             if (DENIED)
             {
                 if (tVBO.generated)
                 {
                     tVBO.Destroy();
                 }
                 return;
             }
             lock (locky)
             {
                 if (tVBO.verts == null)
                 {
                     SysConsole.Output(OutputType.WARNING, "Something went wrong! : tVBO.verts==null while rh.Vertice==" + (rh.Vertices == null ? "null" : rh.Vertices.Count + "_vertices"));
                     // TODO: What even happened here?!
                     tVBO.indices = inds;
                     tVBO.Vertices = rh.Vertices;
                     tVBO.Normals = rh.Norms;
                     tVBO.TexCoords = rh.TCoords;
                     tVBO.Colors = rh.Cols;
                     tVBO.TCOLs = rh.TCols;
                     tVBO.THVs = rh.THVs;
                     tVBO.THWs = rh.THWs;
                     tVBO.Tangents = rh.Tangs;
                 }
             }
             VBO tV = _VBO;
             if (tV != null)
             {
                 lock (OwningRegion.TheClient.vbos)
                 {
                     if (OwningRegion.TheClient.vbos.Count < 40)
                     {
                         OwningRegion.TheClient.vbos.Push(tV);
                     }
                     else
                     {
                         tV.Destroy();
                     }
                 }
             }
             if (DENIED)
             {
                 if (tVBO.generated)
                 {
                     tVBO.Destroy();
                 }
                 return;
             }
             _VBO = tVBO;
             lock (locky)
             {
                 tVBO.GenerateOrUpdate();
                 tVBO.CleanLists();
             }
             DestroyPlants();
             Plant_VAO = GL.GenVertexArray();
             Plant_VBO_Ind = GL.GenBuffer();
             Plant_VBO_Pos = GL.GenBuffer();
             Plant_VBO_Col = GL.GenBuffer();
             Plant_C = posind.Length;
             GL.BindBuffer(BufferTarget.ArrayBuffer, Plant_VBO_Pos);
             GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(posset.Length * OpenTK.Vector3.SizeInBytes), posset, BufferUsageHint.StaticDraw);
             GL.BindBuffer(BufferTarget.ArrayBuffer, Plant_VBO_Col);
             GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(colorset.Length * OpenTK.Vector4.SizeInBytes), colorset, BufferUsageHint.StaticDraw);
             GL.BindBuffer(BufferTarget.ElementArrayBuffer, Plant_VBO_Ind);
             GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(posind.Length * sizeof(uint)), posind, BufferUsageHint.StaticDraw);
             GL.BindVertexArray(Plant_VAO);
             GL.BindBuffer(BufferTarget.ArrayBuffer, Plant_VBO_Pos);
             GL.VertexAttribPointer(0, 3, VertexAttribPointerType.Float, false, 0, 0);
             GL.EnableVertexAttribArray(0);
             GL.BindBuffer(BufferTarget.ArrayBuffer, Plant_VBO_Col);
             GL.VertexAttribPointer(4, 4, VertexAttribPointerType.Float, false, 0, 0);
             GL.EnableVertexAttribArray(4);
             GL.BindBuffer(BufferTarget.ElementArrayBuffer, Plant_VBO_Ind);
             GL.BindVertexArray(0);
             OnRendered?.Invoke();
         });
         OwningRegion.DoneRendering(this);
     }
     catch (Exception ex)
     {
         SysConsole.Output(OutputType.ERROR, "Generating ChunkVBO...: " + ex.ToString());
         OwningRegion.DoneRendering(this);
     }
 }
Exemplo n.º 10
0
 // TODO: Async?
 public EntityShape CalculateHullShape(out Location offs)
 {
     List<Vector3> Vertices = new List<Vector3>(XWidth * YWidth * ZWidth);
     for (int x = 0; x < XWidth; x++)
     {
         for (int y = 0; y < YWidth; y++)
         {
             for (int z = 0; z < ZWidth; z++)
             {
                 BlockInternal c = GetBlockAt(x, y, z);
                 // TODO: Figure out how to handle solidity here
                 //if (((Material)c.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID)
                 //{
                 BlockInternal def = new BlockInternal(0, 0, 0, 0);
                 BlockInternal zp = z + 1 < ZWidth ? GetBlockAt(x, y, z + 1) : def;
                 BlockInternal zm = z > 0 ? GetBlockAt(x, y, z - 1) : def;
                 BlockInternal yp = y + 1 < YWidth ? GetBlockAt(x, y + 1, z) : def;
                 BlockInternal ym = y > 0 ? GetBlockAt(x, y - 1, z) : def;
                 BlockInternal xp = x + 1 < XWidth ? GetBlockAt(x + 1, y, z) : def;
                 BlockInternal xm = x > 0 ? GetBlockAt(x - 1, y, z) : def;
                 bool zps = ((Material)zp.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[zp.BlockData].OccupiesBOTTOM();
                 bool zms = ((Material)zm.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[zm.BlockData].OccupiesTOP();
                 bool xps = ((Material)xp.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[xp.BlockData].OccupiesXM();
                 bool xms = ((Material)xm.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[xm.BlockData].OccupiesXP();
                 bool yps = ((Material)yp.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[yp.BlockData].OccupiesYM();
                 bool yms = ((Material)ym.BlockMaterial).GetSolidity() == MaterialSolidity.FULLSOLID && BlockShapeRegistry.BSD[ym.BlockData].OccupiesYP();
                 Vector3 pos = new Vector3(x, y, z);
                 List<Vector3> vecsi = BlockShapeRegistry.BSD[c.BlockData].GetVertices(pos, xps, xms, yps, yms, zps, zms);
                 Vertices.AddRange(vecsi);
                 //}
             }
         }
     }
     Vector3 center;
     ConvexHullShape chs = new ConvexHullShape(Vertices, out center);
     offs = new Location(center);
     return chs;
 }
Exemplo n.º 11
0
        public virtual Tuple <List <Vector4>, List <Vector4>, List <Vector4>, List <Vector4> > GetStretchData(Vector3 blockpos, List <Vector3> vertices, BlockInternal XP, BlockInternal XM,
                                                                                                              BlockInternal YP, BlockInternal YM, BlockInternal ZP, BlockInternal ZM, bool bxp, bool bxm, bool byp, bool bym, bool bzp, bool bzm,
                                                                                                              BlockInternal ZPXP, BlockInternal ZPXM, BlockInternal ZPYP, BlockInternal ZPYM, BlockInternal XPYP, BlockInternal XPYM, BlockInternal XMYP, BlockInternal XMYM)
        {
            List <Vector4> stretchvals = new List <Vector4>();

            for (int i = 0; i < vertices.Count; i++)
            {
                stretchvals.Add(new Vector4(0, 0, 0, 0));
            }
            return(new Tuple <List <Vector4>, List <Vector4>, List <Vector4>, List <Vector4> >(stretchvals, stretchvals, stretchvals, stretchvals));
        }
Exemplo n.º 12
0
 public void SetBlockMaterial(Location pos, BlockInternal bi, bool broadcast = true, bool regen = true, bool override_protection = false)
 {
     SetBlockMaterial(pos, bi.Material, bi.BlockData, bi._BlockPaintInternal, bi.BlockLocalData, bi.Damage, broadcast, regen, override_protection);
 }
Exemplo n.º 13
0
 public void SetBlockMaterial(Location pos, Material mat, byte dat = 0, byte paint = 0, byte locdat = (byte)BlockFlags.EDITED, BlockDamage damage = BlockDamage.NONE,
     bool broadcast = true, bool regen = true, bool override_protection = false)
 {
     Chunk ch = LoadChunk(ChunkLocFor(pos));
     lock (ch.EditSessionLock)
     {
         int x = (int)Math.Floor(pos.X) - (int)ch.WorldPosition.X * Chunk.CHUNK_SIZE;
         int y = (int)Math.Floor(pos.Y) - (int)ch.WorldPosition.Y * Chunk.CHUNK_SIZE;
         int z = (int)Math.Floor(pos.Z) - (int)ch.WorldPosition.Z * Chunk.CHUNK_SIZE;
         if (!override_protection && ((BlockFlags)ch.GetBlockAt(x, y, z).BlockLocalData).HasFlag(BlockFlags.PROTECTED))
         {
             return;
         }
         BlockInternal bi = new BlockInternal((ushort)mat, dat, paint, locdat) { Damage = damage };
         ch.SetBlockAt(x, y, z, bi);
         ch.LastEdited = GlobalTickTime;
         ch.Flags |= ChunkFlags.NEEDS_DETECT;
         ch.ChunkDetect();
         // TODO: See if this makes any new chunks visible!
         if (broadcast)
         {
             // TODO: Send per-person based on chunk awareness details
             ChunkSendToAll(new BlockEditPacketOut(new Location[] { pos }, new ushort[] { bi._BlockMaterialInternal }, new byte[] { dat }, new byte[] { paint }), ch.WorldPosition);
         }
     }
 }
Exemplo n.º 14
0
 public virtual KeyValuePair<List<Vector4>, List<Vector4>> GetStretchData(Vector3 blockpos, List<Vector3> vertices, BlockInternal XP, BlockInternal XM,
     BlockInternal YP, BlockInternal YM, BlockInternal ZP, BlockInternal ZM, bool bxp, bool bxm, bool byp, bool bym, bool bzp, bool bzm)
 {
     List<Vector4> stretchvals = new List<Vector4>();
     List<Vector4> stretchweis = new List<Vector4>();
     for (int i = 0; i < vertices.Count; i++)
     {
         stretchvals.Add(new Vector4(0, 0, 0, 0));
         stretchweis.Add(new Vector4(0, 0, 0, 0));
     }
     return new KeyValuePair<List<Vector4>, List<Vector4>>(stretchvals, stretchweis);
 }
Exemplo n.º 15
0
 void SpecialSetBlockAt(Chunk chunk, int X, int Y, int Z, BlockInternal bi)
 {
     if (X < 0 || Y < 0 || Z < 0 || X >= Chunk.CHUNK_SIZE || Y >= Chunk.CHUNK_SIZE || Z >= Chunk.CHUNK_SIZE)
     {
         Vector3i chloc = chunk.OwningRegion.ChunkLocFor(new Location(X, Y, Z));
         Chunk ch = chunk.OwningRegion.LoadChunkNoPopulate(chunk.WorldPosition + chloc);
         int x = (int)(X - chloc.X * Chunk.CHUNK_SIZE);
         int y = (int)(Y - chloc.Y * Chunk.CHUNK_SIZE);
         int z = (int)(Z - chloc.Z * Chunk.CHUNK_SIZE);
         BlockInternal orig = ch.GetBlockAt(x, y, z);
         BlockFlags flags = ((BlockFlags)orig.BlockLocalData);
         if (!flags.HasFlag(BlockFlags.EDITED) && !flags.HasFlag(BlockFlags.PROTECTED))
         {
             // TODO: lock?
             ch.BlocksInternal[chunk.BlockIndex(x, y, z)] = bi;
         }
     }
     else
     {
         BlockInternal orig = chunk.GetBlockAt(X, Y, Z);
         BlockFlags flags = ((BlockFlags)orig.BlockLocalData);
         if (!flags.HasFlag(BlockFlags.EDITED) && !flags.HasFlag(BlockFlags.PROTECTED))
         {
             chunk.BlocksInternal[chunk.BlockIndex(X, Y, Z)] = bi;
         }
     }
 }
Exemplo n.º 16
0
 // TODO: Make asyncable!
 public void SetupVBO()
 {
     List<OpenTK.Vector3> Vertices = new List<OpenTK.Vector3>(XWidth * YWidth * ZWidth);
     List<OpenTK.Vector3> Normals = new List<OpenTK.Vector3>(XWidth * YWidth * ZWidth);
     List<OpenTK.Vector3> TexCoords = new List<OpenTK.Vector3>(XWidth * YWidth * ZWidth);
     List<OpenTK.Vector4> Colrs = new List<OpenTK.Vector4>(XWidth * YWidth * ZWidth);
     List<OpenTK.Vector4> TCOLs = new List<OpenTK.Vector4>(XWidth * YWidth * ZWidth);
     List<OpenTK.Vector3> Tangs = new List<OpenTK.Vector3>(XWidth * YWidth * ZWidth);
     for (int x = 0; x < XWidth; x++)
     {
         for (int y = 0; y < YWidth; y++)
         {
             for (int z = 0; z < ZWidth; z++)
             {
                 BlockInternal c = GetBlockAt(x, y, z);
                 if (((Material)c.BlockMaterial).RendersAtAll())
                 {
                     BlockInternal def = new BlockInternal(0, 0, 0, 0);
                     BlockInternal zp = z + 1 < ZWidth ? GetBlockAt(x, y, z + 1) : def;
                     BlockInternal zm = z > 0 ? GetBlockAt(x, y, z - 1) : def;
                     BlockInternal yp = y + 1 < YWidth ? GetBlockAt(x, y + 1, z) : def;
                     BlockInternal ym = y > 0 ? GetBlockAt(x, y - 1, z) : def;
                     BlockInternal xp = x + 1 < XWidth ? GetBlockAt(x + 1, y, z) : def;
                     BlockInternal xm = x > 0 ? GetBlockAt(x - 1, y, z) : def;
                     bool rAS = !((Material)c.BlockMaterial).GetCanRenderAgainstSelf();
                     bool zps = (zp.IsOpaque() || (rAS && (zp.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[zp.BlockData].OccupiesBOTTOM();
                     bool zms = (zm.IsOpaque() || (rAS && (zm.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[zm.BlockData].OccupiesTOP();
                     bool xps = (xp.IsOpaque() || (rAS && (xp.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[xp.BlockData].OccupiesXM();
                     bool xms = (xm.IsOpaque() || (rAS && (xm.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[xm.BlockData].OccupiesXP();
                     bool yps = (yp.IsOpaque() || (rAS && (yp.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[yp.BlockData].OccupiesYM();
                     bool yms = (ym.IsOpaque() || (rAS && (ym.BlockMaterial == c.BlockMaterial))) && BlockShapeRegistry.BSD[ym.BlockData].OccupiesYP();
                     Vector3 pos = new Vector3(x, y, z);
                     List<BEPUutilities.Vector3> vecsi = BlockShapeRegistry.BSD[c.BlockData].GetVertices(pos, xps, xms, yps, yms, zps, zms);
                     List<BEPUutilities.Vector3> normsi = BlockShapeRegistry.BSD[c.BlockData].GetNormals(pos, xps, xms, yps, yms, zps, zms);
                     List<BEPUutilities.Vector3> tci = BlockShapeRegistry.BSD[c.BlockData].GetTCoords(pos, (Material)c.BlockMaterial, xps, xms, yps, yms, zps, zms);
                     int vertcount = Vertices.Count;
                     for (int i = 0; i < vecsi.Count; i++)
                     {
                         // TODO: is PosMultiplier used correctly here?
                         OpenTK.Vector3 vt = new OpenTK.Vector3((float)vecsi[i].X, (float)vecsi[i].Y, (float)vecsi[i].Z);
                         Vertices.Add(vt);
                         OpenTK.Vector3 nt = new OpenTK.Vector3((float)normsi[i].X, (float)normsi[i].Y, (float)normsi[i].Z);
                         Normals.Add(nt);
                         TexCoords.Add(new OpenTK.Vector3((float)tci[i].X, (float)tci[i].Y, (float)tci[i].Z));
                         Colrs.Add(new OpenTK.Vector4(1, 1, 1, 1));
                         TCOLs.Add(TheClient.Rendering.AdaptColor(vt, Colors.ForByte(c.BlockPaint)));
                     }
                     for (int i = 0; i < vecsi.Count; i += 3)
                     {
                         int basis = vertcount + i;
                         OpenTK.Vector3 v1 = Vertices[basis];
                         OpenTK.Vector3 dv1 = Vertices[basis + 1] - v1;
                         OpenTK.Vector3 dv2 = Vertices[basis + 2] - v1;
                         OpenTK.Vector3 t1 = TexCoords[basis];
                         OpenTK.Vector3 dt1 = TexCoords[basis + 1] - t1;
                         OpenTK.Vector3 dt2 = TexCoords[basis + 2] - t1;
                         OpenTK.Vector3 tangent = (dv1 * dt2.Y - dv2 * dt1.Y) * 1f / (dt1.X * dt2.Y - dt1.Y * dt2.X);
                         OpenTK.Vector3 normal = Normals[basis];
                         tangent = (tangent - normal * OpenTK.Vector3.Dot(normal, tangent)).Normalized();
                         Tangs.Add(tangent);
                         Tangs.Add(tangent);
                         Tangs.Add(tangent);
                     }
                     if (!c.IsOpaque() && BlockShapeRegistry.BSD[c.BlockData].BackTextureAllowed)
                     {
                         int tf = Colrs.Count - vecsi.Count;
                         for (int i = vecsi.Count - 1; i >= 0; i--)
                         {
                             Vertices.Add(new OpenTK.Vector3((float)vecsi[i].X, (float)vecsi[i].Y, (float)vecsi[i].Z));
                             int tx = tf + i;
                             Colrs.Add(Colrs[tx]);
                             TCOLs.Add(TCOLs[tx]);
                             Normals.Add(new OpenTK.Vector3(-(float)normsi[i].X, -(float)normsi[i].Y, -(float)normsi[i].Z));
                             TexCoords.Add(new OpenTK.Vector3((float)tci[i].X, (float)tci[i].Y, (float)tci[i].Z));
                         }
                     }
                 }
             }
         }
     }
     if (vbo != null)
     {
         vbo.Destroy();
         vbo = null;
     }
     if (Vertices.Count == 0)
     {
         return;
     }
     vbo = new VBO();
     vbo.THVs = new List<OpenTK.Vector4>();
     vbo.THWs = new List<OpenTK.Vector4>();
     List<uint> Indices = new List<uint>(Vertices.Count);
     for (uint i = 0; i < Vertices.Count; i++)
     {
         Indices.Add(i);
         vbo.THVs.Add(new OpenTK.Vector4(0, 0, 0, 0));
         vbo.THWs.Add(new OpenTK.Vector4(0, 0, 0, 0));
     }
     vbo.Vertices = Vertices;
     vbo.Normals = Normals;
     vbo.TexCoords = TexCoords;
     vbo.Colors = Colrs;
     vbo.TCOLs = TCOLs;
     vbo.Tangents = Tangs;
     vbo.Indices = Indices;
     vbo.GenerateVBO();
 }
Exemplo n.º 17
0
 public Structure(byte[] dat)
 {
     Size.X = Utilities.BytesToInt(Utilities.BytesPartial(dat, 0, 4));
     Size.Y = Utilities.BytesToInt(Utilities.BytesPartial(dat, 4, 4));
     Size.Z = Utilities.BytesToInt(Utilities.BytesPartial(dat, 8, 4));
     Origin.X = Utilities.BytesToInt(Utilities.BytesPartial(dat, 12, 4));
     Origin.Y = Utilities.BytesToInt(Utilities.BytesPartial(dat, 12 + 4, 4));
     Origin.Z = Utilities.BytesToInt(Utilities.BytesPartial(dat, 12 + 8, 4));
     Blocks = new BlockInternal[Size.X * Size.Y * Size.Z];
     for (int i = 0; i < Blocks.Length; i++)
     {
         Blocks[i] = new BlockInternal(Utilities.BytesToUshort(Utilities.BytesPartial(dat, 12 + 12 + i * 2, 2)), dat[12 + 12 + Blocks.Length * 2 + i], dat[12 + 12 + Blocks.Length * 4 + i], dat[12 + 12 + Blocks.Length * 3 + i]);
     }
 }
Exemplo n.º 18
0
 public void SetBlockAt(int x, int y, int z, BlockInternal mat)
 {
     if (SucceededBy != null)
     {
         SucceededBy.SetBlockAt(x, y, z, mat);
     }
     BlocksInternal[BlockIndex(x, y, z)] = mat;
 }
Exemplo n.º 19
0
 void RenderBlockIntoAngle(BlockInternal bi, int x, int y, int z, MaterialImage bmp)
 {
     MaterialImage zmatbmpXP = MaterialImages[bi.Material.TextureID(MaterialSide.XP)];
     MaterialImage zmatbmpYP = MaterialImages[bi.Material.TextureID(MaterialSide.YP)];
     MaterialImage zmatbmpZP = MaterialImages[bi.Material.TextureID(MaterialSide.TOP)];
     if (zmatbmpXP == null || zmatbmpYP == null || zmatbmpZP == null)
     {
         return;
     }
     Color zcolor = Colors.ForByte(bi.BlockPaint);
     if (zcolor.A == 0)
     {
         zcolor = Color.White;
     }
     int x1 = x * TexWidth;
     int y1 = y * TexWidth;
     int z1 = z * TexWidth;
     //    int xw = x * TexWidth;
     //    int yw = y * TexWidth;
     // tileWidth/2*x+tileHeight/2*y, tileWidth/2*x+tileHeight/2*y
     //   int xw = TexWidth * x / 2 + TexWidth * y / 2;
     //   int yw = TexWidth * x / 2 + TexWidth * y / 2;
     // tempPt.x = pt.x - pt.y; tempPt.y = (pt.x + pt.y) / 2;
     int xw = x1 - y1;
     int yw = ((x1 + y1) - (z1)) / 2;
     //   tempPt.x = (2 * pt.y + pt.x) / 2; tempPt.y = (2 * pt.y - pt.x) / 2;
     // int xw = (2 * y1 + x1) / 2;
     //  int yw = (2 * y1 - x1) / 2;
     xw += BmpSize2 / 2;
     yw += BmpSize2 / 2;
     DrawImageShiftX(bmp, zmatbmpXP, xw, yw, zcolor);
     DrawImageShiftY(bmp, zmatbmpYP, xw, yw, zcolor);
     DrawImageShiftZ(bmp, zmatbmpZP, xw, yw, zcolor);
 }
Exemplo n.º 20
0
 public void SetBlockAt(int x, int y, int z, BlockInternal mat)
 {
     BlocksInternal[BlockIndex(x, y, z)] = mat;
 }