hedgewars/uLandGenPerlin.pas
changeset 10192 bb1310c4bd79
parent 10191 d9862e01309a
child 10196 514e338f2eaf
equal deleted inserted replaced
10191:d9862e01309a 10192:bb1310c4bd79
   118 
   118 
   119     for i:= 0 to 255 do
   119     for i:= 0 to 255 do
   120         p[256 + i]:= p[i];
   120         p[256 + i]:= p[i];
   121 end;
   121 end;
   122 
   122 
   123 const detail = 180000;
   123 const detail = 150000;
   124     field = 5;
   124     field = 3;
   125     df = detail * field;
   125     df = detail * field;
   126     width = 4096;
   126     width = 4096;
   127     height = 2048;
   127     height = 2048;
   128     minY = 500;
   128     minY = 500;
   129 
   129 
   140     begin
   140     begin
   141         di:= df * y div height;
   141         di:= df * y div height;
   142         for x:= 0 to pred(width) do
   142         for x:= 0 to pred(width) do
   143         begin
   143         begin
   144             dj:= df * x div width;
   144             dj:= df * x div width;
   145             r:= (abs(inoise(di, dj))) shr 8 and $ff;
   145 
       
   146            r:= (abs(inoise(di, dj)) + y*4) mod 65536 div 256;
       
   147 
       
   148             //r:= (abs(inoise(di, dj))) shr 8 and $ff;
   146             if (x < margin) or (x > width - margin) then r:= r - abs(x - width div 2) + width div 2 - margin; // fade on edges
   149             if (x < margin) or (x > width - margin) then r:= r - abs(x - width div 2) + width div 2 - margin; // fade on edges
   147 
   150 
   148             r:= r - (height - y) div 32;
   151             r:= r - (height - y) div 32;
   149 
   152 
   150             //r:= r - max(0, - abs(x - width div 2) + width * 2 div 100); // split vertically in the middle
   153             //r:= r - max(0, - abs(x - width div 2) + width * 2 div 100); // split vertically in the middle
   162                 else
   165                 else
   163                 if x + bottomPlateMargin + bottomPlateHeight > width then
   166                 if x + bottomPlateMargin + bottomPlateHeight > width then
   164                     r:= r - (x - width + bottomPlateMargin + bottomPlateHeight);
   167                     r:= r - (x - width + bottomPlateMargin + bottomPlateHeight);
   165             end;
   168             end;
   166             }
   169             }
   167             if r < 0 then Land[y, x]:= 0 else Land[y, x]:= lfObjMask;
   170 
       
   171             if r < 50 then Land[y, x]:= 0 else Land[y, x]:= lfObjMask;
   168 
   172 
   169         end;
   173         end;
   170     end;
   174     end;
   171 
   175 
   172     for x:= 0 to width do
   176     for x:= 0 to width do