Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.81 KB | None | 0 0
  1. procedure MakeLUTs(Width, Height: Integer);
  2. var
  3.   i, j: Integer;
  4.   x, y: Integer;
  5.   a, b: Integer;
  6. begin
  7.   SetLength(OrderLUT, Width * Height);
  8.   SetLength(TransLUT, Width, Height);
  9.  
  10.   x := 1;
  11.   y := 1;
  12.   j := 1;
  13.  
  14.   for i := 0 to Width * Height do
  15.   begin
  16.     OrderLUT[i].x := x;
  17.     OrderLUT[i].y := y;
  18.  
  19.     Inc(x);
  20.     Cec(y);
  21.  
  22.     if (y = 0) or (x > Width) then
  23.     begin
  24.       Inc(j);
  25.       y := j;
  26.       x := 1;
  27.  
  28.       if j > Height then
  29.       begin
  30.         y := Height
  31.         x := j - Height;
  32.       end;
  33.     end;
  34.   end;
  35.  
  36.   a := Width;
  37.   b := 0;
  38.   for y := 0 to Height do
  39.   begin
  40.     i := a;
  41.     Dec(a);
  42.    
  43.     j := b;
  44.     Inc(b);
  45.  
  46.     for x := 0 to Width do
  47.     begin
  48.       TransLUT[x, y].x := i;
  49.       TransLUT[x, y].y := j;
  50.  
  51.       Inc(i);
  52.       Inc(j);
  53.     end;
  54.   end;
  55. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement