コード例 #1
0
        public bool Write(RedGrassInstance rgi)
        {
            Vector3 pos = rgi.Position;

            int cx = (int)pos.x >> SHIFT;
            int cz = (int)pos.z >> SHIFT;

            RGChunk chunk = mChunks [cx, cz];

            if (chunk != null)
            {
                if (rgi.Density < 0.001f)
                {
                    chunk.Remove((int)pos.x, (int)pos.y, (int)pos.z);
                }
                else
                {
                    chunk.Write(rgi);
                }
            }
            else
            {
                if (rgi.Density > 0.001f)
                {
                    chunk = RGPoolSig.GetChunk();
                    chunk.Init(cx, cz, mEvni);
                    mChunks[cx, cz] = chunk;
                    chunk.Write(rgi);
                }
            }

            return(true);
        }
コード例 #2
0
        public bool Remove(int x, int y, int z)
        {
            int cx = x >> SHIFT;
            int cz = z >> SHIFT;

            RGChunk chunk = mChunks [cx, cz];

            if (chunk != null)
            {
                return(chunk.Remove(x, y, z));
            }
            return(false);
        }