Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[Manta] r1821 - in trunk: . Image


Chronological Thread 
  • From: kmorley@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [Manta] r1821 - in trunk: . Image
  • Date: Mon, 5 Nov 2007 18:08:43 -0700 (MST)

Author: kmorley
Date: Mon Nov  5 18:08:42 2007
New Revision: 1821

Modified:
   trunk/Image/EXRFile.cc
   trunk/Image/EXRFile.h
   trunk/manta-commands.txt
Log:
EXR textures were being clamped to 8-Bit

Modified: trunk/Image/EXRFile.cc
==============================================================================
--- trunk/Image/EXRFile.cc      (original)
+++ trunk/Image/EXRFile.cc      Mon Nov  5 18:08:42 2007
@@ -50,26 +50,28 @@
 using namespace Manta;
 
 extern "C" 
-bool isEXR( std::string const &filename )
+bool isEXR( const std::string& filename )
 {
   std::ifstream file(filename.c_str(), std::ios_base::binary); 
 
+  if ( !file ) return false;
+
   char b[4]; 
   file.read (b, sizeof (b)); 
 
-  return !!file && b[0] == 0x76 && b[1] == 0x2f && b[2] == 0x31 && b[3] == 
0x01;
+  return b[0] == 0x76 && b[1] == 0x2f && b[2] == 0x31 && b[3] == 0x01;
 }
 
 
 extern "C" 
-void writeEXR( Image const *image, std::string const &file_name, 
+void writeEXR( const Image* image, const std::string& file_name, 
     int which ) 
 {
 }
 
 
 extern "C" 
-Image* readEXR( const std::string &filename ) 
+Image* readEXR( const std::string& filename ) 
 {
 #if 0
 
@@ -170,8 +172,9 @@
   file.setFrameBuffer (&pixels[0][0] - dw.min.x - dw.min.y * width, 1, 
width); 
   file.readPixels (dw.min.y, dw.max.y); 
 
-  SimpleImage<RGBA8Pixel>* image = new SimpleImage<RGBA8Pixel>( false, 
width, 
-      height );
+  SimpleImage<RGBAfloatPixel>* image = 
+    new SimpleImage<RGBAfloatPixel>( false, width, height );
+
   for ( int i = 0; i < width; ++i ) {
     for ( int j = 0; j < height; ++j ) {
      
@@ -184,7 +187,7 @@
       //          << float( pixels[i][j].g ) << " " 
       //          << float( pixels[i][j].b ) << std::endl;
 
-      RGBA8Pixel pixel;
+      RGBAfloatPixel pixel;
       convertToPixel( pixel, color );
       image->set( pixel, i, j, 0 ); 
     }

Modified: trunk/Image/EXRFile.h
==============================================================================
--- trunk/Image/EXRFile.h       (original)
+++ trunk/Image/EXRFile.h       Mon Nov  5 18:08:42 2007
@@ -31,21 +31,71 @@
 #define Manta_Image_EXRFile_h
 
 #include <string>
+#include <vector>
 
-namespace Manta {
+
+namespace Imf 
+{
+  class Rgba;
+}
+
+
+namespace Manta 
+{
 
   class Image;
 
-  extern "C" bool isEXR( const std::string& filename );
+  extern "C" 
+  bool isEXR( const std::string& filename );
 
-  extern "C" void writeEXR ( const Image* image, const std::string& filename,
-                             int which = 0 );
+  extern "C" 
+  void writeEXR( const Image* image, const std::string &filename, int 
which=0 );
 
-  extern "C" Image* readEXR( const std::string& filename );
+  extern "C" 
+  Image* readEXR( const std::string& filename );
 
   // Returns true if this reader is supported
-  extern "C" bool EXRSupported();
+  extern "C" 
+  bool EXRSupported();
+
+
+  class EXRFile 
+  {
+  public:
+
+
+    enum PixelType        // Should be identical to Imf::PixelType
+    {
+      UINT  = 0,          // unsigned int (32 bit)
+      HALF  = 1,          // half (16 bit floating point)
+      FLOAT = 2,          // float (32 bit floating point)
+      NUM_PIXELTYPES      // number of different pixel types
+    };
+
+
+    class Channel
+    {
+      std::string     name;  // Name of the channel, eg "R", "G", "B"
+      PixelType       type;  // Should match Imf::PixelType enum
+      char*           data;  // The raster data 
+    };
+
+    typedef std::vector<Channel*> ChannelList;
+
+    EXRFile( const std::string& filename, unsigned int x, unsigned int y );
+    EXRFile( const ChannelList& channel_list, unsigned int x, unsigned int y 
);
+    EXRFile( Imf::Rgba* pixels, unsigned int x, unsigned int y );
+
+    void write( const std::string& filename );
+    Image* getImage();
+
+  private:
+    EXRFile() {}
+
+    unsigned int _x; // Width
+    unsigned int _y; // Height
 
+  };
 }
 
 #endif

Modified: trunk/manta-commands.txt
==============================================================================
--- trunk/manta-commands.txt    (original)
+++ trunk/manta-commands.txt    Mon Nov  5 18:08:42 2007
@@ -14,7 +14,7 @@
 dplace -c 1-511 bin/manta -res 46080x14400 -bench 1 0 -np 508 -scene 
"lib/libscene_boeing777.so( -file /dev/shm/Boeing777.v3c1 -np 64 -cutting 
default )" -camera "pinhole( -eye 1408.56 -2172.05 110.736  -lookat 1350.55 
188.313 354.277  -up 0.0117111 -0.465077 0.885192  -fov 60 )" -shadows 
noshadows -imagedisplay "file( /tmp/test_img46080x14400 )
 
 #hdri test scene 
-./bin/manta -scene  
"lib/libscene_hdri(/Users/kmorley/Desktop/EXR_images/probe.exr)"
+./bin/manta -scene 
"lib/libscene_hdri(/Users/kmorley/Data/EXR_images/probe.exr)"
 
 # Boeing demo.
 dplace -c 1-121 bin/fox_manta -np 118 -scene "lib/libscene_boeing777.so( 
-file /dev/shm/Boeing777.v3c1 -np 64 )"




  • [Manta] r1821 - in trunk: . Image, kmorley, 11/05/2007

Archive powered by MHonArc 2.6.16.

Top of page