Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1427 - trunk/StandAlone


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1427 - trunk/StandAlone
  • Date: Wed, 27 Jun 2007 11:05:08 -0600 (MDT)

Author: bigler
Date: Wed Jun 27 11:05:08 2007
New Revision: 1427

Modified:
   trunk/StandAlone/noisegen.cc
Log:

StandAlone/noisegen.cc

  Spit out the image as a 24 bit ppm.  I hope this helps Steve out.


Modified: trunk/StandAlone/noisegen.cc
==============================================================================
--- trunk/StandAlone/noisegen.cc        (original)
+++ trunk/StandAlone/noisegen.cc        Wed Jun 27 11:05:08 2007
@@ -1,7 +1,7 @@
 #include <Core/Math/SSEDefs.h>
 #include <Core/Math/Noise.h>
 #include <Image/SimpleImage.h>
-#include <Image/NRRDFile.h>
+#include <Image/PPMFile.h>
 
 using namespace Manta;
 using namespace std;
@@ -11,7 +11,7 @@
   int xres = 512;
   int yres = 512;
   
-  SimpleImage<RGBfloatPixel>* image = new SimpleImage<RGBfloatPixel>(false, 
xres, yres);
+  SimpleImage<RGB8Pixel>* image = new SimpleImage<RGB8Pixel>(false, xres, 
yres);
 
   for(int y = 0; y < yres; ++y)
     for(int x = 0; x < xres; ++x)
@@ -19,15 +19,17 @@
         __m128 sval = ScalarNoiseSSE(_mm_set_ps1((float)x/10), 
_mm_set_ps1((float)y/10), _mm_setzero_ps());
         //        cout << "sval = "<<sval<<"\n";
         float val = simd_component(sval, 0);
-        RGBfloatPixel pixel;
+        RGB8Pixel pixel;
         //val = fabsf(val);
-        pixel.r = val;
-        pixel.g = val;
-        pixel.b = val;
+        val = (val+1)/2;
+        unsigned char valC = SCIRun::Clamp(static_cast<unsigned 
char>(val*255), 0, 255);
+        pixel.r = valC;
+        pixel.g = valC;
+        pixel.b = valC;
         image->set(pixel, x, y, 0);
       }
 
-  writeNRRD(image, "noise.png", 0);
+  writePPM(image, "noise.ppm", 0);
   
   delete image;
   




  • [MANTA] r1427 - trunk/StandAlone, bigler, 06/27/2007

Archive powered by MHonArc 2.6.16.

Top of page