Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,20 @@ IF(USE_CONAN)
ENDIF()

SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
FIND_PACKAGE ( IlmBase REQUIRED )
FIND_PACKAGE ( OpenEXR REQUIRED )
FIND_PACKAGE ( IlmBase QUIET )
IF(IlmBase_FOUND)
FIND_PACKAGE ( OpenEXR REQUIRED )
ELSE()
FIND_PACKAGE ( Imath REQUIRED CONFIG )
FIND_PACKAGE ( OpenEXR REQUIRED CONFIG )
ADD_COMPILE_DEFINITIONS(OPENEXRID_USE_IMATH3)
IF(TARGET OpenEXR::OpenEXR)
SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR)
ENDIF()
IF(TARGET Imath::Imath)
LIST(APPEND OPENEXR_LIBRARIES Imath::Imath)
ENDIF()
ENDIF()
FIND_PACKAGE ( ZLIB REQUIRED )
FIND_PACKAGE ( OpenGL REQUIRED )

Expand Down
21 changes: 14 additions & 7 deletions nuke/OSL/include/OSL/matrix22.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once


#ifdef OPENEXRID_USE_IMATH3
#include <Imath/ImathMatrix.h>
#else
#include <OpenEXR/ImathMatrix.h>
#endif

#include <limits>
#include <stdexcept>

namespace Imathx { // "extended" Imath

Expand Down Expand Up @@ -225,7 +232,7 @@ template <class T> class Matrix22
//------------------------------------------------------------
// 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.
// inverting a singular matrix throws an exception.
//
// inverse() and invert() invert matrices using determinants.
//
Expand Down Expand Up @@ -279,10 +286,10 @@ template <class T> class Matrix22
// Limitations of type T (see also class limits<T>)
//-------------------------------------------------

static T baseTypeMin() {return Imath::limits<T>::min();}
static T baseTypeMax() {return Imath::limits<T>::max();}
static T baseTypeSmallest() {return Imath::limits<T>::smallest();}
static T baseTypeEpsilon() {return Imath::limits<T>::epsilon();}
static T baseTypeMin() {return std::numeric_limits<T>::min();}
static T baseTypeMax() {return std::numeric_limits<T>::max();}
static T baseTypeSmallest() {return std::numeric_limits<T>::min();}
static T baseTypeEpsilon() {return std::numeric_limits<T>::epsilon();}

private:

Expand Down Expand Up @@ -778,7 +785,7 @@ Matrix22<T>::inverse (bool singExc) const
}
else
{
T mr = Imath::abs (r) / Imath::limits<T>::smallest();
T mr = Imath::abs (r) / std::numeric_limits<T>::min();

for (int i = 0; i < 2; ++i)
{
Expand All @@ -791,7 +798,7 @@ Matrix22<T>::inverse (bool singExc) const
else
{
if (singExc)
throw Imath::SingMatrixExc ("Cannot invert "
throw std::invalid_argument ("Cannot invert "
"singular matrix.");
return Matrix22();
}
Expand Down
8 changes: 7 additions & 1 deletion nuke/OSL/include/OSL/oslconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Symbol export defines
#include "export.h"

// All the things we need from Imath
// All the things we need from Imath. OpenEXR 3 split Imath into its own include path.
#ifdef OPENEXRID_USE_IMATH3
#include <Imath/ImathVec.h>
#include <Imath/ImathColor.h>
#include <Imath/ImathMatrix.h>
#else
#include <OpenEXR/ImathVec.h>
#include <OpenEXR/ImathColor.h>
#include <OpenEXR/ImathMatrix.h>
#endif

// All the things we need from OpenImageIO
#include <OpenImageIO/version.h>
Expand Down