예제 #1
0
        static void V(VertexP3fC4b v)
        {
            FastColour AAA = FastColour.Unpack(v.Colour);

            GL.Color4ub(AAA.R, AAA.G, AAA.B, AAA.A);
            GL.Vertex3f(v.X, v.Y, v.Z);
        }
예제 #2
0
        static void V(VertexP3fT2fC4bN1v v)
        {
            FastColour AAA = FastColour.Unpack(v.Colour);

            GL.Color4ub(AAA.R, AAA.G, AAA.B, AAA.A);
            GL.TexCoord2f(v.U, v.V);
            GL.Vertex3f(v.X, v.Y, v.Z);
            GL.Normal3f(v.Normal.X, v.Normal.Y, v.Normal.Z);
        }
예제 #3
0
        public void Render(Game game, float t, VertexP3fT2fC4b[] vertices, ref int index)
        {
            Vector3 pos = Vector3.Lerp(lastPos, nextPos, t);
            int     col = FastColour.WhitePacked;

            if (!BlockInfo.FullBright[block])
            {
                int x = Utils.Floor(pos.X), y = Utils.Floor(pos.Y), z = Utils.Floor(pos.Z);
                col = game.World.IsValidPos(x, y, z) ? game.Lighting.LightCol_ZSide(x, y, z) : game.Lighting.OutsideZSide;
            }

            if (BlockInfo.Tinted[block])
            {
                FastColour fogCol = BlockInfo.FogColour[block];
                FastColour newCol = FastColour.Unpack(col);
                newCol *= fogCol;
                col     = newCol.Pack();
            }
            DoRender(game, ref terrainSize, ref pos, ref rec, col, vertices, ref index);
        }
예제 #4
0
        FastColour GetBlockColorXSide(int X, int Y, int Z, out bool blocksLight)
        {
            blocksLight = false;
            if (map.IsValidPos(X, Y, Z))
            {
                byte thisBlock = map.GetBlock(X, Y, Z);
                if (isOccluder[thisBlock])
                {
                    blocksLight = true;
                }

                FastColour col = blocksLight ? darkX : FastColour.Unpack(light.LightCol_XSide_Fast(X, Y, Z));
                if (BlockInfo.FullBright[thisBlock])
                {
                    col = sun;
                }
                return(col);
            }
            return(sunX);
        }
예제 #5
0
        protected override void PostStretchTiles(int x1, int y1, int z1)
        {
            base.PostStretchTiles(x1, y1, z1);
            for (int i = 0; i < isOccluder.Length; i++)
            {
                isOccluder[i] =
                    BlockInfo.BlocksLight[i] &&
                    BlockInfo.MinBB[i] == Vector3.Zero &&
                    BlockInfo.MaxBB[i] == Vector3.One &&
                    BlockInfo.Draw[i] != DrawType.TransparentThick;                     // goodlyay, did you hack this for leaves?
            }

            sun        = env.Sunlight;
            sunX       = FastColour.Unpack(env.SunXSide);
            sunZ       = FastColour.Unpack(env.SunZSide);
            sunYBottom = FastColour.Unpack(env.SunYBottom);

            dark        = FastColour.Unpack(FastColour.ScalePacked(env.Shadow, 0.3f));
            darkX       = FastColour.Unpack(FastColour.ScalePacked(env.ShadowXSide, 0.3f));
            darkZ       = FastColour.Unpack(FastColour.ScalePacked(env.ShadowZSide, 0.3f));
            darkYBottom = FastColour.Unpack(FastColour.ScalePacked(env.ShadowYBottom, 0.3f));
        }
예제 #6
0
        public override void Render(Game game, double delta, float t,
                                    VertexP3fT2fC4b[] vertices, ref int index)
        {
            Position = Vector3.Lerp(lastPos, nextPos, t);

            int col = FastColour.WhitePacked;

            if (!game.BlockInfo.FullBright[block])
            {
                Vector3I P = Vector3I.Floor(Position);
                col = game.World.IsValidPos(P) ?
                      game.Lighting.LightCol_ZSide(P.X, P.Y, P.Z) : game.Lighting.OutsideZSide;
            }

            if (game.BlockInfo.Tinted[block])
            {
                FastColour fogCol = game.BlockInfo.FogColour[block];
                FastColour newCol = FastColour.Unpack(col);
                newCol *= fogCol;
                col     = newCol.Pack();
            }
            DoRender(game, ref terrainSize, ref rec, col, vertices, ref index);
        }