The book of inspiration

October 28, 2009

C# to HLSL

Filed under: tech — Tags: , — zproxy @ 8:55 am

Jim has found a C# to HLSL compiler. Do you still think code is not data? πŸ™‚

ThumbBl thumbB = new ThumbBl(canvas) {
  Background = Brushes.Blue, LeftTop = new PointBl(0,0), CanDrag = true
};
label.Effect.Custom = (input, uv) => {
  /*L1*/ PointBl p = label.RenderTransform.Inverse.
   Transform(thumbB.CenterPosition - label.LeftTop);
  /*L2*/ PointBl q = uv * label.Size;
  /*L3*/ DoubleBl d = (p - q).Length;
  /*L4*/ d = 1 - (d / 500).Min(1);
  /*L5*/ ColorBl clr = (d).Lerp(Colors.Black, Colors.Blue);
  /*L6*/ return ColorBl.FromScRgb
    ((input[uv].ScA).Min((1 - (d * d)).Max(.4)), clr.ScRGB);
};
Advertisements

Blog at WordPress.com.