changeset 896:90a879277ca2

Fix perling noise usage.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 23 Feb 2015 15:44:33 +0200
parents eb4ebbd5c171
children 9541ea963e75
files tests/blittest.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/tests/blittest.c	Mon Feb 23 15:41:27 2015 +0200
+++ b/tests/blittest.c	Mon Feb 23 15:44:33 2015 +0200
@@ -2,6 +2,7 @@
 #include "dmargs.h"
 #include "dmvecmat.h"
 #include "dmtext.h"
+#include "dmperlin.h"
 #include <math.h>
 
 #define DM_COLORS (256)
@@ -11,6 +12,7 @@
 int optVFlags = SDL_SWSURFACE | SDL_HWPALETTE;
 int optScrWidth = 640, optScrHeight = 480, optFontSize = 20, optScrDepth = 32;
 int optBenchmarkLen = 20;
+DMPerlinContext perlinCtx;
 
 static const DMOptArg optList[] = {
     { 0, '?', "help",       "Show this help", OPT_NONE },
@@ -166,7 +168,7 @@
     for (y = 0; y < QHEIGHT; y++)
         for (x = 0; x < QWIDTH; x++)
         {
-            DMFloat f = 0.40f + dmPerlinNoise2D(x, y, 1.1f, q, 2);
+            DMFloat f = 0.40f + dmPerlinNoise2D(&perlinCtx, x, y, 1.1f, q, 2);
             map[y][x] = (int) (dmClip(f) * m);
         }
 }
@@ -334,7 +336,7 @@
         SDL_WM_SetCaption("Halleluja", "DMT");
     }
 
-    dmPerlinInit();
+    dmPerlinInit(&perlinCtx, 1234);
 
     bmap = SDL_CreateRGBSurface(SDL_SWSURFACE, QWIDTH, QHEIGHT, 8, 0, 0, 0, 0);
     DM_MakePalette(bmap);