diff --git a/3rdparty/include/OpenEXR/Iex.h b/3rdparty/include/OpenEXR/Iex.h deleted file mode 100644 index a0fd31d017..0000000000 --- a/3rdparty/include/OpenEXR/Iex.h +++ /dev/null @@ -1,60 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEX_H -#define INCLUDED_IEX_H - - -//-------------------------------- -// -// Exception handling -// -//-------------------------------- - - -#include "IexMacros.h" -#include "IexBaseExc.h" -#include "IexMathExc.h" -#include "IexThrowErrnoExc.h" - -// Note that we do not include file IexErrnoExc.h here. That file -// defines over 150 classes and significantly slows down compilation. -// If you throw ErrnoExc exceptions using the throwErrnoExc() function, -// you don't need IexErrnoExc.h. You have to include IexErrnoExc.h -// only if you want to catch specific subclasses of ErrnoExc. - - -#endif diff --git a/3rdparty/include/OpenEXR/IexBaseExc.h b/3rdparty/include/OpenEXR/IexBaseExc.h deleted file mode 100644 index 9d8ab24286..0000000000 --- a/3rdparty/include/OpenEXR/IexBaseExc.h +++ /dev/null @@ -1,266 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEXBASEEXC_H -#define INCLUDED_IEXBASEEXC_H - - -//---------------------------------------------------------- -// -// A general exception base class, and a few -// useful exceptions derived from the base class. -// -//---------------------------------------------------------- - -#include -#include -#include - -namespace Iex { - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -// Tell MS VC++ to suppress exception specification warnings -#pragma warning(disable:4290) -#endif - -//------------------------------- -// Our most basic exception class -//------------------------------- - -class BaseExc: public std::string, public std::exception -{ - public: - - //---------------------------- - // Constructors and destructor - //---------------------------- - - BaseExc (const char *s = 0) throw(); // std::string (s) - BaseExc (const std::string &s) throw(); // std::string (s) - BaseExc (std::stringstream &s) throw(); // std::string (s.str()) - - BaseExc (const BaseExc &be) throw(); - virtual ~BaseExc () throw (); - - //-------------------------------------------- - // what() method -- e.what() returns e.c_str() - //-------------------------------------------- - - virtual const char * what () const throw (); - - - //-------------------------------------------------- - // Convenient methods to change the exception's text - //-------------------------------------------------- - - BaseExc & assign (std::stringstream &s); // assign (s.str()) - BaseExc & operator = (std::stringstream &s); - - BaseExc & append (std::stringstream &s); // append (s.str()) - BaseExc & operator += (std::stringstream &s); - - - //-------------------------------------------------- - // These methods from the base class get obscured by - // the definitions above. - //-------------------------------------------------- - - BaseExc & assign (const char *s); - BaseExc & operator = (const char *s); - - BaseExc & append (const char *s); - BaseExc & operator += (const char *s); - - - //-------------------------------------------------- - // Stack trace for the point at which the exception - // was thrown. The stack trace will be an empty - // string unless a working stack-tracing routine - // has been installed (see below, setStackTracer()). - //-------------------------------------------------- - - const std::string & stackTrace () const; - - private: - - std::string _stackTrace; -}; - - -//----------------------------------------------------- -// A macro to save typing when declararing an exception -// class derived directly or indirectly from BaseExc: -//----------------------------------------------------- - -#define DEFINE_EXC(name, base) \ - class name: public base \ - { \ - public: \ - name (const char* text=0) throw(): base (text) {} \ - name (const std::string &text) throw(): base (text) {} \ - name (std::stringstream &text) throw(): base (text) {} \ - }; - - -//-------------------------------------------------------- -// Some exceptions which should be useful in most programs -//-------------------------------------------------------- - -DEFINE_EXC (ArgExc, BaseExc) // Invalid arguments to a function call - -DEFINE_EXC (LogicExc, BaseExc) // General error in a program's logic, - // for example, a function was called - // in a context where the call does - // not make sense. - -DEFINE_EXC (InputExc, BaseExc) // Invalid input data, e.g. from a file - -DEFINE_EXC (IoExc, BaseExc) // Input or output operation failed - -DEFINE_EXC (MathExc, BaseExc) // Arithmetic exception; more specific - // exceptions derived from this class - // are defined in ExcMath.h - -DEFINE_EXC (ErrnoExc, BaseExc) // Base class for exceptions corresponding - // to errno values (see errno.h); more - // specific exceptions derived from this - // class are defined in ExcErrno.h - -DEFINE_EXC (NoImplExc, BaseExc) // Missing method exception e.g. from a - // call to a method that is only partially - // or not at all implemented. A reminder - // to lazy software people to get back - // to work. - -DEFINE_EXC (NullExc, BaseExc) // A pointer is inappropriately null. - -DEFINE_EXC (TypeExc, BaseExc) // An object is an inappropriate type, - // i.e. a dynamnic_cast failed. - - -//---------------------------------------------------------------------- -// Stack-tracing support: -// -// setStackTracer(st) -// -// installs a stack-tracing routine, st, which will be called from -// class BaseExc's constructor every time an exception derived from -// BaseExc is thrown. The stack-tracing routine should return a -// string that contains a printable representation of the program's -// current call stack. This string will be stored in the BaseExc -// object; the string is accesible via the BaseExc::stackTrace() -// method. -// -// setStackTracer(0) -// -// removes the current stack tracing routine. When an exception -// derived from BaseExc is thrown, the stack trace string stored -// in the BaseExc object will be empty. -// -// stackTracer() -// -// returns a pointer to the current stack-tracing routine, or 0 -// if there is no current stack stack-tracing routine. -// -//---------------------------------------------------------------------- - -typedef std::string (* StackTracer) (); - -void setStackTracer (StackTracer stackTracer); -StackTracer stackTracer (); - - -//----------------- -// Inline functions -//----------------- - -inline BaseExc & -BaseExc::operator = (std::stringstream &s) -{ - return assign (s); -} - - -inline BaseExc & -BaseExc::operator += (std::stringstream &s) -{ - return append (s); -} - - -inline BaseExc & -BaseExc::assign (const char *s) -{ - std::string::assign(s); - return *this; -} - - -inline BaseExc & -BaseExc::operator = (const char *s) -{ - return assign(s); -} - - -inline BaseExc & -BaseExc::append (const char *s) -{ - std::string::append(s); - return *this; -} - - -inline BaseExc & -BaseExc::operator += (const char *s) -{ - return append(s); -} - - -inline const std::string & -BaseExc::stackTrace () const -{ - return _stackTrace; -} - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -#pragma warning(default:4290) -#endif - -} // namespace Iex - -#endif diff --git a/3rdparty/include/OpenEXR/IexErrnoExc.h b/3rdparty/include/OpenEXR/IexErrnoExc.h deleted file mode 100644 index 53cc28ffce..0000000000 --- a/3rdparty/include/OpenEXR/IexErrnoExc.h +++ /dev/null @@ -1,210 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEXERRNOEXC_H -#define INCLUDED_IEXERRNOEXC_H - -//---------------------------------------------------------------- -// -// Exceptions which correspond to "errno" error codes. -// -//---------------------------------------------------------------- - -#include "IexBaseExc.h" - -namespace Iex { - - -DEFINE_EXC (EpermExc, ErrnoExc) -DEFINE_EXC (EnoentExc, ErrnoExc) -DEFINE_EXC (EsrchExc, ErrnoExc) -DEFINE_EXC (EintrExc, ErrnoExc) -DEFINE_EXC (EioExc, ErrnoExc) -DEFINE_EXC (EnxioExc, ErrnoExc) -DEFINE_EXC (E2bigExc, ErrnoExc) -DEFINE_EXC (EnoexecExc, ErrnoExc) -DEFINE_EXC (EbadfExc, ErrnoExc) -DEFINE_EXC (EchildExc, ErrnoExc) -DEFINE_EXC (EagainExc, ErrnoExc) -DEFINE_EXC (EnomemExc, ErrnoExc) -DEFINE_EXC (EaccesExc, ErrnoExc) -DEFINE_EXC (EfaultExc, ErrnoExc) -DEFINE_EXC (EnotblkExc, ErrnoExc) -DEFINE_EXC (EbusyExc, ErrnoExc) -DEFINE_EXC (EexistExc, ErrnoExc) -DEFINE_EXC (ExdevExc, ErrnoExc) -DEFINE_EXC (EnodevExc, ErrnoExc) -DEFINE_EXC (EnotdirExc, ErrnoExc) -DEFINE_EXC (EisdirExc, ErrnoExc) -DEFINE_EXC (EinvalExc, ErrnoExc) -DEFINE_EXC (EnfileExc, ErrnoExc) -DEFINE_EXC (EmfileExc, ErrnoExc) -DEFINE_EXC (EnottyExc, ErrnoExc) -DEFINE_EXC (EtxtbsyExc, ErrnoExc) -DEFINE_EXC (EfbigExc, ErrnoExc) -DEFINE_EXC (EnospcExc, ErrnoExc) -DEFINE_EXC (EspipeExc, ErrnoExc) -DEFINE_EXC (ErofsExc, ErrnoExc) -DEFINE_EXC (EmlinkExc, ErrnoExc) -DEFINE_EXC (EpipeExc, ErrnoExc) -DEFINE_EXC (EdomExc, ErrnoExc) -DEFINE_EXC (ErangeExc, ErrnoExc) -DEFINE_EXC (EnomsgExc, ErrnoExc) -DEFINE_EXC (EidrmExc, ErrnoExc) -DEFINE_EXC (EchrngExc, ErrnoExc) -DEFINE_EXC (El2nsyncExc, ErrnoExc) -DEFINE_EXC (El3hltExc, ErrnoExc) -DEFINE_EXC (El3rstExc, ErrnoExc) -DEFINE_EXC (ElnrngExc, ErrnoExc) -DEFINE_EXC (EunatchExc, ErrnoExc) -DEFINE_EXC (EnocsiExc, ErrnoExc) -DEFINE_EXC (El2hltExc, ErrnoExc) -DEFINE_EXC (EdeadlkExc, ErrnoExc) -DEFINE_EXC (EnolckExc, ErrnoExc) -DEFINE_EXC (EbadeExc, ErrnoExc) -DEFINE_EXC (EbadrExc, ErrnoExc) -DEFINE_EXC (ExfullExc, ErrnoExc) -DEFINE_EXC (EnoanoExc, ErrnoExc) -DEFINE_EXC (EbadrqcExc, ErrnoExc) -DEFINE_EXC (EbadsltExc, ErrnoExc) -DEFINE_EXC (EdeadlockExc, ErrnoExc) -DEFINE_EXC (EbfontExc, ErrnoExc) -DEFINE_EXC (EnostrExc, ErrnoExc) -DEFINE_EXC (EnodataExc, ErrnoExc) -DEFINE_EXC (EtimeExc, ErrnoExc) -DEFINE_EXC (EnosrExc, ErrnoExc) -DEFINE_EXC (EnonetExc, ErrnoExc) -DEFINE_EXC (EnopkgExc, ErrnoExc) -DEFINE_EXC (EremoteExc, ErrnoExc) -DEFINE_EXC (EnolinkExc, ErrnoExc) -DEFINE_EXC (EadvExc, ErrnoExc) -DEFINE_EXC (EsrmntExc, ErrnoExc) -DEFINE_EXC (EcommExc, ErrnoExc) -DEFINE_EXC (EprotoExc, ErrnoExc) -DEFINE_EXC (EmultihopExc, ErrnoExc) -DEFINE_EXC (EbadmsgExc, ErrnoExc) -DEFINE_EXC (EnametoolongExc, ErrnoExc) -DEFINE_EXC (EoverflowExc, ErrnoExc) -DEFINE_EXC (EnotuniqExc, ErrnoExc) -DEFINE_EXC (EbadfdExc, ErrnoExc) -DEFINE_EXC (EremchgExc, ErrnoExc) -DEFINE_EXC (ElibaccExc, ErrnoExc) -DEFINE_EXC (ElibbadExc, ErrnoExc) -DEFINE_EXC (ElibscnExc, ErrnoExc) -DEFINE_EXC (ElibmaxExc, ErrnoExc) -DEFINE_EXC (ElibexecExc, ErrnoExc) -DEFINE_EXC (EilseqExc, ErrnoExc) -DEFINE_EXC (EnosysExc, ErrnoExc) -DEFINE_EXC (EloopExc, ErrnoExc) -DEFINE_EXC (ErestartExc, ErrnoExc) -DEFINE_EXC (EstrpipeExc, ErrnoExc) -DEFINE_EXC (EnotemptyExc, ErrnoExc) -DEFINE_EXC (EusersExc, ErrnoExc) -DEFINE_EXC (EnotsockExc, ErrnoExc) -DEFINE_EXC (EdestaddrreqExc, ErrnoExc) -DEFINE_EXC (EmsgsizeExc, ErrnoExc) -DEFINE_EXC (EprototypeExc, ErrnoExc) -DEFINE_EXC (EnoprotooptExc, ErrnoExc) -DEFINE_EXC (EprotonosupportExc, ErrnoExc) -DEFINE_EXC (EsocktnosupportExc, ErrnoExc) -DEFINE_EXC (EopnotsuppExc, ErrnoExc) -DEFINE_EXC (EpfnosupportExc, ErrnoExc) -DEFINE_EXC (EafnosupportExc, ErrnoExc) -DEFINE_EXC (EaddrinuseExc, ErrnoExc) -DEFINE_EXC (EaddrnotavailExc, ErrnoExc) -DEFINE_EXC (EnetdownExc, ErrnoExc) -DEFINE_EXC (EnetunreachExc, ErrnoExc) -DEFINE_EXC (EnetresetExc, ErrnoExc) -DEFINE_EXC (EconnabortedExc, ErrnoExc) -DEFINE_EXC (EconnresetExc, ErrnoExc) -DEFINE_EXC (EnobufsExc, ErrnoExc) -DEFINE_EXC (EisconnExc, ErrnoExc) -DEFINE_EXC (EnotconnExc, ErrnoExc) -DEFINE_EXC (EshutdownExc, ErrnoExc) -DEFINE_EXC (EtoomanyrefsExc, ErrnoExc) -DEFINE_EXC (EtimedoutExc, ErrnoExc) -DEFINE_EXC (EconnrefusedExc, ErrnoExc) -DEFINE_EXC (EhostdownExc, ErrnoExc) -DEFINE_EXC (EhostunreachExc, ErrnoExc) -DEFINE_EXC (EalreadyExc, ErrnoExc) -DEFINE_EXC (EinprogressExc, ErrnoExc) -DEFINE_EXC (EstaleExc, ErrnoExc) -DEFINE_EXC (EioresidExc, ErrnoExc) -DEFINE_EXC (EucleanExc, ErrnoExc) -DEFINE_EXC (EnotnamExc, ErrnoExc) -DEFINE_EXC (EnavailExc, ErrnoExc) -DEFINE_EXC (EisnamExc, ErrnoExc) -DEFINE_EXC (EremoteioExc, ErrnoExc) -DEFINE_EXC (EinitExc, ErrnoExc) -DEFINE_EXC (EremdevExc, ErrnoExc) -DEFINE_EXC (EcanceledExc, ErrnoExc) -DEFINE_EXC (EnolimfileExc, ErrnoExc) -DEFINE_EXC (EproclimExc, ErrnoExc) -DEFINE_EXC (EdisjointExc, ErrnoExc) -DEFINE_EXC (EnologinExc, ErrnoExc) -DEFINE_EXC (EloginlimExc, ErrnoExc) -DEFINE_EXC (EgrouploopExc, ErrnoExc) -DEFINE_EXC (EnoattachExc, ErrnoExc) -DEFINE_EXC (EnotsupExc, ErrnoExc) -DEFINE_EXC (EnoattrExc, ErrnoExc) -DEFINE_EXC (EdircorruptedExc, ErrnoExc) -DEFINE_EXC (EdquotExc, ErrnoExc) -DEFINE_EXC (EnfsremoteExc, ErrnoExc) -DEFINE_EXC (EcontrollerExc, ErrnoExc) -DEFINE_EXC (EnotcontrollerExc, ErrnoExc) -DEFINE_EXC (EenqueuedExc, ErrnoExc) -DEFINE_EXC (EnotenqueuedExc, ErrnoExc) -DEFINE_EXC (EjoinedExc, ErrnoExc) -DEFINE_EXC (EnotjoinedExc, ErrnoExc) -DEFINE_EXC (EnoprocExc, ErrnoExc) -DEFINE_EXC (EmustrunExc, ErrnoExc) -DEFINE_EXC (EnotstoppedExc, ErrnoExc) -DEFINE_EXC (EclockcpuExc, ErrnoExc) -DEFINE_EXC (EinvalstateExc, ErrnoExc) -DEFINE_EXC (EnoexistExc, ErrnoExc) -DEFINE_EXC (EendofminorExc, ErrnoExc) -DEFINE_EXC (EbufsizeExc, ErrnoExc) -DEFINE_EXC (EemptyExc, ErrnoExc) -DEFINE_EXC (EnointrgroupExc, ErrnoExc) -DEFINE_EXC (EinvalmodeExc, ErrnoExc) -DEFINE_EXC (EcantextentExc, ErrnoExc) -DEFINE_EXC (EinvaltimeExc, ErrnoExc) -DEFINE_EXC (EdestroyedExc, ErrnoExc) - - -} // namespace Iex - -#endif diff --git a/3rdparty/include/OpenEXR/IexMacros.h b/3rdparty/include/OpenEXR/IexMacros.h deleted file mode 100644 index 4c715c3eb6..0000000000 --- a/3rdparty/include/OpenEXR/IexMacros.h +++ /dev/null @@ -1,148 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEXMACROS_H -#define INCLUDED_IEXMACROS_H - -//-------------------------------------------------------------------- -// -// Macros which make throwing exceptions more convenient -// -//-------------------------------------------------------------------- - -#include - - -//---------------------------------------------------------------------------- -// A macro to throw exceptions whose text is assembled using stringstreams. -// -// Example: -// -// THROW (InputExc, "Syntax error in line " << line ", " << file << "."); -// -//---------------------------------------------------------------------------- - -#define THROW(type, text) \ - do \ - { \ - std::stringstream s; \ - s << text; \ - throw type (s); \ - } \ - while (0) - - -//---------------------------------------------------------------------------- -// Macros to add to or to replace the text of an exception. -// The new text is assembled using stringstreams. -// -// Examples: -// -// Append to end of an exception's text: -// -// catch (BaseExc &e) -// { -// APPEND_EXC (e, " Directory " << name << " does not exist."); -// throw; -// } -// -// Replace an exception's text: -// -// catch (BaseExc &e) -// { -// REPLACE_EXC (e, "Directory " << name << " does not exist. " << e); -// throw; -// } -//---------------------------------------------------------------------------- - -#define APPEND_EXC(exc, text) \ - do \ - { \ - std::stringstream s; \ - s << text; \ - exc.append (s); \ - } \ - while (0) - -#define REPLACE_EXC(exc, text) \ - do \ - { \ - std::stringstream s; \ - s << text; \ - exc.assign (s); \ - } \ - while (0) - - -//------------------------------------------------------------- -// A macro to throw ErrnoExc exceptions whose text is assembled -// using stringstreams: -// -// Example: -// -// THROW_ERRNO ("Cannot open file " << name << " (%T)."); -// -//------------------------------------------------------------- - -#define THROW_ERRNO(text) \ - do \ - { \ - std::stringstream s; \ - s << text; \ - ::Iex::throwErrnoExc (s.str()); \ - } \ - while (0) - - -//------------------------------------------------------------- -// A macro to throw exceptions if an assertion is false. -// -// Example: -// -// ASSERT (NullExc, ptr != NULL, "Null pointer" ); -// -//------------------------------------------------------------- - -#define ASSERT(assertion, type, text) \ - do \ - { \ - if( (assertion) == false ) \ - THROW( type, text ); \ - } \ - while (0) - - -#endif diff --git a/3rdparty/include/OpenEXR/IexMathExc.h b/3rdparty/include/OpenEXR/IexMathExc.h deleted file mode 100644 index 4ef90d35bb..0000000000 --- a/3rdparty/include/OpenEXR/IexMathExc.h +++ /dev/null @@ -1,58 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEXMATHEXC_H -#define INCLUDED_IEXMATHEXC_H - -#include "IexBaseExc.h" - -namespace Iex { - -//--------------------------------------------------------- -// Exception classess which correspond to specific floating -// point exceptions. -//--------------------------------------------------------- - -DEFINE_EXC (OverflowExc, MathExc) // Overflow -DEFINE_EXC (UnderflowExc, MathExc) // Underflow -DEFINE_EXC (DivzeroExc, MathExc) // Division by zero -DEFINE_EXC (InexactExc, MathExc) // Inexact result -DEFINE_EXC (InvalidFpOpExc, MathExc) // Invalid operation - - -} // namespace Iex - -#endif diff --git a/3rdparty/include/OpenEXR/IexThrowErrnoExc.h b/3rdparty/include/OpenEXR/IexThrowErrnoExc.h deleted file mode 100644 index 5b41dcc0bb..0000000000 --- a/3rdparty/include/OpenEXR/IexThrowErrnoExc.h +++ /dev/null @@ -1,96 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IEXTHROWERRNOEXC_H -#define INCLUDED_IEXTHROWERRNOEXC_H - -//---------------------------------------------------------- -// -// A function which throws ExcErrno exceptions -// -//---------------------------------------------------------- - -#include "IexBaseExc.h" - -namespace Iex { - - -//-------------------------------------------------------------------------- -// -// Function throwErrnoExc() throws an exception which corresponds to -// error code errnum. The exception text is initialized with a copy -// of the string passed to throwErrnoExc(), where all occurrences of -// "%T" have been replaced with the output of strerror(oserror()). -// -// Example: -// -// If opening file /tmp/output failed with an ENOENT error code, -// calling -// -// throwErrnoExc (); -// -// or -// -// throwErrnoExc ("%T."); -// -// will throw an EnoentExc whose text reads -// -// No such file or directory. -// -// More detailed messages can be assembled using stringstreams: -// -// std::stringstream s; -// s << "Cannot open file " << name << " (%T)."; -// throwErrnoExc (s); -// -// The resulting exception contains the following text: -// -// Cannot open file /tmp/output (No such file or directory). -// -// Alternatively, you may want to use the THROW_ERRNO macro defined -// in IexMacros.h: -// -// THROW_ERRNO ("Cannot open file " << name << " (%T).") -// -//-------------------------------------------------------------------------- - -void throwErrnoExc (const std::string &txt, int errnum); -void throwErrnoExc (const std::string &txt = "%T." /*, int errnum = oserror() */); - - -} // namespace Iex - -#endif diff --git a/3rdparty/include/OpenEXR/IlmThread.h b/3rdparty/include/OpenEXR/IlmThread.h deleted file mode 100644 index 5129a8efeb..0000000000 --- a/3rdparty/include/OpenEXR/IlmThread.h +++ /dev/null @@ -1,141 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2005, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_ILM_THREAD_H -#define INCLUDED_ILM_THREAD_H - -//----------------------------------------------------------------------------- -// -// class Thread -// -// Class Thread is a portable interface to a system-dependent thread -// primitive. In order to make a thread actually do something useful, -// you must derive a subclass from class Thread and implement the -// run() function. If the operating system supports threading then -// the run() function will be executed int a new thread. -// -// The actual creation of the thread is done by the start() routine -// which then calls the run() function. In general the start() -// routine should be called from the constructor of the derived class. -// -// The base-class thread destructor will join/destroy the thread. -// -// IMPORTANT: Due to the mechanisms that encapsulate the low-level -// threading primitives in a C++ class there is a race condition -// with code resembling the following: -// -// { -// WorkerThread myThread; -// } // myThread goes out of scope, is destroyed -// // and the thread is joined -// -// The race is between the parent thread joining the child thread -// in the destructor of myThread, and the run() function in the -// child thread. If the destructor gets executed first then run() -// will be called with an invalid "this" pointer. -// -// This issue can be fixed by using a Semaphore to keep track of -// whether the run() function has already been called. You can -// include a Semaphore member variable within your derived class -// which you post() on in the run() function, and wait() on in the -// destructor before the thread is joined. Alternatively you could -// do something like this: -// -// Semaphore runStarted; -// -// void WorkerThread::run () -// { -// runStarted.post() -// // do some work -// ... -// } -// -// { -// WorkerThread myThread; -// runStarted.wait (); // ensure that we have started -// // the run function -// } // myThread goes out of scope, is destroyed -// // and the thread is joined -// -//----------------------------------------------------------------------------- - -#include "OpenEXRConfig.h" - -#if defined _WIN32 || defined _WIN64 - #ifdef NOMINMAX - #undef NOMINMAX - #endif - #define NOMINMAX - #include - #include -#elif HAVE_PTHREAD - #include -#endif - -namespace IlmThread { - -// -// Query function to determine if the current platform supports -// threads AND this library was compiled with threading enabled. -// - -bool supportsThreads (); - - -class Thread -{ - public: - - Thread (); - virtual ~Thread (); - - void start (); - virtual void run () = 0; - - private: - - #if defined _WIN32 || defined _WIN64 - HANDLE _thread; - #elif HAVE_PTHREAD - pthread_t _thread; - #endif - - void operator = (const Thread& t); // not implemented - Thread (const Thread& t); // not implemented -}; - - -} // namespace IlmThread - -#endif diff --git a/3rdparty/include/OpenEXR/IlmThreadMutex.h b/3rdparty/include/OpenEXR/IlmThreadMutex.h deleted file mode 100644 index dd7b86425a..0000000000 --- a/3rdparty/include/OpenEXR/IlmThreadMutex.h +++ /dev/null @@ -1,158 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2005, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_ILM_THREAD_MUTEX_H -#define INCLUDED_ILM_THREAD_MUTEX_H - -//----------------------------------------------------------------------------- -// -// class Mutex, class Lock -// -// Class Mutex is a wrapper for a system-dependent mutual exclusion -// mechanism. Actual locking and unlocking of a Mutex object must -// be performed using an instance of a Lock (defined below). -// -// Class lock provides safe locking and unlocking of mutexes even in -// the presence of C++ exceptions. Constructing a Lock object locks -// the mutex; destroying the Lock unlocks the mutex. -// -// Lock objects are not themselves thread-safe. You should never -// share a Lock object among multiple threads. -// -// Typical usage: -// -// Mutex mtx; // Create a Mutex object that is visible -// //to multiple threads -// -// ... // create some threads -// -// // Then, within each thread, construct a critical section like so: -// -// { -// Lock lock (mtx); // Lock constructor locks the mutex -// ... // do some computation on shared data -// } // leaving the block unlocks the mutex -// -//----------------------------------------------------------------------------- - -#include "OpenEXRConfig.h" - -#if defined _WIN32 || defined _WIN64 - #ifdef NOMINMAX - #undef NOMINMAX - #endif - #define NOMINMAX - #include -#elif HAVE_PTHREAD - #include -#endif - -namespace IlmThread { - -class Lock; - - -class Mutex -{ - public: - - Mutex (); - virtual ~Mutex (); - - private: - - void lock () const; - void unlock () const; - - #if defined _WIN32 || defined _WIN64 - mutable CRITICAL_SECTION _mutex; - #elif HAVE_PTHREAD - mutable pthread_mutex_t _mutex; - #endif - - void operator = (const Mutex& M); // not implemented - Mutex (const Mutex& M); // not implemented - - friend class Lock; -}; - - -class Lock -{ - public: - - Lock (const Mutex& m, bool autoLock = true): - _mutex (m), - _locked (false) - { - if (autoLock) - { - _mutex.lock(); - _locked = true; - } - } - - ~Lock () - { - if (_locked) - _mutex.unlock(); - } - - void acquire () - { - _mutex.lock(); - _locked = true; - } - - void release () - { - _mutex.unlock(); - _locked = false; - } - - bool locked () - { - return _locked; - } - - private: - - const Mutex & _mutex; - bool _locked; -}; - - -} // namespace IlmThread - -#endif diff --git a/3rdparty/include/OpenEXR/IlmThreadPool.h b/3rdparty/include/OpenEXR/IlmThreadPool.h deleted file mode 100644 index 39be1a84a7..0000000000 --- a/3rdparty/include/OpenEXR/IlmThreadPool.h +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2005, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_ILM_THREAD_POOL_H -#define INCLUDED_ILM_THREAD_POOL_H - -//----------------------------------------------------------------------------- -// -// class Task, class ThreadPool, class TaskGroup -// -// Class ThreadPool manages a set of worker threads and accepts -// tasks for processing. Tasks added to the thread pool are -// executed concurrently by the worker threads. -// -// Class Thread provides an abstract interface for a task which -// a ThreadPool works on. Derived classes need to implement the -// execute() function which performs the actual task. -// -// Class TaskTroup allows synchronization on the completion of a set -// of tasks. Every task that is added to a ThreadPool belongs to a -// single TaskGroup. The destructor of the TaskGroup waits for all -// tasks in the group to finish. -// -// Note: if you plan to use the ThreadPool interface in your own -// applications note that the implementation of the ThreadPool calls -// opertor delete on tasks as they complete. If you define a custom -// operator new for your tasks, for instance to use a custom heap, -// then you must also write an appropriate operator delete. -// -//----------------------------------------------------------------------------- - -namespace IlmThread { - -class TaskGroup; -class Task; - - -class ThreadPool -{ - public: - - //------------------------------------------------------- - // Constructor -- creates numThreads worker threads which - // wait until a task is available. - //------------------------------------------------------- - - ThreadPool (unsigned numThreads = 0); - - - //----------------------------------------------------------- - // Destructor -- waits for all tasks to complete, joins all - // the threads to the calling thread, and then destroys them. - //----------------------------------------------------------- - - virtual ~ThreadPool (); - - - //-------------------------------------------------------- - // Query and set the number of worker threads in the pool. - // - // Warning: never call setNumThreads from within a worker - // thread as this will almost certainly cause a deadlock - // or crash. - //-------------------------------------------------------- - - int numThreads () const; - void setNumThreads (int count); - - - //------------------------------------------------------------ - // Add a task for processing. The ThreadPool can handle any - // number of tasks regardless of the number of worker threads. - // The tasks are first added onto a queue, and are executed - // by threads as they become available, in FIFO order. - //------------------------------------------------------------ - - void addTask (Task* task); - - - //------------------------------------------- - // Access functions for the global threadpool - //------------------------------------------- - - static ThreadPool& globalThreadPool (); - static void addGlobalTask (Task* task); - - struct Data; - - protected: - - Data * _data; -}; - - -class Task -{ - public: - - Task (TaskGroup* g); - virtual ~Task (); - - virtual void execute () = 0; - TaskGroup * group(); - - protected: - - TaskGroup * _group; -}; - - -class TaskGroup -{ - public: - - TaskGroup(); - ~TaskGroup(); - - struct Data; - Data* const _data; -}; - - -} // namespace IlmThread - -#endif diff --git a/3rdparty/include/OpenEXR/IlmThreadSemaphore.h b/3rdparty/include/OpenEXR/IlmThreadSemaphore.h deleted file mode 100644 index 98b9e2e369..0000000000 --- a/3rdparty/include/OpenEXR/IlmThreadSemaphore.h +++ /dev/null @@ -1,109 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2005, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_ILM_THREAD_SEMAPHORE_H -#define INCLUDED_ILM_THREAD_SEMAPHORE_H - -//----------------------------------------------------------------------------- -// -// class Semaphore -- a wrapper class for -// system-dependent counting semaphores -// -//----------------------------------------------------------------------------- - -#include "OpenEXRConfig.h" - -#if defined _WIN32 || defined _WIN64 - #ifdef NOMINMAX - #undef NOMINMAX - #endif - #define NOMINMAX - #include -#elif HAVE_PTHREAD && !HAVE_POSIX_SEMAPHORES - #include -#elif HAVE_PTHREAD && HAVE_POSIX_SEMAPHORES - #include -#endif - -namespace IlmThread { - - -class Semaphore -{ - public: - - Semaphore (unsigned int value = 0); - virtual ~Semaphore(); - - void wait(); - void post(); - int value() const; - - private: - - #if defined _WIN32 || defined _WIN64 - - mutable HANDLE _semaphore; - - #elif HAVE_PTHREAD && !HAVE_POSIX_SEMAPHORES - - // - // If the platform has Posix threads but no semapohores, - // then we implement them ourselves using condition variables - // - - struct sema_t - { - unsigned int count; - unsigned long numWaiting; - pthread_mutex_t mutex; - pthread_cond_t nonZero; - }; - - mutable sema_t _semaphore; - - #elif HAVE_PTHREAD && HAVE_POSIX_SEMAPHORES - - mutable sem_t _semaphore; - - #endif - - void operator = (const Semaphore& s); // not implemented - Semaphore (const Semaphore& s); // not implemented -}; - - -} // namespace IlmThread - -#endif diff --git a/3rdparty/include/OpenEXR/ImathBox.h b/3rdparty/include/OpenEXR/ImathBox.h deleted file mode 100644 index c6c33da511..0000000000 --- a/3rdparty/include/OpenEXR/ImathBox.h +++ /dev/null @@ -1,277 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMATHBOX_H -#define INCLUDED_IMATHBOX_H - -//------------------------------------------------------------------- -// -// class Imath::Box -// -------------------------------- -// -// This class imposes the following requirements on its -// parameter class: -// -// 1) The class T must implement these operators: -// + - < > <= >= = -// with the signature (T,T) and the expected -// return values for a numeric type. -// -// 2) The class T must implement operator= -// with the signature (T,float and/or double) -// -// 3) The class T must have a constructor which takes -// a float (and/or double) for use in initializing the box. -// -// 4) The class T must have a function T::dimensions() -// which returns the number of dimensions in the class -// (since its assumed its a vector) -- preferably, this -// returns a constant expression. -// -//------------------------------------------------------------------- - -#include "ImathVec.h" - -namespace Imath { - - -template -class Box -{ - public: - - //------------------------- - // Data Members are public - //------------------------- - - T min; - T max; - - //----------------------------------------------------- - // Constructors - an "empty" box is created by default - //----------------------------------------------------- - - Box(); - Box(const T& point); - Box(const T& minT, const T& maxT); - - //-------------------- - // Operators: ==, != - //-------------------- - - bool operator == (const Box &src) const; - bool operator != (const Box &src) const; - - //------------------ - // Box manipulation - //------------------ - - void makeEmpty(); - void extendBy(const T& point); - void extendBy(const Box& box); - - //--------------------------------------------------- - // Query functions - these compute results each time - //--------------------------------------------------- - - T size() const; - T center() const; - bool intersects(const T &point) const; - bool intersects(const Box &box) const; - - unsigned int majorAxis() const; - - //---------------- - // Classification - //---------------- - - bool isEmpty() const; - bool hasVolume() const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - - -typedef Box Box2s; -typedef Box Box2i; -typedef Box Box2f; -typedef Box Box2d; -typedef Box Box3s; -typedef Box Box3i; -typedef Box Box3f; -typedef Box Box3d; - - -//---------------- -// Implementation -//---------------- - - -template -inline Box::Box() -{ - makeEmpty(); -} - -template -inline Box::Box(const T& point) -{ - min = point; - max = point; -} - -template -inline Box::Box(const T& minV, const T& maxV) -{ - min = minV; - max = maxV; -} - -template -inline bool -Box::operator == (const Box &src) const -{ - return (min == src.min && max == src.max); -} - -template -inline bool -Box::operator != (const Box &src) const -{ - return (min != src.min || max != src.max); -} - -template -inline void Box::makeEmpty() -{ - min = T(T::baseTypeMax()); - max = T(T::baseTypeMin()); -} - -template -inline void Box::extendBy(const T& point) -{ - for (unsigned int i=0; i max[i] ) max[i] = point[i]; - } -} - -template -inline void Box::extendBy(const Box& box) -{ - for (unsigned int i=0; i max[i] ) max[i] = box.max[i]; - } -} - -template -inline bool Box::intersects(const T& point) const -{ - for (unsigned int i=0; i max[i]) return false; - } - return true; -} - -template -inline bool Box::intersects(const Box& box) const -{ - for (unsigned int i=0; i max[i]) return false; - } - return true; -} - -template -inline T Box::size() const -{ - if (isEmpty()) - return T (0); - - return max-min; -} - -template -inline T Box::center() const -{ - return (max+min)/2; -} - -template -inline bool Box::isEmpty() const -{ - for (unsigned int i=0; i -inline bool Box::hasVolume() const -{ - for (unsigned int i=0; i -inline unsigned int Box::majorAxis() const -{ - unsigned int major = 0; - T s = size(); - - for (unsigned int i=1; i s[major] ) major = i; - } - - return major; -} - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathBoxAlgo.h b/3rdparty/include/OpenEXR/ImathBoxAlgo.h deleted file mode 100644 index 344b715867..0000000000 --- a/3rdparty/include/OpenEXR/ImathBoxAlgo.h +++ /dev/null @@ -1,611 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHBOXALGO_H -#define INCLUDED_IMATHBOXALGO_H - - -//--------------------------------------------------------------------------- -// -// This file contains algorithms applied to or in conjunction -// with bounding boxes (Imath::Box). These algorithms require -// more headers to compile. The assumption made is that these -// functions are called much less often than the basic box -// functions or these functions require more support classes. -// -// Contains: -// -// T clip(const T& in, const Box& box) -// -// Vec3 closestPointOnBox(const Vec3&, const Box>& ) -// -// Vec3 closestPointInBox(const Vec3&, const Box>& ) -// -// void transform(Box>&, const Matrix44&) -// -// bool findEntryAndExitPoints(const Line &line, -// const Box< Vec3 > &box, -// Vec3 &enterPoint, -// Vec3 &exitPoint) -// -// bool intersects(const Box> &box, -// const Line3 &line, -// Vec3 result) -// -// bool intersects(const Box> &box, const Line3 &line) -// -//--------------------------------------------------------------------------- - -#include "ImathBox.h" -#include "ImathMatrix.h" -#include "ImathLineAlgo.h" -#include "ImathPlane.h" - -namespace Imath { - - -template -inline T clip(const T& in, const Box& box) -{ - // - // Clip a point so that it lies inside the given bbox - // - - T out; - - for (int i=0; i<(int)box.min.dimensions(); i++) - { - if (in[i] < box.min[i]) out[i] = box.min[i]; - else if (in[i] > box.max[i]) out[i] = box.max[i]; - else out[i] = in[i]; - } - - return out; -} - - -// -// Return p if p is inside the box. -// - -template -Vec3 -closestPointInBox(const Vec3& p, const Box< Vec3 >& box ) -{ - Imath::V3f b; - - if (p.x < box.min.x) - b.x = box.min.x; - else if (p.x > box.max.x) - b.x = box.max.x; - else - b.x = p.x; - - if (p.y < box.min.y) - b.y = box.min.y; - else if (p.y > box.max.y) - b.y = box.max.y; - else - b.y = p.y; - - if (p.z < box.min.z) - b.z = box.min.z; - else if (p.z > box.max.z) - b.z = box.max.z; - else - b.z = p.z; - - return b; -} - -template -Vec3 closestPointOnBox(const Vec3& pt, const Box< Vec3 >& box ) -{ - // - // This sucker is specialized to work with a Vec3f and a box - // made of Vec3fs. - // - - Vec3 result; - - // trivial cases first - if (box.isEmpty()) - return pt; - else if (pt == box.center()) - { - // middle of z side - result[0] = (box.max[0] + box.min[0])/2.0; - result[1] = (box.max[1] + box.min[1])/2.0; - result[2] = box.max[2]; - } - else - { - // Find the closest point on a unit box (from -1 to 1), - // then scale up. - - // Find the vector from center to the point, then scale - // to a unit box. - Vec3 vec = pt - box.center(); - T sizeX = box.max[0]-box.min[0]; - T sizeY = box.max[1]-box.min[1]; - T sizeZ = box.max[2]-box.min[2]; - - T halfX = sizeX/2.0; - T halfY = sizeY/2.0; - T halfZ = sizeZ/2.0; - if (halfX > 0.0) - vec[0] /= halfX; - if (halfY > 0.0) - vec[1] /= halfY; - if (halfZ > 0.0) - vec[2] /= halfZ; - - // Side to snap side that has greatest magnitude in the vector. - Vec3 mag; - mag[0] = fabs(vec[0]); - mag[1] = fabs(vec[1]); - mag[2] = fabs(vec[2]); - - result = mag; - - // Check if beyond corners - if (result[0] > 1.0) - result[0] = 1.0; - if (result[1] > 1.0) - result[1] = 1.0; - if (result[2] > 1.0) - result[2] = 1.0; - - // snap to appropriate side - if ((mag[0] > mag[1]) && (mag[0] > mag[2])) - { - result[0] = 1.0; - } - else if ((mag[1] > mag[0]) && (mag[1] > mag[2])) - { - result[1] = 1.0; - } - else if ((mag[2] > mag[0]) && (mag[2] > mag[1])) - { - result[2] = 1.0; - } - else if ((mag[0] == mag[1]) && (mag[0] == mag[2])) - { - // corner - result = Vec3(1,1,1); - } - else if (mag[0] == mag[1]) - { - // edge parallel with z - result[0] = 1.0; - result[1] = 1.0; - } - else if (mag[0] == mag[2]) - { - // edge parallel with y - result[0] = 1.0; - result[2] = 1.0; - } - else if (mag[1] == mag[2]) - { - // edge parallel with x - result[1] = 1.0; - result[2] = 1.0; - } - - // Now make everything point the right way - for (int i=0; i < 3; i++) - { - if (vec[i] < 0.0) - result[i] = -result[i]; - } - - // scale back up and move to center - result[0] *= halfX; - result[1] *= halfY; - result[2] *= halfZ; - - result += box.center(); - } - return result; -} - -template -Box< Vec3 > -transform(const Box< Vec3 >& box, const Matrix44& m) -{ - // Transforms Box3f by matrix, enlarging Box3f to contain result. - // Clever method courtesy of Graphics Gems, pp. 548-550 - // - // This works for projection matrices as well as simple affine - // transformations. Coordinates of the box are rehomogenized if there - // is a projection matrix - - // a transformed empty box is still empty - if (box.isEmpty()) - return box; - - // If the last column is close enuf to ( 0 0 0 1 ) then we use the - // fast, affine version. The tricky affine method could maybe be - // extended to deal with the projection case as well, but its not - // worth it right now. - - if (m[0][3] * m[0][3] + m[1][3] * m[1][3] + m[2][3] * m[2][3] - + (1.0 - m[3][3]) * (1.0 - m[3][3]) < 0.00001) - { - // Affine version, use the Graphics Gems hack - int i, j; - Box< Vec3 > newBox; - - for (i = 0; i < 3; i++) - { - newBox.min[i] = newBox.max[i] = (S) m[3][i]; - - for (j = 0; j < 3; j++) - { - float a, b; - - a = (S) m[j][i] * box.min[j]; - b = (S) m[j][i] * box.max[j]; - - if (a < b) - { - newBox.min[i] += a; - newBox.max[i] += b; - } - else - { - newBox.min[i] += b; - newBox.max[i] += a; - } - } - } - - return newBox; - } - - // This is a projection matrix. Do things the naive way. - Vec3 points[8]; - - /* Set up the eight points at the corners of the extent */ - points[0][0] = points[1][0] = points[2][0] = points[3][0] = box.min[0]; - points[4][0] = points[5][0] = points[6][0] = points[7][0] = box.max[0]; - - points[0][1] = points[1][1] = points[4][1] = points[5][1] = box.min[1]; - points[2][1] = points[3][1] = points[6][1] = points[7][1] = box.max[1]; - - points[0][2] = points[2][2] = points[4][2] = points[6][2] = box.min[2]; - points[1][2] = points[3][2] = points[5][2] = points[7][2] = box.max[2]; - - Box< Vec3 > newBox; - for (int i = 0; i < 8; i++) - newBox.extendBy(points[i] * m); - - return newBox; -} - -template -Box< Vec3 > -affineTransform(const Box< Vec3 > &bbox, const Matrix44 &M) -{ - float min0, max0, min1, max1, min2, max2, a, b; - float min0new, max0new, min1new, max1new, min2new, max2new; - - min0 = bbox.min[0]; - max0 = bbox.max[0]; - min1 = bbox.min[1]; - max1 = bbox.max[1]; - min2 = bbox.min[2]; - max2 = bbox.max[2]; - - min0new = max0new = M[3][0]; - a = M[0][0] * min0; - b = M[0][0] * max0; - if (a < b) { - min0new += a; - max0new += b; - } else { - min0new += b; - max0new += a; - } - a = M[1][0] * min1; - b = M[1][0] * max1; - if (a < b) { - min0new += a; - max0new += b; - } else { - min0new += b; - max0new += a; - } - a = M[2][0] * min2; - b = M[2][0] * max2; - if (a < b) { - min0new += a; - max0new += b; - } else { - min0new += b; - max0new += a; - } - - min1new = max1new = M[3][1]; - a = M[0][1] * min0; - b = M[0][1] * max0; - if (a < b) { - min1new += a; - max1new += b; - } else { - min1new += b; - max1new += a; - } - a = M[1][1] * min1; - b = M[1][1] * max1; - if (a < b) { - min1new += a; - max1new += b; - } else { - min1new += b; - max1new += a; - } - a = M[2][1] * min2; - b = M[2][1] * max2; - if (a < b) { - min1new += a; - max1new += b; - } else { - min1new += b; - max1new += a; - } - - min2new = max2new = M[3][2]; - a = M[0][2] * min0; - b = M[0][2] * max0; - if (a < b) { - min2new += a; - max2new += b; - } else { - min2new += b; - max2new += a; - } - a = M[1][2] * min1; - b = M[1][2] * max1; - if (a < b) { - min2new += a; - max2new += b; - } else { - min2new += b; - max2new += a; - } - a = M[2][2] * min2; - b = M[2][2] * max2; - if (a < b) { - min2new += a; - max2new += b; - } else { - min2new += b; - max2new += a; - } - - Box< Vec3 > xbbox; - - xbbox.min[0] = min0new; - xbbox.max[0] = max0new; - xbbox.min[1] = min1new; - xbbox.max[1] = max1new; - xbbox.min[2] = min2new; - xbbox.max[2] = max2new; - - return xbbox; -} - - -template -bool findEntryAndExitPoints(const Line3& line, - const Box >& box, - Vec3 &enterPoint, - Vec3 &exitPoint) -{ - if ( box.isEmpty() ) return false; - if ( line.distanceTo(box.center()) > box.size().length()/2. ) return false; - - Vec3 points[8], inter, bary; - Plane3 plane; - int i, v0, v1, v2; - bool front = false, valid, validIntersection = false; - - // set up the eight coords of the corners of the box - for(i = 0; i < 8; i++) - { - points[i].setValue( i & 01 ? box.min[0] : box.max[0], - i & 02 ? box.min[1] : box.max[1], - i & 04 ? box.min[2] : box.max[2]); - } - - // intersect the 12 triangles. - for(i = 0; i < 12; i++) - { - switch(i) - { - case 0: v0 = 2; v1 = 1; v2 = 0; break; // +z - case 1: v0 = 2; v1 = 3; v2 = 1; break; - - case 2: v0 = 4; v1 = 5; v2 = 6; break; // -z - case 3: v0 = 6; v1 = 5; v2 = 7; break; - - case 4: v0 = 0; v1 = 6; v2 = 2; break; // -x - case 5: v0 = 0; v1 = 4; v2 = 6; break; - - case 6: v0 = 1; v1 = 3; v2 = 7; break; // +x - case 7: v0 = 1; v1 = 7; v2 = 5; break; - - case 8: v0 = 1; v1 = 4; v2 = 0; break; // -y - case 9: v0 = 1; v1 = 5; v2 = 4; break; - - case 10: v0 = 2; v1 = 7; v2 = 3; break; // +y - case 11: v0 = 2; v1 = 6; v2 = 7; break; - } - if((valid=intersect (line, points[v0], points[v1], points[v2], - inter, bary, front)) == true) - { - if(front == true) - { - enterPoint = inter; - validIntersection = valid; - } - else - { - exitPoint = inter; - validIntersection = valid; - } - } - } - return validIntersection; -} - -template -bool intersects(const Box< Vec3 > &box, - const Line3 &line, - Vec3 &result) -{ - /* - Fast Ray-Box Intersection - by Andrew Woo - from "Graphics Gems", Academic Press, 1990 - */ - - const int right = 0; - const int left = 1; - const int middle = 2; - - const Vec3 &minB = box.min; - const Vec3 &maxB = box.max; - const Vec3 &origin = line.pos; - const Vec3 &dir = line.dir; - - bool inside = true; - char quadrant[3]; - int whichPlane; - float maxT[3]; - float candidatePlane[3]; - - /* Find candidate planes; this loop can be avoided if - rays cast all from the eye(assume perpsective view) */ - for (int i=0; i<3; i++) - { - if(origin[i] < minB[i]) - { - quadrant[i] = left; - candidatePlane[i] = minB[i]; - inside = false; - } - else if (origin[i] > maxB[i]) - { - quadrant[i] = right; - candidatePlane[i] = maxB[i]; - inside = false; - } - else - { - quadrant[i] = middle; - } - } - - /* Ray origin inside bounding box */ - if ( inside ) - { - result = origin; - return true; - } - - - /* Calculate T distances to candidate planes */ - for (int i = 0; i < 3; i++) - { - if (quadrant[i] != middle && dir[i] !=0.) - { - maxT[i] = (candidatePlane[i]-origin[i]) / dir[i]; - } - else - { - maxT[i] = -1.; - } - } - - /* Get largest of the maxT's for final choice of intersection */ - whichPlane = 0; - - for (int i = 1; i < 3; i++) - { - if (maxT[whichPlane] < maxT[i]) - { - whichPlane = i; - } - } - - /* Check final candidate actually inside box */ - if (maxT[whichPlane] < 0.) return false; - - for (int i = 0; i < 3; i++) - { - if (whichPlane != i) - { - result[i] = origin[i] + maxT[whichPlane] *dir[i]; - - if ((quadrant[i] == right && result[i] < minB[i]) || - (quadrant[i] == left && result[i] > maxB[i])) - { - return false; /* outside box */ - } - } - else - { - result[i] = candidatePlane[i]; - } - } - - return true; -} - -template -bool intersects(const Box< Vec3 > &box, const Line3 &line) -{ - Vec3 ignored; - return intersects(box,line,ignored); -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathColor.h b/3rdparty/include/OpenEXR/ImathColor.h deleted file mode 100644 index 605f10b598..0000000000 --- a/3rdparty/include/OpenEXR/ImathColor.h +++ /dev/null @@ -1,734 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHCOLOR_H -#define INCLUDED_IMATHCOLOR_H - -//---------------------------------------------------- -// -// A three and four component color class template. -// -//---------------------------------------------------- - -#include "ImathVec.h" -#include "half.h" - -namespace Imath { - - -template -class Color3: public Vec3 -{ - public: - - //------------- - // Constructors - //------------- - - Color3 (); // no initialization - explicit Color3 (T a); // (a a a) - Color3 (T a, T b, T c); // (a b c) - - - //--------------------------------- - // Copy constructors and assignment - //--------------------------------- - - Color3 (const Color3 &c); - template Color3 (const Vec3 &v); - - const Color3 & operator = (const Color3 &c); - - - //------------------------ - // Component-wise addition - //------------------------ - - const Color3 & operator += (const Color3 &c); - Color3 operator + (const Color3 &c) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Color3 & operator -= (const Color3 &c); - Color3 operator - (const Color3 &c) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Color3 operator - () const; - const Color3 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Color3 & operator *= (const Color3 &c); - const Color3 & operator *= (T a); - Color3 operator * (const Color3 &c) const; - Color3 operator * (T a) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Color3 & operator /= (const Color3 &c); - const Color3 & operator /= (T a); - Color3 operator / (const Color3 &c) const; - Color3 operator / (T a) const; -}; - -template class Color4 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T r, g, b, a; - - T & operator [] (int i); - const T & operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Color4 (); // no initialization - explicit Color4 (T a); // (a a a a) - Color4 (T a, T b, T c, T d); // (a b c d) - - - //--------------------------------- - // Copy constructors and assignment - //--------------------------------- - - Color4 (const Color4 &v); - template Color4 (const Color4 &v); - - const Color4 & operator = (const Color4 &v); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - template - void setValue (S a, S b, S c, S d); - - template - void setValue (const Color4 &v); - - template - void getValue (S &a, S &b, S &c, S &d) const; - - template - void getValue (Color4 &v) const; - - T * getValue(); - const T * getValue() const; - - - //--------- - // Equality - //--------- - - template - bool operator == (const Color4 &v) const; - - template - bool operator != (const Color4 &v) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Color4 & operator += (const Color4 &v); - Color4 operator + (const Color4 &v) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Color4 & operator -= (const Color4 &v); - Color4 operator - (const Color4 &v) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Color4 operator - () const; - const Color4 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Color4 & operator *= (const Color4 &v); - const Color4 & operator *= (T a); - Color4 operator * (const Color4 &v) const; - Color4 operator * (T a) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Color4 & operator /= (const Color4 &v); - const Color4 & operator /= (T a); - Color4 operator / (const Color4 &v) const; - Color4 operator / (T a) const; - - - //---------------------------------------------------------- - // Number of dimensions, i.e. number of elements in a Color4 - //---------------------------------------------------------- - - static unsigned int dimensions() {return 4;} - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} - - - //-------------------------------------------------------------- - // Base type -- in templates, which accept a parameter, V, which - // could be a Color4, you can refer to T as - // V::BaseType - //-------------------------------------------------------------- - - typedef T BaseType; -}; - -//-------------- -// Stream output -//-------------- - -template -std::ostream & operator << (std::ostream &s, const Color4 &v); - -//---------------------------------------------------- -// Reverse multiplication: S * Color4 -//---------------------------------------------------- - -template Color4 operator * (S a, const Color4 &v); - -//------------------------- -// Typedefs for convenience -//------------------------- - -typedef Color3 Color3f; -typedef Color3 Color3h; -typedef Color3 Color3c; -typedef Color3 C3h; -typedef Color3 C3f; -typedef Color3 C3c; -typedef Color4 Color4f; -typedef Color4 Color4h; -typedef Color4 Color4c; -typedef Color4 C4f; -typedef Color4 C4h; -typedef Color4 C4c; -typedef unsigned int PackedColor; - - -//------------------------- -// Implementation of Color3 -//------------------------- - -template -inline -Color3::Color3 (): Vec3 () -{ - // empty -} - -template -inline -Color3::Color3 (T a): Vec3 (a) -{ - // empty -} - -template -inline -Color3::Color3 (T a, T b, T c): Vec3 (a, b, c) -{ - // empty -} - -template -inline -Color3::Color3 (const Color3 &c): Vec3 (c) -{ - // empty -} - -template -template -inline -Color3::Color3 (const Vec3 &v): Vec3 (v) -{ - //empty -} - -template -inline const Color3 & -Color3::operator = (const Color3 &c) -{ - *((Vec3 *) this) = c; - return *this; -} - -template -inline const Color3 & -Color3::operator += (const Color3 &c) -{ - *((Vec3 *) this) += c; - return *this; -} - -template -inline Color3 -Color3::operator + (const Color3 &c) const -{ - return Color3 (*(Vec3 *)this + (const Vec3 &)c); -} - -template -inline const Color3 & -Color3::operator -= (const Color3 &c) -{ - *((Vec3 *) this) -= c; - return *this; -} - -template -inline Color3 -Color3::operator - (const Color3 &c) const -{ - return Color3 (*(Vec3 *)this - (const Vec3 &)c); -} - -template -inline Color3 -Color3::operator - () const -{ - return Color3 (-(*(Vec3 *)this)); -} - -template -inline const Color3 & -Color3::negate () -{ - ((Vec3 *) this)->negate(); - return *this; -} - -template -inline const Color3 & -Color3::operator *= (const Color3 &c) -{ - *((Vec3 *) this) *= c; - return *this; -} - -template -inline const Color3 & -Color3::operator *= (T a) -{ - *((Vec3 *) this) *= a; - return *this; -} - -template -inline Color3 -Color3::operator * (const Color3 &c) const -{ - return Color3 (*(Vec3 *)this * (const Vec3 &)c); -} - -template -inline Color3 -Color3::operator * (T a) const -{ - return Color3 (*(Vec3 *)this * a); -} - -template -inline const Color3 & -Color3::operator /= (const Color3 &c) -{ - *((Vec3 *) this) /= c; - return *this; -} - -template -inline const Color3 & -Color3::operator /= (T a) -{ - *((Vec3 *) this) /= a; - return *this; -} - -template -inline Color3 -Color3::operator / (const Color3 &c) const -{ - return Color3 (*(Vec3 *)this / (const Vec3 &)c); -} - -template -inline Color3 -Color3::operator / (T a) const -{ - return Color3 (*(Vec3 *)this / a); -} - -//----------------------- -// Implementation of Color4 -//----------------------- - -template -inline T & -Color4::operator [] (int i) -{ - return (&r)[i]; -} - -template -inline const T & -Color4::operator [] (int i) const -{ - return (&r)[i]; -} - -template -inline -Color4::Color4 () -{ - // empty -} - -template -inline -Color4::Color4 (T x) -{ - r = g = b = a = x; -} - -template -inline -Color4::Color4 (T x, T y, T z, T w) -{ - r = x; - g = y; - b = z; - a = w; -} - -template -inline -Color4::Color4 (const Color4 &v) -{ - r = v.r; - g = v.g; - b = v.b; - a = v.a; -} - -template -template -inline -Color4::Color4 (const Color4 &v) -{ - r = T (v.r); - g = T (v.g); - b = T (v.b); - a = T (v.a); -} - -template -inline const Color4 & -Color4::operator = (const Color4 &v) -{ - r = v.r; - g = v.g; - b = v.b; - a = v.a; - return *this; -} - -template -template -inline void -Color4::setValue (S x, S y, S z, S w) -{ - r = T (x); - g = T (y); - b = T (z); - a = T (w); -} - -template -template -inline void -Color4::setValue (const Color4 &v) -{ - r = T (v.r); - g = T (v.g); - b = T (v.b); - a = T (v.a); -} - -template -template -inline void -Color4::getValue (S &x, S &y, S &z, S &w) const -{ - x = S (r); - y = S (g); - z = S (b); - w = S (a); -} - -template -template -inline void -Color4::getValue (Color4 &v) const -{ - v.r = S (r); - v.g = S (g); - v.b = S (b); - v.a = S (a); -} - -template -inline T * -Color4::getValue() -{ - return (T *) &r; -} - -template -inline const T * -Color4::getValue() const -{ - return (const T *) &r; -} - -template -template -inline bool -Color4::operator == (const Color4 &v) const -{ - return r == v.r && g == v.g && b == v.b && a == v.a; -} - -template -template -inline bool -Color4::operator != (const Color4 &v) const -{ - return r != v.r || g != v.g || b != v.b || a != v.a; -} - -template -inline const Color4 & -Color4::operator += (const Color4 &v) -{ - r += v.r; - g += v.g; - b += v.b; - a += v.a; - return *this; -} - -template -inline Color4 -Color4::operator + (const Color4 &v) const -{ - return Color4 (r + v.r, g + v.g, b + v.b, a + v.a); -} - -template -inline const Color4 & -Color4::operator -= (const Color4 &v) -{ - r -= v.r; - g -= v.g; - b -= v.b; - a -= v.a; - return *this; -} - -template -inline Color4 -Color4::operator - (const Color4 &v) const -{ - return Color4 (r - v.r, g - v.g, b - v.b, a - v.a); -} - -template -inline Color4 -Color4::operator - () const -{ - return Color4 (-r, -g, -b, -a); -} - -template -inline const Color4 & -Color4::negate () -{ - r = -r; - g = -g; - b = -b; - a = -a; - return *this; -} - -template -inline const Color4 & -Color4::operator *= (const Color4 &v) -{ - r *= v.r; - g *= v.g; - b *= v.b; - a *= v.a; - return *this; -} - -template -inline const Color4 & -Color4::operator *= (T x) -{ - r *= x; - g *= x; - b *= x; - a *= x; - return *this; -} - -template -inline Color4 -Color4::operator * (const Color4 &v) const -{ - return Color4 (r * v.r, g * v.g, b * v.b, a * v.a); -} - -template -inline Color4 -Color4::operator * (T x) const -{ - return Color4 (r * x, g * x, b * x, a * x); -} - -template -inline const Color4 & -Color4::operator /= (const Color4 &v) -{ - r /= v.r; - g /= v.g; - b /= v.b; - a /= v.a; - return *this; -} - -template -inline const Color4 & -Color4::operator /= (T x) -{ - r /= x; - g /= x; - b /= x; - a /= x; - return *this; -} - -template -inline Color4 -Color4::operator / (const Color4 &v) const -{ - return Color4 (r / v.r, g / v.g, b / v.b, a / v.a); -} - -template -inline Color4 -Color4::operator / (T x) const -{ - return Color4 (r / x, g / x, b / x, a / x); -} - - -template -std::ostream & -operator << (std::ostream &s, const Color4 &v) -{ - return s << '(' << v.r << ' ' << v.g << ' ' << v.b << ' ' << v.a << ')'; -} - -//----------------------------------------- -// Implementation of reverse multiplication -//----------------------------------------- - -template -inline Color4 -operator * (S x, const Color4 &v) -{ - return Color4 (x * v.r, x * v.g, x * v.b, x * v.a); -} - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathColorAlgo.h b/3rdparty/include/OpenEXR/ImathColorAlgo.h deleted file mode 100644 index bd4652abae..0000000000 --- a/3rdparty/include/OpenEXR/ImathColorAlgo.h +++ /dev/null @@ -1,256 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHCOLORALGO_H -#define INCLUDED_IMATHCOLORALGO_H - - -#include "ImathColor.h" -#include "ImathMath.h" -#include "ImathLimits.h" - -namespace Imath { - - -// -// Non-templated helper routines for color conversion. -// These routines eliminate type warnings under g++. -// - -Vec3 hsv2rgb_d(const Vec3 &hsv); - -Color4 hsv2rgb_d(const Color4 &hsv); - - -Vec3 rgb2hsv_d(const Vec3 &rgb); - -Color4 rgb2hsv_d(const Color4 &rgb); - - -// -// Color conversion functions and general color algorithms -// -// hsv2rgb(), rgb2hsv(), rgb2packed(), packed2rgb() -// see each funtion definition for details. -// - -template -Vec3 -hsv2rgb(const Vec3 &hsv) -{ - if ( limits::isIntegral() ) - { - Vec3 v = Vec3(hsv.x / double(limits::max()), - hsv.y / double(limits::max()), - hsv.z / double(limits::max())); - Vec3 c = hsv2rgb_d(v); - return Vec3((T) (c.x * limits::max()), - (T) (c.y * limits::max()), - (T) (c.z * limits::max())); - } - else - { - Vec3 v = Vec3(hsv.x, hsv.y, hsv.z); - Vec3 c = hsv2rgb_d(v); - return Vec3((T) c.x, (T) c.y, (T) c.z); - } -} - - -template -Color4 -hsv2rgb(const Color4 &hsv) -{ - if ( limits::isIntegral() ) - { - Color4 v = Color4(hsv.r / float(limits::max()), - hsv.g / float(limits::max()), - hsv.b / float(limits::max()), - hsv.a / float(limits::max())); - Color4 c = hsv2rgb_d(v); - return Color4((T) (c.r * limits::max()), - (T) (c.g * limits::max()), - (T) (c.b * limits::max()), - (T) (c.a * limits::max())); - } - else - { - Color4 v = Color4(hsv.r, hsv.g, hsv.g, hsv.a); - Color4 c = hsv2rgb_d(v); - return Color4((T) c.r, (T) c.g, (T) c.b, (T) c.a); - } -} - - -template -Vec3 -rgb2hsv(const Vec3 &rgb) -{ - if ( limits::isIntegral() ) - { - Vec3 v = Vec3(rgb.x / double(limits::max()), - rgb.y / double(limits::max()), - rgb.z / double(limits::max())); - Vec3 c = rgb2hsv_d(v); - return Vec3((T) (c.x * limits::max()), - (T) (c.y * limits::max()), - (T) (c.z * limits::max())); - } - else - { - Vec3 v = Vec3(rgb.x, rgb.y, rgb.z); - Vec3 c = rgb2hsv_d(v); - return Vec3((T) c.x, (T) c.y, (T) c.z); - } -} - - -template -Color4 -rgb2hsv(const Color4 &rgb) -{ - if ( limits::isIntegral() ) - { - Color4 v = Color4(rgb.r / float(limits::max()), - rgb.g / float(limits::max()), - rgb.b / float(limits::max()), - rgb.a / float(limits::max())); - Color4 c = rgb2hsv_d(v); - return Color4((T) (c.r * limits::max()), - (T) (c.g * limits::max()), - (T) (c.b * limits::max()), - (T) (c.a * limits::max())); - } - else - { - Color4 v = Color4(rgb.r, rgb.g, rgb.g, rgb.a); - Color4 c = rgb2hsv_d(v); - return Color4((T) c.r, (T) c.g, (T) c.b, (T) c.a); - } -} - -template -PackedColor -rgb2packed(const Vec3 &c) -{ - if ( limits::isIntegral() ) - { - float x = c.x / float(limits::max()); - float y = c.y / float(limits::max()); - float z = c.z / float(limits::max()); - return rgb2packed( V3f(x,y,z) ); - } - else - { - return ( (PackedColor) (c.x * 255) | - (((PackedColor) (c.y * 255)) << 8) | - (((PackedColor) (c.z * 255)) << 16) | 0xFF000000 ); - } -} - -template -PackedColor -rgb2packed(const Color4 &c) -{ - if ( limits::isIntegral() ) - { - float r = c.r / float(limits::max()); - float g = c.g / float(limits::max()); - float b = c.b / float(limits::max()); - float a = c.a / float(limits::max()); - return rgb2packed( C4f(r,g,b,a) ); - } - else - { - return ( (PackedColor) (c.r * 255) | - (((PackedColor) (c.g * 255)) << 8) | - (((PackedColor) (c.b * 255)) << 16) | - (((PackedColor) (c.a * 255)) << 24)); - } -} - -// -// This guy can't return the result because the template -// parameter would not be in the function signiture. So instead, -// its passed in as an argument. -// - -template -void -packed2rgb(PackedColor packed, Vec3 &out) -{ - if ( limits::isIntegral() ) - { - T f = limits::max() / ((PackedColor)0xFF); - out.x = (packed & 0xFF) * f; - out.y = ((packed & 0xFF00) >> 8) * f; - out.z = ((packed & 0xFF0000) >> 16) * f; - } - else - { - T f = T(1) / T(255); - out.x = (packed & 0xFF) * f; - out.y = ((packed & 0xFF00) >> 8) * f; - out.z = ((packed & 0xFF0000) >> 16) * f; - } -} - -template -void -packed2rgb(PackedColor packed, Color4 &out) -{ - if ( limits::isIntegral() ) - { - T f = limits::max() / ((PackedColor)0xFF); - out.r = (packed & 0xFF) * f; - out.g = ((packed & 0xFF00) >> 8) * f; - out.b = ((packed & 0xFF0000) >> 16) * f; - out.a = ((packed & 0xFF000000) >> 24) * f; - } - else - { - T f = T(1) / T(255); - out.r = (packed & 0xFF) * f; - out.g = ((packed & 0xFF00) >> 8) * f; - out.b = ((packed & 0xFF0000) >> 16) * f; - out.a = ((packed & 0xFF000000) >> 24) * f; - } -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathEuler.h b/3rdparty/include/OpenEXR/ImathEuler.h deleted file mode 100644 index 8d29454cee..0000000000 --- a/3rdparty/include/OpenEXR/ImathEuler.h +++ /dev/null @@ -1,903 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHEULER_H -#define INCLUDED_IMATHEULER_H - -//---------------------------------------------------------------------- -// -// template class Euler -// -// This class represents euler angle orientations. The class -// inherits from Vec3 to it can be freely cast. The additional -// information is the euler priorities rep. This class is -// essentially a rip off of Ken Shoemake's GemsIV code. It has -// been modified minimally to make it more understandable, but -// hardly enough to make it easy to grok completely. -// -// There are 24 possible combonations of Euler angle -// representations of which 12 are common in CG and you will -// probably only use 6 of these which in this scheme are the -// non-relative-non-repeating types. -// -// The representations can be partitioned according to two -// criteria: -// -// 1) Are the angles measured relative to a set of fixed axis -// or relative to each other (the latter being what happens -// when rotation matrices are multiplied together and is -// almost ubiquitous in the cg community) -// -// 2) Is one of the rotations repeated (ala XYX rotation) -// -// When you construct a given representation from scratch you -// must order the angles according to their priorities. So, the -// easiest is a softimage or aerospace (yaw/pitch/roll) ordering -// of ZYX. -// -// float x_rot = 1; -// float y_rot = 2; -// float z_rot = 3; -// -// Eulerf angles(z_rot, y_rot, x_rot, Eulerf::ZYX); -// -or- -// Eulerf angles( V3f(z_rot,y_rot,z_rot), Eulerf::ZYX ); -// -// If instead, the order was YXZ for instance you would have to -// do this: -// -// float x_rot = 1; -// float y_rot = 2; -// float z_rot = 3; -// -// Eulerf angles(y_rot, x_rot, z_rot, Eulerf::YXZ); -// -or- -// Eulerf angles( V3f(y_rot,x_rot,z_rot), Eulerf::YXZ ); -// -// Notice how the order you put the angles into the three slots -// should correspond to the enum (YXZ) ordering. The input angle -// vector is called the "ijk" vector -- not an "xyz" vector. The -// ijk vector order is the same as the enum. If you treat the -// Euler<> as a Vec<> (which it inherts from) you will find the -// angles are ordered in the same way, i.e.: -// -// V3f v = angles; -// // v.x == y_rot, v.y == x_rot, v.z == z_rot -// -// If you just want the x, y, and z angles stored in a vector in -// that order, you can do this: -// -// V3f v = angles.toXYZVector() -// // v.x == x_rot, v.y == y_rot, v.z == z_rot -// -// If you want to set the Euler with an XYZVector use the -// optional layout argument: -// -// Eulerf angles(x_rot, y_rot, z_rot, -// Eulerf::YXZ, -// Eulerf::XYZLayout); -// -// This is the same as: -// -// Eulerf angles(y_rot, x_rot, z_rot, Eulerf::YXZ); -// -// Note that this won't do anything intelligent if you have a -// repeated axis in the euler angles (e.g. XYX) -// -// If you need to use the "relative" versions of these, you will -// need to use the "r" enums. -// -// The units of the rotation angles are assumed to be radians. -// -//---------------------------------------------------------------------- - - -#include "ImathMath.h" -#include "ImathVec.h" -#include "ImathQuat.h" -#include "ImathMatrix.h" -#include "ImathLimits.h" -#include - -namespace Imath { - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -// Disable MS VC++ warnings about conversion from double to float -#pragma warning(disable:4244) -#endif - -template -class Euler : public Vec3 -{ - public: - - using Vec3::x; - using Vec3::y; - using Vec3::z; - - enum Order - { - // - // All 24 possible orderings - // - - XYZ = 0x0101, // "usual" orderings - XZY = 0x0001, - YZX = 0x1101, - YXZ = 0x1001, - ZXY = 0x2101, - ZYX = 0x2001, - - XZX = 0x0011, // first axis repeated - XYX = 0x0111, - YXY = 0x1011, - YZY = 0x1111, - ZYZ = 0x2011, - ZXZ = 0x2111, - - XYZr = 0x2000, // relative orderings -- not common - XZYr = 0x2100, - YZXr = 0x1000, - YXZr = 0x1100, - ZXYr = 0x0000, - ZYXr = 0x0100, - - XZXr = 0x2110, // relative first axis repeated - XYXr = 0x2010, - YXYr = 0x1110, - YZYr = 0x1010, - ZYZr = 0x0110, - ZXZr = 0x0010, - // |||| - // VVVV - // Legend: ABCD - // A -> Initial Axis (0==x, 1==y, 2==z) - // B -> Parity Even (1==true) - // C -> Initial Repeated (1==true) - // D -> Frame Static (1==true) - // - - Legal = XYZ | XZY | YZX | YXZ | ZXY | ZYX | - XZX | XYX | YXY | YZY | ZYZ | ZXZ | - XYZr| XZYr| YZXr| YXZr| ZXYr| ZYXr| - XZXr| XYXr| YXYr| YZYr| ZYZr| ZXZr, - - Min = 0x0000, - Max = 0x2111, - Default = XYZ - }; - - enum Axis { X = 0, Y = 1, Z = 2 }; - - enum InputLayout { XYZLayout, IJKLayout }; - - //---------------------------------------------------------------- - // Constructors -- all default to ZYX non-relative ala softimage - // (where there is no argument to specify it) - //---------------------------------------------------------------- - - Euler(); - Euler(const Euler&); - Euler(Order p); - Euler(const Vec3 &v, Order o = Default, InputLayout l = IJKLayout); - Euler(T i, T j, T k, Order o = Default, InputLayout l = IJKLayout); - Euler(const Euler &euler, Order newp); - Euler(const Matrix33 &, Order o = Default); - Euler(const Matrix44 &, Order o = Default); - - //--------------------------------- - // Algebraic functions/ Operators - //--------------------------------- - - const Euler& operator= (const Euler&); - const Euler& operator= (const Vec3&); - - //-------------------------------------------------------- - // Set the euler value - // This does NOT convert the angles, but setXYZVector() - // does reorder the input vector. - //-------------------------------------------------------- - - static bool legal(Order); - - void setXYZVector(const Vec3 &); - - Order order() const; - void setOrder(Order); - - void set(Axis initial, - bool relative, - bool parityEven, - bool firstRepeats); - - //--------------------------------------------------------- - // Conversions, toXYZVector() reorders the angles so that - // the X rotation comes first, followed by the Y and Z - // in cases like XYX ordering, the repeated angle will be - // in the "z" component - //--------------------------------------------------------- - - void extract(const Matrix33&); - void extract(const Matrix44&); - void extract(const Quat&); - - Matrix33 toMatrix33() const; - Matrix44 toMatrix44() const; - Quat toQuat() const; - Vec3 toXYZVector() const; - - //--------------------------------------------------- - // Use this function to unpack angles from ijk form - //--------------------------------------------------- - - void angleOrder(int &i, int &j, int &k) const; - - //--------------------------------------------------- - // Use this function to determine mapping from xyz to ijk - // - reshuffles the xyz to match the order - //--------------------------------------------------- - - void angleMapping(int &i, int &j, int &k) const; - - //---------------------------------------------------------------------- - // - // Utility methods for getting continuous rotations. None of these - // methods change the orientation given by its inputs (or at least - // that is the intent). - // - // angleMod() converts an angle to its equivalent in [-PI, PI] - // - // simpleXYZRotation() adjusts xyzRot so that its components differ - // from targetXyzRot by no more than +-PI - // - // nearestRotation() adjusts xyzRot so that its components differ - // from targetXyzRot by as little as possible. - // Note that xyz here really means ijk, because - // the order must be provided. - // - // makeNear() adjusts "this" Euler so that its components differ - // from target by as little as possible. This method - // might not make sense for Eulers with different order - // and it probably doesn't work for repeated axis and - // relative orderings (TODO). - // - //----------------------------------------------------------------------- - - static float angleMod (T angle); - static void simpleXYZRotation (Vec3 &xyzRot, - const Vec3 &targetXyzRot); - static void nearestRotation (Vec3 &xyzRot, - const Vec3 &targetXyzRot, - Order order = XYZ); - - void makeNear (const Euler &target); - - bool frameStatic() const { return _frameStatic; } - bool initialRepeated() const { return _initialRepeated; } - bool parityEven() const { return _parityEven; } - Axis initialAxis() const { return _initialAxis; } - - protected: - - bool _frameStatic : 1; // relative or static rotations - bool _initialRepeated : 1; // init axis repeated as last - bool _parityEven : 1; // "parity of axis permutation" -#if defined _WIN32 || defined _WIN64 - Axis _initialAxis ; // First axis of rotation -#else - Axis _initialAxis : 2; // First axis of rotation -#endif -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - -typedef Euler Eulerf; -typedef Euler Eulerd; - - -//--------------- -// Implementation -//--------------- - -template -inline void - Euler::angleOrder(int &i, int &j, int &k) const -{ - i = _initialAxis; - j = _parityEven ? (i+1)%3 : (i > 0 ? i-1 : 2); - k = _parityEven ? (i > 0 ? i-1 : 2) : (i+1)%3; -} - -template -inline void - Euler::angleMapping(int &i, int &j, int &k) const -{ - int m[3]; - - m[_initialAxis] = 0; - m[(_initialAxis+1) % 3] = _parityEven ? 1 : 2; - m[(_initialAxis+2) % 3] = _parityEven ? 2 : 1; - i = m[0]; - j = m[1]; - k = m[2]; -} - -template -inline void -Euler::setXYZVector(const Vec3 &v) -{ - int i,j,k; - angleMapping(i,j,k); - (*this)[i] = v.x; - (*this)[j] = v.y; - (*this)[k] = v.z; -} - -template -inline Vec3 -Euler::toXYZVector() const -{ - int i,j,k; - angleMapping(i,j,k); - return Vec3((*this)[i],(*this)[j],(*this)[k]); -} - - -template -Euler::Euler() : - Vec3(0,0,0), - _frameStatic(true), - _initialRepeated(false), - _parityEven(true), - _initialAxis(X) -{} - -template -Euler::Euler(typename Euler::Order p) : - Vec3(0,0,0), - _frameStatic(true), - _initialRepeated(false), - _parityEven(true), - _initialAxis(X) -{ - setOrder(p); -} - -template -inline Euler::Euler( const Vec3 &v, - typename Euler::Order p, - typename Euler::InputLayout l ) -{ - setOrder(p); - if ( l == XYZLayout ) setXYZVector(v); - else { x = v.x; y = v.y; z = v.z; } -} - -template -inline Euler::Euler(const Euler &euler) -{ - operator=(euler); -} - -template -inline Euler::Euler(const Euler &euler,Order p) -{ - setOrder(p); - Matrix33 M = euler.toMatrix33(); - extract(M); -} - -template -inline Euler::Euler( T xi, T yi, T zi, - typename Euler::Order p, - typename Euler::InputLayout l) -{ - setOrder(p); - if ( l == XYZLayout ) setXYZVector(Vec3(xi,yi,zi)); - else { x = xi; y = yi; z = zi; } -} - -template -inline Euler::Euler( const Matrix33 &M, typename Euler::Order p ) -{ - setOrder(p); - extract(M); -} - -template -inline Euler::Euler( const Matrix44 &M, typename Euler::Order p ) -{ - setOrder(p); - extract(M); -} - -template -inline void Euler::extract(const Quat &q) -{ - extract(q.toMatrix33()); -} - -template -void Euler::extract(const Matrix33 &M) -{ - int i,j,k; - angleOrder(i,j,k); - - if (_initialRepeated) - { - // - // Extract the first angle, x. - // - - x = Math::atan2 (M[j][i], M[k][i]); - - // - // Remove the x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Vec3 r (0, 0, 0); - r[i] = (_parityEven? -x: x); - - Matrix44 N; - N.rotate (r); - - N = N * Matrix44 (M[0][0], M[0][1], M[0][2], 0, - M[1][0], M[1][1], M[1][2], 0, - M[2][0], M[2][1], M[2][2], 0, - 0, 0, 0, 1); - // - // Extract the other two angles, y and z, from N. - // - - T sy = Math::sqrt (N[j][i]*N[j][i] + N[k][i]*N[k][i]); - y = Math::atan2 (sy, N[i][i]); - z = Math::atan2 (N[j][k], N[j][j]); - } - else - { - // - // Extract the first angle, x. - // - - x = Math::atan2 (M[j][k], M[k][k]); - - // - // Remove the x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Vec3 r (0, 0, 0); - r[i] = (_parityEven? -x: x); - - Matrix44 N; - N.rotate (r); - - N = N * Matrix44 (M[0][0], M[0][1], M[0][2], 0, - M[1][0], M[1][1], M[1][2], 0, - M[2][0], M[2][1], M[2][2], 0, - 0, 0, 0, 1); - // - // Extract the other two angles, y and z, from N. - // - - T cy = Math::sqrt (N[i][i]*N[i][i] + N[i][j]*N[i][j]); - y = Math::atan2 (-N[i][k], cy); - z = Math::atan2 (-N[j][i], N[j][j]); - } - - if (!_parityEven) - *this *= -1; - - if (!_frameStatic) - { - T t = x; - x = z; - z = t; - } -} - -template -void Euler::extract(const Matrix44 &M) -{ - int i,j,k; - angleOrder(i,j,k); - - if (_initialRepeated) - { - // - // Extract the first angle, x. - // - - x = Math::atan2 (M[j][i], M[k][i]); - - // - // Remove the x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Vec3 r (0, 0, 0); - r[i] = (_parityEven? -x: x); - - Matrix44 N; - N.rotate (r); - N = N * M; - - // - // Extract the other two angles, y and z, from N. - // - - T sy = Math::sqrt (N[j][i]*N[j][i] + N[k][i]*N[k][i]); - y = Math::atan2 (sy, N[i][i]); - z = Math::atan2 (N[j][k], N[j][j]); - } - else - { - // - // Extract the first angle, x. - // - - x = Math::atan2 (M[j][k], M[k][k]); - - // - // Remove the x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Vec3 r (0, 0, 0); - r[i] = (_parityEven? -x: x); - - Matrix44 N; - N.rotate (r); - N = N * M; - - // - // Extract the other two angles, y and z, from N. - // - - T cy = Math::sqrt (N[i][i]*N[i][i] + N[i][j]*N[i][j]); - y = Math::atan2 (-N[i][k], cy); - z = Math::atan2 (-N[j][i], N[j][j]); - } - - if (!_parityEven) - *this *= -1; - - if (!_frameStatic) - { - T t = x; - x = z; - z = t; - } -} - -template -Matrix33 Euler::toMatrix33() const -{ - int i,j,k; - angleOrder(i,j,k); - - Vec3 angles; - - if ( _frameStatic ) angles = (*this); - else angles = Vec3(z,y,x); - - if ( !_parityEven ) angles *= -1.0; - - T ci = Math::cos(angles.x); - T cj = Math::cos(angles.y); - T ch = Math::cos(angles.z); - T si = Math::sin(angles.x); - T sj = Math::sin(angles.y); - T sh = Math::sin(angles.z); - - T cc = ci*ch; - T cs = ci*sh; - T sc = si*ch; - T ss = si*sh; - - Matrix33 M; - - if ( _initialRepeated ) - { - M[i][i] = cj; M[j][i] = sj*si; M[k][i] = sj*ci; - M[i][j] = sj*sh; M[j][j] = -cj*ss+cc; M[k][j] = -cj*cs-sc; - M[i][k] = -sj*ch; M[j][k] = cj*sc+cs; M[k][k] = cj*cc-ss; - } - else - { - M[i][i] = cj*ch; M[j][i] = sj*sc-cs; M[k][i] = sj*cc+ss; - M[i][j] = cj*sh; M[j][j] = sj*ss+cc; M[k][j] = sj*cs-sc; - M[i][k] = -sj; M[j][k] = cj*si; M[k][k] = cj*ci; - } - - return M; -} - -template -Matrix44 Euler::toMatrix44() const -{ - int i,j,k; - angleOrder(i,j,k); - - Vec3 angles; - - if ( _frameStatic ) angles = (*this); - else angles = Vec3(z,y,x); - - if ( !_parityEven ) angles *= -1.0; - - T ci = Math::cos(angles.x); - T cj = Math::cos(angles.y); - T ch = Math::cos(angles.z); - T si = Math::sin(angles.x); - T sj = Math::sin(angles.y); - T sh = Math::sin(angles.z); - - T cc = ci*ch; - T cs = ci*sh; - T sc = si*ch; - T ss = si*sh; - - Matrix44 M; - - if ( _initialRepeated ) - { - M[i][i] = cj; M[j][i] = sj*si; M[k][i] = sj*ci; - M[i][j] = sj*sh; M[j][j] = -cj*ss+cc; M[k][j] = -cj*cs-sc; - M[i][k] = -sj*ch; M[j][k] = cj*sc+cs; M[k][k] = cj*cc-ss; - } - else - { - M[i][i] = cj*ch; M[j][i] = sj*sc-cs; M[k][i] = sj*cc+ss; - M[i][j] = cj*sh; M[j][j] = sj*ss+cc; M[k][j] = sj*cs-sc; - M[i][k] = -sj; M[j][k] = cj*si; M[k][k] = cj*ci; - } - - return M; -} - -template -Quat Euler::toQuat() const -{ - Vec3 angles; - int i,j,k; - angleOrder(i,j,k); - - if ( _frameStatic ) angles = (*this); - else angles = Vec3(z,y,x); - - if ( !_parityEven ) angles.y = -angles.y; - - T ti = angles.x*0.5; - T tj = angles.y*0.5; - T th = angles.z*0.5; - T ci = Math::cos(ti); - T cj = Math::cos(tj); - T ch = Math::cos(th); - T si = Math::sin(ti); - T sj = Math::sin(tj); - T sh = Math::sin(th); - T cc = ci*ch; - T cs = ci*sh; - T sc = si*ch; - T ss = si*sh; - - T parity = _parityEven ? 1.0 : -1.0; - - Quat q; - Vec3 a; - - if ( _initialRepeated ) - { - a[i] = cj*(cs + sc); - a[j] = sj*(cc + ss) * parity, - a[k] = sj*(cs - sc); - q.r = cj*(cc - ss); - } - else - { - a[i] = cj*sc - sj*cs, - a[j] = (cj*ss + sj*cc) * parity, - a[k] = cj*cs - sj*sc; - q.r = cj*cc + sj*ss; - } - - q.v = a; - - return q; -} - -template -inline bool -Euler::legal(typename Euler::Order order) -{ - return (order & ~Legal) ? false : true; -} - -template -typename Euler::Order -Euler::order() const -{ - int foo = (_initialAxis == Z ? 0x2000 : (_initialAxis == Y ? 0x1000 : 0)); - - if (_parityEven) foo |= 0x0100; - if (_initialRepeated) foo |= 0x0010; - if (_frameStatic) foo++; - - return (Order)foo; -} - -template -inline void Euler::setOrder(typename Euler::Order p) -{ - set( p & 0x2000 ? Z : (p & 0x1000 ? Y : X), // initial axis - !(p & 0x1), // static? - !!(p & 0x100), // permutation even? - !!(p & 0x10)); // initial repeats? -} - -template -void Euler::set(typename Euler::Axis axis, - bool relative, - bool parityEven, - bool firstRepeats) -{ - _initialAxis = axis; - _frameStatic = !relative; - _parityEven = parityEven; - _initialRepeated = firstRepeats; -} - -template -const Euler& Euler::operator= (const Euler &euler) -{ - x = euler.x; - y = euler.y; - z = euler.z; - _initialAxis = euler._initialAxis; - _frameStatic = euler._frameStatic; - _parityEven = euler._parityEven; - _initialRepeated = euler._initialRepeated; - return *this; -} - -template -const Euler& Euler::operator= (const Vec3 &v) -{ - x = v.x; - y = v.y; - z = v.z; - return *this; -} - -template -std::ostream& operator << (std::ostream &o, const Euler &euler) -{ - char a[3] = { 'X', 'Y', 'Z' }; - - const char* r = euler.frameStatic() ? "" : "r"; - int i,j,k; - euler.angleOrder(i,j,k); - - if ( euler.initialRepeated() ) k = i; - - return o << "(" - << euler.x << " " - << euler.y << " " - << euler.z << " " - << a[i] << a[j] << a[k] << r << ")"; -} - -template -float -Euler::angleMod (T angle) -{ - angle = fmod(T (angle), T (2 * M_PI)); - - if (angle < -M_PI) angle += 2 * M_PI; - if (angle > +M_PI) angle -= 2 * M_PI; - - return angle; -} - -template -void -Euler::simpleXYZRotation (Vec3 &xyzRot, const Vec3 &targetXyzRot) -{ - Vec3 d = xyzRot - targetXyzRot; - xyzRot[0] = targetXyzRot[0] + angleMod(d[0]); - xyzRot[1] = targetXyzRot[1] + angleMod(d[1]); - xyzRot[2] = targetXyzRot[2] + angleMod(d[2]); -} - -template -void -Euler::nearestRotation (Vec3 &xyzRot, const Vec3 &targetXyzRot, - Order order) -{ - int i,j,k; - Euler e (0,0,0, order); - e.angleOrder(i,j,k); - - simpleXYZRotation(xyzRot, targetXyzRot); - - Vec3 otherXyzRot; - otherXyzRot[i] = M_PI+xyzRot[i]; - otherXyzRot[j] = M_PI-xyzRot[j]; - otherXyzRot[k] = M_PI+xyzRot[k]; - - simpleXYZRotation(otherXyzRot, targetXyzRot); - - Vec3 d = xyzRot - targetXyzRot; - Vec3 od = otherXyzRot - targetXyzRot; - T dMag = d.dot(d); - T odMag = od.dot(od); - - if (odMag < dMag) - { - xyzRot = otherXyzRot; - } -} - -template -void -Euler::makeNear (const Euler &target) -{ - Vec3 xyzRot = toXYZVector(); - Euler targetSameOrder = Euler(target, order()); - Vec3 targetXyz = targetSameOrder.toXYZVector(); - - nearestRotation(xyzRot, targetXyz, order()); - - setXYZVector(xyzRot); -} - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -#pragma warning(default:4244) -#endif - -} // namespace Imath - - -#endif diff --git a/3rdparty/include/OpenEXR/ImathExc.h b/3rdparty/include/OpenEXR/ImathExc.h deleted file mode 100644 index db5c6c415a..0000000000 --- a/3rdparty/include/OpenEXR/ImathExc.h +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHEXC_H -#define INCLUDED_IMATHEXC_H - - -//----------------------------------------------- -// -// Imath library-specific exceptions -// -//----------------------------------------------- - -#include "IexBaseExc.h" - -namespace Imath { - - -DEFINE_EXC (NullVecExc, ::Iex::MathExc) // Attempt to normalize - // null vector - -DEFINE_EXC (NullQuatExc, ::Iex::MathExc) // Attempt to normalize - // null quaternion - -DEFINE_EXC (SingMatrixExc, ::Iex::MathExc) // Attempt to invert - // singular matrix - -DEFINE_EXC (ZeroScaleExc, ::Iex::MathExc) // Attempt to remove zero - // scaling from matrix - -DEFINE_EXC (IntVecNormalizeExc, ::Iex::MathExc) // Attempt to normalize - // a vector of whose elements - // are an integer type - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathFrame.h b/3rdparty/include/OpenEXR/ImathFrame.h deleted file mode 100644 index 72912312e5..0000000000 --- a/3rdparty/include/OpenEXR/ImathFrame.h +++ /dev/null @@ -1,190 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHFRAME_H -#define INCLUDED_IMATHFRAME_H - -namespace Imath { - -template class Vec3; -template class Matrix44; - -// -// These methods compute a set of reference frames, defined by their -// transformation matrix, along a curve. It is designed so that the -// array of points and the array of matrices used to fetch these routines -// don't need to be ordered as the curve. -// -// A typical usage would be : -// -// m[0] = Imath::firstFrame( p[0], p[1], p[2] ); -// for( int i = 1; i < n - 1; i++ ) -// { -// m[i] = Imath::nextFrame( m[i-1], p[i-1], p[i], t[i-1], t[i] ); -// } -// m[n-1] = Imath::lastFrame( m[n-2], p[n-2], p[n-1] ); -// -// See Graphics Gems I for the underlying algorithm. -// - -template Matrix44 firstFrame( const Vec3&, // First point - const Vec3&, // Second point - const Vec3& ); // Third point - -template Matrix44 nextFrame( const Matrix44&, // Previous matrix - const Vec3&, // Previous point - const Vec3&, // Current point - Vec3&, // Previous tangent - Vec3& ); // Current tangent - -template Matrix44 lastFrame( const Matrix44&, // Previous matrix - const Vec3&, // Previous point - const Vec3& ); // Last point - -// -// firstFrame - Compute the first reference frame along a curve. -// -// This function returns the transformation matrix to the reference frame -// defined by the three points 'pi', 'pj' and 'pk'. Note that if the two -// vectors and are colinears, an arbitrary twist value will -// be choosen. -// -// Throw 'NullVecExc' if 'pi' and 'pj' are equals. -// - -template Matrix44 firstFrame -( - const Vec3& pi, // First point - const Vec3& pj, // Second point - const Vec3& pk ) // Third point -{ - Vec3 t = pj - pi; t.normalizeExc(); - - Vec3 n = t.cross( pk - pi ); n.normalize(); - if( n.length() == 0.0f ) - { - int i = fabs( t[0] ) < fabs( t[1] ) ? 0 : 1; - if( fabs( t[2] ) < fabs( t[i] )) i = 2; - - Vec3 v( 0.0, 0.0, 0.0 ); v[i] = 1.0; - n = t.cross( v ); n.normalize(); - } - - Vec3 b = t.cross( n ); - - Matrix44 M; - - M[0][0] = t[0]; M[0][1] = t[1]; M[0][2] = t[2]; M[0][3] = 0.0, - M[1][0] = n[0]; M[1][1] = n[1]; M[1][2] = n[2]; M[1][3] = 0.0, - M[2][0] = b[0]; M[2][1] = b[1]; M[2][2] = b[2]; M[2][3] = 0.0, - M[3][0] = pi[0]; M[3][1] = pi[1]; M[3][2] = pi[2]; M[3][3] = 1.0; - - return M; -} - -// -// nextFrame - Compute the next reference frame along a curve. -// -// This function returns the transformation matrix to the next reference -// frame defined by the previously computed transformation matrix and the -// new point and tangent vector along the curve. -// - -template Matrix44 nextFrame -( - const Matrix44& Mi, // Previous matrix - const Vec3& pi, // Previous point - const Vec3& pj, // Current point - Vec3& ti, // Previous tangent vector - Vec3& tj ) // Current tangent vector -{ - Vec3 a(0.0, 0.0, 0.0); // Rotation axis. - T r = 0.0; // Rotation angle. - - if( ti.length() != 0.0 && tj.length() != 0.0 ) - { - ti.normalize(); tj.normalize(); - T dot = ti.dot( tj ); - - // - // This is *really* necessary : - // - - if( dot > 1.0 ) dot = 1.0; - else if( dot < -1.0 ) dot = -1.0; - - r = acosf( dot ); - a = ti.cross( tj ); - } - - if( a.length() != 0.0 && r != 0.0 ) - { - Matrix44 R; R.setAxisAngle( a, r ); - Matrix44 Tj; Tj.translate( pj ); - Matrix44 Ti; Ti.translate( -pi ); - - return Mi * Ti * R * Tj; - } - else - { - Matrix44 Tr; Tr.translate( pj - pi ); - - return Mi * Tr; - } -} - -// -// lastFrame - Compute the last reference frame along a curve. -// -// This function returns the transformation matrix to the last reference -// frame defined by the previously computed transformation matrix and the -// last point along the curve. -// - -template Matrix44 lastFrame -( - const Matrix44& Mi, // Previous matrix - const Vec3& pi, // Previous point - const Vec3& pj ) // Last point -{ - Matrix44 Tr; Tr.translate( pj - pi ); - - return Mi * Tr; -} - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathFrustum.h b/3rdparty/include/OpenEXR/ImathFrustum.h deleted file mode 100644 index 9f34765940..0000000000 --- a/3rdparty/include/OpenEXR/ImathFrustum.h +++ /dev/null @@ -1,697 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHFRUSTUM_H -#define INCLUDED_IMATHFRUSTUM_H - - -#include "ImathVec.h" -#include "ImathPlane.h" -#include "ImathLine.h" -#include "ImathMatrix.h" -#include "ImathLimits.h" -#include "ImathFun.h" -#include "IexMathExc.h" - -#if defined _WIN32 || defined _WIN64 - #ifdef near - #undef near - #endif - #ifdef far - #undef far - #endif -#endif - -namespace Imath { - -// -// template class Frustum -// -// The frustum is always located with the eye point at the -// origin facing down -Z. This makes the Frustum class -// compatable with OpenGL (or anything that assumes a camera -// looks down -Z, hence with a right-handed coordinate system) -// but not with RenderMan which assumes the camera looks down -// +Z. Additional functions are provided for conversion from -// and from various camera coordinate spaces. -// - - -template -class Frustum -{ - public: - Frustum(); - Frustum(const Frustum &); - Frustum(T near, T far, T left, T right, T top, T bottom, bool ortho=false); - Frustum(T near, T far, T fovx, T fovy, T aspect); - virtual ~Frustum(); - - //-------------------- - // Assignment operator - //-------------------- - - const Frustum &operator = (const Frustum &); - - //-------------------- - // Operators: ==, != - //-------------------- - - bool operator == (const Frustum &src) const; - bool operator != (const Frustum &src) const; - - //-------------------------------------------------------- - // Set functions change the entire state of the Frustum - //-------------------------------------------------------- - - void set(T near, T far, - T left, T right, - T top, T bottom, - bool ortho=false); - - void set(T near, T far, T fovx, T fovy, T aspect); - - //------------------------------------------------------ - // These functions modify an already valid frustum state - //------------------------------------------------------ - - void modifyNearAndFar(T near, T far); - void setOrthographic(bool); - - //-------------- - // Access - //-------------- - - bool orthographic() const { return _orthographic; } - T near() const { return _near; } - T far() const { return _far; } - T left() const { return _left; } - T right() const { return _right; } - T bottom() const { return _bottom; } - T top() const { return _top; } - - //----------------------------------------------------------------------- - // Sets the planes in p to be the six bounding planes of the frustum, in - // the following order: top, right, bottom, left, near, far. - // Note that the planes have normals that point out of the frustum. - // The version of this routine that takes a matrix applies that matrix - // to transform the frustum before setting the planes. - //----------------------------------------------------------------------- - - void planes(Plane3 p[6]); - void planes(Plane3 p[6], const Matrix44 &M); - - //---------------------- - // Derived Quantities - //---------------------- - - T fovx() const; - T fovy() const; - T aspect() const; - Matrix44 projectionMatrix() const; - - //----------------------------------------------------------------------- - // Takes a rectangle in the screen space (i.e., -1 <= left <= right <= 1 - // and -1 <= bottom <= top <= 1) of this Frustum, and returns a new - // Frustum whose near clipping-plane window is that rectangle in local - // space. - //----------------------------------------------------------------------- - - Frustum window(T left, T right, T top, T bottom) const; - - //---------------------------------------------------------- - // Projection is in screen space / Conversion from Z-Buffer - //---------------------------------------------------------- - - Line3 projectScreenToRay( const Vec2 & ) const; - Vec2 projectPointToScreen( const Vec3 & ) const; - - T ZToDepth(long zval, long min, long max) const; - T normalizedZToDepth(T zval) const; - long DepthToZ(T depth, long zmin, long zmax) const; - - T worldRadius(const Vec3 &p, T radius) const; - T screenRadius(const Vec3 &p, T radius) const; - - - protected: - - Vec2 screenToLocal( const Vec2 & ) const; - Vec2 localToScreen( const Vec2 & ) const; - - protected: - T _near; - T _far; - T _left; - T _right; - T _top; - T _bottom; - bool _orthographic; -}; - - -template -inline Frustum::Frustum() -{ - set(T (0.1), - T (1000.0), - T (-1.0), - T (1.0), - T (1.0), - T (-1.0), - false); -} - -template -inline Frustum::Frustum(const Frustum &f) -{ - *this = f; -} - -template -inline Frustum::Frustum(T n, T f, T l, T r, T t, T b, bool o) -{ - set(n,f,l,r,t,b,o); -} - -template -inline Frustum::Frustum(T near, T far, T fovx, T fovy, T aspect) -{ - set(near,far,fovx,fovy,aspect); -} - -template -Frustum::~Frustum() -{ -} - -template -const Frustum & -Frustum::operator = (const Frustum &f) -{ - _near = f._near; - _far = f._far; - _left = f._left; - _right = f._right; - _top = f._top; - _bottom = f._bottom; - _orthographic = f._orthographic; - - return *this; -} - -template -bool -Frustum::operator == (const Frustum &src) const -{ - return - _near == src._near && - _far == src._far && - _left == src._left && - _right == src._right && - _top == src._top && - _bottom == src._bottom && - _orthographic == src._orthographic; -} - -template -inline bool -Frustum::operator != (const Frustum &src) const -{ - return !operator== (src); -} - -template -void Frustum::set(T n, T f, T l, T r, T t, T b, bool o) -{ - _near = n; - _far = f; - _left = l; - _right = r; - _bottom = b; - _top = t; - _orthographic = o; -} - -template -void Frustum::modifyNearAndFar(T n, T f) -{ - if ( _orthographic ) - { - _near = n; - } - else - { - Line3 lowerLeft( Vec3(0,0,0), Vec3(_left,_bottom,-_near) ); - Line3 upperRight( Vec3(0,0,0), Vec3(_right,_top,-_near) ); - Plane3 nearPlane( Vec3(0,0,-1), n ); - - Vec3 ll,ur; - nearPlane.intersect(lowerLeft,ll); - nearPlane.intersect(upperRight,ur); - - _left = ll.x; - _right = ur.x; - _top = ur.y; - _bottom = ll.y; - _near = n; - _far = f; - } - - _far = f; -} - -template -void Frustum::setOrthographic(bool ortho) -{ - _orthographic = ortho; -} - -template -void Frustum::set(T near, T far, T fovx, T fovy, T aspect) -{ - if (fovx != 0 && fovy != 0) - throw Iex::ArgExc ("fovx and fovy cannot both be non-zero."); - - if (fovx != 0) - { - _right = near * Math::tan(fovx/2.0); - _left = -_right; - _top = ((_right - _left)/aspect)/2.0; - _bottom = -_top; - } - else - { - _top = near * Math::tan(fovy/2.0); - _bottom = -_top; - _right = (_top - _bottom) * aspect / 2.0; - _left = -_right; - } - _near = near; - _far = far; - _orthographic = false; -} - -template -T Frustum::fovx() const -{ - return Math::atan2(_right,_near) - Math::atan2(_left,_near); -} - -template -T Frustum::fovy() const -{ - return Math::atan2(_top,_near) - Math::atan2(_bottom,_near); -} - -template -T Frustum::aspect() const -{ - T rightMinusLeft = _right-_left; - T topMinusBottom = _top-_bottom; - - if (abs(topMinusBottom) < 1 && - abs(rightMinusLeft) > limits::max() * abs(topMinusBottom)) - { - throw Iex::DivzeroExc ("Bad viewing frustum: " - "aspect ratio cannot be computed."); - } - - return rightMinusLeft / topMinusBottom; -} - -template -Matrix44 Frustum::projectionMatrix() const -{ - T rightPlusLeft = _right+_left; - T rightMinusLeft = _right-_left; - - T topPlusBottom = _top+_bottom; - T topMinusBottom = _top-_bottom; - - T farPlusNear = _far+_near; - T farMinusNear = _far-_near; - - if ((abs(rightMinusLeft) < 1 && - abs(rightPlusLeft) > limits::max() * abs(rightMinusLeft)) || - (abs(topMinusBottom) < 1 && - abs(topPlusBottom) > limits::max() * abs(topMinusBottom)) || - (abs(farMinusNear) < 1 && - abs(farPlusNear) > limits::max() * abs(farMinusNear))) - { - throw Iex::DivzeroExc ("Bad viewing frustum: " - "projection matrix cannot be computed."); - } - - if ( _orthographic ) - { - T tx = -rightPlusLeft / rightMinusLeft; - T ty = -topPlusBottom / topMinusBottom; - T tz = -farPlusNear / farMinusNear; - - if ((abs(rightMinusLeft) < 1 && - 2 > limits::max() * abs(rightMinusLeft)) || - (abs(topMinusBottom) < 1 && - 2 > limits::max() * abs(topMinusBottom)) || - (abs(farMinusNear) < 1 && - 2 > limits::max() * abs(farMinusNear))) - { - throw Iex::DivzeroExc ("Bad viewing frustum: " - "projection matrix cannot be computed."); - } - - T A = 2 / rightMinusLeft; - T B = 2 / topMinusBottom; - T C = -2 / farMinusNear; - - return Matrix44( A, 0, 0, 0, - 0, B, 0, 0, - 0, 0, C, 0, - tx, ty, tz, 1.f ); - } - else - { - T A = rightPlusLeft / rightMinusLeft; - T B = topPlusBottom / topMinusBottom; - T C = -farPlusNear / farMinusNear; - - T farTimesNear = -2 * _far * _near; - if (abs(farMinusNear) < 1 && - abs(farTimesNear) > limits::max() * abs(farMinusNear)) - { - throw Iex::DivzeroExc ("Bad viewing frustum: " - "projection matrix cannot be computed."); - } - - T D = farTimesNear / farMinusNear; - - T twoTimesNear = 2 * _near; - - if ((abs(rightMinusLeft) < 1 && - abs(twoTimesNear) > limits::max() * abs(rightMinusLeft)) || - (abs(topMinusBottom) < 1 && - abs(twoTimesNear) > limits::max() * abs(topMinusBottom))) - { - throw Iex::DivzeroExc ("Bad viewing frustum: " - "projection matrix cannot be computed."); - } - - T E = twoTimesNear / rightMinusLeft; - T F = twoTimesNear / topMinusBottom; - - return Matrix44( E, 0, 0, 0, - 0, F, 0, 0, - A, B, C, -1, - 0, 0, D, 0 ); - } -} - -template -Frustum Frustum::window(T l, T r, T t, T b) const -{ - // move it to 0->1 space - - Vec2 bl = screenToLocal( Vec2(l,b) ); - Vec2 tr = screenToLocal( Vec2(r,t) ); - - return Frustum(_near, _far, bl.x, tr.x, tr.y, bl.y, _orthographic); -} - - -template -Vec2 Frustum::screenToLocal(const Vec2 &s) const -{ - return Vec2( _left + (_right-_left) * (1.f+s.x) / 2.f, - _bottom + (_top-_bottom) * (1.f+s.y) / 2.f ); -} - -template -Vec2 Frustum::localToScreen(const Vec2 &p) const -{ - T leftPlusRight = _left - 2 * p.x + _right; - T leftMinusRight = _left-_right; - T bottomPlusTop = _bottom - 2 * p.y + _top; - T bottomMinusTop = _bottom-_top; - - if ((abs(leftMinusRight) < 1 && - abs(leftPlusRight) > limits::max() * abs(leftMinusRight)) || - (abs(bottomMinusTop) < 1 && - abs(bottomPlusTop) > limits::max() * abs(bottomMinusTop))) - { - throw Iex::DivzeroExc - ("Bad viewing frustum: " - "local-to-screen transformation cannot be computed"); - } - - return Vec2( leftPlusRight / leftMinusRight, - bottomPlusTop / bottomMinusTop ); -} - -template -Line3 Frustum::projectScreenToRay(const Vec2 &p) const -{ - Vec2 point = screenToLocal(p); - if (orthographic()) - return Line3( Vec3(point.x,point.y, 0.0), - Vec3(point.x,point.y,-_near)); - else - return Line3( Vec3(0, 0, 0), Vec3(point.x,point.y,-_near)); -} - -template -Vec2 Frustum::projectPointToScreen(const Vec3 &point) const -{ - if (orthographic() || point.z == 0) - return localToScreen( Vec2( point.x, point.y ) ); - else - return localToScreen( Vec2( point.x * _near / -point.z, - point.y * _near / -point.z ) ); -} - -template -T Frustum::ZToDepth(long zval,long zmin,long zmax) const -{ - int zdiff = zmax - zmin; - - if (zdiff == 0) - { - throw Iex::DivzeroExc - ("Bad call to Frustum::ZToDepth: zmax == zmin"); - } - - if ( zval > zmax+1 ) zval -= zdiff; - - T fzval = (T(zval) - T(zmin)) / T(zdiff); - return normalizedZToDepth(fzval); -} - -template -T Frustum::normalizedZToDepth(T zval) const -{ - T Zp = zval * 2.0 - 1; - - if ( _orthographic ) - { - return -(Zp*(_far-_near) + (_far+_near))/2; - } - else - { - T farTimesNear = 2 * _far * _near; - T farMinusNear = Zp * (_far - _near) - _far - _near; - - if (abs(farMinusNear) < 1 && - abs(farTimesNear) > limits::max() * abs(farMinusNear)) - { - throw Iex::DivzeroExc - ("Frustum::normalizedZToDepth cannot be computed. The " - "near and far clipping planes of the viewing frustum " - "may be too close to each other"); - } - - return farTimesNear / farMinusNear; - } -} - -template -long Frustum::DepthToZ(T depth,long zmin,long zmax) const -{ - long zdiff = zmax - zmin; - T farMinusNear = _far-_near; - - if ( _orthographic ) - { - T farPlusNear = 2*depth + _far + _near; - - if (abs(farMinusNear) < 1 && - abs(farPlusNear) > limits::max() * abs(farMinusNear)) - { - throw Iex::DivzeroExc - ("Bad viewing frustum: near and far clipping planes " - "are too close to each other"); - } - - T Zp = -farPlusNear/farMinusNear; - return long(0.5*(Zp+1)*zdiff) + zmin; - } - else - { - // Perspective - - T farTimesNear = 2*_far*_near; - if (abs(depth) < 1 && - abs(farTimesNear) > limits::max() * abs(depth)) - { - throw Iex::DivzeroExc - ("Bad call to DepthToZ function: value of `depth' " - "is too small"); - } - - T farPlusNear = farTimesNear/depth + _far + _near; - if (abs(farMinusNear) < 1 && - abs(farPlusNear) > limits::max() * abs(farMinusNear)) - { - throw Iex::DivzeroExc - ("Bad viewing frustum: near and far clipping planes " - "are too close to each other"); - } - - T Zp = farPlusNear/farMinusNear; - return long(0.5*(Zp+1)*zdiff) + zmin; - } -} - -template -T Frustum::screenRadius(const Vec3 &p, T radius) const -{ - // Derivation: - // Consider X-Z plane. - // X coord of projection of p = xp = p.x * (-_near / p.z) - // Let q be p + (radius, 0, 0). - // X coord of projection of q = xq = (p.x - radius) * (-_near / p.z) - // X coord of projection of segment from p to q = r = xp - xq - // = radius * (-_near / p.z) - // A similar analysis holds in the Y-Z plane. - // So r is the quantity we want to return. - - if (abs(p.z) > 1 || abs(-_near) < limits::max() * abs(p.z)) - { - return radius * (-_near / p.z); - } - else - { - throw Iex::DivzeroExc - ("Bad call to Frustum::screenRadius: the magnitude of `p' " - "is too small"); - } - - return radius * (-_near / p.z); -} - -template -T Frustum::worldRadius(const Vec3 &p, T radius) const -{ - if (abs(-_near) > 1 || abs(p.z) < limits::max() * abs(-_near)) - { - return radius * (p.z / -_near); - } - else - { - throw Iex::DivzeroExc - ("Bad viewing frustum: the near clipping plane is too " - "close to zero"); - } -} - -template -void Frustum::planes(Plane3 p[6]) -{ - // - // Plane order: Top, Right, Bottom, Left, Near, Far. - // Normals point outwards. - // - - Vec3 a( _left, _bottom, -_near); - Vec3 b( _left, _top, -_near); - Vec3 c( _right, _top, -_near); - Vec3 d( _right, _bottom, -_near); - Vec3 o(0,0,0); - - p[0].set( o, c, b ); - p[1].set( o, d, c ); - p[2].set( o, a, d ); - p[3].set( o, b, a ); - p[4].set( Vec3(0, 0, 1), -_near ); - p[5].set( Vec3(0, 0,-1), _far ); -} - - -template -void Frustum::planes(Plane3 p[6], const Matrix44 &M) -{ - // - // Plane order: Top, Right, Bottom, Left, Near, Far. - // Normals point outwards. - // - - Vec3 a = Vec3( _left, _bottom, -_near) * M; - Vec3 b = Vec3( _left, _top, -_near) * M; - Vec3 c = Vec3( _right, _top, -_near) * M; - Vec3 d = Vec3( _right, _bottom, -_near) * M; - double s = _far / double(_near); - T farLeft = (T) (s * _left); - T farRight = (T) (s * _right); - T farTop = (T) (s * _top); - T farBottom = (T) (s * _bottom); - Vec3 e = Vec3( farLeft, farBottom, -_far) * M; - Vec3 f = Vec3( farLeft, farTop, -_far) * M; - Vec3 g = Vec3( farRight, farTop, -_far) * M; - Vec3 o = Vec3(0,0,0) * M; - - p[0].set( o, c, b ); - p[1].set( o, d, c ); - p[2].set( o, a, d ); - p[3].set( o, b, a ); - p[4].set( a, d, c ); - p[5].set( e, f, g ); -} - -typedef Frustum Frustumf; -typedef Frustum Frustumd; - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathFun.h b/3rdparty/include/OpenEXR/ImathFun.h deleted file mode 100644 index dbac025df1..0000000000 --- a/3rdparty/include/OpenEXR/ImathFun.h +++ /dev/null @@ -1,272 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHFUN_H -#define INCLUDED_IMATHFUN_H - -//----------------------------------------------------------------------------- -// -// Miscellaneous utility functions -// -//----------------------------------------------------------------------------- - -#include "ImathLimits.h" - -namespace Imath { - -template -inline T -abs (T a) -{ - return (a > 0) ? a : -a; -} - - -template -inline int -sign (T a) -{ - return (a > 0)? 1 : ((a < 0) ? -1 : 0); -} - - -template -inline T -lerp (T a, T b, Q t) -{ - return (T) (a + (b - a) * t); -} - - -template -inline T -ulerp (T a, T b, Q t) -{ - return (T) ((a > b)? (a - (a - b) * t): (a + (b - a) * t)); -} - - -template -inline T -lerpfactor(T m, T a, T b) -{ - // - // Return how far m is between a and b, that is return t such that - // if: - // t = lerpfactor(m, a, b); - // then: - // m = lerp(a, b, t); - // - // If a==b, return 0. - // - - T d = b - a; - T n = m - a; - - if (abs(d) > T(1) || abs(n) < limits::max() * abs(d)) - return n / d; - - return T(0); -} - - -template -inline T -clamp (T a, T l, T h) -{ - return (a < l)? l : ((a > h)? h : a); -} - - -template -inline int -cmp (T a, T b) -{ - return Imath::sign (a - b); -} - - -template -inline int -cmpt (T a, T b, T t) -{ - return (Imath::abs (a - b) <= t)? 0 : cmp (a, b); -} - - -template -inline bool -iszero (T a, T t) -{ - return (Imath::abs (a) <= t) ? 1 : 0; -} - - -template -inline bool -equal (T1 a, T2 b, T3 t) -{ - return Imath::abs (a - b) <= t; -} - -template -inline int -floor (T x) -{ - return (x >= 0)? int (x): -(int (-x) + (-x > int (-x))); -} - - -template -inline int -ceil (T x) -{ - return -floor (-x); -} - -template -inline int -trunc (T x) -{ - return (x >= 0) ? int(x) : -int(-x); -} - - -// -// Integer division and remainder where the -// remainder of x/y has the same sign as x: -// -// divs(x,y) == (abs(x) / abs(y)) * (sign(x) * sign(y)) -// mods(x,y) == x - y * divs(x,y) -// - -inline int -divs (int x, int y) -{ - return (x >= 0)? ((y >= 0)? ( x / y): -( x / -y)): - ((y >= 0)? -(-x / y): (-x / -y)); -} - - -inline int -mods (int x, int y) -{ - return (x >= 0)? ((y >= 0)? ( x % y): ( x % -y)): - ((y >= 0)? -(-x % y): -(-x % -y)); -} - - -// -// Integer division and remainder where the -// remainder of x/y is always positive: -// -// divp(x,y) == floor (double(x) / double (y)) -// modp(x,y) == x - y * divp(x,y) -// - -inline int -divp (int x, int y) -{ - return (x >= 0)? ((y >= 0)? ( x / y): -( x / -y)): - ((y >= 0)? -((y-1-x) / y): ((-y-1-x) / -y)); -} - - -inline int -modp (int x, int y) -{ - return x - y * divp (x, y); -} - -//---------------------------------------------------------- -// Successor and predecessor for floating-point numbers: -// -// succf(f) returns float(f+e), where e is the smallest -// positive number such that float(f+e) != f. -// -// predf(f) returns float(f-e), where e is the smallest -// positive number such that float(f-e) != f. -// -// succd(d) returns double(d+e), where e is the smallest -// positive number such that double(d+e) != d. -// -// predd(d) returns double(d-e), where e is the smallest -// positive number such that double(d-e) != d. -// -// Exceptions: If the input value is an infinity or a nan, -// succf(), predf(), succd(), and predd() all -// return the input value without changing it. -// -//---------------------------------------------------------- - -float succf (float f); -float predf (float f); - -double succd (double d); -double predd (double d); - -// -// Return true if the number is not a NaN or Infinity. -// - -inline bool -finitef (float f) -{ - union {float f; int i;} u; - u.f = f; - - return (u.i & 0x7f800000) != 0x7f800000; -} - -inline bool -finited (double d) -{ -#if ULONG_MAX == 18446744073709551615LU - typedef long unsigned int Int64; -#else - typedef long long unsigned int Int64; -#endif - - union {double d; Int64 i;} u; - u.d = d; - - return (u.i & 0x7ff0000000000000LL) != 0x7ff0000000000000LL; -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathGL.h b/3rdparty/include/OpenEXR/ImathGL.h deleted file mode 100644 index 36be0fdc53..0000000000 --- a/3rdparty/include/OpenEXR/ImathGL.h +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMATHGL_H -#define INCLUDED_IMATHGL_H - -#include - -#include "ImathVec.h" -#include "ImathMatrix.h" -#include "IexMathExc.h" -#include "ImathFun.h" - -inline void glVertex ( const Imath::V3f &v ) { glVertex3f(v.x,v.y,v.z); } -inline void glVertex ( const Imath::V2f &v ) { glVertex2f(v.x,v.y); } -inline void glNormal ( const Imath::V3f &n ) { glNormal3f(n.x,n.y,n.z); } -inline void glColor ( const Imath::V3f &c ) { glColor3f(c.x,c.y,c.z); } -inline void glTranslate ( const Imath::V3f &t ) { glTranslatef(t.x,t.y,t.z); } - -inline void glTexCoord( const Imath::V2f &t ) -{ - glTexCoord2f(t.x,t.y); -} - -inline void glDisableTexture() -{ - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, 0); - glDisable(GL_TEXTURE_2D); - - glActiveTexture(GL_TEXTURE0); -} - -namespace { - -const float GL_FLOAT_MAX = 1.8e+19; // sqrt (FLT_MAX) - -inline bool -badFloat (float f) -{ - return !Imath::finitef (f) || f < - GL_FLOAT_MAX || f > GL_FLOAT_MAX; -} - -} // namespace - -inline void -throwBadMatrix (const Imath::M44f& m) -{ - if (badFloat (m[0][0]) || - badFloat (m[0][1]) || - badFloat (m[0][2]) || - badFloat (m[0][3]) || - badFloat (m[1][0]) || - badFloat (m[1][1]) || - badFloat (m[1][2]) || - badFloat (m[1][3]) || - badFloat (m[2][0]) || - badFloat (m[2][1]) || - badFloat (m[2][2]) || - badFloat (m[2][3]) || - badFloat (m[3][0]) || - badFloat (m[3][1]) || - badFloat (m[3][2]) || - badFloat (m[3][3])) - throw Iex::OverflowExc ("GL matrix overflow"); -} - -inline void -glMultMatrix( const Imath::M44f& m ) -{ - throwBadMatrix (m); - glMultMatrixf( (GLfloat*)m[0] ); -} - -inline void -glMultMatrix( const Imath::M44f* m ) -{ - throwBadMatrix (*m); - glMultMatrixf( (GLfloat*)(*m)[0] ); -} - -inline void -glLoadMatrix( const Imath::M44f& m ) -{ - throwBadMatrix (m); - glLoadMatrixf( (GLfloat*)m[0] ); -} - -inline void -glLoadMatrix( const Imath::M44f* m ) -{ - throwBadMatrix (*m); - glLoadMatrixf( (GLfloat*)(*m)[0] ); -} - - -namespace Imath { - -// -// Class objects that push/pop the GL state. These objects assist with -// proper cleanup of the state when exceptions are thrown. -// - -class GLPushMatrix { - public: - - GLPushMatrix () { glPushMatrix(); } - ~GLPushMatrix() { glPopMatrix(); } -}; - -class GLPushAttrib { - public: - - GLPushAttrib (GLbitfield mask) { glPushAttrib (mask); } - ~GLPushAttrib() { glPopAttrib(); } -}; - -class GLBegin { - public: - - GLBegin (GLenum mode) { glBegin (mode); } - ~GLBegin() { glEnd(); } -}; - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathGLU.h b/3rdparty/include/OpenEXR/ImathGLU.h deleted file mode 100644 index e43d560d10..0000000000 --- a/3rdparty/include/OpenEXR/ImathGLU.h +++ /dev/null @@ -1,54 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHGLU_H -#define INCLUDED_IMATHGLU_H - -#include -#include - -#include "ImathVec.h" - -inline -void -gluLookAt(const Imath::V3f &pos, const Imath::V3f &interest, const Imath::V3f &up) -{ - gluLookAt(pos.x, pos.y, pos.z, - interest.x, interest.y, interest.z, - up.x, up.y, up.z); -} - -#endif diff --git a/3rdparty/include/OpenEXR/ImathHalfLimits.h b/3rdparty/include/OpenEXR/ImathHalfLimits.h deleted file mode 100644 index 2170f94a9c..0000000000 --- a/3rdparty/include/OpenEXR/ImathHalfLimits.h +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHHALFLIMITS_H -#define INCLUDED_IMATHHALFLIMITS_H - -//-------------------------------------------------- -// -// Imath-style limits for class half. -// -//-------------------------------------------------- - -#include "ImathLimits.h" -#include "half.h" - -namespace Imath { - - -template <> -struct limits -{ - static float min() {return -HALF_MAX;} - static float max() {return HALF_MAX;} - static float smallest() {return HALF_MIN;} - static float epsilon() {return HALF_EPSILON;} - static bool isIntegral() {return false;} - static bool isSigned() {return true;} -}; - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathInterval.h b/3rdparty/include/OpenEXR/ImathInterval.h deleted file mode 100644 index 2d9d7d37b5..0000000000 --- a/3rdparty/include/OpenEXR/ImathInterval.h +++ /dev/null @@ -1,224 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHINTERVAL_H -#define INCLUDED_IMATHINTERVAL_H - - -//------------------------------------------------------------------- -// -// class Imath::Interval -// -------------------------------- -// -// An Interval has a min and a max and some miscellaneous -// functions. It is basically a Box that allows T to be -// a scalar. -// -//------------------------------------------------------------------- - -#include "ImathVec.h" - -namespace Imath { - - -template -class Interval -{ - public: - - //------------------------- - // Data Members are public - //------------------------- - - T min; - T max; - - //----------------------------------------------------- - // Constructors - an "empty" Interval is created by default - //----------------------------------------------------- - - Interval(); - Interval(const T& point); - Interval(const T& minT, const T& maxT); - - //-------------------------------- - // Operators: we get != from STL - //-------------------------------- - - bool operator == (const Interval &src) const; - - //------------------ - // Interval manipulation - //------------------ - - void makeEmpty(); - void extendBy(const T& point); - void extendBy(const Interval& interval); - - //--------------------------------------------------- - // Query functions - these compute results each time - //--------------------------------------------------- - - T size() const; - T center() const; - bool intersects(const T &point) const; - bool intersects(const Interval &interval) const; - - //---------------- - // Classification - //---------------- - - bool hasVolume() const; - bool isEmpty() const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - - -typedef Interval Intervalf; -typedef Interval Intervald; -typedef Interval Intervals; -typedef Interval Intervali; - -//---------------- -// Implementation -//---------------- - - -template -inline Interval::Interval() -{ - makeEmpty(); -} - -template -inline Interval::Interval(const T& point) -{ - min = point; - max = point; -} - -template -inline Interval::Interval(const T& minV, const T& maxV) -{ - min = minV; - max = maxV; -} - -template -inline bool -Interval::operator == (const Interval &src) const -{ - return (min == src.min && max == src.max); -} - -template -inline void -Interval::makeEmpty() -{ - min = limits::max(); - max = limits::min(); -} - -template -inline void -Interval::extendBy(const T& point) -{ - if ( point < min ) - min = point; - - if ( point > max ) - max = point; -} - -template -inline void -Interval::extendBy(const Interval& interval) -{ - if ( interval.min < min ) - min = interval.min; - - if ( interval.max > max ) - max = interval.max; -} - -template -inline bool -Interval::intersects(const T& point) const -{ - return point >= min && point <= max; -} - -template -inline bool -Interval::intersects(const Interval& interval) const -{ - return interval.max >= min && interval.min <= max; -} - -template -inline T -Interval::size() const -{ - return max-min; -} - -template -inline T -Interval::center() const -{ - return (max+min)/2; -} - -template -inline bool -Interval::isEmpty() const -{ - return max < min; -} - -template -inline bool Interval::hasVolume() const -{ - return max > min; -} - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathLimits.h b/3rdparty/include/OpenEXR/ImathLimits.h deleted file mode 100644 index 0a67e5bda9..0000000000 --- a/3rdparty/include/OpenEXR/ImathLimits.h +++ /dev/null @@ -1,265 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHLIMITS_H -#define INCLUDED_IMATHLIMITS_H - -//---------------------------------------------------------------- -// -// Limitations of the basic C++ numerical data types -// -//---------------------------------------------------------------- - -#include -#include - -//------------------------------------------ -// In Windows, min and max are macros. Yay. -//------------------------------------------ - -#if defined _WIN32 || defined _WIN64 - #ifdef min - #undef min - #endif - #ifdef max - #undef max - #endif -#endif - -namespace Imath { - - -//----------------------------------------------------------------- -// -// Template class limits returns information about the limits -// of numerical data type T: -// -// min() largest possible negative value of type T -// -// max() largest possible positive value of type T -// -// smallest() smallest possible positive value of type T -// -// epsilon() smallest possible e of type T, for which -// 1 + e != 1 -// -// isIntegral() returns true if T is an integral type -// -// isSigned() returns true if T is signed -// -// Class limits is useful to implement template classes or -// functions which depend on the limits of a numerical type -// which is not known in advance; for example: -// -// template max (T x[], int n) -// { -// T m = limits::min(); -// -// for (int i = 0; i < n; i++) -// if (m < x[i]) -// m = x[i]; -// -// return m; -// } -// -// Class limits has been implemented for the following types: -// -// char, signed char, unsigned char -// short, unsigned short -// int, unsigned int -// long, unsigned long -// float -// double -// long double -// -// Class limits has only static member functions, all of which -// are implemented as inlines. No objects of type limits are -// ever created. -// -//----------------------------------------------------------------- - - -template struct limits -{ - static T min(); - static T max(); - static T smallest(); - static T epsilon(); - static bool isIntegral(); - static bool isSigned(); -}; - - -//--------------- -// Implementation -//--------------- - -template <> -struct limits -{ - static char min() {return CHAR_MIN;} - static char max() {return CHAR_MAX;} - static char smallest() {return 1;} - static char epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return (char) ~0 < 0;} -}; - -template <> -struct limits -{ - static signed char min() {return SCHAR_MIN;} - static signed char max() {return SCHAR_MAX;} - static signed char smallest() {return 1;} - static signed char epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static unsigned char min() {return 0;} - static unsigned char max() {return UCHAR_MAX;} - static unsigned char smallest() {return 1;} - static unsigned char epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return false;} -}; - -template <> -struct limits -{ - static short min() {return SHRT_MIN;} - static short max() {return SHRT_MAX;} - static short smallest() {return 1;} - static short epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static unsigned short min() {return 0;} - static unsigned short max() {return USHRT_MAX;} - static unsigned short smallest() {return 1;} - static unsigned short epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return false;} -}; - -template <> -struct limits -{ - static int min() {return INT_MIN;} - static int max() {return INT_MAX;} - static int smallest() {return 1;} - static int epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static unsigned int min() {return 0;} - static unsigned int max() {return UINT_MAX;} - static unsigned int smallest() {return 1;} - static unsigned int epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return false;} -}; - -template <> -struct limits -{ - static long min() {return LONG_MIN;} - static long max() {return LONG_MAX;} - static long smallest() {return 1;} - static long epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static unsigned long min() {return 0;} - static unsigned long max() {return ULONG_MAX;} - static unsigned long smallest() {return 1;} - static unsigned long epsilon() {return 1;} - static bool isIntegral() {return true;} - static bool isSigned() {return false;} -}; - -template <> -struct limits -{ - static float min() {return -FLT_MAX;} - static float max() {return FLT_MAX;} - static float smallest() {return FLT_MIN;} - static float epsilon() {return FLT_EPSILON;} - static bool isIntegral() {return false;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static double min() {return -DBL_MAX;} - static double max() {return DBL_MAX;} - static double smallest() {return DBL_MIN;} - static double epsilon() {return DBL_EPSILON;} - static bool isIntegral() {return false;} - static bool isSigned() {return true;} -}; - -template <> -struct limits -{ - static long double min() {return -LDBL_MAX;} - static long double max() {return LDBL_MAX;} - static long double smallest() {return LDBL_MIN;} - static long double epsilon() {return LDBL_EPSILON;} - static bool isIntegral() {return false;} - static bool isSigned() {return true;} -}; - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathLine.h b/3rdparty/include/OpenEXR/ImathLine.h deleted file mode 100644 index 601fc6f977..0000000000 --- a/3rdparty/include/OpenEXR/ImathLine.h +++ /dev/null @@ -1,184 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHLINE_H -#define INCLUDED_IMATHLINE_H - -//------------------------------------- -// -// A 3D line class template -// -//------------------------------------- - -#include "ImathVec.h" -#include "ImathLimits.h" -#include "ImathMatrix.h" - -namespace Imath { - - -template -class Line3 -{ - public: - - Vec3 pos; - Vec3 dir; - - //------------------------------------------------------------- - // Constructors - default is normalized units along direction - //------------------------------------------------------------- - - Line3() {} - Line3(const Vec3& point1, const Vec3& point2); - - //------------------ - // State Query/Set - //------------------ - - void set(const Vec3& point1, - const Vec3& point2); - - //------- - // F(t) - //------- - - Vec3 operator() (T parameter) const; - - //--------- - // Query - //--------- - - T distanceTo(const Vec3& point) const; - T distanceTo(const Line3& line) const; - Vec3 closestPointTo(const Vec3& point) const; - Vec3 closestPointTo(const Line3& line) const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - -typedef Line3 Line3f; -typedef Line3 Line3d; - - -//--------------- -// Implementation -//--------------- - -template -inline Line3::Line3(const Vec3 &p0, const Vec3 &p1) -{ - set(p0,p1); -} - -template -inline void Line3::set(const Vec3 &p0, const Vec3 &p1) -{ - pos = p0; dir = p1-p0; - dir.normalize(); -} - -template -inline Vec3 Line3::operator()(T parameter) const -{ - return pos + dir * parameter; -} - -template -inline T Line3::distanceTo(const Vec3& point) const -{ - return (closestPointTo(point)-point).length(); -} - -template -inline Vec3 Line3::closestPointTo(const Vec3& point) const -{ - return ((point - pos) ^ dir) * dir + pos; -} - -template -inline T Line3::distanceTo(const Line3& line) const -{ - T d = (dir % line.dir) ^ (line.pos - pos); - return (d >= 0)? d: -d; -} - -template -inline Vec3 -Line3::closestPointTo(const Line3& line) const -{ - // Assumes the lines are normalized - - Vec3 posLpos = pos - line.pos ; - T c = dir ^ posLpos; - T a = line.dir ^ dir; - T f = line.dir ^ posLpos ; - T num = c - a * f; - - T denom = a*a - 1; - - T absDenom = ((denom >= 0)? denom: -denom); - - if (absDenom < 1) - { - T absNum = ((num >= 0)? num: -num); - - if (absNum >= absDenom * limits::max()) - return pos; - } - - return pos + dir * (num / denom); -} - -template -std::ostream& operator<< (std::ostream &o, const Line3 &line) -{ - return o << "(" << line.pos << ", " << line.dir << ")"; -} - -template -inline Line3 operator * (const Line3 &line, const Matrix44 &M) -{ - return Line3( line.pos * M, (line.pos + line.dir) * M ); -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathLineAlgo.h b/3rdparty/include/OpenEXR/ImathLineAlgo.h deleted file mode 100644 index 7f6fbaa4df..0000000000 --- a/3rdparty/include/OpenEXR/ImathLineAlgo.h +++ /dev/null @@ -1,333 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHLINEALGO_H -#define INCLUDED_IMATHLINEALGO_H - -//------------------------------------------------------------------ -// -// This file contains algorithms applied to or in conjunction -// with lines (Imath::Line). These algorithms may require -// more headers to compile. The assumption made is that these -// functions are called much less often than the basic line -// functions or these functions require more support classes -// -// Contains: -// -// bool closestPoints(const Line& line1, -// const Line& line2, -// Vec3& point1, -// Vec3& point2) -// -// bool intersect( const Line3 &line, -// const Vec3 &v0, -// const Vec3 &v1, -// const Vec3 &v2, -// Vec3 &pt, -// Vec3 &barycentric, -// bool &front) -// -// V3f -// closestVertex(const Vec3 &v0, -// const Vec3 &v1, -// const Vec3 &v2, -// const Line3 &l) -// -// V3f -// nearestPointOnTriangle(const Vec3 &v0, -// const Vec3 &v1, -// const Vec3 &v2, -// const Line3 &l) -// -// V3f -// rotatePoint(const Vec3 p, Line3 l, float angle) -// -//------------------------------------------------------------------ - -#include "ImathLine.h" -#include "ImathVecAlgo.h" - -namespace Imath { - - -template -bool closestPoints(const Line3& line1, - const Line3& line2, - Vec3& point1, - Vec3& point2) -{ - // - // Compute the closest points on two lines. This was originally - // lifted from inventor. This function assumes that the line - // directions are normalized. The original math has been collapsed. - // - - T A = line1.dir ^ line2.dir; - - if ( A == 1 ) return false; - - T denom = A * A - 1; - - T B = (line1.dir ^ line1.pos) - (line1.dir ^ line2.pos); - T C = (line2.dir ^ line1.pos) - (line2.dir ^ line2.pos); - - point1 = line1(( B - A * C ) / denom); - point2 = line2(( B * A - C ) / denom); - - return true; -} - - - -template -bool intersect( const Line3 &line, - const Vec3 &v0, - const Vec3 &v1, - const Vec3 &v2, - Vec3 &pt, - Vec3 &barycentric, - bool &front) -{ - // Intersect the line with a triangle. - // 1. find plane of triangle - // 2. find intersection point of ray and plane - // 3. pick plane to project point and triangle into - // 4. check each edge of triangle to see if point is inside it - - // - // XXX TODO - this routine is way too long - // - the value of EPSILON is dubious - // - there should be versions of this - // routine that do not calculate the - // barycentric coordinates or the - // front flag - - const float EPSILON = 1e-6; - - T d, t, d01, d12, d20, vd0, vd1, vd2, ax, ay, az, sense; - Vec3 v01, v12, v20, c; - int axis0, axis1; - - // calculate plane for polygon - v01 = v1 - v0; - v12 = v2 - v1; - - // c is un-normalized normal - c = v12.cross(v01); - - d = c.length(); - if(d < EPSILON) - return false; // cant hit a triangle with no area - c = c * (1. / d); - - // calculate distance to plane along ray - - d = line.dir.dot(c); - if (d < EPSILON && d > -EPSILON) - return false; // line is parallel to plane containing triangle - - t = (v0 - line.pos).dot(c) / d; - - if(t < 0) - return false; - - // calculate intersection point - pt = line.pos + t * line.dir; - - // is point inside triangle? Project to 2d to find out - // use the plane that has the largest absolute value - // component in the normal - ax = c[0] < 0 ? -c[0] : c[0]; - ay = c[1] < 0 ? -c[1] : c[1]; - az = c[2] < 0 ? -c[2] : c[2]; - - if(ax > ay && ax > az) - { - // project on x=0 plane - - axis0 = 1; - axis1 = 2; - sense = c[0] < 0 ? -1 : 1; - } - else if(ay > az) - { - axis0 = 2; - axis1 = 0; - sense = c[1] < 0 ? -1 : 1; - } - else - { - axis0 = 0; - axis1 = 1; - sense = c[2] < 0 ? -1 : 1; - } - - // distance from v0-v1 must be less than distance from v2 to v0-v1 - d01 = sense * ((pt[axis0] - v0[axis0]) * v01[axis1] - - (pt[axis1] - v0[axis1]) * v01[axis0]); - - if(d01 < 0) return false; - - vd2 = sense * ((v2[axis0] - v0[axis0]) * v01[axis1] - - (v2[axis1] - v0[axis1]) * v01[axis0]); - - if(d01 > vd2) return false; - - // distance from v1-v2 must be less than distance from v1 to v2-v0 - d12 = sense * ((pt[axis0] - v1[axis0]) * v12[axis1] - - (pt[axis1] - v1[axis1]) * v12[axis0]); - - if(d12 < 0) return false; - - vd0 = sense * ((v0[axis0] - v1[axis0]) * v12[axis1] - - (v0[axis1] - v1[axis1]) * v12[axis0]); - - if(d12 > vd0) return false; - - // calculate v20, and do check on final side of triangle - v20 = v0 - v2; - d20 = sense * ((pt[axis0] - v2[axis0]) * v20[axis1] - - (pt[axis1] - v2[axis1]) * v20[axis0]); - - if(d20 < 0) return false; - - vd1 = sense * ((v1[axis0] - v2[axis0]) * v20[axis1] - - (v1[axis1] - v2[axis1]) * v20[axis0]); - - if(d20 > vd1) return false; - - // vd0, vd1, and vd2 will always be non-zero for a triangle - // that has non-zero area (we return before this for - // zero area triangles) - barycentric = Vec3(d12 / vd0, d20 / vd1, d01 / vd2); - front = line.dir.dot(c) < 0; - - return true; -} - -template -Vec3 -closestVertex(const Vec3 &v0, - const Vec3 &v1, - const Vec3 &v2, - const Line3 &l) -{ - Vec3 nearest = v0; - T neardot = (v0 - l.closestPointTo(v0)).length2(); - - T tmp = (v1 - l.closestPointTo(v1)).length2(); - - if (tmp < neardot) - { - neardot = tmp; - nearest = v1; - } - - tmp = (v2 - l.closestPointTo(v2)).length2(); - if (tmp < neardot) - { - neardot = tmp; - nearest = v2; - } - - return nearest; -} - -template -Vec3 -nearestPointOnTriangle(const Vec3 &v0, - const Vec3 &v1, - const Vec3 &v2, - const Line3 &l) -{ - Vec3 pt, barycentric; - bool front; - - if (intersect (l, v0, v1, v2, pt, barycentric, front)) - return pt; - - // - // The line did not intersect the triangle, so to be picky, you should - // find the closest edge that it passed over/under, but chances are that - // 1) another triangle will be closer - // 2) the app does not need this much precision for a ray that does not - // intersect the triangle - // 3) the expense of the calculation is not worth it since this is the - // common case - // - // XXX TODO This is bogus -- nearestPointOnTriangle() should do - // what its name implies; it should return a point - // on an edge if some edge is closer to the line than - // any vertex. If the application does not want the - // extra calculations, it should be possible to specify - // that; it is not up to this nearestPointOnTriangle() - // to make the decision. - - return closestVertex(v0, v1, v2, l); -} - -template -Vec3 -rotatePoint(const Vec3 p, Line3 l, T angle) -{ - // - // Rotate the point p around the line l by the given angle. - // - - // - // Form a coordinate frame with . The rotation is the in xy - // plane. - // - - Vec3 q = l.closestPointTo(p); - Vec3 x = p - q; - T radius = x.length(); - - x.normalize(); - Vec3 y = (x % l.dir).normalize(); - - T cosangle = Math::cos(angle); - T sinangle = Math::sin(angle); - - Vec3 r = q + x * radius * cosangle + y * radius * sinangle; - - return r; -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathMath.h b/3rdparty/include/OpenEXR/ImathMath.h deleted file mode 100644 index b29356c57e..0000000000 --- a/3rdparty/include/OpenEXR/ImathMath.h +++ /dev/null @@ -1,191 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHMATH_H -#define INCLUDED_IMATHMATH_H - -//---------------------------------------------------------------------------- -// -// ImathMath.h -// -// This file contains template functions which call the double- -// precision math functions defined in math.h (sin(), sqrt(), -// exp() etc.), with specializations that call the faster -// single-precision versions (sinf(), sqrtf(), expf() etc.) -// when appropriate. -// -// Example: -// -// double x = Math::sqrt (3); // calls ::sqrt(double); -// float y = Math::sqrt (3); // calls ::sqrtf(float); -// -// When would I want to use this? -// -// You may be writing a template which needs to call some function -// defined in math.h, for example to extract a square root, but you -// don't know whether to call the single- or the double-precision -// version of this function (sqrt() or sqrtf()): -// -// template -// T -// glorp (T x) -// { -// return sqrt (x + 1); // should call ::sqrtf(float) -// } // if x is a float, but we -// // don't know if it is -// -// Using the templates in this file, you can make sure that -// the appropriate version of the math function is called: -// -// template -// T -// glorp (T x, T y) -// { -// return Math::sqrt (x + 1); // calls ::sqrtf(float) if x -// } // is a float, ::sqrt(double) -// // otherwise -// -//---------------------------------------------------------------------------- - -#include "ImathPlatform.h" -#include - -namespace Imath { - - -template -struct Math -{ - static T acos (T x) {return ::acos (double(x));} - static T asin (T x) {return ::asin (double(x));} - static T atan (T x) {return ::atan (double(x));} - static T atan2 (T x, T y) {return ::atan2 (double(x), double(y));} - static T cos (T x) {return ::cos (double(x));} - static T sin (T x) {return ::sin (double(x));} - static T tan (T x) {return ::tan (double(x));} - static T cosh (T x) {return ::cosh (double(x));} - static T sinh (T x) {return ::sinh (double(x));} - static T tanh (T x) {return ::tanh (double(x));} - static T exp (T x) {return ::exp (double(x));} - static T log (T x) {return ::log (double(x));} - static T log10 (T x) {return ::log10 (double(x));} - static T modf (T x, T *iptr) - { - double ival; - T rval( ::modf (double(x),&ival)); - *iptr = ival; - return rval; - } - static T pow (T x, T y) {return ::pow (double(x), double(y));} - static T sqrt (T x) {return ::sqrt (double(x));} - static T ceil (T x) {return ::ceil (double(x));} - static T fabs (T x) {return ::fabs (double(x));} - static T floor (T x) {return ::floor (double(x));} - static T fmod (T x, T y) {return ::fmod (double(x), double(y));} - static T hypot (T x, T y) {return ::hypot (double(x), double(y));} -}; - - -template <> -struct Math -{ - static float acos (float x) {return ::acosf (x);} - static float asin (float x) {return ::asinf (x);} - static float atan (float x) {return ::atanf (x);} - static float atan2 (float x, float y) {return ::atan2f (x, y);} - static float cos (float x) {return ::cosf (x);} - static float sin (float x) {return ::sinf (x);} - static float tan (float x) {return ::tanf (x);} - static float cosh (float x) {return ::coshf (x);} - static float sinh (float x) {return ::sinhf (x);} - static float tanh (float x) {return ::tanhf (x);} - static float exp (float x) {return ::expf (x);} - static float log (float x) {return ::logf (x);} - static float log10 (float x) {return ::log10f (x);} - static float modf (float x, float *y) {return ::modff (x, y);} - static float pow (float x, float y) {return ::powf (x, y);} - static float sqrt (float x) {return ::sqrtf (x);} - static float ceil (float x) {return ::ceilf (x);} - static float fabs (float x) {return ::fabsf (x);} - static float floor (float x) {return ::floorf (x);} - static float fmod (float x, float y) {return ::fmodf (x, y);} -#if !defined(_MSC_VER) - static float hypot (float x, float y) {return ::hypotf (x, y);} -#else - static float hypot (float x, float y) {return ::sqrtf(x*x + y*y);} -#endif -}; - - -//-------------------------------------------------------------------------- -// Compare two numbers and test if they are "approximately equal": -// -// equalWithAbsError (x1, x2, e) -// -// Returns true if x1 is the same as x2 with an absolute error of -// no more than e, -// -// abs (x1 - x2) <= e -// -// equalWithRelError (x1, x2, e) -// -// Returns true if x1 is the same as x2 with an relative error of -// no more than e, -// -// abs (x1 - x2) <= e * x1 -// -//-------------------------------------------------------------------------- - -template -inline bool -equalWithAbsError (T x1, T x2, T e) -{ - return ((x1 > x2)? x1 - x2: x2 - x1) <= e; -} - - -template -inline bool -equalWithRelError (T x1, T x2, T e) -{ - return ((x1 > x2)? x1 - x2: x2 - x1) <= e * ((x1 > 0)? x1: -x1); -} - - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathMatrix.h b/3rdparty/include/OpenEXR/ImathMatrix.h deleted file mode 100644 index 6192d3c435..0000000000 --- a/3rdparty/include/OpenEXR/ImathMatrix.h +++ /dev/null @@ -1,3249 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHMATRIX_H -#define INCLUDED_IMATHMATRIX_H - -//---------------------------------------------------------------- -// -// 2D (3x3) and 3D (4x4) transformation matrix templates. -// -//---------------------------------------------------------------- - -#include "ImathPlatform.h" -#include "ImathFun.h" -#include "ImathExc.h" -#include "ImathVec.h" -#include "ImathShear.h" - -#include -#include - - -namespace Imath { - - -template class Matrix33 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T x[3][3]; - - T * operator [] (int i); - const T * operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Matrix33 (); - // 1 0 0 - // 0 1 0 - // 0 0 1 - - Matrix33 (T a); - // a a a - // a a a - // a a a - - Matrix33 (const T a[3][3]); - // a[0][0] a[0][1] a[0][2] - // a[1][0] a[1][1] a[1][2] - // a[2][0] a[2][1] a[2][2] - - Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i); - - // a b c - // d e f - // g h i - - - //-------------------------------- - // Copy constructor and assignment - //-------------------------------- - - Matrix33 (const Matrix33 &v); - - const Matrix33 & operator = (const Matrix33 &v); - const Matrix33 & operator = (T a); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - T * getValue (); - const T * getValue () const; - - template - void getValue (Matrix33 &v) const; - template - Matrix33 & setValue (const Matrix33 &v); - - template - Matrix33 & setTheMatrix (const Matrix33 &v); - - - //--------- - // Identity - //--------- - - void makeIdentity(); - - - //--------- - // Equality - //--------- - - bool operator == (const Matrix33 &v) const; - bool operator != (const Matrix33 &v) const; - - //----------------------------------------------------------------------- - // Compare two matrices and test if they are "approximately equal": - // - // equalWithAbsError (m, e) - // - // Returns true if the coefficients of this and m are the same with - // an absolute error of no more than e, i.e., for all i, j - // - // abs (this[i][j] - m[i][j]) <= e - // - // equalWithRelError (m, e) - // - // Returns true if the coefficients of this and m are the same with - // a relative error of no more than e, i.e., for all i, j - // - // abs (this[i] - v[i][j]) <= e * abs (this[i][j]) - //----------------------------------------------------------------------- - - bool equalWithAbsError (const Matrix33 &v, T e) const; - bool equalWithRelError (const Matrix33 &v, T e) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Matrix33 & operator += (const Matrix33 &v); - const Matrix33 & operator += (T a); - Matrix33 operator + (const Matrix33 &v) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Matrix33 & operator -= (const Matrix33 &v); - const Matrix33 & operator -= (T a); - Matrix33 operator - (const Matrix33 &v) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Matrix33 operator - () const; - const Matrix33 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Matrix33 & operator *= (T a); - Matrix33 operator * (T a) const; - - - //----------------------------------- - // Matrix-times-matrix multiplication - //----------------------------------- - - const Matrix33 & operator *= (const Matrix33 &v); - Matrix33 operator * (const Matrix33 &v) const; - - - //--------------------------------------------- - // Vector-times-matrix multiplication; see also - // the "operator *" functions defined below. - //--------------------------------------------- - - template - void multVecMatrix(const Vec2 &src, Vec2 &dst) const; - - template - void multDirMatrix(const Vec2 &src, Vec2 &dst) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Matrix33 & operator /= (T a); - Matrix33 operator / (T a) const; - - - //------------------ - // Transposed matrix - //------------------ - - const Matrix33 & transpose (); - Matrix33 transposed () const; - - - //------------------------------------------------------------ - // Inverse matrix: If singExc is false, inverting a singular - // matrix produces an identity matrix. If singExc is true, - // inverting a singular matrix throws a SingMatrixExc. - // - // inverse() and invert() invert matrices using determinants; - // gjInverse() and gjInvert() use the Gauss-Jordan method. - // - // inverse() and invert() are significantly faster than - // gjInverse() and gjInvert(), but the results may be slightly - // less accurate. - // - //------------------------------------------------------------ - - const Matrix33 & invert (bool singExc = false) - throw (Iex::MathExc); - - Matrix33 inverse (bool singExc = false) const - throw (Iex::MathExc); - - const Matrix33 & gjInvert (bool singExc = false) - throw (Iex::MathExc); - - Matrix33 gjInverse (bool singExc = false) const - throw (Iex::MathExc); - - - //----------------------------------------- - // Set matrix to rotation by r (in radians) - //----------------------------------------- - - template - const Matrix33 & setRotation (S r); - - - //----------------------------- - // Rotate the given matrix by r - //----------------------------- - - template - const Matrix33 & rotate (S r); - - - //-------------------------------------------- - // Set matrix to scale by given uniform factor - //-------------------------------------------- - - const Matrix33 & setScale (T s); - - - //------------------------------------ - // Set matrix to scale by given vector - //------------------------------------ - - template - const Matrix33 & setScale (const Vec2 &s); - - - //---------------------- - // Scale the matrix by s - //---------------------- - - template - const Matrix33 & scale (const Vec2 &s); - - - //------------------------------------------ - // Set matrix to translation by given vector - //------------------------------------------ - - template - const Matrix33 & setTranslation (const Vec2 &t); - - - //----------------------------- - // Return translation component - //----------------------------- - - Vec2 translation () const; - - - //-------------------------- - // Translate the matrix by t - //-------------------------- - - template - const Matrix33 & translate (const Vec2 &t); - - - //----------------------------------------------------------- - // Set matrix to shear x for each y coord. by given factor xy - //----------------------------------------------------------- - - template - const Matrix33 & setShear (const S &h); - - - //------------------------------------------------------------- - // Set matrix to shear x for each y coord. by given factor h[0] - // and to shear y for each x coord. by given factor h[1] - //------------------------------------------------------------- - - template - const Matrix33 & setShear (const Vec2 &h); - - - //----------------------------------------------------------- - // Shear the matrix in x for each y coord. by given factor xy - //----------------------------------------------------------- - - template - const Matrix33 & shear (const S &xy); - - - //----------------------------------------------------------- - // Shear the matrix in x for each y coord. by given factor xy - // and shear y for each x coord. by given factor yx - //----------------------------------------------------------- - - template - const Matrix33 & shear (const Vec2 &h); - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} -}; - - -template class Matrix44 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T x[4][4]; - - T * operator [] (int i); - const T * operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Matrix44 (); - // 1 0 0 0 - // 0 1 0 0 - // 0 0 1 0 - // 0 0 0 1 - - Matrix44 (T a); - // a a a a - // a a a a - // a a a a - // a a a a - - Matrix44 (const T a[4][4]) ; - // a[0][0] a[0][1] a[0][2] a[0][3] - // a[1][0] a[1][1] a[1][2] a[1][3] - // a[2][0] a[2][1] a[2][2] a[2][3] - // a[3][0] a[3][1] a[3][2] a[3][3] - - Matrix44 (T a, T b, T c, T d, T e, T f, T g, T h, - T i, T j, T k, T l, T m, T n, T o, T p); - - // a b c d - // e f g h - // i j k l - // m n o p - - Matrix44 (Matrix33 r, Vec3 t); - // r r r 0 - // r r r 0 - // r r r 0 - // t t t 1 - - - //-------------------------------- - // Copy constructor and assignment - //-------------------------------- - - Matrix44 (const Matrix44 &v); - - const Matrix44 & operator = (const Matrix44 &v); - const Matrix44 & operator = (T a); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - T * getValue (); - const T * getValue () const; - - template - void getValue (Matrix44 &v) const; - template - Matrix44 & setValue (const Matrix44 &v); - - template - Matrix44 & setTheMatrix (const Matrix44 &v); - - //--------- - // Identity - //--------- - - void makeIdentity(); - - - //--------- - // Equality - //--------- - - bool operator == (const Matrix44 &v) const; - bool operator != (const Matrix44 &v) const; - - //----------------------------------------------------------------------- - // Compare two matrices and test if they are "approximately equal": - // - // equalWithAbsError (m, e) - // - // Returns true if the coefficients of this and m are the same with - // an absolute error of no more than e, i.e., for all i, j - // - // abs (this[i][j] - m[i][j]) <= e - // - // equalWithRelError (m, e) - // - // Returns true if the coefficients of this and m are the same with - // a relative error of no more than e, i.e., for all i, j - // - // abs (this[i] - v[i][j]) <= e * abs (this[i][j]) - //----------------------------------------------------------------------- - - bool equalWithAbsError (const Matrix44 &v, T e) const; - bool equalWithRelError (const Matrix44 &v, T e) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Matrix44 & operator += (const Matrix44 &v); - const Matrix44 & operator += (T a); - Matrix44 operator + (const Matrix44 &v) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Matrix44 & operator -= (const Matrix44 &v); - const Matrix44 & operator -= (T a); - Matrix44 operator - (const Matrix44 &v) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Matrix44 operator - () const; - const Matrix44 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Matrix44 & operator *= (T a); - Matrix44 operator * (T a) const; - - - //----------------------------------- - // Matrix-times-matrix multiplication - //----------------------------------- - - const Matrix44 & operator *= (const Matrix44 &v); - Matrix44 operator * (const Matrix44 &v) const; - - static void multiply (const Matrix44 &a, // assumes that - const Matrix44 &b, // &a != &c and - Matrix44 &c); // &b != &c. - - - //--------------------------------------------- - // Vector-times-matrix multiplication; see also - // the "operator *" functions defined below. - //--------------------------------------------- - - template - void multVecMatrix(const Vec3 &src, Vec3 &dst) const; - - template - void multDirMatrix(const Vec3 &src, Vec3 &dst) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Matrix44 & operator /= (T a); - Matrix44 operator / (T a) const; - - - //------------------ - // Transposed matrix - //------------------ - - const Matrix44 & transpose (); - Matrix44 transposed () const; - - - //------------------------------------------------------------ - // Inverse matrix: If singExc is false, inverting a singular - // matrix produces an identity matrix. If singExc is true, - // inverting a singular matrix throws a SingMatrixExc. - // - // inverse() and invert() invert matrices using determinants; - // gjInverse() and gjInvert() use the Gauss-Jordan method. - // - // inverse() and invert() are significantly faster than - // gjInverse() and gjInvert(), but the results may be slightly - // less accurate. - // - //------------------------------------------------------------ - - const Matrix44 & invert (bool singExc = false) - throw (Iex::MathExc); - - Matrix44 inverse (bool singExc = false) const - throw (Iex::MathExc); - - const Matrix44 & gjInvert (bool singExc = false) - throw (Iex::MathExc); - - Matrix44 gjInverse (bool singExc = false) const - throw (Iex::MathExc); - - - //-------------------------------------------------------- - // Set matrix to rotation by XYZ euler angles (in radians) - //-------------------------------------------------------- - - template - const Matrix44 & setEulerAngles (const Vec3& r); - - - //-------------------------------------------------------- - // Set matrix to rotation around given axis by given angle - //-------------------------------------------------------- - - template - const Matrix44 & setAxisAngle (const Vec3& ax, S ang); - - - //------------------------------------------- - // Rotate the matrix by XYZ euler angles in r - //------------------------------------------- - - template - const Matrix44 & rotate (const Vec3 &r); - - - //-------------------------------------------- - // Set matrix to scale by given uniform factor - //-------------------------------------------- - - const Matrix44 & setScale (T s); - - - //------------------------------------ - // Set matrix to scale by given vector - //------------------------------------ - - template - const Matrix44 & setScale (const Vec3 &s); - - - //---------------------- - // Scale the matrix by s - //---------------------- - - template - const Matrix44 & scale (const Vec3 &s); - - - //------------------------------------------ - // Set matrix to translation by given vector - //------------------------------------------ - - template - const Matrix44 & setTranslation (const Vec3 &t); - - - //----------------------------- - // Return translation component - //----------------------------- - - const Vec3 translation () const; - - - //-------------------------- - // Translate the matrix by t - //-------------------------- - - template - const Matrix44 & translate (const Vec3 &t); - - - //------------------------------------------------------------- - // Set matrix to shear by given vector h. The resulting matrix - // will shear x for each y coord. by a factor of h[0] ; - // will shear x for each z coord. by a factor of h[1] ; - // will shear y for each z coord. by a factor of h[2] . - //------------------------------------------------------------- - - template - const Matrix44 & setShear (const Vec3 &h); - - - //------------------------------------------------------------ - // Set matrix to shear by given factors. The resulting matrix - // will shear x for each y coord. by a factor of h.xy ; - // will shear x for each z coord. by a factor of h.xz ; - // will shear y for each z coord. by a factor of h.yz ; - // will shear y for each x coord. by a factor of h.yx ; - // will shear z for each x coord. by a factor of h.zx ; - // will shear z for each y coord. by a factor of h.zy . - //------------------------------------------------------------ - - template - const Matrix44 & setShear (const Shear6 &h); - - - //-------------------------------------------------------- - // Shear the matrix by given vector. The composed matrix - // will be * , where the shear matrix ... - // will shear x for each y coord. by a factor of h[0] ; - // will shear x for each z coord. by a factor of h[1] ; - // will shear y for each z coord. by a factor of h[2] . - //-------------------------------------------------------- - - template - const Matrix44 & shear (const Vec3 &h); - - - //------------------------------------------------------------ - // Shear the matrix by the given factors. The composed matrix - // will be * , where the shear matrix ... - // will shear x for each y coord. by a factor of h.xy ; - // will shear x for each z coord. by a factor of h.xz ; - // will shear y for each z coord. by a factor of h.yz ; - // will shear y for each x coord. by a factor of h.yx ; - // will shear z for each x coord. by a factor of h.zx ; - // will shear z for each y coord. by a factor of h.zy . - //------------------------------------------------------------ - - template - const Matrix44 & shear (const Shear6 &h); - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} -}; - - -//-------------- -// Stream output -//-------------- - -template -std::ostream & operator << (std::ostream & s, const Matrix33 &m); - -template -std::ostream & operator << (std::ostream & s, const Matrix44 &m); - - -//--------------------------------------------- -// Vector-times-matrix multiplication operators -//--------------------------------------------- - -template -const Vec2 & operator *= (Vec2 &v, const Matrix33 &m); - -template -Vec2 operator * (const Vec2 &v, const Matrix33 &m); - -template -const Vec3 & operator *= (Vec3 &v, const Matrix33 &m); - -template -Vec3 operator * (const Vec3 &v, const Matrix33 &m); - -template -const Vec3 & operator *= (Vec3 &v, const Matrix44 &m); - -template -Vec3 operator * (const Vec3 &v, const Matrix44 &m); - - -//------------------------- -// Typedefs for convenience -//------------------------- - -typedef Matrix33 M33f; -typedef Matrix33 M33d; -typedef Matrix44 M44f; -typedef Matrix44 M44d; - - -//--------------------------- -// Implementation of Matrix33 -//--------------------------- - -template -inline T * -Matrix33::operator [] (int i) -{ - return x[i]; -} - -template -inline const T * -Matrix33::operator [] (int i) const -{ - return x[i]; -} - -template -inline -Matrix33::Matrix33 () -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; -} - -template -inline -Matrix33::Matrix33 (T a) -{ - x[0][0] = a; - x[0][1] = a; - x[0][2] = a; - x[1][0] = a; - x[1][1] = a; - x[1][2] = a; - x[2][0] = a; - x[2][1] = a; - x[2][2] = a; -} - -template -inline -Matrix33::Matrix33 (const T a[3][3]) -{ - x[0][0] = a[0][0]; - x[0][1] = a[0][1]; - x[0][2] = a[0][2]; - x[1][0] = a[1][0]; - x[1][1] = a[1][1]; - x[1][2] = a[1][2]; - x[2][0] = a[2][0]; - x[2][1] = a[2][1]; - x[2][2] = a[2][2]; -} - -template -inline -Matrix33::Matrix33 (T a, T b, T c, T d, T e, T f, T g, T h, T i) -{ - x[0][0] = a; - x[0][1] = b; - x[0][2] = c; - x[1][0] = d; - x[1][1] = e; - x[1][2] = f; - x[2][0] = g; - x[2][1] = h; - x[2][2] = i; -} - -template -inline -Matrix33::Matrix33 (const Matrix33 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; -} - -template -inline const Matrix33 & -Matrix33::operator = (const Matrix33 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - return *this; -} - -template -inline const Matrix33 & -Matrix33::operator = (T a) -{ - x[0][0] = a; - x[0][1] = a; - x[0][2] = a; - x[1][0] = a; - x[1][1] = a; - x[1][2] = a; - x[2][0] = a; - x[2][1] = a; - x[2][2] = a; - return *this; -} - -template -inline T * -Matrix33::getValue () -{ - return (T *) &x[0][0]; -} - -template -inline const T * -Matrix33::getValue () const -{ - return (const T *) &x[0][0]; -} - -template -template -inline void -Matrix33::getValue (Matrix33 &v) const -{ - v.x[0][0] = x[0][0]; - v.x[0][1] = x[0][1]; - v.x[0][2] = x[0][2]; - v.x[1][0] = x[1][0]; - v.x[1][1] = x[1][1]; - v.x[1][2] = x[1][2]; - v.x[2][0] = x[2][0]; - v.x[2][1] = x[2][1]; - v.x[2][2] = x[2][2]; -} - -template -template -inline Matrix33 & -Matrix33::setValue (const Matrix33 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - return *this; -} - -template -template -inline Matrix33 & -Matrix33::setTheMatrix (const Matrix33 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - return *this; -} - -template -inline void -Matrix33::makeIdentity() -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; -} - -template -bool -Matrix33::operator == (const Matrix33 &v) const -{ - return x[0][0] == v.x[0][0] && - x[0][1] == v.x[0][1] && - x[0][2] == v.x[0][2] && - x[1][0] == v.x[1][0] && - x[1][1] == v.x[1][1] && - x[1][2] == v.x[1][2] && - x[2][0] == v.x[2][0] && - x[2][1] == v.x[2][1] && - x[2][2] == v.x[2][2]; -} - -template -bool -Matrix33::operator != (const Matrix33 &v) const -{ - return x[0][0] != v.x[0][0] || - x[0][1] != v.x[0][1] || - x[0][2] != v.x[0][2] || - x[1][0] != v.x[1][0] || - x[1][1] != v.x[1][1] || - x[1][2] != v.x[1][2] || - x[2][0] != v.x[2][0] || - x[2][1] != v.x[2][1] || - x[2][2] != v.x[2][2]; -} - -template -bool -Matrix33::equalWithAbsError (const Matrix33 &m, T e) const -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (!Imath::equalWithAbsError ((*this)[i][j], m[i][j], e)) - return false; - - return true; -} - -template -bool -Matrix33::equalWithRelError (const Matrix33 &m, T e) const -{ - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (!Imath::equalWithRelError ((*this)[i][j], m[i][j], e)) - return false; - - return true; -} - -template -const Matrix33 & -Matrix33::operator += (const Matrix33 &v) -{ - x[0][0] += v.x[0][0]; - x[0][1] += v.x[0][1]; - x[0][2] += v.x[0][2]; - x[1][0] += v.x[1][0]; - x[1][1] += v.x[1][1]; - x[1][2] += v.x[1][2]; - x[2][0] += v.x[2][0]; - x[2][1] += v.x[2][1]; - x[2][2] += v.x[2][2]; - - return *this; -} - -template -const Matrix33 & -Matrix33::operator += (T a) -{ - x[0][0] += a; - x[0][1] += a; - x[0][2] += a; - x[1][0] += a; - x[1][1] += a; - x[1][2] += a; - x[2][0] += a; - x[2][1] += a; - x[2][2] += a; - - return *this; -} - -template -Matrix33 -Matrix33::operator + (const Matrix33 &v) const -{ - return Matrix33 (x[0][0] + v.x[0][0], - x[0][1] + v.x[0][1], - x[0][2] + v.x[0][2], - x[1][0] + v.x[1][0], - x[1][1] + v.x[1][1], - x[1][2] + v.x[1][2], - x[2][0] + v.x[2][0], - x[2][1] + v.x[2][1], - x[2][2] + v.x[2][2]); -} - -template -const Matrix33 & -Matrix33::operator -= (const Matrix33 &v) -{ - x[0][0] -= v.x[0][0]; - x[0][1] -= v.x[0][1]; - x[0][2] -= v.x[0][2]; - x[1][0] -= v.x[1][0]; - x[1][1] -= v.x[1][1]; - x[1][2] -= v.x[1][2]; - x[2][0] -= v.x[2][0]; - x[2][1] -= v.x[2][1]; - x[2][2] -= v.x[2][2]; - - return *this; -} - -template -const Matrix33 & -Matrix33::operator -= (T a) -{ - x[0][0] -= a; - x[0][1] -= a; - x[0][2] -= a; - x[1][0] -= a; - x[1][1] -= a; - x[1][2] -= a; - x[2][0] -= a; - x[2][1] -= a; - x[2][2] -= a; - - return *this; -} - -template -Matrix33 -Matrix33::operator - (const Matrix33 &v) const -{ - return Matrix33 (x[0][0] - v.x[0][0], - x[0][1] - v.x[0][1], - x[0][2] - v.x[0][2], - x[1][0] - v.x[1][0], - x[1][1] - v.x[1][1], - x[1][2] - v.x[1][2], - x[2][0] - v.x[2][0], - x[2][1] - v.x[2][1], - x[2][2] - v.x[2][2]); -} - -template -Matrix33 -Matrix33::operator - () const -{ - return Matrix33 (-x[0][0], - -x[0][1], - -x[0][2], - -x[1][0], - -x[1][1], - -x[1][2], - -x[2][0], - -x[2][1], - -x[2][2]); -} - -template -const Matrix33 & -Matrix33::negate () -{ - x[0][0] = -x[0][0]; - x[0][1] = -x[0][1]; - x[0][2] = -x[0][2]; - x[1][0] = -x[1][0]; - x[1][1] = -x[1][1]; - x[1][2] = -x[1][2]; - x[2][0] = -x[2][0]; - x[2][1] = -x[2][1]; - x[2][2] = -x[2][2]; - - return *this; -} - -template -const Matrix33 & -Matrix33::operator *= (T a) -{ - x[0][0] *= a; - x[0][1] *= a; - x[0][2] *= a; - x[1][0] *= a; - x[1][1] *= a; - x[1][2] *= a; - x[2][0] *= a; - x[2][1] *= a; - x[2][2] *= a; - - return *this; -} - -template -Matrix33 -Matrix33::operator * (T a) const -{ - return Matrix33 (x[0][0] * a, - x[0][1] * a, - x[0][2] * a, - x[1][0] * a, - x[1][1] * a, - x[1][2] * a, - x[2][0] * a, - x[2][1] * a, - x[2][2] * a); -} - -template -inline Matrix33 -operator * (T a, const Matrix33 &v) -{ - return v * a; -} - -template -const Matrix33 & -Matrix33::operator *= (const Matrix33 &v) -{ - Matrix33 tmp (T (0)); - - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - for (int k = 0; k < 3; k++) - tmp.x[i][j] += x[i][k] * v.x[k][j]; - - *this = tmp; - return *this; -} - -template -Matrix33 -Matrix33::operator * (const Matrix33 &v) const -{ - Matrix33 tmp (T (0)); - - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - for (int k = 0; k < 3; k++) - tmp.x[i][j] += x[i][k] * v.x[k][j]; - - return tmp; -} - -template -template -void -Matrix33::multVecMatrix(const Vec2 &src, Vec2 &dst) const -{ - S a, b, w; - - a = src[0] * x[0][0] + src[1] * x[1][0] + x[2][0]; - b = src[0] * x[0][1] + src[1] * x[1][1] + x[2][1]; - w = src[0] * x[0][2] + src[1] * x[1][2] + x[2][2]; - - dst.x = a / w; - dst.y = b / w; -} - -template -template -void -Matrix33::multDirMatrix(const Vec2 &src, Vec2 &dst) const -{ - S a, b; - - a = src[0] * x[0][0] + src[1] * x[1][0]; - b = src[0] * x[0][1] + src[1] * x[1][1]; - - dst.x = a; - dst.y = b; -} - -template -const Matrix33 & -Matrix33::operator /= (T a) -{ - x[0][0] /= a; - x[0][1] /= a; - x[0][2] /= a; - x[1][0] /= a; - x[1][1] /= a; - x[1][2] /= a; - x[2][0] /= a; - x[2][1] /= a; - x[2][2] /= a; - - return *this; -} - -template -Matrix33 -Matrix33::operator / (T a) const -{ - return Matrix33 (x[0][0] / a, - x[0][1] / a, - x[0][2] / a, - x[1][0] / a, - x[1][1] / a, - x[1][2] / a, - x[2][0] / a, - x[2][1] / a, - x[2][2] / a); -} - -template -const Matrix33 & -Matrix33::transpose () -{ - Matrix33 tmp (x[0][0], - x[1][0], - x[2][0], - x[0][1], - x[1][1], - x[2][1], - x[0][2], - x[1][2], - x[2][2]); - *this = tmp; - return *this; -} - -template -Matrix33 -Matrix33::transposed () const -{ - return Matrix33 (x[0][0], - x[1][0], - x[2][0], - x[0][1], - x[1][1], - x[2][1], - x[0][2], - x[1][2], - x[2][2]); -} - -template -const Matrix33 & -Matrix33::gjInvert (bool singExc) throw (Iex::MathExc) -{ - *this = gjInverse (singExc); - return *this; -} - -template -Matrix33 -Matrix33::gjInverse (bool singExc) const throw (Iex::MathExc) -{ - int i, j, k; - Matrix33 s; - Matrix33 t (*this); - - // Forward elimination - - for (i = 0; i < 2 ; i++) - { - int pivot = i; - - T pivotsize = t[i][i]; - - if (pivotsize < 0) - pivotsize = -pivotsize; - - for (j = i + 1; j < 3; j++) - { - T tmp = t[j][i]; - - if (tmp < 0) - tmp = -tmp; - - if (tmp > pivotsize) - { - pivot = j; - pivotsize = tmp; - } - } - - if (pivotsize == 0) - { - if (singExc) - throw ::Imath::SingMatrixExc ("Cannot invert singular matrix."); - - return Matrix33(); - } - - if (pivot != i) - { - for (j = 0; j < 3; j++) - { - T tmp; - - tmp = t[i][j]; - t[i][j] = t[pivot][j]; - t[pivot][j] = tmp; - - tmp = s[i][j]; - s[i][j] = s[pivot][j]; - s[pivot][j] = tmp; - } - } - - for (j = i + 1; j < 3; j++) - { - T f = t[j][i] / t[i][i]; - - for (k = 0; k < 3; k++) - { - t[j][k] -= f * t[i][k]; - s[j][k] -= f * s[i][k]; - } - } - } - - // Backward substitution - - for (i = 2; i >= 0; --i) - { - T f; - - if ((f = t[i][i]) == 0) - { - if (singExc) - throw ::Imath::SingMatrixExc ("Cannot invert singular matrix."); - - return Matrix33(); - } - - for (j = 0; j < 3; j++) - { - t[i][j] /= f; - s[i][j] /= f; - } - - for (j = 0; j < i; j++) - { - f = t[j][i]; - - for (k = 0; k < 3; k++) - { - t[j][k] -= f * t[i][k]; - s[j][k] -= f * s[i][k]; - } - } - } - - return s; -} - -template -const Matrix33 & -Matrix33::invert (bool singExc) throw (Iex::MathExc) -{ - *this = inverse (singExc); - return *this; -} - -template -Matrix33 -Matrix33::inverse (bool singExc) const throw (Iex::MathExc) -{ - if (x[0][2] != 0 || x[1][2] != 0 || x[2][2] != 1) - { - Matrix33 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], - x[2][1] * x[0][2] - x[0][1] * x[2][2], - x[0][1] * x[1][2] - x[1][1] * x[0][2], - - x[2][0] * x[1][2] - x[1][0] * x[2][2], - x[0][0] * x[2][2] - x[2][0] * x[0][2], - x[1][0] * x[0][2] - x[0][0] * x[1][2], - - x[1][0] * x[2][1] - x[2][0] * x[1][1], - x[2][0] * x[0][1] - x[0][0] * x[2][1], - x[0][0] * x[1][1] - x[1][0] * x[0][1]); - - T r = x[0][0] * s[0][0] + x[0][1] * s[1][0] + x[0][2] * s[2][0]; - - if (Imath::abs (r) >= 1) - { - for (int i = 0; i < 3; ++i) - { - for (int j = 0; j < 3; ++j) - { - s[i][j] /= r; - } - } - } - else - { - T mr = Imath::abs (r) / limits::smallest(); - - for (int i = 0; i < 3; ++i) - { - for (int j = 0; j < 3; ++j) - { - if (mr > Imath::abs (s[i][j])) - { - s[i][j] /= r; - } - else - { - if (singExc) - throw SingMatrixExc ("Cannot invert " - "singular matrix."); - return Matrix33(); - } - } - } - } - - return s; - } - else - { - Matrix33 s ( x[1][1], - -x[0][1], - 0, - - -x[1][0], - x[0][0], - 0, - - 0, - 0, - 1); - - T r = x[0][0] * x[1][1] - x[1][0] * x[0][1]; - - if (Imath::abs (r) >= 1) - { - for (int i = 0; i < 2; ++i) - { - for (int j = 0; j < 2; ++j) - { - s[i][j] /= r; - } - } - } - else - { - T mr = Imath::abs (r) / limits::smallest(); - - for (int i = 0; i < 2; ++i) - { - for (int j = 0; j < 2; ++j) - { - if (mr > Imath::abs (s[i][j])) - { - s[i][j] /= r; - } - else - { - if (singExc) - throw SingMatrixExc ("Cannot invert " - "singular matrix."); - return Matrix33(); - } - } - } - } - - s[2][0] = -x[2][0] * s[0][0] - x[2][1] * s[1][0]; - s[2][1] = -x[2][0] * s[0][1] - x[2][1] * s[1][1]; - - return s; - } -} - -template -template -const Matrix33 & -Matrix33::setRotation (S r) -{ - S cos_r, sin_r; - - cos_r = Math::cos (r); - sin_r = Math::sin (r); - - x[0][0] = cos_r; - x[0][1] = sin_r; - x[0][2] = 0; - - x[1][0] = -sin_r; - x[1][1] = cos_r; - x[1][2] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::rotate (S r) -{ - *this *= Matrix33().setRotation (r); - return *this; -} - -template -const Matrix33 & -Matrix33::setScale (T s) -{ - x[0][0] = s; - x[0][1] = 0; - x[0][2] = 0; - - x[1][0] = 0; - x[1][1] = s; - x[1][2] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::setScale (const Vec2 &s) -{ - x[0][0] = s[0]; - x[0][1] = 0; - x[0][2] = 0; - - x[1][0] = 0; - x[1][1] = s[1]; - x[1][2] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::scale (const Vec2 &s) -{ - x[0][0] *= s[0]; - x[0][1] *= s[0]; - x[0][2] *= s[0]; - - x[1][0] *= s[1]; - x[1][1] *= s[1]; - x[1][2] *= s[1]; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::setTranslation (const Vec2 &t) -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - - x[2][0] = t[0]; - x[2][1] = t[1]; - x[2][2] = 1; - - return *this; -} - -template -inline Vec2 -Matrix33::translation () const -{ - return Vec2 (x[2][0], x[2][1]); -} - -template -template -const Matrix33 & -Matrix33::translate (const Vec2 &t) -{ - x[2][0] += t[0] * x[0][0] + t[1] * x[1][0]; - x[2][1] += t[0] * x[0][1] + t[1] * x[1][1]; - x[2][2] += t[0] * x[0][2] + t[1] * x[1][2]; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::setShear (const S &xy) -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - - x[1][0] = xy; - x[1][1] = 1; - x[1][2] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::setShear (const Vec2 &h) -{ - x[0][0] = 1; - x[0][1] = h[1]; - x[0][2] = 0; - - x[1][0] = h[0]; - x[1][1] = 1; - x[1][2] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::shear (const S &xy) -{ - // - // In this case, we don't need a temp. copy of the matrix - // because we never use a value on the RHS after we've - // changed it on the LHS. - // - - x[1][0] += xy * x[0][0]; - x[1][1] += xy * x[0][1]; - x[1][2] += xy * x[0][2]; - - return *this; -} - -template -template -const Matrix33 & -Matrix33::shear (const Vec2 &h) -{ - Matrix33 P (*this); - - x[0][0] = P[0][0] + h[1] * P[1][0]; - x[0][1] = P[0][1] + h[1] * P[1][1]; - x[0][2] = P[0][2] + h[1] * P[1][2]; - - x[1][0] = P[1][0] + h[0] * P[0][0]; - x[1][1] = P[1][1] + h[0] * P[0][1]; - x[1][2] = P[1][2] + h[0] * P[0][2]; - - return *this; -} - - -//--------------------------- -// Implementation of Matrix44 -//--------------------------- - -template -inline T * -Matrix44::operator [] (int i) -{ - return x[i]; -} - -template -inline const T * -Matrix44::operator [] (int i) const -{ - return x[i]; -} - -template -inline -Matrix44::Matrix44 () -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - x[1][3] = 0; - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - x[2][3] = 0; - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; -} - -template -inline -Matrix44::Matrix44 (T a) -{ - x[0][0] = a; - x[0][1] = a; - x[0][2] = a; - x[0][3] = a; - x[1][0] = a; - x[1][1] = a; - x[1][2] = a; - x[1][3] = a; - x[2][0] = a; - x[2][1] = a; - x[2][2] = a; - x[2][3] = a; - x[3][0] = a; - x[3][1] = a; - x[3][2] = a; - x[3][3] = a; -} - -template -inline -Matrix44::Matrix44 (const T a[4][4]) -{ - x[0][0] = a[0][0]; - x[0][1] = a[0][1]; - x[0][2] = a[0][2]; - x[0][3] = a[0][3]; - x[1][0] = a[1][0]; - x[1][1] = a[1][1]; - x[1][2] = a[1][2]; - x[1][3] = a[1][3]; - x[2][0] = a[2][0]; - x[2][1] = a[2][1]; - x[2][2] = a[2][2]; - x[2][3] = a[2][3]; - x[3][0] = a[3][0]; - x[3][1] = a[3][1]; - x[3][2] = a[3][2]; - x[3][3] = a[3][3]; -} - -template -inline -Matrix44::Matrix44 (T a, T b, T c, T d, T e, T f, T g, T h, - T i, T j, T k, T l, T m, T n, T o, T p) -{ - x[0][0] = a; - x[0][1] = b; - x[0][2] = c; - x[0][3] = d; - x[1][0] = e; - x[1][1] = f; - x[1][2] = g; - x[1][3] = h; - x[2][0] = i; - x[2][1] = j; - x[2][2] = k; - x[2][3] = l; - x[3][0] = m; - x[3][1] = n; - x[3][2] = o; - x[3][3] = p; -} - - -template -inline -Matrix44::Matrix44 (Matrix33 r, Vec3 t) -{ - x[0][0] = r[0][0]; - x[0][1] = r[0][1]; - x[0][2] = r[0][2]; - x[0][3] = 0; - x[1][0] = r[1][0]; - x[1][1] = r[1][1]; - x[1][2] = r[1][2]; - x[1][3] = 0; - x[2][0] = r[2][0]; - x[2][1] = r[2][1]; - x[2][2] = r[2][2]; - x[2][3] = 0; - x[3][0] = t[0]; - x[3][1] = t[1]; - x[3][2] = t[2]; - x[3][3] = 1; -} - -template -inline -Matrix44::Matrix44 (const Matrix44 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[0][3] = v.x[0][3]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[1][3] = v.x[1][3]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - x[2][3] = v.x[2][3]; - x[3][0] = v.x[3][0]; - x[3][1] = v.x[3][1]; - x[3][2] = v.x[3][2]; - x[3][3] = v.x[3][3]; -} - -template -inline const Matrix44 & -Matrix44::operator = (const Matrix44 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[0][3] = v.x[0][3]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[1][3] = v.x[1][3]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - x[2][3] = v.x[2][3]; - x[3][0] = v.x[3][0]; - x[3][1] = v.x[3][1]; - x[3][2] = v.x[3][2]; - x[3][3] = v.x[3][3]; - return *this; -} - -template -inline const Matrix44 & -Matrix44::operator = (T a) -{ - x[0][0] = a; - x[0][1] = a; - x[0][2] = a; - x[0][3] = a; - x[1][0] = a; - x[1][1] = a; - x[1][2] = a; - x[1][3] = a; - x[2][0] = a; - x[2][1] = a; - x[2][2] = a; - x[2][3] = a; - x[3][0] = a; - x[3][1] = a; - x[3][2] = a; - x[3][3] = a; - return *this; -} - -template -inline T * -Matrix44::getValue () -{ - return (T *) &x[0][0]; -} - -template -inline const T * -Matrix44::getValue () const -{ - return (const T *) &x[0][0]; -} - -template -template -inline void -Matrix44::getValue (Matrix44 &v) const -{ - v.x[0][0] = x[0][0]; - v.x[0][1] = x[0][1]; - v.x[0][2] = x[0][2]; - v.x[0][3] = x[0][3]; - v.x[1][0] = x[1][0]; - v.x[1][1] = x[1][1]; - v.x[1][2] = x[1][2]; - v.x[1][3] = x[1][3]; - v.x[2][0] = x[2][0]; - v.x[2][1] = x[2][1]; - v.x[2][2] = x[2][2]; - v.x[2][3] = x[2][3]; - v.x[3][0] = x[3][0]; - v.x[3][1] = x[3][1]; - v.x[3][2] = x[3][2]; - v.x[3][3] = x[3][3]; -} - -template -template -inline Matrix44 & -Matrix44::setValue (const Matrix44 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[0][3] = v.x[0][3]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[1][3] = v.x[1][3]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - x[2][3] = v.x[2][3]; - x[3][0] = v.x[3][0]; - x[3][1] = v.x[3][1]; - x[3][2] = v.x[3][2]; - x[3][3] = v.x[3][3]; - return *this; -} - -template -template -inline Matrix44 & -Matrix44::setTheMatrix (const Matrix44 &v) -{ - x[0][0] = v.x[0][0]; - x[0][1] = v.x[0][1]; - x[0][2] = v.x[0][2]; - x[0][3] = v.x[0][3]; - x[1][0] = v.x[1][0]; - x[1][1] = v.x[1][1]; - x[1][2] = v.x[1][2]; - x[1][3] = v.x[1][3]; - x[2][0] = v.x[2][0]; - x[2][1] = v.x[2][1]; - x[2][2] = v.x[2][2]; - x[2][3] = v.x[2][3]; - x[3][0] = v.x[3][0]; - x[3][1] = v.x[3][1]; - x[3][2] = v.x[3][2]; - x[3][3] = v.x[3][3]; - return *this; -} - -template -inline void -Matrix44::makeIdentity() -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - x[1][3] = 0; - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - x[2][3] = 0; - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; -} - -template -bool -Matrix44::operator == (const Matrix44 &v) const -{ - return x[0][0] == v.x[0][0] && - x[0][1] == v.x[0][1] && - x[0][2] == v.x[0][2] && - x[0][3] == v.x[0][3] && - x[1][0] == v.x[1][0] && - x[1][1] == v.x[1][1] && - x[1][2] == v.x[1][2] && - x[1][3] == v.x[1][3] && - x[2][0] == v.x[2][0] && - x[2][1] == v.x[2][1] && - x[2][2] == v.x[2][2] && - x[2][3] == v.x[2][3] && - x[3][0] == v.x[3][0] && - x[3][1] == v.x[3][1] && - x[3][2] == v.x[3][2] && - x[3][3] == v.x[3][3]; -} - -template -bool -Matrix44::operator != (const Matrix44 &v) const -{ - return x[0][0] != v.x[0][0] || - x[0][1] != v.x[0][1] || - x[0][2] != v.x[0][2] || - x[0][3] != v.x[0][3] || - x[1][0] != v.x[1][0] || - x[1][1] != v.x[1][1] || - x[1][2] != v.x[1][2] || - x[1][3] != v.x[1][3] || - x[2][0] != v.x[2][0] || - x[2][1] != v.x[2][1] || - x[2][2] != v.x[2][2] || - x[2][3] != v.x[2][3] || - x[3][0] != v.x[3][0] || - x[3][1] != v.x[3][1] || - x[3][2] != v.x[3][2] || - x[3][3] != v.x[3][3]; -} - -template -bool -Matrix44::equalWithAbsError (const Matrix44 &m, T e) const -{ - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - if (!Imath::equalWithAbsError ((*this)[i][j], m[i][j], e)) - return false; - - return true; -} - -template -bool -Matrix44::equalWithRelError (const Matrix44 &m, T e) const -{ - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) - if (!Imath::equalWithRelError ((*this)[i][j], m[i][j], e)) - return false; - - return true; -} - -template -const Matrix44 & -Matrix44::operator += (const Matrix44 &v) -{ - x[0][0] += v.x[0][0]; - x[0][1] += v.x[0][1]; - x[0][2] += v.x[0][2]; - x[0][3] += v.x[0][3]; - x[1][0] += v.x[1][0]; - x[1][1] += v.x[1][1]; - x[1][2] += v.x[1][2]; - x[1][3] += v.x[1][3]; - x[2][0] += v.x[2][0]; - x[2][1] += v.x[2][1]; - x[2][2] += v.x[2][2]; - x[2][3] += v.x[2][3]; - x[3][0] += v.x[3][0]; - x[3][1] += v.x[3][1]; - x[3][2] += v.x[3][2]; - x[3][3] += v.x[3][3]; - - return *this; -} - -template -const Matrix44 & -Matrix44::operator += (T a) -{ - x[0][0] += a; - x[0][1] += a; - x[0][2] += a; - x[0][3] += a; - x[1][0] += a; - x[1][1] += a; - x[1][2] += a; - x[1][3] += a; - x[2][0] += a; - x[2][1] += a; - x[2][2] += a; - x[2][3] += a; - x[3][0] += a; - x[3][1] += a; - x[3][2] += a; - x[3][3] += a; - - return *this; -} - -template -Matrix44 -Matrix44::operator + (const Matrix44 &v) const -{ - return Matrix44 (x[0][0] + v.x[0][0], - x[0][1] + v.x[0][1], - x[0][2] + v.x[0][2], - x[0][3] + v.x[0][3], - x[1][0] + v.x[1][0], - x[1][1] + v.x[1][1], - x[1][2] + v.x[1][2], - x[1][3] + v.x[1][3], - x[2][0] + v.x[2][0], - x[2][1] + v.x[2][1], - x[2][2] + v.x[2][2], - x[2][3] + v.x[2][3], - x[3][0] + v.x[3][0], - x[3][1] + v.x[3][1], - x[3][2] + v.x[3][2], - x[3][3] + v.x[3][3]); -} - -template -const Matrix44 & -Matrix44::operator -= (const Matrix44 &v) -{ - x[0][0] -= v.x[0][0]; - x[0][1] -= v.x[0][1]; - x[0][2] -= v.x[0][2]; - x[0][3] -= v.x[0][3]; - x[1][0] -= v.x[1][0]; - x[1][1] -= v.x[1][1]; - x[1][2] -= v.x[1][2]; - x[1][3] -= v.x[1][3]; - x[2][0] -= v.x[2][0]; - x[2][1] -= v.x[2][1]; - x[2][2] -= v.x[2][2]; - x[2][3] -= v.x[2][3]; - x[3][0] -= v.x[3][0]; - x[3][1] -= v.x[3][1]; - x[3][2] -= v.x[3][2]; - x[3][3] -= v.x[3][3]; - - return *this; -} - -template -const Matrix44 & -Matrix44::operator -= (T a) -{ - x[0][0] -= a; - x[0][1] -= a; - x[0][2] -= a; - x[0][3] -= a; - x[1][0] -= a; - x[1][1] -= a; - x[1][2] -= a; - x[1][3] -= a; - x[2][0] -= a; - x[2][1] -= a; - x[2][2] -= a; - x[2][3] -= a; - x[3][0] -= a; - x[3][1] -= a; - x[3][2] -= a; - x[3][3] -= a; - - return *this; -} - -template -Matrix44 -Matrix44::operator - (const Matrix44 &v) const -{ - return Matrix44 (x[0][0] - v.x[0][0], - x[0][1] - v.x[0][1], - x[0][2] - v.x[0][2], - x[0][3] - v.x[0][3], - x[1][0] - v.x[1][0], - x[1][1] - v.x[1][1], - x[1][2] - v.x[1][2], - x[1][3] - v.x[1][3], - x[2][0] - v.x[2][0], - x[2][1] - v.x[2][1], - x[2][2] - v.x[2][2], - x[2][3] - v.x[2][3], - x[3][0] - v.x[3][0], - x[3][1] - v.x[3][1], - x[3][2] - v.x[3][2], - x[3][3] - v.x[3][3]); -} - -template -Matrix44 -Matrix44::operator - () const -{ - return Matrix44 (-x[0][0], - -x[0][1], - -x[0][2], - -x[0][3], - -x[1][0], - -x[1][1], - -x[1][2], - -x[1][3], - -x[2][0], - -x[2][1], - -x[2][2], - -x[2][3], - -x[3][0], - -x[3][1], - -x[3][2], - -x[3][3]); -} - -template -const Matrix44 & -Matrix44::negate () -{ - x[0][0] = -x[0][0]; - x[0][1] = -x[0][1]; - x[0][2] = -x[0][2]; - x[0][3] = -x[0][3]; - x[1][0] = -x[1][0]; - x[1][1] = -x[1][1]; - x[1][2] = -x[1][2]; - x[1][3] = -x[1][3]; - x[2][0] = -x[2][0]; - x[2][1] = -x[2][1]; - x[2][2] = -x[2][2]; - x[2][3] = -x[2][3]; - x[3][0] = -x[3][0]; - x[3][1] = -x[3][1]; - x[3][2] = -x[3][2]; - x[3][3] = -x[3][3]; - - return *this; -} - -template -const Matrix44 & -Matrix44::operator *= (T a) -{ - x[0][0] *= a; - x[0][1] *= a; - x[0][2] *= a; - x[0][3] *= a; - x[1][0] *= a; - x[1][1] *= a; - x[1][2] *= a; - x[1][3] *= a; - x[2][0] *= a; - x[2][1] *= a; - x[2][2] *= a; - x[2][3] *= a; - x[3][0] *= a; - x[3][1] *= a; - x[3][2] *= a; - x[3][3] *= a; - - return *this; -} - -template -Matrix44 -Matrix44::operator * (T a) const -{ - return Matrix44 (x[0][0] * a, - x[0][1] * a, - x[0][2] * a, - x[0][3] * a, - x[1][0] * a, - x[1][1] * a, - x[1][2] * a, - x[1][3] * a, - x[2][0] * a, - x[2][1] * a, - x[2][2] * a, - x[2][3] * a, - x[3][0] * a, - x[3][1] * a, - x[3][2] * a, - x[3][3] * a); -} - -template -inline Matrix44 -operator * (T a, const Matrix44 &v) -{ - return v * a; -} - -template -inline const Matrix44 & -Matrix44::operator *= (const Matrix44 &v) -{ - Matrix44 tmp (T (0)); - - multiply (*this, v, tmp); - *this = tmp; - return *this; -} - -template -inline Matrix44 -Matrix44::operator * (const Matrix44 &v) const -{ - Matrix44 tmp (T (0)); - - multiply (*this, v, tmp); - return tmp; -} - -template -void -Matrix44::multiply (const Matrix44 &a, - const Matrix44 &b, - Matrix44 &c) -{ - register const T * restrict ap = &a.x[0][0]; - register const T * restrict bp = &b.x[0][0]; - register T * restrict cp = &c.x[0][0]; - - register T a0, a1, a2, a3; - - a0 = ap[0]; - a1 = ap[1]; - a2 = ap[2]; - a3 = ap[3]; - - cp[0] = a0 * bp[0] + a1 * bp[4] + a2 * bp[8] + a3 * bp[12]; - cp[1] = a0 * bp[1] + a1 * bp[5] + a2 * bp[9] + a3 * bp[13]; - cp[2] = a0 * bp[2] + a1 * bp[6] + a2 * bp[10] + a3 * bp[14]; - cp[3] = a0 * bp[3] + a1 * bp[7] + a2 * bp[11] + a3 * bp[15]; - - a0 = ap[4]; - a1 = ap[5]; - a2 = ap[6]; - a3 = ap[7]; - - cp[4] = a0 * bp[0] + a1 * bp[4] + a2 * bp[8] + a3 * bp[12]; - cp[5] = a0 * bp[1] + a1 * bp[5] + a2 * bp[9] + a3 * bp[13]; - cp[6] = a0 * bp[2] + a1 * bp[6] + a2 * bp[10] + a3 * bp[14]; - cp[7] = a0 * bp[3] + a1 * bp[7] + a2 * bp[11] + a3 * bp[15]; - - a0 = ap[8]; - a1 = ap[9]; - a2 = ap[10]; - a3 = ap[11]; - - cp[8] = a0 * bp[0] + a1 * bp[4] + a2 * bp[8] + a3 * bp[12]; - cp[9] = a0 * bp[1] + a1 * bp[5] + a2 * bp[9] + a3 * bp[13]; - cp[10] = a0 * bp[2] + a1 * bp[6] + a2 * bp[10] + a3 * bp[14]; - cp[11] = a0 * bp[3] + a1 * bp[7] + a2 * bp[11] + a3 * bp[15]; - - a0 = ap[12]; - a1 = ap[13]; - a2 = ap[14]; - a3 = ap[15]; - - cp[12] = a0 * bp[0] + a1 * bp[4] + a2 * bp[8] + a3 * bp[12]; - cp[13] = a0 * bp[1] + a1 * bp[5] + a2 * bp[9] + a3 * bp[13]; - cp[14] = a0 * bp[2] + a1 * bp[6] + a2 * bp[10] + a3 * bp[14]; - cp[15] = a0 * bp[3] + a1 * bp[7] + a2 * bp[11] + a3 * bp[15]; -} - -template template -void -Matrix44::multVecMatrix(const Vec3 &src, Vec3 &dst) const -{ - S a, b, c, w; - - a = src[0] * x[0][0] + src[1] * x[1][0] + src[2] * x[2][0] + x[3][0]; - b = src[0] * x[0][1] + src[1] * x[1][1] + src[2] * x[2][1] + x[3][1]; - c = src[0] * x[0][2] + src[1] * x[1][2] + src[2] * x[2][2] + x[3][2]; - w = src[0] * x[0][3] + src[1] * x[1][3] + src[2] * x[2][3] + x[3][3]; - - dst.x = a / w; - dst.y = b / w; - dst.z = c / w; -} - -template template -void -Matrix44::multDirMatrix(const Vec3 &src, Vec3 &dst) const -{ - S a, b, c; - - a = src[0] * x[0][0] + src[1] * x[1][0] + src[2] * x[2][0]; - b = src[0] * x[0][1] + src[1] * x[1][1] + src[2] * x[2][1]; - c = src[0] * x[0][2] + src[1] * x[1][2] + src[2] * x[2][2]; - - dst.x = a; - dst.y = b; - dst.z = c; -} - -template -const Matrix44 & -Matrix44::operator /= (T a) -{ - x[0][0] /= a; - x[0][1] /= a; - x[0][2] /= a; - x[0][3] /= a; - x[1][0] /= a; - x[1][1] /= a; - x[1][2] /= a; - x[1][3] /= a; - x[2][0] /= a; - x[2][1] /= a; - x[2][2] /= a; - x[2][3] /= a; - x[3][0] /= a; - x[3][1] /= a; - x[3][2] /= a; - x[3][3] /= a; - - return *this; -} - -template -Matrix44 -Matrix44::operator / (T a) const -{ - return Matrix44 (x[0][0] / a, - x[0][1] / a, - x[0][2] / a, - x[0][3] / a, - x[1][0] / a, - x[1][1] / a, - x[1][2] / a, - x[1][3] / a, - x[2][0] / a, - x[2][1] / a, - x[2][2] / a, - x[2][3] / a, - x[3][0] / a, - x[3][1] / a, - x[3][2] / a, - x[3][3] / a); -} - -template -const Matrix44 & -Matrix44::transpose () -{ - Matrix44 tmp (x[0][0], - x[1][0], - x[2][0], - x[3][0], - x[0][1], - x[1][1], - x[2][1], - x[3][1], - x[0][2], - x[1][2], - x[2][2], - x[3][2], - x[0][3], - x[1][3], - x[2][3], - x[3][3]); - *this = tmp; - return *this; -} - -template -Matrix44 -Matrix44::transposed () const -{ - return Matrix44 (x[0][0], - x[1][0], - x[2][0], - x[3][0], - x[0][1], - x[1][1], - x[2][1], - x[3][1], - x[0][2], - x[1][2], - x[2][2], - x[3][2], - x[0][3], - x[1][3], - x[2][3], - x[3][3]); -} - -template -const Matrix44 & -Matrix44::gjInvert (bool singExc) throw (Iex::MathExc) -{ - *this = gjInverse (singExc); - return *this; -} - -template -Matrix44 -Matrix44::gjInverse (bool singExc) const throw (Iex::MathExc) -{ - int i, j, k; - Matrix44 s; - Matrix44 t (*this); - - // Forward elimination - - for (i = 0; i < 3 ; i++) - { - int pivot = i; - - T pivotsize = t[i][i]; - - if (pivotsize < 0) - pivotsize = -pivotsize; - - for (j = i + 1; j < 4; j++) - { - T tmp = t[j][i]; - - if (tmp < 0) - tmp = -tmp; - - if (tmp > pivotsize) - { - pivot = j; - pivotsize = tmp; - } - } - - if (pivotsize == 0) - { - if (singExc) - throw ::Imath::SingMatrixExc ("Cannot invert singular matrix."); - - return Matrix44(); - } - - if (pivot != i) - { - for (j = 0; j < 4; j++) - { - T tmp; - - tmp = t[i][j]; - t[i][j] = t[pivot][j]; - t[pivot][j] = tmp; - - tmp = s[i][j]; - s[i][j] = s[pivot][j]; - s[pivot][j] = tmp; - } - } - - for (j = i + 1; j < 4; j++) - { - T f = t[j][i] / t[i][i]; - - for (k = 0; k < 4; k++) - { - t[j][k] -= f * t[i][k]; - s[j][k] -= f * s[i][k]; - } - } - } - - // Backward substitution - - for (i = 3; i >= 0; --i) - { - T f; - - if ((f = t[i][i]) == 0) - { - if (singExc) - throw ::Imath::SingMatrixExc ("Cannot invert singular matrix."); - - return Matrix44(); - } - - for (j = 0; j < 4; j++) - { - t[i][j] /= f; - s[i][j] /= f; - } - - for (j = 0; j < i; j++) - { - f = t[j][i]; - - for (k = 0; k < 4; k++) - { - t[j][k] -= f * t[i][k]; - s[j][k] -= f * s[i][k]; - } - } - } - - return s; -} - -template -const Matrix44 & -Matrix44::invert (bool singExc) throw (Iex::MathExc) -{ - *this = inverse (singExc); - return *this; -} - -template -Matrix44 -Matrix44::inverse (bool singExc) const throw (Iex::MathExc) -{ - if (x[0][3] != 0 || x[1][3] != 0 || x[2][3] != 0 || x[3][3] != 1) - return gjInverse(singExc); - - Matrix44 s (x[1][1] * x[2][2] - x[2][1] * x[1][2], - x[2][1] * x[0][2] - x[0][1] * x[2][2], - x[0][1] * x[1][2] - x[1][1] * x[0][2], - 0, - - x[2][0] * x[1][2] - x[1][0] * x[2][2], - x[0][0] * x[2][2] - x[2][0] * x[0][2], - x[1][0] * x[0][2] - x[0][0] * x[1][2], - 0, - - x[1][0] * x[2][1] - x[2][0] * x[1][1], - x[2][0] * x[0][1] - x[0][0] * x[2][1], - x[0][0] * x[1][1] - x[1][0] * x[0][1], - 0, - - 0, - 0, - 0, - 1); - - T r = x[0][0] * s[0][0] + x[0][1] * s[1][0] + x[0][2] * s[2][0]; - - if (Imath::abs (r) >= 1) - { - for (int i = 0; i < 3; ++i) - { - for (int j = 0; j < 3; ++j) - { - s[i][j] /= r; - } - } - } - else - { - T mr = Imath::abs (r) / limits::smallest(); - - for (int i = 0; i < 3; ++i) - { - for (int j = 0; j < 3; ++j) - { - if (mr > Imath::abs (s[i][j])) - { - s[i][j] /= r; - } - else - { - if (singExc) - throw SingMatrixExc ("Cannot invert singular matrix."); - - return Matrix44(); - } - } - } - } - - s[3][0] = -x[3][0] * s[0][0] - x[3][1] * s[1][0] - x[3][2] * s[2][0]; - s[3][1] = -x[3][0] * s[0][1] - x[3][1] * s[1][1] - x[3][2] * s[2][1]; - s[3][2] = -x[3][0] * s[0][2] - x[3][1] * s[1][2] - x[3][2] * s[2][2]; - - return s; -} - -template -template -const Matrix44 & -Matrix44::setEulerAngles (const Vec3& r) -{ - S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx; - - cos_rz = Math::cos (r[2]); - cos_ry = Math::cos (r[1]); - cos_rx = Math::cos (r[0]); - - sin_rz = Math::sin (r[2]); - sin_ry = Math::sin (r[1]); - sin_rx = Math::sin (r[0]); - - x[0][0] = cos_rz * cos_ry; - x[0][1] = sin_rz * cos_ry; - x[0][2] = -sin_ry; - x[0][3] = 0; - - x[1][0] = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx; - x[1][1] = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx; - x[1][2] = cos_ry * sin_rx; - x[1][3] = 0; - - x[2][0] = sin_rz * sin_rx + cos_rz * sin_ry * cos_rx; - x[2][1] = -cos_rz * sin_rx + sin_rz * sin_ry * cos_rx; - x[2][2] = cos_ry * cos_rx; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::setAxisAngle (const Vec3& axis, S angle) -{ - Vec3 unit (axis.normalized()); - S sine = Math::sin (angle); - S cosine = Math::cos (angle); - - x[0][0] = unit[0] * unit[0] * (1 - cosine) + cosine; - x[0][1] = unit[0] * unit[1] * (1 - cosine) + unit[2] * sine; - x[0][2] = unit[0] * unit[2] * (1 - cosine) - unit[1] * sine; - x[0][3] = 0; - - x[1][0] = unit[0] * unit[1] * (1 - cosine) - unit[2] * sine; - x[1][1] = unit[1] * unit[1] * (1 - cosine) + cosine; - x[1][2] = unit[1] * unit[2] * (1 - cosine) + unit[0] * sine; - x[1][3] = 0; - - x[2][0] = unit[0] * unit[2] * (1 - cosine) + unit[1] * sine; - x[2][1] = unit[1] * unit[2] * (1 - cosine) - unit[0] * sine; - x[2][2] = unit[2] * unit[2] * (1 - cosine) + cosine; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::rotate (const Vec3 &r) -{ - S cos_rz, sin_rz, cos_ry, sin_ry, cos_rx, sin_rx; - S m00, m01, m02; - S m10, m11, m12; - S m20, m21, m22; - - cos_rz = Math::cos (r[2]); - cos_ry = Math::cos (r[1]); - cos_rx = Math::cos (r[0]); - - sin_rz = Math::sin (r[2]); - sin_ry = Math::sin (r[1]); - sin_rx = Math::sin (r[0]); - - m00 = cos_rz * cos_ry; - m01 = sin_rz * cos_ry; - m02 = -sin_ry; - m10 = -sin_rz * cos_rx + cos_rz * sin_ry * sin_rx; - m11 = cos_rz * cos_rx + sin_rz * sin_ry * sin_rx; - m12 = cos_ry * sin_rx; - m20 = -sin_rz * -sin_rx + cos_rz * sin_ry * cos_rx; - m21 = cos_rz * -sin_rx + sin_rz * sin_ry * cos_rx; - m22 = cos_ry * cos_rx; - - Matrix44 P (*this); - - x[0][0] = P[0][0] * m00 + P[1][0] * m01 + P[2][0] * m02; - x[0][1] = P[0][1] * m00 + P[1][1] * m01 + P[2][1] * m02; - x[0][2] = P[0][2] * m00 + P[1][2] * m01 + P[2][2] * m02; - x[0][3] = P[0][3] * m00 + P[1][3] * m01 + P[2][3] * m02; - - x[1][0] = P[0][0] * m10 + P[1][0] * m11 + P[2][0] * m12; - x[1][1] = P[0][1] * m10 + P[1][1] * m11 + P[2][1] * m12; - x[1][2] = P[0][2] * m10 + P[1][2] * m11 + P[2][2] * m12; - x[1][3] = P[0][3] * m10 + P[1][3] * m11 + P[2][3] * m12; - - x[2][0] = P[0][0] * m20 + P[1][0] * m21 + P[2][0] * m22; - x[2][1] = P[0][1] * m20 + P[1][1] * m21 + P[2][1] * m22; - x[2][2] = P[0][2] * m20 + P[1][2] * m21 + P[2][2] * m22; - x[2][3] = P[0][3] * m20 + P[1][3] * m21 + P[2][3] * m22; - - return *this; -} - -template -const Matrix44 & -Matrix44::setScale (T s) -{ - x[0][0] = s; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - - x[1][0] = 0; - x[1][1] = s; - x[1][2] = 0; - x[1][3] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = s; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::setScale (const Vec3 &s) -{ - x[0][0] = s[0]; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - - x[1][0] = 0; - x[1][1] = s[1]; - x[1][2] = 0; - x[1][3] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = s[2]; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::scale (const Vec3 &s) -{ - x[0][0] *= s[0]; - x[0][1] *= s[0]; - x[0][2] *= s[0]; - x[0][3] *= s[0]; - - x[1][0] *= s[1]; - x[1][1] *= s[1]; - x[1][2] *= s[1]; - x[1][3] *= s[1]; - - x[2][0] *= s[2]; - x[2][1] *= s[2]; - x[2][2] *= s[2]; - x[2][3] *= s[2]; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::setTranslation (const Vec3 &t) -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - - x[1][0] = 0; - x[1][1] = 1; - x[1][2] = 0; - x[1][3] = 0; - - x[2][0] = 0; - x[2][1] = 0; - x[2][2] = 1; - x[2][3] = 0; - - x[3][0] = t[0]; - x[3][1] = t[1]; - x[3][2] = t[2]; - x[3][3] = 1; - - return *this; -} - -template -inline const Vec3 -Matrix44::translation () const -{ - return Vec3 (x[3][0], x[3][1], x[3][2]); -} - -template -template -const Matrix44 & -Matrix44::translate (const Vec3 &t) -{ - x[3][0] += t[0] * x[0][0] + t[1] * x[1][0] + t[2] * x[2][0]; - x[3][1] += t[0] * x[0][1] + t[1] * x[1][1] + t[2] * x[2][1]; - x[3][2] += t[0] * x[0][2] + t[1] * x[1][2] + t[2] * x[2][2]; - x[3][3] += t[0] * x[0][3] + t[1] * x[1][3] + t[2] * x[2][3]; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::setShear (const Vec3 &h) -{ - x[0][0] = 1; - x[0][1] = 0; - x[0][2] = 0; - x[0][3] = 0; - - x[1][0] = h[0]; - x[1][1] = 1; - x[1][2] = 0; - x[1][3] = 0; - - x[2][0] = h[1]; - x[2][1] = h[2]; - x[2][2] = 1; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::setShear (const Shear6 &h) -{ - x[0][0] = 1; - x[0][1] = h.yx; - x[0][2] = h.zx; - x[0][3] = 0; - - x[1][0] = h.xy; - x[1][1] = 1; - x[1][2] = h.zy; - x[1][3] = 0; - - x[2][0] = h.xz; - x[2][1] = h.yz; - x[2][2] = 1; - x[2][3] = 0; - - x[3][0] = 0; - x[3][1] = 0; - x[3][2] = 0; - x[3][3] = 1; - - return *this; -} - -template -template -const Matrix44 & -Matrix44::shear (const Vec3 &h) -{ - // - // In this case, we don't need a temp. copy of the matrix - // because we never use a value on the RHS after we've - // changed it on the LHS. - // - - for (int i=0; i < 4; i++) - { - x[2][i] += h[1] * x[0][i] + h[2] * x[1][i]; - x[1][i] += h[0] * x[0][i]; - } - - return *this; -} - -template -template -const Matrix44 & -Matrix44::shear (const Shear6 &h) -{ - Matrix44 P (*this); - - for (int i=0; i < 4; i++) - { - x[0][i] = P[0][i] + h.yx * P[1][i] + h.zx * P[2][i]; - x[1][i] = h.xy * P[0][i] + P[1][i] + h.zy * P[2][i]; - x[2][i] = h.xz * P[0][i] + h.yz * P[1][i] + P[2][i]; - } - - return *this; -} - - -//-------------------------------- -// Implementation of stream output -//-------------------------------- - -template -std::ostream & -operator << (std::ostream &s, const Matrix33 &m) -{ - std::ios_base::fmtflags oldFlags = s.flags(); - int width; - - if (s.flags() & std::ios_base::fixed) - { - s.setf (std::ios_base::showpoint); - width = s.precision() + 5; - } - else - { - s.setf (std::ios_base::scientific); - s.setf (std::ios_base::showpoint); - width = s.precision() + 8; - } - - s << "(" << std::setw (width) << m[0][0] << - " " << std::setw (width) << m[0][1] << - " " << std::setw (width) << m[0][2] << "\n" << - - " " << std::setw (width) << m[1][0] << - " " << std::setw (width) << m[1][1] << - " " << std::setw (width) << m[1][2] << "\n" << - - " " << std::setw (width) << m[2][0] << - " " << std::setw (width) << m[2][1] << - " " << std::setw (width) << m[2][2] << ")\n"; - - s.flags (oldFlags); - return s; -} - -template -std::ostream & -operator << (std::ostream &s, const Matrix44 &m) -{ - std::ios_base::fmtflags oldFlags = s.flags(); - int width; - - if (s.flags() & std::ios_base::fixed) - { - s.setf (std::ios_base::showpoint); - width = s.precision() + 5; - } - else - { - s.setf (std::ios_base::scientific); - s.setf (std::ios_base::showpoint); - width = s.precision() + 8; - } - - s << "(" << std::setw (width) << m[0][0] << - " " << std::setw (width) << m[0][1] << - " " << std::setw (width) << m[0][2] << - " " << std::setw (width) << m[0][3] << "\n" << - - " " << std::setw (width) << m[1][0] << - " " << std::setw (width) << m[1][1] << - " " << std::setw (width) << m[1][2] << - " " << std::setw (width) << m[1][3] << "\n" << - - " " << std::setw (width) << m[2][0] << - " " << std::setw (width) << m[2][1] << - " " << std::setw (width) << m[2][2] << - " " << std::setw (width) << m[2][3] << "\n" << - - " " << std::setw (width) << m[3][0] << - " " << std::setw (width) << m[3][1] << - " " << std::setw (width) << m[3][2] << - " " << std::setw (width) << m[3][3] << ")\n"; - - s.flags (oldFlags); - return s; -} - - -//--------------------------------------------------------------- -// Implementation of vector-times-matrix multiplication operators -//--------------------------------------------------------------- - -template -inline const Vec2 & -operator *= (Vec2 &v, const Matrix33 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + m[2][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + m[2][1]); - S w = S(v.x * m[0][2] + v.y * m[1][2] + m[2][2]); - - v.x = x / w; - v.y = y / w; - - return v; -} - -template -inline Vec2 -operator * (const Vec2 &v, const Matrix33 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + m[2][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + m[2][1]); - S w = S(v.x * m[0][2] + v.y * m[1][2] + m[2][2]); - - return Vec2 (x / w, y / w); -} - - -template -inline const Vec3 & -operator *= (Vec3 &v, const Matrix33 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1]); - S z = S(v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2]); - - v.x = x; - v.y = y; - v.z = z; - - return v; -} - - -template -inline Vec3 -operator * (const Vec3 &v, const Matrix33 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1]); - S z = S(v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2]); - - return Vec3 (x, y, z); -} - - -template -inline const Vec3 & -operator *= (Vec3 &v, const Matrix44 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0] + m[3][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1] + m[3][1]); - S z = S(v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2] + m[3][2]); - S w = S(v.x * m[0][3] + v.y * m[1][3] + v.z * m[2][3] + m[3][3]); - - v.x = x / w; - v.y = y / w; - v.z = z / w; - - return v; -} - -template -inline Vec3 -operator * (const Vec3 &v, const Matrix44 &m) -{ - S x = S(v.x * m[0][0] + v.y * m[1][0] + v.z * m[2][0] + m[3][0]); - S y = S(v.x * m[0][1] + v.y * m[1][1] + v.z * m[2][1] + m[3][1]); - S z = S(v.x * m[0][2] + v.y * m[1][2] + v.z * m[2][2] + m[3][2]); - S w = S(v.x * m[0][3] + v.y * m[1][3] + v.z * m[2][3] + m[3][3]); - - return Vec3 (x / w, y / w, z / w); -} - -} // namespace Imath - - - -#endif diff --git a/3rdparty/include/OpenEXR/ImathMatrixAlgo.h b/3rdparty/include/OpenEXR/ImathMatrixAlgo.h deleted file mode 100644 index 0234f23c02..0000000000 --- a/3rdparty/include/OpenEXR/ImathMatrixAlgo.h +++ /dev/null @@ -1,1114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMATHMATRIXALGO_H -#define INCLUDED_IMATHMATRIXALGO_H - -//------------------------------------------------------------------------- -// -// This file contains algorithms applied to or in conjunction with -// transformation matrices (Imath::Matrix33 and Imath::Matrix44). -// The assumption made is that these functions are called much less -// often than the basic point functions or these functions require -// more support classes. -// -// This file also defines a few predefined constant matrices. -// -//------------------------------------------------------------------------- - -#include "ImathMatrix.h" -#include "ImathQuat.h" -#include "ImathEuler.h" -#include "ImathExc.h" -#include "ImathVec.h" -#include - - -#ifdef OPENEXR_DLL - #ifdef IMATH_EXPORTS - #define IMATH_EXPORT_CONST extern __declspec(dllexport) - #else - #define IMATH_EXPORT_CONST extern __declspec(dllimport) - #endif -#else - #define IMATH_EXPORT_CONST extern const -#endif - - -namespace Imath { - -//------------------ -// Identity matrices -//------------------ - -IMATH_EXPORT_CONST M33f identity33f; -IMATH_EXPORT_CONST M44f identity44f; -IMATH_EXPORT_CONST M33d identity33d; -IMATH_EXPORT_CONST M44d identity44d; - -//---------------------------------------------------------------------- -// Extract scale, shear, rotation, and translation values from a matrix: -// -// Notes: -// -// This implementation follows the technique described in the paper by -// Spencer W. Thomas in the Graphics Gems II article: "Decomposing a -// Matrix into Simple Transformations", p. 320. -// -// - Some of the functions below have an optional exc parameter -// that determines the functions' behavior when the matrix' -// scaling is very close to zero: -// -// If exc is true, the functions throw an Imath::ZeroScale exception. -// -// If exc is false: -// -// extractScaling (m, s) returns false, s is invalid -// sansScaling (m) returns m -// removeScaling (m) returns false, m is unchanged -// sansScalingAndShear (m) returns m -// removeScalingAndShear (m) returns false, m is unchanged -// extractAndRemoveScalingAndShear (m, s, h) -// returns false, m is unchanged, -// (sh) are invalid -// checkForZeroScaleInRow () returns false -// extractSHRT (m, s, h, r, t) returns false, (shrt) are invalid -// -// - Functions extractEuler(), extractEulerXYZ() and extractEulerZYX() -// assume that the matrix does not include shear or non-uniform scaling, -// but they do not examine the matrix to verify this assumption. -// Matrices with shear or non-uniform scaling are likely to produce -// meaningless results. Therefore, you should use the -// removeScalingAndShear() routine, if necessary, prior to calling -// extractEuler...() . -// -// - All functions assume that the matrix does not include perspective -// transformation(s), but they do not examine the matrix to verify -// this assumption. Matrices with perspective transformations are -// likely to produce meaningless results. -// -//---------------------------------------------------------------------- - - -// -// Declarations for 4x4 matrix. -// - -template bool extractScaling - (const Matrix44 &mat, - Vec3 &scl, - bool exc = true); - -template Matrix44 sansScaling (const Matrix44 &mat, - bool exc = true); - -template bool removeScaling - (Matrix44 &mat, - bool exc = true); - -template bool extractScalingAndShear - (const Matrix44 &mat, - Vec3 &scl, - Vec3 &shr, - bool exc = true); - -template Matrix44 sansScalingAndShear - (const Matrix44 &mat, - bool exc = true); - -template bool removeScalingAndShear - (Matrix44 &mat, - bool exc = true); - -template bool extractAndRemoveScalingAndShear - (Matrix44 &mat, - Vec3 &scl, - Vec3 &shr, - bool exc = true); - -template void extractEulerXYZ - (const Matrix44 &mat, - Vec3 &rot); - -template void extractEulerZYX - (const Matrix44 &mat, - Vec3 &rot); - -template Quat extractQuat (const Matrix44 &mat); - -template bool extractSHRT - (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Vec3 &r, - Vec3 &t, - bool exc /*= true*/, - typename Euler::Order rOrder); - -template bool extractSHRT - (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Vec3 &r, - Vec3 &t, - bool exc = true); - -template bool extractSHRT - (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Euler &r, - Vec3 &t, - bool exc = true); - -// -// Internal utility function. -// - -template bool checkForZeroScaleInRow - (const T &scl, - const Vec3 &row, - bool exc = true); - -// -// Returns a matrix that rotates "fromDirection" vector to "toDirection" -// vector. -// - -template Matrix44 rotationMatrix (const Vec3 &fromDirection, - const Vec3 &toDirection); - - - -// -// Returns a matrix that rotates the "fromDir" vector -// so that it points towards "toDir". You may also -// specify that you want the up vector to be pointing -// in a certain direction "upDir". -// - -template Matrix44 rotationMatrixWithUpDir - (const Vec3 &fromDir, - const Vec3 &toDir, - const Vec3 &upDir); - - -// -// Returns a matrix that rotates the z-axis so that it -// points towards "targetDir". You must also specify -// that you want the up vector to be pointing in a -// certain direction "upDir". -// -// Notes: The following degenerate cases are handled: -// (a) when the directions given by "toDir" and "upDir" -// are parallel or opposite; -// (the direction vectors must have a non-zero cross product) -// (b) when any of the given direction vectors have zero length -// - -template Matrix44 alignZAxisWithTargetDir - (Vec3 targetDir, - Vec3 upDir); - - -//---------------------------------------------------------------------- - - -// -// Declarations for 3x3 matrix. -// - - -template bool extractScaling - (const Matrix33 &mat, - Vec2 &scl, - bool exc = true); - -template Matrix33 sansScaling (const Matrix33 &mat, - bool exc = true); - -template bool removeScaling - (Matrix33 &mat, - bool exc = true); - -template bool extractScalingAndShear - (const Matrix33 &mat, - Vec2 &scl, - T &h, - bool exc = true); - -template Matrix33 sansScalingAndShear - (const Matrix33 &mat, - bool exc = true); - -template bool removeScalingAndShear - (Matrix33 &mat, - bool exc = true); - -template bool extractAndRemoveScalingAndShear - (Matrix33 &mat, - Vec2 &scl, - T &shr, - bool exc = true); - -template void extractEuler - (const Matrix33 &mat, - T &rot); - -template bool extractSHRT (const Matrix33 &mat, - Vec2 &s, - T &h, - T &r, - Vec2 &t, - bool exc = true); - -template bool checkForZeroScaleInRow - (const T &scl, - const Vec2 &row, - bool exc = true); - - - - -//----------------------------------------------------------------------------- -// Implementation for 4x4 Matrix -//------------------------------ - - -template -bool -extractScaling (const Matrix44 &mat, Vec3 &scl, bool exc) -{ - Vec3 shr; - Matrix44 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return false; - - return true; -} - - -template -Matrix44 -sansScaling (const Matrix44 &mat, bool exc) -{ - Vec3 scl; - Vec3 shr; - Vec3 rot; - Vec3 tran; - - if (! extractSHRT (mat, scl, shr, rot, tran, exc)) - return mat; - - Matrix44 M; - - M.translate (tran); - M.rotate (rot); - M.shear (shr); - - return M; -} - - -template -bool -removeScaling (Matrix44 &mat, bool exc) -{ - Vec3 scl; - Vec3 shr; - Vec3 rot; - Vec3 tran; - - if (! extractSHRT (mat, scl, shr, rot, tran, exc)) - return false; - - mat.makeIdentity (); - mat.translate (tran); - mat.rotate (rot); - mat.shear (shr); - - return true; -} - - -template -bool -extractScalingAndShear (const Matrix44 &mat, - Vec3 &scl, Vec3 &shr, bool exc) -{ - Matrix44 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return false; - - return true; -} - - -template -Matrix44 -sansScalingAndShear (const Matrix44 &mat, bool exc) -{ - Vec3 scl; - Vec3 shr; - Matrix44 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return mat; - - return M; -} - - -template -bool -removeScalingAndShear (Matrix44 &mat, bool exc) -{ - Vec3 scl; - Vec3 shr; - - if (! extractAndRemoveScalingAndShear (mat, scl, shr, exc)) - return false; - - return true; -} - - -template -bool -extractAndRemoveScalingAndShear (Matrix44 &mat, - Vec3 &scl, Vec3 &shr, bool exc) -{ - // - // This implementation follows the technique described in the paper by - // Spencer W. Thomas in the Graphics Gems II article: "Decomposing a - // Matrix into Simple Transformations", p. 320. - // - - Vec3 row[3]; - - row[0] = Vec3 (mat[0][0], mat[0][1], mat[0][2]); - row[1] = Vec3 (mat[1][0], mat[1][1], mat[1][2]); - row[2] = Vec3 (mat[2][0], mat[2][1], mat[2][2]); - - T maxVal = 0; - for (int i=0; i < 3; i++) - for (int j=0; j < 3; j++) - if (Imath::abs (row[i][j]) > maxVal) - maxVal = Imath::abs (row[i][j]); - - // - // We normalize the 3x3 matrix here. - // It was noticed that this can improve numerical stability significantly, - // especially when many of the upper 3x3 matrix's coefficients are very - // close to zero; we correct for this step at the end by multiplying the - // scaling factors by maxVal at the end (shear and rotation are not - // affected by the normalization). - - if (maxVal != 0) - { - for (int i=0; i < 3; i++) - if (! checkForZeroScaleInRow (maxVal, row[i], exc)) - return false; - else - row[i] /= maxVal; - } - - // Compute X scale factor. - scl.x = row[0].length (); - if (! checkForZeroScaleInRow (scl.x, row[0], exc)) - return false; - - // Normalize first row. - row[0] /= scl.x; - - // An XY shear factor will shear the X coord. as the Y coord. changes. - // There are 6 combinations (XY, XZ, YZ, YX, ZX, ZY), although we only - // extract the first 3 because we can effect the last 3 by shearing in - // XY, XZ, YZ combined rotations and scales. - // - // shear matrix < 1, YX, ZX, 0, - // XY, 1, ZY, 0, - // XZ, YZ, 1, 0, - // 0, 0, 0, 1 > - - // Compute XY shear factor and make 2nd row orthogonal to 1st. - shr[0] = row[0].dot (row[1]); - row[1] -= shr[0] * row[0]; - - // Now, compute Y scale. - scl.y = row[1].length (); - if (! checkForZeroScaleInRow (scl.y, row[1], exc)) - return false; - - // Normalize 2nd row and correct the XY shear factor for Y scaling. - row[1] /= scl.y; - shr[0] /= scl.y; - - // Compute XZ and YZ shears, orthogonalize 3rd row. - shr[1] = row[0].dot (row[2]); - row[2] -= shr[1] * row[0]; - shr[2] = row[1].dot (row[2]); - row[2] -= shr[2] * row[1]; - - // Next, get Z scale. - scl.z = row[2].length (); - if (! checkForZeroScaleInRow (scl.z, row[2], exc)) - return false; - - // Normalize 3rd row and correct the XZ and YZ shear factors for Z scaling. - row[2] /= scl.z; - shr[1] /= scl.z; - shr[2] /= scl.z; - - // At this point, the upper 3x3 matrix in mat is orthonormal. - // Check for a coordinate system flip. If the determinant - // is less than zero, then negate the matrix and the scaling factors. - if (row[0].dot (row[1].cross (row[2])) < 0) - for (int i=0; i < 3; i++) - { - scl[i] *= -1; - row[i] *= -1; - } - - // Copy over the orthonormal rows into the returned matrix. - // The upper 3x3 matrix in mat is now a rotation matrix. - for (int i=0; i < 3; i++) - { - mat[i][0] = row[i][0]; - mat[i][1] = row[i][1]; - mat[i][2] = row[i][2]; - } - - // Correct the scaling factors for the normalization step that we - // performed above; shear and rotation are not affected by the - // normalization. - scl *= maxVal; - - return true; -} - - -template -void -extractEulerXYZ (const Matrix44 &mat, Vec3 &rot) -{ - // - // Normalize the local x, y and z axes to remove scaling. - // - - Vec3 i (mat[0][0], mat[0][1], mat[0][2]); - Vec3 j (mat[1][0], mat[1][1], mat[1][2]); - Vec3 k (mat[2][0], mat[2][1], mat[2][2]); - - i.normalize(); - j.normalize(); - k.normalize(); - - Matrix44 M (i[0], i[1], i[2], 0, - j[0], j[1], j[2], 0, - k[0], k[1], k[2], 0, - 0, 0, 0, 1); - - // - // Extract the first angle, rot.x. - // - - rot.x = Math::atan2 (M[1][2], M[2][2]); - - // - // Remove the rot.x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Matrix44 N; - N.rotate (Vec3 (-rot.x, 0, 0)); - N = N * M; - - // - // Extract the other two angles, rot.y and rot.z, from N. - // - - T cy = Math::sqrt (N[0][0]*N[0][0] + N[0][1]*N[0][1]); - rot.y = Math::atan2 (-N[0][2], cy); - rot.z = Math::atan2 (-N[1][0], N[1][1]); -} - - -template -void -extractEulerZYX (const Matrix44 &mat, Vec3 &rot) -{ - // - // Normalize the local x, y and z axes to remove scaling. - // - - Vec3 i (mat[0][0], mat[0][1], mat[0][2]); - Vec3 j (mat[1][0], mat[1][1], mat[1][2]); - Vec3 k (mat[2][0], mat[2][1], mat[2][2]); - - i.normalize(); - j.normalize(); - k.normalize(); - - Matrix44 M (i[0], i[1], i[2], 0, - j[0], j[1], j[2], 0, - k[0], k[1], k[2], 0, - 0, 0, 0, 1); - - // - // Extract the first angle, rot.x. - // - - rot.x = -Math::atan2 (M[1][0], M[0][0]); - - // - // Remove the x rotation from M, so that the remaining - // rotation, N, is only around two axes, and gimbal lock - // cannot occur. - // - - Matrix44 N; - N.rotate (Vec3 (0, 0, -rot.x)); - N = N * M; - - // - // Extract the other two angles, rot.y and rot.z, from N. - // - - T cy = Math::sqrt (N[2][2]*N[2][2] + N[2][1]*N[2][1]); - rot.y = -Math::atan2 (-N[2][0], cy); - rot.z = -Math::atan2 (-N[1][2], N[1][1]); -} - - -template -Quat -extractQuat (const Matrix44 &mat) -{ - Matrix44 rot; - - T tr, s; - T q[4]; - int i, j, k; - Quat quat; - - int nxt[3] = {1, 2, 0}; - tr = mat[0][0] + mat[1][1] + mat[2][2]; - - // check the diagonal - if (tr > 0.0) { - s = Math::sqrt (tr + 1.0); - quat.r = s / 2.0; - s = 0.5 / s; - - quat.v.x = (mat[1][2] - mat[2][1]) * s; - quat.v.y = (mat[2][0] - mat[0][2]) * s; - quat.v.z = (mat[0][1] - mat[1][0]) * s; - } - else { - // diagonal is negative - i = 0; - if (mat[1][1] > mat[0][0]) - i=1; - if (mat[2][2] > mat[i][i]) - i=2; - - j = nxt[i]; - k = nxt[j]; - s = Math::sqrt ((mat[i][i] - (mat[j][j] + mat[k][k])) + 1.0); - - q[i] = s * 0.5; - if (s != 0.0) - s = 0.5 / s; - - q[3] = (mat[j][k] - mat[k][j]) * s; - q[j] = (mat[i][j] + mat[j][i]) * s; - q[k] = (mat[i][k] + mat[k][i]) * s; - - quat.v.x = q[0]; - quat.v.y = q[1]; - quat.v.z = q[2]; - quat.r = q[3]; - } - - return quat; -} - -template -bool -extractSHRT (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Vec3 &r, - Vec3 &t, - bool exc /* = true */ , - typename Euler::Order rOrder /* = Euler::XYZ */ ) -{ - Matrix44 rot; - - rot = mat; - if (! extractAndRemoveScalingAndShear (rot, s, h, exc)) - return false; - - extractEulerXYZ (rot, r); - - t.x = mat[3][0]; - t.y = mat[3][1]; - t.z = mat[3][2]; - - if (rOrder != Euler::XYZ) - { - Imath::Euler eXYZ (r, Imath::Euler::XYZ); - Imath::Euler e (eXYZ, rOrder); - r = e.toXYZVector (); - } - - return true; -} - -template -bool -extractSHRT (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Vec3 &r, - Vec3 &t, - bool exc) -{ - return extractSHRT(mat, s, h, r, t, exc, Imath::Euler::XYZ); -} - -template -bool -extractSHRT (const Matrix44 &mat, - Vec3 &s, - Vec3 &h, - Euler &r, - Vec3 &t, - bool exc /* = true */) -{ - return extractSHRT (mat, s, h, r, t, exc, r.order ()); -} - - -template -bool -checkForZeroScaleInRow (const T& scl, - const Vec3 &row, - bool exc /* = true */ ) -{ - for (int i = 0; i < 3; i++) - { - if ((abs (scl) < 1 && abs (row[i]) >= limits::max() * abs (scl))) - { - if (exc) - throw Imath::ZeroScaleExc ("Cannot remove zero scaling " - "from matrix."); - else - return false; - } - } - - return true; -} - - -template -Matrix44 -rotationMatrix (const Vec3 &from, const Vec3 &to) -{ - Quat q; - q.setRotation(from, to); - return q.toMatrix44(); -} - - -template -Matrix44 -rotationMatrixWithUpDir (const Vec3 &fromDir, - const Vec3 &toDir, - const Vec3 &upDir) -{ - // - // The goal is to obtain a rotation matrix that takes - // "fromDir" to "toDir". We do this in two steps and - // compose the resulting rotation matrices; - // (a) rotate "fromDir" into the z-axis - // (b) rotate the z-axis into "toDir" - // - - // The from direction must be non-zero; but we allow zero to and up dirs. - if (fromDir.length () == 0) - return Matrix44 (); - - else - { - Matrix44 zAxis2FromDir = alignZAxisWithTargetDir - (fromDir, Vec3 (0, 1, 0)); - - Matrix44 fromDir2zAxis = zAxis2FromDir.transposed (); - - Matrix44 zAxis2ToDir = alignZAxisWithTargetDir (toDir, upDir); - - return fromDir2zAxis * zAxis2ToDir; - } -} - - -template -Matrix44 -alignZAxisWithTargetDir (Vec3 targetDir, Vec3 upDir) -{ - // - // Ensure that the target direction is non-zero. - // - - if ( targetDir.length () == 0 ) - targetDir = Vec3 (0, 0, 1); - - // - // Ensure that the up direction is non-zero. - // - - if ( upDir.length () == 0 ) - upDir = Vec3 (0, 1, 0); - - // - // Check for degeneracies. If the upDir and targetDir are parallel - // or opposite, then compute a new, arbitrary up direction that is - // not parallel or opposite to the targetDir. - // - - if (upDir.cross (targetDir).length () == 0) - { - upDir = targetDir.cross (Vec3 (1, 0, 0)); - if (upDir.length() == 0) - upDir = targetDir.cross(Vec3 (0, 0, 1)); - } - - // - // Compute the x-, y-, and z-axis vectors of the new coordinate system. - // - - Vec3 targetPerpDir = upDir.cross (targetDir); - Vec3 targetUpDir = targetDir.cross (targetPerpDir); - - // - // Rotate the x-axis into targetPerpDir (row 0), - // rotate the y-axis into targetUpDir (row 1), - // rotate the z-axis into targetDir (row 2). - // - - Vec3 row[3]; - row[0] = targetPerpDir.normalized (); - row[1] = targetUpDir .normalized (); - row[2] = targetDir .normalized (); - - Matrix44 mat ( row[0][0], row[0][1], row[0][2], 0, - row[1][0], row[1][1], row[1][2], 0, - row[2][0], row[2][1], row[2][2], 0, - 0, 0, 0, 1 ); - - return mat; -} - - - -//----------------------------------------------------------------------------- -// Implementation for 3x3 Matrix -//------------------------------ - - -template -bool -extractScaling (const Matrix33 &mat, Vec2 &scl, bool exc) -{ - T shr; - Matrix33 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return false; - - return true; -} - - -template -Matrix33 -sansScaling (const Matrix33 &mat, bool exc) -{ - Vec2 scl; - T shr; - T rot; - Vec2 tran; - - if (! extractSHRT (mat, scl, shr, rot, tran, exc)) - return mat; - - Matrix33 M; - - M.translate (tran); - M.rotate (rot); - M.shear (shr); - - return M; -} - - -template -bool -removeScaling (Matrix33 &mat, bool exc) -{ - Vec2 scl; - T shr; - T rot; - Vec2 tran; - - if (! extractSHRT (mat, scl, shr, rot, tran, exc)) - return false; - - mat.makeIdentity (); - mat.translate (tran); - mat.rotate (rot); - mat.shear (shr); - - return true; -} - - -template -bool -extractScalingAndShear (const Matrix33 &mat, Vec2 &scl, T &shr, bool exc) -{ - Matrix33 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return false; - - return true; -} - - -template -Matrix33 -sansScalingAndShear (const Matrix33 &mat, bool exc) -{ - Vec2 scl; - T shr; - Matrix33 M (mat); - - if (! extractAndRemoveScalingAndShear (M, scl, shr, exc)) - return mat; - - return M; -} - - -template -bool -removeScalingAndShear (Matrix33 &mat, bool exc) -{ - Vec2 scl; - T shr; - - if (! extractAndRemoveScalingAndShear (mat, scl, shr, exc)) - return false; - - return true; -} - -template -bool -extractAndRemoveScalingAndShear (Matrix33 &mat, - Vec2 &scl, T &shr, bool exc) -{ - Vec2 row[2]; - - row[0] = Vec2 (mat[0][0], mat[0][1]); - row[1] = Vec2 (mat[1][0], mat[1][1]); - - T maxVal = 0; - for (int i=0; i < 2; i++) - for (int j=0; j < 2; j++) - if (Imath::abs (row[i][j]) > maxVal) - maxVal = Imath::abs (row[i][j]); - - // - // We normalize the 2x2 matrix here. - // It was noticed that this can improve numerical stability significantly, - // especially when many of the upper 2x2 matrix's coefficients are very - // close to zero; we correct for this step at the end by multiplying the - // scaling factors by maxVal at the end (shear and rotation are not - // affected by the normalization). - - if (maxVal != 0) - { - for (int i=0; i < 2; i++) - if (! checkForZeroScaleInRow (maxVal, row[i], exc)) - return false; - else - row[i] /= maxVal; - } - - // Compute X scale factor. - scl.x = row[0].length (); - if (! checkForZeroScaleInRow (scl.x, row[0], exc)) - return false; - - // Normalize first row. - row[0] /= scl.x; - - // An XY shear factor will shear the X coord. as the Y coord. changes. - // There are 2 combinations (XY, YX), although we only extract the XY - // shear factor because we can effect the an YX shear factor by - // shearing in XY combined with rotations and scales. - // - // shear matrix < 1, YX, 0, - // XY, 1, 0, - // 0, 0, 1 > - - // Compute XY shear factor and make 2nd row orthogonal to 1st. - shr = row[0].dot (row[1]); - row[1] -= shr * row[0]; - - // Now, compute Y scale. - scl.y = row[1].length (); - if (! checkForZeroScaleInRow (scl.y, row[1], exc)) - return false; - - // Normalize 2nd row and correct the XY shear factor for Y scaling. - row[1] /= scl.y; - shr /= scl.y; - - // At this point, the upper 2x2 matrix in mat is orthonormal. - // Check for a coordinate system flip. If the determinant - // is -1, then flip the rotation matrix and adjust the scale(Y) - // and shear(XY) factors to compensate. - if (row[0][0] * row[1][1] - row[0][1] * row[1][0] < 0) - { - row[1][0] *= -1; - row[1][1] *= -1; - scl[1] *= -1; - shr *= -1; - } - - // Copy over the orthonormal rows into the returned matrix. - // The upper 2x2 matrix in mat is now a rotation matrix. - for (int i=0; i < 2; i++) - { - mat[i][0] = row[i][0]; - mat[i][1] = row[i][1]; - } - - scl *= maxVal; - - return true; -} - - -template -void -extractEuler (const Matrix33 &mat, T &rot) -{ - // - // Normalize the local x and y axes to remove scaling. - // - - Vec2 i (mat[0][0], mat[0][1]); - Vec2 j (mat[1][0], mat[1][1]); - - i.normalize(); - j.normalize(); - - // - // Extract the angle, rot. - // - - rot = - Math::atan2 (j[0], i[0]); -} - - -template -bool -extractSHRT (const Matrix33 &mat, - Vec2 &s, - T &h, - T &r, - Vec2 &t, - bool exc) -{ - Matrix33 rot; - - rot = mat; - if (! extractAndRemoveScalingAndShear (rot, s, h, exc)) - return false; - - extractEuler (rot, r); - - t.x = mat[2][0]; - t.y = mat[2][1]; - - return true; -} - - -template -bool -checkForZeroScaleInRow (const T& scl, - const Vec2 &row, - bool exc /* = true */ ) -{ - for (int i = 0; i < 2; i++) - { - if ((abs (scl) < 1 && abs (row[i]) >= limits::max() * abs (scl))) - { - if (exc) - throw Imath::ZeroScaleExc ("Cannot remove zero scaling " - "from matrix."); - else - return false; - } - } - - return true; -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathPlane.h b/3rdparty/include/OpenEXR/ImathPlane.h deleted file mode 100644 index aa59e3c7d7..0000000000 --- a/3rdparty/include/OpenEXR/ImathPlane.h +++ /dev/null @@ -1,256 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHPLANE_H -#define INCLUDED_IMATHPLANE_H - -//---------------------------------------------------------------------- -// -// template class Plane3 -// -// The Imath::Plane3<> class represents a half space, so the -// normal may point either towards or away from origin. The -// plane P can be represented by Imath::Plane3 as either p or -p -// corresponding to the two half-spaces on either side of the -// plane. Any function which computes a distance will return -// either negative or positive values for the distance indicating -// which half-space the point is in. Note that reflection, and -// intersection functions will operate as expected. -// -//---------------------------------------------------------------------- - -#include "ImathVec.h" -#include "ImathLine.h" - -namespace Imath { - - -template -class Plane3 -{ - public: - - Vec3 normal; - T distance; - - Plane3() {} - Plane3(const Vec3 &normal, T distance); - Plane3(const Vec3 &point, const Vec3 &normal); - Plane3(const Vec3 &point1, - const Vec3 &point2, - const Vec3 &point3); - - //---------------------- - // Various set methods - //---------------------- - - void set(const Vec3 &normal, - T distance); - - void set(const Vec3 &point, - const Vec3 &normal); - - void set(const Vec3 &point1, - const Vec3 &point2, - const Vec3 &point3 ); - - //---------------------- - // Utilities - //---------------------- - - bool intersect(const Line3 &line, - Vec3 &intersection) const; - - bool intersectT(const Line3 &line, - T ¶meter) const; - - T distanceTo(const Vec3 &) const; - - Vec3 reflectPoint(const Vec3 &) const; - Vec3 reflectVector(const Vec3 &) const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - -typedef Plane3 Plane3f; -typedef Plane3 Plane3d; - - -//--------------- -// Implementation -//--------------- - -template -inline Plane3::Plane3(const Vec3 &p0, - const Vec3 &p1, - const Vec3 &p2) -{ - set(p0,p1,p2); -} - -template -inline Plane3::Plane3(const Vec3 &n, T d) -{ - set(n, d); -} - -template -inline Plane3::Plane3(const Vec3 &p, const Vec3 &n) -{ - set(p, n); -} - -template -inline void Plane3::set(const Vec3& point1, - const Vec3& point2, - const Vec3& point3) -{ - normal = (point2 - point1) % (point3 - point1); - normal.normalize(); - distance = normal ^ point1; -} - -template -inline void Plane3::set(const Vec3& point, const Vec3& n) -{ - normal = n; - normal.normalize(); - distance = normal ^ point; -} - -template -inline void Plane3::set(const Vec3& n, T d) -{ - normal = n; - normal.normalize(); - distance = d; -} - -template -inline T Plane3::distanceTo(const Vec3 &point) const -{ - return (point ^ normal) - distance; -} - -template -inline Vec3 Plane3::reflectPoint(const Vec3 &point) const -{ - return normal * distanceTo(point) * -2.0 + point; -} - - -template -inline Vec3 Plane3::reflectVector(const Vec3 &v) const -{ - return normal * (normal ^ v) * 2.0 - v; -} - - -template -inline bool Plane3::intersect(const Line3& line, Vec3& point) const -{ - T d = normal ^ line.dir; - if ( d == 0.0 ) return false; - T t = - ((normal ^ line.pos) - distance) / d; - point = line(t); - return true; -} - -template -inline bool Plane3::intersectT(const Line3& line, T &t) const -{ - T d = normal ^ line.dir; - if ( d == 0.0 ) return false; - t = - ((normal ^ line.pos) - distance) / d; - return true; -} - -template -std::ostream &operator<< (std::ostream &o, const Plane3 &plane) -{ - return o << "(" << plane.normal << ", " << plane.distance - << ")"; -} - -template -Plane3 operator* (const Plane3 &plane, const Matrix44 &M) -{ - // T - // -1 - // Could also compute M but that would suck. - // - - Vec3 dir1 = Vec3 (1, 0, 0) % plane.normal; - T dir1Len = dir1 ^ dir1; - - Vec3 tmp = Vec3 (0, 1, 0) % plane.normal; - T tmpLen = tmp ^ tmp; - - if (tmpLen > dir1Len) - { - dir1 = tmp; - dir1Len = tmpLen; - } - - tmp = Vec3 (0, 0, 1) % plane.normal; - tmpLen = tmp ^ tmp; - - if (tmpLen > dir1Len) - { - dir1 = tmp; - } - - Vec3 dir2 = dir1 % plane.normal; - Vec3 point = plane.distance * plane.normal; - - return Plane3 ( point * M, - (point + dir2) * M, - (point + dir1) * M ); -} - -template -Plane3 operator- (const Plane3 &plane) -{ - return Plane3(-plane.normal,-plane.distance); -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathPlatform.h b/3rdparty/include/OpenEXR/ImathPlatform.h deleted file mode 100644 index d542265028..0000000000 --- a/3rdparty/include/OpenEXR/ImathPlatform.h +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHPLATFORM_H -#define INCLUDED_IMATHPLATFORM_H - -//---------------------------------------------------------------------------- -// -// ImathPlatform.h -// -// This file contains functions and constants which aren't -// provided by the system libraries, compilers, or includes on -// certain platforms. -//---------------------------------------------------------------------------- - -#include - -#if defined _WIN32 || defined _WIN64 - #ifndef M_PI - #define M_PI 3.14159265358979323846 - #endif -#endif - -//----------------------------------------------------------------------------- -// -// Fixes for the "restrict" keyword. These #ifdef's for detecting -// compiler versions courtesy of Boost's select_compiler_config.hpp; -// here is the copyright notice for that file: -// -// (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and -// and distribute this software is granted provided this copyright notice -// appears in all copies. This software is provided "as is" without express -// or implied warranty, and with no claim as to its suitability for any -// purpose. -// -// Some compilers support "restrict", in which case we do nothing. -// Other compilers support some variant of it (e.g. "__restrict"). -// If we don't know anything about the compiler, we define "restrict" -// to be a no-op. -// -//----------------------------------------------------------------------------- - -#if defined __GNUC__ - #if !defined(restrict) - #define restrict __restrict - #endif - -#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) - // supports restrict, do nothing. - -#elif defined __sgi - // supports restrict, do nothing. - -#else - #define restrict - -#endif - -#endif // INCLUDED_IMATHPLATFORM_H diff --git a/3rdparty/include/OpenEXR/ImathQuat.h b/3rdparty/include/OpenEXR/ImathQuat.h deleted file mode 100644 index 4a36a5d3f7..0000000000 --- a/3rdparty/include/OpenEXR/ImathQuat.h +++ /dev/null @@ -1,690 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHQUAT_H -#define INCLUDED_IMATHQUAT_H - -//---------------------------------------------------------------------- -// -// template class Quat -// -// "Quaternions came from Hamilton ... and have been an unmixed -// evil to those who have touched them in any way. Vector is a -// useless survival ... and has never been of the slightest use -// to any creature." -// -// - Lord Kelvin -// -// This class implements the quaternion numerical type -- you -// will probably want to use this class to represent orientations -// in R3 and to convert between various euler angle reps. You -// should probably use Imath::Euler<> for that. -// -//---------------------------------------------------------------------- - -#include "ImathExc.h" -#include "ImathMatrix.h" - -#include - -namespace Imath { - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -// Disable MS VC++ warnings about conversion from double to float -#pragma warning(disable:4244) -#endif - -template -class Quat; - -template -Quat slerp (const Quat &q1,const Quat &q2, T t); - -template -Quat squad (const Quat &q1,const Quat &q2, - const Quat &qa,const Quat &qb, T t); - -template -void intermediate (const Quat &q0, const Quat &q1, - const Quat &q2, const Quat &q3, - Quat &qa, Quat &qb); - -template -class Quat -{ - public: - - T r; // real part - Vec3 v; // imaginary vector - - //----------------------------------------------------- - // Constructors - default constructor is identity quat - //----------------------------------------------------- - - Quat() : r(1), v(0,0,0) {} - - template - Quat( const Quat& q) : r(q.r), v(q.v) {} - - Quat( T s, T i, T j, T k ) : r(s), v(i,j,k) {} - - Quat( T s, Vec3 d ) : r(s), v(d) {} - - static Quat identity() { return Quat(); } - - //------------------------------------------------ - // Basic Algebra - Operators and Methods - // The operator return values are *NOT* normalized - // - // operator^ is 4D dot product - // operator/ uses the inverse() quaternion - // operator~ is conjugate -- if (S+V) is quat then - // the conjugate (S+V)* == (S-V) - // - // some operators (*,/,*=,/=) treat the quat as - // a 4D vector when one of the operands is scalar - //------------------------------------------------ - - const Quat& operator= (const Quat&); - const Quat& operator*= (const Quat&); - const Quat& operator*= (T); - const Quat& operator/= (const Quat&); - const Quat& operator/= (T); - const Quat& operator+= (const Quat&); - const Quat& operator-= (const Quat&); - T& operator[] (int index); // as 4D vector - T operator[] (int index) const; - - template bool operator == (const Quat &q) const; - template bool operator != (const Quat &q) const; - - Quat& invert(); // this -> 1 / this - Quat inverse() const; - Quat& normalize(); // returns this - Quat normalized() const; - T length() const; // in R4 - - //----------------------- - // Rotation conversion - //----------------------- - - Quat& setAxisAngle(const Vec3& axis, T radians); - Quat& setRotation(const Vec3& fromDirection, - const Vec3& toDirection); - - T angle() const; - Vec3 axis() const; - - Matrix33 toMatrix33() const; - Matrix44 toMatrix44() const; - - Quat log() const; - Quat exp() const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - -typedef Quat Quatf; -typedef Quat Quatd; - - -//--------------- -// Implementation -//--------------- - -template -inline const Quat& Quat::operator= (const Quat& q) -{ - r = q.r; - v = q.v; - return *this; -} - -template -inline const Quat& Quat::operator*= (const Quat& q) -{ - T rtmp = r * q.r - (v ^ q.v); - v = r * q.v + v * q.r + v % q.v; - r = rtmp; - return *this; -} - -template -inline const Quat& Quat::operator*= (T t) -{ - r *= t; - v *= t; - return *this; -} - -template -inline const Quat& Quat::operator/= (const Quat& q) -{ - *this = *this * q.inverse(); - return *this; -} - -template -inline const Quat& Quat::operator/= (T t) -{ - r /= t; - v /= t; - return *this; -} - -template -inline const Quat& Quat::operator+= (const Quat& q) -{ - r += q.r; - v += q.v; - return *this; -} - -template -inline const Quat& Quat::operator-= (const Quat& q) -{ - r -= q.r; - v -= q.v; - return *this; -} -template -inline T& Quat::operator[] (int index) -{ - return index ? v[index-1] : r; -} - -template -inline T Quat::operator[] (int index) const -{ - return index ? v[index-1] : r; -} - -template -template -inline bool -Quat::operator == (const Quat &q) const -{ - return r == q.r && v == q.v; -} - -template -template -inline bool -Quat::operator != (const Quat &q) const -{ - return r != q.r || v != q.v; -} - -template -inline T operator^ (const Quat& q1,const Quat& q2) -{ - return q1.r * q2.r + (q1.v ^ q2.v); -} - -template -inline T Quat::length() const -{ - return Math::sqrt( r * r + (v ^ v) ); -} - -template -inline Quat& Quat::normalize() -{ - if ( T l = length() ) { r /= l; v /= l; } - else { r = 1; v = Vec3(0); } - return *this; -} - -template -inline Quat Quat::normalized() const -{ - if ( T l = length() ) return Quat( r / l, v / l ); - return Quat(); -} - -template -inline Quat Quat::inverse() const -{ - // 1 Q* - // - = ---- where Q* is conjugate (operator~) - // Q Q* Q and (Q* Q) == Q ^ Q (4D dot) - - T qdot = *this ^ *this; - return Quat( r / qdot, -v / qdot ); -} - -template -inline Quat& Quat::invert() -{ - T qdot = (*this) ^ (*this); - r /= qdot; - v = -v / qdot; - return *this; -} - -template -Quat -slerp(const Quat &q1,const Quat &q2, T t) -{ - // - // Spherical linear interpolation. - // - // NOTE: Assumes q1 and q2 are normalized and that 0 <= t <= 1. - // - // This method does *not* interpolate along the shortest arc - // between q1 and q2. If you desire interpolation along the - // shortest arc, then consider flipping the second quaternion - // explicitly before calling slerp. The implementation of squad() - // depends on a slerp() that interpolates as is, without the - // automatic flipping. - // - - T cosomega = q1 ^ q2; - if (cosomega >= (T) 1.0) - { - // - // Special case: q1 and q2 are the same, so just return one of them. - // This also catches the case where cosomega is very slightly > 1.0 - // - - return q1; - } - - T sinomega = Math::sqrt (1 - cosomega * cosomega); - - Quat result; - - if (sinomega * limits::max() > 1) - { - T omega = Math::acos (cosomega); - T s1 = Math::sin ((1.0 - t) * omega) / sinomega; - T s2 = Math::sin (t * omega) / sinomega; - - result = s1 * q1 + s2 * q2; - } - else if (cosomega > 0) - { - // - // omega == 0 - // - - T s1 = 1.0 - t; - T s2 = t; - - result = s1 * q1 + s2 * q2; - } - else - { - // - // omega == -pi - // - - result.v.x = - q1.v.y; - result.v.y = q1.v.x; - result.v.z = - q1.r; - result.r = q1.v.z; - - T s1 = Math::sin ((0.5 - t) * M_PI); - T s2 = Math::sin (t * M_PI); - - result = s1 * q1 + s2 * result; - } - - return result; -} - -template -Quat spline(const Quat &q0, const Quat &q1, - const Quat &q2, const Quat &q3, - T t) -{ - // Spherical Cubic Spline Interpolation - - // from Advanced Animation and Rendering - // Techniques by Watt and Watt, Page 366: - // A spherical curve is constructed using three - // spherical linear interpolations of a quadrangle - // of unit quaternions: q1, qa, qb, q2. - // Given a set of quaternion keys: q0, q1, q2, q3, - // this routine does the interpolation between - // q1 and q2 by constructing two intermediate - // quaternions: qa and qb. The qa and qb are - // computed by the intermediate function to - // guarantee the continuity of tangents across - // adjacent cubic segments. The qa represents in-tangent - // for q1 and the qb represents the out-tangent for q2. - // - // The q1 q2 is the cubic segment being interpolated. - // The q0 is from the previous adjacent segment and q3 is - // from the next adjacent segment. The q0 and q3 are used - // in computing qa and qb. - // - - Quat qa = intermediate (q0, q1, q2); - Quat qb = intermediate (q1, q2, q3); - Quat result = squad(q1, qa, qb, q2, t); - - return result; -} - -template -Quat squad(const Quat &q1, const Quat &qa, - const Quat &qb, const Quat &q2, - T t) -{ - // Spherical Quadrangle Interpolation - - // from Advanced Animation and Rendering - // Techniques by Watt and Watt, Page 366: - // It constructs a spherical cubic interpolation as - // a series of three spherical linear interpolations - // of a quadrangle of unit quaternions. - // - - Quat r1 = slerp(q1, q2, t); - Quat r2 = slerp(qa, qb, t); - Quat result = slerp(r1, r2, 2*t*(1-t)); - - return result; -} - -template -Quat intermediate(const Quat &q0, const Quat &q1, const Quat &q2) -{ - // From advanced Animation and Rendering - // Techniques by Watt and Watt, Page 366: - // computing the inner quadrangle - // points (qa and qb) to guarantee tangent - // continuity. - // - Quat q1inv = q1.inverse(); - Quat c1 = q1inv*q2; - Quat c2 = q1inv*q0; - Quat c3 = (T) (-0.25) * (c2.log() + c1.log()); - Quat qa = q1 * c3.exp(); - qa.normalize(); - return qa; -} - -template -inline Quat Quat::log() const -{ - // - // For unit quaternion, from Advanced Animation and - // Rendering Techniques by Watt and Watt, Page 366: - // - - T theta = Math::acos (std::min (r, (T) 1.0)); - if (theta == 0) - return Quat (0, v); - - T sintheta = Math::sin (theta); - - T k; - if (abs (sintheta) < 1 && abs (theta) >= limits::max() * abs (sintheta)) - k = 0; - else - k = theta / sintheta; - - return Quat ((T) 0, v.x * k, v.y * k, v.z * k); -} - -template -inline Quat Quat::exp() const -{ - // - // For pure quaternion (zero scalar part): - // from Advanced Animation and Rendering - // Techniques by Watt and Watt, Page 366: - // - - T theta = v.length(); - T sintheta = Math::sin (theta); - - T k; - if (abs (theta) < 1 && abs (sintheta) >= limits::max() * abs (theta)) - k = 0; - else - k = sintheta / theta; - - T costheta = Math::cos (theta); - - return Quat (costheta, v.x * k, v.y * k, v.z * k); -} - -template -inline T Quat::angle() const -{ - return 2.0*Math::acos(r); -} - -template -inline Vec3 Quat::axis() const -{ - return v.normalized(); -} - -template -inline Quat& Quat::setAxisAngle(const Vec3& axis, T radians) -{ - r = Math::cos(radians/2); - v = axis.normalized() * Math::sin(radians/2); - return *this; -} - - -template -Quat& -Quat::setRotation(const Vec3& from, const Vec3& to) -{ - // - // Ported from SbRotation - // - - T cost = from.dot(to) / Math::sqrt(from.dot(from) * to.dot(to)); - - // check for degeneracies - if (cost > 0.99999) - { - // - // Vectors are parallel. - // - - r = 1.0; - v = Vec3(0); - } - else if (cost < -0.99999) - { - // - // Vectors are opposite. Find an axis to rotate around, - // which should be perpendicular to the original axis. - // - - Vec3 frm = from.normalized(); - v = frm.cross(Vec3(1, 0, 0)); - if (v.length() < 0.00001) - v = frm.cross(Vec3(0, 1, 0)); - r = 0; - v.normalize(); - } - else - { - // - // Use half-angle formulae: - // cos^2 t = ( 1 + cos (2t) ) / 2 - // w part is cosine of half the rotation angle - // - - r = Math::sqrt(0.5 * (1.0 + cost)); - - // - // sin^2 t = ( 1 - cos (2t) ) / 2 - // Do the normalization of the axis vector at the same time so - // we only call sqrt once. - // - - v = from.cross(to); - v *= Math::sqrt((0.5 * (1.0 - cost))/(v.dot(v))); - } - - return *this; -} - -template -Matrix33 Quat::toMatrix33() const -{ - return Matrix33(1. - 2.0 * (v.y * v.y + v.z * v.z), - 2.0 * (v.x * v.y + v.z * r), - 2.0 * (v.z * v.x - v.y * r), - - 2.0 * (v.x * v.y - v.z * r), - 1. - 2.0 * (v.z * v.z + v.x * v.x), - 2.0 * (v.y * v.z + v.x * r), - - 2.0 * (v.z * v.x + v.y * r), - 2.0 * (v.y * v.z - v.x * r), - 1. - 2.0 * (v.y * v.y + v.x * v.x)); -} - -template -Matrix44 Quat::toMatrix44() const -{ - return Matrix44(1. - 2.0 * (v.y * v.y + v.z * v.z), - 2.0 * (v.x * v.y + v.z * r), - 2.0 * (v.z * v.x - v.y * r), - 0., - 2.0 * (v.x * v.y - v.z * r), - 1. - 2.0 * (v.z * v.z + v.x * v.x), - 2.0 * (v.y * v.z + v.x * r), - 0., - 2.0 * (v.z * v.x + v.y * r), - 2.0 * (v.y * v.z - v.x * r), - 1. - 2.0 * (v.y * v.y + v.x * v.x), - 0., - 0., - 0., - 0., - 1.0 ); -} - - -template -inline Matrix33 operator* (const Matrix33 &M, const Quat &q) -{ - return M * q.toMatrix33(); -} - -template -inline Matrix33 operator* (const Quat &q, const Matrix33 &M) -{ - return q.toMatrix33() * M; -} - -template -std::ostream& operator<< (std::ostream &o, const Quat &q) -{ - return o << "(" << q.r - << " " << q.v.x - << " " << q.v.y - << " " << q.v.z - << ")"; - -} - -template -inline Quat operator* (const Quat& q1, const Quat& q2) -{ - // (S1+V1) (S2+V2) = S1 S2 - V1.V2 + S1 V2 + V1 S2 + V1 x V2 - return Quat( q1.r * q2.r - (q1.v ^ q2.v), - q1.r * q2.v + q1.v * q2.r + q1.v % q2.v ); -} - -template -inline Quat operator/ (const Quat& q1, const Quat& q2) -{ - return q1 * q2.inverse(); -} - -template -inline Quat operator/ (const Quat& q,T t) -{ - return Quat(q.r/t,q.v/t); -} - -template -inline Quat operator* (const Quat& q,T t) -{ - return Quat(q.r*t,q.v*t); -} - -template -inline Quat operator* (T t, const Quat& q) -{ - return Quat(q.r*t,q.v*t); -} - -template -inline Quat operator+ (const Quat& q1, const Quat& q2) -{ - return Quat( q1.r + q2.r, q1.v + q2.v ); -} - -template -inline Quat operator- (const Quat& q1, const Quat& q2) -{ - return Quat( q1.r - q2.r, q1.v - q2.v ); -} - -template -inline Quat operator~ (const Quat& q) -{ - return Quat( q.r, -q.v ); // conjugate: (S+V)* = S-V -} - -template -inline Quat operator- (const Quat& q) -{ - return Quat( -q.r, -q.v ); -} - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -#pragma warning(default:4244) -#endif - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathRandom.h b/3rdparty/include/OpenEXR/ImathRandom.h deleted file mode 100644 index 4cd44b21ec..0000000000 --- a/3rdparty/include/OpenEXR/ImathRandom.h +++ /dev/null @@ -1,461 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMATHRANDOM_H -#define INCLUDED_IMATHRANDOM_H - -//----------------------------------------------------------------------------- -// -// Generators for uniformly distributed pseudo-random numbers and -// functions that use those generators to generate numbers with -// different distributions: -// -// class Rand32 -// class Rand48 -// solidSphereRand() -// hollowSphereRand() -// gaussRand() -// gaussSphereRand() -// -//----------------------------------------------------------------------------- - -// -// Here is the copyright for the *rand48() functions implemented for -// Windows. -// - -// -// Copyright (c) 1993 Martin Birgmeier -// All rights reserved. -// -// You may redistribute unmodified or modified versions of this source -// code provided that the above copyright notice and this and the -// following conditions are retained. -// -// This software is provided ``as is'', and comes with no warranties -// of any kind. I shall in no event be liable for anything that happens -// to anyone/anything when using this software. -// - -#include -#include - -namespace Imath { - - -//----------------------------------------------- -// Fast random-number generator that generates -// a uniformly distributed sequence with a period -// length of 2^32. -//----------------------------------------------- - -class Rand32 -{ - public: - - //------------ - // Constructor - //------------ - - Rand32 (unsigned long int seed = 0); - - - //-------------------------------- - // Re-initialize with a given seed - //-------------------------------- - - void init (unsigned long int seed); - - - //---------------------------------------------------------- - // Get the next value in the sequence (range: [false, true]) - //---------------------------------------------------------- - - bool nextb (); - - - //--------------------------------------------------------------- - // Get the next value in the sequence (range: [0 ... 0xffffffff]) - //--------------------------------------------------------------- - - unsigned long int nexti (); - - - //------------------------------------------------------ - // Get the next value in the sequence (range: [0 ... 1[) - //------------------------------------------------------ - - float nextf (); - - - //------------------------------------------------------------------- - // Get the next value in the sequence (range [rangeMin ... rangeMax[) - //------------------------------------------------------------------- - - float nextf (float rangeMin, float rangeMax); - - - private: - - void next (); - - unsigned long int _state; -}; - - -//-------------------------------------------------------- -// Random-number generator based on the C Standard Library -// functions drand48(), lrand48() & company; generates a -// uniformly distributed sequence. -//-------------------------------------------------------- - -class Rand48 -{ - public: - - //------------ - // Constructor - //------------ - - Rand48 (unsigned long int seed = 0); - - - //-------------------------------- - // Re-initialize with a given seed - //-------------------------------- - - void init (unsigned long int seed); - - - //---------------------------------------------------------- - // Get the next value in the sequence (range: [false, true]) - //---------------------------------------------------------- - - bool nextb (); - - - //--------------------------------------------------------------- - // Get the next value in the sequence (range: [0 ... 0x7fffffff]) - //--------------------------------------------------------------- - - long int nexti (); - - - //------------------------------------------------------ - // Get the next value in the sequence (range: [0 ... 1[) - //------------------------------------------------------ - - double nextf (); - - - //------------------------------------------------------------------- - // Get the next value in the sequence (range [rangeMin ... rangeMax[) - //------------------------------------------------------------------- - - double nextf (double rangeMin, double rangeMax); - - - private: - - unsigned short int _state[3]; - -#if defined ( _WIN32 ) || defined ( _WIN64 ) || defined ( __MWERKS__ ) - void shiftState(); -#endif -}; - - -//------------------------------------------------------------ -// Return random points uniformly distributed in a sphere with -// radius 1 around the origin (distance from origin <= 1). -//------------------------------------------------------------ - -template -Vec -solidSphereRand (Rand &rand); - - -//------------------------------------------------------------- -// Return random points uniformly distributed on the surface of -// a sphere with radius 1 around the origin. -//------------------------------------------------------------- - -template -Vec -hollowSphereRand (Rand &rand); - - -//----------------------------------------------- -// Return random numbers with a normal (Gaussian) -// distribution with zero mean and unit variance. -//----------------------------------------------- - -template -float -gaussRand (Rand &rand); - - -//---------------------------------------------------- -// Return random points whose distance from the origin -// has a normal (Gaussian) distribution with zero mean -// and unit variance. -//---------------------------------------------------- - -template -Vec -gaussSphereRand (Rand &rand); - - -//--------------- -// Implementation -//--------------- - - -inline void -Rand32::init (unsigned long int seed) -{ - _state = (seed * 0xa5a573a5L) ^ 0x5a5a5a5aL; -} - - -inline -Rand32::Rand32 (unsigned long int seed) -{ - init (seed); -} - - -inline void -Rand32::next () -{ - _state = 1664525L * _state + 1013904223L; -} - - -inline bool -Rand32::nextb () -{ - next (); - // Return the 31st (most significant) bit, by and-ing with 2 ^ 31. - return !!(_state & 2147483648UL); -} - - -inline unsigned long int -Rand32::nexti () -{ - next (); - return _state & 0xffffffff; -} - - -inline float -Rand32::nextf () -{ - next (); - return ((int) (_state & 0xffffff)) * ((float) (1.0F / 0x1000000)); -} - - -inline float -Rand32::nextf (float rangeMin, float rangeMax) -{ - return rangeMin + nextf() * (rangeMax - rangeMin); -} - - -inline void -Rand48::init (unsigned long int seed) -{ - seed = (seed * 0xa5a573a5L) ^ 0x5a5a5a5aL; - - _state[0] = (unsigned short int) (seed); - _state[1] = (unsigned short int) (seed >> 16); - _state[2] = (unsigned short int) (seed); -} - - -inline -Rand48::Rand48 (unsigned long int seed) -{ - init (seed); -} - - -#if defined ( _WIN32 ) || defined ( _WIN64 ) || defined ( __MWERKS__ ) - -inline void -Rand48::shiftState() -{ - unsigned long accu; - unsigned short temp[2]; - - accu = 0xe66dUL * ( unsigned long )_state[0] + 0x000bUL; - - temp[0] = ( unsigned short )accu; /* lower 16 bits */ - accu >>= sizeof( unsigned short ) * 8; - - accu += 0xe66dUL * ( unsigned long )_state[1] + - 0xdeecUL * ( unsigned long )_state[0]; - - temp[1] = ( unsigned short )accu; /* middle 16 bits */ - accu >>= sizeof( unsigned short ) * 8; - - accu += 0xe66dUL * _state[2] + - 0xdeecUL * _state[1] + - 0x0005UL * _state[0]; - - _state[0] = temp[0]; - _state[1] = temp[1]; - _state[2] = ( unsigned short )accu; -} - -#endif - -inline bool -Rand48::nextb () -{ -#if defined ( _WIN32 ) || defined ( _WIN64 ) || defined ( __MWERKS__ ) - shiftState(); - return ( ( long( _state[2] ) << 15 ) + ( long( _state[1] ) >> 1 ) ) & 0x1; -#else - return nrand48 (_state) & 1; -#endif -} - - -inline long int -Rand48::nexti () -{ -#if defined ( _WIN32 ) || defined ( _WIN64 ) || defined ( __MWERKS__ ) - shiftState(); - return ( long( _state[2] ) << 15 ) + ( long( _state[1] ) >> 1 ); -#else - return nrand48 (_state); -#endif -} - - -inline double -Rand48::nextf () -{ -#if defined ( _WIN32 ) || defined ( _WIN64 ) || defined ( __MWERKS__ ) - shiftState(); - return ldexp( double( _state[0] ), -48 ) + - ldexp( double( _state[1] ), -32 ) + - ldexp( double( _state[2] ), -16 ); -#else - return erand48 (_state); -#endif -} - - -inline double -Rand48::nextf (double rangeMin, double rangeMax) -{ - return rangeMin + nextf() * (rangeMax - rangeMin); -} - - -template -Vec -solidSphereRand (Rand &rand) -{ - Vec v; - - do - { - for (unsigned int i = 0; i < Vec::dimensions(); i++) - v[i] = (typename Vec::BaseType) rand.nextf (-1, 1); - } - while (v.length2() > 1); - - return v; -} - - -template -Vec -hollowSphereRand (Rand &rand) -{ - Vec v; - typename Vec::BaseType length; - - do - { - for (unsigned int i = 0; i < Vec::dimensions(); i++) - v[i] = (typename Vec::BaseType) rand.nextf (-1, 1); - - length = v.length(); - } - while (length > 1 || length == 0); - - return v / length; -} - - -template -float -gaussRand (Rand &rand) -{ - float x; // Note: to avoid numerical problems with very small - float y; // numbers, we make these variables singe-precision - float length2; // floats, but later we call the double-precision log() - // and sqrt() functions instead of logf() and sqrtf(). - do - { - x = float (rand.nextf (-1, 1)); - y = float (rand.nextf (-1, 1)); - length2 = x * x + y * y; - } - while (length2 >= 1 || length2 == 0); - - return x * sqrt (-2 * log (length2) / length2); -} - - -template -Vec -gaussSphereRand (Rand &rand) -{ - return hollowSphereRand (rand) * gaussRand (rand); -} - -double drand48(); -long int lrand48(); - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathRoots.h b/3rdparty/include/OpenEXR/ImathRoots.h deleted file mode 100644 index 16723f722c..0000000000 --- a/3rdparty/include/OpenEXR/ImathRoots.h +++ /dev/null @@ -1,217 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHROOTS_H -#define INCLUDED_IMATHROOTS_H - -//--------------------------------------------------------------------- -// -// Functions to solve linear, quadratic or cubic equations -// -//--------------------------------------------------------------------- - -#include - -namespace Imath { - -//-------------------------------------------------------------------------- -// Find the real solutions of a linear, quadratic or cubic equation: -// -// function equation solved -// -// solveLinear (a, b, x) a * x + b == 0 -// solveQuadratic (a, b, c, x) a * x*x + b * x + c == 0 -// solveNormalizedCubic (r, s, t, x) x*x*x + r * x*x + s * x + t == 0 -// solveCubic (a, b, c, d, x) a * x*x*x + b * x*x + c * x + d == 0 -// -// Return value: -// -// 3 three real solutions, stored in x[0], x[1] and x[2] -// 2 two real solutions, stored in x[0] and x[1] -// 1 one real solution, stored in x[1] -// 0 no real solutions -// -1 all real numbers are solutions -// -// Notes: -// -// * It is possible that an equation has real solutions, but that the -// solutions (or some intermediate result) are not representable. -// In this case, either some of the solutions returned are invalid -// (nan or infinity), or, if floating-point exceptions have been -// enabled with Iex::mathExcOn(), an Iex::MathExc exception is -// thrown. -// -// * Cubic equations are solved using Cardano's Formula; even though -// only real solutions are produced, some intermediate results are -// complex (std::complex). -// -//-------------------------------------------------------------------------- - -template int solveLinear (T a, T b, T &x); -template int solveQuadratic (T a, T b, T c, T x[2]); -template int solveNormalizedCubic (T r, T s, T t, T x[3]); -template int solveCubic (T a, T b, T c, T d, T x[3]); - - -//--------------- -// Implementation -//--------------- - -template -int -solveLinear (T a, T b, T &x) -{ - if (a != 0) - { - x = -b / a; - return 1; - } - else if (b != 0) - { - return 0; - } - else - { - return -1; - } -} - - -template -int -solveQuadratic (T a, T b, T c, T x[2]) -{ - if (a == 0) - { - return solveLinear (b, c, x[0]); - } - else - { - T D = b * b - 4 * a * c; - - if (D > 0) - { - T s = sqrt (D); - - x[0] = (-b + s) / (2 * a); - x[1] = (-b - s) / (2 * a); - return 2; - } - if (D == 0) - { - x[0] = -b / (2 * a); - return 1; - } - else - { - return 0; - } - } -} - - -template -int -solveNormalizedCubic (T r, T s, T t, T x[3]) -{ - T p = (3 * s - r * r) / 3; - T q = 2 * r * r * r / 27 - r * s / 3 + t; - T p3 = p / 3; - T q2 = q / 2; - T D = p3 * p3 * p3 + q2 * q2; - - if (D == 0 && p3 == 0) - { - x[0] = -r / 3; - x[1] = -r / 3; - x[2] = -r / 3; - return 1; - } - - std::complex u = std::pow (-q / 2 + std::sqrt (std::complex (D)), - T (1) / T (3)); - - std::complex v = -p / (T (3) * u); - - const T sqrt3 = T (1.73205080756887729352744634150587); // enough digits - // for long double - std::complex y0 (u + v); - - std::complex y1 (-(u + v) / T (2) + - (u - v) / T (2) * std::complex (0, sqrt3)); - - std::complex y2 (-(u + v) / T (2) - - (u - v) / T (2) * std::complex (0, sqrt3)); - - if (D > 0) - { - x[0] = y0.real() - r / 3; - return 1; - } - else if (D == 0) - { - x[0] = y0.real() - r / 3; - x[1] = y1.real() - r / 3; - return 2; - } - else - { - x[0] = y0.real() - r / 3; - x[1] = y1.real() - r / 3; - x[2] = y2.real() - r / 3; - return 3; - } -} - - -template -int -solveCubic (T a, T b, T c, T d, T x[3]) -{ - if (a == 0) - { - return solveQuadratic (b, c, d, x); - } - else - { - return solveNormalizedCubic (b / a, c / a, d / a, x); - } -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathShear.h b/3rdparty/include/OpenEXR/ImathShear.h deleted file mode 100644 index bad40a549c..0000000000 --- a/3rdparty/include/OpenEXR/ImathShear.h +++ /dev/null @@ -1,659 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHSHEAR_H -#define INCLUDED_IMATHSHEAR_H - -//---------------------------------------------------- -// -// Shear6 class template. -// -//---------------------------------------------------- - -#include "ImathExc.h" -#include "ImathLimits.h" -#include "ImathMath.h" -#include "ImathVec.h" - -#include - - -namespace Imath { - - - - -template class Shear6 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T xy, xz, yz, yx, zx, zy; - - T & operator [] (int i); - const T & operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Shear6 (); // (0 0 0 0 0 0) - Shear6 (T XY, T XZ, T YZ); // (XY XZ YZ 0 0 0) - Shear6 (const Vec3 &v); // (v.x v.y v.z 0 0 0) - template // (v.x v.y v.z 0 0 0) - Shear6 (const Vec3 &v); - Shear6 (T XY, T XZ, T YZ, // (XY XZ YZ YX ZX ZY) - T YX, T ZX, T ZY); - - - //--------------------------------- - // Copy constructors and assignment - //--------------------------------- - - Shear6 (const Shear6 &h); - template Shear6 (const Shear6 &h); - - const Shear6 & operator = (const Shear6 &h); - template - const Shear6 & operator = (const Vec3 &v); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - template - void setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY); - - template - void setValue (const Shear6 &h); - - template - void getValue (S &XY, S &XZ, S &YZ, - S &YX, S &ZX, S &ZY) const; - - template - void getValue (Shear6 &h) const; - - T * getValue(); - const T * getValue() const; - - - //--------- - // Equality - //--------- - - template - bool operator == (const Shear6 &h) const; - - template - bool operator != (const Shear6 &h) const; - - //----------------------------------------------------------------------- - // Compare two shears and test if they are "approximately equal": - // - // equalWithAbsError (h, e) - // - // Returns true if the coefficients of this and h are the same with - // an absolute error of no more than e, i.e., for all i - // - // abs (this[i] - h[i]) <= e - // - // equalWithRelError (h, e) - // - // Returns true if the coefficients of this and h are the same with - // a relative error of no more than e, i.e., for all i - // - // abs (this[i] - h[i]) <= e * abs (this[i]) - //----------------------------------------------------------------------- - - bool equalWithAbsError (const Shear6 &h, T e) const; - bool equalWithRelError (const Shear6 &h, T e) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Shear6 & operator += (const Shear6 &h); - Shear6 operator + (const Shear6 &h) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Shear6 & operator -= (const Shear6 &h); - Shear6 operator - (const Shear6 &h) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Shear6 operator - () const; - const Shear6 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Shear6 & operator *= (const Shear6 &h); - const Shear6 & operator *= (T a); - Shear6 operator * (const Shear6 &h) const; - Shear6 operator * (T a) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Shear6 & operator /= (const Shear6 &h); - const Shear6 & operator /= (T a); - Shear6 operator / (const Shear6 &h) const; - Shear6 operator / (T a) const; - - - //---------------------------------------------------------- - // Number of dimensions, i.e. number of elements in a Shear6 - //---------------------------------------------------------- - - static unsigned int dimensions() {return 6;} - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} - - - //-------------------------------------------------------------- - // Base type -- in templates, which accept a parameter, V, which - // could be either a Vec2 or a Shear6, you can refer to T as - // V::BaseType - //-------------------------------------------------------------- - - typedef T BaseType; -}; - - -//-------------- -// Stream output -//-------------- - -template -std::ostream & operator << (std::ostream &s, const Shear6 &h); - - -//---------------------------------------------------- -// Reverse multiplication: scalar * Shear6 -//---------------------------------------------------- - -template Shear6 operator * (S a, const Shear6 &h); - - -//------------------------- -// Typedefs for convenience -//------------------------- - -typedef Vec3 Shear3f; -typedef Vec3 Shear3d; -typedef Shear6 Shear6f; -typedef Shear6 Shear6d; - - - - -//----------------------- -// Implementation of Shear6 -//----------------------- - -template -inline T & -Shear6::operator [] (int i) -{ - return (&xy)[i]; -} - -template -inline const T & -Shear6::operator [] (int i) const -{ - return (&xy)[i]; -} - -template -inline -Shear6::Shear6 () -{ - xy = xz = yz = yx = zx = zy = 0; -} - -template -inline -Shear6::Shear6 (T XY, T XZ, T YZ) -{ - xy = XY; - xz = XZ; - yz = YZ; - yx = 0; - zx = 0; - zy = 0; -} - -template -inline -Shear6::Shear6 (const Vec3 &v) -{ - xy = v.x; - xz = v.y; - yz = v.z; - yx = 0; - zx = 0; - zy = 0; -} - -template -template -inline -Shear6::Shear6 (const Vec3 &v) -{ - xy = T (v.x); - xz = T (v.y); - yz = T (v.z); - yx = 0; - zx = 0; - zy = 0; -} - -template -inline -Shear6::Shear6 (T XY, T XZ, T YZ, T YX, T ZX, T ZY) -{ - xy = XY; - xz = XZ; - yz = YZ; - yx = YX; - zx = ZX; - zy = ZY; -} - -template -inline -Shear6::Shear6 (const Shear6 &h) -{ - xy = h.xy; - xz = h.xz; - yz = h.yz; - yx = h.yx; - zx = h.zx; - zy = h.zy; -} - -template -template -inline -Shear6::Shear6 (const Shear6 &h) -{ - xy = T (h.xy); - xz = T (h.xz); - yz = T (h.yz); - yx = T (h.yx); - zx = T (h.zx); - zy = T (h.zy); -} - -template -inline const Shear6 & -Shear6::operator = (const Shear6 &h) -{ - xy = h.xy; - xz = h.xz; - yz = h.yz; - yx = h.yx; - zx = h.zx; - zy = h.zy; - return *this; -} - -template -template -inline const Shear6 & -Shear6::operator = (const Vec3 &v) -{ - xy = T (v.x); - xz = T (v.y); - yz = T (v.z); - yx = 0; - zx = 0; - zy = 0; - return *this; -} - -template -template -inline void -Shear6::setValue (S XY, S XZ, S YZ, S YX, S ZX, S ZY) -{ - xy = T (XY); - xz = T (XZ); - yz = T (YZ); - yx = T (YX); - zx = T (ZX); - zy = T (ZY); -} - -template -template -inline void -Shear6::setValue (const Shear6 &h) -{ - xy = T (h.xy); - xz = T (h.xz); - yz = T (h.yz); - yx = T (h.yx); - zx = T (h.zx); - zy = T (h.zy); -} - -template -template -inline void -Shear6::getValue (S &XY, S &XZ, S &YZ, S &YX, S &ZX, S &ZY) const -{ - XY = S (xy); - XZ = S (xz); - YZ = S (yz); - YX = S (yx); - ZX = S (zx); - ZY = S (zy); -} - -template -template -inline void -Shear6::getValue (Shear6 &h) const -{ - h.xy = S (xy); - h.xz = S (xz); - h.yz = S (yz); - h.yx = S (yx); - h.zx = S (zx); - h.zy = S (zy); -} - -template -inline T * -Shear6::getValue() -{ - return (T *) &xy; -} - -template -inline const T * -Shear6::getValue() const -{ - return (const T *) &xy; -} - -template -template -inline bool -Shear6::operator == (const Shear6 &h) const -{ - return xy == h.xy && xz == h.xz && yz == h.yz && - yx == h.yx && zx == h.zx && zy == h.zy; -} - -template -template -inline bool -Shear6::operator != (const Shear6 &h) const -{ - return xy != h.xy || xz != h.xz || yz != h.yz || - yx != h.yx || zx != h.zx || zy != h.zy; -} - -template -bool -Shear6::equalWithAbsError (const Shear6 &h, T e) const -{ - for (int i = 0; i < 6; i++) - if (!Imath::equalWithAbsError ((*this)[i], h[i], e)) - return false; - - return true; -} - -template -bool -Shear6::equalWithRelError (const Shear6 &h, T e) const -{ - for (int i = 0; i < 6; i++) - if (!Imath::equalWithRelError ((*this)[i], h[i], e)) - return false; - - return true; -} - - -template -inline const Shear6 & -Shear6::operator += (const Shear6 &h) -{ - xy += h.xy; - xz += h.xz; - yz += h.yz; - yx += h.yx; - zx += h.zx; - zy += h.zy; - return *this; -} - -template -inline Shear6 -Shear6::operator + (const Shear6 &h) const -{ - return Shear6 (xy + h.xy, xz + h.xz, yz + h.yz, - yx + h.yx, zx + h.zx, zy + h.zy); -} - -template -inline const Shear6 & -Shear6::operator -= (const Shear6 &h) -{ - xy -= h.xy; - xz -= h.xz; - yz -= h.yz; - yx -= h.yx; - zx -= h.zx; - zy -= h.zy; - return *this; -} - -template -inline Shear6 -Shear6::operator - (const Shear6 &h) const -{ - return Shear6 (xy - h.xy, xz - h.xz, yz - h.yz, - yx - h.yx, zx - h.zx, zy - h.zy); -} - -template -inline Shear6 -Shear6::operator - () const -{ - return Shear6 (-xy, -xz, -yz, -yx, -zx, -zy); -} - -template -inline const Shear6 & -Shear6::negate () -{ - xy = -xy; - xz = -xz; - yz = -yz; - yx = -yx; - zx = -zx; - zy = -zy; - return *this; -} - -template -inline const Shear6 & -Shear6::operator *= (const Shear6 &h) -{ - xy *= h.xy; - xz *= h.xz; - yz *= h.yz; - yx *= h.yx; - zx *= h.zx; - zy *= h.zy; - return *this; -} - -template -inline const Shear6 & -Shear6::operator *= (T a) -{ - xy *= a; - xz *= a; - yz *= a; - yx *= a; - zx *= a; - zy *= a; - return *this; -} - -template -inline Shear6 -Shear6::operator * (const Shear6 &h) const -{ - return Shear6 (xy * h.xy, xz * h.xz, yz * h.yz, - yx * h.yx, zx * h.zx, zy * h.zy); -} - -template -inline Shear6 -Shear6::operator * (T a) const -{ - return Shear6 (xy * a, xz * a, yz * a, - yx * a, zx * a, zy * a); -} - -template -inline const Shear6 & -Shear6::operator /= (const Shear6 &h) -{ - xy /= h.xy; - xz /= h.xz; - yz /= h.yz; - yx /= h.yx; - zx /= h.zx; - zy /= h.zy; - return *this; -} - -template -inline const Shear6 & -Shear6::operator /= (T a) -{ - xy /= a; - xz /= a; - yz /= a; - yx /= a; - zx /= a; - zy /= a; - return *this; -} - -template -inline Shear6 -Shear6::operator / (const Shear6 &h) const -{ - return Shear6 (xy / h.xy, xz / h.xz, yz / h.yz, - yx / h.yx, zx / h.zx, zy / h.zy); -} - -template -inline Shear6 -Shear6::operator / (T a) const -{ - return Shear6 (xy / a, xz / a, yz / a, - yx / a, zx / a, zy / a); -} - - -//----------------------------- -// Stream output implementation -//----------------------------- - -template -std::ostream & -operator << (std::ostream &s, const Shear6 &h) -{ - return s << '(' - << h.xy << ' ' << h.xz << ' ' << h.yz - << h.yx << ' ' << h.zx << ' ' << h.zy - << ')'; -} - - -//----------------------------------------- -// Implementation of reverse multiplication -//----------------------------------------- - -template -inline Shear6 -operator * (S a, const Shear6 &h) -{ - return Shear6 (a * h.xy, a * h.xz, a * h.yz, - a * h.yx, a * h.zx, a * h.zy); -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathSphere.h b/3rdparty/include/OpenEXR/ImathSphere.h deleted file mode 100644 index 3860701d81..0000000000 --- a/3rdparty/include/OpenEXR/ImathSphere.h +++ /dev/null @@ -1,177 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHSPHERE_H -#define INCLUDED_IMATHSPHERE_H - -//------------------------------------- -// -// A 3D sphere class template -// -//------------------------------------- - -#include "ImathVec.h" -#include "ImathBox.h" -#include "ImathLine.h" - -namespace Imath { - -template -class Sphere3 -{ - public: - - Vec3 center; - T radius; - - //--------------- - // Constructors - //--------------- - - Sphere3() : center(0,0,0), radius(0) {} - Sphere3(const Vec3 &c, T r) : center(c), radius(r) {} - - //------------------------------------------------------------------- - // Utilities: - // - // s.circumscribe(b) sets center and radius of sphere s - // so that the s tightly encloses box b. - // - // s.intersectT (l, t) If sphere s and line l intersect, then - // intersectT() computes the smallest t, - // t >= 0, so that l(t) is a point on the - // sphere. intersectT() then returns true. - // - // If s and l do not intersect, intersectT() - // returns false. - // - // s.intersect (l, i) If sphere s and line l intersect, then - // intersect() calls s.intersectT(l,t) and - // computes i = l(t). - // - // If s and l do not intersect, intersect() - // returns false. - // - //------------------------------------------------------------------- - - void circumscribe(const Box > &box); - bool intersect(const Line3 &l, Vec3 &intersection) const; - bool intersectT(const Line3 &l, T &t) const; -}; - - -//-------------------- -// Convenient typedefs -//-------------------- - -typedef Sphere3 Sphere3f; -typedef Sphere3 Sphere3d; - - -//--------------- -// Implementation -//--------------- - -template -void Sphere3::circumscribe(const Box > &box) -{ - center = T(0.5) * (box.min + box.max); - radius = (box.max - center).length(); -} - - -template -bool Sphere3::intersectT(const Line3 &line, T &t) const -{ - bool doesIntersect = true; - - Vec3 v = line.pos - center; - T B = 2.0 * (line.dir ^ v); - T C = (v ^ v) - (radius * radius); - - // compute discriminant - // if negative, there is no intersection - - T discr = B*B - 4.0*C; - - if (discr < 0.0) - { - // line and Sphere3 do not intersect - - doesIntersect = false; - } - else - { - // t0: (-B - sqrt(B^2 - 4AC)) / 2A (A = 1) - - T sqroot = Math::sqrt(discr); - t = (-B - sqroot) * 0.5; - - if (t < 0.0) - { - // no intersection, try t1: (-B + sqrt(B^2 - 4AC)) / 2A (A = 1) - - t = (-B + sqroot) * 0.5; - } - - if (t < 0.0) - doesIntersect = false; - } - - return doesIntersect; -} - - -template -bool Sphere3::intersect(const Line3 &line, Vec3 &intersection) const -{ - T t; - - if (intersectT (line, t)) - { - intersection = line(t); - return true; - } - else - { - return false; - } -} - - -} //namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathVec.h b/3rdparty/include/OpenEXR/ImathVec.h deleted file mode 100644 index b7adc5f958..0000000000 --- a/3rdparty/include/OpenEXR/ImathVec.h +++ /dev/null @@ -1,1426 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHVEC_H -#define INCLUDED_IMATHVEC_H - -//---------------------------------------------------- -// -// 2D and 3D point/vector class templates! -// -//---------------------------------------------------- - -#include "ImathExc.h" -#include "ImathLimits.h" -#include "ImathMath.h" - -#include - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -// suppress exception specification warnings -#pragma warning(disable:4290) -#endif - - -namespace Imath { - - -template class Vec2 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T x, y; - - T & operator [] (int i); - const T & operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Vec2 (); // no initialization - explicit Vec2 (T a); // (a a) - Vec2 (T a, T b); // (a b) - - - //--------------------------------- - // Copy constructors and assignment - //--------------------------------- - - Vec2 (const Vec2 &v); - template Vec2 (const Vec2 &v); - - const Vec2 & operator = (const Vec2 &v); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - template - void setValue (S a, S b); - - template - void setValue (const Vec2 &v); - - template - void getValue (S &a, S &b) const; - - template - void getValue (Vec2 &v) const; - - T * getValue (); - const T * getValue () const; - - - //--------- - // Equality - //--------- - - template - bool operator == (const Vec2 &v) const; - - template - bool operator != (const Vec2 &v) const; - - - //----------------------------------------------------------------------- - // Compare two vectors and test if they are "approximately equal": - // - // equalWithAbsError (v, e) - // - // Returns true if the coefficients of this and v are the same with - // an absolute error of no more than e, i.e., for all i - // - // abs (this[i] - v[i]) <= e - // - // equalWithRelError (v, e) - // - // Returns true if the coefficients of this and v are the same with - // a relative error of no more than e, i.e., for all i - // - // abs (this[i] - v[i]) <= e * abs (this[i]) - //----------------------------------------------------------------------- - - bool equalWithAbsError (const Vec2 &v, T e) const; - bool equalWithRelError (const Vec2 &v, T e) const; - - //------------ - // Dot product - //------------ - - T dot (const Vec2 &v) const; - T operator ^ (const Vec2 &v) const; - - - //------------------------------------------------ - // Right-handed cross product, i.e. z component of - // Vec3 (this->x, this->y, 0) % Vec3 (v.x, v.y, 0) - //------------------------------------------------ - - T cross (const Vec2 &v) const; - T operator % (const Vec2 &v) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Vec2 & operator += (const Vec2 &v); - Vec2 operator + (const Vec2 &v) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Vec2 & operator -= (const Vec2 &v); - Vec2 operator - (const Vec2 &v) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Vec2 operator - () const; - const Vec2 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Vec2 & operator *= (const Vec2 &v); - const Vec2 & operator *= (T a); - Vec2 operator * (const Vec2 &v) const; - Vec2 operator * (T a) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Vec2 & operator /= (const Vec2 &v); - const Vec2 & operator /= (T a); - Vec2 operator / (const Vec2 &v) const; - Vec2 operator / (T a) const; - - - //---------------------------------------------------------------- - // Length and normalization: If v.length() is 0.0, v.normalize() - // and v.normalized() produce a null vector; v.normalizeExc() and - // v.normalizedExc() throw a NullVecExc. - // v.normalizeNonNull() and v.normalizedNonNull() are slightly - // faster than the other normalization routines, but if v.length() - // is 0.0, the result is undefined. - //---------------------------------------------------------------- - - T length () const; - T length2 () const; - - const Vec2 & normalize (); // modifies *this - const Vec2 & normalizeExc () throw (Iex::MathExc); - const Vec2 & normalizeNonNull (); - - Vec2 normalized () const; // does not modify *this - Vec2 normalizedExc () const throw (Iex::MathExc); - Vec2 normalizedNonNull () const; - - - //-------------------------------------------------------- - // Number of dimensions, i.e. number of elements in a Vec2 - //-------------------------------------------------------- - - static unsigned int dimensions() {return 2;} - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} - - - //-------------------------------------------------------------- - // Base type -- in templates, which accept a parameter, V, which - // could be either a Vec2 or a Vec3, you can refer to T as - // V::BaseType - //-------------------------------------------------------------- - - typedef T BaseType; -}; - - -template class Vec3 -{ - public: - - //------------------- - // Access to elements - //------------------- - - T x, y, z; - - T & operator [] (int i); - const T & operator [] (int i) const; - - - //------------- - // Constructors - //------------- - - Vec3 (); // no initialization - explicit Vec3 (T a); // (a a a) - Vec3 (T a, T b, T c); // (a b c) - - - //--------------------------------- - // Copy constructors and assignment - //--------------------------------- - - Vec3 (const Vec3 &v); - template Vec3 (const Vec3 &v); - - const Vec3 & operator = (const Vec3 &v); - - - //---------------------- - // Compatibility with Sb - //---------------------- - - template - void setValue (S a, S b, S c); - - template - void setValue (const Vec3 &v); - - template - void getValue (S &a, S &b, S &c) const; - - template - void getValue (Vec3 &v) const; - - T * getValue(); - const T * getValue() const; - - - //--------- - // Equality - //--------- - - template - bool operator == (const Vec3 &v) const; - - template - bool operator != (const Vec3 &v) const; - - //----------------------------------------------------------------------- - // Compare two vectors and test if they are "approximately equal": - // - // equalWithAbsError (v, e) - // - // Returns true if the coefficients of this and v are the same with - // an absolute error of no more than e, i.e., for all i - // - // abs (this[i] - v[i]) <= e - // - // equalWithRelError (v, e) - // - // Returns true if the coefficients of this and v are the same with - // a relative error of no more than e, i.e., for all i - // - // abs (this[i] - v[i]) <= e * abs (this[i]) - //----------------------------------------------------------------------- - - bool equalWithAbsError (const Vec3 &v, T e) const; - bool equalWithRelError (const Vec3 &v, T e) const; - - //------------ - // Dot product - //------------ - - T dot (const Vec3 &v) const; - T operator ^ (const Vec3 &v) const; - - - //--------------------------- - // Right-handed cross product - //--------------------------- - - Vec3 cross (const Vec3 &v) const; - const Vec3 & operator %= (const Vec3 &v); - Vec3 operator % (const Vec3 &v) const; - - - //------------------------ - // Component-wise addition - //------------------------ - - const Vec3 & operator += (const Vec3 &v); - Vec3 operator + (const Vec3 &v) const; - - - //--------------------------- - // Component-wise subtraction - //--------------------------- - - const Vec3 & operator -= (const Vec3 &v); - Vec3 operator - (const Vec3 &v) const; - - - //------------------------------------ - // Component-wise multiplication by -1 - //------------------------------------ - - Vec3 operator - () const; - const Vec3 & negate (); - - - //------------------------------ - // Component-wise multiplication - //------------------------------ - - const Vec3 & operator *= (const Vec3 &v); - const Vec3 & operator *= (T a); - Vec3 operator * (const Vec3 &v) const; - Vec3 operator * (T a) const; - - - //------------------------ - // Component-wise division - //------------------------ - - const Vec3 & operator /= (const Vec3 &v); - const Vec3 & operator /= (T a); - Vec3 operator / (const Vec3 &v) const; - Vec3 operator / (T a) const; - - - //---------------------------------------------------------------- - // Length and normalization: If v.length() is 0.0, v.normalize() - // and v.normalized() produce a null vector; v.normalizeExc() and - // v.normalizedExc() throw a NullVecExc. - // v.normalizeNonNull() and v.normalizedNonNull() are slightly - // faster than the other normalization routines, but if v.length() - // is 0.0, the result is undefined. - //---------------------------------------------------------------- - - T length () const; - T length2 () const; - - const Vec3 & normalize (); // modifies *this - const Vec3 & normalizeExc () throw (Iex::MathExc); - const Vec3 & normalizeNonNull (); - - Vec3 normalized () const; // does not modify *this - Vec3 normalizedExc () const throw (Iex::MathExc); - Vec3 normalizedNonNull () const; - - - //-------------------------------------------------------- - // Number of dimensions, i.e. number of elements in a Vec3 - //-------------------------------------------------------- - - static unsigned int dimensions() {return 3;} - - - //------------------------------------------------- - // Limitations of type T (see also class limits) - //------------------------------------------------- - - static T baseTypeMin() {return limits::min();} - static T baseTypeMax() {return limits::max();} - static T baseTypeSmallest() {return limits::smallest();} - static T baseTypeEpsilon() {return limits::epsilon();} - - - //-------------------------------------------------------------- - // Base type -- in templates, which accept a parameter, V, which - // could be either a Vec2 or a Vec3, you can refer to T as - // V::BaseType - //-------------------------------------------------------------- - - typedef T BaseType; -}; - - -//-------------- -// Stream output -//-------------- - -template -std::ostream & operator << (std::ostream &s, const Vec2 &v); - -template -std::ostream & operator << (std::ostream &s, const Vec3 &v); - - -//---------------------------------------------------- -// Reverse multiplication: S * Vec2 and S * Vec3 -//---------------------------------------------------- - -template Vec2 operator * (T a, const Vec2 &v); -template Vec3 operator * (T a, const Vec3 &v); - - -//------------------------- -// Typedefs for convenience -//------------------------- - -typedef Vec2 V2s; -typedef Vec2 V2i; -typedef Vec2 V2f; -typedef Vec2 V2d; -typedef Vec3 V3s; -typedef Vec3 V3i; -typedef Vec3 V3f; -typedef Vec3 V3d; - - -//------------------------------------------------------------------- -// Specializations for Vec2, Vec2, Vec3, Vec3 -//------------------------------------------------------------------- - -// Vec2 - -template <> short -Vec2::length () const; - -template <> const Vec2 & -Vec2::normalize (); - -template <> const Vec2 & -Vec2::normalizeExc () throw (Iex::MathExc); - -template <> const Vec2 & -Vec2::normalizeNonNull (); - -template <> Vec2 -Vec2::normalized () const; - -template <> Vec2 -Vec2::normalizedExc () const throw (Iex::MathExc); - -template <> Vec2 -Vec2::normalizedNonNull () const; - - -// Vec2 - -template <> int -Vec2::length () const; - -template <> const Vec2 & -Vec2::normalize (); - -template <> const Vec2 & -Vec2::normalizeExc () throw (Iex::MathExc); - -template <> const Vec2 & -Vec2::normalizeNonNull (); - -template <> Vec2 -Vec2::normalized () const; - -template <> Vec2 -Vec2::normalizedExc () const throw (Iex::MathExc); - -template <> Vec2 -Vec2::normalizedNonNull () const; - - -// Vec3 - -template <> short -Vec3::length () const; - -template <> const Vec3 & -Vec3::normalize (); - -template <> const Vec3 & -Vec3::normalizeExc () throw (Iex::MathExc); - -template <> const Vec3 & -Vec3::normalizeNonNull (); - -template <> Vec3 -Vec3::normalized () const; - -template <> Vec3 -Vec3::normalizedExc () const throw (Iex::MathExc); - -template <> Vec3 -Vec3::normalizedNonNull () const; - - -// Vec3 - -template <> int -Vec3::length () const; - -template <> const Vec3 & -Vec3::normalize (); - -template <> const Vec3 & -Vec3::normalizeExc () throw (Iex::MathExc); - -template <> const Vec3 & -Vec3::normalizeNonNull (); - -template <> Vec3 -Vec3::normalized () const; - -template <> Vec3 -Vec3::normalizedExc () const throw (Iex::MathExc); - -template <> Vec3 -Vec3::normalizedNonNull () const; - - -//------------------------ -// Implementation of Vec2: -//------------------------ - -template -inline T & -Vec2::operator [] (int i) -{ - return (&x)[i]; -} - -template -inline const T & -Vec2::operator [] (int i) const -{ - return (&x)[i]; -} - -template -inline -Vec2::Vec2 () -{ - // empty -} - -template -inline -Vec2::Vec2 (T a) -{ - x = y = a; -} - -template -inline -Vec2::Vec2 (T a, T b) -{ - x = a; - y = b; -} - -template -inline -Vec2::Vec2 (const Vec2 &v) -{ - x = v.x; - y = v.y; -} - -template -template -inline -Vec2::Vec2 (const Vec2 &v) -{ - x = T (v.x); - y = T (v.y); -} - -template -inline const Vec2 & -Vec2::operator = (const Vec2 &v) -{ - x = v.x; - y = v.y; - return *this; -} - -template -template -inline void -Vec2::setValue (S a, S b) -{ - x = T (a); - y = T (b); -} - -template -template -inline void -Vec2::setValue (const Vec2 &v) -{ - x = T (v.x); - y = T (v.y); -} - -template -template -inline void -Vec2::getValue (S &a, S &b) const -{ - a = S (x); - b = S (y); -} - -template -template -inline void -Vec2::getValue (Vec2 &v) const -{ - v.x = S (x); - v.y = S (y); -} - -template -inline T * -Vec2::getValue() -{ - return (T *) &x; -} - -template -inline const T * -Vec2::getValue() const -{ - return (const T *) &x; -} - -template -template -inline bool -Vec2::operator == (const Vec2 &v) const -{ - return x == v.x && y == v.y; -} - -template -template -inline bool -Vec2::operator != (const Vec2 &v) const -{ - return x != v.x || y != v.y; -} - -template -bool -Vec2::equalWithAbsError (const Vec2 &v, T e) const -{ - for (int i = 0; i < 2; i++) - if (!Imath::equalWithAbsError ((*this)[i], v[i], e)) - return false; - - return true; -} - -template -bool -Vec2::equalWithRelError (const Vec2 &v, T e) const -{ - for (int i = 0; i < 2; i++) - if (!Imath::equalWithRelError ((*this)[i], v[i], e)) - return false; - - return true; -} - -template -inline T -Vec2::dot (const Vec2 &v) const -{ - return x * v.x + y * v.y; -} - -template -inline T -Vec2::operator ^ (const Vec2 &v) const -{ - return dot (v); -} - -template -inline T -Vec2::cross (const Vec2 &v) const -{ - return x * v.y - y * v.x; - -} - -template -inline T -Vec2::operator % (const Vec2 &v) const -{ - return x * v.y - y * v.x; -} - -template -inline const Vec2 & -Vec2::operator += (const Vec2 &v) -{ - x += v.x; - y += v.y; - return *this; -} - -template -inline Vec2 -Vec2::operator + (const Vec2 &v) const -{ - return Vec2 (x + v.x, y + v.y); -} - -template -inline const Vec2 & -Vec2::operator -= (const Vec2 &v) -{ - x -= v.x; - y -= v.y; - return *this; -} - -template -inline Vec2 -Vec2::operator - (const Vec2 &v) const -{ - return Vec2 (x - v.x, y - v.y); -} - -template -inline Vec2 -Vec2::operator - () const -{ - return Vec2 (-x, -y); -} - -template -inline const Vec2 & -Vec2::negate () -{ - x = -x; - y = -y; - return *this; -} - -template -inline const Vec2 & -Vec2::operator *= (const Vec2 &v) -{ - x *= v.x; - y *= v.y; - return *this; -} - -template -inline const Vec2 & -Vec2::operator *= (T a) -{ - x *= a; - y *= a; - return *this; -} - -template -inline Vec2 -Vec2::operator * (const Vec2 &v) const -{ - return Vec2 (x * v.x, y * v.y); -} - -template -inline Vec2 -Vec2::operator * (T a) const -{ - return Vec2 (x * a, y * a); -} - -template -inline const Vec2 & -Vec2::operator /= (const Vec2 &v) -{ - x /= v.x; - y /= v.y; - return *this; -} - -template -inline const Vec2 & -Vec2::operator /= (T a) -{ - x /= a; - y /= a; - return *this; -} - -template -inline Vec2 -Vec2::operator / (const Vec2 &v) const -{ - return Vec2 (x / v.x, y / v.y); -} - -template -inline Vec2 -Vec2::operator / (T a) const -{ - return Vec2 (x / a, y / a); -} - -template -inline T -Vec2::length () const -{ - return Math::sqrt (dot (*this)); -} - -template -inline T -Vec2::length2 () const -{ - return dot (*this); -} - -template -const Vec2 & -Vec2::normalize () -{ - T l = length(); - - if (l != 0) - { - x /= l; - y /= l; - } - - return *this; -} - -template -const Vec2 & -Vec2::normalizeExc () throw (Iex::MathExc) -{ - T l = length(); - - if (l == 0) - throw NullVecExc ("Cannot normalize null vector."); - - x /= l; - y /= l; - return *this; -} - -template -inline -const Vec2 & -Vec2::normalizeNonNull () -{ - T l = length(); - x /= l; - y /= l; - return *this; -} - -template -Vec2 -Vec2::normalized () const -{ - T l = length(); - - if (l == 0) - return Vec2 (T (0)); - - return Vec2 (x / l, y / l); -} - -template -Vec2 -Vec2::normalizedExc () const throw (Iex::MathExc) -{ - T l = length(); - - if (l == 0) - throw NullVecExc ("Cannot normalize null vector."); - - return Vec2 (x / l, y / l); -} - -template -inline -Vec2 -Vec2::normalizedNonNull () const -{ - T l = length(); - return Vec2 (x / l, y / l); -} - - -//----------------------- -// Implementation of Vec3 -//----------------------- - -template -inline T & -Vec3::operator [] (int i) -{ - return (&x)[i]; -} - -template -inline const T & -Vec3::operator [] (int i) const -{ - return (&x)[i]; -} - -template -inline -Vec3::Vec3 () -{ - // empty -} - -template -inline -Vec3::Vec3 (T a) -{ - x = y = z = a; -} - -template -inline -Vec3::Vec3 (T a, T b, T c) -{ - x = a; - y = b; - z = c; -} - -template -inline -Vec3::Vec3 (const Vec3 &v) -{ - x = v.x; - y = v.y; - z = v.z; -} - -template -template -inline -Vec3::Vec3 (const Vec3 &v) -{ - x = T (v.x); - y = T (v.y); - z = T (v.z); -} - -template -inline const Vec3 & -Vec3::operator = (const Vec3 &v) -{ - x = v.x; - y = v.y; - z = v.z; - return *this; -} - -template -template -inline void -Vec3::setValue (S a, S b, S c) -{ - x = T (a); - y = T (b); - z = T (c); -} - -template -template -inline void -Vec3::setValue (const Vec3 &v) -{ - x = T (v.x); - y = T (v.y); - z = T (v.z); -} - -template -template -inline void -Vec3::getValue (S &a, S &b, S &c) const -{ - a = S (x); - b = S (y); - c = S (z); -} - -template -template -inline void -Vec3::getValue (Vec3 &v) const -{ - v.x = S (x); - v.y = S (y); - v.z = S (z); -} - -template -inline T * -Vec3::getValue() -{ - return (T *) &x; -} - -template -inline const T * -Vec3::getValue() const -{ - return (const T *) &x; -} - -template -template -inline bool -Vec3::operator == (const Vec3 &v) const -{ - return x == v.x && y == v.y && z == v.z; -} - -template -template -inline bool -Vec3::operator != (const Vec3 &v) const -{ - return x != v.x || y != v.y || z != v.z; -} - -template -bool -Vec3::equalWithAbsError (const Vec3 &v, T e) const -{ - for (int i = 0; i < 3; i++) - if (!Imath::equalWithAbsError ((*this)[i], v[i], e)) - return false; - - return true; -} - -template -bool -Vec3::equalWithRelError (const Vec3 &v, T e) const -{ - for (int i = 0; i < 3; i++) - if (!Imath::equalWithRelError ((*this)[i], v[i], e)) - return false; - - return true; -} - -template -inline T -Vec3::dot (const Vec3 &v) const -{ - return x * v.x + y * v.y + z * v.z; -} - -template -inline T -Vec3::operator ^ (const Vec3 &v) const -{ - return dot (v); -} - -template -inline Vec3 -Vec3::cross (const Vec3 &v) const -{ - return Vec3 (y * v.z - z * v.y, - z * v.x - x * v.z, - x * v.y - y * v.x); -} - -template -inline const Vec3 & -Vec3::operator %= (const Vec3 &v) -{ - T a = y * v.z - z * v.y; - T b = z * v.x - x * v.z; - T c = x * v.y - y * v.x; - x = a; - y = b; - z = c; - return *this; -} - -template -inline Vec3 -Vec3::operator % (const Vec3 &v) const -{ - return Vec3 (y * v.z - z * v.y, - z * v.x - x * v.z, - x * v.y - y * v.x); -} - -template -inline const Vec3 & -Vec3::operator += (const Vec3 &v) -{ - x += v.x; - y += v.y; - z += v.z; - return *this; -} - -template -inline Vec3 -Vec3::operator + (const Vec3 &v) const -{ - return Vec3 (x + v.x, y + v.y, z + v.z); -} - -template -inline const Vec3 & -Vec3::operator -= (const Vec3 &v) -{ - x -= v.x; - y -= v.y; - z -= v.z; - return *this; -} - -template -inline Vec3 -Vec3::operator - (const Vec3 &v) const -{ - return Vec3 (x - v.x, y - v.y, z - v.z); -} - -template -inline Vec3 -Vec3::operator - () const -{ - return Vec3 (-x, -y, -z); -} - -template -inline const Vec3 & -Vec3::negate () -{ - x = -x; - y = -y; - z = -z; - return *this; -} - -template -inline const Vec3 & -Vec3::operator *= (const Vec3 &v) -{ - x *= v.x; - y *= v.y; - z *= v.z; - return *this; -} - -template -inline const Vec3 & -Vec3::operator *= (T a) -{ - x *= a; - y *= a; - z *= a; - return *this; -} - -template -inline Vec3 -Vec3::operator * (const Vec3 &v) const -{ - return Vec3 (x * v.x, y * v.y, z * v.z); -} - -template -inline Vec3 -Vec3::operator * (T a) const -{ - return Vec3 (x * a, y * a, z * a); -} - -template -inline const Vec3 & -Vec3::operator /= (const Vec3 &v) -{ - x /= v.x; - y /= v.y; - z /= v.z; - return *this; -} - -template -inline const Vec3 & -Vec3::operator /= (T a) -{ - x /= a; - y /= a; - z /= a; - return *this; -} - -template -inline Vec3 -Vec3::operator / (const Vec3 &v) const -{ - return Vec3 (x / v.x, y / v.y, z / v.z); -} - -template -inline Vec3 -Vec3::operator / (T a) const -{ - return Vec3 (x / a, y / a, z / a); -} - - -template -inline T -Vec3::length () const -{ - return Math::sqrt (dot (*this)); -} - -template -inline T -Vec3::length2 () const -{ - return dot (*this); -} - -template -const Vec3 & -Vec3::normalize () -{ - T l = length(); - - if (l != 0) - { - x /= l; - y /= l; - z /= l; - } - - return *this; -} - -template -const Vec3 & -Vec3::normalizeExc () throw (Iex::MathExc) -{ - T l = length(); - - if (l == 0) - throw NullVecExc ("Cannot normalize null vector."); - - x /= l; - y /= l; - z /= l; - return *this; -} - -template -inline -const Vec3 & -Vec3::normalizeNonNull () -{ - T l = length(); - x /= l; - y /= l; - z /= l; - return *this; -} - -template -Vec3 -Vec3::normalized () const -{ - T l = length(); - - if (l == 0) - return Vec3 (T (0)); - - return Vec3 (x / l, y / l, z / l); -} - -template -Vec3 -Vec3::normalizedExc () const throw (Iex::MathExc) -{ - T l = length(); - - if (l == 0) - throw NullVecExc ("Cannot normalize null vector."); - - return Vec3 (x / l, y / l, z / l); -} - -template -inline -Vec3 -Vec3::normalizedNonNull () const -{ - T l = length(); - return Vec3 (x / l, y / l, z / l); -} - - -//----------------------------- -// Stream output implementation -//----------------------------- - -template -std::ostream & -operator << (std::ostream &s, const Vec2 &v) -{ - return s << '(' << v.x << ' ' << v.y << ')'; -} - -template -std::ostream & -operator << (std::ostream &s, const Vec3 &v) -{ - return s << '(' << v.x << ' ' << v.y << ' ' << v.z << ')'; -} - - -//----------------------------------------- -// Implementation of reverse multiplication -//----------------------------------------- - -template -inline Vec2 -operator * (T a, const Vec2 &v) -{ - return Vec2 (a * v.x, a * v.y); -} - -template -inline Vec3 -operator * (T a, const Vec3 &v) -{ - return Vec3 (a * v.x, a * v.y, a * v.z); -} - - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER -#pragma warning(default:4290) -#endif - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImathVecAlgo.h b/3rdparty/include/OpenEXR/ImathVecAlgo.h deleted file mode 100644 index 9b726a74ad..0000000000 --- a/3rdparty/include/OpenEXR/ImathVecAlgo.h +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMATHVECALGO_H -#define INCLUDED_IMATHVECALGO_H - -//------------------------------------------------------------------------- -// -// This file contains algorithms applied to or in conjunction -// with points (Imath::Vec2 and Imath::Vec3). -// The assumption made is that these functions are called much -// less often than the basic point functions or these functions -// require more support classes. -// -//------------------------------------------------------------------------- - -#include "ImathVec.h" -#include "ImathLimits.h" - -namespace Imath { - - -//-------------------------------------------------------------- -// Find the projection of vector t onto vector s (Vec2 and Vec3) -//-------------------------------------------------------------- - -template Vec project (const Vec &s, const Vec &t); - - -//---------------------------------------------- -// Find a vector which is perpendicular to s and -// in the same plane as s and t (Vec2 and Vec3) -//---------------------------------------------- - -template Vec orthogonal (const Vec &s, const Vec &t); - - -//----------------------------------------------- -// Find the direction of a ray s after reflection -// off a plane with normal t (Vec2 and Vec3) -//----------------------------------------------- - -template Vec reflect (const Vec &s, const Vec &t); - - -//---------------------------------------------------------------------- -// Find the vertex of triangle (v0, v1, v2), which is closest to point p -// (Vec2 and Vec3). -//---------------------------------------------------------------------- - -template Vec closestVertex (const Vec &v0, - const Vec &v1, - const Vec &v2, - const Vec &p); - -//--------------- -// Implementation -//--------------- - -template -Vec -project (const Vec &s, const Vec &t) -{ - Vec sNormalized = s.normalized(); - return sNormalized * (sNormalized ^ t); -} - -template -Vec -orthogonal (const Vec &s, const Vec &t) -{ - return t - project (s, t); -} - -template -Vec -reflect (const Vec &s, const Vec &t) -{ - return s - typename Vec::BaseType(2) * (s - project(t, s)); -} - -template -Vec -closestVertex(const Vec &v0, - const Vec &v1, - const Vec &v2, - const Vec &p) -{ - Vec nearest = v0; - typename Vec::BaseType neardot = (v0 - p).length2(); - typename Vec::BaseType tmp = (v1 - p).length2(); - - if (tmp < neardot) - { - neardot = tmp; - nearest = v1; - } - - tmp = (v2 - p).length2(); - - if (tmp < neardot) - { - neardot = tmp; - nearest = v2; - } - - return nearest; -} - - -} // namespace Imath - -#endif diff --git a/3rdparty/include/OpenEXR/ImfArray.h b/3rdparty/include/OpenEXR/ImfArray.h deleted file mode 100644 index 18eb66f390..0000000000 --- a/3rdparty/include/OpenEXR/ImfArray.h +++ /dev/null @@ -1,261 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_ARRAY_H -#define INCLUDED_IMF_ARRAY_H - -//------------------------------------------------------------------------- -// -// class Array -// class Array2D -// -// "Arrays of T" whose sizes are not known at compile time. -// When an array goes out of scope, its elements are automatically -// deleted. -// -// Usage example: -// -// struct C -// { -// C () {std::cout << "C::C (" << this << ")\n";}; -// virtual ~C () {std::cout << "C::~C (" << this << ")\n";}; -// }; -// -// int -// main () -// { -// Array a(3); -// -// C &b = a[1]; -// const C &c = a[1]; -// C *d = a + 2; -// const C *e = a; -// -// return 0; -// } -// -//------------------------------------------------------------------------- - -namespace Imf { - - -template -class Array -{ - public: - - //----------------------------- - // Constructors and destructors - //----------------------------- - - Array () {_data = 0;} - Array (long size) {_data = new T[size];} - ~Array () {delete [] _data;} - - - //----------------------------- - // Access to the array elements - //----------------------------- - - operator T * () {return _data;} - operator const T * () const {return _data;} - - - //------------------------------------------------------ - // Resize and clear the array (the contents of the array - // are not preserved across the resize operation). - // - // resizeEraseUnsafe() is more memory efficient than - // resizeErase() because it deletes the old memory block - // before allocating a new one, but if allocating the - // new block throws an exception, resizeEraseUnsafe() - // leaves the array in an unusable state. - // - //------------------------------------------------------ - - void resizeErase (long size); - void resizeEraseUnsafe (long size); - - - private: - - Array (const Array &); // Copying and assignment - Array & operator = (const Array &); // are not implemented - - T * _data; -}; - - -template -class Array2D -{ - public: - - //----------------------------- - // Constructors and destructors - //----------------------------- - - Array2D (); // empty array, 0 by 0 elements - Array2D (long sizeX, long sizeY); // sizeX by sizeY elements - ~Array2D (); - - - //----------------------------- - // Access to the array elements - //----------------------------- - - T * operator [] (long x); - const T * operator [] (long x) const; - - - //------------------------------------------------------ - // Resize and clear the array (the contents of the array - // are not preserved across the resize operation). - // - // resizeEraseUnsafe() is more memory efficient than - // resizeErase() because it deletes the old memory block - // before allocating a new one, but if allocating the - // new block throws an exception, resizeEraseUnsafe() - // leaves the array in an unusable state. - // - //------------------------------------------------------ - - void resizeErase (long sizeX, long sizeY); - void resizeEraseUnsafe (long sizeX, long sizeY); - - - private: - - Array2D (const Array2D &); // Copying and assignment - Array2D & operator = (const Array2D &); // are not implemented - - long _sizeY; - T * _data; -}; - - -//--------------- -// Implementation -//--------------- - -template -inline void -Array::resizeErase (long size) -{ - T *tmp = new T[size]; - delete [] _data; - _data = tmp; -} - - -template -inline void -Array::resizeEraseUnsafe (long size) -{ - delete [] _data; - _data = 0; - _data = new T[size]; -} - - -template -inline -Array2D::Array2D (): - _sizeY (0), _data (0) -{ - // emtpy -} - - -template -inline -Array2D::Array2D (long sizeX, long sizeY): - _sizeY (sizeY), _data (new T[sizeX * sizeY]) -{ - // emtpy -} - - -template -inline -Array2D::~Array2D () -{ - delete [] _data; -} - - -template -inline T * -Array2D::operator [] (long x) -{ - return _data + x * _sizeY; -} - - -template -inline const T * -Array2D::operator [] (long x) const -{ - return _data + x * _sizeY; -} - - -template -inline void -Array2D::resizeErase (long sizeX, long sizeY) -{ - T *tmp = new T[sizeX * sizeY]; - delete [] _data; - _sizeY = sizeY; - _data = tmp; -} - - -template -inline void -Array2D::resizeEraseUnsafe (long sizeX, long sizeY) -{ - delete [] _data; - _data = 0; - _sizeY = 0; - _data = new T[sizeX * sizeY]; - _sizeY = sizeY; -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfAttribute.h b/3rdparty/include/OpenEXR/ImfAttribute.h deleted file mode 100644 index 45d62ff9ad..0000000000 --- a/3rdparty/include/OpenEXR/ImfAttribute.h +++ /dev/null @@ -1,422 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_ATTRIBUTE_H -#define INCLUDED_IMF_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class Attribute -// -//----------------------------------------------------------------------------- - -#include "IexBaseExc.h" -#include -#include - - -namespace Imf { - - -class Attribute -{ - public: - - //--------------------------- - // Constructor and destructor - //--------------------------- - - Attribute (); - virtual ~Attribute (); - - - //------------------------------- - // Get this attribute's type name - //------------------------------- - - virtual const char * typeName () const = 0; - - - //------------------------------ - // Make a copy of this attribute - //------------------------------ - - virtual Attribute * copy () const = 0; - - - //---------------------------------------- - // Type-specific attribute I/O and copying - //---------------------------------------- - - virtual void writeValueTo (OStream &os, - int version) const = 0; - - virtual void readValueFrom (IStream &is, - int size, - int version) = 0; - - virtual void copyValueFrom (const Attribute &other) = 0; - - - //------------------ - // Attribute factory - //------------------ - - static Attribute * newAttribute (const char typeName[]); - - - //----------------------------------------------------------- - // Test if a given attribute type has already been registered - //----------------------------------------------------------- - - static bool knownType (const char typeName[]); - - - protected: - - //-------------------------------------------------- - // Register an attribute type so that newAttribute() - // knows how to make objects of this type. - //-------------------------------------------------- - - static void registerAttributeType (const char typeName[], - Attribute *(*newAttribute)()); - - //------------------------------------------------------ - // Un-register an attribute type so that newAttribute() - // no longer knows how to make objects of this type (for - // debugging only). - //------------------------------------------------------ - - static void unRegisterAttributeType (const char typeName[]); -}; - - -//------------------------------------------------- -// Class template for attributes of a specific type -//------------------------------------------------- - -template -class TypedAttribute: public Attribute -{ - public: - - //---------------------------- - // Constructors and destructor - //------------_--------------- - - TypedAttribute (); - TypedAttribute (const T &value); - TypedAttribute (const TypedAttribute &other); - virtual ~TypedAttribute (); - - - //-------------------------------- - // Access to the attribute's value - //-------------------------------- - - T & value (); - const T & value () const; - - - //-------------------------------- - // Get this attribute's type name. - //-------------------------------- - - virtual const char * typeName () const; - - - //--------------------------------------------------------- - // Static version of typeName() - // This function must be specialized for each value type T. - //--------------------------------------------------------- - - static const char * staticTypeName (); - - - //--------------------- - // Make a new attribute - //--------------------- - - static Attribute * makeNewAttribute (); - - - //------------------------------ - // Make a copy of this attribute - //------------------------------ - - virtual Attribute * copy () const; - - - //----------------------------------------------------------------- - // Type-specific attribute I/O and copying. - // Depending on type T, these functions may have to be specialized. - //----------------------------------------------------------------- - - virtual void writeValueTo (OStream &os, - int version) const; - - virtual void readValueFrom (IStream &is, - int size, - int version); - - virtual void copyValueFrom (const Attribute &other); - - - //------------------------------------------------------------ - // Dynamic casts that throw exceptions instead of returning 0. - //------------------------------------------------------------ - - static TypedAttribute * cast (Attribute *attribute); - static const TypedAttribute * cast (const Attribute *attribute); - static TypedAttribute & cast (Attribute &attribute); - static const TypedAttribute & cast (const Attribute &attribute); - - - //--------------------------------------------------------------- - // Register this attribute type so that Attribute::newAttribute() - // knows how to make objects of this type. - // - // Note that this function is not thread-safe because it modifies - // a global variable in the IlmIlm library. A thread in a multi- - // threaded program may call registerAttributeType() only when no - // other thread is accessing any functions or classes in the - // IlmImf library. - // - //--------------------------------------------------------------- - - static void registerAttributeType (); - - - //----------------------------------------------------- - // Un-register this attribute type (for debugging only) - //----------------------------------------------------- - - static void unRegisterAttributeType (); - - - private: - - T _value; -}; - - -//------------------------------------ -// Implementation of TypedAttribute -//------------------------------------ - -template -TypedAttribute::TypedAttribute (): _value (T()) -{ - // empty -} - - -template -TypedAttribute::TypedAttribute (const T &value): _value (value) -{ - // empty -} - - -template -TypedAttribute::TypedAttribute (const TypedAttribute &other): - _value () -{ - copyValueFrom (other); -} - - -template -TypedAttribute::~TypedAttribute () -{ - // empty -} - - -template -inline T & -TypedAttribute::value () -{ - return _value; -} - - -template -inline const T & -TypedAttribute::value () const -{ - return _value; -} - - -template -const char * -TypedAttribute::typeName () const -{ - return staticTypeName(); -} - - -template -Attribute * -TypedAttribute::makeNewAttribute () -{ - return new TypedAttribute(); -} - - -template -Attribute * -TypedAttribute::copy () const -{ - Attribute * attribute = new TypedAttribute(); - attribute->copyValueFrom (*this); - return attribute; -} - - -template -void -TypedAttribute::writeValueTo (OStream &os, int version) const -{ - Xdr::write (os, _value); -} - - -template -void -TypedAttribute::readValueFrom (IStream &is, int size, int version) -{ - Xdr::read (is, _value); -} - - -template -void -TypedAttribute::copyValueFrom (const Attribute &other) -{ - _value = cast(other)._value; -} - - -template -TypedAttribute * -TypedAttribute::cast (Attribute *attribute) -{ - TypedAttribute *t = - dynamic_cast *> (attribute); - - if (t == 0) - throw Iex::TypeExc ("Unexpected attribute type."); - - return t; -} - - -template -const TypedAttribute * -TypedAttribute::cast (const Attribute *attribute) -{ - const TypedAttribute *t = - dynamic_cast *> (attribute); - - if (t == 0) - throw Iex::TypeExc ("Unexpected attribute type."); - - return t; -} - - -template -inline TypedAttribute & -TypedAttribute::cast (Attribute &attribute) -{ - return *cast (&attribute); -} - - -template -inline const TypedAttribute & -TypedAttribute::cast (const Attribute &attribute) -{ - return *cast (&attribute); -} - - -template -inline void -TypedAttribute::registerAttributeType () -{ - Attribute::registerAttributeType (staticTypeName(), makeNewAttribute); -} - - -template -inline void -TypedAttribute::unRegisterAttributeType () -{ - Attribute::unRegisterAttributeType (staticTypeName()); -} - - -} // namespace Imf - -#if defined(OPENEXR_DLL) && defined(_MSC_VER) - // Tell MS VC++ to disable "non dll-interface class used as base - // for dll-interface class" and "no suitable definition provided - // for explicit template" - #pragma warning (disable : 4275 4661) - - #if defined (ILMIMF_EXPORTS) - #define IMF_EXPIMP_TEMPLATE - #else - #define IMF_EXPIMP_TEMPLATE extern - #endif - - IMF_EXPIMP_TEMPLATE template class Imf::TypedAttribute; - IMF_EXPIMP_TEMPLATE template class Imf::TypedAttribute; - - #pragma warning(default : 4251) - #undef EXTERN_TEMPLATE -#endif - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfBoxAttribute.h b/3rdparty/include/OpenEXR/ImfBoxAttribute.h deleted file mode 100644 index fe3539106c..0000000000 --- a/3rdparty/include/OpenEXR/ImfBoxAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_BOX_ATTRIBUTE_H -#define INCLUDED_IMF_BOX_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class Box2iAttribute -// class Box2fAttribute -// -//----------------------------------------------------------------------------- - -#include -#include "ImathBox.h" - - -namespace Imf { - - -typedef TypedAttribute Box2iAttribute; -template <> const char *Box2iAttribute::staticTypeName (); -template <> void Box2iAttribute::writeValueTo (OStream &, int) const; -template <> void Box2iAttribute::readValueFrom (IStream &, int, int); - - -typedef TypedAttribute Box2fAttribute; -template <> const char *Box2fAttribute::staticTypeName (); -template <> void Box2fAttribute::writeValueTo (OStream &, int) const; -template <> void Box2fAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfCRgbaFile.h b/3rdparty/include/OpenEXR/ImfCRgbaFile.h deleted file mode 100644 index d32f52e144..0000000000 --- a/3rdparty/include/OpenEXR/ImfCRgbaFile.h +++ /dev/null @@ -1,465 +0,0 @@ -/* - -Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -Digital Ltd. LLC - -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: -* Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above -copyright notice, this list of conditions and the following disclaimer -in the documentation and/or other materials provided with the -distribution. -* Neither the name of Industrial Light & Magic nor the names of -its contributors may be used to endorse or promote products derived -from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -*/ - -#ifndef INCLUDED_IMF_C_RGBA_FILE_H -#define INCLUDED_IMF_C_RGBA_FILE_H - - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Interpreting unsigned shorts as 16-bit floating point numbers -*/ - -typedef unsigned short ImfHalf; - -void ImfFloatToHalf (float f, - ImfHalf *h); - -void ImfFloatToHalfArray (int n, - const float f[/*n*/], - ImfHalf h[/*n*/]); - -float ImfHalfToFloat (ImfHalf h); - -void ImfHalfToFloatArray (int n, - const ImfHalf h[/*n*/], - float f[/*n*/]); - -/* -** RGBA pixel; memory layout must be the same as struct Imf::Rgba. -*/ - -struct ImfRgba -{ - ImfHalf r; - ImfHalf g; - ImfHalf b; - ImfHalf a; -}; - -typedef struct ImfRgba ImfRgba; - -/* -** Magic number; this must be the same as Imf::MAGIC -*/ - -#define IMF_MAGIC 20000630 - -/* -** Version number; this must be the same as Imf::EXR_VERSION -*/ - -#define IMF_VERSION_NUMBER 2 - -/* -** Line order; values must the the same as in Imf::LineOrder. -*/ - -#define IMF_INCREASING_Y 0 -#define IMF_DECREASING_Y 1 -#define IMF_RAMDOM_Y 2 - - -/* -** Compression types; values must be the same as in Imf::Compression. -*/ - -#define IMF_NO_COMPRESSION 0 -#define IMF_RLE_COMPRESSION 1 -#define IMF_ZIPS_COMPRESSION 2 -#define IMF_ZIP_COMPRESSION 3 -#define IMF_PIZ_COMPRESSION 4 -#define IMF_PXR24_COMPRESSION 5 - - -/* -** Channels; values must be the same as in Imf::RgbaChannels. -*/ - -#define IMF_WRITE_R 0x01 -#define IMF_WRITE_G 0x02 -#define IMF_WRITE_B 0x04 -#define IMF_WRITE_A 0x08 -#define IMF_WRITE_Y 0x10 -#define IMF_WRITE_C 0x20 -#define IMF_WRITE_RGB 0x07 -#define IMF_WRITE_RGBA 0x0f -#define IMF_WRITE_YC 0x30 -#define IMF_WRITE_YA 0x18 -#define IMF_WRITE_YCA 0x38 - - -/* -** Level modes; values must be the same as in Imf::LevelMode -*/ - -#define IMF_ONE_LEVEL 0 -#define IMF_MIPMAP_LEVELS 1 -#define IMF_RIPMAP_LEVELS 2 - - -/* -** Level rounding modes; values must be the same as in Imf::LevelRoundingMode -*/ - -#define IMF_ROUND_DOWN 0 -#define IMF_ROUND_UP 1 - - -/* -** RGBA file header -*/ - -struct ImfHeader; -typedef struct ImfHeader ImfHeader; - -ImfHeader * ImfNewHeader (void); - -void ImfDeleteHeader (ImfHeader *hdr); - -ImfHeader * ImfCopyHeader (const ImfHeader *hdr); - -void ImfHeaderSetDisplayWindow (ImfHeader *hdr, - int xMin, int yMin, - int xMax, int yMax); - -void ImfHeaderDisplayWindow (const ImfHeader *hdr, - int *xMin, int *yMin, - int *xMax, int *yMax); - -void ImfHeaderSetDataWindow (ImfHeader *hdr, - int xMin, int yMin, - int xMax, int yMax); - -void ImfHeaderDataWindow (const ImfHeader *hdr, - int *xMin, int *yMin, - int *xMax, int *yMax); - -void ImfHeaderSetPixelAspectRatio (ImfHeader *hdr, - float pixelAspectRatio); - -float ImfHeaderPixelAspectRatio (const ImfHeader *hdr); - -void ImfHeaderSetScreenWindowCenter (ImfHeader *hdr, - float x, float y); - -void ImfHeaderScreenWindowCenter (const ImfHeader *hdr, - float *x, float *y); - -void ImfHeaderSetScreenWindowWidth (ImfHeader *hdr, - float width); - -float ImfHeaderScreenWindowWidth (const ImfHeader *hdr); - -void ImfHeaderSetLineOrder (ImfHeader *hdr, - int lineOrder); - -int ImfHeaderLineOrder (const ImfHeader *hdr); - -void ImfHeaderSetCompression (ImfHeader *hdr, - int compression); - -int ImfHeaderCompression (const ImfHeader *hdr); - -int ImfHeaderSetIntAttribute (ImfHeader *hdr, - const char name[], - int value); - -int ImfHeaderIntAttribute (const ImfHeader *hdr, - const char name[], - int *value); - -int ImfHeaderSetFloatAttribute (ImfHeader *hdr, - const char name[], - float value); - -int ImfHeaderSetDoubleAttribute (ImfHeader *hdr, - const char name[], - double value); - -int ImfHeaderFloatAttribute (const ImfHeader *hdr, - const char name[], - float *value); - -int ImfHeaderDoubleAttribute (const ImfHeader *hdr, - const char name[], - double *value); - -int ImfHeaderSetStringAttribute (ImfHeader *hdr, - const char name[], - const char value[]); - -int ImfHeaderStringAttribute (const ImfHeader *hdr, - const char name[], - const char **value); - -int ImfHeaderSetBox2iAttribute (ImfHeader *hdr, - const char name[], - int xMin, int yMin, - int xMax, int yMax); - -int ImfHeaderBox2iAttribute (const ImfHeader *hdr, - const char name[], - int *xMin, int *yMin, - int *xMax, int *yMax); - -int ImfHeaderSetBox2fAttribute (ImfHeader *hdr, - const char name[], - float xMin, float yMin, - float xMax, float yMax); - -int ImfHeaderBox2fAttribute (const ImfHeader *hdr, - const char name[], - float *xMin, float *yMin, - float *xMax, float *yMax); - -int ImfHeaderSetV2iAttribute (ImfHeader *hdr, - const char name[], - int x, int y); - -int ImfHeaderV2iAttribute (const ImfHeader *hdr, - const char name[], - int *x, int *y); - -int ImfHeaderSetV2fAttribute (ImfHeader *hdr, - const char name[], - float x, float y); - -int ImfHeaderV2fAttribute (const ImfHeader *hdr, - const char name[], - float *x, float *y); - -int ImfHeaderSetV3iAttribute (ImfHeader *hdr, - const char name[], - int x, int y, int z); - -int ImfHeaderV3iAttribute (const ImfHeader *hdr, - const char name[], - int *x, int *y, int *z); - -int ImfHeaderSetV3fAttribute (ImfHeader *hdr, - const char name[], - float x, float y, float z); - -int ImfHeaderV3fAttribute (const ImfHeader *hdr, - const char name[], - float *x, float *y, float *z); - -int ImfHeaderSetM33fAttribute (ImfHeader *hdr, - const char name[], - const float m[3][3]); - -int ImfHeaderM33fAttribute (const ImfHeader *hdr, - const char name[], - float m[3][3]); - -int ImfHeaderSetM44fAttribute (ImfHeader *hdr, - const char name[], - const float m[4][4]); - -int ImfHeaderM44fAttribute (const ImfHeader *hdr, - const char name[], - float m[4][4]); - -/* -** RGBA output file -*/ - -struct ImfOutputFile; -typedef struct ImfOutputFile ImfOutputFile; - -ImfOutputFile * ImfOpenOutputFile (const char name[], - const ImfHeader *hdr, - int channels); - -int ImfCloseOutputFile (ImfOutputFile *out); - -int ImfOutputSetFrameBuffer (ImfOutputFile *out, - const ImfRgba *base, - size_t xStride, - size_t yStride); - -int ImfOutputWritePixels (ImfOutputFile *out, - int numScanLines); - -int ImfOutputCurrentScanLine (const ImfOutputFile *out); - -const ImfHeader * ImfOutputHeader (const ImfOutputFile *out); - -int ImfOutputChannels (const ImfOutputFile *out); - - -/* -** Tiled RGBA output file -*/ - -struct ImfTiledOutputFile; -typedef struct ImfTiledOutputFile ImfTiledOutputFile; - -ImfTiledOutputFile * ImfOpenTiledOutputFile (const char name[], - const ImfHeader *hdr, - int channels, - int xSize, int ySize, - int mode, int rmode); - -int ImfCloseTiledOutputFile (ImfTiledOutputFile *out); - -int ImfTiledOutputSetFrameBuffer (ImfTiledOutputFile *out, - const ImfRgba *base, - size_t xStride, - size_t yStride); - -int ImfTiledOutputWriteTile (ImfTiledOutputFile *out, - int dx, int dy, - int lx, int ly); - -int ImfTiledOutputWriteTiles (ImfTiledOutputFile *out, - int dxMin, int dxMax, - int dyMin, int dyMax, - int lx, int ly); - -const ImfHeader * ImfTiledOutputHeader (const ImfTiledOutputFile *out); - -int ImfTiledOutputChannels (const ImfTiledOutputFile *out); - -int ImfTiledOutputTileXSize (const ImfTiledOutputFile *out); - -int ImfTiledOutputTileYSize (const ImfTiledOutputFile *out); - -int ImfTiledOutputLevelMode (const ImfTiledOutputFile *out); -int ImfTiledOutputLevelRoundingMode - (const ImfTiledOutputFile *out); - - -/* -** RGBA input file -*/ - -struct ImfInputFile; -typedef struct ImfInputFile ImfInputFile; - -ImfInputFile * ImfOpenInputFile (const char name[]); - -int ImfCloseInputFile (ImfInputFile *in); - -int ImfInputSetFrameBuffer (ImfInputFile *in, - ImfRgba *base, - size_t xStride, - size_t yStride); - -int ImfInputReadPixels (ImfInputFile *in, - int scanLine1, - int scanLine2); - -const ImfHeader * ImfInputHeader (const ImfInputFile *in); - -int ImfInputChannels (const ImfInputFile *in); - -const char * ImfInputFileName (const ImfInputFile *in); - - -/* -** Tiled RGBA input file -*/ - -struct ImfTiledInputFile; -typedef struct ImfTiledInputFile ImfTiledInputFile; - -ImfTiledInputFile * ImfOpenTiledInputFile (const char name[]); - -int ImfCloseTiledInputFile (ImfTiledInputFile *in); - -int ImfTiledInputSetFrameBuffer (ImfTiledInputFile *in, - ImfRgba *base, - size_t xStride, - size_t yStride); - -int ImfTiledInputReadTile (ImfTiledInputFile *in, - int dx, int dy, - int lx, int ly); - -int ImfTiledInputReadTiles (ImfTiledInputFile *in, - int dxMin, int dxMax, - int dyMin, int dyMax, - int lx, int ly); - -const ImfHeader * ImfTiledInputHeader (const ImfTiledInputFile *in); - -int ImfTiledInputChannels (const ImfTiledInputFile *in); - -const char * ImfTiledInputFileName (const ImfTiledInputFile *in); - -int ImfTiledInputTileXSize (const ImfTiledInputFile *in); - -int ImfTiledInputTileYSize (const ImfTiledInputFile *in); - -int ImfTiledInputLevelMode (const ImfTiledInputFile *in); - -int ImfTiledInputLevelRoundingMode - (const ImfTiledInputFile *in); - -/* -** Lookup tables -*/ - -struct ImfLut; -typedef struct ImfLut ImfLut; - -ImfLut * ImfNewRound12logLut (int channels); - -ImfLut * ImfNewRoundNBitLut (unsigned int n, int channels); - -void ImfDeleteLut (ImfLut *lut); - -void ImfApplyLut (ImfLut *lut, - ImfRgba *data, - int nData, - int stride); -/* -** Most recent error message -*/ - -const char * ImfErrorMessage (void); - - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfChannelList.h b/3rdparty/include/OpenEXR/ImfChannelList.h deleted file mode 100644 index ddbe9d613d..0000000000 --- a/3rdparty/include/OpenEXR/ImfChannelList.h +++ /dev/null @@ -1,392 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_CHANNEL_LIST_H -#define INCLUDED_IMF_CHANNEL_LIST_H - -//----------------------------------------------------------------------------- -// -// class Channel -// class ChannelList -// -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include - - -namespace Imf { - - -struct Channel -{ - //------------------------------ - // Data type; see ImfPixelType.h - //------------------------------ - - PixelType type; - - - //-------------------------------------------- - // Subsampling: pixel (x, y) is present in the - // channel only if - // - // x % xSampling == 0 && y % ySampling == 0 - // - //-------------------------------------------- - - int xSampling; - int ySampling; - - - //------------ - // Constructor - //------------ - - Channel (PixelType type = HALF, - int xSampling = 1, - int ySampling = 1); - - - //------------ - // Operator == - //------------ - - bool operator == (const Channel &other) const; -}; - - -class ChannelList -{ - public: - - //-------------- - // Add a channel - //-------------- - - void insert (const char name[], - const Channel &channel); - - //------------------------------------------------------------------ - // Access to existing channels: - // - // [n] Returns a reference to the channel with name n. - // If no channel with name n exists, an Iex::ArgExc - // is thrown. - // - // findChannel(n) Returns a pointer to the channel with name n, - // or 0 if no channel with name n exists. - // - //------------------------------------------------------------------ - - Channel & operator [] (const char name[]); - const Channel & operator [] (const char name[]) const; - - Channel * findChannel (const char name[]); - const Channel * findChannel (const char name[]) const; - - - //------------------------------------------- - // Iterator-style access to existing channels - //------------------------------------------- - - typedef std::map ChannelMap; - - class Iterator; - class ConstIterator; - - Iterator begin (); - ConstIterator begin () const; - Iterator end (); - ConstIterator end () const; - Iterator find (const char name[]); - ConstIterator find (const char name[]) const; - - - //----------------------------------------------------------------- - // Support for image layers: - // - // In an image file with many channels it is sometimes useful to - // group the channels into "layers", that is, into sets of channels - // that logically belong together. Grouping channels into layers - // is done using a naming convention: channel C in layer L is - // called "L.C". - // - // For example, a computer graphic image may contain separate - // R, G and B channels for light that originated at each of - // several different virtual light sources. The channels in - // this image might be called "light1.R", "light1.G", "light1.B", - // "light2.R", "light2.G", "light2.B", etc. - // - // Note that this naming convention allows layers to be nested; - // for example, "light1.specular.R" identifies the "R" channel - // in the "specular" sub-layer of layer "light1". - // - // Channel names that don't contain a "." or that contain a - // "." only at the beginning or at the end are not considered - // to be part of any layer. - // - // layers(lns) sorts the channels in this ChannelList - // into layers and stores the names of - // all layers, sorted alphabetically, - // into string set lns. - // - // channelsInLayer(ln,f,l) stores a pair of iterators in f and l - // such that the loop - // - // for (ConstIterator i = f; i != l; ++i) - // ... - // - // iterates over all channels in layer ln. - // channelsInLayer (ln, l, p) calls - // channelsWithPrefix (ln + ".", l, p). - // - //----------------------------------------------------------------- - - void layers (std::set &layerNames) const; - - void channelsInLayer (const std::string &layerName, - Iterator &first, - Iterator &last); - - void channelsInLayer (const std::string &layerName, - ConstIterator &first, - ConstIterator &last) const; - - - //------------------------------------------------------------------- - // Find all channels whose name begins with a given prefix: - // - // channelsWithPrefix(p,f,l) stores a pair of iterators in f and l - // such that the following loop iterates over all channels whose name - // begins with string p: - // - // for (ConstIterator i = f; i != l; ++i) - // ... - // - //------------------------------------------------------------------- - - void channelsWithPrefix (const char prefix[], - Iterator &first, - Iterator &last); - - void channelsWithPrefix (const char prefix[], - ConstIterator &first, - ConstIterator &last) const; - - //------------ - // Operator == - //------------ - - bool operator == (const ChannelList &other) const; - - private: - - ChannelMap _map; -}; - - -//---------- -// Iterators -//---------- - -class ChannelList::Iterator -{ - public: - - Iterator (); - Iterator (const ChannelList::ChannelMap::iterator &i); - - Iterator & operator ++ (); - Iterator operator ++ (int); - - const char * name () const; - Channel & channel () const; - - private: - - friend class ChannelList::ConstIterator; - - ChannelList::ChannelMap::iterator _i; -}; - - -class ChannelList::ConstIterator -{ - public: - - ConstIterator (); - ConstIterator (const ChannelList::ChannelMap::const_iterator &i); - ConstIterator (const ChannelList::Iterator &other); - - ConstIterator & operator ++ (); - ConstIterator operator ++ (int); - - const char * name () const; - const Channel & channel () const; - - private: - - friend bool operator == (const ConstIterator &, const ConstIterator &); - friend bool operator != (const ConstIterator &, const ConstIterator &); - - ChannelList::ChannelMap::const_iterator _i; -}; - - -//----------------- -// Inline Functions -//----------------- - -inline -ChannelList::Iterator::Iterator (): _i() -{ - // empty -} - - -inline -ChannelList::Iterator::Iterator (const ChannelList::ChannelMap::iterator &i): - _i (i) -{ - // empty -} - - -inline ChannelList::Iterator & -ChannelList::Iterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline ChannelList::Iterator -ChannelList::Iterator::operator ++ (int) -{ - Iterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -ChannelList::Iterator::name () const -{ - return *_i->first; -} - - -inline Channel & -ChannelList::Iterator::channel () const -{ - return _i->second; -} - - -inline -ChannelList::ConstIterator::ConstIterator (): _i() -{ - // empty -} - -inline -ChannelList::ConstIterator::ConstIterator - (const ChannelList::ChannelMap::const_iterator &i): _i (i) -{ - // empty -} - - -inline -ChannelList::ConstIterator::ConstIterator (const ChannelList::Iterator &other): - _i (other._i) -{ - // empty -} - -inline ChannelList::ConstIterator & -ChannelList::ConstIterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline ChannelList::ConstIterator -ChannelList::ConstIterator::operator ++ (int) -{ - ConstIterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -ChannelList::ConstIterator::name () const -{ - return *_i->first; -} - -inline const Channel & -ChannelList::ConstIterator::channel () const -{ - return _i->second; -} - - -inline bool -operator == (const ChannelList::ConstIterator &x, - const ChannelList::ConstIterator &y) -{ - return x._i == y._i; -} - - -inline bool -operator != (const ChannelList::ConstIterator &x, - const ChannelList::ConstIterator &y) -{ - return !(x == y); -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfChannelListAttribute.h b/3rdparty/include/OpenEXR/ImfChannelListAttribute.h deleted file mode 100644 index 050ecf9219..0000000000 --- a/3rdparty/include/OpenEXR/ImfChannelListAttribute.h +++ /dev/null @@ -1,67 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_CHANNEL_LIST_ATTRIBUTE_H -#define INCLUDED_IMF_CHANNEL_LIST_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class ChannelListAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute ChannelListAttribute; -template <> const char *ChannelListAttribute::staticTypeName (); -template <> void ChannelListAttribute::writeValueTo (OStream &, int) const; -template <> void ChannelListAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif - diff --git a/3rdparty/include/OpenEXR/ImfChromaticities.h b/3rdparty/include/OpenEXR/ImfChromaticities.h deleted file mode 100644 index 5132ce9a8e..0000000000 --- a/3rdparty/include/OpenEXR/ImfChromaticities.h +++ /dev/null @@ -1,127 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_CHROMATICITIES_H -#define INCLUDED_IMF_CHROMATICITIES_H - -//----------------------------------------------------------------------------- -// -// CIE (x,y) chromaticities, and conversions between -// RGB tiples and CIE XYZ tristimulus values. -// -//----------------------------------------------------------------------------- - -#include "ImathVec.h" -#include "ImathMatrix.h" - -namespace Imf { - - -struct Chromaticities -{ - Imath::V2f red; - Imath::V2f green; - Imath::V2f blue; - Imath::V2f white; - - Chromaticities (const Imath::V2f &red = Imath::V2f (0.6400f, 0.3300f), - const Imath::V2f &green = Imath::V2f (0.3000f, 0.6000f), - const Imath::V2f &blue = Imath::V2f (0.1500f, 0.0600f), - const Imath::V2f &white = Imath::V2f (0.3127f, 0.3290f)); -}; - - -// -// Conversions between RGB and CIE XYZ -// -// RGB to XYZ: -// -// Given a set of chromaticities, c, and the luminance, Y, of the RGB -// triple (1,1,1), or "white", RGBtoXYZ(c,Y) computes a matrix, M, so -// that multiplying an RGB value, v, with M produces an equivalent -// XYZ value, w. (w == v * M) -// -// If we define that -// -// (Xr, Yr, Zr) == (1, 0, 0) * M -// (Xg, Yg, Zg) == (0, 1, 0) * M -// (Xb, Yb, Zb) == (0, 0, 1) * M -// (Xw, Yw, Zw) == (1, 1, 1) * M, -// -// then the following statements are true: -// -// Xr / (Xr + Yr + Zr) == c.red.x -// Yr / (Xr + Yr + Zr) == c.red.y -// -// Xg / (Xg + Yg + Zg) == c.red.x -// Yg / (Xg + Yg + Zg) == c.red.y -// -// Xb / (Xb + Yb + Zb) == c.red.x -// Yb / (Xb + Yb + Zb) == c.red.y -// -// Xw / (Xw + Yw + Zw) == c.red.x -// Yw / (Xw + Yw + Zw) == c.red.y -// -// Yw == Y. -// -// XYZ to RGB: -// -// YYZtoRGB(c,Y) returns RGBtoXYZ(c,Y).inverse(). -// -// Warning: -// -// It would seem that RGBtoXYZ() and XYZtoRGB() are all you need -// to convert RGB values with one set of primary and white point -// chromaticities into perceptually equivalent RGB values with -// different primary and white point chromaticities: -// -// M44f M = RGBtoXYZ (chromaticities1, Y1) * -// XYZtoRGB (chromaticities2, Y2); -// -// However, this simple conversion does not account for white point -// adaptation, and produces undesirable results. The proper thing -// to do is to perform a Bradford or a von Kries transform, which -// moves the white point of the original color space to the white -// point of the destination color space, dragging other colors with -// it in a sensible fashion. -// - -Imath::M44f RGBtoXYZ (const Chromaticities chroma, float Y); -Imath::M44f XYZtoRGB (const Chromaticities chroma, float Y); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfChromaticitiesAttribute.h b/3rdparty/include/OpenEXR/ImfChromaticitiesAttribute.h deleted file mode 100644 index 08357fa644..0000000000 --- a/3rdparty/include/OpenEXR/ImfChromaticitiesAttribute.h +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_CHROMATICITIES_ATTRIBUTE_H -#define INCLUDED_IMF_CHROMATICITIES_ATTRIBUTE_H - - -//----------------------------------------------------------------------------- -// -// class ChromaticitiesAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute ChromaticitiesAttribute; - -template <> -const char *ChromaticitiesAttribute::staticTypeName (); - -template <> -void ChromaticitiesAttribute::writeValueTo (OStream &, int) const; - -template <> -void ChromaticitiesAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfCompression.h b/3rdparty/include/OpenEXR/ImfCompression.h deleted file mode 100644 index f81e34d313..0000000000 --- a/3rdparty/include/OpenEXR/ImfCompression.h +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_COMPRESSION_H -#define INCLUDED_IMF_COMPRESSION_H - -//----------------------------------------------------------------------------- -// -// enum Compression -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -enum Compression -{ - NO_COMPRESSION = 0, // no compression - RLE_COMPRESSION = 1, // run length encoding - ZIPS_COMPRESSION = 2, // zlib compression, one scan line at a time - ZIP_COMPRESSION = 3, // zlib compression, in blocks of 16 scan lines - PIZ_COMPRESSION = 4, // piz-based wavelet compression - PXR24_COMPRESSION = 5, // lossy 24-bit float compression - - NUM_COMPRESSION_METHODS // number of different compression methods -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfCompressionAttribute.h b/3rdparty/include/OpenEXR/ImfCompressionAttribute.h deleted file mode 100644 index 268c26be5b..0000000000 --- a/3rdparty/include/OpenEXR/ImfCompressionAttribute.h +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_COMPRESSION_ATTRIBUTE_H -#define INCLUDED_IMF_COMPRESSION_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class CompressionAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute CompressionAttribute; -template <> const char *CompressionAttribute::staticTypeName (); -template <> void CompressionAttribute::writeValueTo (OStream &, int) const; -template <> void CompressionAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfConvert.h b/3rdparty/include/OpenEXR/ImfConvert.h deleted file mode 100644 index fc2c037251..0000000000 --- a/3rdparty/include/OpenEXR/ImfConvert.h +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_CONVERT_H -#define INCLUDED_IMF_CONVERT_H - -//----------------------------------------------------------------------------- -// -// Routines for converting between pixel data types, -// with well-defined behavior for exceptional cases, -// without depending on how hardware and operating -// system handle integer overflows and floating-point -// exceptions. -// -//----------------------------------------------------------------------------- - -#include "half.h" - - -namespace Imf { - -//--------------------------------------------------------- -// Conversion from half or float to unsigned int: -// -// input result -// --------------------------------------------------- -// -// finite, >= 0 input, cast to unsigned int -// (rounds towards zero) -// -// finite, < 0 0 -// -// NaN 0 -// -// +infinity UINT_MAX -// -// -infinity 0 -// -//--------------------------------------------------------- - -unsigned int halfToUint (half h); -unsigned int floatToUint (float f); - - -//--------------------------------------------------------- -// Conversion from unsigned int or float to half: -// -// input result -// --------------------------------------------------- -// -// finite, closest possible half -// magnitude <= HALF_MAX -// -// finite, > HALF_MAX +infinity -// -// finite, < -HALF_MAX -infinity -// -// NaN NaN -// -// +infinity +infinity -// -// -infinity -infinity -// -//--------------------------------------------------------- - -half uintToHalf (unsigned int ui); -half floatToHalf (float f); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfDoubleAttribute.h b/3rdparty/include/OpenEXR/ImfDoubleAttribute.h deleted file mode 100644 index bafd1ef2b7..0000000000 --- a/3rdparty/include/OpenEXR/ImfDoubleAttribute.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_DOUBLE_ATTRIBUTE_H -#define INCLUDED_IMF_DOUBLE_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class DoubleAttribute -// -//----------------------------------------------------------------------------- - -#include - - -namespace Imf { - - -typedef TypedAttribute DoubleAttribute; -template <> const char *DoubleAttribute::staticTypeName (); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfEnvmap.h b/3rdparty/include/OpenEXR/ImfEnvmap.h deleted file mode 100644 index 8c738a76fd..0000000000 --- a/3rdparty/include/OpenEXR/ImfEnvmap.h +++ /dev/null @@ -1,322 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_ENVMAP_H -#define INCLUDED_IMF_ENVMAP_H - -//----------------------------------------------------------------------------- -// -// Environment maps -// -// Environment maps define a mapping from 3D directions to 2D -// pixel space locations. Environment maps are typically used -// in 3D rendering, for effects such as quickly approximating -// how shiny surfaces reflect their environment. -// -// Environment maps can be stored in scanline-based or in tiled -// OpenEXR files. The fact that an image is an environment map -// is indicated by the presence of an EnvmapAttribute whose name -// is "envmap". (Convenience functions to access this attribute -// are defined in header file ImfStandardAttributes.h.) -// The attribute's value defines the mapping from 3D directions -// to 2D pixel space locations. -// -// This header file defines the set of possible EnvmapAttribute -// values. -// -// For each possible EnvmapAttribute value, this header file also -// defines a set of convienience functions to convert between 3D -// directions and 2D pixel locations. -// -// Most of the convenience functions defined below require a -// dataWindow parameter. For scanline-based images, and for -// tiled images with level mode ONE_LEVEL, the dataWindow -// parameter should be set to the image's data window, as -// defined in the image header. For tiled images with level -// mode MIPMAP_LEVELS or RIPMAP_LEVELS, the data window of the -// image level that is being accessed should be used instead. -// (See the dataWindowForLevel() methods in ImfTiledInputFile.h -// and ImfTiledOutputFile.h.) -// -//----------------------------------------------------------------------------- - -#include "ImathBox.h" - -namespace Imf { - -//-------------------------------- -// Supported environment map types -//-------------------------------- - -enum Envmap -{ - ENVMAP_LATLONG = 0, // Latitude-longitude environment map - ENVMAP_CUBE = 1, // Cube map - - NUM_ENVMAPTYPES // Number of different environment map types -}; - - -//------------------------------------------------------------------------- -// Latitude-Longitude Map: -// -// The environment is projected onto the image using polar coordinates -// (latitude and longitude). A pixel's x coordinate corresponds to -// its longitude, and the y coordinate corresponds to its latitude. -// Pixel (dataWindow.min.x, dataWindow.min.y) has latitude +pi/2 and -// longitude +pi; pixel (dataWindow.max.x, dataWindow.max.y) has -// latitude -pi/2 and longitude -pi. -// -// In 3D space, latitudes -pi/2 and +pi/2 correspond to the negative and -// positive y direction. Latitude 0, longitude 0 points into positive -// z direction; and latitude 0, longitude pi/2 points into positive x -// direction. -// -// The size of the data window should be 2*N by N pixels (width by height), -// where N can be any integer greater than 0. -//------------------------------------------------------------------------- - -namespace LatLongMap -{ - //---------------------------------------------------- - // Convert a 3D direction to a 2D vector whose x and y - // components represent the corresponding latitude - // and longitude. - //---------------------------------------------------- - - Imath::V2f latLong (const Imath::V3f &direction); - - - //-------------------------------------------------------- - // Convert the position of a pixel to a 2D vector whose - // x and y components represent the corresponding latitude - // and longitude. - //-------------------------------------------------------- - - Imath::V2f latLong (const Imath::Box2i &dataWindow, - const Imath::V2f &pixelPosition); - - - //------------------------------------------------------------- - // Convert a 2D vector, whose x and y components represent - // longitude and latitude, into a corresponding pixel position. - //------------------------------------------------------------- - - Imath::V2f pixelPosition (const Imath::Box2i &dataWindow, - const Imath::V2f &latLong); - - - //----------------------------------------------------- - // Convert a 3D direction vector into a corresponding - // pixel position. pixelPosition(dw,dir) is equivalent - // to pixelPosition(dw,latLong(dw,dir)). - //----------------------------------------------------- - - Imath::V2f pixelPosition (const Imath::Box2i &dataWindow, - const Imath::V3f &direction); - - - //-------------------------------------------------------- - // Convert the position of a pixel in a latitude-longitude - // map into a corresponding 3D direction. - //-------------------------------------------------------- - - Imath::V3f direction (const Imath::Box2i &dataWindow, - const Imath::V2f &pixelPosition); -} - - -//-------------------------------------------------------------- -// Cube Map: -// -// The environment is projected onto the six faces of an -// axis-aligned cube. The cube's faces are then arranged -// in a 2D image as shown below. -// -// 2-----------3 -// / /| -// / / | Y -// / / | | -// 6-----------7 | | -// | | | | -// | | | | -// | 0 | 1 *------- X -// | | / / -// | | / / -// | |/ / -// 4-----------5 Z -// -// dataWindow.min -// / -// / -// +-----------+ -// |3 Y 7| -// | | | -// | | | -// | ---+---Z | +X face -// | | | -// | | | -// |1 5| -// +-----------+ -// |6 Y 2| -// | | | -// | | | -// | Z---+--- | -X face -// | | | -// | | | -// |4 0| -// +-----------+ -// |6 Z 7| -// | | | -// | | | -// | ---+---X | +Y face -// | | | -// | | | -// |2 3| -// +-----------+ -// |0 1| -// | | | -// | | | -// | ---+---X | -Y face -// | | | -// | | | -// |4 Z 5| -// +-----------+ -// |7 Y 6| -// | | | -// | | | -// | X---+--- | +Z face -// | | | -// | | | -// |5 4| -// +-----------+ -// |2 Y 3| -// | | | -// | | | -// | ---+---X | -Z face -// | | | -// | | | -// |0 1| -// +-----------+ -// / -// / -// dataWindow.max -// -// The size of the data window should be N by 6*N pixels -// (width by height), where N can be any integer greater -// than 0. -// -//-------------------------------------------------------------- - -//------------------------------------ -// Names for the six faces of the cube -//------------------------------------ - -enum CubeMapFace -{ - CUBEFACE_POS_X, // +X face - CUBEFACE_NEG_X, // -X face - CUBEFACE_POS_Y, // +Y face - CUBEFACE_NEG_Y, // -Y face - CUBEFACE_POS_Z, // +Z face - CUBEFACE_NEG_Z, // -Z face -}; - -namespace CubeMap -{ - //--------------------------------------------- - // Width and height of a cube's face, in pixels - //--------------------------------------------- - - int sizeOfFace (const Imath::Box2i &dataWindow); - - - //------------------------------------------ - // Compute the region in the environment map - // that is covered by the specified face. - //------------------------------------------ - - Imath::Box2i dataWindowForFace (CubeMapFace face, - const Imath::Box2i &dataWindow); - - - //---------------------------------------------------- - // Convert the coordinates of a pixel within a face - // [in the range from (0,0) to (s-1,s-1), where - // s == sizeOfFace(dataWindow)] to pixel coordinates - // in the environment map. - //---------------------------------------------------- - - Imath::V2f pixelPosition (CubeMapFace face, - const Imath::Box2i &dataWindow, - Imath::V2f positionInFace); - - - //-------------------------------------------------------------- - // Convert a 3D direction into a cube face, and a pixel position - // within that face. - // - // If you have a 3D direction, dir, the following code fragment - // finds the position, pos, of the corresponding pixel in an - // environment map with data window dw: - // - // CubeMapFace f; - // V2f pif, pos; - // - // faceAndPixelPosition (dir, dw, f, pif); - // pos = pixelPosition (f, dw, pif); - // - //-------------------------------------------------------------- - - void faceAndPixelPosition (const Imath::V3f &direction, - const Imath::Box2i &dataWindow, - CubeMapFace &face, - Imath::V2f &positionInFace); - - - // -------------------------------------------------------- - // Given a cube face and a pixel position within that face, - // compute the corresponding 3D direction. - // -------------------------------------------------------- - - Imath::V3f direction (CubeMapFace face, - const Imath::Box2i &dataWindow, - const Imath::V2f &positionInFace); -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfEnvmapAttribute.h b/3rdparty/include/OpenEXR/ImfEnvmapAttribute.h deleted file mode 100644 index 716883fbdc..0000000000 --- a/3rdparty/include/OpenEXR/ImfEnvmapAttribute.h +++ /dev/null @@ -1,65 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_IMF_ENVMAP_ATTRIBUTE_H -#define INCLUDED_IMF_ENVMAP_ATTRIBUTE_H - - -//----------------------------------------------------------------------------- -// -// class EnvmapAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute EnvmapAttribute; -template <> const char *EnvmapAttribute::staticTypeName (); -template <> void EnvmapAttribute::writeValueTo (OStream &, int) const; -template <> void EnvmapAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfFloatAttribute.h b/3rdparty/include/OpenEXR/ImfFloatAttribute.h deleted file mode 100644 index 60d6f23c51..0000000000 --- a/3rdparty/include/OpenEXR/ImfFloatAttribute.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_FLOAT_ATTRIBUTE_H -#define INCLUDED_IMF_FLOAT_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class FloatAttribute -// -//----------------------------------------------------------------------------- - -#include - - -namespace Imf { - - -typedef TypedAttribute FloatAttribute; -template <> const char *FloatAttribute::staticTypeName (); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfFrameBuffer.h b/3rdparty/include/OpenEXR/ImfFrameBuffer.h deleted file mode 100644 index cd24016833..0000000000 --- a/3rdparty/include/OpenEXR/ImfFrameBuffer.h +++ /dev/null @@ -1,368 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_FRAME_BUFFER_H -#define INCLUDED_IMF_FRAME_BUFFER_H - -//----------------------------------------------------------------------------- -// -// class Slice -// class FrameBuffer -// -//----------------------------------------------------------------------------- - -#include -#include -#include - - -namespace Imf { - - -//------------------------------------------------------- -// Description of a single slice of the frame buffer: -// -// Note -- terminology: as part of a file, a component of -// an image (e.g. red, green, blue, depth etc.) is called -// a "channel". As part of a frame buffer, an image -// component is called a "slice". -//------------------------------------------------------- - -struct Slice -{ - //------------------------------ - // Data type; see ImfPixelType.h - //------------------------------ - - PixelType type; - - - //--------------------------------------------------------------------- - // Memory layout: The address of pixel (x, y) is - // - // base + (xp / xSampling) * xStride + (yp / ySampling) * yStride - // - // where xp and yp are computed as follows: - // - // * If we are reading or writing a scanline-based file: - // - // xp = x - // yp = y - // - // * If we are reading a tile whose upper left coorner is at (xt, yt): - // - // if xTileCoords is true then xp = x - xt, else xp = x - // if yTileCoords is true then yp = y - yt, else yp = y - // - //--------------------------------------------------------------------- - - char * base; - size_t xStride; - size_t yStride; - - - //-------------------------------------------- - // Subsampling: pixel (x, y) is present in the - // slice only if - // - // x % xSampling == 0 && y % ySampling == 0 - // - //-------------------------------------------- - - int xSampling; - int ySampling; - - - //---------------------------------------------------------- - // Default value, used to fill the slice when a file without - // a channel that corresponds to this slice is read. - //---------------------------------------------------------- - - double fillValue; - - - //------------------------------------------------------- - // For tiled files, the xTileCoords and yTileCoords flags - // determine whether pixel addressing is performed using - // absolute coordinates or coordinates relative to a - // tile's upper left corner. (See the comment on base, - // xStride and yStride, above.) - // - // For scanline-based files these flags have no effect; - // pixel addressing is always done using absolute - // coordinates. - //------------------------------------------------------- - - bool xTileCoords; - bool yTileCoords; - - - //------------ - // Constructor - //------------ - - Slice (PixelType type = HALF, - char * base = 0, - size_t xStride = 0, - size_t yStride = 0, - int xSampling = 1, - int ySampling = 1, - double fillValue = 0.0, - bool xTileCoords = false, - bool yTileCoords = false); -}; - - -class FrameBuffer -{ - public: - - //------------ - // Add a slice - //------------ - - void insert (const char name[], - const Slice &slice); - - //---------------------------------------------------------------- - // Access to existing slices: - // - // [n] Returns a reference to the slice with name n. - // If no slice with name n exists, an Iex::ArgExc - // is thrown. - // - // findSlice(n) Returns a pointer to the slice with name n, - // or 0 if no slice with name n exists. - // - //---------------------------------------------------------------- - - Slice & operator [] (const char name[]); - const Slice & operator [] (const char name[]) const; - - Slice * findSlice (const char name[]); - const Slice * findSlice (const char name[]) const; - - - //----------------------------------------- - // Iterator-style access to existing slices - //----------------------------------------- - - typedef std::map SliceMap; - - class Iterator; - class ConstIterator; - - Iterator begin (); - ConstIterator begin () const; - Iterator end (); - ConstIterator end () const; - Iterator find (const char name[]); - ConstIterator find (const char name[]) const; - - private: - - SliceMap _map; -}; - - -//---------- -// Iterators -//---------- - -class FrameBuffer::Iterator -{ - public: - - Iterator (); - Iterator (const FrameBuffer::SliceMap::iterator &i); - - Iterator & operator ++ (); - Iterator operator ++ (int); - - const char * name () const; - Slice & slice () const; - - private: - - friend class FrameBuffer::ConstIterator; - - FrameBuffer::SliceMap::iterator _i; -}; - - -class FrameBuffer::ConstIterator -{ - public: - - ConstIterator (); - ConstIterator (const FrameBuffer::SliceMap::const_iterator &i); - ConstIterator (const FrameBuffer::Iterator &other); - - ConstIterator & operator ++ (); - ConstIterator operator ++ (int); - - const char * name () const; - const Slice & slice () const; - - private: - - friend bool operator == (const ConstIterator &, const ConstIterator &); - friend bool operator != (const ConstIterator &, const ConstIterator &); - - FrameBuffer::SliceMap::const_iterator _i; -}; - - -//----------------- -// Inline Functions -//----------------- - -inline -FrameBuffer::Iterator::Iterator (): _i() -{ - // empty -} - - -inline -FrameBuffer::Iterator::Iterator (const FrameBuffer::SliceMap::iterator &i): - _i (i) -{ - // empty -} - - -inline FrameBuffer::Iterator & -FrameBuffer::Iterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline FrameBuffer::Iterator -FrameBuffer::Iterator::operator ++ (int) -{ - Iterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -FrameBuffer::Iterator::name () const -{ - return *_i->first; -} - - -inline Slice & -FrameBuffer::Iterator::slice () const -{ - return _i->second; -} - - -inline -FrameBuffer::ConstIterator::ConstIterator (): _i() -{ - // empty -} - -inline -FrameBuffer::ConstIterator::ConstIterator - (const FrameBuffer::SliceMap::const_iterator &i): _i (i) -{ - // empty -} - - -inline -FrameBuffer::ConstIterator::ConstIterator (const FrameBuffer::Iterator &other): - _i (other._i) -{ - // empty -} - -inline FrameBuffer::ConstIterator & -FrameBuffer::ConstIterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline FrameBuffer::ConstIterator -FrameBuffer::ConstIterator::operator ++ (int) -{ - ConstIterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -FrameBuffer::ConstIterator::name () const -{ - return *_i->first; -} - -inline const Slice & -FrameBuffer::ConstIterator::slice () const -{ - return _i->second; -} - - -inline bool -operator == (const FrameBuffer::ConstIterator &x, - const FrameBuffer::ConstIterator &y) -{ - return x._i == y._i; -} - - -inline bool -operator != (const FrameBuffer::ConstIterator &x, - const FrameBuffer::ConstIterator &y) -{ - return !(x == y); -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfHeader.h b/3rdparty/include/OpenEXR/ImfHeader.h deleted file mode 100644 index 0d93a8cb9e..0000000000 --- a/3rdparty/include/OpenEXR/ImfHeader.h +++ /dev/null @@ -1,557 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_HEADER_H -#define INCLUDED_IMF_HEADER_H - -//----------------------------------------------------------------------------- -// -// class Header -// -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include "ImathVec.h" -#include "ImathBox.h" -#include "IexBaseExc.h" -#include -#include - -namespace Imf { - - -class Attribute; -class ChannelList; -class IStream; -class OStream; -class PreviewImage; - - -class Header -{ - public: - - //---------------------------------------------------------------- - // Default constructor -- the display window and the data window - // are both set to Box2i (V2i (0, 0), V2i (width-1, height-1). - //---------------------------------------------------------------- - - Header (int width = 64, - int height = 64, - float pixelAspectRatio = 1, - const Imath::V2f &screenWindowCenter = Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression = ZIP_COMPRESSION); - - - //-------------------------------------------------------------------- - // Constructor -- the data window is specified explicitly; the display - // window is set to Box2i (V2i (0, 0), V2i (width-1, height-1). - //-------------------------------------------------------------------- - - Header (int width, - int height, - const Imath::Box2i &dataWindow, - float pixelAspectRatio = 1, - const Imath::V2f &screenWindowCenter = Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression = ZIP_COMPRESSION); - - - //---------------------------------------------------------- - // Constructor -- the display window and the data window are - // both specified explicitly. - //---------------------------------------------------------- - - Header (const Imath::Box2i &displayWindow, - const Imath::Box2i &dataWindow, - float pixelAspectRatio = 1, - const Imath::V2f &screenWindowCenter = Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression = ZIP_COMPRESSION); - - - //----------------- - // Copy constructor - //----------------- - - Header (const Header &other); - - - //----------- - // Destructor - //----------- - - ~Header (); - - - //----------- - // Assignment - //----------- - - Header & operator = (const Header &other); - - - //--------------------------------------------------------------- - // Add an attribute: - // - // insert(n,attr) If no attribute with name n exists, a new - // attribute with name n, and the same type as - // attr, is added, and the value of attr is - // copied into the new attribute. - // - // If an attribute with name n exists, and its - // type is the same as attr, the value of attr - // is copied into this attribute. - // - // If an attribute with name n exists, and its - // type is different from attr, an Iex::TypeExc - // is thrown. - // - //--------------------------------------------------------------- - - void insert (const char name[], - const Attribute &attribute); - - //------------------------------------------------------------------ - // Access to existing attributes: - // - // [n] Returns a reference to the attribute - // with name n. If no attribute with - // name n exists, an Iex::ArgExc is thrown. - // - // typedAttribute(n) Returns a reference to the attribute - // with name n and type T. If no attribute - // with name n exists, an Iex::ArgExc is - // thrown. If an attribute with name n - // exists, but its type is not T, an - // Iex::TypeExc is thrown. - // - // findTypedAttribute(n) Returns a pointer to the attribute with - // name n and type T, or 0 if no attribute - // with name n and type T exists. - // - //------------------------------------------------------------------ - - Attribute & operator [] (const char name[]); - const Attribute & operator [] (const char name[]) const; - - template T& typedAttribute (const char name[]); - template const T& typedAttribute (const char name[]) const; - - template T* findTypedAttribute (const char name[]); - template const T* findTypedAttribute (const char name[]) const; - - - //--------------------------------------------- - // Iterator-style access to existing attributes - //--------------------------------------------- - - typedef std::map AttributeMap; - - class Iterator; - class ConstIterator; - - Iterator begin (); - ConstIterator begin () const; - Iterator end (); - ConstIterator end () const; - Iterator find (const char name[]); - ConstIterator find (const char name[]) const; - - - //-------------------------------- - // Access to predefined attributes - //-------------------------------- - - Imath::Box2i & displayWindow (); - const Imath::Box2i & displayWindow () const; - - Imath::Box2i & dataWindow (); - const Imath::Box2i & dataWindow () const; - - float & pixelAspectRatio (); - const float & pixelAspectRatio () const; - - Imath::V2f & screenWindowCenter (); - const Imath::V2f & screenWindowCenter () const; - - float & screenWindowWidth (); - const float & screenWindowWidth () const; - - ChannelList & channels (); - const ChannelList & channels () const; - - LineOrder & lineOrder (); - const LineOrder & lineOrder () const; - - Compression & compression (); - const Compression & compression () const; - - - //---------------------------------------------------------------------- - // Tile Description: - // - // The tile description is a TileDescriptionAttribute whose name - // is "tiles". The "tiles" attribute must be present in any tiled - // image file. When present, it describes various properties of the - // tiles that make up the file. - // - // Convenience functions: - // - // setTileDescription(td) - // calls insert ("tiles", TileDescriptionAttribute (td)) - // - // tileDescription() - // returns typedAttribute("tiles").value() - // - // hasTileDescription() - // return findTypedAttribute("tiles") != 0 - // - //---------------------------------------------------------------------- - - void setTileDescription (const TileDescription & td); - - TileDescription & tileDescription (); - const TileDescription & tileDescription () const; - - bool hasTileDescription() const; - - - //---------------------------------------------------------------------- - // Preview image: - // - // The preview image is a PreviewImageAttribute whose name is "preview". - // This attribute is special -- while an image file is being written, - // the pixels of the preview image can be changed repeatedly by calling - // OutputFile::updatePreviewImage(). - // - // Convenience functions: - // - // setPreviewImage(p) - // calls insert ("preview", PreviewImageAttribute (p)) - // - // previewImage() - // returns typedAttribute("preview").value() - // - // hasPreviewImage() - // return findTypedAttribute("preview") != 0 - // - //---------------------------------------------------------------------- - - void setPreviewImage (const PreviewImage &p); - - PreviewImage & previewImage (); - const PreviewImage & previewImage () const; - - bool hasPreviewImage () const; - - - //------------------------------------------------------------- - // Sanity check -- examines the header, and throws an exception - // if it finds something wrong (empty display window, negative - // pixel aspect ratio, unknown compression sceme etc.) - // - // set isTiled to true if you are checking a tiled/multi-res - // header - //------------------------------------------------------------- - - void sanityCheck (bool isTiled = false) const; - - - //------------------------------------------------------------------ - // Input and output: - // - // If the header contains a preview image attribute, then writeTo() - // returns the position of that attribute in the output stream; this - // information is used by OutputFile::updatePreviewImage(). - // If the header contains no preview image attribute, then writeTo() - // returns 0. - //------------------------------------------------------------------ - - - Int64 writeTo (OStream &os, - bool isTiled = false) const; - - void readFrom (IStream &is, int &version); - - private: - - AttributeMap _map; -}; - - -//---------- -// Iterators -//---------- - -class Header::Iterator -{ - public: - - Iterator (); - Iterator (const Header::AttributeMap::iterator &i); - - Iterator & operator ++ (); - Iterator operator ++ (int); - - const char * name () const; - Attribute & attribute () const; - - private: - - friend class Header::ConstIterator; - - Header::AttributeMap::iterator _i; -}; - - -class Header::ConstIterator -{ - public: - - ConstIterator (); - ConstIterator (const Header::AttributeMap::const_iterator &i); - ConstIterator (const Header::Iterator &other); - - ConstIterator & operator ++ (); - ConstIterator operator ++ (int); - - const char * name () const; - const Attribute & attribute () const; - - private: - - friend bool operator == (const ConstIterator &, const ConstIterator &); - friend bool operator != (const ConstIterator &, const ConstIterator &); - - Header::AttributeMap::const_iterator _i; -}; - - -//------------------------------------------------------------------------ -// Library initialization: -// -// In a multithreaded program, staticInitialize() must be called once -// during startup, before the program accesses any other functions or -// classes in the IlmImf library. Calling staticInitialize() in this -// way avoids races during initialization of the library's global -// variables. -// -// Single-threaded programs are not required to call staticInitialize(); -// initialization of the library's global variables happens automatically. -// -//------------------------------------------------------------------------ - -void staticInitialize (); - - -//----------------- -// Inline Functions -//----------------- - - -inline -Header::Iterator::Iterator (): _i() -{ - // empty -} - - -inline -Header::Iterator::Iterator (const Header::AttributeMap::iterator &i): _i (i) -{ - // empty -} - - -inline Header::Iterator & -Header::Iterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline Header::Iterator -Header::Iterator::operator ++ (int) -{ - Iterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -Header::Iterator::name () const -{ - return *_i->first; -} - - -inline Attribute & -Header::Iterator::attribute () const -{ - return *_i->second; -} - - -inline -Header::ConstIterator::ConstIterator (): _i() -{ - // empty -} - -inline -Header::ConstIterator::ConstIterator - (const Header::AttributeMap::const_iterator &i): _i (i) -{ - // empty -} - - -inline -Header::ConstIterator::ConstIterator (const Header::Iterator &other): - _i (other._i) -{ - // empty -} - -inline Header::ConstIterator & -Header::ConstIterator::operator ++ () -{ - ++_i; - return *this; -} - - -inline Header::ConstIterator -Header::ConstIterator::operator ++ (int) -{ - ConstIterator tmp = *this; - ++_i; - return tmp; -} - - -inline const char * -Header::ConstIterator::name () const -{ - return *_i->first; -} - - -inline const Attribute & -Header::ConstIterator::attribute () const -{ - return *_i->second; -} - - -inline bool -operator == (const Header::ConstIterator &x, const Header::ConstIterator &y) -{ - return x._i == y._i; -} - - -inline bool -operator != (const Header::ConstIterator &x, const Header::ConstIterator &y) -{ - return !(x == y); -} - - -//--------------------- -// Template definitions -//--------------------- - -template -T & -Header::typedAttribute (const char name[]) -{ - Attribute *attr = &(*this)[name]; - T *tattr = dynamic_cast (attr); - - if (tattr == 0) - throw Iex::TypeExc ("Unexpected attribute type."); - - return *tattr; -} - - -template -const T & -Header::typedAttribute (const char name[]) const -{ - const Attribute *attr = &(*this)[name]; - const T *tattr = dynamic_cast (attr); - - if (tattr == 0) - throw Iex::TypeExc ("Unexpected attribute type."); - - return *tattr; -} - - -template -T * -Header::findTypedAttribute (const char name[]) -{ - AttributeMap::iterator i = _map.find (name); - return (i == _map.end())? 0: dynamic_cast (i->second); -} - - -template -const T * -Header::findTypedAttribute (const char name[]) const -{ - AttributeMap::const_iterator i = _map.find (name); - return (i == _map.end())? 0: dynamic_cast (i->second); -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfHuf.h b/3rdparty/include/OpenEXR/ImfHuf.h deleted file mode 100644 index 5134dfdc79..0000000000 --- a/3rdparty/include/OpenEXR/ImfHuf.h +++ /dev/null @@ -1,79 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_HUF_H -#define INCLUDED_IMF_HUF_H - - -//----------------------------------------------------------------------------- -// -// 16-bit Huffman compression and decompression: -// -// hufCompress (r, nr, c) -// -// Compresses the contents of array r (of length nr), -// stores the compressed data in array c, and returns -// the size of the compressed data (in bytes). -// -// To avoid buffer overflows, the size of array c should -// be at least 2 * nr + 65536. -// -// hufUncompress (c, nc, r, nr) -// -// Uncompresses the data in array c (with length nc), -// and stores the results in array r (with length nr). -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -int -hufCompress (const unsigned short raw[/*nRaw*/], - int nRaw, - char compressed[/*2 * nRaw + 65536*/]); - - -void -hufUncompress (const char compressed[/*nCompressed*/], - int nCompressed, - unsigned short raw[/*nRaw*/], - int nRaw); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfIO.h b/3rdparty/include/OpenEXR/ImfIO.h deleted file mode 100644 index 44f51a304a..0000000000 --- a/3rdparty/include/OpenEXR/ImfIO.h +++ /dev/null @@ -1,252 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_IO_H -#define INCLUDED_IMF_IO_H - -//----------------------------------------------------------------------------- -// -// Low-level file input and output for OpenEXR. -// -//----------------------------------------------------------------------------- - -#include -#include - -namespace Imf { - -//----------------------------------------------------------- -// class IStream -- an abstract base class for input streams. -//----------------------------------------------------------- - -class IStream -{ - public: - - //----------- - // Destructor - //----------- - - virtual ~IStream (); - - - //------------------------------------------------- - // Does this input stream support memory-mapped IO? - // - // Memory-mapped streams can avoid an extra copy; - // memory-mapped read operations return a pointer - // to an internal buffer instead of copying data - // into a buffer supplied by the caller. - //------------------------------------------------- - - virtual bool isMemoryMapped () const; - - - //------------------------------------------------------ - // Read from the stream: - // - // read(c,n) reads n bytes from the stream, and stores - // them in array c. If the stream contains less than n - // bytes, or if an I/O error occurs, read(c,n) throws - // an exception. If read(c,n) reads the last byte from - // the file it returns false, otherwise it returns true. - //------------------------------------------------------ - - virtual bool read (char c[/*n*/], int n) = 0; - - - //--------------------------------------------------- - // Read from a memory-mapped stream: - // - // readMemoryMapped(n) reads n bytes from the stream - // and returns a pointer to the first byte. The - // returned pointer remains valid until the stream - // is closed. If there are less than n byte left to - // read in the stream or if the stream is not memory- - // mapped, readMemoryMapped(n) throws an exception. - //--------------------------------------------------- - - virtual char * readMemoryMapped (int n); - - - //-------------------------------------------------------- - // Get the current reading position, in bytes from the - // beginning of the file. If the next call to read() will - // read the first byte in the file, tellg() returns 0. - //-------------------------------------------------------- - - virtual Int64 tellg () = 0; - - - //------------------------------------------- - // Set the current reading position. - // After calling seekg(i), tellg() returns i. - //------------------------------------------- - - virtual void seekg (Int64 pos) = 0; - - - //------------------------------------------------------ - // Clear error conditions after an operation has failed. - //------------------------------------------------------ - - virtual void clear (); - - - //------------------------------------------------------ - // Get the name of the file associated with this stream. - //------------------------------------------------------ - - const char * fileName () const; - - protected: - - IStream (const char fileName[]); - - private: - - IStream (const IStream &); // not implemented - IStream & operator = (const IStream &); // not implemented - - std::string _fileName; -}; - - -//----------------------------------------------------------- -// class OStream -- an abstract base class for output streams -//----------------------------------------------------------- - -class OStream -{ - public: - - //----------- - // Destructor - //----------- - - virtual ~OStream (); - - - //---------------------------------------------------------- - // Write to the stream: - // - // write(c,n) takes n bytes from array c, and stores them - // in the stream. If an I/O error occurs, write(c,n) throws - // an exception. - //---------------------------------------------------------- - - virtual void write (const char c[/*n*/], int n) = 0; - - - //--------------------------------------------------------- - // Get the current writing position, in bytes from the - // beginning of the file. If the next call to write() will - // start writing at the beginning of the file, tellp() - // returns 0. - //--------------------------------------------------------- - - virtual Int64 tellp () = 0; - - - //------------------------------------------- - // Set the current writing position. - // After calling seekp(i), tellp() returns i. - //------------------------------------------- - - virtual void seekp (Int64 pos) = 0; - - - //------------------------------------------------------ - // Get the name of the file associated with this stream. - //------------------------------------------------------ - - const char * fileName () const; - - protected: - - OStream (const char fileName[]); - - private: - - OStream (const OStream &); // not implemented - OStream & operator = (const OStream &); // not implemented - - std::string _fileName; -}; - - -//----------------------- -// Helper classes for Xdr -//----------------------- - -struct StreamIO -{ - static void - writeChars (OStream &os, const char c[/*n*/], int n) - { - os.write (c, n); - } - - static bool - readChars (IStream &is, char c[/*n*/], int n) - { - return is.read (c, n); - } -}; - - -struct CharPtrIO -{ - static void - writeChars (char *&op, const char c[/*n*/], int n) - { - while (n--) - *op++ = *c++; - } - - static bool - readChars (const char *&ip, char c[/*n*/], int n) - { - while (n--) - *c++ = *ip++; - - return true; - } -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfInputFile.h b/3rdparty/include/OpenEXR/ImfInputFile.h deleted file mode 100644 index af9256bbd4..0000000000 --- a/3rdparty/include/OpenEXR/ImfInputFile.h +++ /dev/null @@ -1,209 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_INPUT_FILE_H -#define INCLUDED_IMF_INPUT_FILE_H - -//----------------------------------------------------------------------------- -// -// class InputFile -- a scanline-based interface that can be used -// to read both scanline-based and tiled OpenEXR image files. -// -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include - -namespace Imf { - -class TiledInputFile; -class ScanLineInputFile; - - -class InputFile -{ - public: - - //----------------------------------------------------------- - // A constructor that opens the file with the specified name. - // Destroying the InputFile object will close the file. - // - // numThreads determines the number of threads that will be - // used to read the file (see ImfThreading.h). - //----------------------------------------------------------- - - InputFile (const char fileName[], int numThreads = globalThreadCount()); - - - //------------------------------------------------------------- - // A constructor that attaches the new InputFile object to a - // file that has already been opened. Destroying the InputFile - // object will not close the file. - // - // numThreads determines the number of threads that will be - // used to read the file (see ImfThreading.h). - //------------------------------------------------------------- - - InputFile (IStream &is, int numThreads = globalThreadCount()); - - - //----------- - // Destructor - //----------- - - virtual ~InputFile (); - - - //------------------------ - // Access to the file name - //------------------------ - - const char * fileName () const; - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - - - //---------------------------------- - // Access to the file format version - //---------------------------------- - - int version () const; - - - //----------------------------------------------------------- - // Set the current frame buffer -- copies the FrameBuffer - // object into the InputFile object. - // - // The current frame buffer is the destination for the pixel - // data read from the file. The current frame buffer must be - // set at least once before readPixels() is called. - // The current frame buffer can be changed after each call - // to readPixels(). - //----------------------------------------------------------- - - void setFrameBuffer (const FrameBuffer &frameBuffer); - - - //----------------------------------- - // Access to the current frame buffer - //----------------------------------- - - const FrameBuffer & frameBuffer () const; - - - //--------------------------------------------------------------- - // Check if the file is complete: - // - // isComplete() returns true if all pixels in the data window are - // present in the input file, or false if any pixels are missing. - // (Another program may still be busy writing the file, or file - // writing may have been aborted prematurely.) - //--------------------------------------------------------------- - - bool isComplete () const; - - - //--------------------------------------------------------------- - // Read pixel data: - // - // readPixels(s1,s2) reads all scan lines with y coordinates - // in the interval [min (s1, s2), max (s1, s2)] from the file, - // and stores them in the current frame buffer. - // - // Both s1 and s2 must be within the interval - // [header().dataWindow().min.y, header().dataWindow().max.y] - // - // The scan lines can be read from the file in random order, and - // individual scan lines may be skipped or read multiple times. - // For maximum efficiency, the scan lines should be read in the - // order in which they were written to the file. - // - // readPixels(s) calls readPixels(s,s). - // - //--------------------------------------------------------------- - - void readPixels (int scanLine1, int scanLine2); - void readPixels (int scanLine); - - - //---------------------------------------------- - // Read a block of raw pixel data from the file, - // without uncompressing it (this function is - // used to implement OutputFile::copyPixels()). - //---------------------------------------------- - - void rawPixelData (int firstScanLine, - const char *&pixelData, - int &pixelDataSize); - - //-------------------------------------------------- - // Read a tile of raw pixel data from the file, - // without uncompressing it (this function is - // used to implement TiledOutputFile::copyPixels()). - //-------------------------------------------------- - - void rawTileData (int &dx, int &dy, - int &lx, int &ly, - const char *&pixelData, - int &pixelDataSize); - - struct Data; - - private: - - InputFile (const InputFile &); // not implemented - InputFile & operator = (const InputFile &); // not implemented - - void initialize (); - TiledInputFile * tFile (); - - friend void TiledOutputFile::copyPixels (InputFile &); - - Data * _data; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfInt64.h b/3rdparty/include/OpenEXR/ImfInt64.h deleted file mode 100644 index 926eeb014f..0000000000 --- a/3rdparty/include/OpenEXR/ImfInt64.h +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_INT64_H -#define INCLUDED_IMF_INT64_H - -//---------------------------------------------------------------------------- -// -// Int64 -- unsigned 64-bit integers -// -//---------------------------------------------------------------------------- - -#include - -namespace Imf { - - -#if (defined _WIN32 || defined _WIN64) && _MSC_VER >= 1300 - typedef unsigned __int64 Int64; -#elif ULONG_MAX == 18446744073709551615LU - typedef long unsigned int Int64; -#else - typedef long long unsigned int Int64; -#endif - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfIntAttribute.h b/3rdparty/include/OpenEXR/ImfIntAttribute.h deleted file mode 100644 index c67e5b1673..0000000000 --- a/3rdparty/include/OpenEXR/ImfIntAttribute.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_INT_ATTRIBUTE_H -#define INCLUDED_IMF_INT_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class IntAttribute -// -//----------------------------------------------------------------------------- - -#include - - -namespace Imf { - - -typedef TypedAttribute IntAttribute; -template <> const char *IntAttribute::staticTypeName (); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfKeyCode.h b/3rdparty/include/OpenEXR/ImfKeyCode.h deleted file mode 100644 index 93dd915ed4..0000000000 --- a/3rdparty/include/OpenEXR/ImfKeyCode.h +++ /dev/null @@ -1,161 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_KEY_CODE_H -#define INCLUDED_IMF_KEY_CODE_H - -//----------------------------------------------------------------------------- -// -// class KeyCode -// -// A KeyCode object uniquely identifies a motion picture film frame. -// The following fields specifiy film manufacturer, film type, film -// roll and the frame's position within the roll: -// -// filmMfcCode film manufacturer code -// range: 0 - 99 -// -// filmType film type code -// range: 0 - 99 -// -// prefix prefix to identify film roll -// range: 0 - 999999 -// -// count count, increments once every perfsPerCount -// perforations (see below) -// range: 0 - 9999 -// -// perfOffset offset of frame, in perforations from -// zero-frame reference mark -// range: 0 - 119 -// -// perfsPerFrame number of perforations per frame -// range: 1 - 15 -// -// typical values: -// -// 1 for 16mm film -// 3, 4, or 8 for 35mm film -// 5, 8 or 15 for 65mm film -// -// perfsPerCount number of perforations per count -// range: 20 - 120 -// -// typical values: -// -// 20 for 16mm film -// 64 for 35mm film -// 80 or 120 for 65mm film -// -// For more information about the interpretation of those fields see -// the following standards and recommended practice publications: -// -// SMPTE 254 Motion-Picture Film (35-mm) - Manufacturer-Printed -// Latent Image Identification Information -// -// SMPTE 268M File Format for Digital Moving-Picture Exchange (DPX) -// (section 6.1) -// -// SMPTE 270 Motion-Picture Film (65-mm) - Manufacturer- Printed -// Latent Image Identification Information -// -// SMPTE 271 Motion-Picture Film (16-mm) - Manufacturer- Printed -// Latent Image Identification Information -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -class KeyCode -{ - public: - - //------------------------------------- - // Constructors and assignment operator - //------------------------------------- - - KeyCode (int filmMfcCode = 0, - int filmType = 0, - int prefix = 0, - int count = 0, - int perfOffset = 0, - int perfsPerFrame = 4, - int perfsPerCount = 64); - - KeyCode (const KeyCode &other); - KeyCode & operator = (const KeyCode &other); - - - //---------------------------- - // Access to individual fields - //---------------------------- - - int filmMfcCode () const; - void setFilmMfcCode (int filmMfcCode); - - int filmType () const; - void setFilmType (int filmType); - - int prefix () const; - void setPrefix (int prefix); - - int count () const; - void setCount (int count); - - int perfOffset () const; - void setPerfOffset (int perfOffset); - - int perfsPerFrame () const; - void setPerfsPerFrame (int perfsPerFrame); - - int perfsPerCount () const; - void setPerfsPerCount (int perfsPerCount); - - private: - - int _filmMfcCode; - int _filmType; - int _prefix; - int _count; - int _perfOffset; - int _perfsPerFrame; - int _perfsPerCount; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfKeyCodeAttribute.h b/3rdparty/include/OpenEXR/ImfKeyCodeAttribute.h deleted file mode 100644 index 9ec8f84034..0000000000 --- a/3rdparty/include/OpenEXR/ImfKeyCodeAttribute.h +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_KEY_CODE_ATTRIBUTE_H -#define INCLUDED_IMF_KEY_CODE_ATTRIBUTE_H - - -//----------------------------------------------------------------------------- -// -// class KeyCodeAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute KeyCodeAttribute; - -template <> -const char *KeyCodeAttribute::staticTypeName (); - -template <> -void KeyCodeAttribute::writeValueTo (OStream &, int) const; - -template <> -void KeyCodeAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfLineOrder.h b/3rdparty/include/OpenEXR/ImfLineOrder.h deleted file mode 100644 index 2f91352fd9..0000000000 --- a/3rdparty/include/OpenEXR/ImfLineOrder.h +++ /dev/null @@ -1,64 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_LINE_ORDER_H -#define INCLUDED_IMF_LINE_ORDER_H - -//----------------------------------------------------------------------------- -// -// enum LineOrder -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -enum LineOrder -{ - INCREASING_Y = 0, // first scan line has lowest y coordinate - - DECREASING_Y = 1, // first scan line has highest y coordinate - - RANDOM_Y = 2, // only for tiled files; tiles are written - // in random order - - NUM_LINEORDERS // number of different line orders -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfLineOrderAttribute.h b/3rdparty/include/OpenEXR/ImfLineOrderAttribute.h deleted file mode 100644 index eb9301e040..0000000000 --- a/3rdparty/include/OpenEXR/ImfLineOrderAttribute.h +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_LINE_ORDER_ATTRIBUTE_H -#define INCLUDED_IMF_LINE_ORDER_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class LineOrderAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute LineOrderAttribute; -template <> const char *LineOrderAttribute::staticTypeName (); -template <> void LineOrderAttribute::writeValueTo (OStream &, int) const; -template <> void LineOrderAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfLut.h b/3rdparty/include/OpenEXR/ImfLut.h deleted file mode 100644 index ca702d2dbb..0000000000 --- a/3rdparty/include/OpenEXR/ImfLut.h +++ /dev/null @@ -1,185 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_LUT_H -#define INCLUDED_IMF_LUT_H - -//----------------------------------------------------------------------------- -// -// Lookup tables for efficient application -// of half --> half functions to pixel data, -// and some commonly applied functions. -// -//----------------------------------------------------------------------------- - -#include -#include -#include "ImathBox.h" -#include "halfFunction.h" - -namespace Imf { - -// -// Lookup table for individual half channels. -// - -class HalfLut -{ - public: - - //------------ - // Constructor - //------------ - - template - HalfLut (Function f); - - - //---------------------------------------------------------------------- - // Apply the table to data[0], data[stride] ... data[(nData-1) * stride] - //---------------------------------------------------------------------- - - void apply (half *data, - int nData, - int stride = 1) const; - - - //--------------------------------------------------------------- - // Apply the table to a frame buffer slice (see ImfFrameBuffer.h) - //--------------------------------------------------------------- - - void apply (const Slice &data, - const Imath::Box2i &dataWindow) const; - - private: - - halfFunction _lut; -}; - - -// -// Lookup table for combined RGBA data. -// - -class RgbaLut -{ - public: - - //------------ - // Constructor - //------------ - - template - RgbaLut (Function f, RgbaChannels chn = WRITE_RGB); - - - //---------------------------------------------------------------------- - // Apply the table to data[0], data[stride] ... data[(nData-1) * stride] - //---------------------------------------------------------------------- - - void apply (Rgba *data, - int nData, - int stride = 1) const; - - - //----------------------------------------------------------------------- - // Apply the table to a frame buffer (see RgbaOutpuFile.setFrameBuffer()) - //----------------------------------------------------------------------- - - void apply (Rgba *base, - int xStride, - int yStride, - const Imath::Box2i &dataWindow) const; - - private: - - halfFunction _lut; - RgbaChannels _chn; -}; - - -// -// 12bit log rounding reduces data to 20 stops with 200 steps per stop. -// That makes 4000 numbers. An extra 96 just come along for the ride. -// Zero explicitly remains zero. The first non-zero half will map to 1 -// in the 0-4095 12log space. A nice power of two number is placed at -// the center [2000] and that number is near 0.18. -// - -half round12log (half x); - - -// -// Round to n-bit precision (n should be between 0 and 10). -// After rounding, the significand's 10-n least significant -// bits will be zero. -// - -struct roundNBit -{ - roundNBit (int n): n(n) {} - half operator () (half x) {return x.round(n);} - int n; -}; - - -// -// Template definitions -// - - -template -HalfLut::HalfLut (Function f): - _lut(f, -HALF_MAX, HALF_MAX, half (0), - half::posInf(), half::negInf(), half::qNan()) -{ - // empty -} - - -template -RgbaLut::RgbaLut (Function f, RgbaChannels chn): - _lut(f, -HALF_MAX, HALF_MAX, half (0), - half::posInf(), half::negInf(), half::qNan()), - _chn(chn) -{ - // empty -} - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfMatrixAttribute.h b/3rdparty/include/OpenEXR/ImfMatrixAttribute.h deleted file mode 100644 index db0efc7319..0000000000 --- a/3rdparty/include/OpenEXR/ImfMatrixAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_MATRIX_ATTRIBUTE_H -#define INCLUDED_IMF_MATRIX_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class M33fAttribute -// class M44fAttribute -// -//----------------------------------------------------------------------------- - -#include -#include "ImathMatrix.h" - - -namespace Imf { - - -typedef TypedAttribute M33fAttribute; -template <> const char *M33fAttribute::staticTypeName (); -template <> void M33fAttribute::writeValueTo (OStream &, int) const; -template <> void M33fAttribute::readValueFrom (IStream &, int, int); - - -typedef TypedAttribute M44fAttribute; -template <> const char *M44fAttribute::staticTypeName (); -template <> void M44fAttribute::writeValueTo (OStream &, int) const; -template <> void M44fAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfName.h b/3rdparty/include/OpenEXR/ImfName.h deleted file mode 100644 index afa893079b..0000000000 --- a/3rdparty/include/OpenEXR/ImfName.h +++ /dev/null @@ -1,146 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_NAME_H -#define INCLUDED_IMF_NAME_H - -//----------------------------------------------------------------------------- -// -// class ImfName -- a zero-terminated string -// with a fixed, small maximum length -// -//----------------------------------------------------------------------------- - -#include - -namespace Imf { - - -class Name -{ - public: - - //------------- - // Constructors - //------------- - - Name (); - Name (const char text[]); - - - //-------------------- - // Assignment operator - //-------------------- - - Name & operator = (const char text[]); - - - //--------------------- - // Access to the string - //--------------------- - - const char * text () const {return _text;} - const char * operator * () const {return _text;} - - //--------------- - // Maximum length - //--------------- - - static const int SIZE = 32; - static const int MAX_LENGTH = SIZE - 1; - - private: - - char _text[SIZE]; -}; - - -bool operator == (const Name &x, const Name &y); -bool operator != (const Name &x, const Name &y); -bool operator < (const Name &x, const Name &y); - - -//----------------- -// Inline functions -//----------------- - -inline Name & -Name::operator = (const char text[]) -{ - strncpy (_text, text, MAX_LENGTH); - return *this; -} - - -inline -Name::Name () -{ - _text[0] = 0; -} - - -inline -Name::Name (const char text[]) -{ - *this = text; - _text [MAX_LENGTH] = 0; -} - - -inline bool -operator == (const Name &x, const Name &y) -{ - return strcmp (*x, *y) == 0; -} - - -inline bool -operator != (const Name &x, const Name &y) -{ - return !(x == y); -} - - -inline bool -operator < (const Name &x, const Name &y) -{ - return strcmp (*x, *y) < 0; -} - - -} // namespace IMF - -#endif diff --git a/3rdparty/include/OpenEXR/ImfOpaqueAttribute.h b/3rdparty/include/OpenEXR/ImfOpaqueAttribute.h deleted file mode 100644 index 864ae93732..0000000000 --- a/3rdparty/include/OpenEXR/ImfOpaqueAttribute.h +++ /dev/null @@ -1,114 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_OPAQUE_ATTRIBUTE_H -#define INCLUDED_IMF_OPAQUE_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class OpaqueAttribute -// -// When an image file is read, OpqaqueAttribute objects are used -// to hold the values of attributes whose types are not recognized -// by the reading program. OpaqueAttribute objects can be read -// from an image file, copied, and written back to to another image -// file, but their values are inaccessible. -// -//----------------------------------------------------------------------------- - -#include -#include - -namespace Imf { - - -class OpaqueAttribute: public Attribute -{ - public: - - //---------------------------- - // Constructors and destructor - //---------------------------- - - OpaqueAttribute (const char typeName[]); - OpaqueAttribute (const OpaqueAttribute &other); - virtual ~OpaqueAttribute (); - - - //------------------------------- - // Get this attribute's type name - //------------------------------- - - virtual const char * typeName () const; - - - //------------------------------ - // Make a copy of this attribute - //------------------------------ - - virtual Attribute * copy () const; - - - //---------------- - // I/O and copying - //---------------- - - virtual void writeValueTo (OStream &os, - int version) const; - - virtual void readValueFrom (IStream &is, - int size, - int version); - - virtual void copyValueFrom (const Attribute &other); - - - private: - - Array _typeName; - long _dataSize; - Array _data; -}; - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfOutputFile.h b/3rdparty/include/OpenEXR/ImfOutputFile.h deleted file mode 100644 index bdc317a484..0000000000 --- a/3rdparty/include/OpenEXR/ImfOutputFile.h +++ /dev/null @@ -1,241 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_OUTPUT_FILE_H -#define INCLUDED_IMF_OUTPUT_FILE_H - -//----------------------------------------------------------------------------- -// -// class OutputFile -// -//----------------------------------------------------------------------------- - -#include -#include -#include - -namespace Imf { - -class InputFile; -struct PreviewRgba; - - -class OutputFile -{ - public: - - //----------------------------------------------------------- - // Constructor -- opens the file and writes the file header. - // The file header is also copied into the OutputFile object, - // and can later be accessed via the header() method. - // Destroying this OutputFile object automatically closes - // the file. - // - // numThreads determines the number of threads that will be - // used to write the file (see ImfThreading.h). - //----------------------------------------------------------- - - OutputFile (const char fileName[], const Header &header, - int numThreads = globalThreadCount()); - - - //------------------------------------------------------------ - // Constructor -- attaches the new OutputFile object to a file - // that has already been opened, and writes the file header. - // The file header is also copied into the OutputFile object, - // and can later be accessed via the header() method. - // Destroying this OutputFile object does not automatically - // close the file. - // - // numThreads determines the number of threads that will be - // used to write the file (see ImfThreading.h). - //------------------------------------------------------------ - - OutputFile (OStream &os, const Header &header, - int numThreads = globalThreadCount()); - - - //------------------------------------------------- - // Destructor - // - // Destroying the OutputFile object before writing - // all scan lines within the data window results in - // an incomplete file. - //------------------------------------------------- - - virtual ~OutputFile (); - - - //------------------------ - // Access to the file name - //------------------------ - - const char * fileName () const; - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - - - //------------------------------------------------------- - // Set the current frame buffer -- copies the FrameBuffer - // object into the OutputFile object. - // - // The current frame buffer is the source of the pixel - // data written to the file. The current frame buffer - // must be set at least once before writePixels() is - // called. The current frame buffer can be changed - // after each call to writePixels. - //------------------------------------------------------- - - void setFrameBuffer (const FrameBuffer &frameBuffer); - - - //----------------------------------- - // Access to the current frame buffer - //----------------------------------- - - const FrameBuffer & frameBuffer () const; - - - //------------------------------------------------------------------- - // Write pixel data: - // - // writePixels(n) retrieves the next n scan lines worth of data from - // the current frame buffer, starting with the scan line indicated by - // currentScanLine(), and stores the data in the output file, and - // progressing in the direction indicated by header.lineOrder(). - // - // To produce a complete and correct file, exactly m scan lines must - // be written, where m is equal to - // header().dataWindow().max.y - header().dataWindow().min.y + 1. - //------------------------------------------------------------------- - - void writePixels (int numScanLines = 1); - - - //------------------------------------------------------------------ - // Access to the current scan line: - // - // currentScanLine() returns the y coordinate of the first scan line - // that will be read from the current frame buffer during the next - // call to writePixels(). - // - // If header.lineOrder() == INCREASING_Y: - // - // The current scan line before the first call to writePixels() - // is header().dataWindow().min.y. After writing each scan line, - // the current scan line is incremented by 1. - // - // If header.lineOrder() == DECREASING_Y: - // - // The current scan line before the first call to writePixels() - // is header().dataWindow().max.y. After writing each scan line, - // the current scan line is decremented by 1. - // - //------------------------------------------------------------------ - - int currentScanLine () const; - - - //-------------------------------------------------------------- - // Shortcut to copy all pixels from an InputFile into this file, - // without uncompressing and then recompressing the pixel data. - // This file's header must be compatible with the InputFile's - // header: The two header's "dataWindow", "compression", - // "lineOrder" and "channels" attributes must be the same. - //-------------------------------------------------------------- - - void copyPixels (InputFile &in); - - - //-------------------------------------------------------------- - // Updating the preview image: - // - // updatePreviewImage() supplies a new set of pixels for the - // preview image attribute in the file's header. If the header - // does not contain a preview image, updatePreviewImage() throws - // an Iex::LogicExc. - // - // Note: updatePreviewImage() is necessary because images are - // often stored in a file incrementally, a few scan lines at a - // time, while the image is being generated. Since the preview - // image is an attribute in the file's header, it gets stored in - // the file as soon as the file is opened, but we may not know - // what the preview image should look like until we have written - // the last scan line of the main image. - // - //-------------------------------------------------------------- - - void updatePreviewImage (const PreviewRgba newPixels[]); - - - //--------------------------------------------------------- - // Break a scan line -- for testing and debugging only: - // - // breakScanLine(y,p,n,c) introduces an error into the - // output file by writing n copies of character c, starting - // p bytes from the beginning of the pixel data block that - // contains scan line y. - // - // Warning: Calling this function usually results in a - // broken image file. The file or parts of it may not - // be readable, or the file may contain bad data. - // - //--------------------------------------------------------- - - void breakScanLine (int y, int offset, int length, char c); - - - struct Data; - - private: - - OutputFile (const OutputFile &); // not implemented - OutputFile & operator = (const OutputFile &); // not implemented - - void initialize (const Header &header); - - Data * _data; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfPixelType.h b/3rdparty/include/OpenEXR/ImfPixelType.h deleted file mode 100644 index 8f504efa23..0000000000 --- a/3rdparty/include/OpenEXR/ImfPixelType.h +++ /dev/null @@ -1,61 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_PIXEL_TYPE_H -#define INCLUDED_IMF_PIXEL_TYPE_H - -//----------------------------------------------------------------------------- -// -// enum PixelType -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -enum 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 -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfPreviewImage.h b/3rdparty/include/OpenEXR/ImfPreviewImage.h deleted file mode 100644 index d016620394..0000000000 --- a/3rdparty/include/OpenEXR/ImfPreviewImage.h +++ /dev/null @@ -1,131 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2003, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_PREVIEW_IMAGE_H -#define INCLUDED_IMF_PREVIEW_IMAGE_H - -//----------------------------------------------------------------------------- -// -// class PreviewImage -- a usually small, low-dynamic range image, -// that is intended to be stored in an image file's header. -// -// struct PreviewRgba -- holds the value of a PreviewImage pixel. -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -struct PreviewRgba -{ - unsigned char r; // Red, green and blue components of - unsigned char g; // the pixel's color; intensity is - unsigned char b; // proportional to pow (x/255, 2.2), - // where x is r, g, or b. - - unsigned char a; // The pixel's alpha; 0 == transparent, - // 255 == opaque. - - PreviewRgba (unsigned char r = 0, - unsigned char g = 0, - unsigned char b = 0, - unsigned char a = 255) - : r(r), g(g), b(b), a(a) {} -}; - - -class PreviewImage -{ - public: - - //-------------------------------------------------------------------- - // Constructor: - // - // PreviewImage(w,h,p) constructs a preview image with w by h pixels - // whose initial values are specified in pixel array p. The x and y - // coordinates of the pixels in p go from 0 to w-1, and from 0 to h-1. - // The pixel with coordinates (x, y) is at address p + y*w + x. - // Pixel (0, 0) is in the upper left corner of the preview image. - // If p is zero, the pixels in the preview image are initialized with - // (r = 0, b = 0, g = 0, a = 255). - // - //-------------------------------------------------------------------- - - PreviewImage (unsigned int width = 0, - unsigned int height = 0, - const PreviewRgba pixels[] = 0); - - //----------------------------------------------------- - // Copy constructor, destructor and assignment operator - //----------------------------------------------------- - - PreviewImage (const PreviewImage &other); - ~PreviewImage (); - - PreviewImage & operator = (const PreviewImage &other); - - - //----------------------------------------------- - // Access to width, height and to the pixel array - //----------------------------------------------- - - unsigned int width () const {return _width;} - unsigned int height () const {return _height;} - - PreviewRgba * pixels () {return _pixels;} - const PreviewRgba * pixels () const {return _pixels;} - - - //---------------------------- - // Access to individual pixels - //---------------------------- - - PreviewRgba & pixel (unsigned int x, unsigned int y) - {return _pixels[y * _width + x];} - - const PreviewRgba & pixel (unsigned int x, unsigned int y) const - {return _pixels[y * _width + x];} - - private: - - unsigned int _width; - unsigned int _height; - PreviewRgba * _pixels; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfPreviewImageAttribute.h b/3rdparty/include/OpenEXR/ImfPreviewImageAttribute.h deleted file mode 100644 index f08b9b7b9a..0000000000 --- a/3rdparty/include/OpenEXR/ImfPreviewImageAttribute.h +++ /dev/null @@ -1,71 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_PREVIEW_IMAGE_ATTRIBUTE_H -#define INCLUDED_IMF_PREVIEW_IMAGE_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class PreviewImageAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute PreviewImageAttribute; - -template <> -const char *PreviewImageAttribute::staticTypeName (); - -template <> -void PreviewImageAttribute::writeValueTo (OStream &, int) const; - -template <> -void PreviewImageAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfRgba.h b/3rdparty/include/OpenEXR/ImfRgba.h deleted file mode 100644 index e68cb4b0e1..0000000000 --- a/3rdparty/include/OpenEXR/ImfRgba.h +++ /dev/null @@ -1,104 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_RGBA_H -#define INCLUDED_IMF_RGBA_H - -//----------------------------------------------------------------------------- -// -// class Rgba -// -//----------------------------------------------------------------------------- - -#include "half.h" - -namespace Imf { - - -// -// RGBA pixel -// - -struct Rgba -{ - half r; - half g; - half b; - half a; - - Rgba () {} - Rgba (half r, half g, half b, half a = 1.f): r (r), g (g), b (b), a (a) {} - - Rgba & operator = (const Rgba &other) - { - r = other.r; - g = other.g; - b = other.b; - a = other.a; - - return *this; - } -}; - - -// -// Channels in an RGBA file -// - -enum RgbaChannels -{ - WRITE_R = 0x01, // Red - WRITE_G = 0x02, // Green - WRITE_B = 0x04, // Blue - WRITE_A = 0x08, // Alpha - - WRITE_Y = 0x10, // Luminance, for black-and-white images, - // or in combination with chroma - - WRITE_C = 0x20, // Chroma (two subsampled channels, RY and BY, - // supported only for scanline-based files) - - WRITE_RGB = 0x07, // Red, green, blue - WRITE_RGBA = 0x0f, // Red, green, blue, alpha - - WRITE_YC = 0x30, // Luminance, chroma - WRITE_YA = 0x18, // Luminance, alpha - WRITE_YCA = 0x38 // Luminance, chroma, alpha -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfRgbaFile.h b/3rdparty/include/OpenEXR/ImfRgbaFile.h deleted file mode 100644 index ff7b07b869..0000000000 --- a/3rdparty/include/OpenEXR/ImfRgbaFile.h +++ /dev/null @@ -1,315 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_RGBA_FILE_H -#define INCLUDED_IMF_RGBA_FILE_H - - -//----------------------------------------------------------------------------- -// -// Simplified RGBA image I/O -// -// class RgbaOutputFile -// class RgbaInputFile -// -//----------------------------------------------------------------------------- - -#include -#include -#include -#include "ImathVec.h" -#include "ImathBox.h" -#include "half.h" -#include - -namespace Imf { - - -class OutputFile; -class InputFile; -struct PreviewRgba; - -// -// RGBA output file. -// - -class RgbaOutputFile -{ - public: - - //--------------------------------------------------- - // Constructor -- header is constructed by the caller - //--------------------------------------------------- - - RgbaOutputFile (const char name[], - const Header &header, - RgbaChannels rgbaChannels = WRITE_RGBA, - int numThreads = globalThreadCount()); - - - //---------------------------------------------------- - // Constructor -- header is constructed by the caller, - // file is opened by the caller, destructor will not - // automatically close the file. - //---------------------------------------------------- - - RgbaOutputFile (OStream &os, - const Header &header, - RgbaChannels rgbaChannels = WRITE_RGBA, - int numThreads = globalThreadCount()); - - - //---------------------------------------------------------------- - // Constructor -- header data are explicitly specified as function - // call arguments (empty dataWindow means "same as displayWindow") - //---------------------------------------------------------------- - - RgbaOutputFile (const char name[], - const Imath::Box2i &displayWindow, - const Imath::Box2i &dataWindow = Imath::Box2i(), - RgbaChannels rgbaChannels = WRITE_RGBA, - float pixelAspectRatio = 1, - const Imath::V2f screenWindowCenter = Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression compression = PIZ_COMPRESSION, - int numThreads = globalThreadCount()); - - - //----------------------------------------------- - // Constructor -- like the previous one, but both - // the display window and the data window are - // Box2i (V2i (0, 0), V2i (width - 1, height -1)) - //----------------------------------------------- - - RgbaOutputFile (const char name[], - int width, - int height, - RgbaChannels rgbaChannels = WRITE_RGBA, - float pixelAspectRatio = 1, - const Imath::V2f screenWindowCenter = Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression compression = PIZ_COMPRESSION, - int numThreads = globalThreadCount()); - - - //----------- - // Destructor - //----------- - - virtual ~RgbaOutputFile (); - - - //------------------------------------------------ - // Define a frame buffer as the pixel data source: - // Pixel (x, y) is at address - // - // base + x * xStride + y * yStride - // - //------------------------------------------------ - - void setFrameBuffer (const Rgba *base, - size_t xStride, - size_t yStride); - - - //--------------------------------------------- - // Write pixel data (see class Imf::OutputFile) - //--------------------------------------------- - - void writePixels (int numScanLines = 1); - int currentScanLine () const; - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - const FrameBuffer & frameBuffer () const; - const Imath::Box2i & displayWindow () const; - const Imath::Box2i & dataWindow () const; - float pixelAspectRatio () const; - const Imath::V2f screenWindowCenter () const; - float screenWindowWidth () const; - LineOrder lineOrder () const; - Compression compression () const; - RgbaChannels channels () const; - - - // -------------------------------------------------------------------- - // Update the preview image (see Imf::OutputFile::updatePreviewImage()) - // -------------------------------------------------------------------- - - void updatePreviewImage (const PreviewRgba[]); - - - //----------------------------------------------------------------------- - // Rounding control for luminance/chroma images: - // - // If the output file contains luminance and chroma channels (WRITE_YC - // or WRITE_YCA), then the the significands of the luminance and - // chroma values are rounded to roundY and roundC bits respectively (see - // function half::round()). Rounding improves compression with minimal - // image degradation, usually much less than the degradation caused by - // chroma subsampling. By default, roundY is 7, and roundC is 5. - // - // If the output file contains RGB channels or a luminance channel, - // without chroma, then no rounding is performed. - //----------------------------------------------------------------------- - - void setYCRounding (unsigned int roundY, - unsigned int roundC); - - - //---------------------------------------------------- - // Break a scan line -- for testing and debugging only - // (see Imf::OutputFile::updatePreviewImage() - // - // Warning: Calling this function usually results in a - // broken image file. The file or parts of it may not - // be readable, or the file may contain bad data. - // - //---------------------------------------------------- - - void breakScanLine (int y, - int offset, - int length, - char c); - private: - - RgbaOutputFile (const RgbaOutputFile &); // not implemented - RgbaOutputFile & operator = (const RgbaOutputFile &); // not implemented - - class ToYca; - - OutputFile * _outputFile; - ToYca * _toYca; -}; - - -// -// RGBA input file -// - -class RgbaInputFile -{ - public: - - //------------------------------------------------------- - // Constructor -- opens the file with the specified name, - // destructor will automatically close the file. - //------------------------------------------------------- - - RgbaInputFile (const char name[], int numThreads = globalThreadCount()); - - - //----------------------------------------------------------- - // Constructor -- attaches the new RgbaInputFile object to a - // file that has already been opened by the caller. - // Destroying the RgbaInputFile object will not automatically - // close the file. - //----------------------------------------------------------- - - RgbaInputFile (IStream &is, int numThreads = globalThreadCount()); - - - //----------- - // Destructor - //----------- - - virtual ~RgbaInputFile (); - - //----------------------------------------------------- - // Define a frame buffer as the pixel data destination: - // Pixel (x, y) is at address - // - // base + x * xStride + y * yStride - // - //----------------------------------------------------- - - void setFrameBuffer (Rgba *base, - size_t xStride, - size_t yStride); - - - //------------------------------------------- - // Read pixel data (see class Imf::InputFile) - //------------------------------------------- - - void readPixels (int scanLine1, int scanLine2); - void readPixels (int scanLine); - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - const FrameBuffer & frameBuffer () const; - const Imath::Box2i & displayWindow () const; - const Imath::Box2i & dataWindow () const; - float pixelAspectRatio () const; - const Imath::V2f screenWindowCenter () const; - float screenWindowWidth () const; - LineOrder lineOrder () const; - Compression compression () const; - RgbaChannels channels () const; - const char * fileName () const; - bool isComplete () const; - - //---------------------------------- - // Access to the file format version - //---------------------------------- - - int version () const; - - private: - - RgbaInputFile (const RgbaInputFile &); // not implemented - RgbaInputFile & operator = (const RgbaInputFile &); // not implemented - - class FromYca; - - InputFile * _inputFile; - FromYca * _fromYca; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfRgbaYca.h b/3rdparty/include/OpenEXR/ImfRgbaYca.h deleted file mode 100644 index 4a2743ecc6..0000000000 --- a/3rdparty/include/OpenEXR/ImfRgbaYca.h +++ /dev/null @@ -1,248 +0,0 @@ -#ifndef INCLUDED_IMF_RGBA_YCA_H -#define INCLUDED_IMF_RGBA_YCA_H - -////////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucasfilm -// Entertainment Company Ltd. Portions contributed and copyright held by -// others as indicated. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above -// copyright notice, this list of conditions and the following -// disclaimer. -// -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided with -// the distribution. -// -// * Neither the name of Industrial Light & Magic nor the names of -// any other contributors to this software may be used to endorse or -// promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, -// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// -// Conversion between RGBA (red, green, blue alpha) -// and YCA (luminance, subsampled chroma, alpha) data: -// -// Luminance, Y, is computed as a weighted sum of R, G, and B: -// -// Y = yw.x * R + yw.y * G + yw.z * B -// -// Function computeYw() computes a set of RGB-to-Y weights, yw, -// from a set of primary and white point chromaticities. -// -// Chroma, C, consists of two components, RY and BY: -// -// RY = (R - Y) / Y -// BY = (B - Y) / Y -// -// For efficiency, the x and y subsampling rates for chroma are -// hardwired to 2, and the chroma subsampling and reconstruction -// filters are fixed 27-pixel wide windowed sinc functions. -// -// Starting with an image that has RGBA data for all pixels, -// -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// ... -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// RGBA RGBA RGBA RGBA ... RGBA RGBA -// -// function RGBAtoYCA() converts the pixels to YCA format: -// -// YCA YCA YCA YCA ... YCA YCA -// YCA YCA YCA YCA ... YCA YCA -// YCA YCA YCA YCA ... YCA YCA -// YCA YCA YCA YCA ... YCA YCA -// ... -// YCA YCA YCA YCA ... YCA YCA -// YCA YCA YCA YCA ... YCA YCA -// -// Next, decimateChomaHoriz() eliminates the chroma values from -// the odd-numbered pixels in every scan line: -// -// YCA YA YCA YA ... YCA YA -// YCA YA YCA YA ... YCA YA -// YCA YA YCA YA ... YCA YA -// YCA YA YCA YA ... YCA YA -// ... -// YCA YA YCA YA ... YCA YA -// YCA YA YCA YA ... YCA YA -// -// decimateChromaVert() eliminates all chroma values from the -// odd-numbered scan lines: -// -// YCA YA YCA YA ... YCA YA -// YA YA YA YA ... YA YA -// YCA YA YCA YA ... YCA YA -// YA YA YA YA ... YA YA -// ... -// YCA YA YCA YA ... YCA YA -// YA YA YA YA ... YA YA -// -// Finally, roundYCA() reduces the precision of the luminance -// and chroma values so that the pixel data shrink more when -// they are saved in a compressed file. -// -// The output of roundYCA() can be converted back to a set -// of RGBA pixel data that is visually very similar to the -// original RGBA image, by calling reconstructChromaHoriz(), -// reconstructChromaVert(), YCAtoRGBA(), and finally -// fixSaturation(). -// -//----------------------------------------------------------------------------- - -#include -#include - -namespace Imf { -namespace RgbaYca { - - -// -// Width of the chroma subsampling and reconstruction filters -// - -static const int N = 27; -static const int N2 = N / 2; - - -// -// Convert a set of primary chromaticities into a set of weighting -// factors for computing a pixels's luminance, Y, from R, G and B -// - -Imath::V3f computeYw (const Chromaticities &cr); - - -// -// Convert an array of n RGBA pixels, rgbaIn, to YCA (luminance/chroma/alpha): -// -// ycaOut[i].g = Y (rgbaIn[i]); -// ycaOut[i].r = RY (rgbaIn[i]); -// ycaOut[i].b = BY (rgbaIn[i]); -// ycaOut[i].a = aIsValid? rgbaIn[i].a: 1 -// -// yw is a set of RGB-to-Y weighting factors, as computed by computeYw(). -// - -void RGBAtoYCA (const Imath::V3f &yw, - int n, - bool aIsValid, - const Rgba rgbaIn[/*n*/], - Rgba ycaOut[/*n*/]); - -// -// Perform horizontal low-pass filtering and subsampling of -// the chroma channels of an array of n pixels. In order -// to avoid indexing off the ends of the input array during -// low-pass filtering, ycaIn must have N2 extra pixels at -// both ends. Before calling decimateChromaHoriz(), the extra -// pixels should be filled with copies of the first and last -// "real" input pixel. -// - -void decimateChromaHoriz (int n, - const Rgba ycaIn[/*n+N-1*/], - Rgba ycaOut[/*n*/]); - -// -// Perform vertical chroma channel low-pass filtering and subsampling. -// N scan lines of input pixels are combined into a single scan line -// of output pixels. -// - -void decimateChromaVert (int n, - const Rgba * const ycaIn[N], - Rgba ycaOut[/*n*/]); - -// -// Round the luminance and chroma channels of an array of YCA -// pixels that has already been filtered and subsampled. -// The signifcands of the pixels' luminance and chroma values -// are rounded to roundY and roundC bits respectively. -// - -void roundYCA (int n, - unsigned int roundY, - unsigned int roundC, - const Rgba ycaIn[/*n*/], - Rgba ycaOut[/*n*/]); - -// -// For a scan line that has valid chroma data only for every other pixel, -// reconstruct the missing chroma values. -// - -void reconstructChromaHoriz (int n, - const Rgba ycaIn[/*n+N-1*/], - Rgba ycaOut[/*n*/]); - -// -// For a scan line that has only luminance and no valid chroma data, -// reconstruct chroma from the surronding N scan lines. -// - -void reconstructChromaVert (int n, - const Rgba * const ycaIn[N], - Rgba ycaOut[/*n*/]); - -// -// Convert an array of n YCA (luminance/chroma/alpha) pixels to RGBA. -// This function is the inverse of RGBAtoYCA(). -// yw is a set of RGB-to-Y weighting factors, as computed by computeYw(). -// - -void YCAtoRGBA (const Imath::V3f &yw, - int n, - const Rgba ycaIn[/*n*/], - Rgba rgbaOut[/*n*/]); - -// -// Eliminate super-saturated pixels: -// -// Converting an image from RGBA to YCA, low-pass filtering chroma, -// and converting the result back to RGBA can produce pixels with -// super-saturated colors, where one or two of the RGB components -// become zero or negative. (The low-pass and reconstruction filters -// introduce some amount of ringing into the chroma components. -// This can lead to negative RGB values near high-contrast edges.) -// -// The fixSaturation() function finds super-saturated pixels and -// corrects them by desaturating their colors while maintaining -// their luminance. fixSaturation() takes three adjacent input -// scan lines, rgbaIn[0], rgbaIn[1], rgbaIn[2], adjusts the -// saturation of rgbaIn[1], and stores the result in rgbaOut. -// - -void fixSaturation (const Imath::V3f &yw, - int n, - const Rgba * const rgbaIn[3], - Rgba rgbaOut[/*n*/]); - -} // namespace RgbaYca -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfStandardAttributes.h b/3rdparty/include/OpenEXR/ImfStandardAttributes.h deleted file mode 100644 index 76e1f9b4bb..0000000000 --- a/3rdparty/include/OpenEXR/ImfStandardAttributes.h +++ /dev/null @@ -1,251 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_STANDARD_ATTRIBUTES_H -#define INCLUDED_IMF_STANDARD_ATTRIBUTES_H - -//----------------------------------------------------------------------------- -// -// Optional Standard Attributes -- these attributes are "optional" -// because not every image file header has them, but they define a -// "standard" way to represent commonly used data in the file header. -// -// For each attribute, with name "foo", and type "T", the following -// functions are automatically generated via macros: -// -// void addFoo (Header &header, const T &value); -// bool hasFoo (const Header &header); -// const TypedAttribute & fooAttribute (const Header &header); -// TypedAttribute & fooAttribute (Header &header); -// const T & foo (const Header &Header); -// T & foo (Header &Header); -// -//----------------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - - -#define IMF_STD_ATTRIBUTE_DEF(name,suffix,type) \ - \ - void add##suffix (Header &header, const type &v); \ - bool has##suffix (const Header &header); \ - const TypedAttribute & name##Attribute (const Header &header); \ - TypedAttribute & name##Attribute (Header &header); \ - const type & name (const Header &header); \ - type & name (Header &header); - - -namespace Imf { - -// -// chromaticities -- for RGB images, specifies the CIE (x,y) -// chromaticities of the primaries and the white point -// - -IMF_STD_ATTRIBUTE_DEF (chromaticities, Chromaticities, Chromaticities) - - -// -// whiteLuminance -- for RGB images, defines the luminance, in Nits -// (candelas per square meter) of the RGB value (1.0, 1.0, 1.0). -// -// If the chromaticities and the whiteLuminance of an RGB image are -// known, then it is possible to convert the image's pixels from RGB -// to CIE XYZ tristimulus values (see function RGBtoXYZ() in header -// file ImfChromaticities.h). -// -// - -IMF_STD_ATTRIBUTE_DEF (whiteLuminance, WhiteLuminance, float) - - -// -// xDensity -- horizontal output density, in pixels per inch. -// The image's vertical output density is xDensity * pixelAspectRatio. -// - -IMF_STD_ATTRIBUTE_DEF (xDensity, XDensity, float) - - -// -// owner -- name of the owner of the image -// - -IMF_STD_ATTRIBUTE_DEF (owner, Owner, std::string) - - -// -// comments -- additional image information in human-readable -// form, for example a verbal description of the image -// - -IMF_STD_ATTRIBUTE_DEF (comments, Comments, std::string) - - -// -// capDate -- the date when the image was created or captured, -// in local time, and formatted as -// -// YYYY:MM:DD hh:mm:ss -// -// where YYYY is the year (4 digits, e.g. 2003), MM is the month -// (2 digits, 01, 02, ... 12), DD is the day of the month (2 digits, -// 01, 02, ... 31), hh is the hour (2 digits, 00, 01, ... 23), mm -// is the minute, and ss is the second (2 digits, 00, 01, ... 59). -// -// - -IMF_STD_ATTRIBUTE_DEF (capDate, CapDate, std::string) - - -// -// utcOffset -- offset of local time at capDate from -// Universal Coordinated Time (UTC), in seconds: -// -// UTC == local time + utcOffset -// - -IMF_STD_ATTRIBUTE_DEF (utcOffset, utcOffset, float) - - -// -// longitude, latitude, altitude -- for images of real objects, the -// location where the image was recorded. Longitude and latitude are -// in degrees east of Greenwich and north of the equator. Altitude -// is in meters above sea level. For example, Kathmandu, Nepal is -// at longitude 85.317, latitude 27.717, altitude 1305. -// - -IMF_STD_ATTRIBUTE_DEF (longitude, Longitude, float) -IMF_STD_ATTRIBUTE_DEF (latitude, Latitude, float) -IMF_STD_ATTRIBUTE_DEF (altitude, Altitude, float) - - -// -// focus -- the camera's focus distance, in meters -// - -IMF_STD_ATTRIBUTE_DEF (focus, Focus, float) - - -// -// exposure -- exposure time, in seconds -// - -IMF_STD_ATTRIBUTE_DEF (expTime, ExpTime, float) - - -// -// aperture -- the camera's lens aperture, in f-stops (focal length -// of the lens divided by the diameter of the iris opening) -// - -IMF_STD_ATTRIBUTE_DEF (aperture, Aperture, float) - - -// -// isoSpeed -- the ISO speed of the film or image sensor -// that was used to record the image -// - -IMF_STD_ATTRIBUTE_DEF (isoSpeed, IsoSpeed, float) - - -// -// envmap -- if this attribute is present, the image represents -// an environment map. The attribute's value defines how 3D -// directions are mapped to 2D pixel locations. For details -// see header file ImfEnvmap.h -// - -IMF_STD_ATTRIBUTE_DEF (envmap, Envmap, Envmap) - - -// -// keyCode -- for motion picture film frames. Identifies film -// manufacturer, film type, film roll and frame position within -// the roll. -// - -IMF_STD_ATTRIBUTE_DEF (keyCode, KeyCode, KeyCode) - - -// -// timeCode -- time and control code -// - -IMF_STD_ATTRIBUTE_DEF (timeCode, TimeCode, TimeCode) - - -// -// wrapmodes -- determines how texture map images are extrapolated. -// If an OpenEXR file is used as a texture map for 3D rendering, -// texture coordinates (0.0, 0.0) and (1.0, 1.0) correspond to -// the upper left and lower right corners of the data window. -// If the image is mapped onto a surface with texture coordinates -// outside the zero-to-one range, then the image must be extrapolated. -// This attribute tells the renderer how to do this extrapolation. -// The attribute contains either a pair of comma-separated keywords, -// to specify separate extrapolation modes for the horizontal and -// vertical directions; or a single keyword, to specify extrapolation -// in both directions (e.g. "clamp,periodic" or "clamp"). Extra white -// space surrounding the keywords is allowed, but should be ignored -// by the renderer ("clamp, black " is equivalent to "clamp,black"). -// The keywords listed below are predefined; some renderers may support -// additional extrapolation modes: -// -// black pixels outside the zero-to-one range are black -// -// clamp texture coordinates less than 0.0 and greater -// than 1.0 are clamped to 0.0 and 1.0 respectively -// -// periodic the texture image repeats periodically -// -// mirror the texture image repeats periodically, but -// every other instance is mirrored -// - -IMF_STD_ATTRIBUTE_DEF (wrapmodes, Wrapmodes, std::string) - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfStdIO.h b/3rdparty/include/OpenEXR/ImfStdIO.h deleted file mode 100644 index 0137b45a16..0000000000 --- a/3rdparty/include/OpenEXR/ImfStdIO.h +++ /dev/null @@ -1,156 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_STD_IO_H -#define INCLUDED_IMF_STD_IO_H - -//----------------------------------------------------------------------------- -// -// Low-level file input and output for OpenEXR -// based on C++ standard iostreams. -// -//----------------------------------------------------------------------------- - -#include -#include -#include - -namespace Imf { - -//------------------------------------------- -// class StdIFStream -- an implementation of -// class IStream based on class std::ifstream -//------------------------------------------- - -class StdIFStream: public IStream -{ - public: - - //------------------------------------------------------- - // A constructor that opens the file with the given name. - // The destructor will close the file. - //------------------------------------------------------- - - StdIFStream (const char fileName[]); - - - //--------------------------------------------------------- - // A constructor that uses a std::ifstream that has already - // been opened by the caller. The StdIFStream's destructor - // will not close the std::ifstream. - //--------------------------------------------------------- - - StdIFStream (std::ifstream &is, const char fileName[]); - - - virtual ~StdIFStream (); - - virtual bool read (char c[/*n*/], int n); - virtual Int64 tellg (); - virtual void seekg (Int64 pos); - virtual void clear (); - - private: - - std::ifstream * _is; - bool _deleteStream; -}; - - -//------------------------------------------- -// class StdOFStream -- an implementation of -// class OStream based on class std::ofstream -//------------------------------------------- - -class StdOFStream: public OStream -{ - public: - - //------------------------------------------------------- - // A constructor that opens the file with the given name. - // The destructor will close the file. - //------------------------------------------------------- - - StdOFStream (const char fileName[]); - - - //--------------------------------------------------------- - // A constructor that uses a std::ofstream that has already - // been opened by the caller. The StdOFStream's destructor - // will not close the std::ofstream. - //--------------------------------------------------------- - - StdOFStream (std::ofstream &os, const char fileName[]); - - - virtual ~StdOFStream (); - - virtual void write (const char c[/*n*/], int n); - virtual Int64 tellp (); - virtual void seekp (Int64 pos); - - private: - - std::ofstream * _os; - bool _deleteStream; -}; - - -//------------------------------------------------ -// class StdOSStream -- an implementation of class -// OStream, based on class std::ostringstream -//------------------------------------------------ - -class StdOSStream: public OStream -{ - public: - - StdOSStream (); - - virtual void write (const char c[/*n*/], int n); - virtual Int64 tellp (); - virtual void seekp (Int64 pos); - - std::string str () const {return _os.str();} - - private: - - std::ostringstream _os; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfStringAttribute.h b/3rdparty/include/OpenEXR/ImfStringAttribute.h deleted file mode 100644 index 3ce76ebb34..0000000000 --- a/3rdparty/include/OpenEXR/ImfStringAttribute.h +++ /dev/null @@ -1,66 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_STRING_ATTRIBUTE_H -#define INCLUDED_IMF_STRING_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class StringAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute StringAttribute; -template <> const char *StringAttribute::staticTypeName (); -template <> void StringAttribute::writeValueTo (OStream &, int) const; -template <> void StringAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTestFile.h b/3rdparty/include/OpenEXR/ImfTestFile.h deleted file mode 100644 index d81c61a782..0000000000 --- a/3rdparty/include/OpenEXR/ImfTestFile.h +++ /dev/null @@ -1,63 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TEST_FILE_H -#define INCLUDED_IMF_TEST_FILE_H - -//----------------------------------------------------------------------------- -// -// Utility routines to test quickly if a given -// file is an OpenEXR file, and whether the -// file is scanline-based or tiled. -// -//----------------------------------------------------------------------------- - - -namespace Imf { - -class IStream; - - -bool isOpenExrFile (const char fileName[], bool &isTiled); -bool isOpenExrFile (const char fileName[]); -bool isTiledOpenExrFile (const char fileName[]); -bool isOpenExrFile (IStream &is, bool &isTiled); -bool isOpenExrFile (IStream &is); -bool isTiledOpenExrFile (IStream &is); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfThreading.h b/3rdparty/include/OpenEXR/ImfThreading.h deleted file mode 100644 index 50fe35e6ba..0000000000 --- a/3rdparty/include/OpenEXR/ImfThreading.h +++ /dev/null @@ -1,92 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2005, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -#ifndef INCLUDED_IMF_THREADING_H -#define INCLUDED_IMF_THREADING_H - -//----------------------------------------------------------------------------- -// -// Threading support for the IlmImf library -// -// The IlmImf library uses threads to perform reading and writing -// of OpenEXR files in parallel. The thread that calls the library -// always performs the actual file IO (this is usually the main -// application thread) whereas a several worker threads perform -// data compression and decompression. The number of worker -// threads can be any non-negative value (a value of zero reverts -// to single-threaded operation). As long as there is at least -// one worker thread, file IO and compression can potentially be -// done concurrently through pinelining. If there are two or more -// worker threads, then pipelining as well as concurrent compression -// of multiple blocks can be performed. -// -// Threading in the Imf library is controllable at two granularities: -// -// * The functions in this file query and control the total number -// of worker threads, which will be created globally for the whole -// library. Regardless of how many input or output files are -// opened simultaneously, the library will use at most this number -// of worker threads to perform all work. The default number of -// global worker threads is zero (i.e. single-threaded operation; -// everything happens in the thread that calls the library). -// -// * Furthermore, it is possible to set the number of threads that -// each input or output file should keep busy. This number can -// be explicitly set for each file. The default behavior is for -// each file to try to occupy all worker threads in the library's -// thread pool. -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -//----------------------------------------------------------------------------- -// Return the number of Imf-global worker threads used for parallel -// compression and decompression of OpenEXR files. -//----------------------------------------------------------------------------- - -int globalThreadCount (); - - -//----------------------------------------------------------------------------- -// Change the number of Imf-global worker threads -//----------------------------------------------------------------------------- - -void setGlobalThreadCount (int count); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTileDescription.h b/3rdparty/include/OpenEXR/ImfTileDescription.h deleted file mode 100644 index 0e5989057b..0000000000 --- a/3rdparty/include/OpenEXR/ImfTileDescription.h +++ /dev/null @@ -1,102 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TILE_DESCRIPTION_H -#define INCLUDED_IMF_TILE_DESCRIPTION_H - -//----------------------------------------------------------------------------- -// -// class TileDescription and enum LevelMode -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -enum LevelMode -{ - ONE_LEVEL = 0, - MIPMAP_LEVELS = 1, - RIPMAP_LEVELS = 2, - - NUM_LEVELMODES // number of different level modes -}; - - -enum LevelRoundingMode -{ - ROUND_DOWN = 0, - ROUND_UP = 1, - - NUM_ROUNDINGMODES // number of different rounding modes -}; - - -class TileDescription -{ - public: - - unsigned int xSize; // size of a tile in the x dimension - unsigned int ySize; // size of a tile in the y dimension - LevelMode mode; - LevelRoundingMode roundingMode; - - TileDescription (unsigned int xs = 32, - unsigned int ys = 32, - LevelMode m = ONE_LEVEL, - LevelRoundingMode r = ROUND_DOWN) - : - xSize (xs), - ySize (ys), - mode (m), - roundingMode (r) - { - // empty - } - - bool - operator == (const TileDescription &other) const - { - return xSize == other.xSize && - ySize == other.ySize && - mode == other.mode && - roundingMode == other.roundingMode; - } -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTileDescriptionAttribute.h b/3rdparty/include/OpenEXR/ImfTileDescriptionAttribute.h deleted file mode 100644 index 8a7125a783..0000000000 --- a/3rdparty/include/OpenEXR/ImfTileDescriptionAttribute.h +++ /dev/null @@ -1,73 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TILE_DESCRIPTION_ATTRIBUTE_H -#define INCLUDED_IMF_TILE_DESCRIPTION_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class TileDescriptionAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - -namespace Imf { - - -typedef TypedAttribute TileDescriptionAttribute; - -template <> -const char * -TileDescriptionAttribute::staticTypeName (); - -template <> -void -TileDescriptionAttribute::writeValueTo (OStream &, int) const; - -template <> -void -TileDescriptionAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTiledInputFile.h b/3rdparty/include/OpenEXR/ImfTiledInputFile.h deleted file mode 100644 index 13eb84f6f4..0000000000 --- a/3rdparty/include/OpenEXR/ImfTiledInputFile.h +++ /dev/null @@ -1,381 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TILED_INPUT_FILE_H -#define INCLUDED_IMF_TILED_INPUT_FILE_H - -//----------------------------------------------------------------------------- -// -// class TiledInputFile -// -//----------------------------------------------------------------------------- - -#include -#include -#include "ImathBox.h" -#include -#include - -namespace Imf { - - -class TiledInputFile -{ - public: - - //-------------------------------------------------------------------- - // A constructor that opens the file with the specified name, and - // reads the file header. The constructor throws an Iex::ArgExc - // exception if the file is not tiled. - // The numThreads parameter specifies how many worker threads this - // file will try to keep busy when decompressing individual tiles. - // Destroying TiledInputFile objects constructed with this constructor - // automatically closes the corresponding files. - //-------------------------------------------------------------------- - - TiledInputFile (const char fileName[], - int numThreads = globalThreadCount ()); - - - // ---------------------------------------------------------- - // A constructor that attaches the new TiledInputFile object - // to a file that has already been opened. - // Destroying TiledInputFile objects constructed with this - // constructor does not automatically close the corresponding - // files. - // ---------------------------------------------------------- - - TiledInputFile (IStream &is, int numThreads = globalThreadCount ()); - - - //----------- - // Destructor - //----------- - - virtual ~TiledInputFile (); - - - //------------------------ - // Access to the file name - //------------------------ - - const char * fileName () const; - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - - - //---------------------------------- - // Access to the file format version - //---------------------------------- - - int version () const; - - - //----------------------------------------------------------- - // Set the current frame buffer -- copies the FrameBuffer - // object into the TiledInputFile object. - // - // The current frame buffer is the destination for the pixel - // data read from the file. The current frame buffer must be - // set at least once before readTile() is called. - // The current frame buffer can be changed after each call - // to readTile(). - //----------------------------------------------------------- - - void setFrameBuffer (const FrameBuffer &frameBuffer); - - - //----------------------------------- - // Access to the current frame buffer - //----------------------------------- - - const FrameBuffer & frameBuffer () const; - - - //------------------------------------------------------------ - // Check if the file is complete: - // - // isComplete() returns true if all pixels in the data window - // (in all levels) are present in the input file, or false if - // any pixels are missing. (Another program may still be busy - // writing the file, or file writing may have been aborted - // prematurely.) - //------------------------------------------------------------ - - bool isComplete () const; - - - //-------------------------------------------------- - // Utility functions: - //-------------------------------------------------- - - //--------------------------------------------------------- - // Multiresolution mode and tile size: - // The following functions return the xSize, ySize and mode - // fields of the file header's TileDescriptionAttribute. - //--------------------------------------------------------- - - unsigned int tileXSize () const; - unsigned int tileYSize () const; - LevelMode levelMode () const; - LevelRoundingMode levelRoundingMode () const; - - - //-------------------------------------------------------------------- - // Number of levels: - // - // numXLevels() returns the file's number of levels in x direction. - // - // if levelMode() == ONE_LEVEL: - // return value is: 1 - // - // if levelMode() == MIPMAP_LEVELS: - // return value is: rfunc (log (max (w, h)) / log (2)) + 1 - // - // if levelMode() == RIPMAP_LEVELS: - // return value is: rfunc (log (w) / log (2)) + 1 - // - // where - // w is the width of the image's data window, max.x - min.x + 1, - // y is the height of the image's data window, max.y - min.y + 1, - // and rfunc(x) is either floor(x), or ceil(x), depending on - // whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP. - // - // numYLevels() returns the file's number of levels in y direction. - // - // if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS: - // return value is the same as for numXLevels() - // - // if levelMode() == RIPMAP_LEVELS: - // return value is: rfunc (log (h) / log (2)) + 1 - // - // - // numLevels() is a convenience function for use with - // MIPMAP_LEVELS files. - // - // if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS: - // return value is the same as for numXLevels() - // - // if levelMode() == RIPMAP_LEVELS: - // an Iex::LogicExc exception is thrown - // - // isValidLevel(lx, ly) returns true if the file contains - // a level with level number (lx, ly), false if not. - // - //-------------------------------------------------------------------- - - int numLevels () const; - int numXLevels () const; - int numYLevels () const; - bool isValidLevel (int lx, int ly) const; - - - //---------------------------------------------------------- - // Dimensions of a level: - // - // levelWidth(lx) returns the width of a level with level - // number (lx, *), where * is any number. - // - // return value is: - // max (1, rfunc (w / pow (2, lx))) - // - // - // levelHeight(ly) returns the height of a level with level - // number (*, ly), where * is any number. - // - // return value is: - // max (1, rfunc (h / pow (2, ly))) - // - //---------------------------------------------------------- - - int levelWidth (int lx) const; - int levelHeight (int ly) const; - - - //-------------------------------------------------------------- - // Number of tiles: - // - // numXTiles(lx) returns the number of tiles in x direction - // that cover a level with level number (lx, *), where * is - // any number. - // - // return value is: - // (levelWidth(lx) + tileXSize() - 1) / tileXSize() - // - // - // numYTiles(ly) returns the number of tiles in y direction - // that cover a level with level number (*, ly), where * is - // any number. - // - // return value is: - // (levelHeight(ly) + tileXSize() - 1) / tileXSize() - // - //-------------------------------------------------------------- - - int numXTiles (int lx = 0) const; - int numYTiles (int ly = 0) const; - - - //--------------------------------------------------------------- - // Level pixel ranges: - // - // dataWindowForLevel(lx, ly) returns a 2-dimensional region of - // valid pixel coordinates for a level with level number (lx, ly) - // - // return value is a Box2i with min value: - // (dataWindow.min.x, dataWindow.min.y) - // - // and max value: - // (dataWindow.min.x + levelWidth(lx) - 1, - // dataWindow.min.y + levelHeight(ly) - 1) - // - // dataWindowForLevel(level) is a convenience function used - // for ONE_LEVEL and MIPMAP_LEVELS files. It returns - // dataWindowForLevel(level, level). - // - //--------------------------------------------------------------- - - Imath::Box2i dataWindowForLevel (int l = 0) const; - Imath::Box2i dataWindowForLevel (int lx, int ly) const; - - - //------------------------------------------------------------------- - // Tile pixel ranges: - // - // dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional - // region of valid pixel coordinates for a tile with tile coordinates - // (dx,dy) and level number (lx, ly). - // - // return value is a Box2i with min value: - // (dataWindow.min.x + dx * tileXSize(), - // dataWindow.min.y + dy * tileYSize()) - // - // and max value: - // (dataWindow.min.x + (dx + 1) * tileXSize() - 1, - // dataWindow.min.y + (dy + 1) * tileYSize() - 1) - // - // dataWindowForTile(dx, dy, level) is a convenience function - // used for ONE_LEVEL and MIPMAP_LEVELS files. It returns - // dataWindowForTile(dx, dy, level, level). - // - //------------------------------------------------------------------- - - Imath::Box2i dataWindowForTile (int dx, int dy, int l = 0) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int lx, int ly) const; - - //------------------------------------------------------------ - // Read pixel data: - // - // readTile(dx, dy, lx, ly) reads the tile with tile - // coordinates (dx, dy), and level number (lx, ly), - // and stores it in the current frame buffer. - // - // dx must lie in the interval [0, numXTiles(lx)-1] - // dy must lie in the interval [0, numYTiles(ly)-1] - // - // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] - // - // readTile(dx, dy, level) is a convenience function used - // for ONE_LEVEL and MIPMAP_LEVELS files. It calls - // readTile(dx, dy, level, level). - // - // The two readTiles(dx1, dx2, dy1, dy2, ...) functions allow - // reading multiple tiles at once. If multi-threading is used - // the multiple tiles are read concurrently. - // - // Pixels that are outside the pixel coordinate range for the - // tile's level, are never accessed by readTile(). - // - // Attempting to access a tile that is not present in the file - // throws an InputExc exception. - // - //------------------------------------------------------------ - - void readTile (int dx, int dy, int l = 0); - void readTile (int dx, int dy, int lx, int ly); - - void readTiles (int dx1, int dx2, int dy1, int dy2, - int lx, int ly); - - void readTiles (int dx1, int dx2, int dy1, int dy2, - int l = 0); - - - //-------------------------------------------------- - // Read a tile of raw pixel data from the file, - // without uncompressing it (this function is - // used to implement TiledOutputFile::copyPixels()). - //-------------------------------------------------- - - void rawTileData (int &dx, int &dy, - int &lx, int &ly, - const char *&pixelData, - int &pixelDataSize); - - struct Data; - - private: - - friend class InputFile; - - TiledInputFile (const TiledInputFile &); // not implemented - TiledInputFile & operator = (const TiledInputFile &); // not implemented - - TiledInputFile (const Header &header, IStream *is, int version, - int numThreads); - - void initialize (); - - bool isValidTile (int dx, int dy, - int lx, int ly) const; - - size_t bytesPerLineForTile (int dx, int dy, - int lx, int ly) const; - - Data * _data; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTiledOutputFile.h b/3rdparty/include/OpenEXR/ImfTiledOutputFile.h deleted file mode 100644 index 3b4f3ffbec..0000000000 --- a/3rdparty/include/OpenEXR/ImfTiledOutputFile.h +++ /dev/null @@ -1,475 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TILED_OUTPUT_FILE_H -#define INCLUDED_IMF_TILED_OUTPUT_FILE_H - -//----------------------------------------------------------------------------- -// -// class TiledOutputFile -// -//----------------------------------------------------------------------------- - -#include -#include -#include "ImathBox.h" -#include -#include - -namespace Imf { - -class TiledInputFile; -class InputFile; -struct PreviewRgba; - - -class TiledOutputFile -{ - public: - - //------------------------------------------------------------------- - // A constructor that opens the file with the specified name, and - // writes the file header. The file header is also copied into the - // TiledOutputFile object, and can later be accessed via the header() - // method. - // - // Destroying TiledOutputFile constructed with this constructor - // automatically closes the corresponding files. - // - // The header must contain a TileDescriptionAttribute called "tiles". - // - // The x and y subsampling factors for all image channels must be 1; - // subsampling is not supported. - // - // Tiles can be written to the file in arbitrary order. The line - // order attribute can be used to cause the tiles to be sorted in - // the file. When the file is read later, reading the tiles in the - // same order as they are in the file tends to be significantly - // faster than reading the tiles in random order (see writeTile, - // below). - //------------------------------------------------------------------- - - TiledOutputFile (const char fileName[], - const Header &header, - int numThreads = globalThreadCount ()); - - - // ---------------------------------------------------------------- - // A constructor that attaches the new TiledOutputFile object to - // a file that has already been opened. Destroying TiledOutputFile - // objects constructed with this constructor does not automatically - // close the corresponding files. - // ---------------------------------------------------------------- - - TiledOutputFile (OStream &os, - const Header &header, - int numThreads = globalThreadCount ()); - - - //----------------------------------------------------- - // Destructor - // - // Destroying a TiledOutputFile object before all tiles - // have been written results in an incomplete file. - //----------------------------------------------------- - - virtual ~TiledOutputFile (); - - - //------------------------ - // Access to the file name - //------------------------ - - const char * fileName () const; - - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - - - //------------------------------------------------------- - // Set the current frame buffer -- copies the FrameBuffer - // object into the TiledOutputFile object. - // - // The current frame buffer is the source of the pixel - // data written to the file. The current frame buffer - // must be set at least once before writeTile() is - // called. The current frame buffer can be changed - // after each call to writeTile(). - //------------------------------------------------------- - - void setFrameBuffer (const FrameBuffer &frameBuffer); - - - //----------------------------------- - // Access to the current frame buffer - //----------------------------------- - - const FrameBuffer & frameBuffer () const; - - - //------------------- - // Utility functions: - //------------------- - - //--------------------------------------------------------- - // Multiresolution mode and tile size: - // The following functions return the xSize, ySize and mode - // fields of the file header's TileDescriptionAttribute. - //--------------------------------------------------------- - - unsigned int tileXSize () const; - unsigned int tileYSize () const; - LevelMode levelMode () const; - LevelRoundingMode levelRoundingMode () const; - - - //-------------------------------------------------------------------- - // Number of levels: - // - // numXLevels() returns the file's number of levels in x direction. - // - // if levelMode() == ONE_LEVEL: - // return value is: 1 - // - // if levelMode() == MIPMAP_LEVELS: - // return value is: rfunc (log (max (w, h)) / log (2)) + 1 - // - // if levelMode() == RIPMAP_LEVELS: - // return value is: rfunc (log (w) / log (2)) + 1 - // - // where - // w is the width of the image's data window, max.x - min.x + 1, - // y is the height of the image's data window, max.y - min.y + 1, - // and rfunc(x) is either floor(x), or ceil(x), depending on - // whether levelRoundingMode() returns ROUND_DOWN or ROUND_UP. - // - // numYLevels() returns the file's number of levels in y direction. - // - // if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS: - // return value is the same as for numXLevels() - // - // if levelMode() == RIPMAP_LEVELS: - // return value is: rfunc (log (h) / log (2)) + 1 - // - // - // numLevels() is a convenience function for use with MIPMAP_LEVELS - // files. - // - // if levelMode() == ONE_LEVEL or levelMode() == MIPMAP_LEVELS: - // return value is the same as for numXLevels() - // - // if levelMode() == RIPMAP_LEVELS: - // an Iex::LogicExc exception is thrown - // - // isValidLevel(lx, ly) returns true if the file contains - // a level with level number (lx, ly), false if not. - // - //-------------------------------------------------------------------- - - int numLevels () const; - int numXLevels () const; - int numYLevels () const; - bool isValidLevel (int lx, int ly) const; - - - //--------------------------------------------------------- - // Dimensions of a level: - // - // levelWidth(lx) returns the width of a level with level - // number (lx, *), where * is any number. - // - // return value is: - // max (1, rfunc (w / pow (2, lx))) - // - // - // levelHeight(ly) returns the height of a level with level - // number (*, ly), where * is any number. - // - // return value is: - // max (1, rfunc (h / pow (2, ly))) - // - //--------------------------------------------------------- - - int levelWidth (int lx) const; - int levelHeight (int ly) const; - - - //---------------------------------------------------------- - // Number of tiles: - // - // numXTiles(lx) returns the number of tiles in x direction - // that cover a level with level number (lx, *), where * is - // any number. - // - // return value is: - // (levelWidth(lx) + tileXSize() - 1) / tileXSize() - // - // - // numYTiles(ly) returns the number of tiles in y direction - // that cover a level with level number (*, ly), where * is - // any number. - // - // return value is: - // (levelHeight(ly) + tileXSize() - 1) / tileXSize() - // - //---------------------------------------------------------- - - int numXTiles (int lx = 0) const; - int numYTiles (int ly = 0) const; - - - //--------------------------------------------------------- - // Level pixel ranges: - // - // dataWindowForLevel(lx, ly) returns a 2-dimensional - // region of valid pixel coordinates for a level with - // level number (lx, ly) - // - // return value is a Box2i with min value: - // (dataWindow.min.x, dataWindow.min.y) - // - // and max value: - // (dataWindow.min.x + levelWidth(lx) - 1, - // dataWindow.min.y + levelHeight(ly) - 1) - // - // dataWindowForLevel(level) is a convenience function used - // for ONE_LEVEL and MIPMAP_LEVELS files. It returns - // dataWindowForLevel(level, level). - // - //--------------------------------------------------------- - - Imath::Box2i dataWindowForLevel (int l = 0) const; - Imath::Box2i dataWindowForLevel (int lx, int ly) const; - - - //------------------------------------------------------------------- - // Tile pixel ranges: - // - // dataWindowForTile(dx, dy, lx, ly) returns a 2-dimensional - // region of valid pixel coordinates for a tile with tile coordinates - // (dx,dy) and level number (lx, ly). - // - // return value is a Box2i with min value: - // (dataWindow.min.x + dx * tileXSize(), - // dataWindow.min.y + dy * tileYSize()) - // - // and max value: - // (dataWindow.min.x + (dx + 1) * tileXSize() - 1, - // dataWindow.min.y + (dy + 1) * tileYSize() - 1) - // - // dataWindowForTile(dx, dy, level) is a convenience function - // used for ONE_LEVEL and MIPMAP_LEVELS files. It returns - // dataWindowForTile(dx, dy, level, level). - // - //------------------------------------------------------------------- - - Imath::Box2i dataWindowForTile (int dx, int dy, - int l = 0) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int lx, int ly) const; - - //------------------------------------------------------------------ - // Write pixel data: - // - // writeTile(dx, dy, lx, ly) writes the tile with tile - // coordinates (dx, dy), and level number (lx, ly) to - // the file. - // - // dx must lie in the interval [0, numXTiles(lx) - 1] - // dy must lie in the interval [0, numYTiles(ly) - 1] - // - // lx must lie in the interval [0, numXLevels() - 1] - // ly must lie in the inverval [0, numYLevels() - 1] - // - // writeTile(dx, dy, level) is a convenience function - // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls - // writeTile(dx, dy, level, level). - // - // The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow - // writing multiple tiles at once. If multi-threading is used - // multiple tiles are written concurrently. The tile coordinates, - // dx1, dx2 and dy1, dy2, specify inclusive ranges of tile - // coordinates. It is valid for dx1 < dx2 or dy1 < dy2; the - // tiles are always written in the order specified by the line - // order attribute. Hence, it is not possible to specify an - // "invalid" or empty tile range. - // - // Pixels that are outside the pixel coordinate range for the tile's - // level, are never accessed by writeTile(). - // - // Each tile in the file must be written exactly once. - // - // The file's line order attribute determines the order of the tiles - // in the file: - // - // INCREASING_Y In the file, the tiles for each level are stored - // in a contiguous block. The levels are ordered - // like this: - // - // (0, 0) (1, 0) ... (nx-1, 0) - // (0, 1) (1, 1) ... (nx-1, 1) - // ... - // (0,ny-1) (1,ny-1) ... (nx-1,ny-1) - // - // where nx = numXLevels(), and ny = numYLevels(). - // In an individual level, (lx, ly), the tiles - // are stored in the following order: - // - // (0, 0) (1, 0) ... (tx-1, 0) - // (0, 1) (1, 1) ... (tx-1, 1) - // ... - // (0,ty-1) (1,ty-1) ... (tx-1,ty-1) - // - // where tx = numXTiles(lx), - // and ty = numYTiles(ly). - // - // DECREASING_Y As for INCREASING_Y, the tiles for each level - // are stored in a contiguous block. The levels - // are ordered the same way as for INCREASING_Y, - // but within an individual level, the tiles - // are stored in this order: - // - // (0,ty-1) (1,ty-1) ... (tx-1,ty-1) - // ... - // (0, 1) (1, 1) ... (tx-1, 1) - // (0, 0) (1, 0) ... (tx-1, 0) - // - // - // RANDOM_Y The order of the calls to writeTile() determines - // the order of the tiles in the file. - // - //------------------------------------------------------------------ - - void writeTile (int dx, int dy, int l = 0); - void writeTile (int dx, int dy, int lx, int ly); - - void writeTiles (int dx1, int dx2, int dy1, int dy2, - int lx, int ly); - - void writeTiles (int dx1, int dx2, int dy1, int dy2, - int l = 0); - - - //------------------------------------------------------------------ - // Shortcut to copy all pixels from a TiledInputFile into this file, - // without uncompressing and then recompressing the pixel data. - // This file's header must be compatible with the TiledInputFile's - // header: The two header's "dataWindow", "compression", - // "lineOrder", "channels", and "tiles" attributes must be the same. - //------------------------------------------------------------------ - - void copyPixels (TiledInputFile &in); - - - //------------------------------------------------------------------ - // Shortcut to copy all pixels from an InputFile into this file, - // without uncompressing and then recompressing the pixel data. - // This file's header must be compatible with the InputFile's - // header: The two header's "dataWindow", "compression", - // "lineOrder", "channels", and "tiles" attributes must be the same. - // - // To use this function, the InputFile must be tiled. - //------------------------------------------------------------------ - - void copyPixels (InputFile &in); - - - //-------------------------------------------------------------- - // Updating the preview image: - // - // updatePreviewImage() supplies a new set of pixels for the - // preview image attribute in the file's header. If the header - // does not contain a preview image, updatePreviewImage() throws - // an Iex::LogicExc. - // - // Note: updatePreviewImage() is necessary because images are - // often stored in a file incrementally, a few tiles at a time, - // while the image is being generated. Since the preview image - // is an attribute in the file's header, it gets stored in the - // file as soon as the file is opened, but we may not know what - // the preview image should look like until we have written the - // last tile of the main image. - // - //-------------------------------------------------------------- - - void updatePreviewImage (const PreviewRgba newPixels[]); - - - //------------------------------------------------------------- - // Break a tile -- for testing and debugging only: - // - // breakTile(dx,dy,lx,ly,p,n,c) introduces an error into the - // output file by writing n copies of character c, starting - // p bytes from the beginning of the tile with tile coordinates - // (dx, dy) and level number (lx, ly). - // - // Warning: Calling this function usually results in a broken - // image file. The file or parts of it may not be readable, - // or the file may contain bad data. - // - //------------------------------------------------------------- - - void breakTile (int dx, int dy, - int lx, int ly, - int offset, - int length, - char c); - struct Data; - - private: - - TiledOutputFile (const TiledOutputFile &); // not implemented - TiledOutputFile & operator = (const TiledOutputFile &); // not implemented - - void initialize (const Header &header); - - bool isValidTile (int dx, int dy, - int lx, int ly) const; - - size_t bytesPerLineForTile (int dx, int dy, - int lx, int ly) const; - - Data * _data; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTiledRgbaFile.h b/3rdparty/include/OpenEXR/ImfTiledRgbaFile.h deleted file mode 100644 index 4d7dd75809..0000000000 --- a/3rdparty/include/OpenEXR/ImfTiledRgbaFile.h +++ /dev/null @@ -1,453 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TILED_RGBA_FILE_H -#define INCLUDED_IMF_TILED_RGBA_FILE_H - -//----------------------------------------------------------------------------- -// -// Simplified RGBA image I/O for tiled files -// -// class TiledRgbaOutputFile -// class TiledRgbaInputFile -// -//----------------------------------------------------------------------------- - -#include -#include -#include "ImathVec.h" -#include "ImathBox.h" -#include "half.h" -#include -#include -#include - -namespace Imf { - -class TiledOutputFile; -class TiledInputFile; -struct PreviewRgba; - - -// -// Tiled RGBA output file. -// - -class TiledRgbaOutputFile -{ - public: - - //--------------------------------------------------- - // Constructor -- rgbaChannels, tileXSize, tileYSize, - // levelMode, and levelRoundingMode overwrite the - // channel list and tile description attribute in the - // header that is passed as an argument to the - // constructor. - //--------------------------------------------------- - - TiledRgbaOutputFile (const char name[], - const Header &header, - RgbaChannels rgbaChannels, - int tileXSize, - int tileYSize, - LevelMode mode, - LevelRoundingMode rmode = ROUND_DOWN, - int numThreads = globalThreadCount ()); - - - //--------------------------------------------------- - // Constructor -- like the previous one, but the new - // TiledRgbaOutputFile is attached to a file that has - // already been opened by the caller. Destroying - // TiledRgbaOutputFileObjects constructed with this - // constructor does not automatically close the - // corresponding files. - //--------------------------------------------------- - - TiledRgbaOutputFile (OStream &os, - const Header &header, - RgbaChannels rgbaChannels, - int tileXSize, - int tileYSize, - LevelMode mode, - LevelRoundingMode rmode = ROUND_DOWN, - int numThreads = globalThreadCount ()); - - - //------------------------------------------------------ - // Constructor -- header data are explicitly specified - // as function call arguments (an empty dataWindow means - // "same as displayWindow") - //------------------------------------------------------ - - TiledRgbaOutputFile (const char name[], - int tileXSize, - int tileYSize, - LevelMode mode, - LevelRoundingMode rmode, - const Imath::Box2i &displayWindow, - const Imath::Box2i &dataWindow = Imath::Box2i(), - RgbaChannels rgbaChannels = WRITE_RGBA, - float pixelAspectRatio = 1, - const Imath::V2f screenWindowCenter = - Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression compression = ZIP_COMPRESSION, - int numThreads = globalThreadCount ()); - - - //----------------------------------------------- - // Constructor -- like the previous one, but both - // the display window and the data window are - // Box2i (V2i (0, 0), V2i (width - 1, height -1)) - //----------------------------------------------- - - TiledRgbaOutputFile (const char name[], - int width, - int height, - int tileXSize, - int tileYSize, - LevelMode mode, - LevelRoundingMode rmode = ROUND_DOWN, - RgbaChannels rgbaChannels = WRITE_RGBA, - float pixelAspectRatio = 1, - const Imath::V2f screenWindowCenter = - Imath::V2f (0, 0), - float screenWindowWidth = 1, - LineOrder lineOrder = INCREASING_Y, - Compression compression = ZIP_COMPRESSION, - int numThreads = globalThreadCount ()); - - - virtual ~TiledRgbaOutputFile (); - - - //------------------------------------------------ - // Define a frame buffer as the pixel data source: - // Pixel (x, y) is at address - // - // base + x * xStride + y * yStride - // - //------------------------------------------------ - - void setFrameBuffer (const Rgba *base, - size_t xStride, - size_t yStride); - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - const FrameBuffer & frameBuffer () const; - const Imath::Box2i & displayWindow () const; - const Imath::Box2i & dataWindow () const; - float pixelAspectRatio () const; - const Imath::V2f screenWindowCenter () const; - float screenWindowWidth () const; - LineOrder lineOrder () const; - Compression compression () const; - RgbaChannels channels () const; - - - //---------------------------------------------------- - // Utility functions (same as in Imf::TiledOutputFile) - //---------------------------------------------------- - - unsigned int tileXSize () const; - unsigned int tileYSize () const; - LevelMode levelMode () const; - LevelRoundingMode levelRoundingMode () const; - - int numLevels () const; - int numXLevels () const; - int numYLevels () const; - bool isValidLevel (int lx, int ly) const; - - int levelWidth (int lx) const; - int levelHeight (int ly) const; - - int numXTiles (int lx = 0) const; - int numYTiles (int ly = 0) const; - - Imath::Box2i dataWindowForLevel (int l = 0) const; - Imath::Box2i dataWindowForLevel (int lx, int ly) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int l = 0) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int lx, int ly) const; - - //------------------------------------------------------------------ - // Write pixel data: - // - // writeTile(dx, dy, lx, ly) writes the tile with tile - // coordinates (dx, dy), and level number (lx, ly) to - // the file. - // - // dx must lie in the interval [0, numXTiles(lx)-1] - // dy must lie in the interval [0, numYTiles(ly)-1] - // - // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] - // - // writeTile(dx, dy, level) is a convenience function - // used for ONE_LEVEL and MIPMAP_LEVEL files. It calls - // writeTile(dx, dy, level, level). - // - // The two writeTiles(dx1, dx2, dy1, dy2, ...) functions allow - // writing multiple tiles at once. If multi-threading is used - // multiple tiles are written concurrently. - // - // Pixels that are outside the pixel coordinate range for the tile's - // level, are never accessed by writeTile(). - // - // Each tile in the file must be written exactly once. - // - //------------------------------------------------------------------ - - void writeTile (int dx, int dy, int l = 0); - void writeTile (int dx, int dy, int lx, int ly); - - void writeTiles (int dxMin, int dxMax, int dyMin, int dyMax, - int lx, int ly); - - void writeTiles (int dxMin, int dxMax, int dyMin, int dyMax, - int l = 0); - - - // ------------------------------------------------------------------------- - // Update the preview image (see Imf::TiledOutputFile::updatePreviewImage()) - // ------------------------------------------------------------------------- - - void updatePreviewImage (const PreviewRgba[]); - - - //------------------------------------------------ - // Break a tile -- for testing and debugging only - // (see Imf::TiledOutputFile::breakTile()) - // - // Warning: Calling this function usually results - // in a broken image file. The file or parts of - // it may not be readable, or the file may contain - // bad data. - // - //------------------------------------------------ - - void breakTile (int dx, int dy, - int lx, int ly, - int offset, - int length, - char c); - private: - - // - // Copy constructor and assignment are not implemented - // - - TiledRgbaOutputFile (const TiledRgbaOutputFile &); - TiledRgbaOutputFile & operator = (const TiledRgbaOutputFile &); - - class ToYa; - - TiledOutputFile * _outputFile; - ToYa * _toYa; -}; - - - -// -// Tiled RGBA input file -// - -class TiledRgbaInputFile -{ - public: - - //-------------------------------------------------------- - // Constructor -- opens the file with the specified name. - // Destroying TiledRgbaInputFile objects constructed with - // this constructor automatically closes the corresponding - // files. - //-------------------------------------------------------- - - TiledRgbaInputFile (const char name[], - int numThreads = globalThreadCount ()); - - - //------------------------------------------------------- - // Constructor -- attaches the new TiledRgbaInputFile - // object to a file that has already been opened by the - // caller. - // Destroying TiledRgbaInputFile objects constructed with - // this constructor does not automatically close the - // corresponding files. - //------------------------------------------------------- - - TiledRgbaInputFile (IStream &is, int numThreads = globalThreadCount ()); - - - //----------- - // Destructor - //----------- - - virtual ~TiledRgbaInputFile (); - - - //----------------------------------------------------- - // Define a frame buffer as the pixel data destination: - // Pixel (x, y) is at address - // - // base + x * xStride + y * yStride - // - //----------------------------------------------------- - - void setFrameBuffer (Rgba *base, - size_t xStride, - size_t yStride); - - //-------------------------- - // Access to the file header - //-------------------------- - - const Header & header () const; - const FrameBuffer & frameBuffer () const; - const Imath::Box2i & displayWindow () const; - const Imath::Box2i & dataWindow () const; - float pixelAspectRatio () const; - const Imath::V2f screenWindowCenter () const; - float screenWindowWidth () const; - LineOrder lineOrder () const; - Compression compression () const; - RgbaChannels channels () const; - const char * fileName () const; - bool isComplete () const; - - //---------------------------------- - // Access to the file format version - //---------------------------------- - - int version () const; - - - //--------------------------------------------------- - // Utility functions (same as in Imf::TiledInputFile) - //--------------------------------------------------- - - unsigned int tileXSize () const; - unsigned int tileYSize () const; - LevelMode levelMode () const; - LevelRoundingMode levelRoundingMode () const; - - int numLevels () const; - int numXLevels () const; - int numYLevels () const; - bool isValidLevel (int lx, int ly) const; - - int levelWidth (int lx) const; - int levelHeight (int ly) const; - - int numXTiles (int lx = 0) const; - int numYTiles (int ly = 0) const; - - Imath::Box2i dataWindowForLevel (int l = 0) const; - Imath::Box2i dataWindowForLevel (int lx, int ly) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int l = 0) const; - - Imath::Box2i dataWindowForTile (int dx, int dy, - int lx, int ly) const; - - - //---------------------------------------------------------------- - // Read pixel data: - // - // readTile(dx, dy, lx, ly) reads the tile with tile - // coordinates (dx, dy), and level number (lx, ly), - // and stores it in the current frame buffer. - // - // dx must lie in the interval [0, numXTiles(lx)-1] - // dy must lie in the interval [0, numYTiles(ly)-1] - // - // lx must lie in the interval [0, numXLevels()-1] - // ly must lie in the inverval [0, numYLevels()-1] - // - // readTile(dx, dy, level) is a convenience function used - // for ONE_LEVEL and MIPMAP_LEVELS files. It calls - // readTile(dx, dy, level, level). - // - // The two readTiles(dx1, dx2, dy1, dy2, ...) functions allow - // reading multiple tiles at once. If multi-threading is used - // multiple tiles are read concurrently. - // - // Pixels that are outside the pixel coordinate range for the - // tile's level, are never accessed by readTile(). - // - // Attempting to access a tile that is not present in the file - // throws an InputExc exception. - // - //---------------------------------------------------------------- - - void readTile (int dx, int dy, int l = 0); - void readTile (int dx, int dy, int lx, int ly); - - void readTiles (int dxMin, int dxMax, - int dyMin, int dyMax, int lx, int ly); - - void readTiles (int dxMin, int dxMax, - int dyMin, int dyMax, int l = 0); - - private: - - // - // Copy constructor and assignment are not implemented - // - - TiledRgbaInputFile (const TiledRgbaInputFile &); - TiledRgbaInputFile & operator = (const TiledRgbaInputFile &); - - class FromYa; - - TiledInputFile * _inputFile; - FromYa * _fromYa; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTimeCode.h b/3rdparty/include/OpenEXR/ImfTimeCode.h deleted file mode 100644 index 3030d49356..0000000000 --- a/3rdparty/include/OpenEXR/ImfTimeCode.h +++ /dev/null @@ -1,226 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TIME_CODE_H -#define INCLUDED_IMF_TIME_CODE_H - -//----------------------------------------------------------------------------- -// -// class TimeCode -// -// A TimeCode object stores time and control codes as described -// in SMPTE standard 12M-1999. A TimeCode object contains the -// following fields: -// -// Time Address: -// -// hours integer, range 0 - 23 -// minutes integer, range 0 - 59 -// seconds integer, range 0 - 59 -// frame integer, range 0 - 29 -// -// Flags: -// -// drop frame flag boolean -// color frame flag boolean -// field/phase flag boolean -// bgf0 boolean -// bgf1 boolean -// bgf2 boolean -// -// Binary groups for user-defined data and control codes: -// -// binary group 1 integer, range 0 - 15 -// binary group 2 integer, range 0 - 15 -// ... -// binary group 8 integer, range 0 - 15 -// -// Class TimeCode contains methods to convert between the fields -// listed above and a more compact representation where the fields -// are packed into two unsigned 32-bit integers. In the packed -// integer representations, bit 0 is the least significant bit, -// and bit 31 is the most significant bit of the integer value. -// -// The time address and flags fields can be packed in three -// different ways: -// -// bits packing for packing for packing for -// 24-frame 60-field 50-field -// film television television -// -// 0 - 3 frame units frame units frame units -// 4 - 5 frame tens frame tens frame tens -// 6 unused, set to 0 drop frame flag unused, set to 0 -// 7 unused, set to 0 color frame flag color frame flag -// 8 - 11 seconds units seconds units seconds units -// 12 - 14 seconds tens seconds tens seconds tens -// 15 phase flag field/phase flag bgf0 -// 16 - 19 minutes units minutes units minutes units -// 20 - 22 minutes tens minutes tens minutes tens -// 23 bgf0 bgf0 bgf2 -// 24 - 27 hours units hours units hours units -// 28 - 29 hours tens hours tens hours tens -// 30 bgf1 bgf1 bgf1 -// 31 bgf2 bgf2 field/phase flag -// -// User-defined data and control codes are packed as follows: -// -// bits field -// -// 0 - 3 binary group 1 -// 4 - 7 binary group 2 -// 8 - 11 binary group 3 -// 12 - 15 binary group 4 -// 16 - 19 binary group 5 -// 20 - 23 binary group 6 -// 24 - 27 binary group 7 -// 28 - 31 binary group 8 -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -class TimeCode -{ - public: - - //--------------------- - // Bit packing variants - //--------------------- - - enum Packing - { - TV60_PACKING, // packing for 60-field television - TV50_PACKING, // packing for 50-field television - FILM24_PACKING // packing for 24-frame film - }; - - - //------------------------------------- - // Constructors and assignment operator - //------------------------------------- - - TimeCode (); // all fields set to 0 or false - - TimeCode (int hours, - int minutes, - int seconds, - int frame, - bool dropFrame = false, - bool colorFrame = false, - bool fieldPhase = false, - bool bgf0 = false, - bool bgf1 = false, - bool bgf2 = false, - int binaryGroup1 = 0, - int binaryGroup2 = 0, - int binaryGroup3 = 0, - int binaryGroup4 = 0, - int binaryGroup5 = 0, - int binaryGroup6 = 0, - int binaryGroup7 = 0, - int binaryGroup8 = 0); - - TimeCode (unsigned int timeAndFlags, - unsigned int userData = 0, - Packing packing = TV60_PACKING); - - TimeCode (const TimeCode &other); - - TimeCode & operator = (const TimeCode &other); - - - //---------------------------- - // Access to individual fields - //---------------------------- - - int hours () const; - void setHours (int value); - - int minutes () const; - void setMinutes (int value); - - int seconds () const; - void setSeconds (int value); - - int frame () const; - void setFrame (int value); - - bool dropFrame () const; - void setDropFrame (bool value); - - bool colorFrame () const; - void setColorFrame (bool value); - - bool fieldPhase () const; - void setFieldPhase (bool value); - - bool bgf0 () const; - void setBgf0 (bool value); - - bool bgf1 () const; - void setBgf1 (bool value); - - bool bgf2 () const; - void setBgf2 (bool value); - - int binaryGroup (int group) const; // group must be between 1 and 8 - void setBinaryGroup (int group, int value); - - - //--------------------------------- - // Access to packed representations - //--------------------------------- - - unsigned int timeAndFlags (Packing packing = TV60_PACKING) const; - - void setTimeAndFlags (unsigned int value, - Packing packing = TV60_PACKING); - - unsigned int userData () const; - - void setUserData (unsigned int value); - - private: - - unsigned int _time; - unsigned int _user; -}; - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfTimeCodeAttribute.h b/3rdparty/include/OpenEXR/ImfTimeCodeAttribute.h deleted file mode 100644 index 3d548fa102..0000000000 --- a/3rdparty/include/OpenEXR/ImfTimeCodeAttribute.h +++ /dev/null @@ -1,72 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_TIME_CODE_ATTRIBUTE_H -#define INCLUDED_IMF_TIME_CODE_ATTRIBUTE_H - - -//----------------------------------------------------------------------------- -// -// class TimeCodeAttribute -// -//----------------------------------------------------------------------------- - -#include -#include - - -namespace Imf { - - -typedef TypedAttribute TimeCodeAttribute; - -template <> -const char *TimeCodeAttribute::staticTypeName (); - -template <> -void TimeCodeAttribute::writeValueTo (OStream &, int) const; - -template <> -void TimeCodeAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfVecAttribute.h b/3rdparty/include/OpenEXR/ImfVecAttribute.h deleted file mode 100644 index ba13f86480..0000000000 --- a/3rdparty/include/OpenEXR/ImfVecAttribute.h +++ /dev/null @@ -1,87 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_VEC_ATTRIBUTE_H -#define INCLUDED_IMF_VEC_ATTRIBUTE_H - -//----------------------------------------------------------------------------- -// -// class V2iAttribute -// class V2fAttribute -// class V3iAttribute -// class V3fAttribute -// -//----------------------------------------------------------------------------- - -#include -#include "ImathVec.h" - - -namespace Imf { - - -typedef TypedAttribute V2iAttribute; -template <> const char *V2iAttribute::staticTypeName (); -template <> void V2iAttribute::writeValueTo (OStream &, int) const; -template <> void V2iAttribute::readValueFrom (IStream &, int, int); - - -typedef TypedAttribute V2fAttribute; -template <> const char *V2fAttribute::staticTypeName (); -template <> void V2fAttribute::writeValueTo (OStream &, int) const; -template <> void V2fAttribute::readValueFrom (IStream &, int, int); - - -typedef TypedAttribute V3iAttribute; -template <> const char *V3iAttribute::staticTypeName (); -template <> void V3iAttribute::writeValueTo (OStream &, int) const; -template <> void V3iAttribute::readValueFrom (IStream &, int, int); - - -typedef TypedAttribute V3fAttribute; -template <> const char *V3fAttribute::staticTypeName (); -template <> void V3fAttribute::writeValueTo (OStream &, int) const; -template <> void V3fAttribute::readValueFrom (IStream &, int, int); - - -} // namespace Imf - -// Metrowerks compiler wants the .cpp file inlined, too -#ifdef __MWERKS__ -#include -#endif - -#endif diff --git a/3rdparty/include/OpenEXR/ImfVersion.h b/3rdparty/include/OpenEXR/ImfVersion.h deleted file mode 100644 index 76f0d84376..0000000000 --- a/3rdparty/include/OpenEXR/ImfVersion.h +++ /dev/null @@ -1,117 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2004, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_VERSION_H -#define INCLUDED_IMF_VERSION_H - -//----------------------------------------------------------------------------- -// -// Magic and version number. -// -//----------------------------------------------------------------------------- - - -namespace Imf { - - -// -// The MAGIC number is stored in the first four bytes of every -// OpenEXR image file. This can be used to quickly test whether -// a given file is an OpenEXR image file (see isImfMagic(), below). -// - -const int MAGIC = 20000630; - - -// -// The second item in each OpenEXR image file, right after the -// magic number, is a four-byte file version identifier. Depending -// on a file's version identifier, a file reader can enable various -// backwards-compatibility switches, or it can quickly reject files -// that it cannot read. -// -// The version identifier is split into an 8-bit version number, -// and a 24-bit flags field. -// - -const int VERSION_NUMBER_FIELD = 0x000000ff; -const int VERSION_FLAGS_FIELD = 0xffffff00; - - -// -// Value that goes into VERSION_NUMBER_FIELD. -// - -const int EXR_VERSION = 2; - - -// -// Flags that can go into VERSION_FLAGS_FIELD. -// Flags can only occupy the 1 bits in VERSION_FLAGS_FIELD. -// - -const int TILED_FLAG = 0x00000200; - - -// -// Bitwise OR of all known flags. -// - -const int ALL_FLAGS = TILED_FLAG; - - -// -// Utility functions -// - -inline bool isTiled (int version) {return !!(version & TILED_FLAG);} -inline int makeTiled (int version) {return version | TILED_FLAG;} -inline int makeNotTiled (int version) {return version & ~TILED_FLAG;} -inline int getVersion (int version) {return version & VERSION_NUMBER_FIELD;} -inline int getFlags (int version) {return version & VERSION_FLAGS_FIELD;} -inline bool supportsFlags (int flags) {return !(flags & ~ALL_FLAGS);} - - -// -// Given the first four bytes of a file, returns true if the -// file is probably an OpenEXR image file, false if not. -// - -bool isImfMagic (const char bytes[4]); - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfWav.h b/3rdparty/include/OpenEXR/ImfWav.h deleted file mode 100644 index 815d2d57c2..0000000000 --- a/3rdparty/include/OpenEXR/ImfWav.h +++ /dev/null @@ -1,70 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - - -#ifndef INCLUDED_IMF_WAV_H -#define INCLUDED_IMF_WAV_H - -//----------------------------------------------------------------------------- -// -// 16-bit Haar Wavelet encoding and decoding -// -//----------------------------------------------------------------------------- - -namespace Imf { - - -void -wav2Encode - (unsigned short *in, // io: values in[y][x] are transformed in place - int nx, // i : x size - int ox, // i : x offset - int ny, // i : y size - int oy, // i : y offset - unsigned short mx); // i : maximum in[x][y] value - -void -wav2Decode - (unsigned short *in, // io: values in[y][x] are transformed in place - int nx, // i : x size - int ox, // i : x offset - int ny, // i : y size - int oy, // i : y offset - unsigned short mx); // i : maximum in[x][y] value - - -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/ImfXdr.h b/3rdparty/include/OpenEXR/ImfXdr.h deleted file mode 100644 index 7992921bb0..0000000000 --- a/3rdparty/include/OpenEXR/ImfXdr.h +++ /dev/null @@ -1,916 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -#ifndef INCLUDED_IMF_XDR_H -#define INCLUDED_IMF_XDR_H - -//---------------------------------------------------------------------------- -// -// Xdr -- routines to convert data between the machine's native -// format and a machine-independent external data representation: -// -// write (T &o, S v); converts a value, v, of type S -// into a machine-independent -// representation and stores the -// result in an output buffer, o. -// -// read (T &i, S &v); reads the machine-independent -// representation of a value of type -// S from input buffer i, converts -// the value into the machine's native -// representation, and stores the result -// in v. -// -// size(); returns the size, in bytes, of the -// machine-independent representation -// of an object of type S. -// -// The write() and read() routines are templates; data can be written -// to and read from any output or input buffer type T for which a helper -// class, R, exits. Class R must define a method to store a char array -// in a T, and a method to read a char array from a T: -// -// struct R -// { -// static void -// writeChars (T &o, const char c[/*n*/], int n) -// { -// ... // Write c[0], c[1] ... c[n-1] to output buffer o. -// } -// -// static void -// readChars (T &i, char c[/*n*/], int n) -// { -// ... // Read n characters from input buffer i -// // and copy them to c[0], c[1] ... c[n-1]. -// } -// }; -// -// Example - writing to and reading from iostreams: -// -// struct CharStreamIO -// { -// static void -// writeChars (ostream &os, const char c[], int n) -// { -// os.write (c, n); -// } -// -// static void -// readChars (istream &is, char c[], int n) -// { -// is.read (c, n); -// } -// }; -// -// ... -// -// Xdr::write (os, 3); -// Xdr::write (os, 5.0); -// -//---------------------------------------------------------------------------- - -#include -#include "IexMathExc.h" -#include "half.h" -#include - -namespace Imf { -namespace Xdr { - - -//------------------------------- -// Write data to an output stream -//------------------------------- - -template -void -write (T &out, bool v); - -template -void -write (T &out, char v); - -template -void -write (T &out, signed char v); - -template -void -write (T &out, unsigned char v); - -template -void -write (T &out, signed short v); - -template -void -write (T &out, unsigned short v); - -template -void -write (T &out, signed int v); - -template -void -write (T &out, unsigned int v); - -template -void -write (T &out, signed long v); - -template -void -write (T &out, unsigned long v); - -#if ULONG_MAX != 18446744073709551615LU - - template - void - write (T &out, Int64 v); - -#endif - -template -void -write (T &out, float v); - -template -void -write (T &out, double v); - -template -void -write (T &out, half v); - -template -void -write (T &out, const char v[/*n*/], int n); // fixed-size char array - -template -void -write (T &out, const char v[]); // zero-terminated string - - -//----------------------------------------- -// Append padding bytes to an output stream -//----------------------------------------- - -template -void -pad (T &out, int n); // write n padding bytes - - - -//------------------------------- -// Read data from an input stream -//------------------------------- - -template -void -read (T &in, bool &v); - -template -void -read (T &in, char &v); - -template -void -read (T &in, signed char &v); - -template -void -read (T &in, unsigned char &v); - -template -void -read (T &in, signed short &v); - -template -void -read (T &in, unsigned short &v); - -template -void -read (T &in, signed int &v); - -template -void -read (T &in, unsigned int &v); - -template -void -read (T &in, signed long &v); - -template -void -read (T &in, unsigned long &v); - -#if ULONG_MAX != 18446744073709551615LU - - template - void - read (T &in, Int64 &v); - -#endif - -template -void -read (T &in, float &v); - -template -void -read (T &in, double &v); - -template -void -read (T &in, half &v); - -template -void -read (T &in, char v[/*n*/], int n); // fixed-size char array - -template -void -read (T &in, int n, char v[/*n*/]); // zero-terminated string - - -//------------------------------------------- -// Skip over padding bytes in an input stream -//------------------------------------------- - -template -void -skip (T &in, int n); // skip n padding bytes - - - -//-------------------------------------- -// Size of the machine-independent -// representation of an object of type S -//-------------------------------------- - -template -int -size (); - - -//--------------- -// Implementation -//--------------- - -template -inline void -writeSignedChars (T &out, const signed char c[], int n) -{ - S::writeChars (out, (const char *) c, n); -} - - -template -inline void -writeUnsignedChars (T &out, const unsigned char c[], int n) -{ - S::writeChars (out, (const char *) c, n); -} - - -template -inline void -readSignedChars (T &in, signed char c[], int n) -{ - S::readChars (in, (char *) c, n); -} - - -template -inline void -readUnsignedChars (T &in, unsigned char c[], int n) -{ - S::readChars (in, (char *) c, n); -} - - -template -inline void -write (T &out, bool v) -{ - char c = !!v; - S::writeChars (out, &c, 1); -} - - -template -inline void -write (T &out, char v) -{ - S::writeChars (out, &v, 1); -} - - -template -inline void -write (T &out, signed char v) -{ - writeSignedChars (out, &v, 1); -} - - -template -inline void -write (T &out, unsigned char v) -{ - writeUnsignedChars (out, &v, 1); -} - - -template -void -write (T &out, signed short v) -{ - signed char b[2]; - - b[0] = (signed char) (v); - b[1] = (signed char) (v >> 8); - - writeSignedChars (out, b, 2); -} - - -template -void -write (T &out, unsigned short v) -{ - unsigned char b[2]; - - b[0] = (unsigned char) (v); - b[1] = (unsigned char) (v >> 8); - - writeUnsignedChars (out, b, 2); -} - - -template -void -write (T &out, signed int v) -{ - signed char b[4]; - - b[0] = (signed char) (v); - b[1] = (signed char) (v >> 8); - b[2] = (signed char) (v >> 16); - b[3] = (signed char) (v >> 24); - - writeSignedChars (out, b, 4); -} - - -template -void -write (T &out, unsigned int v) -{ - unsigned char b[4]; - - b[0] = (unsigned char) (v); - b[1] = (unsigned char) (v >> 8); - b[2] = (unsigned char) (v >> 16); - b[3] = (unsigned char) (v >> 24); - - writeUnsignedChars (out, b, 4); -} - - -template -void -write (T &out, signed long v) -{ - signed char b[8]; - - b[0] = (signed char) (v); - b[1] = (signed char) (v >> 8); - b[2] = (signed char) (v >> 16); - b[3] = (signed char) (v >> 24); - - #if LONG_MAX == 2147483647 - - if (v >= 0) - { - b[4] = 0; - b[5] = 0; - b[6] = 0; - b[7] = 0; - } - else - { - b[4] = ~0; - b[5] = ~0; - b[6] = ~0; - b[7] = ~0; - } - - #elif LONG_MAX == 9223372036854775807L - - b[4] = (signed char) (v >> 32); - b[5] = (signed char) (v >> 40); - b[6] = (signed char) (v >> 48); - b[7] = (signed char) (v >> 56); - - #else - - #error write (T &out, signed long v) not implemented - - #endif - - writeSignedChars (out, b, 8); -} - - -template -void -write (T &out, unsigned long v) -{ - unsigned char b[8]; - - b[0] = (unsigned char) (v); - b[1] = (unsigned char) (v >> 8); - b[2] = (unsigned char) (v >> 16); - b[3] = (unsigned char) (v >> 24); - - #if ULONG_MAX == 4294967295U - - b[4] = 0; - b[5] = 0; - b[6] = 0; - b[7] = 0; - - #elif ULONG_MAX == 18446744073709551615LU - - b[4] = (unsigned char) (v >> 32); - b[5] = (unsigned char) (v >> 40); - b[6] = (unsigned char) (v >> 48); - b[7] = (unsigned char) (v >> 56); - - #else - - #error write (T &out, unsigned long v) not implemented - - #endif - - writeUnsignedChars (out, b, 8); -} - - -#if ULONG_MAX != 18446744073709551615LU - - template - void - write (T &out, Int64 v) - { - unsigned char b[8]; - - b[0] = (unsigned char) (v); - b[1] = (unsigned char) (v >> 8); - b[2] = (unsigned char) (v >> 16); - b[3] = (unsigned char) (v >> 24); - b[4] = (unsigned char) (v >> 32); - b[5] = (unsigned char) (v >> 40); - b[6] = (unsigned char) (v >> 48); - b[7] = (unsigned char) (v >> 56); - - writeUnsignedChars (out, b, 8); - } - -#endif - - -template -void -write (T &out, float v) -{ - union {unsigned int i; float f;} u; - u.f = v; - - unsigned char b[4]; - - b[0] = (unsigned char) (u.i); - b[1] = (unsigned char) (u.i >> 8); - b[2] = (unsigned char) (u.i >> 16); - b[3] = (unsigned char) (u.i >> 24); - - writeUnsignedChars (out, b, 4); -} - - -template -void -write (T &out, double v) -{ - union {Int64 i; double d;} u; - u.d = v; - - unsigned char b[8]; - - b[0] = (unsigned char) (u.i); - b[1] = (unsigned char) (u.i >> 8); - b[2] = (unsigned char) (u.i >> 16); - b[3] = (unsigned char) (u.i >> 24); - b[4] = (unsigned char) (u.i >> 32); - b[5] = (unsigned char) (u.i >> 40); - b[6] = (unsigned char) (u.i >> 48); - b[7] = (unsigned char) (u.i >> 56); - - writeUnsignedChars (out, b, 8); -} - - -template -inline void -write (T &out, half v) -{ - unsigned char b[2]; - - b[0] = (unsigned char) (v.bits()); - b[1] = (unsigned char) (v.bits() >> 8); - - writeUnsignedChars (out, b, 2); -} - - -template -inline void -write (T &out, const char v[], int n) // fixed-size char array -{ - S::writeChars (out, v, n); -} - - -template -void -write (T &out, const char v[]) // zero-terminated string -{ - while (*v) - { - S::writeChars (out, v, 1); - ++v; - } - - S::writeChars (out, v, 1); -} - - -template -void -pad (T &out, int n) // add n padding bytes -{ - for (int i = 0; i < n; i++) - { - const char c = 0; - S::writeChars (out, &c, 1); - } -} - - -template -inline void -read (T &in, bool &v) -{ - char c; - - S::readChars (in, &c, 1); - v = !!c; -} - - -template -inline void -read (T &in, char &v) -{ - S::readChars (in, &v, 1); -} - - -template -inline void -read (T &in, signed char &v) -{ - readSignedChars (in, &v, 1); -} - - -template -inline void -read (T &in, unsigned char &v) -{ - readUnsignedChars (in, &v, 1); -} - - -template -void -read (T &in, signed short &v) -{ - signed char b[2]; - - readSignedChars (in, b, 2); - - v = (b[0] & 0x00ff) | - (b[1] << 8); -} - - -template -void -read (T &in, unsigned short &v) -{ - unsigned char b[2]; - - readUnsignedChars (in, b, 2); - - v = (b[0] & 0x00ff) | - (b[1] << 8); -} - - -template -void -read (T &in, signed int &v) -{ - signed char b[4]; - - readSignedChars (in, b, 4); - - v = (b[0] & 0x000000ff) | - ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | - (b[3] << 24); -} - - -template -void -read (T &in, unsigned int &v) -{ - unsigned char b[4]; - - readUnsignedChars (in, b, 4); - - v = (b[0] & 0x000000ff) | - ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | - (b[3] << 24); -} - - -template -void -read (T &in, signed long &v) -{ - signed char b[8]; - - readSignedChars (in, b, 8); - - #if LONG_MAX == 2147483647 - - v = (b[0] & 0x000000ff) | - ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | - (b[3] << 24); - - if (( b[4] || b[5] || b[6] || b[7]) && - (~b[4] || ~b[5] || ~b[6] || ~b[7])) - { - throw Iex::OverflowExc ("Long int overflow - read a large " - "64-bit integer in a 32-bit process."); - } - - #elif LONG_MAX == 9223372036854775807L - - v = ((long) b[0] & 0x00000000000000ff) | - (((long) b[1] << 8) & 0x000000000000ff00) | - (((long) b[2] << 16) & 0x0000000000ff0000) | - (((long) b[3] << 24) & 0x00000000ff000000) | - (((long) b[4] << 32) & 0x000000ff00000000) | - (((long) b[5] << 40) & 0x0000ff0000000000) | - (((long) b[6] << 48) & 0x00ff000000000000) | - ((long) b[7] << 56); - - #else - - #error read (T &in, signed long &v) not implemented - - #endif -} - - -template -void -read (T &in, unsigned long &v) -{ - unsigned char b[8]; - - readUnsignedChars (in, b, 8); - - #if ULONG_MAX == 4294967295U - - v = (b[0] & 0x000000ff) | - ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | - (b[3] << 24); - - if (b[4] || b[5] || b[6] || b[7]) - { - throw Iex::OverflowExc ("Long int overflow - read a large " - "64-bit integer in a 32-bit process."); - } - - #elif ULONG_MAX == 18446744073709551615LU - - v = ((unsigned long) b[0] & 0x00000000000000ff) | - (((unsigned long) b[1] << 8) & 0x000000000000ff00) | - (((unsigned long) b[2] << 16) & 0x0000000000ff0000) | - (((unsigned long) b[3] << 24) & 0x00000000ff000000) | - (((unsigned long) b[4] << 32) & 0x000000ff00000000) | - (((unsigned long) b[5] << 40) & 0x0000ff0000000000) | - (((unsigned long) b[6] << 48) & 0x00ff000000000000) | - ((unsigned long) b[7] << 56); - - #else - - #error read (T &in, unsigned long &v) not implemented - - #endif -} - - -#if ULONG_MAX != 18446744073709551615LU - - template - void - read (T &in, Int64 &v) - { - unsigned char b[8]; - - readUnsignedChars (in, b, 8); - - v = ((Int64) b[0] & 0x00000000000000ffLL) | - (((Int64) b[1] << 8) & 0x000000000000ff00LL) | - (((Int64) b[2] << 16) & 0x0000000000ff0000LL) | - (((Int64) b[3] << 24) & 0x00000000ff000000LL) | - (((Int64) b[4] << 32) & 0x000000ff00000000LL) | - (((Int64) b[5] << 40) & 0x0000ff0000000000LL) | - (((Int64) b[6] << 48) & 0x00ff000000000000LL) | - ((Int64) b[7] << 56); - } - -#endif - - -template -void -read (T &in, float &v) -{ - unsigned char b[4]; - - readUnsignedChars (in, b, 4); - - union {unsigned int i; float f;} u; - - u.i = (b[0] & 0x000000ff) | - ((b[1] << 8) & 0x0000ff00) | - ((b[2] << 16) & 0x00ff0000) | - (b[3] << 24); - - v = u.f; -} - - -template -void -read (T &in, double &v) -{ - unsigned char b[8]; - - readUnsignedChars (in, b, 8); - - union {Int64 i; double d;} u; - - u.i = ((Int64) b[0] & 0x00000000000000ffULL) | - (((Int64) b[1] << 8) & 0x000000000000ff00ULL) | - (((Int64) b[2] << 16) & 0x0000000000ff0000ULL) | - (((Int64) b[3] << 24) & 0x00000000ff000000ULL) | - (((Int64) b[4] << 32) & 0x000000ff00000000ULL) | - (((Int64) b[5] << 40) & 0x0000ff0000000000ULL) | - (((Int64) b[6] << 48) & 0x00ff000000000000ULL) | - ((Int64) b[7] << 56); - - v = u.d; -} - - -template -inline void -read (T &in, half &v) -{ - unsigned char b[2]; - - readUnsignedChars (in, b, 2); - - v.setBits ((b[0] & 0x00ff) | (b[1] << 8)); -} - - -template -inline void -read (T &in, char v[], int n) // fixed-size char array -{ - S::readChars (in, v, n); -} - - -template -void -read (T &in, int n, char v[]) // zero-terminated string -{ - while (n >= 0) - { - S::readChars (in, v, 1); - - if (*v == 0) - break; - - --n; - ++v; - } -} - - -template -void -skip (T &in, int n) // skip n padding bytes -{ - char c[1024]; - - while (n >= (int) sizeof (c)) - { - if (!S::readChars (in, c, sizeof (c))) - return; - - n -= sizeof (c); - } - - if (n >= 1) - S::readChars (in, c, n); -} - - -template <> inline int size () {return 1;} -template <> inline int size () {return 1;} -template <> inline int size () {return 1;} -template <> inline int size () {return 1;} -template <> inline int size () {return 2;} -template <> inline int size () {return 2;} -template <> inline int size () {return 4;} -template <> inline int size () {return 4;} -template <> inline int size () {return 8;} -template <> inline int size () {return 8;} -template <> inline int size () {return 4;} -template <> inline int size () {return 8;} -template <> inline int size () {return 2;} - - -} // namespace Xdr -} // namespace Imf - -#endif diff --git a/3rdparty/include/OpenEXR/OpenEXRConfig.h b/3rdparty/include/OpenEXR/OpenEXRConfig.h deleted file mode 100644 index 6fa1a853a7..0000000000 --- a/3rdparty/include/OpenEXR/OpenEXRConfig.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// This is a hard-coded config file for Windows platforms. Don't -// change any of these settings. -// - -// -// Define and set to 1 if the target system has POSIX thread support -// and you want OpenEXR to use it for multithreaded file I/O. -// - -/* #undef HAVE_PTHREAD */ - -// -// Define and set to 1 if the target system supports POSIX semaphores -// and you want OpenEXR to use them; otherwise, OpenEXR will use its -// own semaphore implementation. -// - -/* #undef HAVE_POSIX_SEMAPHORES */ - -// -// Define and set to 1 if the target system is a Darwin-based system -// (e.g., OS X). -// - -/* #undef HAVE_DARWIN */ - -// -// Define and set to 1 if the target system supports a proc filesystem -// compatible with the Linux kernel's proc filesystem. Note that this -// is only used by a program in the IlmImfTest test suite, it's not -// used by any OpenEXR library or application code. -// - -/* #undef HAVE_LINUX_PROCFS */ - -// -// Define and set to 1 if the target system has a complete -// implementation, specifically if it supports the std::right -// formatter. -// - -#define HAVE_COMPLETE_IOMANIP 1 diff --git a/3rdparty/include/OpenEXR/half.h b/3rdparty/include/OpenEXR/half.h deleted file mode 100644 index 87ddc9de92..0000000000 --- a/3rdparty/include/OpenEXR/half.h +++ /dev/null @@ -1,775 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -// Primary authors: -// Florian Kainz -// Rod Bogart - -//--------------------------------------------------------------------------- -// -// half -- a 16-bit floating point number class: -// -// Type half can represent positive and negative numbers, whose -// magnitude is between roughly 6.1e-5 and 6.5e+4, with a relative -// error of 9.8e-4; numbers smaller than 6.1e-5 can be represented -// with an absolute error of 6.0e-8. All integers from -2048 to -// +2048 can be represented exactly. -// -// Type half behaves (almost) like the built-in C++ floating point -// types. In arithmetic expressions, half, float and double can be -// mixed freely. Here are a few examples: -// -// half a (3.5); -// float b (a + sqrt (a)); -// a += b; -// b += a; -// b = a + 7; -// -// Conversions from half to float are lossless; all half numbers -// are exactly representable as floats. -// -// Conversions from float to half may not preserve the float's -// value exactly. If a float is not representable as a half, the -// float value is rounded to the nearest representable half. If -// a float value is exactly in the middle between the two closest -// representable half values, then the float value is rounded to -// the half with the greater magnitude. -// -// Overflows during float-to-half conversions cause arithmetic -// exceptions. An overflow occurs when the float value to be -// converted is too large to be represented as a half, or if the -// float value is an infinity or a NAN. -// -// The implementation of type half makes the following assumptions -// about the implementation of the built-in C++ types: -// -// float is an IEEE 754 single-precision number -// sizeof (float) == 4 -// sizeof (unsigned int) == sizeof (float) -// alignof (unsigned int) == alignof (float) -// sizeof (unsigned short) == 2 -// -//--------------------------------------------------------------------------- - -#ifndef _HALF_H_ -#define _HALF_H_ - -#include - -class half -{ - public: - - //------------- - // Constructors - //------------- - - half (); // no initialization - half (float f); - - - //-------------------- - // Conversion to float - //-------------------- - - operator float () const; - - - //------------ - // Unary minus - //------------ - - half operator - () const; - - - //----------- - // Assignment - //----------- - - half & operator = (half h); - half & operator = (float f); - - half & operator += (half h); - half & operator += (float f); - - half & operator -= (half h); - half & operator -= (float f); - - half & operator *= (half h); - half & operator *= (float f); - - half & operator /= (half h); - half & operator /= (float f); - - - //--------------------------------------------------------- - // Round to n-bit precision (n should be between 0 and 10). - // After rounding, the significand's 10-n least significant - // bits will be zero. - //--------------------------------------------------------- - - half round (unsigned int n) const; - - - //-------------------------------------------------------------------- - // Classification: - // - // h.isFinite() returns true if h is a normalized number, - // a denormalized number or zero - // - // h.isNormalized() returns true if h is a normalized number - // - // h.isDenormalized() returns true if h is a denormalized number - // - // h.isZero() returns true if h is zero - // - // h.isNan() returns true if h is a NAN - // - // h.isInfinity() returns true if h is a positive - // or a negative infinity - // - // h.isNegative() returns true if the sign bit of h - // is set (negative) - //-------------------------------------------------------------------- - - bool isFinite () const; - bool isNormalized () const; - bool isDenormalized () const; - bool isZero () const; - bool isNan () const; - bool isInfinity () const; - bool isNegative () const; - - - //-------------------------------------------- - // Special values - // - // posInf() returns +infinity - // - // negInf() returns +infinity - // - // qNan() returns a NAN with the bit - // pattern 0111111111111111 - // - // sNan() returns a NAN with the bit - // pattern 0111110111111111 - //-------------------------------------------- - - static half posInf (); - static half negInf (); - static half qNan (); - static half sNan (); - - - //-------------------------------------- - // Access to the internal representation - //-------------------------------------- - - unsigned short bits () const; - void setBits (unsigned short bits); - - - public: - - union uif - { - unsigned int i; - float f; - }; - - private: - - static short convert (int i); - static float overflow (); - - unsigned short _h; - - //--------------------------------------------------- - // Windows dynamic libraries don't like static - // member variables. - //--------------------------------------------------- -#ifndef OPENEXR_DLL - static const uif _toFloat[1 << 16]; - static const unsigned short _eLut[1 << 9]; -#endif -}; - -#if defined(OPENEXR_DLL) - //-------------------------------------- - // Lookup tables defined for Windows DLL - //-------------------------------------- - #if defined(HALF_EXPORTS) - extern __declspec(dllexport) half::uif _toFloat[1 << 16]; - extern __declspec(dllexport) unsigned short _eLut[1 << 9]; - #else - extern __declspec(dllimport) half::uif _toFloat[1 << 16]; - extern __declspec(dllimport) unsigned short _eLut[1 << 9]; - #endif -#endif - - -//----------- -// Stream I/O -//----------- - -std::ostream & operator << (std::ostream &os, half h); -std::istream & operator >> (std::istream &is, half &h); - - -//---------- -// Debugging -//---------- - -void printBits (std::ostream &os, half h); -void printBits (std::ostream &os, float f); -void printBits (char c[19], half h); -void printBits (char c[35], float f); - - -//------------------------------------------------------------------------- -// Limits -// -// Visual C++ will complain if HALF_MIN, HALF_NRM_MIN etc. are not float -// constants, but at least one other compiler (gcc 2.96) produces incorrect -// results if they are. -//------------------------------------------------------------------------- - -#if (defined _WIN32 || defined _WIN64) && defined _MSC_VER - -#define HALF_MIN 5.96046448e-08f // Smallest positive half - -#define HALF_NRM_MIN 6.10351562e-05f // Smallest positive normalized half - -#define HALF_MAX 65504.0f // Largest positive half - -#define HALF_EPSILON 0.00097656f // Smallest positive e for which - // half (1.0 + e) != half (1.0) -#else - -#define HALF_MIN 5.96046448e-08 // Smallest positive half - -#define HALF_NRM_MIN 6.10351562e-05 // Smallest positive normalized half - -#define HALF_MAX 65504.0 // Largest positive half - -#define HALF_EPSILON 0.00097656 // Smallest positive e for which - // half (1.0 + e) != half (1.0) -#endif - - -#define HALF_MANT_DIG 11 // Number of digits in mantissa - // (significand + hidden leading 1) - -#define HALF_DIG 2 // Number of base 10 digits that - // can be represented without change - -#define HALF_RADIX 2 // Base of the exponent - -#define HALF_MIN_EXP -13 // Minimum negative integer such that - // HALF_RADIX raised to the power of - // one less than that integer is a - // normalized half - -#define HALF_MAX_EXP 16 // Maximum positive integer such that - // HALF_RADIX raised to the power of - // one less than that integer is a - // normalized half - -#define HALF_MIN_10_EXP -4 // Minimum positive integer such - // that 10 raised to that power is - // a normalized half - -#define HALF_MAX_10_EXP 4 // Maximum positive integer such - // that 10 raised to that power is - // a normalized half - - -//--------------------------------------------------------------------------- -// -// Implementation -- -// -// Representation of a float: -// -// We assume that a float, f, is an IEEE 754 single-precision -// floating point number, whose bits are arranged as follows: -// -// 31 (msb) -// | -// | 30 23 -// | | | -// | | | 22 0 (lsb) -// | | | | | -// X XXXXXXXX XXXXXXXXXXXXXXXXXXXXXXX -// -// s e m -// -// S is the sign-bit, e is the exponent and m is the significand. -// -// If e is between 1 and 254, f is a normalized number: -// -// s e-127 -// f = (-1) * 2 * 1.m -// -// If e is 0, and m is not zero, f is a denormalized number: -// -// s -126 -// f = (-1) * 2 * 0.m -// -// If e and m are both zero, f is zero: -// -// f = 0.0 -// -// If e is 255, f is an "infinity" or "not a number" (NAN), -// depending on whether m is zero or not. -// -// Examples: -// -// 0 00000000 00000000000000000000000 = 0.0 -// 0 01111110 00000000000000000000000 = 0.5 -// 0 01111111 00000000000000000000000 = 1.0 -// 0 10000000 00000000000000000000000 = 2.0 -// 0 10000000 10000000000000000000000 = 3.0 -// 1 10000101 11110000010000000000000 = -124.0625 -// 0 11111111 00000000000000000000000 = +infinity -// 1 11111111 00000000000000000000000 = -infinity -// 0 11111111 10000000000000000000000 = NAN -// 1 11111111 11111111111111111111111 = NAN -// -// Representation of a half: -// -// Here is the bit-layout for a half number, h: -// -// 15 (msb) -// | -// | 14 10 -// | | | -// | | | 9 0 (lsb) -// | | | | | -// X XXXXX XXXXXXXXXX -// -// s e m -// -// S is the sign-bit, e is the exponent and m is the significand. -// -// If e is between 1 and 30, h is a normalized number: -// -// s e-15 -// h = (-1) * 2 * 1.m -// -// If e is 0, and m is not zero, h is a denormalized number: -// -// S -14 -// h = (-1) * 2 * 0.m -// -// If e and m are both zero, h is zero: -// -// h = 0.0 -// -// If e is 31, h is an "infinity" or "not a number" (NAN), -// depending on whether m is zero or not. -// -// Examples: -// -// 0 00000 0000000000 = 0.0 -// 0 01110 0000000000 = 0.5 -// 0 01111 0000000000 = 1.0 -// 0 10000 0000000000 = 2.0 -// 0 10000 1000000000 = 3.0 -// 1 10101 1111000001 = -124.0625 -// 0 11111 0000000000 = +infinity -// 1 11111 0000000000 = -infinity -// 0 11111 1000000000 = NAN -// 1 11111 1111111111 = NAN -// -// Conversion: -// -// Converting from a float to a half requires some non-trivial bit -// manipulations. In some cases, this makes conversion relatively -// slow, but the most common case is accelerated via table lookups. -// -// Converting back from a half to a float is easier because we don't -// have to do any rounding. In addition, there are only 65536 -// different half numbers; we can convert each of those numbers once -// and store the results in a table. Later, all conversions can be -// done using only simple table lookups. -// -//--------------------------------------------------------------------------- - - -//-------------------- -// Simple constructors -//-------------------- - -inline -half::half () -{ - // no initialization -} - - -//---------------------------- -// Half-from-float constructor -//---------------------------- - -inline -half::half (float f) -{ - if (f == 0) - { - // - // Common special case - zero. - // For speed, we don't preserve the zero's sign. - // - - _h = 0; - } - else - { - // - // We extract the combined sign and exponent, e, from our - // floating-point number, f. Then we convert e to the sign - // and exponent of the half number via a table lookup. - // - // For the most common case, where a normalized half is produced, - // the table lookup returns a non-zero value; in this case, all - // we have to do, is round f's significand to 10 bits and combine - // the result with e. - // - // For all other cases (overflow, zeroes, denormalized numbers - // resulting from underflow, infinities and NANs), the table - // lookup returns zero, and we call a longer, non-inline function - // to do the float-to-half conversion. - // - - uif x; - - x.f = f; - - register int e = (x.i >> 23) & 0x000001ff; - - e = _eLut[e]; - - if (e) - { - // - // Simple case - round the significand and - // combine it with the sign and exponent. - // - - _h = e + (((x.i & 0x007fffff) + 0x00001000) >> 13); - } - else - { - // - // Difficult case - call a function. - // - - _h = convert (x.i); - } - } -} - - -//------------------------------------------ -// Half-to-float conversion via table lookup -//------------------------------------------ - -inline -half::operator float () const -{ - return _toFloat[_h].f; -} - - -//------------------------- -// Round to n-bit precision -//------------------------- - -inline half -half::round (unsigned int n) const -{ - // - // Parameter check. - // - - if (n >= 10) - return *this; - - // - // Disassemble h into the sign, s, - // and the combined exponent and significand, e. - // - - unsigned short s = _h & 0x8000; - unsigned short e = _h & 0x7fff; - - // - // Round the exponent and significand to the nearest value - // where ones occur only in the (10-n) most significant bits. - // Note that the exponent adjusts automatically if rounding - // up causes the significand to overflow. - // - - e >>= 9 - n; - e += e & 1; - e <<= 9 - n; - - // - // Check for exponent overflow. - // - - if (e >= 0x7c00) - { - // - // Overflow occurred -- truncate instead of rounding. - // - - e = _h; - e >>= 10 - n; - e <<= 10 - n; - } - - // - // Put the original sign bit back. - // - - half h; - h._h = s | e; - - return h; -} - - -//----------------------- -// Other inline functions -//----------------------- - -inline half -half::operator - () const -{ - half h; - h._h = _h ^ 0x8000; - return h; -} - - -inline half & -half::operator = (half h) -{ - _h = h._h; - return *this; -} - - -inline half & -half::operator = (float f) -{ - *this = half (f); - return *this; -} - - -inline half & -half::operator += (half h) -{ - *this = half (float (*this) + float (h)); - return *this; -} - - -inline half & -half::operator += (float f) -{ - *this = half (float (*this) + f); - return *this; -} - - -inline half & -half::operator -= (half h) -{ - *this = half (float (*this) - float (h)); - return *this; -} - - -inline half & -half::operator -= (float f) -{ - *this = half (float (*this) - f); - return *this; -} - - -inline half & -half::operator *= (half h) -{ - *this = half (float (*this) * float (h)); - return *this; -} - - -inline half & -half::operator *= (float f) -{ - *this = half (float (*this) * f); - return *this; -} - - -inline half & -half::operator /= (half h) -{ - *this = half (float (*this) / float (h)); - return *this; -} - - -inline half & -half::operator /= (float f) -{ - *this = half (float (*this) / f); - return *this; -} - - -inline bool -half::isFinite () const -{ - unsigned short e = (_h >> 10) & 0x001f; - return e < 31; -} - - -inline bool -half::isNormalized () const -{ - unsigned short e = (_h >> 10) & 0x001f; - return e > 0 && e < 31; -} - - -inline bool -half::isDenormalized () const -{ - unsigned short e = (_h >> 10) & 0x001f; - unsigned short m = _h & 0x3ff; - return e == 0 && m != 0; -} - - -inline bool -half::isZero () const -{ - return (_h & 0x7fff) == 0; -} - - -inline bool -half::isNan () const -{ - unsigned short e = (_h >> 10) & 0x001f; - unsigned short m = _h & 0x3ff; - return e == 31 && m != 0; -} - - -inline bool -half::isInfinity () const -{ - unsigned short e = (_h >> 10) & 0x001f; - unsigned short m = _h & 0x3ff; - return e == 31 && m == 0; -} - - -inline bool -half::isNegative () const -{ - return (_h & 0x8000) != 0; -} - - -inline half -half::posInf () -{ - half h; - h._h = 0x7c00; - return h; -} - - -inline half -half::negInf () -{ - half h; - h._h = 0xfc00; - return h; -} - - -inline half -half::qNan () -{ - half h; - h._h = 0x7fff; - return h; -} - - -inline half -half::sNan () -{ - half h; - h._h = 0x7dff; - return h; -} - - -inline unsigned short -half::bits () const -{ - return _h; -} - - -inline void -half::setBits (unsigned short bits) -{ - _h = bits; -} - -#undef HALF_EXPORT_CONST - -#endif diff --git a/3rdparty/include/OpenEXR/halfFunction.h b/3rdparty/include/OpenEXR/halfFunction.h deleted file mode 100644 index 19838802e0..0000000000 --- a/3rdparty/include/OpenEXR/halfFunction.h +++ /dev/null @@ -1,159 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - -// Primary authors: -// Florian Kainz -// Rod Bogart - - -//--------------------------------------------------------------------------- -// -// halfFunction -- a class for fast evaluation -// of half --> T functions -// -// The constructor for a halfFunction object, -// -// halfFunction (function, -// domainMin, domainMax, -// defaultValue, -// posInfValue, negInfValue, -// nanValue); -// -// evaluates the function for all finite half values in the interval -// [domainMin, domainMax], and stores the results in a lookup table. -// For finite half values that are not in [domainMin, domainMax], the -// constructor stores defaultValue in the table. For positive infinity, -// negative infinity and NANs, posInfValue, negInfValue and nanValue -// are stored in the table. -// -// The tabulated function can then be evaluated quickly for arbitrary -// half values by calling the the halfFunction object's operator() -// method. -// -// Example: -// -// #include -// #include -// -// halfFunction hsin (sin); -// -// halfFunction hsqrt (sqrt, // function -// 0, HALF_MAX, // domain -// half::qNan(), // sqrt(x) for x < 0 -// half::posInf(), // sqrt(+inf) -// half::qNan(), // sqrt(-inf) -// half::qNan()); // sqrt(nan) -// -// half x = hsin (1); -// half y = hsqrt (3.5); -// -//--------------------------------------------------------------------------- - -#ifndef _HALF_FUNCTION_H_ -#define _HALF_FUNCTION_H_ - -#include -#include "half.h" - - -template -class halfFunction -{ - public: - - //------------ - // Constructor - //------------ - - template - halfFunction (Function f, - half domainMin = -HALF_MAX, - half domainMax = HALF_MAX, - T defaultValue = 0, - T posInfValue = 0, - T negInfValue = 0, - T nanValue = 0); - - //----------- - // Evaluation - //----------- - - T operator () (half x) const; - - private: - - T _lut[1 << 16]; -}; - - -//--------------- -// Implementation -//--------------- - -template -template -halfFunction::halfFunction (Function f, - half domainMin, - half domainMax, - T defaultValue, - T posInfValue, - T negInfValue, - T nanValue) -{ - for (int i = 0; i < (1 << 16); i++) - { - half x; - x.setBits (i); - - if (x.isNan()) - _lut[i] = nanValue; - else if (x.isInfinity()) - _lut[i] = x.isNegative()? negInfValue: posInfValue; - else if (x < domainMin || x > domainMax) - _lut[i] = defaultValue; - else - _lut[i] = f (x); - } -} - - -template -inline T -halfFunction::operator () (half x) const -{ - return _lut[x.bits()]; -} - - -#endif diff --git a/3rdparty/include/OpenEXR/halfLimits.h b/3rdparty/include/OpenEXR/halfLimits.h deleted file mode 100644 index 404f58936b..0000000000 --- a/3rdparty/include/OpenEXR/halfLimits.h +++ /dev/null @@ -1,102 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// -// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas -// Digital Ltd. LLC -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Industrial Light & Magic nor the names of -// its contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////// - - -// Primary authors: -// Florian Kainz -// Rod Bogart - - -#ifndef INCLUDED_HALF_LIMITS_H -#define INCLUDED_HALF_LIMITS_H - - -//------------------------------------------------------------------------ -// -// C++ standard library-style numeric_limits for class half -// -//------------------------------------------------------------------------ - -#include -#include "half.h" - -namespace std { - -template <> -class numeric_limits -{ - public: - - static const bool is_specialized = true; - - static half min () throw () {return HALF_NRM_MIN;} - static half max () throw () {return HALF_MAX;} - - static const int digits = HALF_MANT_DIG; - static const int digits10 = HALF_DIG; - static const bool is_signed = true; - static const bool is_integer = false; - static const bool is_exact = false; - static const int radix = HALF_RADIX; - static half epsilon () throw () {return HALF_EPSILON;} - static half round_error () throw () {return HALF_EPSILON / 2;} - - static const int min_exponent = HALF_MIN_EXP; - static const int min_exponent10 = HALF_MIN_10_EXP; - static const int max_exponent = HALF_MAX_EXP; - static const int max_exponent10 = HALF_MAX_10_EXP; - - static const bool has_infinity = true; - static const bool has_quiet_NaN = true; - static const bool has_signaling_NaN = true; - static const float_denorm_style has_denorm = denorm_present; - static const bool has_denorm_loss = false; - static half infinity () throw () {return half::posInf();} - static half quiet_NaN () throw () {return half::qNan();} - static half signaling_NaN () throw () {return half::sNan();} - static half denorm_min () throw () {return HALF_MIN;} - - static const bool is_iec559 = false; - static const bool is_bounded = false; - static const bool is_modulo = false; - - static const bool traps = true; - static const bool tinyness_before = false; - static const float_round_style round_style = round_to_nearest; -}; - - -} // namespace std - -#endif diff --git a/3rdparty/lib/Half.lib b/3rdparty/lib/Half.lib deleted file mode 100644 index 8c066c462f..0000000000 Binary files a/3rdparty/lib/Half.lib and /dev/null differ diff --git a/3rdparty/lib/Iex.lib b/3rdparty/lib/Iex.lib deleted file mode 100644 index c78b56cc8c..0000000000 Binary files a/3rdparty/lib/Iex.lib and /dev/null differ diff --git a/3rdparty/lib/IlmImf.lib b/3rdparty/lib/IlmImf.lib deleted file mode 100644 index e1de904a70..0000000000 Binary files a/3rdparty/lib/IlmImf.lib and /dev/null differ diff --git a/3rdparty/lib/IlmThread.lib b/3rdparty/lib/IlmThread.lib deleted file mode 100644 index 57ecb349be..0000000000 Binary files a/3rdparty/lib/IlmThread.lib and /dev/null differ diff --git a/3rdparty/lib/Imath.lib b/3rdparty/lib/Imath.lib deleted file mode 100644 index 4827a42f91..0000000000 Binary files a/3rdparty/lib/Imath.lib and /dev/null differ diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aafdf94ad..5a1af024a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,6 +260,7 @@ set(WITH_PNG ON CACHE BOOL "Include PNG support") set(WITH_JPEG ON CACHE BOOL "Include JPEG support") set(WITH_JASPER ON CACHE BOOL "Include JPEG2K support") set(WITH_TIFF ON CACHE BOOL "Include TIFF support") +set(WITH_OPENEXR ON CACHE BOOL "Include ILM support via OpenEXR") if(UNIX) set(WITH_FFMPEG ON CACHE BOOL "Include FFMPEG support") @@ -449,6 +450,10 @@ if(UNIX) endif() endif() +if(WITH_OPENEXR) + include(OpenCVFindOpenEXR.cmake) +endif() + set(BUILD_NEW_PYTHON_SUPPORT ON CACHE BOOL "Build with Python support") if(BUILD_NEW_PYTHON_SUPPORT) @@ -1216,6 +1221,12 @@ else() message(STATUS " JPEG 2000: build") endif() +if(WITH_OPENEXR AND OPENEXR_FOUND) +message(STATUS " OpenEXR: YES") +else() +message(STATUS " OpenEXR: NO") +endif() + if(UNIX AND NOT APPLE) message(STATUS "") message(STATUS " Video I/O: ") diff --git a/OpenCVFindOpenEXR.cmake b/OpenCVFindOpenEXR.cmake new file mode 100644 index 0000000000..72c652ca9a --- /dev/null +++ b/OpenCVFindOpenEXR.cmake @@ -0,0 +1,77 @@ +# The script is taken f + +# +# Try to find OpenEXR's libraries, and include path. +# Once done this will define: +# +# OPENEXR_FOUND = OpenEXR found. +# OPENEXR_INCLUDE_PATHS = OpenEXR include directories. +# OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. +# + +INCLUDE(FindZLIB) + + +IF(ZLIB_FOUND) + + SET(LIBRARY_PATHS + /usr/lib + /usr/local/lib + /sw/lib + /opt/local/lib + $ENV{PROGRAM_FILES}/OpenEXR/lib/static) + + FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h + PATH_SUFFIXES OpenEXR + /usr/include + /usr/local/include + /sw/include + /opt/local/include) + + FIND_LIBRARY(OPENEXR_HALF_LIBRARY + NAMES Half + PATHS ${LIBRARY_PATHS}) + + FIND_LIBRARY(OPENEXR_IEX_LIBRARY + NAMES Iex + PATHS ${LIBRARY_PATHS}) + + FIND_LIBRARY(OPENEXR_IMATH_LIBRARY + NAMES Imath + PATHS ${LIBRARY_PATHS}) + + FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY + NAMES IlmImf + PATHS ${LIBRARY_PATHS}) + + FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY + NAMES IlmThread + PATHS ${LIBRARY_PATHS}) + +ENDIF(ZLIB_FOUND) + +#MESSAGE(STATUS ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY}) + +IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) + SET(OPENEXR_FOUND TRUE) + SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR") + SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} ${ZLIB_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR") +ENDIF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) + +IF(OPENEXR_FOUND) + IF(NOT OPENEXR_FIND_QUIETLY) + MESSAGE(STATUS "Found OpenEXR: ${OPENEXR_ILMIMF_LIBRARY}") + ENDIF(NOT OPENEXR_FIND_QUIETLY) +ELSE(OPENEXR_FOUND) + IF(OPENEXR_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "Could not find OpenEXR library") + ENDIF(OPENEXR_FIND_REQUIRED) +ENDIF(OPENEXR_FOUND) + +MARK_AS_ADVANCED( + OPENEXR_INCLUDE_PATHS + OPENEXR_LIBRARIES + OPENEXR_ILMIMF_LIBRARY + OPENEXR_IMATH_LIBRARY + OPENEXR_IEX_LIBRARY + OPENEXR_HALF_LIBRARY) diff --git a/OpenCVFindTBB.cmake b/OpenCVFindTBB.cmake deleted file mode 100644 index cba87cdf29..0000000000 --- a/OpenCVFindTBB.cmake +++ /dev/null @@ -1,191 +0,0 @@ -# Locate Intel Threading Building Blocks include paths and libraries -# TBB can be found at http://www.threadingbuildingblocks.org/ -# Written by Hannes Hofmann, hannes.hofmann _at_ informatik.uni-erlangen.de -# Adapted by Gino van den Bergen gino _at_ dtecta.com - -# GvdB: This module uses the environment variable TBB_ARCH_PLATFORM which defines architecture and compiler. -# e.g. "ia32/vc8" or "em64t/cc4.1.0_libc2.4_kernel2.6.16.21" -# TBB_ARCH_PLATFORM is set by the build script tbbvars[.bat|.sh|.csh], which can be found -# in the TBB installation directory (TBB_INSTALL_DIR). -# -# For backwards compatibility, you may explicitely set the CMake variables TBB_ARCHITECTURE and TBB_COMPILER. -# TBB_ARCHITECTURE [ ia32 | em64t | itanium ] -# which architecture to use -# TBB_COMPILER e.g. vc9 or cc3.2.3_libc2.3.2_kernel2.4.21 or cc4.0.1_os10.4.9 -# which compiler to use (detected automatically on Windows) - -# This module respects -# TBB_INSTALL_DIR or $ENV{TBB22_INSTALL_DIR} or $ENV{TBB_INSTALL_DIR} - -# This module defines -# TBB_INCLUDE_DIRS, where to find task_scheduler_init.h, etc. -# TBB_LIBRARY_DIRS, where to find libtbb, libtbbmalloc -# TBB_INSTALL_DIR, the base TBB install directory -# TBB_LIBRARIES, the libraries to link against to use TBB. -# TBB_DEBUG_LIBRARIES, the libraries to link against to use TBB with debug symbols. -# TBB_FOUND, If false, don't try to use TBB. - - -if (WIN32) - # has em64t/vc8 em64t/vc9 - # has ia32/vc7.1 ia32/vc8 ia32/vc9 - set(_TBB_DEFAULT_INSTALL_DIR "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB") - set(_TBB_LIB_NAME "tbb") - set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") - set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") - set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") - if (MSVC71) - set (_TBB_COMPILER "vc7.1") - endif(MSVC71) - if (MSVC80) - set(_TBB_COMPILER "vc8") - endif(MSVC80) - if (MSVC90) - set(_TBB_COMPILER "vc9") - endif(MSVC90) - if (NOT _TBB_COMPILER) - message("ERROR: TBB supports only VC 7.1, 8 and 9 compilers on Windows platforms.") - endif (NOT _TBB_COMPILER) - set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) -endif (WIN32) - -if (UNIX) - if (APPLE) - # MAC - set(_TBB_DEFAULT_INSTALL_DIR "/Library/Frameworks/Intel_TBB.framework/Versions") - # libs: libtbb.dylib, libtbbmalloc.dylib, *_debug - set(_TBB_LIB_NAME "tbb") - set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") - set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") - set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") - # has only one flavor: ia32/cc4.0.1_os10.4.9 - set(_TBB_COMPILER "cc4.0.1_os10.4.9") - set(_TBB_ARCHITECTURE "ia32") - else (APPLE) - # LINUX - set(_TBB_DEFAULT_INSTALL_DIR "/opt/intel/tbb" "/usr/local/include" "/usr/include") - set(_TBB_LIB_NAME "tbb") - set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc") - set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug") - set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug") - # has em64t/cc3.2.3_libc2.3.2_kernel2.4.21 em64t/cc3.3.3_libc2.3.3_kernel2.6.5 em64t/cc3.4.3_libc2.3.4_kernel2.6.9 em64t/cc4.1.0_libc2.4_kernel2.6.16.21 - # has ia32/* - # has itanium/* - set(_TBB_COMPILER ${TBB_COMPILER}) - set(_TBB_ARCHITECTURE ${TBB_ARCHITECTURE}) - endif (APPLE) -endif (UNIX) - -if (CMAKE_SYSTEM MATCHES "SunOS.*") -# SUN -# not yet supported -# has em64t/cc3.4.3_kernel5.10 -# has ia32/* -endif (CMAKE_SYSTEM MATCHES "SunOS.*") - - -#-- Clear the public variables -set (TBB_FOUND "NO") - - -#-- Find TBB install dir and set ${_TBB_INSTALL_DIR} and cached ${TBB_INSTALL_DIR} -# first: use CMake variable TBB_INSTALL_DIR -if (TBB_INSTALL_DIR) - set (_TBB_INSTALL_DIR ${TBB_INSTALL_DIR}) -endif (TBB_INSTALL_DIR) -# second: use environment variable -if (NOT _TBB_INSTALL_DIR) - if (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") - set (_TBB_INSTALL_DIR $ENV{TBB_INSTALL_DIR}) - endif (NOT "$ENV{TBB_INSTALL_DIR}" STREQUAL "") - # Intel recommends setting TBB22_INSTALL_DIR - if (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") - set (_TBB_INSTALL_DIR $ENV{TBB22_INSTALL_DIR}) - endif (NOT "$ENV{TBB22_INSTALL_DIR}" STREQUAL "") -endif (NOT _TBB_INSTALL_DIR) -# third: try to find path automatically -if (NOT _TBB_INSTALL_DIR) - if (_TBB_DEFAULT_INSTALL_DIR) - set (_TBB_INSTALL_DIR $ENV{_TBB_DEFAULT_INSTALL_DIR}) - endif (_TBB_DEFAULT_INSTALL_DIR) -endif (NOT _TBB_INSTALL_DIR) -# sanity check -if (NOT _TBB_INSTALL_DIR) - message ("ERROR: TBB_INSTALL_DIR not found. ${_TBB_INSTALL_DIR}") -else (NOT _TBB_INSTALL_DIR) -# finally: set the cached CMake variable TBB_INSTALL_DIR -if (NOT TBB_INSTALL_DIR) - set (TBB_INSTALL_DIR ${_TBB_INSTALL_DIR} CACHE PATH "Intel TBB install directory") - mark_as_advanced(TBB_INSTALL_DIR) -endif (NOT TBB_INSTALL_DIR) - - -#-- A macro to rewrite the paths of the library. This is necessary, because -# find_library() always found the em64t/vc9 version of the TBB libs -macro(TBB_CORRECT_LIB_DIR var_name) -# if (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") - string(REPLACE em64t "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) -# endif (NOT "${_TBB_ARCHITECTURE}" STREQUAL "em64t") - string(REPLACE ia32 "${_TBB_ARCHITECTURE}" ${var_name} ${${var_name}}) - string(REPLACE vc7.1 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) - string(REPLACE vc8 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) - string(REPLACE vc9 "${_TBB_COMPILER}" ${var_name} ${${var_name}}) -endmacro(TBB_CORRECT_LIB_DIR var_content) - - -#-- Look for include directory and set ${TBB_INCLUDE_DIR} -set (TBB_INC_SEARCH_DIR ${_TBB_INSTALL_DIR}/include) -find_path(TBB_INCLUDE_DIR - tbb/task_scheduler_init.h - PATHS ${TBB_INC_SEARCH_DIR} -) -mark_as_advanced(TBB_INCLUDE_DIR) - - -#-- Look for libraries -# GvdB: $ENV{TBB_ARCH_PLATFORM} is set by the build script tbbvars[.bat|.sh|.csh] -if (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") - set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/$ENV{TBB_ARCH_PLATFORM}/lib") -else (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") - # HH: deprecated - message(STATUS "[Warning] FindTBB.cmake: The use of TBB_ARCHITECTURE and TBB_COMPILER is deprecated and may not be supported in future versions. Please set $ENV{TBB_ARCH_PLATFORM} (using tbbvars.[bat|csh|sh]).") - set (TBB_LIBRARY_DIR "${_TBB_INSTALL_DIR}/${_TBB_ARCHITECTURE}/${_TBB_COMPILER}/lib") -endif (NOT $ENV{TBB_ARCH_PLATFORM} STREQUAL "") - - -find_library(TBB_LIBRARY ${_TBB_LIB_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH) -find_library(TBB_MALLOC_LIBRARY ${_TBB_LIB_MALLOC_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH) -#TBB_CORRECT_LIB_DIR(TBB_LIBRARY) -#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY) -mark_as_advanced(TBB_LIBRARY TBB_MALLOC_LIBRARY) - -#-- Look for debug libraries -find_library(TBB_LIBRARY_DEBUG ${_TBB_LIB_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH) -find_library(TBB_MALLOC_LIBRARY_DEBUG ${_TBB_LIB_MALLOC_DEBUG_NAME} ${TBB_LIBRARY_DIR} NO_DEFAULT_PATH) -#TBB_CORRECT_LIB_DIR(TBB_LIBRARY_DEBUG) -#TBB_CORRECT_LIB_DIR(TBB_MALLOC_LIBRARY_DEBUG) -mark_as_advanced(TBB_LIBRARY_DEBUG TBB_MALLOC_LIBRARY_DEBUG) - - -if (TBB_INCLUDE_DIR) - if (TBB_LIBRARY) - set (TBB_FOUND "YES") - set (TBB_LIBRARIES ${TBB_LIBRARY} ${TBB_MALLOC_LIBRARY} ${TBB_LIBRARIES}) - set (TBB_DEBUG_LIBRARIES ${TBB_LIBRARY_DEBUG} ${TBB_MALLOC_LIBRARY_DEBUG} ${TBB_DEBUG_LIBRARIES}) - set (TBB_INCLUDE_DIRS ${TBB_INCLUDE_DIR} CACHE PATH "TBB include directory" FORCE) - set (TBB_LIBRARY_DIRS ${TBB_LIBRARY_DIR} CACHE PATH "TBB library directory" FORCE) - mark_as_advanced(TBB_INCLUDE_DIRS TBB_LIBRARY_DIRS TBB_LIBRARIES TBB_DEBUG_LIBRARIES) - message(STATUS "Found Intel TBB") - endif (TBB_LIBRARY) -endif (TBB_INCLUDE_DIR) - -if (NOT TBB_FOUND) - message("ERROR: Intel TBB NOT found!") - message(STATUS "Looked for Threading Building Blocks in ${_TBB_INSTALL_DIR}") - # do only throw fatal, if this pkg is REQUIRED - if (TBB_FIND_REQUIRED) - message(FATAL_ERROR "Could NOT find TBB library.") - endif (TBB_FIND_REQUIRED) -endif (NOT TBB_FOUND) - -endif (NOT _TBB_INSTALL_DIR) diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index 613883c0d6..3b53374dae 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -33,6 +33,11 @@ if(WITH_JASPER) endif() endif() +if(WITH_OPENEXR AND OPENEXR_FOUND) + add_definitions(-DHAVE_OPENEXR) + include_directories(${OPENEXR_INCLUDE_PATHS}) +endif() + if(use_3rdparty) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include") endif() @@ -282,7 +287,7 @@ endif(MSVC) add_dependencies(${the_target} opencv_core opencv_imgproc) # Add the required libraries for linking: -target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES}) +target_link_libraries(${the_target} ${OPENCV_LINKER_LIBS} opencv_core opencv_imgproc ${JPEG_LIBRARIES} ${PNG_LIBRARIES} ${TIFF_LIBRARIES} ${JASPER_LIBRARIES} ${HIGHGUI_LIBRARIES} ${OPENEXR_LIBRARIES}) if(WITH_JASPER AND NOT JASPER_FOUND) add_dependencies(${the_target} libjasper) diff --git a/modules/highgui/src/grfmt_exr.cpp b/modules/highgui/src/grfmt_exr.cpp index 2ff57b7bf3..e441adaba3 100644 --- a/modules/highgui/src/grfmt_exr.cpp +++ b/modules/highgui/src/grfmt_exr.cpp @@ -42,14 +42,14 @@ #include "precomp.hpp" -#ifdef HAVE_ILMIMF - -#include -#include -#include -#include -#include -#include +#ifdef HAVE_OPENEXR + +#include +#include +#include +#include +#include +#include #include "grfmt_exr.hpp" #if defined _MSC_VER && _MSC_VER >= 1200 @@ -65,8 +65,6 @@ #define HALF ((Imf::PixelType)1) #undef FLOAT #define FLOAT ((Imf::PixelType)2) -#undef uint -#define uint unsigned #endif @@ -78,7 +76,7 @@ namespace cv ExrDecoder::ExrDecoder() { m_signature = "\x76\x2f\x31\x01"; - m_file = new InputFile( filename ); + m_file = 0; m_red = m_green = m_blue = 0; } @@ -102,6 +100,8 @@ bool ExrDecoder::readHeader() { bool result = false; + m_file = new InputFile( m_filename.c_str() ); + if( !m_file ) // probably paranoid return false; @@ -166,7 +166,7 @@ bool ExrDecoder::readHeader() } if( !result ) - Close(); + close(); return result; } @@ -342,10 +342,10 @@ bool ExrDecoder::readData( Mat& img ) } else { - uint *ui = (uint *)buffer; + unsigned *ui = (unsigned *)buffer; for( x = 0; x < m_width * 3; x++) { - uint t = ui[x]; + unsigned t = ui[x]; out[x] = CV_CAST_8U(t); } } @@ -369,7 +369,7 @@ bool ExrDecoder::readData( Mat& img ) if( chromatorgb ) ChromaToBGR( (float *)data, m_height, step / xstep ); - Close(); + close(); return result; } @@ -393,7 +393,7 @@ void ExrDecoder::UpSample( uchar *data, int xstep, int ystep, int xsample, int else if( m_type == FLOAT ) ((float *)data)[(yre + i) * ystep + (xre + n) * xstep] = ((float *)data)[y * ystep + x * xstep]; else - ((uint *)data)[(yre + i) * ystep + (xre + n) * xstep] = ((uint *)data)[y * ystep + x * xstep]; + ((unsigned *)data)[(yre + i) * ystep + (xre + n) * xstep] = ((unsigned *)data)[y * ystep + x * xstep]; } } } @@ -413,7 +413,7 @@ void ExrDecoder::UpSampleX( float *data, int xstep, int xsample ) if( m_type == FLOAT ) ((float *)data)[(xre + n) * xstep] = ((float *)data)[x * xstep]; else - ((uint *)data)[(xre + n) * xstep] = ((uint *)data)[x * xstep]; + ((unsigned *)data)[(xre + n) * xstep] = ((unsigned *)data)[x * xstep]; } } } @@ -435,7 +435,7 @@ void ExrDecoder::UpSampleY( uchar *data, int xstep, int ystep, int ysample ) else if( m_type == FLOAT ) ((float *)data)[(yre + i) * ystep + x * xstep] = ((float *)data)[y * ystep + x * xstep]; else - ((uint *)data)[(yre + i) * ystep + x * xstep] = ((uint *)data)[y * ystep + x * xstep]; + ((unsigned *)data)[(yre + i) * ystep + x * xstep] = ((unsigned *)data)[y * ystep + x * xstep]; } } } @@ -446,11 +446,9 @@ void ExrDecoder::UpSampleY( uchar *data, int xstep, int ystep, int ysample ) */ void ExrDecoder::ChromaToBGR( float *data, int numlines, int step ) { - int x, y, t; - - for( y = 0; y < numlines; y++ ) + for( int y = 0; y < numlines; y++ ) { - for( x = 0; x < m_width; x++ ) + for( int x = 0; x < m_width; x++ ) { double b, Y, r; if( !m_native_depth ) @@ -467,9 +465,9 @@ void ExrDecoder::ChromaToBGR( float *data, int numlines, int step ) } else { - b = ((uint *)data)[y * step + x * 3]; - Y = ((uint *)data)[y * step + x * 3 + 1]; - r = ((uint *)data)[y * step + x * 3 + 2]; + b = ((unsigned *)data)[y * step + x * 3]; + Y = ((unsigned *)data)[y * step + x * 3 + 1]; + r = ((unsigned *)data)[y * step + x * 3 + 2]; } r = (r + 1) * Y; b = (b + 1) * Y; @@ -493,11 +491,11 @@ void ExrDecoder::ChromaToBGR( float *data, int numlines, int step ) else { int t = cvRound(b); - ((uint *)data)[y * step + x * 3] = (uint)MAX(t,0); + ((unsigned *)data)[y * step + x * 3] = (unsigned)MAX(t,0); t = cvRound(Y); - ((uint *)data)[y * step + x * 3 + 1] = (uint)MAX(t,0); + ((unsigned *)data)[y * step + x * 3 + 1] = (unsigned)MAX(t,0); t = cvRound(r); - ((uint *)data)[y * step + x * 3 + 2] = (uint)MAX(t,0); + ((unsigned *)data)[y * step + x * 3 + 2] = (unsigned)MAX(t,0); } } } @@ -527,7 +525,7 @@ void ExrDecoder::RGBToGray( float *in, float *out ) { if( m_native_depth ) { - uint *ui = (uint *)in; + unsigned *ui = (unsigned *)in; for( int i = 0; i < m_width * 3; i++ ) ui[i] -= 0x80000000; int *si = (int *)in; @@ -536,13 +534,19 @@ void ExrDecoder::RGBToGray( float *in, float *out ) } else // how to best convert float to uchar? { - uint *ui = (uint *)in; + unsigned *ui = (unsigned *)in; for( int i = 0, n = 0; i < m_width; i++, n += 3 ) ((uchar *)out)[i] = uchar((ui[n] * m_chroma.blue[0] + ui[n + 1] * m_chroma.green[0] + ui[n + 2] * m_chroma.red[0]) * (256.0 / 4294967296.0)); } } } + +ImageDecoder ExrDecoder::newDecoder() const +{ + return new ExrDecoder; +} + /////////////////////// ExrEncoder /////////////////// @@ -564,7 +568,7 @@ bool ExrEncoder::isFormatSupported( int depth ) const // TODO scale appropriately -bool ExrEncoder::write( const Mat& img, const Vector& ) +bool ExrEncoder::write( const Mat& img, const vector& ) { int width = img.cols, height = img.rows; int depth = img.depth(), channels = img.channels(); @@ -613,7 +617,7 @@ bool ExrEncoder::write( const Mat& img, const Vector& ) } else if( depth > 16 || type == UINT ) { - buffer = (char *)new uint[width * channels]; + buffer = (char *)new unsigned[width * channels]; bufferstep = 0; size = 4; } @@ -659,7 +663,7 @@ bool ExrEncoder::write( const Mat& img, const Vector& ) { if(type == UINT) { - uint *buf = (uint *)buffer; // FIXME 64-bit problems + unsigned *buf = (unsigned*)buffer; // FIXME 64-bit problems if( depth <= 8 ) { @@ -676,7 +680,7 @@ bool ExrEncoder::write( const Mat& img, const Vector& ) { int *sd = (int *)data; // FIXME 64-bit problems for(int i = 0; i < width * channels; i++) - buf[i] = (uint) sd[i] + offset; + buf[i] = (unsigned) sd[i] + offset; } } else @@ -712,6 +716,12 @@ bool ExrEncoder::write( const Mat& img, const Vector& ) return result; } + +ImageEncoder ExrEncoder::newEncoder() const +{ + return new ExrEncoder; +} + } #endif diff --git a/modules/highgui/src/grfmt_exr.hpp b/modules/highgui/src/grfmt_exr.hpp index 6ed5614314..04aec365ec 100644 --- a/modules/highgui/src/grfmt_exr.hpp +++ b/modules/highgui/src/grfmt_exr.hpp @@ -43,7 +43,7 @@ #ifndef _GRFMT_EXR_H_ #define _GRFMT_EXR_H_ -#ifdef HAVE_ILMIMF +#ifdef HAVE_OPENEXR #include #include @@ -87,6 +87,10 @@ protected: const Channel *m_green; const Channel *m_blue; Chromaticities m_chroma; + int m_bit_depth; + bool m_native_depth; + bool m_iscolor; + bool m_isfloat; }; @@ -97,7 +101,7 @@ public: ~ExrEncoder(); bool isFormatSupported( int depth ) const; - bool write( const Mat& img, const Vector& params ); + bool write( const Mat& img, const vector& params ); ImageEncoder newEncoder() const; }; diff --git a/modules/highgui/src/loadsave.cpp b/modules/highgui/src/loadsave.cpp index a29ec2373e..977bfd2cc8 100644 --- a/modules/highgui/src/loadsave.cpp +++ b/modules/highgui/src/loadsave.cpp @@ -175,7 +175,7 @@ struct ImageCodecInitializer decoders.push_back( new Jpeg2KDecoder ); encoders.push_back( new Jpeg2KEncoder ); #endif - #ifdef HAVE_ILMIMF + #ifdef HAVE_OPENEXR decoders.push_back( new ExrDecoder ); encoders.push_back( new ExrEncoder ); #endif diff --git a/modules/highgui/src/precomp.hpp b/modules/highgui/src/precomp.hpp index 2f1da1149b..ad35839f50 100644 --- a/modules/highgui/src/precomp.hpp +++ b/modules/highgui/src/precomp.hpp @@ -108,7 +108,7 @@ struct CvVideoWriter #endif /* uncomment to enable OpenEXR codec (will not compile under MSVC6) */ -//#define HAVE_ILMIMF 1 +//#define HAVE_OPENEXR 1 /* uncomment to enable CMUCamera1394 fireware camera module */ //#define HAVE_CMU1394 1