Browse Source

pnmimagetypes: Changes to support compilation with OpenEXR 3.0.1

rdb 4 years ago
parent
commit
9410418840
2 changed files with 26 additions and 1 deletions
  1. 2 1
      makepanda/makepanda.py
  2. 24 0
      panda/src/pnmimagetypes/pnmFileTypeEXR.cxx

+ 2 - 1
makepanda/makepanda.py

@@ -783,6 +783,7 @@ if (COMPILER == "MSVC"):
         else:
         else:
             LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Half" + suffix + ".lib")
             LibName("OPENEXR", GetThirdpartyDir() + "openexr/lib/Half" + suffix + ".lib")
         IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/OpenEXR")
         IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/OpenEXR")
+        IncDirectory("OPENEXR", GetThirdpartyDir() + "openexr/include/Imath")
     if (PkgSkip("JPEG")==0):     LibName("JPEG",     GetThirdpartyDir() + "jpeg/lib/jpeg-static.lib")
     if (PkgSkip("JPEG")==0):     LibName("JPEG",     GetThirdpartyDir() + "jpeg/lib/jpeg-static.lib")
     if (PkgSkip("ZLIB")==0):     LibName("ZLIB",     GetThirdpartyDir() + "zlib/lib/zlibstatic.lib")
     if (PkgSkip("ZLIB")==0):     LibName("ZLIB",     GetThirdpartyDir() + "zlib/lib/zlibstatic.lib")
     if (PkgSkip("VRPN")==0):     LibName("VRPN",     GetThirdpartyDir() + "vrpn/lib/vrpn.lib")
     if (PkgSkip("VRPN")==0):     LibName("VRPN",     GetThirdpartyDir() + "vrpn/lib/vrpn.lib")
@@ -992,7 +993,7 @@ if (COMPILER=="GCC"):
         SmartPkgEnable("OPENAL",    "openal",    ("openal"), "AL/al.h", framework = "OpenAL")
         SmartPkgEnable("OPENAL",    "openal",    ("openal"), "AL/al.h", framework = "OpenAL")
         SmartPkgEnable("SQUISH",    "",          ("squish"), "squish.h")
         SmartPkgEnable("SQUISH",    "",          ("squish"), "squish.h")
         SmartPkgEnable("TIFF",      "libtiff-4", ("tiff"), "tiff.h")
         SmartPkgEnable("TIFF",      "libtiff-4", ("tiff"), "tiff.h")
-        SmartPkgEnable("OPENEXR",   "OpenEXR",   ("IlmImf", "Imath", "Half", "Iex", "IexMath", "IlmThread"), ("OpenEXR", "OpenEXR/ImfOutputFile.h"))
+        SmartPkgEnable("OPENEXR",   "OpenEXR",   ("IlmImf", "Imath", "Half", "Iex", "IexMath", "IlmThread"), ("OpenEXR", "Imath", "OpenEXR/ImfOutputFile.h"))
         SmartPkgEnable("VRPN",      "",          ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
         SmartPkgEnable("VRPN",      "",          ("vrpn", "quat"), ("vrpn", "quat.h", "vrpn/vrpn_Types.h"))
         SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
         SmartPkgEnable("BULLET", "bullet", ("BulletSoftBody", "BulletDynamics", "BulletCollision", "LinearMath"), ("bullet", "bullet/btBulletDynamicsCommon.h"))
         SmartPkgEnable("VORBIS",    "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))
         SmartPkgEnable("VORBIS",    "vorbisfile",("vorbisfile", "vorbis", "ogg"), ("ogg/ogg.h", "vorbis/vorbisfile.h"))

+ 24 - 0
panda/src/pnmimagetypes/pnmFileTypeEXR.cxx

@@ -25,6 +25,10 @@
 #include <ImfChannelList.h>
 #include <ImfChannelList.h>
 #include <ImfVersion.h>
 #include <ImfVersion.h>
 #include <ImfIO.h>
 #include <ImfIO.h>
+#include <ImfFrameBuffer.h>
+#include <ImfHeader.h>
+
+#include <ImathBox.h>
 
 
 #ifndef IMATH_NAMESPACE
 #ifndef IMATH_NAMESPACE
 #define IMATH_NAMESPACE Imath
 #define IMATH_NAMESPACE Imath
@@ -50,6 +54,15 @@ public:
     _strm.write(c, n);
     _strm.write(c, n);
   }
   }
 
 
+#if OPENEXR_VERSION_MAJOR >= 3
+  virtual uint64_t tellp() {
+    return _strm.tellp();
+  }
+
+  virtual void seekp(uint64_t pos) {
+    _strm.seekp(pos);
+  }
+#else
   virtual IMF::Int64 tellp() {
   virtual IMF::Int64 tellp() {
     return _strm.tellp();
     return _strm.tellp();
   }
   }
@@ -57,6 +70,7 @@ public:
   virtual void seekp(IMF::Int64 pos) {
   virtual void seekp(IMF::Int64 pos) {
     _strm.seekp(pos);
     _strm.seekp(pos);
   }
   }
+#endif
 
 
 private:
 private:
   std::ostream &_strm;
   std::ostream &_strm;
@@ -88,6 +102,15 @@ public:
     return not_eof;
     return not_eof;
   }
   }
 
 
+#if OPENEXR_VERSION_MAJOR >= 3
+  virtual uint64_t tellg() {
+    return _strm.tellg();
+  }
+
+  virtual void seekg(uint64_t pos) {
+    _strm.seekg(pos);
+  }
+#else
   virtual IMF::Int64 tellg() {
   virtual IMF::Int64 tellg() {
     return _strm.tellg();
     return _strm.tellg();
   }
   }
@@ -95,6 +118,7 @@ public:
   virtual void seekg(IMF::Int64 pos) {
   virtual void seekg(IMF::Int64 pos) {
     _strm.seekg(pos);
     _strm.seekg(pos);
   }
   }
+#endif
 
 
   virtual void clear() {
   virtual void clear() {
     _strm.clear();
     _strm.clear();