GLS.ProcTextures.pas 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. //
  2. // The graphics engine GLScene https://github.com/glscene
  3. //
  4. unit GLS.ProcTextures;
  5. (* Procedural textures *)
  6. interface
  7. uses
  8. System.Classes,
  9. System.SysUtils,
  10. System.Math,
  11. GLS.Texture,
  12. GLS.Graphics,
  13. GLScene.TextureFormat,
  14. GLScene.VectorGeometry;
  15. const
  16. GRADIENT_TABLE_SIZE = 256;
  17. DAMP_SHIFT = 20;
  18. type
  19. TGLProcTextureNoise = class(TGLTextureImage)
  20. private
  21. FNoiseMap: TGLBitmap32;
  22. FWidth, FHeight: Integer;
  23. FMinCut: Byte;
  24. FNoiseSharpness: Single;
  25. FNoiseAnimate: Single;
  26. FSeamless: Boolean;
  27. FNoiseRandSeed: Longint;
  28. protected
  29. FGradients: array[0..GRADIENT_TABLE_SIZE * 3 - 1] of Single;
  30. PERM: array[0..GRADIENT_TABLE_SIZE - 1] of Byte;
  31. function GetWidth: Integer; override;
  32. function GetHeight: Integer; override;
  33. function GetDepth: Integer; override;
  34. function GetTextureTarget: TGLTextureTarget; override;
  35. function Noise(x, y: Single): Single;
  36. procedure SetMinCut(const val: Byte);
  37. procedure SetSeamless(const val: Boolean);
  38. procedure SetWidth(const val: Integer);
  39. procedure SetHeight(const val: Integer);
  40. procedure SetNoiseSharpness(const val: Single);
  41. procedure SetNoiseRandSeed(const val: Longint);
  42. procedure UpdateNoise;
  43. public
  44. constructor Create(AOwner: TPersistent); override;
  45. destructor Destroy; override;
  46. class function FriendlyName: string; override;
  47. class function FriendlyDescription: string; override;
  48. procedure Assign(Source: TPersistent); override;
  49. function GetBitmap32: TGLBitmap32; override;
  50. procedure ReleaseBitmap32; override;
  51. procedure SaveToFile(const fileName: string); override;
  52. procedure LoadFromFile(const fileName: string); override;
  53. procedure NoiseAnimate(speed: Single);
  54. procedure SetPermFromData(const inPERM: array of Byte);
  55. procedure SetPermToDefault;
  56. published
  57. property Width: Integer read GetWidth write SetWidth default 128;
  58. property Height: Integer read GetHeight write SetHeight default 128;
  59. property Depth: Integer read GetDepth;
  60. property MinCut: Byte read FMinCut write SetMinCut;
  61. property NoiseSharpness: Single read FNoiseSharpness write
  62. SetNoiseSharpness;
  63. property Seamless: Boolean read FSeamless write SetSeamless;
  64. property NoiseRandSeed: Longint read FNoiseRandSeed write SetNoiseRandSeed;
  65. end;
  66. // ------------------------------------------------------------------
  67. implementation
  68. // ------------------------------------------------------------------
  69. constructor TGLProcTextureNoise.Create(AOwner: TPersistent);
  70. { PERM array Borrowed from Darwyn Peachey.
  71. The gradient table is indexed with an XYZ triplet, which is first turned
  72. into a single random index using a lookup in PERM array. The PERM array simply
  73. contains all numbers in [0..255] in random order. }
  74. //Can now be set to a different set of Random arrangement
  75. var
  76. i: Integer;
  77. seedBackup: Longint;
  78. z, r, theta: Single;
  79. begin
  80. inherited;
  81. FWidth := 128;
  82. FHeight := 128;
  83. FMinCut := 0;
  84. FNoiseSharpness := 0.99;
  85. FSeamless := False;
  86. seedBackup := RandSeed;
  87. Randomize;
  88. FNoiseRandSeed := Random(2147483647); //Random(10000);
  89. RandSeed := FNoiseRandSeed;
  90. SetPermToDefault;
  91. // Generate random gradient vectors.
  92. for i := 0 to GRADIENT_TABLE_SIZE - 1 do
  93. begin
  94. z := 1 - 2 * Random;
  95. r := sqrt(1 - z * z);
  96. theta := 2 * PI * Random;
  97. FGradients[i * 3] := r * cos(theta);
  98. FGradients[i * 3 + 1] := r * sin(theta);
  99. FGradients[i * 3 + 2] := z;
  100. end;
  101. RandSeed := seedBackup;
  102. end;
  103. destructor TGLProcTextureNoise.Destroy;
  104. begin
  105. ReleaseBitmap32;
  106. inherited;
  107. end;
  108. procedure TGLProcTextureNoise.UpdateNoise;
  109. var
  110. X, Y, C: Integer;
  111. Line: PGLPixel32Array;
  112. nf: Single;
  113. n: Byte;
  114. function NoiseSeamless(Scale: Single): Single;
  115. begin
  116. Result := (Noise(x / Scale, y / Scale) * (Width - x) * (Height - y)
  117. + Noise((x - width) / Scale, y / Scale) * x * (Height - y)
  118. + Noise((x - width) / Scale, (y - Height) / Scale) * x * y
  119. + Noise(x / Scale, (y - Height) / Scale) * (Width - x) * y)
  120. / (Width * Height);
  121. end;
  122. begin
  123. // Update the noise texture.
  124. for y := 0 to FNoiseMap.Height - 1 do
  125. begin
  126. Line := FNoiseMap.ScanLine[y];
  127. for x := 0 to FNoiseMap.Width - 1 do
  128. begin
  129. case FSeamless of
  130. // Take 4 octaves of noise and add them weighted for seamless.
  131. // uses much Ghz
  132. True:
  133. begin
  134. nf := NoiseSeamless(16)
  135. + NoiseSeamless(8) / 2
  136. + NoiseSeamless(4) / 4
  137. + NoiseSeamless(2) / 8;
  138. end;
  139. // Take 4 octaves of noise and add them.
  140. False:
  141. begin
  142. nf := Noise(x / 16, y / 16)
  143. + Noise(x / 8, y / 8) / 2
  144. + Noise(x / 4, y / 4) / 4
  145. + Noise(x / 2, y / 2) / 8;
  146. end;
  147. end;
  148. // Range between 0 and 255
  149. n := Round(255 * (nf + 1) / 2);
  150. if MinCut > 0 then
  151. begin
  152. // Min Cut
  153. C := n - FMinCut;
  154. if C < 0 then
  155. n := 0
  156. else
  157. // Noise Sharpness
  158. n := 255 - Round(PowerInteger(FNoiseSharpness, C) * 255);
  159. end;
  160. //if n < 13 then n:=13;
  161. // Write the result to the texture image.
  162. Line^[x].r := n;
  163. Line^[x].g := n;
  164. Line^[x].b := n;
  165. Line^[x].a := n;
  166. end;
  167. end;
  168. end;
  169. function TGLProcTextureNoise.GetBitmap32: TGLBitmap32;
  170. begin
  171. if not Assigned(FNoiseMap) then
  172. begin
  173. FNoiseMap := TGLBitmap32.Create;
  174. FNoiseMap.Width := FWidth;
  175. FNoiseMap.Height := FHeight;
  176. FNoiseMap.Blank := false;
  177. UpdateNoise;
  178. end;
  179. Result := FNoiseMap;
  180. end;
  181. class function TGLProcTextureNoise.FriendlyName: string;
  182. begin
  183. Result := 'Procedural Noise';
  184. end;
  185. class function TGLProcTextureNoise.FriendlyDescription: string;
  186. begin
  187. Result := 'Procedural Noise (Animated)';
  188. end;
  189. procedure TGLProcTextureNoise.SetSeamless(const val: Boolean);
  190. begin
  191. if val <> FSeamless then
  192. begin
  193. FSeamless := val;
  194. Invalidate;
  195. end;
  196. end;
  197. procedure TGLProcTextureNoise.LoadFromFile(const fileName: string);
  198. begin
  199. Assert(False, 'TGLProcTextureNoise.LoadFromFile not implemented');
  200. end;
  201. procedure TGLProcTextureNoise.ReleaseBitmap32;
  202. begin
  203. if Assigned(FNoiseMap) then
  204. begin
  205. FNoiseMap.Free;
  206. FNoiseMap := nil;
  207. end;
  208. end;
  209. procedure TGLProcTextureNoise.SaveToFile(const fileName: string);
  210. begin
  211. {Nothing here}
  212. end;
  213. function TGLProcTextureNoise.GetHeight: Integer;
  214. begin
  215. Result := FHeight;
  216. end;
  217. function TGLProcTextureNoise.GetWidth: Integer;
  218. begin
  219. Result := FWidth;
  220. end;
  221. function TGLProcTextureNoise.GetDepth: Integer;
  222. begin
  223. Result := 1;
  224. end;
  225. function TGLProcTextureNoise.GetTextureTarget: TGLTextureTarget;
  226. begin
  227. Result := ttTexture2D;
  228. end;
  229. procedure TGLProcTextureNoise.SetHeight(const val: Integer);
  230. begin
  231. if val <> FHeight then
  232. begin
  233. FHeight := val;
  234. if FHeight < 1 then
  235. FHeight := 1;
  236. Invalidate;
  237. end;
  238. end;
  239. procedure TGLProcTextureNoise.SetWidth(const val: Integer);
  240. begin
  241. if val <> FWidth then
  242. begin
  243. FWidth := val;
  244. if FWidth < 1 then
  245. FWidth := 1;
  246. Invalidate;
  247. end;
  248. end;
  249. procedure TGLProcTextureNoise.SetMinCut(const val: Byte);
  250. begin
  251. if val <> FMinCut then
  252. begin
  253. FMinCut := val;
  254. Invalidate;
  255. end;
  256. end;
  257. procedure TGLProcTextureNoise.SetNoiseSharpness(const val: Single);
  258. begin
  259. if val <> FNoiseSharpness then
  260. begin
  261. FNoiseSharpness := val;
  262. if FNoiseSharpness > 1 then
  263. FNoiseSharpness := 1;
  264. Invalidate;
  265. end;
  266. end;
  267. procedure TGLProcTextureNoise.SetNoiseRandSeed(const val: Longint);
  268. var
  269. i: Integer;
  270. seedBackup: Longint;
  271. z, r, theta: Single;
  272. begin
  273. if val <> FNoiseRandSeed then
  274. begin
  275. seedBackup := RandSeed;
  276. FNoiseRandSeed := val;
  277. //Dunno, might be ok to be negative
  278. if FNoiseRandSeed < 1 then
  279. FNoiseRandSeed := 1;
  280. RandSeed := FNoiseRandSeed;
  281. //didnt change so added/copied FGradients here... to get Seed to work
  282. // Generate random gradient vectors.
  283. for i := 0 to GRADIENT_TABLE_SIZE - 1 do
  284. begin
  285. z := 1 - 2 * Random;
  286. r := sqrt(1 - z * z);
  287. theta := 2 * PI * Random;
  288. FGradients[i * 3] := r * cos(theta);
  289. FGradients[i * 3 + 1] := r * sin(theta);
  290. FGradients[i * 3 + 2] := z;
  291. end;
  292. RandSeed := seedBackup;
  293. Invalidate;
  294. end;
  295. end;
  296. procedure TGLProcTextureNoise.Assign(Source: TPersistent);
  297. begin
  298. if Assigned(Source) and (Source is TGLProcTextureNoise) then
  299. begin
  300. FWidth := TGLProcTextureNoise(Source).FWidth;
  301. FHeight := TGLProcTextureNoise(Source).FHeight;
  302. FMinCut := TGLProcTextureNoise(Source).FMinCut;
  303. FNoiseSharpness := TGLProcTextureNoise(Source).FNoiseSharpness;
  304. FNoiseRandSeed := TGLProcTextureNoise(Source).FNoiseRandSeed;
  305. Invalidate;
  306. end
  307. else
  308. inherited;
  309. end;
  310. procedure TGLProcTextureNoise.NoiseAnimate(speed: Single);
  311. begin
  312. FNoiseAnimate := FNoiseAnimate + speed;
  313. Invalidate;
  314. end;
  315. function TGLProcTextureNoise.Noise(x, y: Single): Single;
  316. var
  317. ix, iy, iz: Integer;
  318. fx0, fx1, fy0, fy1, fz0, fz1: Single;
  319. wx, wy, wz: Single;
  320. vx0, vx1, vy0, vy1, vz0, vz1: Single;
  321. function Smooth(x: Single): Single;
  322. begin
  323. { Smoothing curve. This is used to calculate interpolants so that the noise
  324. doesn't look blocky when the frequency is low. }
  325. Result := x * x * (3 - 2 * x);
  326. end;
  327. function Permutate(x: Integer): Integer;
  328. const
  329. MASK = GRADIENT_TABLE_SIZE - 1;
  330. begin
  331. // Do a lookup in the permutation table.
  332. Result := PERM[x and MASK];
  333. end;
  334. function Index(ix, iy, iz: Integer): Integer;
  335. begin
  336. // Turn an XYZ triplet into a single gradient table index.
  337. Result := Permutate(ix + Permutate(iy + Permutate(iz)));
  338. end;
  339. function Lattice(lx, ly, lz: Integer; fx, fy, fz: Single): Single;
  340. var
  341. g: Integer;
  342. begin
  343. // Look up a random gradient at [ix,iy,iz] and dot it with the [fx,fy,fz] vector.
  344. g := Index(lx, ly, lz) * 3;
  345. Result := FGradients[g] * fx + FGradients[g + 1] * fy + FGradients[g + 2] *
  346. fz;
  347. end;
  348. function Lerp(t, x0, x1: Single): Single;
  349. begin
  350. // Simple linear interpolation.
  351. Result := x0 + t * (x1 - x0);
  352. end;
  353. begin
  354. { The main noise function. Looks up the pseudorandom gradients at the nearest
  355. lattice points, dots them with the input vector, and interpolates the
  356. results to produce a single output value in [0, 1] range. }
  357. ix := Floor(x);
  358. fx0 := x - ix;
  359. fx1 := fx0 - 1;
  360. wx := Smooth(fx0);
  361. iy := Floor(y);
  362. fy0 := y - iy;
  363. fy1 := fy0 - 1;
  364. wy := Smooth(fy0);
  365. iz := Floor(FNoiseAnimate);
  366. fz0 := FNoiseAnimate - iz;
  367. fz1 := fz0 - 1;
  368. wz := Smooth(fz0);
  369. vx0 := Lattice(ix, iy, iz, fx0, fy0, fz0);
  370. vx1 := Lattice(ix + 1, iy, iz, fx1, fy0, fz0);
  371. vy0 := Lerp(wx, vx0, vx1);
  372. vx0 := Lattice(ix, iy + 1, iz, fx0, fy1, fz0);
  373. vx1 := Lattice(ix + 1, iy + 1, iz, fx1, fy1, fz0);
  374. vy1 := Lerp(wx, vx0, vx1);
  375. vz0 := Lerp(wy, vy0, vy1);
  376. vx0 := Lattice(ix, iy, iz + 1, fx0, fy0, fz1);
  377. vx1 := Lattice(ix + 1, iy, iz + 1, fx1, fy0, fz1);
  378. vy0 := Lerp(wx, vx0, vx1);
  379. vx0 := Lattice(ix, iy + 1, iz + 1, fx0, fy1, fz1);
  380. vx1 := Lattice(ix + 1, iy + 1, iz + 1, fx1, fy1, fz1);
  381. vy1 := Lerp(wx, vx0, vx1);
  382. vz1 := Lerp(wy, vy0, vy1);
  383. Result := Lerp(wz, vz0, vz1);
  384. end;
  385. procedure TGLProcTextureNoise.SetPermFromData(const inPERM: array of Byte);
  386. var
  387. I: Integer;
  388. begin
  389. for I := 0 to 255 do
  390. PERM[I] := inPERM[I];
  391. Invalidate;
  392. end;
  393. procedure TGLProcTextureNoise.SetPermToDefault;
  394. begin
  395. //225,155,210,108,175,199,221,144,203,116, 70,213, 69,158, 33,252,
  396. PERM[0] := 225;
  397. PERM[1] := 155;
  398. PERM[2] := 210;
  399. PERM[3] := 108;
  400. PERM[4] := 175;
  401. PERM[5] := 199;
  402. PERM[6] := 221;
  403. PERM[7] := 144;
  404. PERM[8] := 203;
  405. PERM[9] := 116;
  406. PERM[10] := 70;
  407. PERM[11] := 213;
  408. PERM[12] := 69;
  409. PERM[13] := 158;
  410. PERM[14] := 33;
  411. PERM[15] := 252;
  412. //5, 82,173,133,222,139,174, 27, 9, 71, 90,246, 75,130, 91,191,
  413. PERM[16] := 5;
  414. PERM[17] := 82;
  415. PERM[18] := 173;
  416. PERM[19] := 133;
  417. PERM[20] := 222;
  418. PERM[21] := 139;
  419. PERM[22] := 174;
  420. PERM[23] := 27;
  421. PERM[24] := 9;
  422. PERM[25] := 71;
  423. PERM[26] := 90;
  424. PERM[27] := 246;
  425. PERM[28] := 75;
  426. PERM[29] := 130;
  427. PERM[30] := 91;
  428. PERM[31] := 191;
  429. //169,138, 2,151,194,235, 81, 7, 25,113,228,159,205,253,134,142,
  430. PERM[32] := 169;
  431. PERM[33] := 138;
  432. PERM[34] := 2;
  433. PERM[35] := 151;
  434. PERM[36] := 194;
  435. PERM[37] := 235;
  436. PERM[38] := 81;
  437. PERM[39] := 7;
  438. PERM[40] := 25;
  439. PERM[41] := 113;
  440. PERM[42] := 228;
  441. PERM[43] := 159;
  442. PERM[44] := 205;
  443. PERM[45] := 253;
  444. PERM[46] := 134;
  445. PERM[47] := 142;
  446. //248, 65,224,217, 22,121,229, 63, 89,103, 96,104,156, 17,201,129,
  447. PERM[48] := 248;
  448. PERM[49] := 65;
  449. PERM[50] := 224;
  450. PERM[51] := 217;
  451. PERM[52] := 22;
  452. PERM[53] := 121;
  453. PERM[54] := 229;
  454. PERM[55] := 63;
  455. PERM[56] := 89;
  456. PERM[57] := 103;
  457. PERM[58] := 96;
  458. PERM[59] := 104;
  459. PERM[60] := 156;
  460. PERM[61] := 17;
  461. PERM[62] := 201;
  462. PERM[63] := 129;
  463. //36, 8,165,110,237,117,231, 56,132,211,152, 20,181,111,239,218,
  464. PERM[64] := 36;
  465. PERM[65] := 8;
  466. PERM[66] := 165;
  467. PERM[67] := 110;
  468. PERM[68] := 237;
  469. PERM[69] := 117;
  470. PERM[70] := 231;
  471. PERM[71] := 56;
  472. PERM[72] := 132;
  473. PERM[73] := 211;
  474. PERM[74] := 152;
  475. PERM[75] := 20;
  476. PERM[76] := 181;
  477. PERM[77] := 111;
  478. PERM[78] := 239;
  479. PERM[79] := 218;
  480. // 170,163, 51,172,157, 47, 80,212,176,250, 87, 49, 99,242,136,189,
  481. PERM[80] := 170;
  482. PERM[81] := 163;
  483. PERM[82] := 51;
  484. PERM[83] := 172;
  485. PERM[84] := 157;
  486. PERM[85] := 47;
  487. PERM[86] := 80;
  488. PERM[86] := 212;
  489. PERM[88] := 176;
  490. PERM[89] := 250;
  491. PERM[90] := 87;
  492. PERM[91] := 49;
  493. PERM[92] := 99;
  494. PERM[93] := 242;
  495. PERM[94] := 136;
  496. PERM[95] := 189;
  497. //162,115, 44, 43,124, 94,150, 16,141,247, 32, 10,198,223,255, 72,
  498. PERM[96] := 162;
  499. PERM[97] := 115;
  500. PERM[98] := 44;
  501. PERM[99] := 43;
  502. PERM[100] := 124;
  503. PERM[101] := 94;
  504. PERM[102] := 150;
  505. PERM[103] := 16;
  506. PERM[104] := 141;
  507. PERM[105] := 247;
  508. PERM[106] := 32;
  509. PERM[107] := 10;
  510. PERM[108] := 198;
  511. PERM[109] := 223;
  512. PERM[110] := 255;
  513. PERM[111] := 72;
  514. //53,131, 84, 57,220,197, 58, 50,208, 11,241, 28, 3,192, 62,202,
  515. PERM[112] := 53;
  516. PERM[113] := 131;
  517. PERM[114] := 84;
  518. PERM[115] := 57;
  519. PERM[116] := 220;
  520. PERM[117] := 197;
  521. PERM[118] := 58;
  522. PERM[119] := 50;
  523. PERM[120] := 208;
  524. PERM[121] := 11;
  525. PERM[122] := 241;
  526. PERM[123] := 28;
  527. PERM[124] := 3;
  528. PERM[125] := 192;
  529. PERM[126] := 62;
  530. PERM[127] := 202;
  531. //18,215,153, 24, 76, 41, 15,179, 39, 46, 55, 6,128,167, 23,188,
  532. PERM[128] := 18;
  533. PERM[129] := 215;
  534. PERM[130] := 153;
  535. PERM[131] := 24;
  536. PERM[132] := 76;
  537. PERM[133] := 41;
  538. PERM[134] := 15;
  539. PERM[135] := 179;
  540. PERM[136] := 39;
  541. PERM[137] := 46;
  542. PERM[138] := 55;
  543. PERM[139] := 6;
  544. PERM[140] := 128;
  545. PERM[141] := 167;
  546. PERM[142] := 23;
  547. PERM[143] := 188;
  548. // 106, 34,187,140,164, 73,112,182,244,195,227, 13, 35, 77,196,185,
  549. PERM[144] := 106;
  550. PERM[145] := 34;
  551. PERM[146] := 187;
  552. PERM[147] := 140;
  553. PERM[148] := 164;
  554. PERM[149] := 73;
  555. PERM[150] := 112;
  556. PERM[151] := 182;
  557. PERM[152] := 244;
  558. PERM[153] := 195;
  559. PERM[154] := 227;
  560. PERM[155] := 13;
  561. PERM[156] := 35;
  562. PERM[157] := 77;
  563. PERM[158] := 196;
  564. PERM[159] := 185;
  565. //26,200,226,119, 31,123,168,125,249, 68,183,230,177,135,160,180,
  566. PERM[160] := 26;
  567. PERM[161] := 200;
  568. PERM[162] := 226;
  569. PERM[163] := 119;
  570. PERM[164] := 31;
  571. PERM[165] := 123;
  572. PERM[166] := 168;
  573. PERM[167] := 125;
  574. PERM[168] := 249;
  575. PERM[169] := 68;
  576. PERM[170] := 183;
  577. PERM[171] := 230;
  578. PERM[172] := 177;
  579. PERM[173] := 135;
  580. PERM[174] := 160;
  581. PERM[175] := 180;
  582. // 12, 1,243,148,102,166, 38,238,251, 37,240,126, 64, 74,161, 40,
  583. PERM[176] := 12;
  584. PERM[177] := 1;
  585. PERM[178] := 243;
  586. PERM[179] := 148;
  587. PERM[180] := 102;
  588. PERM[181] := 166;
  589. PERM[182] := 38;
  590. PERM[183] := 238;
  591. PERM[184] := 251;
  592. PERM[185] := 37;
  593. PERM[186] := 240;
  594. PERM[187] := 126;
  595. PERM[188] := 64;
  596. PERM[189] := 74;
  597. PERM[190] := 161;
  598. PERM[191] := 40;
  599. // 184,149,171,178,101, 66, 29, 59,146, 61,254,107, 42, 86,154, 4,
  600. PERM[192] := 184;
  601. PERM[193] := 149;
  602. PERM[194] := 171;
  603. PERM[195] := 178;
  604. PERM[196] := 101;
  605. PERM[197] := 66;
  606. PERM[198] := 29;
  607. PERM[199] := 59;
  608. PERM[200] := 146;
  609. PERM[201] := 61;
  610. PERM[202] := 254;
  611. PERM[203] := 107;
  612. PERM[204] := 42;
  613. PERM[205] := 86;
  614. PERM[206] := 154;
  615. PERM[207] := 4;
  616. // 236,232,120, 21,233,209, 45, 98,193,114, 78, 19,206, 14,118,127,
  617. PERM[208] := 236;
  618. PERM[209] := 232;
  619. PERM[210] := 120;
  620. PERM[211] := 21;
  621. PERM[212] := 233;
  622. PERM[213] := 209;
  623. PERM[214] := 45;
  624. PERM[215] := 98;
  625. PERM[216] := 193;
  626. PERM[217] := 114;
  627. PERM[218] := 78;
  628. PERM[219] := 19;
  629. PERM[220] := 206;
  630. PERM[221] := 14;
  631. PERM[222] := 118;
  632. PERM[223] := 127;
  633. // 48, 79,147, 85, 30,207,219, 54, 88,234,190,122, 95, 67,143,109,
  634. PERM[224] := 48;
  635. PERM[225] := 79;
  636. PERM[226] := 147;
  637. PERM[227] := 85;
  638. PERM[228] := 30;
  639. PERM[229] := 207;
  640. PERM[230] := 219;
  641. PERM[231] := 54;
  642. PERM[232] := 88;
  643. PERM[233] := 234;
  644. PERM[234] := 190;
  645. PERM[235] := 122;
  646. PERM[236] := 95;
  647. PERM[237] := 67;
  648. PERM[238] := 143;
  649. PERM[239] := 109;
  650. // 137,214,145, 93, 92,100,245, 0,216,186, 60, 83,105, 97,204, 52
  651. PERM[240] := 137;
  652. PERM[241] := 214;
  653. PERM[242] := 145;
  654. PERM[243] := 93;
  655. PERM[244] := 92;
  656. PERM[245] := 100;
  657. PERM[246] := 245;
  658. PERM[247] := 0;
  659. PERM[248] := 216;
  660. PERM[249] := 186;
  661. PERM[250] := 60;
  662. PERM[251] := 83;
  663. PERM[252] := 105;
  664. PERM[253] := 97;
  665. PERM[254] := 204;
  666. PERM[255] := 52;
  667. end;
  668. // ------------------------------------------------------------------
  669. initialization
  670. // ------------------------------------------------------------------
  671. RegisterGLTextureImageClass(TGLProcTextureNoise);
  672. finalization
  673. end.