changeset 248:e6303e0c62cb

Radial blur stuff.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 09 Oct 2012 17:47:40 +0300
parents cfde1deedd62
children 3b028785b843
files vptest.c
diffstat 1 files changed, 22 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/vptest.c	Tue Oct 09 17:47:19 2012 +0300
+++ b/vptest.c	Tue Oct 09 17:47:40 2012 +0300
@@ -10,7 +10,7 @@
 #define DM_COLORS (256)
 
 char *optFontFile = "font.ttf",
-     *optBitmapFilename = "map.png";
+     *optBitmapFilename = "blurri.png";
 BOOL optBenchmark = FALSE;
 int optVFlags = SDL_SWSURFACE | SDL_HWPALETTE;
 int optScrWidth = 640, optScrHeight = 480, optFontSize = 20, optScrDepth = 32;
@@ -196,7 +196,7 @@
 
 int main(int argc, char *argv[])
 {
-    SDL_Surface *screen = NULL, *bmap = NULL, *fbmap = NULL;
+    SDL_Surface *screen = NULL, *bmap = NULL, *fbmap = NULL, *screen2 = NULL;
     SDL_Color fontcol = { 255, 155, 155, 0 };
     SDL_Event event;
     TTF_Font *font = NULL;
@@ -291,6 +291,7 @@
         SDL_WM_SetCaption("Halleluja", "DMT");
     }
 
+    screen2 = SDL_CreateRGBSurface(SDL_SWSURFACE, optScrWidth, optScrHeight, optScrDepth, 0, 0, 0, 0);
     Uint32 lcol = dmMapRGB(screen, 255,255,255);
 
     int numFrames = 0, startTime = SDL_GetTicks(), endTime = 0;
@@ -353,15 +354,14 @@
         dmClearSurface(screen, 0);
 
         float f = SDL_GetTicks() / 150.0f,
-              qw = (float) 32.0 * (1.0 + sin(f) * 0.1),
-              qh = (float) 32.0 * (1.0 + sin(f) * 0.1),
               qw2 = (float) 132.0 * (1.0 + sin(f) * 0.1),
               qh2 = (float) 132.0 * (1.0 + sin(f) * 0.1);
 
 #if 1
         dmScaledBlitSurfaceAny(bmap, bx-qw2, by-qh2, bmap->w+qw2, bmap->h+qh2, screen,
+        DMD_TRANSPARENT
+//        DMD_SATURATE
 //        DMD_NONE
-        DMD_TRANSPARENT
         );
 #endif
 #if 0
@@ -384,6 +384,23 @@
         dmDraw3DLineSpriteModel(screen, model, &pos, &mat, fbmap, lcol);
 #endif
 
+#if 0
+        int np;
+        dmClearSurface(screen2, 0);
+        for (np = 1; np <= 4; np++)
+        {
+            float n = ((np + 1) * (np + 1) * np) * 0.6;
+            dmScaledBlitSurface32to32TransparentGA(screen, -n, -n, screen->w + n*2.0f, screen->h + n*2.0f, screen2,
+            200 - np * 5
+            );
+            dmDirectBlitSurface(screen2, screen);
+        }
+
+        dmDraw3DLineSpriteModel(screen, &model, &pos, &mat, fbmap, lcol);
+
+        dmRadialBlur(screen, 320, 240, 0.010);
+        dmRadialBlur(screen, 325, 245, 0.016);
+#endif
 
         if (!optBenchmark)
         {