Ejemplo n.º 1
0
        public void DrawTriangle(MeshRenderer renderer, int i)
        {
            var p1 = renderer.GetCameraPosition(i);
            var p2 = renderer.GetCameraPosition(i + 1);
            var p3 = renderer.GetCameraPosition(i + 2);

            if (!BackFaceCulling(p1.point, p2.point, p3.point, out Vector3 normal))
            {
                return;
            }
            p1.normal = p2.normal = p3.normal = normal;
            BakeLight(ref p1); BakeLight(ref p2); BakeLight(ref p3);
            Triangle(ToScreen(p1), ToScreen(p2), ToScreen(p3));
        }