Пример #1
0
        bool IsHidden(byte block, byte other, int side)
        {
            // Sprite blocks can never hide faces.
            if (IsSprite[block])
            {
                return(false);
            }

            // NOTE: Water is always culled by lava
            if ((block == Block.Water || block == Block.StillWater) &&
                (other == Block.Lava || other == Block.StillLava))
            {
                return(true);
            }

            // All blocks (except for say leaves) cull with themselves.
            if (block == other)
            {
                return(CullWithNeighbours[block]);
            }

            // An opaque neighbour (asides from lava) culls the face.
            if (IsOpaque[other] && !IsLiquid(other))
            {
                return(true);
            }
            if (!IsTranslucent[block] || !IsTranslucent[other])
            {
                return(false);
            }

            // e.g. for water / ice, don't need to draw water.
            CollideType bType = Collide[block], oType = Collide[other];
            bool        canSkip = (bType == CollideType.Solid && oType == CollideType.Solid) ||
                                  bType != CollideType.Solid;

            return(canSkip && FaceOccluded(block, other, side));
        }
Пример #2
0
        bool IsHidden(BlockID block, BlockID other, int side)
        {
            // Sprite blocks can never hide faces.
            if (Draw[block] == DrawType.Sprite)
            {
                return(false);
            }

            // NOTE: Water is always culled by lava
            if ((block == Block.Water || block == Block.StillWater) &&
                (other == Block.Lava || other == Block.StillLava))
            {
                return(true);
            }

            // All blocks (except for say leaves) cull with themselves.
            if (block == other)
            {
                return(Draw[block] != DrawType.TransparentThick);
            }

            // An opaque neighbour (asides from lava) culls the face.
            if (Draw[other] == DrawType.Opaque && !IsLiquid(other))
            {
                return(true);
            }
            if (Draw[block] != DrawType.Translucent || Draw[other] != DrawType.Translucent)
            {
                return(false);
            }

            // e.g. for water / ice, don't need to draw water.
            CollideType bType = Collide[block], oType = Collide[other];
            bool        canSkip = (bType == CollideType.Solid && oType == CollideType.Solid) ||
                                  bType != CollideType.Solid;

            return(canSkip);
        }