From e7bfc7d845dd59bf412b2cb2db2a0e460ffe1c29 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 11 Jun 2012 15:51:17 -0700 Subject: [PATCH 01/25] Fix for reworking the order of include and library paths - (Barnaby Robson) Barnaby Robson reports that while trying to build PyImbase with a non system python version and boost python library the custom boost python directories ahead of the python directories because the python directories might just be the system directories which might contain a different boost python library. https://github.com/openexr/openexr/pull/8 This is a manual fix since the pull request was out of sync --- PyIlmBase/configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyIlmBase/configure.ac b/PyIlmBase/configure.ac index 46911900ca..8d92401873 100644 --- a/PyIlmBase/configure.ac +++ b/PyIlmBase/configure.ac @@ -85,8 +85,8 @@ AC_ARG_WITH( [AS_HELP_STRING([--with-boost-python-libname],["boost::python library name (default: boost_python)"])], [BOOST_PYTHON_LIBNAME="$withval"]) -CXXFLAGS="$CXXFLAGS -I$PYTHON_INC_DIR $BOOST_PYTHON_CXXFLAGS" -LDFLAGS="$LDFLAGS -L$PYTHON_LIB_DIR $BOOST_PYTHON_LDFLAGS" +CXXFLAGS="$CXXFLAGS $BOOST_PYTHON_CXXFLAGS -I$PYTHON_INC_DIR" +LDFLAGS="$LDFLAGS $BOOST_PYTHON_LDFLAGS -L$PYTHON_LIB_DIR" BOOST_PYTHON_LIBS="-l$BOOST_PYTHON_LIBNAME" From 602b66852bd338723265a8b4f120777a58346ecd Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Tue, 3 Jul 2012 20:18:37 -0700 Subject: [PATCH 02/25] Fix type errors in 3D box transformation --- IlmBase/Imath/ImathBoxAlgo.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/IlmBase/Imath/ImathBoxAlgo.h b/IlmBase/Imath/ImathBoxAlgo.h index 54bd71a803..3d6e4e0c69 100644 --- a/IlmBase/Imath/ImathBoxAlgo.h +++ b/IlmBase/Imath/ImathBoxAlgo.h @@ -195,7 +195,7 @@ transform (const Box< Vec3 > &box, const Matrix44 &m) for (int j = 0; j < 3; j++) { - float a, b; + S a, b; a = (S) m[j][i] * box.min[j]; b = (S) m[j][i] * box.max[j]; @@ -279,7 +279,7 @@ transform (const Box< Vec3 > &box, for (int j = 0; j < 3; j++) { - float a, b; + S a, b; a = (S) m[j][i] * box.min[j]; b = (S) m[j][i] * box.max[j]; @@ -352,7 +352,7 @@ affineTransform (const Box< Vec3 > &box, const Matrix44 &m) for (int j = 0; j < 3; j++) { - float a, b; + S a, b; a = (S) m[j][i] * box.min[j]; b = (S) m[j][i] * box.max[j]; @@ -412,7 +412,7 @@ affineTransform (const Box< Vec3 > &box, for (int j = 0; j < 3; j++) { - float a, b; + S a, b; a = (S) m[j][i] * box.min[j]; b = (S) m[j][i] * box.max[j]; From c5f2dd17410854c229376570a6dffd24a6c27fa2 Mon Sep 17 00:00:00 2001 From: Peter Hillman Date: Thu, 12 Jul 2012 11:37:24 +1200 Subject: [PATCH 03/25] added missing stdint.h for uint16_t --- IlmBase/IexMath/IexMathFpu.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/IlmBase/IexMath/IexMathFpu.cpp b/IlmBase/IexMath/IexMathFpu.cpp index ef70951ea1..c0e26595e6 100644 --- a/IlmBase/IexMath/IexMathFpu.cpp +++ b/IlmBase/IexMath/IexMathFpu.cpp @@ -31,6 +31,7 @@ #include #include #include +#include namespace Iex { From 6ad79ff8e515da5430097ba3652b55f879452e24 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 16 Jul 2012 19:59:37 -0700 Subject: [PATCH 04/25] updating the file types for git to ignore. --- .gitignore | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3d3cbab767..3744544d93 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,9 @@ depcomp install-sh ltmain.sh missing -*.o *.lo *.pc *.la +*.o +*.lo +*.so +*.Po +*.la +*.dylib From 925a59350619399852a0ec1e252d8304494476b1 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 16 Jul 2012 20:10:45 -0700 Subject: [PATCH 05/25] Cleaning up an OS X compiler flag --- OpenEXR_Viewers/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenEXR_Viewers/configure.ac b/OpenEXR_Viewers/configure.ac index fa7a1ee70e..cdfbed1e3a 100644 --- a/OpenEXR_Viewers/configure.ac +++ b/OpenEXR_Viewers/configure.ac @@ -239,7 +239,7 @@ Please re-run configure with these options: dnl LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -arch i386" fi - CXXFLAGS="$CXXFLAGS -Wno-long-double" + CXXFLAGS="$CXXFLAGS" ;; esac From 9a14cc2d42a0f6f0d98b5a0a56c17fb7fe605e84 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 16 Jul 2012 21:11:17 -0700 Subject: [PATCH 06/25] Adding .Plo to the list of ignorable file types --- .gitignore | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 3744544d93..a1761ef5a6 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,9 @@ depcomp install-sh ltmain.sh missing -*.o -*.lo +*.o +*.lo +*.Plo *.so *.Po *.la From 5cbe4e9bc3d85b2a8258704f60d88d9f87eafe90 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 16 Jul 2012 21:18:18 -0700 Subject: [PATCH 07/25] Updated the Changelog --- IlmBase/ChangeLog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/IlmBase/ChangeLog b/IlmBase/ChangeLog index 0c707825b9..3516a77a16 100644 --- a/IlmBase/ChangeLog +++ b/IlmBase/ChangeLog @@ -1,4 +1,10 @@ Version 1.0.3 + * Fixed a number of missing includes to comply with stricter + enforcement by gnu compilers. + (Piotr Stanczyk) + * Depracated compiler flag: -Wno-long-double since it is no longer + supported under OS X. + (Piotr Stanczyk) * A minor API change to Imath::Frustum has been made: the functions 'near' and 'far' have been renamed to 'nearPlane' and 'farPlane' due to conflicts with certain windows headers. The former alternate From 7a60afbb66e9c74f2ab63f82d792158ca5e3d291 Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 16 Jul 2012 21:33:54 -0700 Subject: [PATCH 08/25] Fixing the order of the includes. --- OpenEXR_Viewers/exrdisplay/Makefile.am | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenEXR_Viewers/exrdisplay/Makefile.am b/OpenEXR_Viewers/exrdisplay/Makefile.am index 07f0055810..a5044177b0 100644 --- a/OpenEXR_Viewers/exrdisplay/Makefile.am +++ b/OpenEXR_Viewers/exrdisplay/Makefile.am @@ -4,12 +4,14 @@ if HAVE_FLTK bin_PROGRAMS = exrdisplay -INCLUDES = @GL_CXXFLAGS@ @CG_CXXFLAGS@ @FLTK_CXXFLAGS@ -I$(top_builddir) \ +INCLUDES = @OPENEXR_CXXFLAGS@ \ + @GL_CXXFLAGS@ @CG_CXXFLAGS@ @FLTK_CXXFLAGS@ -I$(top_builddir) \ @OPENEXR_CTL_CXXFLAGS@ -LDADD = @CG_LDFLAGS@ @FLTK_LDFLAGS@ \ - @OPENEXR_CTL_LDFLAGS@ \ - @OPENEXR_CTL_LIBS@ +LDADD = @OPENEXR_LDFLAGS@ @OPENEXR_LIBS@ \ + @OPENEXR_CTL_LDFLAGS@ @OPENEXR_CTL_LIBS@ \ + @CG_LDFLAGS@ @FLTK_LDFLAGS@ + all-local: @FLTK_CONFIG@ --post exrdisplay From a140f96b053e51180df68d62f240d17765f26b7e Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Wed, 18 Jul 2012 13:21:01 -0700 Subject: [PATCH 09/25] bring up to date with the pyimath-update branch. Also added .cvs ignore files to keep make dist happy. --- IlmBase/Imath/ImathNoise.cpp | 911 ++++++++++++++++++ IlmBase/Imath/ImathNoise.h | 253 +++++ IlmBase/Imath/Makefile.am | 5 +- IlmBase/vc/vc9/IlmBase/Half/Debug/.cvsignore | 17 + .../vc/vc9/IlmBase/Half/Release/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/HalfTest/.cvsignore | 17 + .../vc/vc9/IlmBase/HalfTest/Debug/.cvsignore | 17 + .../vc9/IlmBase/HalfTest/Release/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/Iex/Debug/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/Iex/Release/.cvsignore | 17 + .../vc/vc9/IlmBase/IexTest/Debug/.cvsignore | 17 + .../vc/vc9/IlmBase/IexTest/Release/.cvsignore | 17 + .../vc/vc9/IlmBase/IlmThread/Debug/.cvsignore | 17 + .../vc9/IlmBase/IlmThread/Release/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/Imath/Debug/.cvsignore | 17 + .../vc/vc9/IlmBase/Imath/Release/.cvsignore | 17 + .../vc/vc9/IlmBase/ImathTest/Debug/.cvsignore | 17 + .../vc9/IlmBase/ImathTest/Release/.cvsignore | 17 + .../vc/vc9/IlmBase/createDLL/Debug/.cvsignore | 17 + .../vc9/IlmBase/createDLL/Release/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/debug/.cvsignore | 17 + IlmBase/vc/vc9/IlmBase/release/.cvsignore | 17 + PyIlmBase/PyImath/Makefile.am | 27 +- PyIlmBase/PyImath/PyImath.cpp | 5 +- PyIlmBase/PyImath/PyImath.h | 3 + PyIlmBase/PyImath/PyImathBasicTypes.cpp | 28 +- PyIlmBase/PyImath/PyImathBasicTypes.h | 4 +- PyIlmBase/PyImath/PyImathBox.cpp | 18 + PyIlmBase/PyImath/PyImathColor.h | 6 +- PyIlmBase/PyImath/PyImathColor3.cpp | 11 + PyIlmBase/PyImath/PyImathColor3ArrayImpl.h | 84 ++ PyIlmBase/PyImath/PyImathExport.h | 29 +- PyIlmBase/PyImath/PyImathFixedArray.cpp | 3 + PyIlmBase/PyImath/PyImathFixedArray.h | 1 + PyIlmBase/PyImath/PyImathFun.h | 4 +- PyIlmBase/PyImath/PyImathNoise.cpp | 257 +++++ PyIlmBase/PyImath/PyImathNoise.h | 267 +++++ PyIlmBase/PyImath/PyImathStringArray.h | 1 + PyIlmBase/PyImath/imathmodule.cpp | 99 +- PyIlmBase/PyImathNumpy/Makefile.am | 1 + 40 files changed, 2307 insertions(+), 33 deletions(-) create mode 100644 IlmBase/Imath/ImathNoise.cpp create mode 100644 IlmBase/Imath/ImathNoise.h create mode 100755 IlmBase/vc/vc9/IlmBase/Half/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/Half/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/HalfTest/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/HalfTest/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/HalfTest/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/Iex/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/Iex/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/IexTest/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/IexTest/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/IlmThread/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/IlmThread/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/Imath/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/Imath/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/ImathTest/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/ImathTest/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/createDLL/Debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/createDLL/Release/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/debug/.cvsignore create mode 100755 IlmBase/vc/vc9/IlmBase/release/.cvsignore create mode 100644 PyIlmBase/PyImath/PyImathColor3ArrayImpl.h create mode 100644 PyIlmBase/PyImath/PyImathNoise.cpp create mode 100644 PyIlmBase/PyImath/PyImathNoise.h diff --git a/IlmBase/Imath/ImathNoise.cpp b/IlmBase/Imath/ImathNoise.cpp new file mode 100644 index 0000000000..b1ba29d54e --- /dev/null +++ b/IlmBase/Imath/ImathNoise.cpp @@ -0,0 +1,911 @@ +// +// Copyright (C) Pixar. All rights reserved. +// +// This license governs use of the accompanying software. If you +// use the software, you accept this license. If you do not accept +// the license, do not use the software. +// +// 1. Definitions +// The terms "reproduce," "reproduction," "derivative works," and +// "distribution" have the same meaning here as under U.S. +// copyright law. A "contribution" is the original software, or +// any additions or changes to the software. +// A "contributor" is any person or entity that distributes its +// contribution under this license. +// "Licensed patents" are a contributor's patent claims that read +// directly on its contribution. +// +// 2. Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, +// including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, +// royalty-free copyright license to reproduce its contribution, +// prepare derivative works of its contribution, and distribute +// its contribution or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, +// including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, +// royalty-free license under its licensed patents to make, have +// made, use, sell, offer for sale, import, and/or otherwise +// dispose of its contribution in the software or derivative works +// of the contribution in the software. +// +// 3. Conditions and Limitations +// (A) No Trademark License- This license does not grant you +// rights to use any contributor's name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over +// patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends +// automatically. +// (C) If you distribute any portion of the software, you must +// retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source +// code form, you may do so only under this license by including a +// complete copy of this license with your distribution. If you +// distribute any portion of the software in compiled or object +// code form, you may only do so under a license that complies +// with this license. +// (E) The software is licensed "as-is." You bear the risk of +// using it. The contributors give no express warranties, +// guarantees or conditions. You may have additional consumer +// rights under your local laws which this license cannot change. +// To the extent permitted under your local laws, the contributors +// exclude the implied warranties of merchantability, fitness for +// a particular purpose and non-infringement. +// + +//----------------------------------------------------- +// +// Implementation of non-template items declared in ImathNoise.h +// +//----------------------------------------------------- + +#include +#include + +namespace Imath { + +// Local namespace to avoid any possible +// conflicts +namespace { + +static const int TABSIZE = 1<<8; +static const int TABMASK = TABSIZE-1; + +// Need these structs because compiler disallows inline declaration of an array +// of templated types. +// FIXME someday? +struct gradF +{ + float x; + float y; + float z; +}; + +struct gradD +{ + double x; + double y; + double z; +}; + +// Gradient table +// Note that this gradient table is prescaled to avoid extra multiplications +#define __GRADS { \ + { 0.788314, -0.627167, -0.773665 }, \ + { 0.835654, 0.069542, 0.954034 }, \ + { 0.862828, -0.309454, 0.879260 }, \ + { 0.042682, 0.584865, 1.126696 }, \ + { 0.737730, 0.026284, 1.033633 }, \ + { 0.110664, -0.828499, 0.956388 }, \ + { 0.424872, -1.138934, 0.368302 }, \ + { 0.654991, 0.665466, -0.861089 }, \ + { 0.635469, 0.311065, -1.054870 }, \ + { 0.338959, 1.132728, -0.464077 }, \ + { 0.916530, 0.646707, 0.595883 }, \ + { 0.987652, 0.798522, 0.015472 }, \ + { 0.500117, -0.418634, -1.089937 }, \ + { -0.576124, -0.181586, 1.117337 }, \ + { 0.568912, -0.375714, -1.071686 }, \ + { -0.179357, -1.201633, 0.370459 }, \ + { -1.006695, 0.136077, -0.762483 }, \ + { 1.068612, -0.317531, -0.608748 }, \ + { 0.358635, -1.203018, 0.193550 }, \ + { -0.995783, -0.106278, 0.781316 }, \ + { -0.407784, 0.927005, -0.766622 }, \ + { 0.635842, 0.958725, 0.538411 }, \ + { 0.581987, 0.596964, 0.958258 }, \ + { 1.111869, 0.270864, 0.551103 }, \ + { 0.991703, -0.216817, 0.763445 }, \ + { -1.061301, 0.237904, 0.656030 }, \ + { -0.055740, -0.617158, 1.108757 }, \ + { 1.255156, -0.058470, -0.185734 }, \ + { -0.823359, -0.913780, -0.316890 }, \ + { -1.211957, -0.365441, -0.104626 }, \ + { 1.002084, -0.773715, -0.102592 }, \ + { -0.609635, 0.953535, 0.576585 }, \ + { 1.225272, 0.097679, 0.320154 }, \ + { 0.342458, -1.106212, 0.521874 }, \ + { -0.995704, 0.081499, -0.784386 }, \ + { -0.906387, -0.755130, 0.470716 }, \ + { -0.807056, -0.608014, -0.769619 }, \ + { 0.958624, -0.482824, -0.679156 }, \ + { 1.071986, 0.351351, -0.583722 }, \ + { 0.428542, -0.204119, -1.178143 }, \ + { 0.088317, 0.307805, 1.229141 }, \ + { 1.088993, 0.595928, 0.268879 }, \ + { 0.585054, -0.122038, -1.120782 }, \ + { -0.602183, -0.264804, 1.086548 }, \ + { -0.941179, -0.813802, -0.255425 }, \ + { 0.508118, 0.621588, 0.984264 }, \ + { -0.955647, 0.836402, -0.022417 }, \ + { 0.940401, -0.852504, 0.047080 }, \ + { 0.202505, -1.226986, 0.258515 }, \ + { 0.316072, 1.141490, -0.458730 }, \ + { 1.117972, -0.033154, 0.601973 }, \ + { 0.897958, 0.395254, -0.806708 }, \ + { -1.072434, -0.633395, -0.249058 }, \ + { -0.108024, 0.203028, -1.249177 }, \ + { 1.175307, -0.337381, -0.343747 }, \ + { -0.644246, -0.904131, 0.617112 }, \ + { -0.542979, -0.759639, 0.861078 }, \ + { 0.901807, 0.674722, -0.587219 }, \ + { 0.406597, -1.165070, -0.301035 }, \ + { 0.231152, 1.173626, -0.427204 }, \ + { 0.240216, -1.229258, 0.211081 }, \ + { 1.088987, -0.548564, 0.355693 }, \ + { 0.514074, -0.793976, 0.847740 }, \ + { -0.918495, -0.394216, -0.783770 }, \ + { -1.231720, 0.084433, -0.298444 }, \ + { 0.779848, -0.727575, -0.689786 }, \ + { -1.075781, -0.674133, 0.039659 }, \ + { 0.496633, 0.282983, -1.134289 }, \ + { 0.891475, -0.364374, 0.828152 }, \ + { 0.454983, -1.163763, 0.227991 }, \ + { -0.388587, -0.679547, -1.000274 }, \ + { 1.191951, 0.427388, 0.099628 }, \ + { 0.422267, 1.105700, 0.460923 }, \ + { 0.852907, -0.356047, 0.871271 }, \ + { 0.078403, -0.153410, -1.258432 }, \ + { -0.785527, 0.482813, 0.873597 }, \ + { -1.235010, -0.125301, -0.269042 }, \ + { 0.167053, -1.190004, 0.411482 }, \ + { 0.736825, 0.969256, 0.361893 }, \ + { 1.185784, -0.187628, 0.414782 }, \ + { 0.950462, 0.768893, -0.344616 }, \ + { 0.650843, 0.611536, -0.903194 }, \ + { 0.374910, -1.105191, -0.501329 }, \ + { 0.705070, -0.738210, 0.755814 }, \ + { -0.845956, -0.724609, -0.610436 }, \ + { -0.788504, -0.883724, -0.458942 }, \ + { 0.719097, 0.885464, 0.558737 }, \ + { -0.957466, -0.682968, -0.479736 }, \ + { 0.678558, -0.986781, 0.423267 }, \ + { -0.601691, 1.114939, -0.090623 }, \ + { -0.426899, -1.114558, -0.434568 }, \ + { -0.187710, 1.096872, -0.612348 }, \ + { 0.906217, 0.491324, 0.742095 }, \ + { -0.503540, -0.219473, 1.145256 }, \ + { -0.800428, 0.697720, 0.697017 }, \ + { 0.814789, -0.968967, -0.102735 }, \ + { -1.008348, 0.772234, 0.014864 }, \ + { 0.123590, 0.320934, -1.222726 }, \ + { 0.409058, 0.926047, 0.767099 }, \ + { 0.570782, -0.232945, 1.110530 }, \ + { -0.041734, -1.021842, -0.753280 }, \ + { 1.114086, 0.581667, -0.183877 }, \ + { -0.057148, 0.808571, -0.977895 }, \ + { 0.235176, 1.166170, -0.445052 }, \ + { 0.191218, 0.761957, 0.998092 }, \ + { 0.222648, -1.244770, -0.119625 }, \ + { -0.178733, 0.731520, -1.022871 }, \ + { 0.445567, 0.371098, 1.130083 }, \ + { 0.970801, 0.746381, 0.337333 }, \ + { -0.992364, -0.654808, -0.446960 }, \ + { 0.266218, 1.241710, 0.024866 }, \ + { 1.258707, -0.124089, 0.116583 }, \ + { -1.137213, 0.488463, -0.285456 }, \ + { 0.358283, -0.898286, 0.823436 }, \ + { 0.087521, 1.230420, -0.302886 }, \ + { -0.951069, 0.556370, -0.631864 }, \ + { -0.145136, 0.302903, -1.224956 }, \ + { 0.852662, -0.941234, 0.019464 }, \ + { 0.620505, 1.088370, -0.209184 }, \ + { -0.263752, -0.659466, 1.053030 }, \ + { -0.828791, -0.911600, 0.308908 }, \ + { -0.245717, 1.243459, 0.082263 }, \ + { -0.679384, -0.097832, -1.068738 }, \ + { -0.292610, 1.204928, 0.275430 }, \ + { 1.119552, 0.505687, -0.322825 }, \ + { 0.609661, 0.553285, -0.967223 }, \ + { -0.582157, 0.986451, 0.548945 }, \ + { 0.610331, -0.465619, 1.011942 }, \ + { -0.183770, 1.052674, -0.686614 }, \ + { -0.888905, 0.739944, -0.525038 }, \ + { -1.220009, 0.351023, -0.041166 }, \ + { -1.005903, 0.010069, -0.775494 }, \ + { -0.311862, 1.011240, -0.702473 }, \ + { -0.773117, 0.948144, 0.341536 }, \ + { -1.207578, 0.383727, 0.088551 }, \ + { 0.302053, -0.453340, 1.147422 }, \ + { -0.699607, -0.070289, 1.057801 }, \ + { 0.838653, 0.022693, 0.953666 }, \ + { -0.487446, -0.049690, 1.171862 }, \ + { -0.583229, -0.997283, 0.527828 }, \ + { 0.582716, 1.108410, -0.212604 }, \ + { 0.705140, -0.773962, -0.719092 }, \ + { 0.951171, -0.841553, -0.019865 }, \ + { -0.189525, 1.062100, -0.670340 }, \ + { -0.920539, 0.172259, 0.858060 }, \ + { -0.520160, -1.077708, -0.425809 }, \ + { -0.655485, 0.112743, -1.082109 }, \ + { -0.285007, -0.926371, 0.820939 }, \ + { -1.030567, -0.281194, -0.687164 }, \ + { 0.054927, 0.607216, 1.114272 }, \ + { 0.158439, 0.130549, -1.253470 }, \ + { 0.607180, 0.319168, 1.069017 }, \ + { 0.352076, 1.177935, -0.319130 }, \ + { -0.356005, -0.596175, 1.063565 }, \ + { -0.799209, 0.813891, -0.558731 }, \ + { -0.394995, 1.127402, 0.431599 }, \ + { 0.958186, 0.825377, -0.118173 }, \ + { 0.901745, 0.320422, 0.835176 }, \ + { 0.107000, -0.046214, -1.264812 }, \ + { 0.640494, 1.010901, 0.425652 }, \ + { 1.247362, 0.000485, 0.239629 }, \ + { -0.458720, 0.814407, -0.860030 }, \ + { 1.262387, 0.122437, 0.068710 }, \ + { 0.018970, 0.460893, 1.183448 }, \ + { 1.041231, 0.712477, -0.146786 }, \ + { -1.203936, -0.401310, 0.053105 }, \ + { -0.957886, -0.367324, 0.748905 }, \ + { 0.596976, -1.072770, -0.325754 }, \ + { -0.271895, -1.047016, -0.665706 }, \ + { -1.261994, 0.143359, 0.012337 }, \ + { 0.319336, -0.624347, 1.059031 }, \ + { -0.715401, -0.758312, -0.725603 }, \ + { 0.588401, -0.163489, -1.113727 }, \ + { 1.087744, -0.460141, -0.467350 }, \ + { 0.784349, 0.081183, -0.995760 }, \ + { -0.221156, 0.716483, 1.025221 }, \ + { 0.296764, -0.128480, 1.228315 }, \ + { -1.224266, 0.081436, -0.328441 }, \ + { -0.285543, -0.472121, -1.144072 }, \ + { -1.122514, -0.057485, -0.591600 }, \ + { 0.257123, 1.055719, -0.657783 }, \ + { 0.585054, -0.134138, 1.119397 }, \ + { -0.408430, -0.987509, -0.686545 }, \ + { -1.004570, -0.206791, -0.749272 }, \ + { -0.309829, 1.203774, 0.261282 }, \ + { -0.299370, 0.037320, 1.233822 }, \ + { 0.250466, -0.771841, 0.977170 }, \ + { 0.749622, 0.263278, 0.991002 }, \ + { 0.296587, -1.048701, -0.652376 }, \ + { -0.149659, -0.202717, -1.244926 }, \ + { 0.852538, 0.515000, -0.788217 }, \ + { 0.265281, -0.506737, -1.134097 }, \ + { -0.327238, -0.168619, 1.215655 }, \ + { 1.162758, -0.208046, 0.466951 }, \ + { 1.032532, 0.328815, 0.662639 }, \ + { 1.269059, -0.015245, 0.050896 }, \ + { -1.081859, -0.272825, 0.607027 }, \ + { 0.475025, 0.094649, -1.174191 }, \ + { 0.047901, -1.062886, 0.693767 }, \ + { -0.896166, -0.885498, -0.161599 }, \ + { -0.475727, -0.253498, 1.150111 }, \ + { 0.405294, 0.662314, 1.005191 }, \ + { 0.274705, 1.200667, 0.310273 }, \ + { 0.693373, 0.783180, 0.720552 }, \ + { 0.061456, 0.218791, 1.249675 }, \ + { 0.435662, -0.951332, -0.720070 }, \ + { -0.145699, -1.146880, 0.526092 }, \ + { -0.478284, 1.117453, -0.368616 }, \ + { 1.135808, -0.281828, 0.493807 }, \ + { -1.103055, -0.318719, 0.543158 }, \ + { 0.026058, -0.255878, 1.243858 }, \ + { -0.169674, 1.254070, -0.108868 }, \ + { -1.169501, -0.037295, 0.494178 }, \ + { -1.143053, -0.235727, 0.501195 }, \ + { 0.745852, -0.832007, 0.603988 }, \ + { -0.337013, 0.859032, 0.872823 }, \ + { -0.084982, 1.259383, 0.141651 }, \ + { 0.555071, -1.140266, 0.070868 }, \ + { -0.478393, -1.174910, 0.063697 }, \ + { -0.513698, 0.055100, -1.160350 }, \ + { -0.047833, -0.777682, -1.003122 }, \ + { 0.444149, 1.077675, 0.504658 }, \ + { 1.196798, -0.418619, 0.075926 }, \ + { 0.204415, -1.253602, -0.005455 }, \ + { 0.175366, -0.713941, -1.035794 }, \ + { 1.031947, -0.583500, 0.456009 }, \ + { 0.825104, -0.955708, -0.138414 }, \ + { 0.634382, -0.767285, 0.788777 }, \ + { -1.223932, 0.059993, 0.334253 }, \ + { -0.845312, -0.907721, 0.273539 }, \ + { -1.161587, -0.367260, 0.359399 }, \ + { 0.196107, -0.569707, -1.118172 }, \ + { -0.849886, 0.522510, -0.786135 }, \ + { -0.263671, 1.201331, -0.317197 }, \ + { -0.666174, -0.375187, 1.014288 }, \ + { 1.072889, -0.029637, -0.679238 }, \ + { 1.077886, 0.496687, 0.452545 }, \ + { 0.256237, -0.949089, 0.804305 }, \ + { -0.122358, -0.285378, 1.231633 }, \ + { 1.113703, -0.586025, -0.171966 }, \ + { 0.968073, -0.819611, 0.066380 }, \ + { 0.914228, 0.164627, -0.866266 }, \ + { 1.077638, 0.209107, -0.638987 }, \ + { 0.583443, 0.547600, -0.986439 }, \ + { -0.242707, 1.245431, -0.057689 }, \ + { 0.807001, -0.746150, -0.636664 }, \ + { -0.347392, -0.890262, -0.836710 }, \ + { -0.759495, -0.904449, -0.467411 }, \ + { -0.279167, 0.720129, 1.008371 }, \ + { 0.193653, 0.648045, -1.075113 }, \ + { -0.289260, -0.738665, -0.991985 }, \ + { 0.237874, 0.986703, 0.763653 }, \ + { -0.804498, 0.729487, -0.658760 }, \ + { 0.025529, -0.164599, 1.259201 }, \ + { -0.576384, -0.280181, 1.096637 }, \ + { -1.126249, -0.305677, -0.501456 }, \ +} + +// Gradient tables +static const gradD gradsV3d[TABSIZE] = __GRADS; +static const gradF gradsV3f[TABSIZE] = __GRADS; + +// Permutation table +static unsigned const char permute[TABSIZE] = { + 225,155,210,108,175,199,221,144,203,116, 70,213, 69,158, 33,252, + 5, 82,173,133,222,139,174, 27, 9, 71, 90,246, 75,130, 91,191, + 169,138, 2,151,194,235, 81, 7, 25,113,228,159,205,253,134,142, + 248, 65,224,217, 22,121,229, 63, 89,103, 96,104,156, 17,201,129, + 36, 8,165,110,237,117,231, 56,132,211,152, 20,181,111,239,218, + 170,163, 51,172,157, 47, 80,212,176,250, 87, 49, 99,242,136,189, + 162,115, 44, 43,124, 94,150, 16,141,247, 32, 10,198,223,255, 72, + 53,131, 84, 57,220,197, 58, 50,208, 11,241, 28, 3,192, 62,202, + 18,215,153, 24, 76, 41, 15,179, 39, 46, 55, 6,128,167, 23,188, + 106, 34,187,140,164, 73,112,182,244,195,227, 13, 35, 77,196,185, + 26,200,226,119, 31,123,168,125,249, 68,183,230,177,135,160,180, + 12, 1,243,148,102,166, 38,238,251, 37,240,126, 64, 74,161, 40, + 184,149,171,178,101, 66, 29, 59,146, 61,254,107, 42, 86,154, 4, + 236,232,120, 21,233,209, 45, 98,193,114, 78, 19,206, 14,118,127, + 48, 79,147, 85, 30,207,219, 54, 88,234,190,122, 95, 67,143,109, + 137,214,145, 93, 92,100,245, 0,216,186, 60, 83,105, 97,204, 52 +}; + +inline int phi( int x ) +{ + return permute[x & TABMASK]; +} + +inline float cubicWeight( float t ) +{ + // 3 t^2 - 2 t^3 + return t * t * ( 3.0f - 2.0f * t ); +} + +inline double cubicWeight( double t ) +{ + // 3 t^2 - 2 t^3 + return t * t * ( ((double)3.0) - ((double)2.0) * t ); +} + +inline float cubicWeightGrad( float t ) +{ + // 6 t - 6 t^2 + return t * ( 6.0f - 6.0f * t ); +} + +inline double cubicWeightGrad( double t ) +{ + // 6 t - 6 t^2 + return t * ( ((double)6.0) - ((double)6.0) * t ); +} + +template +inline Vec2 cubicWeight( const Vec2 &t ) +{ + return Vec2( cubicWeight( t[0] ), + cubicWeight( t[1] ) ); +} + +template +inline Vec2 cubicWeightGrad( const Vec2 &t ) +{ + return Vec2( cubicWeightGrad( t[0] ), + cubicWeightGrad( t[1] ) ); +} + +template +inline Vec3 cubicWeight( const Vec3 &t ) +{ + return Vec3( cubicWeight( t[0] ), + cubicWeight( t[1] ), + cubicWeight( t[2] ) ); +} + +template +inline Vec3 cubicWeightGrad( const Vec3 &t ) +{ + return Vec3( cubicWeightGrad( t[0] ), + cubicWeightGrad( t[1] ), + cubicWeightGrad( t[2] ) ); +} + + +// by not templating these inoiseGrad functions, we guarantee that this +// code will only compile for float and double. +// The mysterious "17" and "34" passed into the phi functions +// are there to make the noise match prman + +inline const V3d &inoiseGrad( int ix, double *dummy ) +{ + return ( const V3d & )( gradsV3d[phi(ix + phi(17 + phi(34)))] ); +} + +inline const V3f &inoiseGrad( int ix, float *dummy ) +{ + return ( const V3f & )( gradsV3f[phi(ix + phi(17 + phi(34)))] ); +} + +inline const V3d &inoiseGrad( int ix, int iy, double *dummy ) +{ + return ( const V3d & )( gradsV3d[phi(ix + phi(iy + phi(34)))] ); +} + +inline const V3f &inoiseGrad( int ix, int iy, float *dummy ) +{ + return ( const V3f & )( gradsV3f[phi(ix + phi(iy + phi(34)))] ); +} + +inline const V3d &inoiseGrad( int ix, int iy, int iz, double *dummy ) +{ + return ( const V3d & )( gradsV3d[phi(ix + phi(iy + phi(iz)))] ); +} + +inline const V3f &inoiseGrad( int ix, int iy, int iz, float *dummy ) +{ + return ( const V3f & )( gradsV3f[phi(ix + phi(iy + phi(iz)))] ); +} + +template +inline +T dotComp( const Vec3 &v, T x ) +{ + return v.x * x; +} + +template +inline +T dotComp( const Vec3 &v, T x, T y ) +{ + return (v.x * x) + (v.y * y); +} + +template +inline +T dotComp( const Vec3 &v, T x, T y, T z ) +{ + return (v.x * x) + (v.y * y) + (v.z * z); +} + +//------------------------ +// 1D noise implementation +//------------------------ + +template +inline T noiseCen1( T v ) +{ + const int floorV = ( int ) Imath::floor( v ); + + const T t = v - ( T ) floorV; + + const T tm1 = t - ((T)1.0); + + const Vec3 &g0 = + inoiseGrad( floorV, (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV+1, (T*)NULL ); + + const T w = cubicWeight( t ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t ); + const T proj1 = dotComp( g1, tm1 ); + return Imath::lerp( proj0, proj1, w ); +} + +//------------------------ +// 2D noise implementation +//------------------------ + +template +inline T noiseCen2( const Vec2 &v ) +{ + const V2i floorV( ( int ) Imath::floor( v[0] ), + ( int ) Imath::floor( v[1] ) ); + + const Vec2 t( v[0] - ( T ) floorV[0], + v[1] - ( T ) floorV[1] ); + + const Vec2 tm1( t[0] - ((T)1.0), + t[1] - ((T)1.0) ); + + const Vec3 &g0 = + inoiseGrad( floorV[0], floorV[1], (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV[0]+1, floorV[1], (T*)NULL ); + + const Vec3 &g2 = + inoiseGrad( floorV[0], floorV[1]+1, (T*)NULL ); + + const Vec3 &g3 = + inoiseGrad( floorV[0]+1, floorV[1]+1, (T*)NULL ); + + const Vec2 w( cubicWeight( t ) ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t[0], t[1] ); + const T proj1 = dotComp( g1, tm1[0], t[1] ); + const T n0x = Imath::lerp( proj0, proj1, w[0] ); + + // n1x + const T proj2 = dotComp( g2, t[0], tm1[1] ); + const T proj3 = dotComp( g3, tm1[0], tm1[1] ); + const T n1x = Imath::lerp( proj2, proj3, w[0] ); + + // Do the y's + // n0y + return Imath::lerp( n0x, n1x, w[1] ); +} + +//------------------------ +// 3D noise implementation +//------------------------ + +template +inline T noiseCen3( const Vec3 &v ) +{ + const V3i floorV( ( int ) Imath::floor( v[0] ), + ( int ) Imath::floor( v[1] ), + ( int ) Imath::floor( v[2] ) ); + + const Vec3 t( v[0] - ( T ) floorV[0], + v[1] - ( T ) floorV[1], + v[2] - ( T ) floorV[2] ); + + const Vec3 tm1( t[0] - ((T)1.0), + t[1] - ((T)1.0), + t[2] - ((T)1.0) ); + + const Vec3 &g0 = + inoiseGrad( floorV[0], floorV[1], floorV[2], (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV[0]+1, floorV[1], floorV[2], (T*)NULL ); + + const Vec3 &g2 = + inoiseGrad( floorV[0], floorV[1]+1, floorV[2], (T*)NULL ); + + const Vec3 &g3 = + inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2], (T*)NULL ); + + const Vec3 &g4 = + inoiseGrad( floorV[0], floorV[1], floorV[2]+1, (T*)NULL ); + + const Vec3 &g5 = + inoiseGrad( floorV[0]+1, floorV[1], floorV[2]+1, (T*)NULL ); + + const Vec3 &g6 = + inoiseGrad( floorV[0], floorV[1]+1, floorV[2]+1, (T*)NULL ); + + const Vec3 &g7 = + inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2]+1, (T*)NULL ); + + const Vec3 w( cubicWeight( t ) ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t[0], t[1], t[2] ); + const T proj1 = dotComp( g1, tm1[0], t[1], t[2] ); + const T n0x = Imath::lerp( proj0, proj1, w[0] ); + + // n1x + const T proj2 = dotComp( g2, t[0], tm1[1], t[2] ); + const T proj3 = dotComp( g3, tm1[0], tm1[1], t[2] ); + const T n1x = Imath::lerp( proj2, proj3, w[0] ); + + // n2x + const T proj4 = dotComp( g4, t[0], t[1], tm1[2] ); + const T proj5 = dotComp( g5, tm1[0], t[1], tm1[2] ); + const T n2x = Imath::lerp( proj4, proj5, w[0] ); + + // n3x + const T proj6 = dotComp( g6, t[0], tm1[1], tm1[2] ); + const T proj7 = dotComp( g7, tm1[0], tm1[1], tm1[2] ); + const T n3x = Imath::lerp( proj6, proj7, w[0] ); + + // Do the y's + // n0y + const T n0y = Imath::lerp( n0x, n1x, w[1] ); + + // n1y + const T n1y = Imath::lerp( n2x, n3x, w[1] ); + + // Do the z's + return Imath::lerp( n0y, n1y, w[2] ); +} + + +//---------------------------------- +// 1D noise with grad implementation +//---------------------------------- + +template +inline T noiseCenGrad1( T v, + T &grad ) +{ + const int floorV = ( int ) Imath::floor( v ); + + const T t = v - ( T ) floorV; + + const T tm1 = t - ((T)1.0); + + const Vec3 &g0 = + inoiseGrad( floorV, (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV+1, (T*)NULL ); + + const T w = cubicWeight( t ); + const T dw = cubicWeightGrad( t ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t ); + const T proj1 = dotComp( g1, tm1 ); + grad = Imath::lerp( g0[0], g1[0], w ) + + dw * ( proj1 - proj0 ); + return Imath::lerp( proj0, proj1, w ); +} + +//---------------------------------- +// 2D noise with grad implementation +//---------------------------------- + +template +inline T noiseCenGrad2( const Vec2 &v, + Vec2 &grad ) +{ + const V2i floorV( ( int ) Imath::floor( v[0] ), + ( int ) Imath::floor( v[1] ) ); + + const Vec2 t( v[0] - ( T ) floorV[0], + v[1] - ( T ) floorV[1] ); + + const Vec2 tm1( t[0] - ((T)1.0), + t[1] - ((T)1.0) ); + + const Vec3 &g0 = + inoiseGrad( floorV[0], floorV[1], (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV[0]+1, floorV[1], (T*)NULL ); + + const Vec3 &g2 = + inoiseGrad( floorV[0], floorV[1]+1, (T*)NULL ); + + const Vec3 &g3 = + inoiseGrad( floorV[0]+1, floorV[1]+1, (T*)NULL ); + + const Vec2 w( cubicWeight( t ) ); + const Vec2 dw( cubicWeightGrad( t ) ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t[0], t[1] ); + const T proj1 = dotComp( g1, tm1[0], t[1] ); + const T n0x = Imath::lerp( proj0, proj1, w[0] ); + const T d_dx_n0x = Imath::lerp( g0[0], g1[0], w[0] ) + + dw[0] * ( proj1 - proj0 ); + const T d_dy_n0x = Imath::lerp( g0[1], g1[1], w[0] ); + + // n1x + const T proj2 = dotComp( g2, t[0], tm1[1] ); + const T proj3 = dotComp( g3, tm1[0], tm1[1] ); + const T n1x = Imath::lerp( proj2, proj3, w[0] ); + const T d_dx_n1x = Imath::lerp( g2[0], g3[0], w[0] ) + + dw[0] * ( proj3 - proj2 ); + const T d_dy_n1x = Imath::lerp( g2[1], g3[1], w[0] ); + + // Do the y's + // n0y + grad[0] = Imath::lerp( d_dx_n0x, d_dx_n1x, w[1] ); + grad[1] = Imath::lerp( d_dy_n0x, d_dy_n1x, w[1] ) + + dw[1] * ( n1x - n0x ); + return Imath::lerp( n0x, n1x, w[1] ); +} + +//---------------------------------- +// 3D noise with grad implementation +//---------------------------------- + +template +inline T noiseCenGrad3( const Vec3 &v, + Vec3 &grad ) +{ + const V3i floorV( ( int ) Imath::floor( v[0] ), + ( int ) Imath::floor( v[1] ), + ( int ) Imath::floor( v[2] ) ); + + const Vec3 t( v[0] - ( T ) floorV[0], + v[1] - ( T ) floorV[1], + v[2] - ( T ) floorV[2] ); + + const Vec3 tm1( t[0] - ((T)1.0), + t[1] - ((T)1.0), + t[2] - ((T)1.0) ); + + const Vec3 &g0 = + inoiseGrad( floorV[0], floorV[1], floorV[2], (T*)NULL ); + + const Vec3 &g1 = + inoiseGrad( floorV[0]+1, floorV[1], floorV[2], (T*)NULL ); + + const Vec3 &g2 = + inoiseGrad( floorV[0], floorV[1]+1, floorV[2], (T*)NULL ); + + const Vec3 &g3 = + inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2], (T*)NULL ); + + const Vec3 &g4 = + inoiseGrad( floorV[0], floorV[1], floorV[2]+1, (T*)NULL ); + + const Vec3 &g5 = + inoiseGrad( floorV[0]+1, floorV[1], floorV[2]+1, (T*)NULL ); + + const Vec3 &g6 = + inoiseGrad( floorV[0], floorV[1]+1, floorV[2]+1, (T*)NULL ); + + const Vec3 &g7 = + inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2]+1, (T*)NULL ); + + const Vec3 w( cubicWeight( t ) ); + const Vec3 dw( cubicWeightGrad( t ) ); + + // Do the x's + // n0x + const T proj0 = dotComp( g0, t[0], t[1], t[2] ); + const T proj1 = dotComp( g1, tm1[0], t[1], t[2] ); + const T n0x = Imath::lerp( proj0, proj1, w[0] ); + const T d_dx_n0x = Imath::lerp( g0[0], g1[0], w[0] ) + + dw[0] * ( proj1 - proj0 ); + const T d_dy_n0x = Imath::lerp( g0[1], g1[1], w[0] ); + const T d_dz_n0x = Imath::lerp( g0[2], g1[2], w[0] ); + + // n1x + const T proj2 = dotComp( g2, t[0], tm1[1], t[2] ); + const T proj3 = dotComp( g3, tm1[0], tm1[1], t[2] ); + const T n1x = Imath::lerp( proj2, proj3, w[0] ); + const T d_dx_n1x = Imath::lerp( g2[0], g3[0], w[0] ) + + dw[0] * ( proj3 - proj2 ); + const T d_dy_n1x = Imath::lerp( g2[1], g3[1], w[0] ); + const T d_dz_n1x = Imath::lerp( g2[2], g3[2], w[0] ); + + // n2x + const T proj4 = dotComp( g4, t[0], t[1], tm1[2] ); + const T proj5 = dotComp( g5, tm1[0], t[1], tm1[2] ); + const T n2x = Imath::lerp( proj4, proj5, w[0] ); + const T d_dx_n2x = Imath::lerp( g4[0], g5[0], w[0] ) + + dw[0] * ( proj5 - proj4 ); + const T d_dy_n2x = Imath::lerp( g4[1], g5[1], w[0] ); + const T d_dz_n2x = Imath::lerp( g4[2], g5[2], w[0] ); + + // n3x + const T proj6 = dotComp( g6, t[0], tm1[1], tm1[2] ); + const T proj7 = dotComp( g7, tm1[0], tm1[1], tm1[2] ); + const T n3x = Imath::lerp( proj6, proj7, w[0] ); + const T d_dx_n3x = Imath::lerp( g6[0], g7[0], w[0] ) + + dw[0] * ( proj7 - proj6 ); + const T d_dy_n3x = Imath::lerp( g6[1], g7[1], w[0] ); + const T d_dz_n3x = Imath::lerp( g6[2], g7[2], w[0] ); + + // Do the y's + // n0y + const T n0y = Imath::lerp( n0x, n1x, w[1] ); + const T d_dx_n0y = Imath::lerp( d_dx_n0x, d_dx_n1x, w[1] ); + const T d_dy_n0y = Imath::lerp( d_dy_n0x, d_dy_n1x, w[1] ) + + dw[1] * ( n1x - n0x ); + const T d_dz_n0y = Imath::lerp( d_dz_n0x, d_dz_n1x, w[1] ); + + // n1y + const T n1y = Imath::lerp( n2x, n3x, w[1] ); + const T d_dx_n1y = Imath::lerp( d_dx_n2x, d_dx_n3x, w[1] ); + const T d_dy_n1y = Imath::lerp( d_dy_n2x, d_dy_n3x, w[1] ) + + dw[1] * ( n3x - n2x ); + const T d_dz_n1y = Imath::lerp( d_dz_n2x, d_dz_n3x, w[1] ); + + // Do the z's + grad[0] = Imath::lerp( d_dx_n0y, d_dx_n1y, w[2] ); + grad[1] = Imath::lerp( d_dy_n0y, d_dy_n1y, w[2] ); + grad[2] = Imath::lerp( d_dz_n0y, d_dz_n1y, w[2] ) + + dw[2] * ( n1y - n0y ); + return Imath::lerp( n0y, n1y, w[2] ); +} + +} // End namespace + + +float noiseCen( float v ) +{ + return noiseCen1( v ); +} + +double noiseCen( double v ) +{ + return noiseCen1( v ); +} + +float noiseCen( const V2f &v ) +{ + return noiseCen2( v ); +} + +double noiseCen( const V2d &v ) +{ + return noiseCen2( v ); +} + +float noiseCen( const V3f &v ) +{ + return noiseCen3( v ); +} + +double noiseCen( const V3d &v ) +{ + return noiseCen3( v ); +} + +float noiseCenGrad( float v, + float &grad ) +{ + return noiseCenGrad1( v, grad ); +} + +double noiseCenGrad( double v, + double &grad ) +{ + return noiseCenGrad1( v, grad ); +} + +float noiseCenGrad( const V2f &v, + V2f &grad ) +{ + return noiseCenGrad2( v, grad ); +} + +double noiseCenGrad( const V2d &v, + V2d &grad ) +{ + return noiseCenGrad2( v, grad ); +} + +float noiseCenGrad( const V3f &v, + V3f &grad ) +{ + return noiseCenGrad3( v, grad ); +} + +double noiseCenGrad( const V3d &v, + V3d &grad ) +{ + return noiseCenGrad3( v, grad ); +} + +} // End namespace Imath diff --git a/IlmBase/Imath/ImathNoise.h b/IlmBase/Imath/ImathNoise.h new file mode 100644 index 0000000000..72bcd24d6e --- /dev/null +++ b/IlmBase/Imath/ImathNoise.h @@ -0,0 +1,253 @@ +#ifndef INCLUDED_IMATHNOISE_H +#define INCLUDED_IMATHNOISE_H + +// +// Copyright (C) Pixar. All rights reserved. +// +// This license governs use of the accompanying software. If you +// use the software, you accept this license. If you do not accept +// the license, do not use the software. +// +// 1. Definitions +// The terms "reproduce," "reproduction," "derivative works," and +// "distribution" have the same meaning here as under U.S. +// copyright law. A "contribution" is the original software, or +// any additions or changes to the software. +// A "contributor" is any person or entity that distributes its +// contribution under this license. +// "Licensed patents" are a contributor's patent claims that read +// directly on its contribution. +// +// 2. Grant of Rights +// (A) Copyright Grant- Subject to the terms of this license, +// including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, +// royalty-free copyright license to reproduce its contribution, +// prepare derivative works of its contribution, and distribute +// its contribution or any derivative works that you create. +// (B) Patent Grant- Subject to the terms of this license, +// including the license conditions and limitations in section 3, +// each contributor grants you a non-exclusive, worldwide, +// royalty-free license under its licensed patents to make, have +// made, use, sell, offer for sale, import, and/or otherwise +// dispose of its contribution in the software or derivative works +// of the contribution in the software. +// +// 3. Conditions and Limitations +// (A) No Trademark License- This license does not grant you +// rights to use any contributor's name, logo, or trademarks. +// (B) If you bring a patent claim against any contributor over +// patents that you claim are infringed by the software, your +// patent license from such contributor to the software ends +// automatically. +// (C) If you distribute any portion of the software, you must +// retain all copyright, patent, trademark, and attribution +// notices that are present in the software. +// (D) If you distribute any portion of the software in source +// code form, you may do so only under this license by including a +// complete copy of this license with your distribution. If you +// distribute any portion of the software in compiled or object +// code form, you may only do so under a license that complies +// with this license. +// (E) The software is licensed "as-is." You bear the risk of +// using it. The contributors give no express warranties, +// guarantees or conditions. You may have additional consumer +// rights under your local laws which this license cannot change. +// To the extent permitted under your local laws, the contributors +// exclude the implied warranties of merchantability, fitness for +// a particular purpose and non-infringement. +// + +//---------------------------------------------------- +// +// Perlin noise +// +//---------------------------------------------------- + +#include + +//---------------------------------------------------------------------- +// README!!!! +// These noise functions are not templated because they only make sense +// for floating point types. Furthermore, because static gradient tables +// are used, I've got a different gradient table for floats and doubles +// to avoid the cost of float-double conversion, since this is a speed +// critical function. Therefore, no templates... +//---------------------------------------------------------------------- + +namespace Imath { + +//---------------------- +// Centered Perlin Noise +// Range -1.0 to 1.0 +//---------------------- + +float noiseCen( float v ); +double noiseCen( double v ); + +float noiseCen( const V2f &v ); +double noiseCen( const V2d &v ); + +float noiseCen( const V3f &v ); +double noiseCen( const V3d &v ); + +inline V3f noiseCen3d( const V3f &v ) +{ + return V3f( noiseCen( v ), + noiseCen( v + V3f( 7,0,3) ), + noiseCen( v + V3f(14,0,6) ) ); +} + +inline V3d noiseCen3d( const V3d &v ) +{ + return V3d( noiseCen( v ), + noiseCen( v + V3d( 7,0,3) ), + noiseCen( v + V3d(14,0,6) ) ); +} + +//----------------------------- +// Perlin noise centered at 0.5 +// Range 0.0 to 1.0 +//----------------------------- + +float noise( float v ); +double noise( double v ); + +float noise( const V2f &v ); +double noise( const V2d &v ); + +float noise( const V3f &v ); +double noise( const V3d &v ); + +inline V3f noise3d( const V3f &v ) +{ + return V3f( noise( v ), + noise( v + V3f( 7,0,3) ), + noise( v + V3f(14,0,6) ) ); +} + +inline V3d noise3d( const V3d &v ) +{ + return V3d( noise( v ), + noise( v + V3d( 7,0,3) ), + noise( v + V3d(14,0,6) ) ); +} + + +//---------------------- +// Centered Perlin noise +// With Gradients +// Range -1.0 to 1.0 +//---------------------- + +float noiseCenGrad( float v, float &grad ); +double noiseCenGrad( double v, double &grad ); + +float noiseCenGrad( const V2f &v, V2f &grad ); +double noiseCenGrad( const V2d &v, V2d &grad ); + +float noiseCenGrad( const V3f &v, V3f &grad ); +double noiseCenGrad( const V3d &v, V3d &grad ); + +//----------------------------- +// Perlin noise centered at 0.5 +// With Gradients +// Range 0.0 to 1.0 +//----------------------------- + +float noiseGrad( float v, float &grad ); +double noiseGrad( double v, double &grad ); + +float noiseGrad( const V2f &v, V2f &grad ); +double noiseGrad( const V2d &v, V2d &grad ); + +float noiseGrad( const V3f &v, V3f &grad ); +double noiseGrad( const V3d &v, V3d &grad ); + +//----------------------- +// INLINE IMPLEMENTATIONS +//----------------------- + +namespace { +template +inline T remap( T v ) +{ + return ((T)0.5)*v + ((T)0.5); +} +} // End unnamed namespace + +inline float noise( float v ) +{ + return remap( noiseCen( v ) ); +} + +inline double noise( double v ) +{ + return remap( noiseCen( v ) ); +} + +inline float noise( const V2f &v ) +{ + return remap( noiseCen( v ) ); +} + +inline double noise( const V2d &v ) +{ + return remap( noiseCen( v ) ); +} + +inline float noise( const V3f &v ) +{ + return remap( noiseCen( v ) ); +} + +inline double noise( const V3d &v ) +{ + return remap( noiseCen( v ) ); +} + +inline float noiseGrad( float v, float &grad ) +{ + const float ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((float)0.5); + return ret; +} + +inline double noiseGrad( double v, double &grad ) +{ + const double ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((double)0.5); + return ret; +} + +inline float noiseGrad( const V2f &v, V2f &grad ) +{ + const float ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((float)0.5); + return ret; +} + +inline double noiseGrad( const V2d &v, V2d &grad ) +{ + const double ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((double)0.5); + return ret; +} + +inline float noiseGrad( const V3f &v, V3f &grad ) +{ + const float ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((float)0.5); + return ret; +} + +inline double noiseGrad( const V3d &v, V3d &grad ) +{ + const double ret = remap( noiseCenGrad( v, grad ) ); + grad *= ((double)0.5); + return ret; +} + +} // End namespace Imath + +#endif diff --git a/IlmBase/Imath/Makefile.am b/IlmBase/Imath/Makefile.am index 6752428cd9..01ae56951e 100644 --- a/IlmBase/Imath/Makefile.am +++ b/IlmBase/Imath/Makefile.am @@ -14,7 +14,7 @@ libImath_la_SOURCES = ImathShear.cpp ImathMatrixAlgo.cpp ImathVec.cpp \ ImathHalfLimits.h ImathInterval.h ImathGLU.h \ ImathFrame.h ImathPlatform.h \ ImathBox.cpp ImathRandom.cpp ImathInt64.h \ - ImathFrustumTest.h + ImathFrustumTest.h ImathNoise.cpp libImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined libImath_la_LIBADD = ../Iex/libIex.la @@ -29,7 +29,8 @@ libImathinclude_HEADERS = ImathColorAlgo.h ImathMatrixAlgo.h ImathVec.h \ ImathFrustum.h ImathMath.h ImathGL.h \ ImathColor.h ImathRandom.h ImathRoots.h \ ImathHalfLimits.h ImathInterval.h ImathGLU.h \ - ImathFrame.h ImathPlatform.h ImathInt64.h + ImathFrame.h ImathPlatform.h ImathInt64.h \ + ImathNoise.h INCLUDES = -I$(top_builddir) -I$(top_srcdir)/Iex -I$(top_srcdir)/Half \ -I$(top_srcdir)/config diff --git a/IlmBase/vc/vc9/IlmBase/Half/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/Half/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Half/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/Half/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/Half/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Half/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/HalfTest/.cvsignore b/IlmBase/vc/vc9/IlmBase/HalfTest/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/HalfTest/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/HalfTest/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/HalfTest/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/HalfTest/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/HalfTest/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/HalfTest/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/HalfTest/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/Iex/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/Iex/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Iex/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/Iex/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/Iex/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Iex/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/IexTest/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/IexTest/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/IexTest/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/IexTest/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/IexTest/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/IexTest/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/IlmThread/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/IlmThread/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/IlmThread/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/IlmThread/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/IlmThread/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/IlmThread/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/Imath/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/Imath/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Imath/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/Imath/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/Imath/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/Imath/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/ImathTest/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/ImathTest/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/ImathTest/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/ImathTest/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/ImathTest/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/ImathTest/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/createDLL/Debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/createDLL/Debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/createDLL/Debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/createDLL/Release/.cvsignore b/IlmBase/vc/vc9/IlmBase/createDLL/Release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/createDLL/Release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/debug/.cvsignore b/IlmBase/vc/vc9/IlmBase/debug/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/debug/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/IlmBase/vc/vc9/IlmBase/release/.cvsignore b/IlmBase/vc/vc9/IlmBase/release/.cvsignore new file mode 100755 index 0000000000..dbd02a06b9 --- /dev/null +++ b/IlmBase/vc/vc9/IlmBase/release/.cvsignore @@ -0,0 +1,17 @@ +Makefile +Makefile.in +config.h.in +config.h +config.log +config.status +configure +libtool +stamp-h +aclocal.m4 +OpenEXR.pc +autom4te.cache +ltmain.sh +stamp-h.in +depcomp +.deps +CVS diff --git a/PyIlmBase/PyImath/Makefile.am b/PyIlmBase/PyImath/Makefile.am index 15d9df6178..2a75cd3264 100644 --- a/PyIlmBase/PyImath/Makefile.am +++ b/PyIlmBase/PyImath/Makefile.am @@ -5,19 +5,24 @@ lib_LTLIBRARIES = libPyImath.la libPyImath_la_SOURCES = PyImath.cpp \ PyImathAutovectorize.cpp \ + PyImathBox2Array.cpp \ + PyImathBox3Array.cpp \ PyImathBox.cpp \ PyImathColor3.cpp \ - PyImathColor4.cpp \ + PyImathColor4.cpp \ PyImathEuler.cpp \ PyImathFixedArray.cpp \ PyImathFrustum.cpp \ PyImathLine.cpp \ PyImathMatrix33.cpp \ PyImathMatrix44.cpp \ + PyImathNoise.cpp \ PyImathPlane.cpp \ PyImathQuat.cpp \ PyImathRandom.cpp \ PyImathShear.cpp \ + PyImathStringArray.cpp \ + PyImathStringTable.cpp \ PyImathTask.cpp \ PyImathUtil.cpp \ PyImathVec2fd.cpp \ @@ -27,15 +32,13 @@ libPyImath_la_SOURCES = PyImath.cpp \ PyImathVec3si.cpp \ PyImathVec4fd.cpp \ PyImathVec4siArray.cpp \ - PyImathVec4si.cpp \ - PyImathBox2Array.cpp \ - PyImathBox3Array.cpp \ - PyImathStringArray.cpp \ - PyImathStringTable.cpp + PyImathVec4si.cpp libPyImathinclude_HEADERS = PyImath.h \ PyImathAutovectorize.h \ + PyImathBoxArrayImpl.h \ PyImathBox.h \ + PyImathColor3ArrayImpl.h \ PyImathColor4Array2DImpl.h \ PyImathColor4ArrayImpl.h \ PyImathColor.h \ @@ -49,11 +52,15 @@ libPyImathinclude_HEADERS = PyImath.h \ PyImathLine.h \ PyImathMathExc.h \ PyImathMatrix.h \ + PyImathNoise.h \ PyImathOperators.h \ PyImathPlane.h \ PyImathQuat.h \ PyImathRandom.h \ PyImathShear.h \ + PyImathStringArray.h \ + PyImathStringArrayRegister.h \ + PyImathStringTable.h \ PyImathTask.h \ PyImathUtil.h \ PyImathVec2Impl.h \ @@ -62,11 +69,7 @@ libPyImathinclude_HEADERS = PyImath.h \ PyImathVec4ArrayImpl.h \ PyImathVec4Impl.h \ PyImathVec.h \ - PyImathVecOperators.h \ - PyImathBoxArrayImpl.h \ - PyImathStringArray.h \ - PyImathStringTable.h \ - PyImathStringArrayRegister.h + PyImathVecOperators.h libPyImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ \ -no-undefined @@ -82,7 +85,7 @@ imathmodule_la_LDFLAGS = -avoid-version -module imathmodule_la_LIBADD = -lPyImath @BOOST_PYTHON_LIBS@ noinst_HEADERS = PyImathFun.h \ - PyImathBasicTypes.cpp + PyImathBasicTypes.h INCLUDES = @ILMBASE_CXXFLAGS@ \ -I$(top_builddir) \ diff --git a/PyIlmBase/PyImath/PyImath.cpp b/PyIlmBase/PyImath/PyImath.cpp index b44123d2f8..a2e64942cb 100644 --- a/PyIlmBase/PyImath/PyImath.cpp +++ b/PyIlmBase/PyImath/PyImath.cpp @@ -38,10 +38,13 @@ namespace PyImath { -template <> PYIMATH_EXPORT const char * BoolArray::name() { return "BoolArray"; } +template <> PYIMATH_EXPORT const char * BoolArray::name() { return "BoolArray"; } +template <> PYIMATH_EXPORT const char * SignedCharArray::name() { return "SignedCharArray"; } template <> PYIMATH_EXPORT const char * UnsignedCharArray::name() { return "UnsignedCharArray"; } template <> PYIMATH_EXPORT const char * ShortArray::name() { return "ShortArray"; } +template <> PYIMATH_EXPORT const char * UnsignedShortArray::name(){ return "UnsignedShortArray"; } template <> PYIMATH_EXPORT const char * IntArray::name() { return "IntArray"; } +template <> PYIMATH_EXPORT const char * UnsignedIntArray::name() { return "UnsignedIntArray"; } template <> PYIMATH_EXPORT const char * FloatArray::name() { return "FloatArray"; } template <> PYIMATH_EXPORT const char * DoubleArray::name() { return "DoubleArray"; } diff --git a/PyIlmBase/PyImath/PyImath.h b/PyIlmBase/PyImath/PyImath.h index 6ae2c205e2..f191167d8d 100644 --- a/PyIlmBase/PyImath/PyImath.h +++ b/PyIlmBase/PyImath/PyImath.h @@ -44,9 +44,12 @@ namespace PyImath { typedef FixedArray BoolArray; +typedef FixedArray SignedCharArray; typedef FixedArray UnsignedCharArray; typedef FixedArray ShortArray; +typedef FixedArray UnsignedShortArray; typedef FixedArray IntArray; +typedef FixedArray UnsignedIntArray; typedef FixedArray FloatArray; typedef FixedArray DoubleArray; diff --git a/PyIlmBase/PyImath/PyImathBasicTypes.cpp b/PyIlmBase/PyImath/PyImathBasicTypes.cpp index 4e214f7935..e8d66a0ce3 100644 --- a/PyIlmBase/PyImath/PyImathBasicTypes.cpp +++ b/PyIlmBase/PyImath/PyImathBasicTypes.cpp @@ -32,6 +32,7 @@ // /////////////////////////////////////////////////////////////////////////// +#include #include #include #include @@ -44,18 +45,33 @@ namespace PyImath { void register_basicTypes() { - class_ ucclass = UnsignedCharArray::register_("Fixed length array of unsigned char"); + class_ bclass = BoolArray::register_("Fixed length array of bool"); + add_comparison_functions(bclass); + + class_ scclass = SignedCharArray::register_("Fixed length array of signed chars"); + add_arithmetic_math_functions(scclass); + add_mod_math_functions(scclass); + add_comparison_functions(scclass); + add_ordered_comparison_functions(scclass); + + class_ ucclass = UnsignedCharArray::register_("Fixed length array of unsigned chars"); add_arithmetic_math_functions(ucclass); add_mod_math_functions(ucclass); add_comparison_functions(ucclass); add_ordered_comparison_functions(ucclass); - class_ sclass = ShortArray::register_("Fixed length array of short"); + class_ sclass = ShortArray::register_("Fixed length array of shorts"); add_arithmetic_math_functions(sclass); add_mod_math_functions(sclass); add_comparison_functions(sclass); add_ordered_comparison_functions(sclass); + class_ usclass = UnsignedShortArray::register_("Fixed length array of unsigned shorts"); + add_arithmetic_math_functions(usclass); + add_mod_math_functions(usclass); + add_comparison_functions(usclass); + add_ordered_comparison_functions(usclass); + class_ iclass = IntArray::register_("Fixed length array of ints"); add_arithmetic_math_functions(iclass); add_mod_math_functions(iclass); @@ -64,6 +80,14 @@ register_basicTypes() add_explicit_construction_from_type(iclass); add_explicit_construction_from_type(iclass); + class_ uiclass = UnsignedIntArray::register_("Fixed length array of unsigned ints"); + add_arithmetic_math_functions(uiclass); + add_mod_math_functions(uiclass); + add_comparison_functions(uiclass); + add_ordered_comparison_functions(uiclass); + add_explicit_construction_from_type(uiclass); + add_explicit_construction_from_type(uiclass); + class_ fclass = FloatArray::register_("Fixed length array of floats"); add_arithmetic_math_functions(fclass); add_pow_math_functions(fclass); diff --git a/PyIlmBase/PyImath/PyImathBasicTypes.h b/PyIlmBase/PyImath/PyImathBasicTypes.h index 6f666e0c36..a10379769e 100644 --- a/PyIlmBase/PyImath/PyImathBasicTypes.h +++ b/PyIlmBase/PyImath/PyImathBasicTypes.h @@ -35,9 +35,11 @@ #ifndef _PyImathBasicTypes_h_ #define _PyImathBasicTypes_h_ +#include + namespace PyImath { -void register_basicTypes(); +PYIMATH_EXPORT void register_basicTypes(); } diff --git a/PyIlmBase/PyImath/PyImathBox.cpp b/PyIlmBase/PyImath/PyImathBox.cpp index 2ed8cd34dc..fb7604a621 100644 --- a/PyIlmBase/PyImath/PyImathBox.cpp +++ b/PyIlmBase/PyImath/PyImathBox.cpp @@ -241,6 +241,20 @@ static void boxSetMax(Imath::Box &box, const T &m) box.max = m; } +template +static T +boxMin(Imath::Box &box) +{ + return box.min; +} + +template +static T +boxMax(Imath::Box &box) +{ + return box.max; +} + template struct IntersectsTask : public Task { @@ -324,6 +338,8 @@ register_Box2() .def("__init__", make_constructor(boxConstructor)) .def_readwrite("min",&Box::min) .def_readwrite("max",&Box::max) + .def("min", &boxMin) + .def("max", &boxMax) .def(self == self) .def(self != self) .def("__repr__", &Box2_repr) @@ -390,6 +406,8 @@ register_Box3() .def("__mul__", &mulM44) .def("__imul__", &imulM44,return_internal_reference<>()) .def("__imul__", &imulM44,return_internal_reference<>()) + .def("min", &boxMin) + .def("max", &boxMax) .def("__repr__", &Box3_repr) .def("makeEmpty",&Box::makeEmpty,"makeEmpty() make the box empty") .def("makeInfinite",&Box::makeInfinite,"makeInfinite() make the box cover all space") diff --git a/PyIlmBase/PyImath/PyImathColor.h b/PyIlmBase/PyImath/PyImathColor.h index 7ffba8d042..f58adea99f 100644 --- a/PyIlmBase/PyImath/PyImathColor.h +++ b/PyIlmBase/PyImath/PyImathColor.h @@ -43,16 +43,18 @@ namespace PyImath { -template boost::python::class_, boost::python::bases > > register_Color3(); - template boost::python::class_ > register_Color4(); template boost::python::class_ > > register_Color4Array2D(); template boost::python::class_ > > register_Color4Array(); +template boost::python::class_, boost::python::bases > > register_Color3(); +template boost::python::class_ > > register_Color3Array(); typedef FixedArray2D Color4fArray; typedef FixedArray2D Color4cArray; typedef FixedArray C4fArray; typedef FixedArray C4cArray; +typedef FixedArray C3fArray; +typedef FixedArray C3cArray; // // Other code in the Zeno code base assumes the existance of a class with the diff --git a/PyIlmBase/PyImath/PyImathColor3.cpp b/PyIlmBase/PyImath/PyImathColor3.cpp index ca1774db91..1595133193 100644 --- a/PyIlmBase/PyImath/PyImathColor3.cpp +++ b/PyIlmBase/PyImath/PyImathColor3.cpp @@ -52,8 +52,12 @@ #include #include #include +#include "PyImathColor3ArrayImpl.h" namespace PyImath { +template <> const char *PyImath::C3cArray::name() { return "C3cArray"; } +template <> const char *PyImath::C3fArray::name() { return "C3fArray"; } + using namespace boost::python; using namespace Imath; @@ -657,5 +661,12 @@ register_Color3() template PYIMATH_EXPORT class_, bases > > register_Color3(); template PYIMATH_EXPORT class_, bases > > register_Color3(); +template PYIMATH_EXPORT class_ > > register_Color3Array(); +template PYIMATH_EXPORT class_ > > register_Color3Array(); + +template<> PYIMATH_EXPORT Imath::Color3 PyImath::FixedArrayDefaultValue >::value() +{ return Imath::Color3(0,0,0); } +template<> PYIMATH_EXPORT Imath::Color3 PyImath::FixedArrayDefaultValue >::value() +{ return Imath::Color3(0,0,0); } } diff --git a/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h b/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h new file mode 100644 index 0000000000..bd6fa214e7 --- /dev/null +++ b/PyIlmBase/PyImath/PyImathColor3ArrayImpl.h @@ -0,0 +1,84 @@ +/////////////////////////////////////////////////////////////////////////// +// +// Copyright (c) 2012, 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 _PyImathColor3ArrayImpl_h_ +#define _PyImathColor3ArrayImpl_h_ + +// +// This .C file was turned into a header file so that instantiations +// of the various V3* types can be spread across multiple files in +// order to work around MSVC limitations. +// + +#include "PyImathDecorators.h" +#include +#include +#include +#include +#include +#include +#include + +namespace PyImath { +using namespace boost::python; +using namespace Imath; + +// XXX fixme - template this +// really this should get generated automatically... + +template +static FixedArray +Color3Array_get(FixedArray > &ca) +{ + return FixedArray(&ca[0][index],ca.len(),3*ca.stride(),ca.handle()); +} + +// Currently we are only exposing the RGBA components. +template +class_ > > +register_Color3Array() +{ + class_ > > color3Array_class = FixedArray >::register_("Fixed length array of Imath::Color3"); + color3Array_class + .add_property("r",&Color3Array_get) + .add_property("g",&Color3Array_get) + .add_property("b",&Color3Array_get) + ; + + return color3Array_class; +} + +} // namespace PyImath + +#endif // _PyImathColor3ArrayImpl_h_ diff --git a/PyIlmBase/PyImath/PyImathExport.h b/PyIlmBase/PyImath/PyImathExport.h index 1b52842eaf..7fe739689d 100644 --- a/PyIlmBase/PyImath/PyImathExport.h +++ b/PyIlmBase/PyImath/PyImathExport.h @@ -35,16 +35,29 @@ #ifndef PYIMATH_EXPORT_H #define PYIMATH_EXPORT_H -#if defined(PLATFORM_WINDOWS) && !defined(ZENO_STATIC) - #ifdef PYIMATH_EXPORTS - #define PYIMATH_EXPORT __declspec(dllexport) - #else - #define PYIMATH_EXPORT __declspec(dllimport) - #endif -#else - #define PYIMATH_EXPORT +#if defined(PLATFORM_WINDOWS) +# if defined(PLATFORM_BUILD_STATIC) +# define PYIMATH_EXPORT_DEFINITION +# define PYIMATH_IMPORT_DEFINITION +# else +# define PYIMATH_EXPORT_DEFINITION __declspec(dllexport) +# define PYIMATH_IMPORT_DEFINITION __declspec(dllimport) +# endif +#else // linux/macos +# if defined(PLATFORM_VISIBILITY_AVAILABLE) +# define PYIMATH_EXPORT_DEFINITION __attribute__((visibility("default"))) +# define PYIMATH_IMPORT_DEFINITION +# else +# define PYIMATH_EXPORT_DEFINITION +# define PYIMATH_IMPORT_DEFINITION +# endif #endif +#if defined(PYIMATH_EXPORTS) // create library +# define PYIMATH_EXPORT PYIMATH_EXPORT_DEFINITION +#else // use library +# define PYIMATH_EXPORT PYIMATH_IMPORT_DEFINITION +#endif #endif // #ifndef PYIMATHEXPORT_H diff --git a/PyIlmBase/PyImath/PyImathFixedArray.cpp b/PyIlmBase/PyImath/PyImathFixedArray.cpp index dca78247ae..106a05fd6d 100644 --- a/PyIlmBase/PyImath/PyImathFixedArray.cpp +++ b/PyIlmBase/PyImath/PyImathFixedArray.cpp @@ -38,9 +38,12 @@ namespace PyImath { template <> PYIMATH_EXPORT bool FixedArrayDefaultValue::value() { return false; } +template <> PYIMATH_EXPORT signed char FixedArrayDefaultValue::value() { return 0; } template <> PYIMATH_EXPORT unsigned char FixedArrayDefaultValue::value() { return 0; } template <> PYIMATH_EXPORT short FixedArrayDefaultValue::value() { return 0; } +template <> PYIMATH_EXPORT unsigned short FixedArrayDefaultValue::value() { return 0; } template <> PYIMATH_EXPORT int FixedArrayDefaultValue::value() { return 0; } +template <> PYIMATH_EXPORT unsigned int FixedArrayDefaultValue::value() { return 0; } template <> PYIMATH_EXPORT float FixedArrayDefaultValue::value() { return 0; } template <> PYIMATH_EXPORT double FixedArrayDefaultValue::value() { return 0; } diff --git a/PyIlmBase/PyImath/PyImathFixedArray.h b/PyIlmBase/PyImath/PyImathFixedArray.h index c2f233a175..38edda599a 100644 --- a/PyIlmBase/PyImath/PyImathFixedArray.h +++ b/PyIlmBase/PyImath/PyImathFixedArray.h @@ -78,6 +78,7 @@ class FixedArray public: + typedef T BaseType; FixedArray(T *ptr, size_t length, size_t stride = 1) : _ptr(ptr), _length(length), _stride(stride), _handle(), _unmaskedLength(0) diff --git a/PyIlmBase/PyImath/PyImathFun.h b/PyIlmBase/PyImath/PyImathFun.h index 6c73861313..d2c4e65488 100644 --- a/PyIlmBase/PyImath/PyImathFun.h +++ b/PyIlmBase/PyImath/PyImathFun.h @@ -35,9 +35,11 @@ #ifndef _PyImathFun_h_ #define _PyImathFun_h_ +#include + namespace PyImath { -void register_functions(); +PYIMATH_EXPORT void register_functions(); } diff --git a/PyIlmBase/PyImath/PyImathNoise.cpp b/PyIlmBase/PyImath/PyImathNoise.cpp new file mode 100644 index 0000000000..349a077b43 --- /dev/null +++ b/PyIlmBase/PyImath/PyImathNoise.cpp @@ -0,0 +1,257 @@ +// +// Copyright (c) 1998-2006 Lucas Digital Ltd. All rights reserved. +// Used under authorization. This material contains the +// confidential and proprietary information of Lucas Digital +// Ltd. and may not be copied in whole or in part without the +// express written permission of Lucas Digital Ltd. This +// copyright notice does not imply publication. +// + +#include + +namespace PyImath{ + +using namespace boost::python; + +float noise1(float f) +{ + MATH_EXC_ON; + return Imath::noise(f); +} + +double noise2(double d) +{ + MATH_EXC_ON; + return Imath::noise(d); +} + +float noise3(const Imath::Vec2 &v) +{ + MATH_EXC_ON; + return Imath::noise(v); +} + +double noise4(const Imath::Vec2 &v) +{ + MATH_EXC_ON; + return Imath::noise(v); +} + +float noise5(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noise(v); +} + +double noise6(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noise(v); +} + +float noise7(const tuple &t) +{ + return noiseTuple(t); +} + +double noise8(const tuple &t) +{ + return noiseTuple(t); +} + +float noiseCen1(float f) +{ + MATH_EXC_ON; + return Imath::noiseCen(f); +} + +double noiseCen2(double d) +{ + MATH_EXC_ON; + return Imath::noiseCen(d); +} + +float noiseCen3(const Imath::Vec2 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen(v); +} + +double noiseCen4(const Imath::Vec2 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen(v); +} + +float noiseCen5(const tuple &t) +{ + return noiseCenTuple(t); +} + +double noiseCen6(const tuple &t) +{ + return noiseCenTuple(t); +} + +float noiseCen7(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen(v); +} + +double noiseCen8(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen(v); +} + +Imath::Vec3 noiseCen3d1(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen3d(v); +} + +Imath::Vec3 noiseCen3d2(const Imath::Vec3 &v) +{ + MATH_EXC_ON; + return Imath::noiseCen3d(v); +} + +Imath::Vec3 noiseCen3d3(const tuple &t) +{ + MATH_EXC_ON; + return noiseCen3dTuple(t); +} + +Imath::Vec3 noiseCen3d4(const tuple &t) +{ + MATH_EXC_ON; + return noiseCen3dTuple(t); +} + +float noiseCenGrad1(float f, float &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(f, g); +} + +double noiseCenGrad2(double d, double &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(d, g); +} + +float noiseCenGrad3(const Imath::Vec2 &v, Imath::Vec2 &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(v, g); +} + +double noiseCenGrad4(const Imath::Vec2 &v, Imath::Vec2 &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(v, g); +} + +float noiseCenGrad5(const Imath::Vec3 &v, Imath::Vec3 &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(v, g); +} + +double noiseCenGrad6(const Imath::Vec3 &v, Imath::Vec3 &g) +{ + MATH_EXC_ON; + return Imath::noiseCenGrad(v, g); +} + +float noiseCenGrad7(const tuple &t, tuple &g) +{ + return noiseCenGradTuple1(t, g); +} + +double noiseCenGrad8(const tuple &t, tuple &g) +{ + return noiseCenGradTuple1(t, g); +} + +tuple noiseCenGrad9(const tuple &t) +{ + return noiseCenGradTuple2(t); +} + +tuple noiseCenGrad10(const tuple &t) +{ + return noiseCenGradTuple2(t); +} + +tuple noiseCenGrad11(float f) +{ + return noiseCenGradTuple3(f); +} + +tuple noiseCenGrad12(double d) +{ + return noiseCenGradTuple3(d); +} + + +float noiseGrad1(float f, float &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(f, g); +} + +double noiseGrad2(double d, double &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(d, g); +} + +float noiseGrad3(const Imath::Vec2 &v, Imath::Vec2 &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(v, g); +} + +double noiseGrad4(const Imath::Vec2 &v, Imath::Vec2 &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(v, g); +} + +float noiseGrad5(const Imath::Vec3 &v, Imath::Vec3 &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(v, g); +} + +double noiseGrad6(const Imath::Vec3 &v, Imath::Vec3 &g) +{ + MATH_EXC_ON; + return Imath::noiseGrad(v, g); +} + +tuple noiseGrad7(const tuple &t) +{ + return noiseGradTuple1(t); +} + +tuple noiseGrad8(const tuple &t) +{ + return noiseGradTuple1(t); +} + +tuple noiseGrad9(float f) +{ + return noiseGradTuple2(f); +} + +tuple noiseGrad10(double d) +{ + return noiseGradTuple2(d); +} + + +} // PyImath + diff --git a/PyIlmBase/PyImath/PyImathNoise.h b/PyIlmBase/PyImath/PyImathNoise.h new file mode 100644 index 0000000000..066fc71a06 --- /dev/null +++ b/PyIlmBase/PyImath/PyImathNoise.h @@ -0,0 +1,267 @@ +#ifndef _PyImathNoise_h_ +#define _PyImathNoise_h_ + +// +// Copyright (c) 1998-2006 Lucas Digital Ltd. All rights reserved. +// Used under authorization. This material contains the +// confidential and proprietary information of Lucas Digital +// Ltd. and may not be copied in whole or in part without the +// express written permission of Lucas Digital Ltd. This +// copyright notice does not imply publication. +// + +// Separate header file created to deal with the noise functions when tuples are +// input instead of vectors + +#include +#include +#include +#include +#include +#include + +namespace PyImath{ + +using namespace boost::python; + +template +T noiseTuple(const tuple &t) +{ + MATH_EXC_ON; + if(t.attr("__len__")() == 2) + { + Imath::Vec2 point; + point.x = extract(t[0]); + point.y = extract(t[1]); + + return Imath::noise(point); + } + if(t.attr("__len__")() == 3) + { + Imath::Vec3 point; + point.x = extract(t[0]); + point.y = extract(t[1]); + point.z = extract(t[2]); + + return Imath::noise(point); + } + else + THROW(Iex::LogicExc, "noise expects tuple of length 2 or 3"); +} + +template +T noiseCenTuple(const tuple &t) +{ + MATH_EXC_ON; + if(t.attr("__len__")() == 2) + { + Imath::Vec2 point; + point.x = extract(t[0]); + point.y = extract(t[1]); + + return Imath::noiseCen(point); + } + if(t.attr("__len__")() == 3) + { + Imath::Vec3 point; + point.x = extract(t[0]); + point.y = extract(t[1]); + point.z = extract(t[1]); + + return Imath::noiseCen(point); + } + else + THROW(Iex::LogicExc, "noiseCen expects tuple of length 2 or3"); +} + +template +Imath::Vec3 noiseCen3dTuple(const tuple &t) +{ + MATH_EXC_ON; + if(t.attr("__len__")() == 3) + { + Imath::Vec3 point; + point.x = extract(t[0]); + point.y = extract(t[1]); + point.z = extract(t[2]); + + return Imath::noiseCen3d(point); + } + else + THROW(Iex::LogicExc, "noiseCen3d expects tuple of length 3"); +} + +template +T noiseCenGradTuple1(const tuple &t0, tuple &t1) +{ + MATH_EXC_ON; + if(t0.attr("__len__")() == 3 && t1.attr("__len__")() == 3) + { + Imath::Vec3 point0; + Imath::Vec3 point1; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + point0.z = extract(t0[2]); + + point1.x = extract(t1[0]); + point1.y = extract(t1[1]); + point1.z = extract(t1[2]); + + return Imath::noiseCenGrad(point0, point1); + } + else if(t0.attr("__len__")() == 2 && t1.attr("__len__")() == 2) + { + Imath::Vec2 point0; + Imath::Vec2 point1; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + + point1.x = extract(t1[0]); + point1.y = extract(t1[1]); + + return Imath::noiseCenGrad(point0, point1); + } + else + THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); +} + +template +tuple noiseCenGradTuple2(const tuple &t0) +{ + MATH_EXC_ON; + tuple t; + + if(t0.attr("__len__")() == 3) + { + Imath::Vec3 point0; + Imath::Vec3 point1; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + point0.z = extract(t0[2]); + + T result = Imath::noiseCenGrad(point0, point1); + t = make_tuple(result, point1); + } + else if(t0.attr("__len__")() == 2) + { + Imath::Vec2 point0; + Imath::Vec2 point1; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + + T result = Imath::noiseCenGrad(point0, point1); + t = make_tuple(result, point1); + } + else + THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); + + return t; +} + +template +tuple noiseCenGradTuple3(T a) +{ + MATH_EXC_ON; + tuple t; + T grad; + T result = Imath::noiseCenGrad(a, grad); + t = make_tuple(result, grad); + return t; +} + +template +tuple noiseGradTuple1(const tuple &t0) +{ + MATH_EXC_ON; + tuple t; + + if(t0.attr("__len__")() == 3) + { + Imath::Vec3 point0; + Imath::Vec3 grad; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + point0.z = extract(t0[2]); + + T result = Imath::noiseGrad(point0, grad); + t = make_tuple(result, grad); + } + else if(t0.attr("__len__")() == 2) + { + Imath::Vec2 point0; + Imath::Vec2 grad; + point0.x = extract(t0[0]); + point0.y = extract(t0[1]); + + T result = Imath::noiseGrad(point0, grad); + t = make_tuple(result, grad); + } + else + THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); + + return t; +} + +template +tuple noiseGradTuple2(T a) +{ + MATH_EXC_ON; + tuple t; + T grad; + T result = Imath::noiseGrad(a, grad); + t = make_tuple(result, grad); + return t; +} + +PYIMATH_EXPORT float noise1(float f); +PYIMATH_EXPORT double noise2(double d); +PYIMATH_EXPORT float noise3(const Imath::Vec2 &v); +PYIMATH_EXPORT double noise4(const Imath::Vec2 &v); +PYIMATH_EXPORT float noise5(const Imath::Vec3 &v); +PYIMATH_EXPORT double noise6(const Imath::Vec3 &v); +PYIMATH_EXPORT float noise7(const tuple &t); +PYIMATH_EXPORT double noise8(const tuple &t); + +PYIMATH_EXPORT float noiseCen1(float f); +PYIMATH_EXPORT double noiseCen2(double d); +PYIMATH_EXPORT float noiseCen3(const Imath::Vec2 &v); +PYIMATH_EXPORT double noiseCen4(const Imath::Vec2 &v); +PYIMATH_EXPORT float noiseCen5(const tuple &t); +PYIMATH_EXPORT double noiseCen6(const tuple &t); +PYIMATH_EXPORT float noiseCen7(const Imath::Vec3 &v); +PYIMATH_EXPORT double noiseCen8(const Imath::Vec3 &v); + +PYIMATH_EXPORT Imath::Vec3 noiseCen3d1(const Imath::Vec3 &v); +PYIMATH_EXPORT Imath::Vec3 noiseCen3d2(const Imath::Vec3 &v); +PYIMATH_EXPORT Imath::Vec3 noiseCen3d3(const tuple &t); +PYIMATH_EXPORT Imath::Vec3 noiseCen3d4(const tuple &t); + +PYIMATH_EXPORT float noiseCenGrad1(float f, float &g); +PYIMATH_EXPORT double noiseCenGrad2(double d, double &g); +PYIMATH_EXPORT float noiseCenGrad3(const Imath::Vec2 &v, Imath::Vec2 &g); +PYIMATH_EXPORT double noiseCenGrad4(const Imath::Vec2 &v, Imath::Vec2 &g); +PYIMATH_EXPORT float noiseCenGrad5(const Imath::Vec3 &v, Imath::Vec3 &g); +PYIMATH_EXPORT double noiseCenGrad6(const Imath::Vec3 &v, Imath::Vec3 &g); +PYIMATH_EXPORT float noiseCenGrad7(const tuple &t, tuple &g); +PYIMATH_EXPORT double noiseCenGrad8(const tuple &t, tuple &g); +PYIMATH_EXPORT tuple noiseCenGrad9(const tuple &t); +PYIMATH_EXPORT tuple noiseCenGrad10(const tuple &t); +PYIMATH_EXPORT tuple noiseCenGrad11(float f); +PYIMATH_EXPORT tuple noiseCenGrad12(double d); + +PYIMATH_EXPORT float noiseGrad1(float f, float &g); +PYIMATH_EXPORT double noiseGrad2(double d, double &g); +PYIMATH_EXPORT float noiseGrad3(const Imath::Vec2 &v, Imath::Vec2 &g); +PYIMATH_EXPORT double noiseGrad4(const Imath::Vec2 &v, Imath::Vec2 &g); +PYIMATH_EXPORT float noiseGrad5(const Imath::Vec3 &v, Imath::Vec3 &g); +PYIMATH_EXPORT double noiseGrad6(const Imath::Vec3 &v, Imath::Vec3 &g); +PYIMATH_EXPORT tuple noiseGrad7(const tuple &t); +PYIMATH_EXPORT tuple noiseGrad8(const tuple &t); +PYIMATH_EXPORT tuple noiseGrad9(float f); +PYIMATH_EXPORT tuple noiseGrad10(double d); + +} // PyImath + +#endif + + diff --git a/PyIlmBase/PyImath/PyImathStringArray.h b/PyIlmBase/PyImath/PyImathStringArray.h index 9cfd5154fb..313fb2c458 100644 --- a/PyIlmBase/PyImath/PyImathStringArray.h +++ b/PyIlmBase/PyImath/PyImathStringArray.h @@ -50,6 +50,7 @@ template class StringArrayT : public FixedArray { public: + typedef T BaseType; typedef FixedArray super; static StringArrayT* createDefaultArray(size_t length); diff --git a/PyIlmBase/PyImath/imathmodule.cpp b/PyIlmBase/PyImath/imathmodule.cpp index 87286feae9..aabc6c7e5c 100644 --- a/PyIlmBase/PyImath/imathmodule.cpp +++ b/PyIlmBase/PyImath/imathmodule.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -59,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -318,7 +320,7 @@ BOOST_PYTHON_MODULE(imath) register_Matrix44(); // - // M44Array + // M33/44Array // class_ > m44d_class = register_M44Array(); class_ > m44f_class = register_M44Array(); @@ -343,12 +345,23 @@ BOOST_PYTHON_MODULE(imath) register_Color4(); register_Color4(); + // + // C3/4Array + // + class_ > c3f_class = register_Color3Array(); + class_ > c3c_class = register_Color3Array(); + add_explicit_construction_from_type(c3f_class); + add_explicit_construction_from_type(c3f_class); + + class_ > c4f_class = register_Color4Array(); + class_ > c4c_class = register_Color4Array(); + + // + // Color4Array + // register_Color4Array2D(); register_Color4Array2D(); - register_Color4Array(); - register_Color4Array(); - // // Frustum // @@ -377,6 +390,56 @@ BOOST_PYTHON_MODULE(imath) // Utility Functions // register_functions(); + + // + // Noise Functions + // + def("noise", noise1); + def("noise", noise2); + def("noise", noise3); + def("noise", noise4); + def("noise", noise5); + def("noise", noise6); + def("noise", noise7); + def("noise", noise8); + + def("noiseCen", noiseCen1); + def("noiseCen", noiseCen2); + def("noiseCen", noiseCen3); + def("noiseCen", noiseCen4); + def("noiseCen", noiseCen5); + def("noiseCen", noiseCen6); + def("noiseCen", noiseCen7); + def("noiseCen", noiseCen8); + + def("noiseCen3d", noiseCen3d1); + def("noiseCen3d", noiseCen3d2); + def("noiseCen3d", noiseCen3d3); + def("noiseCen3d", noiseCen3d4); + + def("noiseCenGrad", noiseCenGrad1); + def("noiseCenGrad", noiseCenGrad2); + def("noiseCenGrad", noiseCenGrad3); + def("noiseCenGrad", noiseCenGrad4); + def("noiseCenGrad", noiseCenGrad5); + def("noiseCenGrad", noiseCenGrad6); + def("noiseCenGrad", noiseCenGrad7); + def("noiseCenGrad", noiseCenGrad8); + def("noiseCenGrad", noiseCenGrad9); + def("noiseCenGrad", noiseCenGrad10); + def("noiseCenGrad", noiseCenGrad11); + def("noiseCenGrad", noiseCenGrad12); + + def("noiseGrad", noiseGrad1); + def("noiseGrad", noiseGrad2); + def("noiseGrad", noiseGrad3); + def("noiseGrad", noiseGrad4); + def("noiseGrad", noiseGrad5); + def("noiseGrad", noiseGrad6); + def("noiseGrad", noiseGrad7); + def("noiseGrad", noiseGrad8); + def("noiseGrad", noiseGrad9); + def("noiseGrad", noiseGrad10); def("procrustesRotationAndTranslation", procrustes1, args("fromPts", "toPts", "weights", "doScale"), // Can't use 'from' and 'to' because 'from' is a reserved keywork in Python @@ -397,6 +460,34 @@ BOOST_PYTHON_MODULE(imath) // Initialize constants // + scope().attr("EULER_XYZ") = Imath::Eulerf::XYZ; + scope().attr("EULER_XZY") = Imath::Eulerf::XZY; + scope().attr("EULER_YZX") = Imath::Eulerf::YZX; + scope().attr("EULER_YXZ") = Imath::Eulerf::YXZ; + scope().attr("EULER_ZXY") = Imath::Eulerf::ZXY; + scope().attr("EULER_ZYX") = Imath::Eulerf::ZYX; + scope().attr("EULER_XZX") = Imath::Eulerf::XZX; + scope().attr("EULER_XYX") = Imath::Eulerf::XYX; + scope().attr("EULER_YXY") = Imath::Eulerf::YXY; + scope().attr("EULER_YZY") = Imath::Eulerf::YZY; + scope().attr("EULER_ZYZ") = Imath::Eulerf::ZYZ; + scope().attr("EULER_ZXZ") = Imath::Eulerf::ZXZ; + scope().attr("EULER_XYZr") = Imath::Eulerf::XYZr; + scope().attr("EULER_XZYr") = Imath::Eulerf::XZYr; + scope().attr("EULER_YZXr") = Imath::Eulerf::YZXr; + scope().attr("EULER_YXZr") = Imath::Eulerf::YXZr; + scope().attr("EULER_ZXYr") = Imath::Eulerf::ZXYr; + scope().attr("EULER_ZYXr") = Imath::Eulerf::ZYXr; + scope().attr("EULER_XZXr") = Imath::Eulerf::XZXr; + scope().attr("EULER_XYXr") = Imath::Eulerf::XYXr; + scope().attr("EULER_YXYr") = Imath::Eulerf::YXYr; + scope().attr("EULER_YZYr") = Imath::Eulerf::YZYr; + scope().attr("EULER_ZYZr") = Imath::Eulerf::ZYZr; + scope().attr("EULER_ZXZr") = Imath::Eulerf::ZXZr; + scope().attr("EULER_X_AXIS") = Imath::Eulerf::X; + scope().attr("EULER_Y_AXIS") = Imath::Eulerf::Y; + scope().attr("EULER_Z_AXIS") = Imath::Eulerf::Z; + scope().attr("INT_MIN") = Imath::limits::min(); scope().attr("INT_MAX") = Imath::limits::max(); scope().attr("INT_SMALLEST") = Imath::limits::smallest(); diff --git a/PyIlmBase/PyImathNumpy/Makefile.am b/PyIlmBase/PyImathNumpy/Makefile.am index 0f3e8113de..184260edad 100644 --- a/PyIlmBase/PyImathNumpy/Makefile.am +++ b/PyIlmBase/PyImathNumpy/Makefile.am @@ -10,5 +10,6 @@ noinst_HEADERS = INCLUDES = @ILMBASE_CXXFLAGS@ \ @NUMPY_CXXFLAGS@ \ + -I$(top_srcdir)/PyImath \ -I$(top_builddir) \ -I$(top_srcdir)/config From daafde359cab988d6252dcf3f287fb7e1c07140f Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Wed, 18 Jul 2012 15:31:34 -0700 Subject: [PATCH 10/25] More changes to ensure make dist functions correcly. Slight changes to the include path order in the IlmImfExmaples to ensure we pick up the toplevel libs and not any system ones. --- OpenEXR/IlmImfExamples/Makefile.am | 4 ++-- PyIlmBase/Makefile.am | 2 +- PyIlmBase/PyIexTest/Makefile.am | 5 ++--- PyIlmBase/PyImathNumpyTest/Makefile.am | 4 ++-- PyIlmBase/PyImathTest/Makefile.am | 4 ++-- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/OpenEXR/IlmImfExamples/Makefile.am b/OpenEXR/IlmImfExamples/Makefile.am index 620fa1a2a5..90dd766045 100644 --- a/OpenEXR/IlmImfExamples/Makefile.am +++ b/OpenEXR/IlmImfExamples/Makefile.am @@ -8,8 +8,8 @@ INCLUDES = -I$(top_builddir) \ -I$(top_srcdir)/IlmImf -I$(top_srcdir)/config \ @ILMBASE_CXXFLAGS@ -LDADD = @ILMBASE_LDFLAGS@ @ILMBASE_LIBS@ \ - -L$(top_builddir)/IlmImf \ +LDADD = -L$(top_builddir)/IlmImf \ + @ILMBASE_LDFLAGS@ @ILMBASE_LIBS@ \ -lIlmImf -lz imfexamples_SOURCES = main.cpp drawImage.cpp rgbaInterfaceExamples.cpp \ diff --git a/PyIlmBase/Makefile.am b/PyIlmBase/Makefile.am index e52130319f..8958023034 100644 --- a/PyIlmBase/Makefile.am +++ b/PyIlmBase/Makefile.am @@ -4,7 +4,7 @@ # (an alternative to the acinclude.m4 mechanism) ACLOCAL_AMFLAGS = -I m4 -PYIMATH_SUBDIRS = config PyIex PyImath +PYIMATH_SUBDIRS = config PyIex PyImath PyIexTest PyImathTest PYIMATHNUMPY_SUBDIRS = PyImathNumpy if BUILD_PYIMATHNUMPY diff --git a/PyIlmBase/PyIexTest/Makefile.am b/PyIlmBase/PyIexTest/Makefile.am index 0b09d59e95..0b5575ab2d 100644 --- a/PyIlmBase/PyIexTest/Makefile.am +++ b/PyIlmBase/PyIexTest/Makefile.am @@ -1,5 +1,4 @@ ## Process this file with automake to produce Makefile.in -check_PROGRAMS = pyIexTest - -TESTS = $(check_PROGRAMS) +# check_PROGRAMS = pyIexTest +# TESTS = $(check_PROGRAMS) diff --git a/PyIlmBase/PyImathNumpyTest/Makefile.am b/PyIlmBase/PyImathNumpyTest/Makefile.am index abf57dc4da..b32907c0a0 100644 --- a/PyIlmBase/PyImathNumpyTest/Makefile.am +++ b/PyIlmBase/PyImathNumpyTest/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -check_PROGRAMS = pyImathNumpyTest +# check_PROGRAMS = pyImathNumpyTest -TESTS = $(check_PROGRAMS) +# TESTS = $(check_PROGRAMS) diff --git a/PyIlmBase/PyImathTest/Makefile.am b/PyIlmBase/PyImathTest/Makefile.am index b0b9ef8e2c..4059ec4102 100644 --- a/PyIlmBase/PyImathTest/Makefile.am +++ b/PyIlmBase/PyImathTest/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -check_PROGRAMS = pyImathTest +# check_PROGRAMS = pyImathTest -TESTS = $(check_PROGRAMS) +# TESTS = $(check_PROGRAMS) From 5c3223127ce22e613a36853de1348a24d3df2e1f Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Sun, 22 Jul 2012 22:39:33 -0700 Subject: [PATCH 11/25] Updating the Changelog files accordingly. --- IlmBase/ChangeLog | 8 +- PyIlmBase/ChangeLog | 654 -------------------------------------------- 2 files changed, 6 insertions(+), 656 deletions(-) diff --git a/IlmBase/ChangeLog b/IlmBase/ChangeLog index 3516a77a16..c78cfe5658 100644 --- a/IlmBase/ChangeLog +++ b/IlmBase/ChangeLog @@ -1,4 +1,7 @@ Version 1.0.3 + * Added ImathNoise.(h/cpp) files. Initializes Perlin noise to match the + Renderman implmenetation. + (Pixar Contribution) * Fixed a number of missing includes to comply with stricter enforcement by gnu compilers. (Piotr Stanczyk) @@ -22,9 +25,10 @@ Version 1.0.3 directory, and several minor visual studio compile fixes have been applied. (Nick Rasmussen) - * Updated the so verison to 7 + * Updated the so verison to 7. + (Piotr Stanczyk) + * Depracated the MacCode_Warrior and Shake submodules. (Piotr Stanczyk) - Version 1.0.2 * Added support for targetting builds on 64bit Windows and minimising diff --git a/PyIlmBase/ChangeLog b/PyIlmBase/ChangeLog index 483dd61a7f..d35175a77f 100644 --- a/PyIlmBase/ChangeLog +++ b/PyIlmBase/ChangeLog @@ -1,657 +1,3 @@ - * Added new atttribute types: - M33dAttribute 3x3 double-precision matrix - M44dAttribute 4x4 double-precision matrix - V2d 2D double-precision vector - V3d 3D double-precision vector - (Florian Kainz) - * Bug fix: crash when reading a damaged image file (found - by Apple). An exception thrown inside the PIZ Huffman - decoder bypasses initialization of an array of pointers. - The uninitialized pointers are later passed to operator - delete. - (Florian Kainz) - * Bug fix: crash when reading a damaged image file (found by - Apple). Computing the size of input certain buffers may - overflow and wrap around to a small number, later causing - writes beyond the end of the buffer. - (Florian Kainz) - * In the "Technical Introduction" document, added - Premultiplied vs. Un-Premulitiplied Color section: - states explicitly that pixels with zero alpha and non-zero - RGB are allowed, points out that preserving such a pixel can - be a problem in application programs with un-premultiplied - internal image representations. - (Florian Kainz) - * exrenvmap improvements: - - New command line flags set the type of the input image to - latitude-longitude map or cube-face map, overriding the - envmap attribute in the input file header. - - Cube-face maps can now be assembled from or split into six - square sub-images. - - Converting a cube-face map into a new cube-face map with - the same face size copies the image instead of resampling - it. This avoids blurring when a cube-face map is assembled - from or split into sub-images. - (Florian Kainz) - * Updated standard chromaticities in ImfAcesFile.cpp to match - final ACES (Academy Color Encoding Specification) document. - (Florian Kainz) - * Added worldToCamera and worldToNDC matrices to - ImfStandardAttributes.h (Florian Kainz) - * Increased the maximum length of attribute and channel names - from 31 to 255 characters. For files that do contain names - longer than 31 characters, a new LONG_NAMES_FLAG in the fil - version number is set. This flag causes older versions of - the IlmImf library (1.6.1 and earlier) to reject files with - long names. Without the flag, older library versions would - mis-interpret files with long names as broken. - (Florian Kainz) - * Reading luminance/chroma-encoded files via the RGBA - interface is faster: buffer padding avoids cache thrashing - for certain image sizes, redundant calls to saturation() - have been eliminated. - (Mike Wall) - * Added "hemispherical blur" option to exrenvmap. - (Florian Kainz) - * Added experimental version of I/O classes for ACES file - format (restricted OpenEXR format with special primaries - and white point); added exr2aces file converter. - (Florian Kainz) - * Added new constructors to classes Imf::RgbaInputFile and - Imf::TiledRgbaInputFile. The new constructors have a - layerName parameter, which allows the caller to specify - which layer of a multi-layer or multi-view image will - be read. - (Florian Kainz) - * A number of member functions in classes Imf::Header, - Imf::ChannelList and Imf::FrameBuffer have parameters - of type "const char *". Added equivalent functions that - take "const std::string &" parameters. - (Florian Kainz) - * Added library support for Weta Digital multi-view images: - StringVector attribute type, multiView standard attribute - of type StringVector, utility functions related to grouping - channels into separate views. - (Peter Hillman, Florian Kainz) - -Version 1.6.1: - * Removed Windows .suo files from distribution. - (Eric Wimmer) - * Bug fix: crashes, memory leaks and file descriptor leaks - when reading damaged image files (some reported by Apple, - others found by running IlmImfFuzzTest). - (Florian Kainz) - * Added new IlmImfFuzzTest program to test how resilient the - IlmImf library is with respect broken input files: the program - first damages OpenEXR files by partially overwriting them with - random data; then it tries to read the damaged files. If all - goes well, the program doesn't crash. - (Florian Kainz) - -Version 1.6.0: - * Bumped DSO version number to 6.0 - (Florian Kainz) - * Added new standard attributes related to color rendering with - CTL (Color Transformation Language): renderingTransform, - lookModTransform and adoptedNeutral. - (Florian Kainz) - * Bug fix: for pixels with luminance near HALF_MIN, conversion - from RGB to luminance/chroma produces NaNs and infinities - (Florian Kainz) - * Bug fix: excessive desaturation of small details with certain - colors after repeatedly loading and saving luminance/chroma - encoded images with B44 compression. - (Florian Kainz) - * Added B44A compression, a minor variation of B44: in most cases, - the compression ratio is 2.28:1, the same as with B44, but in - uniform image areas where all pixels have the same value, the - compression ratio increases to 10.66:1. Uniform areas occur, for - example, in an image's alpha channel, which typically contains - large patches that are solid black or white, or in computer- - generated images with a black background. - (Florian Kainz) - * Added flag to configure.ac to enable or disable use of large - auto arrays in the IlmImf library. Default is "enable" for - Linux, "disable" for everything else. - (Darby Johnston, Florian Kainz) - * corrected version number on dso's (libtool) - now 5.0 - * Separated ILMBASE_LDFLAGS and ILMBASE_LIBS so that test programs - can link with static libraries properly - * eliminated some warning messages during install - (Andrew Kunz) - -Version 1.5.0: - * reorganized packaging of OpenEXR libraries to facilitate - integration with CTL. Now this library depends on the library - IlmBase. Some functionality has been moved into OpenEXR_Viewers, - which depends on two other libraries, CTL and OpenEXR_CTL. - Note: previously there were separate releases of - OpenEXR-related plugins for Renderman, Shake and Photoshop. - OpenEXR is supported natively by Rendermand and Photoshop, so - these plugins will not be supported for this or future - versions of OpenEXR. - (Andrew Kunz) - * New build scripts for Linux/Unix - (Andrew Kunz) - * New Windows project files and build scripts - (Kimball Thurston) - * float-to-half conversion now preserves the sign of float zeroes - and of floats that are so small that they become half zeroes. - (Florian Kainz) - * Bug fix: Imath::Frustum::planes() returns incorrect planes - if the frustum is orthogonal. - (Philip Hubbard) - * added new framesPerSecond optional standard attribute - (Florian Kainz) - * Imath cleanup: - - Rewrote function Imath::Quat::setRotation() to make it - numerically more accurate, added confidence tests - - Rewrote function Imath::Quat::slerp() using Don Hatch's - method, which is numerically more accurate, added confidence - tests. - - Rewrote functions Imath::closestPoints(), Imath::intersect(), - added confidence tests. - - Removed broken function Imath::nearestPointOnTriangle(). - - Rewrote Imath::drand48(), Imath::lrand48(), etc. to make - them functionally identical with the Unix/Linux versions - of drand48(), lrand48() and friends. - - Replaced redundant definitions of Int64 in Imath and IlmImf - with a single definition in ImathInt64.h. - (Florian Kainz) - * exrdisplay: if the file's and the display's RGB chromaticities - differ, the pixels RGB values are transformed from the file's - to the display's RGB space. - (Florian Kainz) - * Added new lossy B44 compression method. HALF channels are - compressed with a fixed ratio of 2.28:1. UINT and FLOAT - channels are stored verbatim, without compression. - (Florian Kainz) - -Version 1.4.0a: - * Fixed the ReleaseDLL targets for Visual Studio 2003. - (Barnaby Robson) - -Version 1.4.0: - * Production release. - * Bug Fix: calling setFrameBuffer() for every scan line - while reading a tiled file through the scan line API - returns bad pixel data. (Paul Schneider, Florian Kainz) - -Version 1.3.1: - * Fixed the ReleaseDLL targets for Visual Studio 2005. - (Nick Porcino, Drew Hess) - * Fixes/enhancements for createDLL. - (Nick Porcino) - -Version 1.3.0: - * Removed openexr.spec file, it's out of date and broken to - boot. - (Drew Hess) - * Support for Visual Studio 2005. - (Drew Hess, Nick Porcino) - * When compiling against OpenEXR headers on Windows, you - no longer need to define any HAVE_* or PLATFORM_* - macros in your projects. If you are using any OpenEXR - DLLs, however, you must define OPENEXR_DLL in your - project's preprocessor directives. - (Drew Hess) - * Many fixes to the Windows VC7 build system. - (Drew Hess, Nick Porcino) - * Support for building universal binaries on OS X 10.4. - (Drew Hess, Paul Schneider) - * Minor configure.ac fix to accomodate OS X's automake. - (Drew Hess) - * Removed CPU-specific optimizations from configure.ac, - autoconf's guess at the CPU type isn't very useful, - anyway. Closes #13429. - (Drew Hess) - * Fixed quoting for tests in configure.ac. Closes #13428. - (Drew Hess) - * Use host specification instead of target in configure.ac. - Closes #13427. - (Drew Hess) - * Fix use of AC_ARG_ENABLE in configure.ac. Closes - #13426. - (Drew Hess) - * Removed workaround for OS X istream::read bug. - (Drew Hess) - * Added pthread support to OpenEXR pkg-config file. - (Drew Hess) - * Added -no-undefined to LDFLAGS and required libs to LIBADD - for library projects with other library dependencies, per - Rex Dieter's patch. - (Drew Hess) - * HAVE_* macros are now defined in the OpenEXRConfig.h header - file instead of via compiler flags. There are a handful of - public headers which rely on the value of these macros, - and projects including these headers have previously needed - to define the same macros and values as used by OpenEXR's - 'configure', which is bad form. Now 'configure' writes these - values to the OpenEXRConfig.h header file, which is included - by any OpenEXR source files that need these macros. This - method of specifying HAVE_* macros guarantees that projects - will get the proper settings without needing to add compile- - time flags to accomodate OpenEXR. Note that this isn't - implemented properly for Windows yet. - (Drew Hess) - * Platform cleanups: - - No more support for IRIX or OSF1. - - No more explicit support for SunOS, because we have no way to - verify that it's working. I suspect that newish versions of - SunOS will just work out of the box, but let me know if not. - - No more PLATFORM_* macros (vestiges of the ILM internal build - system). PLATFORM_DARWIN_PPC is replaced by HAVE_DARWIN. - PLATFORM_REDHAT_IA32 (which was only used in IlmImfTest) is - replaced by HAVE_LINUX_PROCFS. - - OS X 10.4, which is the minimum version we're going to support - with this version, appears to have support for nrand48 and friends, - so no need to use the Imath-supplied version of them anymore. - (Drew Hess) - * No more PLATFORM_WINDOWS or PLATFORM_WIN32, replace with - proper standard Windows macros. (Drew Hess) - * Remove support for gcc 2.95, no longer supported. (Drew Hess) - * Eliminate HAVE_IOS_BASE macro, OpenEXR now requires support for - ios_base. (Drew Hess) - * Eliminate HAVE_STL_LIMITS macro, OpenEXR now requires the ISO C++ - header. (Drew Hess) - * Use double quote-style include dirctives for OpenEXR - includes. (Drew Hess) - * Added a document that gives an overview of the on-disk - layout of OpenEXR files (Florian Kainz) - * Added sections on layers and on memory-mapped file input - to the documentation. (Florian Kainz) - * Bug fix: reading an incomplete file causes a deadlock while - waiting on a semaphore. (Florian Kainz) - * Updated documentation (ReadingAndWritingImageFiles.sxw) and - sample code (IlmImfExamples): - Added a section about multi-threading, updated section on - thread-safety, changed documentation and sample code to use - readTiles()/writeTiles() instead of readTile()/writeTile() - where possible, mentioned that environment maps contain - redundant pixels, updated section on testing if a file is - an OpenEXR file. - (Florian Kainz) - * Multi-threading bug fixes (exceptions could be thrown - multiple times, some operations were not thread safe), - updated some comments, added comments, more multithreaded - testing. - (Florian Kainz) - * Added multi-threading support: multiple threads - cooperate to read or write a single OpenEXR file. - (Wojciech Jarosz) - * Added operator== and operator!= to Imath::Frustum. - (Andre Mazzone) - * Bug fix: Reading a PIZ-compressed file with an invalid - Huffman code table caused crashes by indexing off the - end of an array. - (Florian Kainz) - -Version 1.2.2: - * Updated README to remove option for building with Visual C++ 6.0. - (Drew Hess) - * Some older versions of gcc don't support a full iomanip - implemenation; check for this during configuration. - (Drew Hess) - * Install PDF versions of documentation, remove old/out-of-date - HTML documentation. (Florian Kainz) - * Removed vc/vc6 directory; Visual C++ 6.0 is no longer - supported. (Drew Hess) - * Updated README.win32 with details of new build system. - (Florian Kainz, Drew Hess) - * New build system for Windows / Visual C++ 7 builds both - static libraries and DLLs. - (Nick Porcino) - * Removed Imath::TMatrix and related classes, which are not - used anywhere in OpenEXR. - (Florian Kainz) - * Added minimal support for "image layers" to class Imf::ChannelList - (Florian Kainz) - * Added new isComplete() method to InputFile, TiledInputFile - etc., that checks if a file is complete or if any pixels - are missing (for example, because writing the file was - aborted prematurely). - (Florian Kainz) - * Exposed staticInitialize() function in ImfHeader.h in order - to allow thread-safe library initialization in multithreaded - programs. - (Florian Kainz) - * Added a new "time code" attribute - (Florian Kainz) - * exrmaketiled: when a MIPMAP_LEVELS or RIPMAP_LEVELS image - is produced, low-pass filtering takes samples outside the - image's data window. This requires extrapolating the image. - The user can now specify how the image is extrapolated - horizontally and vertically (image is surrounded by black / - outermost row of pixels repeats / entire image repeats / - entire image repeats, every other copy is a mirror image). - exrdisplay: added option to swap the top and botton half, - and the left and right half of an image, so that the image's - four corners end up in the center. This is useful for checking - the seams of wrap-around texture map images. - IlmImf library: Added new "wrapmodes" standard attribute - to indicate the extrapolation mode for MIPMAP_LEVELS and - RIPMAP_LEVELS images. - (Florian Kainz) - * Added a new "key code" attribute to identify motion picture - film frames. - (Florian Kainz) - * Removed #include from ImfAttribute.h, ImfHeader.h - and ImfXdr.h so that including header files such as - ImfInputFile.h no longer defines ASSERT and THROW macros, - which may conflict with similar macros defined by - application programs. - (Florian Kainz) - * Converted HTML documentation to OpenOffice format to - make maintaining the documents easier: - api.html -> ReadingAndWritingImageFiles.sxw - details.html -> TechnicalIntroduction.sxw - (Florian Kainz) - -Version 1.2.1: - * exrenvmap and exrmaketiled use slightly less memory - (Florian Kainz) - * Added functions to IlmImf for quickly testing if a file - is an OpenEXR file, and whether the file is scan-line - based or tiled. (Florian Kainz) - * Added preview image examples to IlmImfExamples. Added - description of preview images and environment maps to - docs/api.html (Florian Kainz) - * Bug fix: PXR24 compression did not work properly for channels - with ySampling != 1. - (Florian Kainz) - * Made template become template for - the transform(ObjectS, ObjectT) methods. This was done to allow - for differing templated objects to be passed in e.g. say a - Box> and a Matrix44, where S=float and T=double. - (Jeff Yost, Arkell Rasiah) - * New method Matrix44::setTheMatrix(). Used for assigning a - M44f to a M44d. (Jeff Yost, Arkell Rasiah) - * Added convenience Color typedefs for half versions of Color3 - and Color4. Note the Makefile.am for both Imath and ImathTest - have been updated with -I and/or -L pathing to Half. - (Max Chen, Arkell Rasiah) - * Methods equalWithAbsError() and equalWithRelError() are now - declared as const. (Colette Mullenhoff, Arkell Rasiah) - * Fixes for gcc34. Mainly typename/template/using/this syntax - correctness changes. (Nick Ramussen, Arkell Rasiah) - * Added Custom low-level file I/O examples to IlmImfExamples - and to the docs/api.html document. (Florian Kainz) - * Eliminated most warnings messages when OpenEXR is compiled - with Visual C++. The OpenEXR code uses lots of (intentional - and unintended) implicit type conversions. By default, Visual - C++ warns about almost all of them. Most implicit conversions - have been removed from the .h files, so that including them - should not generate warnings even at warning level 3. Most - .cpp files are now compiled with warning level 1. - (Florian Kainz) - -Version 1.2.0: - * Production-ready release. - * Disable long double warnings on OS X. (Drew Hess) - * Add new source files to VC7 IlmImfDll target. (Drew Hess) - * Iex: change the way that APPEND_EXC and REPLACE_EXC modify - their what() string to work around an issue with Visual C++ - 7.1. (Florian Kainz, Nick Porcino) - * Bumped OpenEXR version to 1.2 and .so versions to 2.0.0 in - preparation for the release. (Drew Hess) - * Imath: fixed ImathTMatrix.h to work with gcc 3.4. (Drew Hess) - * Another quoting fix in openexr.m4. (Drew Hess) - * Quoting fix in acinclude.m4 for automake 1.8. (Brad Hards) - * Imath: put inline at beginning of declaration in ImathMatrix.h - to fix a warning. (Ken McGaugh) - * Imath: made Vec equalWith*Error () methods const. - * Cleaned up compile-time Win32 support. (Florian Kainz) - * Bug fix: Reading a particular broken PIZ-compressed file - caused crashes by indexing off the end of an array. - (Florian Kainz) - -Version 1.1.1: - * Half: operator= and variants now return by reference rather - than by value. This brings half into conformance with - built-in types. (Drew Hess) - * Half: remove copy constructor, let compiler supply its - own. This improves performance up to 25% on some - expressions using half. (Drew Hess) - * configure: don't try to be fancy with CXXFLAGS, just use - what the user supplies or let configure choose a sensible - default if CXXFLAGS is not defined. - * IlmImf: fixed a bug in reading scanline files on big-endian - architectures. (Drew Hess) - * exrmaketiled: Added an option to select compression type. - (Florian Kainz) - * exrenvmap: Added an option to select compression type. - (Florian Kainz) - * exrdisplay: Added some new command-line options. (Florian Kainz) - * IlmImf: Added Pixar's new "slightly lossy" image compression - method. The new method, named PXR24, preserves HALF and - UINT data without loss, but FLOAT pixels are converted to - a 24-bit representation. PXR24 appears to compress - FLOAT depth buffers very well without losing much accuracy. - (Loren Carpenter, Florian Kainz) - * Changed top-level LICENSE file to allow for other copyright - holders for individual files. - * IlmImf: TILED FILE FORMAT CHANGE. TiledOutputFile was - incorrectly interleaving channels and scanlines before - passing pixel data to a compressor. The lossless compressors - still work, but lossy compressors do not. Fix the bug by - interleaving channels and scanlines in tiled files in the - same way as ScanLineOutputFile does. Programs compiled with - the new version of IlmImf cannot read tiled images produced - with version 1.1.0. (Florian Kainz) - * IlmImf: ImfXdr.h fix for 64-bit architectures. (Florian Kainz) - * IlmImf: OpenEXR now supports YCA (luminance/chroma/alpha) - images with subsampled chroma channels. When an image - is written with the RGBA convenience interface, selecting - WRITE_YCA instead of WRITE_RGBA causes the library to - convert the pixels to YCA format. If WRITE_Y is selected, - only luminance is stored in the file (for black and white - images). When an image file is read with the RGBA convenience - interface, YCA data are automatically converted back to RGBA. - (Florian Kainz) - * IlmImf: speed up reading tiled files as scan lines. - (Florian Kainz) - * Half: Fixed subtle bug in Half where signaling float NaNs - were being converted to inf in half. (Florian Kainz) - * gcc 3.3 compiler warning cleanups. (various) - * Imath: ImathEuler.h fixes for gcc 3.4. (Garrick Meeker) - -Version 1.1.0: - * Added new targets to Visual C++ .NET 2003 project - for exrmaketiled, exrenvmap, exrmakepreview, and exrstdattr. - (Drew Hess) - * A few assorted Win32 fixes for Imath. (Drew Hess) - * GNU autoconf builds now produce versioned libraries. - This release is 1:0:0. (Drew Hess) - * Fixes for Visual C++ .NET 2003. (Paul Schneider) - * Updated Visual C++ zlib project file to zlib 1.2.1. - (Drew Hess) - * exrdisplay: Fixed fragment shader version. (Drew Hess) - * *Test: Fixed some compiler issues. (Drew Hess) - * Imath: Handle "restrict" keyword properly. (Drew Hess) - * IlmImfExamples: Updated to latest versions of example - source code, includes tiling and multi-res images. - (Florian Kainz) - * exrmakepreview: A new utility to create preview images. - (Florian Kainz) - * exrenvmap: A new utility to create OpenEXR environment - maps. (Florian Kainz) - * exrstdattr: A new utility to modify standard - attributes. (Florian Kainz) - * Updated exrheader to print level rounding mode and - preview image size. (Florian Kainz) - * Updated exrmaketiled to use level rounding mode. - (Florian Kainz) - * IlmImf: Changed the orientation of lat-long envmaps to - match typical panoramic camera setups. (Florian Kainz) - * IlmImf: Fixed a bug where partially-completed files with - DECREASING_Y could not be read. (Florian Kainz) - * IlmImf: Added support for selectable rounding mode (up/down) - when generating multiresolution files. (Florian Kainz) - * exrdisplay: Support for tiled images, mip/ripmaps, preview - images, and display windows. (Florian Kainz, Drew Hess) - * exrmaketiled: A new utility which generates tiled - versions of OpenEXR images. (Florian Kainz) - * IlmImf: Changed Imf::VERSION to Imf::EXR_VERSION to - work around problems with autoconf VERSION macro - conflict. (Drew Hess) - * exrheader: Support for tiles, mipmaps, environment - maps. (Florian Kainz) - * IlmImf: Environment map support. (Florian Kainz) - * IlmImf: Abstracted stream I/O support. (Florian Kainz) - * IlmImf: Support for tiled and mip/ripmapped files; - requires new file format. (Wojciech Jarosz, Florian Kainz) - * Imath: TMatrix*, generic 2D matricies and algorithms. - (Francesco Callari) - * Imath: major quaternions cleanup. (Cary Phillips) - * Imath: added GLBegin, GLPushAttrib, GLPushMatrix objects - for automatic cleanup on exceptions. (Cary Phillips) - * Imath: removed implicit scalar->vector promotions and vector - comparisons. (Nick Rasmussen) - -Version 1.0.7: - * Fixed a typo in one of the IlmImfTest tests. (Paul Schneider) - * Fixed a bug in exrdisplay that causes the image to display - as all black if there's a NaN or infinity in an OpenEXR - image. (Florian Kainz) - * Updated exrheader per recent changes to IlmImf library. - (Florian Kainz) - * Changed an errant float to a T in ImathFrame.h nextFrame(). - (Cary Phillips) - * Support for new "optional standard" attributes - (chromaticities, luminance, comments, etc.). - (Florian Kainz, Greg Ward, Joseph Goldstone) - * Fixed a buffer overrun in ImfOpaqueAttribute. (Paul Schneider) - * Added new function, isImfMagic (). (Florian Kainz) - -Version 1.0.6: - * Added README.win32 to disted files. - * Fixed OpenEXR.pc.in pkg-config file, OpenEXR now works - with pkg-config. - * Random fixes to readme files for new release. - * Fixed openexr.m4, now looks in /usr by default. - * Added Visual Studio .NET 2003 "solution." - * Fixes for Visual Studio .NET 2003 w/ Microsoft C++ compiler. - (Various) - * Random Imath fixes and enhancements. Note that - extractSHRT now takes an additional optional - argument, see ImathMatrixAlgo.h for details. (Various) - * Added Wojciech Jarosz to AUTHORS file. - * Added test cases for uncompressed case, preview images, - frame buffer type conversion. (Wojciech Jarosz, - Florian Kainz) - * Fix a bug in IlmImf where uncompressed data doesn't get - read/written correctly. (Wojciech Jarosz) - * Added support for preview images and preview image - attributes (thumbnail images) in IlmImf. (Florian Kainz) - * Added support for automatic frame buffer type conversion - in IlmImf. (Florian Kainz) - * Cleaned up some compile-time checks. - * Added HalfTest unit tests. - * [exrdisplay] Download half framebuffer to texture memory - instead of converting to float first. Requires latest - Nvidia drivers. - -Version 1.0.5: - * Fixed IlmImf.dll to use static runtime libs (Andreas). - * Added exrheader project to Visual Studio 6.0 workspace. - * Added some example code showing how to use the IlmImf library. - (Florian) - * Use DLL runtime libs for Win32 libraries rather than static - runtime libs. - * Add an exrdisplay_fragshader project to the Visual Studio 6.0 - workspace to enable fragment shaders in Win32. - * Add an IlmImfDll project to the Visual Studio 6.0 workspace. - * In Win32, export the ImfCRgbaFile C interface via a DLL so - that Visual C++ 6.0 users can link against an Intel-compiled - IlmImf. (Andreas Kahler) - * Use auto_ptr in ImfAutoArray on Win32, it doesn't like large - automatic stacks. - * Performance improvements in PIZ decoding, between - 20 and 60% speedup on Athlon and Pentium 4 systems. - (Florian) - * Updated the README with various information, made - some cosmetic changes for readability. - * Added fragment shader support to exrdisplay. - * Bumped the version to 1.0.5 in prep for release. - * Updated README and README.OSX to talk about CodeWarrior - project files. - * Incorporated Rodrigo Damazio's patch for an openexr.m4 - macro file and an openexr.spec file for building RPMs. - * Small change in ImfAttribute.h to make IlmImf compile with gcc 2.95. - * Updated ImfDoubleAttribute.h for Codewarrior on MacOS. - * Added exrheader utility. - * Update to AUTHORS file. - * Added a README.win32 file. - * Added project files for Visual Studio 6.0. - * Initial Win32 port. Requires Visual Studio 6.0 and Intel C++ - compiler version 7.0. - * Added new intersectT method in ImathSphere.h - * Fixed some bugs in ImathQuat.h - * Proper use of fltk-config to get platform-specific FLTK - compile- and link-time flags. - * exrdisplay uses Imath::Math::pow instead of powf now. - powf is not availble on all platforms. - * Roll OS X "hack" into the source until Apple fixes their - istream implementation. - -Version 1.0.4: - * OpenEXR is now covered by a modified BSD license. See LICENSE - for the new terms. - -Version 1.0.3: - - * OpenEXR is now in sf.net CVS. - * Imf::Xdr namespace cleanups. - * Some IlmImfTest cleanups for OS X. - * Use .cpp extension in exrdisplay sources. - * Iex cleanups. - * Make IlmImf compile with Metrowerks Codewarrior. - * Change large automatic stacks in ImfHuf.C to auto_ptrs allocated - off the heap. MacOS X default stack size isn't large enough. - * std::ios fix for MacOS X in ImfInputFile.C. - * Added new FP predecessor/successor functions to Imath, added - tests to ImathTest - * Fixed a bug in Imath::extractSHRT for 3x3 matricies when - exactly one of the original scaling factors is negative, updated - ImathTest to check this case. - * Install include files when 'make install' is run. - * exrdisplay requires fltk 1.1+ now in an effort to support - a MacOS X display program (fltk 1.1 runs on OS X), though this - is untested. - * renamed configure.in to configure.ac - * Removed some tests from IexTest that are no longer used. - * Removed ImfHalfXdr.h, it's not used anymore. - * Revamped the autoconf system, added some compile-time - optimizations, a pkgconfig target, and some maintainer-specific - stuff. - -Version 1.0.2: - - * More OS X fixes in Imath, IlmImf and IlmImfTest. - * Imath updates. - * Fixed a rotation bug in Imath - -Version 1.0.1: - - * Used autoconf 2.53 and automake 1.6 to generate build environment. - * Makefile.am cleanups. - * OS X fixes. - * removed images directory (now distributed separately). - Version 1.0: * first official release. - * added some high-level documentation, removed the old OpenEXR.html - documentation. - * fixed a few nagging build problems. - * bumped IMV_VERSION_NUMBER to 2 - -Version 0.9: - - * added exrdisplay viewer application. - * cleanup _data in Imf::InputFile and Imf::OutputFile constructors. - * removed old ILM copyright notices. - -Version 0.8: - - * Initial release. From 3b490139b47536015bcfb07a80cee8c45f1803cb Mon Sep 17 00:00:00 2001 From: Piotr Date: Sun, 22 Jul 2012 22:42:48 -0700 Subject: [PATCH 12/25] Update README --- README | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README b/README index 7e4f1dd88a..887396c0d7 100644 --- a/README +++ b/README @@ -32,12 +32,12 @@ license. The distribution is divided into the following sub-modules: * IlmBase * OpenEXR - * OpenEXR-image - * OpenEXR_MacCodeWarrior - * OpenEXR_Shake * OpenEXR_Viewers * Photoshop * d_exr Please see the README files of each of the individual directories for more information. + +A collection of OpenEXR images are available from the adjecent repository: + openexr-images From 63e3627213e6d7a352210f76c0004fb88d5e19e0 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 18 Jun 2012 23:35:33 +0200 Subject: [PATCH 13/25] Fix build with gcc-4.5 --- IlmBase/Imath/ImathMatrix.h | 1 + 1 file changed, 1 insertion(+) diff --git a/IlmBase/Imath/ImathMatrix.h b/IlmBase/Imath/ImathMatrix.h index 58874122eb..bbf8cd10e5 100644 --- a/IlmBase/Imath/ImathMatrix.h +++ b/IlmBase/Imath/ImathMatrix.h @@ -49,6 +49,7 @@ #include "ImathVec.h" #include "ImathShear.h" +#include #include #include #include From d0abc36a99ff89a190687467e7b4c3df664307f0 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Mon, 18 Jun 2012 23:36:35 +0200 Subject: [PATCH 14/25] Fix build with gcc-4.7 --- IlmBase/IexMath/IexMathFpu.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IlmBase/IexMath/IexMathFpu.cpp b/IlmBase/IexMath/IexMathFpu.cpp index c0e26595e6..9967c042d6 100644 --- a/IlmBase/IexMath/IexMathFpu.cpp +++ b/IlmBase/IexMath/IexMathFpu.cpp @@ -14,6 +14,8 @@ // //------------------------------------------------------------------------ +#include + #include #include From c476b30e9cea353514a0b60d3e8103910d0c0a8f Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Tue, 19 Jun 2012 23:27:57 +0200 Subject: [PATCH 15/25] Fix make dist - removal of deprecated .cvsignore --- IlmBase/vc/Makefile.am | 56 +----------------------------------------- 1 file changed, 1 insertion(+), 55 deletions(-) diff --git a/IlmBase/vc/Makefile.am b/IlmBase/vc/Makefile.am index af47a86172..970adea470 100644 --- a/IlmBase/vc/Makefile.am +++ b/IlmBase/vc/Makefile.am @@ -12,85 +12,31 @@ EXTRA_DIST = \ createDLL/createDLL.cpp \ vc7/IlmBase/IlmBase.sln \ vc7/IlmBase/Half/Half.vcproj \ - vc7/IlmBase/Half/Debug/.cvsignore \ - vc7/IlmBase/Half/Release/.cvsignore \ vc7/IlmBase/HalfTest/HalfTest.vcproj \ - vc7/IlmBase/HalfTest/Debug/.cvsignore \ - vc7/IlmBase/HalfTest/Release/.cvsignore \ vc7/IlmBase/Iex/Iex.vcproj \ - vc7/IlmBase/Iex/Debug/.cvsignore \ - vc7/IlmBase/Iex/Release/.cvsignore \ vc7/IlmBase/IexTest/IexTest.vcproj \ - vc7/IlmBase/IexTest/Debug/.cvsignore \ - vc7/IlmBase/IexTest/Release/.cvsignore \ vc7/IlmBase/IlmThread/IlmThread.vcproj \ - vc7/IlmBase/IlmThread/Debug/.cvsignore \ - vc7/IlmBase/IlmThread/Release/.cvsignore \ vc7/IlmBase/Imath/Imath.vcproj \ - vc7/IlmBase/Imath/Debug/.cvsignore \ - vc7/IlmBase/Imath/Release/.cvsignore \ vc7/IlmBase/ImathTest/ImathTest.vcproj \ - vc7/IlmBase/ImathTest/Debug/.cvsignore \ - vc7/IlmBase/ImathTest/Release/.cvsignore \ vc7/IlmBase/createDLL/createDLL.vcproj \ - vc7/IlmBase/createDLL/Debug/.cvsignore \ - vc7/IlmBase/createDLL/Release/.cvsignore \ - vc7/IlmBase/debug/.cvsignore \ - vc7/IlmBase/release/.cvsignore \ vc8/IlmBase/IlmBase.sln \ vc8/IlmBase/Half/Half.vcproj \ - vc8/IlmBase/Half/Debug/.cvsignore \ - vc8/IlmBase/Half/Release/.cvsignore \ vc8/IlmBase/HalfTest/HalfTest.vcproj \ - vc8/IlmBase/HalfTest/Debug/.cvsignore \ - vc8/IlmBase/HalfTest/Release/.cvsignore \ vc8/IlmBase/Iex/Iex.vcproj \ - vc8/IlmBase/Iex/Debug/.cvsignore \ - vc8/IlmBase/Iex/Release/.cvsignore \ vc8/IlmBase/IexTest/IexTest.vcproj \ - vc8/IlmBase/IexTest/Debug/.cvsignore \ - vc8/IlmBase/IexTest/Release/.cvsignore \ vc8/IlmBase/IlmThread/IlmThread.vcproj \ - vc8/IlmBase/IlmThread/Debug/.cvsignore \ - vc8/IlmBase/IlmThread/Release/.cvsignore \ vc8/IlmBase/Imath/Imath.vcproj \ - vc8/IlmBase/Imath/Debug/.cvsignore \ - vc8/IlmBase/Imath/Release/.cvsignore \ vc8/IlmBase/ImathTest/ImathTest.vcproj \ - vc8/IlmBase/ImathTest/Debug/.cvsignore \ - vc8/IlmBase/ImathTest/Release/.cvsignore \ vc8/IlmBase/createDLL/createDLL.vcproj \ - vc8/IlmBase/createDLL/Debug/.cvsignore \ - vc8/IlmBase/createDLL/Release/.cvsignore \ - vc8/IlmBase/debug/.cvsignore \ - vc8/IlmBase/release/.cvsignore \ vc9/IlmBase/IlmBase.sln \ vc9/IlmBase/Half/Half.vcproj \ - vc9/IlmBase/Half/Debug/.cvsignore \ - vc9/IlmBase/Half/Release/.cvsignore \ vc9/IlmBase/HalfTest/HalfTest.vcproj \ - vc9/IlmBase/HalfTest/Debug/.cvsignore \ - vc9/IlmBase/HalfTest/Release/.cvsignore \ vc9/IlmBase/Iex/Iex.vcproj \ - vc9/IlmBase/Iex/Debug/.cvsignore \ - vc9/IlmBase/Iex/Release/.cvsignore \ vc9/IlmBase/IexTest/IexTest.vcproj \ - vc9/IlmBase/IexTest/Debug/.cvsignore \ - vc9/IlmBase/IexTest/Release/.cvsignore \ vc9/IlmBase/IlmThread/IlmThread.vcproj \ - vc9/IlmBase/IlmThread/Debug/.cvsignore \ - vc9/IlmBase/IlmThread/Release/.cvsignore \ vc9/IlmBase/Imath/Imath.vcproj \ - vc9/IlmBase/Imath/Debug/.cvsignore \ - vc9/IlmBase/Imath/Release/.cvsignore \ vc9/IlmBase/ImathTest/ImathTest.vcproj \ - vc9/IlmBase/ImathTest/Debug/.cvsignore \ - vc9/IlmBase/ImathTest/Release/.cvsignore \ - vc9/IlmBase/createDLL/createDLL.vcproj \ - vc9/IlmBase/createDLL/Debug/.cvsignore \ - vc9/IlmBase/createDLL/Release/.cvsignore \ - vc9/IlmBase/debug/.cvsignore \ - vc9/IlmBase/release/.cvsignore + vc9/IlmBase/createDLL/createDLL.vcproj From 20ab2e57f72681e3b6860f9a8154c5b69cee6be9 Mon Sep 17 00:00:00 2001 From: kwizart Date: Fri, 27 Jul 2012 17:54:04 -0700 Subject: [PATCH 16/25] Various fixes for recent gcc needed by OpenEXR_Viewers --- OpenEXR_Viewers/exrdisplay/applyCtl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/OpenEXR_Viewers/exrdisplay/applyCtl.cpp b/OpenEXR_Viewers/exrdisplay/applyCtl.cpp index 0a801ee663..73a370d5d2 100644 --- a/OpenEXR_Viewers/exrdisplay/applyCtl.cpp +++ b/OpenEXR_Viewers/exrdisplay/applyCtl.cpp @@ -49,6 +49,7 @@ #include #include #include + #include #include using namespace std; @@ -62,6 +63,7 @@ #include #include #include + #include #include using namespace std; From 6c50c42a6e4271de8404de3110e70361119cd8f1 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 27 Jul 2012 21:03:28 +0200 Subject: [PATCH 17/25] Fix OpenEXR pkg-config file - -lz is not used directly, but is needed when linking statically - Fetch CFLAGS and LDFLAGS from the IlmBase.pc --- OpenEXR/OpenEXR.pc.in | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenEXR/OpenEXR.pc.in b/OpenEXR/OpenEXR.pc.in index df0b46c1bc..82ee00dc78 100644 --- a/OpenEXR/OpenEXR.pc.in +++ b/OpenEXR/OpenEXR.pc.in @@ -7,5 +7,7 @@ OpenEXR_includedir=@includedir@/OpenEXR Name: OpenEXR Description: OpenEXR image library Version: @OPENEXR_VERSION@ -Libs: -L${libdir} @ILMBASE_LDFLAGS@ -lIlmImf -lz @ILMBASE_LIBS@ -Cflags: @ILMBASE_CXXFLAGS@ -I${OpenEXR_includedir} +Requires: IlmBase +Libs: -L${libdir} -lIlmImf +Libs.private: -lz +Cflags: -I${OpenEXR_includedir} From c45c85d8ad5c04bb891786e918d3f8c5a99fe6ae Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 27 Jul 2012 22:13:01 +0200 Subject: [PATCH 18/25] Fix for gcc-4.3 --- OpenEXR_Viewers/configure.ac | 1 + OpenEXR_Viewers/exrdisplay/applyCtl.h | 1 + OpenEXR_Viewers/playexr/ctlToLut.h | 1 + OpenEXR_Viewers/playexr/main.cpp | 1 + 4 files changed, 4 insertions(+) diff --git a/OpenEXR_Viewers/configure.ac b/OpenEXR_Viewers/configure.ac index cdfbed1e3a..21c4250961 100644 --- a/OpenEXR_Viewers/configure.ac +++ b/OpenEXR_Viewers/configure.ac @@ -126,6 +126,7 @@ AM_COMPILELINKRUN( #include #include #include +#include using namespace Ctl; using namespace Imf; using namespace Imath; diff --git a/OpenEXR_Viewers/exrdisplay/applyCtl.h b/OpenEXR_Viewers/exrdisplay/applyCtl.h index 2382b2f828..66cc6da90c 100644 --- a/OpenEXR_Viewers/exrdisplay/applyCtl.h +++ b/OpenEXR_Viewers/exrdisplay/applyCtl.h @@ -49,6 +49,7 @@ #include #include #include +#include // // Apply a series of CTL transforms to the raw pixel data from an image file diff --git a/OpenEXR_Viewers/playexr/ctlToLut.h b/OpenEXR_Viewers/playexr/ctlToLut.h index d71d086342..09e5a2ac96 100644 --- a/OpenEXR_Viewers/playexr/ctlToLut.h +++ b/OpenEXR_Viewers/playexr/ctlToLut.h @@ -88,6 +88,7 @@ #include #include #include +#include void diff --git a/OpenEXR_Viewers/playexr/main.cpp b/OpenEXR_Viewers/playexr/main.cpp index 9cf123531d..f5ee402a9f 100644 --- a/OpenEXR_Viewers/playexr/main.cpp +++ b/OpenEXR_Viewers/playexr/main.cpp @@ -49,6 +49,7 @@ #include #include #include +#include using namespace std; From f7203a43ce9f6fedcd4111a96c432208b2e4051f Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 27 Jul 2012 22:15:10 +0200 Subject: [PATCH 19/25] Fix for gcc-4.7 --- OpenEXR_Viewers/playexr/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenEXR_Viewers/playexr/main.cpp b/OpenEXR_Viewers/playexr/main.cpp index f5ee402a9f..963d47543e 100644 --- a/OpenEXR_Viewers/playexr/main.cpp +++ b/OpenEXR_Viewers/playexr/main.cpp @@ -49,6 +49,7 @@ #include #include #include +#include #include using namespace std; From bf3646713112928907af4ca8ef1755256af89293 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 27 Jul 2012 22:16:18 +0200 Subject: [PATCH 20/25] Fix for gcc-4.4 - Cg enabled build --- OpenEXR_Viewers/playexr/ctlToLut.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenEXR_Viewers/playexr/ctlToLut.cpp b/OpenEXR_Viewers/playexr/ctlToLut.cpp index a0aa418953..35f352500d 100644 --- a/OpenEXR_Viewers/playexr/ctlToLut.cpp +++ b/OpenEXR_Viewers/playexr/ctlToLut.cpp @@ -38,6 +38,7 @@ // //----------------------------------------------------------------------------- +#include #include #if HAVE_CTL_INTERPRETER From 73dfd7a4501e9e868727c155410993e0f98b4847 Mon Sep 17 00:00:00 2001 From: Nicolas Chauvet Date: Fri, 27 Jul 2012 22:22:41 +0200 Subject: [PATCH 21/25] Fix OpenEXR for gcc-4.7 --- OpenEXR/exrenvmap/blurImage.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenEXR/exrenvmap/blurImage.cpp b/OpenEXR/exrenvmap/blurImage.cpp index 9700914a11..391fc84b62 100644 --- a/OpenEXR/exrenvmap/blurImage.cpp +++ b/OpenEXR/exrenvmap/blurImage.cpp @@ -42,6 +42,7 @@ #include #include +#include #include "Iex.h" #include #include From b2d8dc16ef70d86f4a3f883e8ed79d1e0da9888e Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 30 Jul 2012 15:39:54 -0700 Subject: [PATCH 22/25] Support for large stack optimisation. This addresses issues where using the halfFunction class resulted in memory issues on certain systems. You can now disable this during configuration time. Follows the same pattern as that of the OpenEXR module. --- IlmBase/Half/halfFunction.h | 23 +++++++++++++++++++++-- IlmBase/config/IlmBaseConfig.h.in | 8 ++++++++ IlmBase/configure.ac | 26 +++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/IlmBase/Half/halfFunction.h b/IlmBase/Half/halfFunction.h index 19838802e0..37dbf50dc9 100644 --- a/IlmBase/Half/halfFunction.h +++ b/IlmBase/Half/halfFunction.h @@ -83,9 +83,16 @@ #ifndef _HALF_FUNCTION_H_ #define _HALF_FUNCTION_H_ -#include #include "half.h" +#include +#ifndef ILMBASE_HAVE_LARGE_STACK +#include // need this for memset +#else +#endif + +#include + template class halfFunction @@ -105,6 +112,10 @@ class halfFunction T negInfValue = 0, T nanValue = 0); +#ifndef ILMBASE_HAVE_LARGE_STACK + ~halfFunction () { delete [] _lut; } +#endif + //----------- // Evaluation //----------- @@ -112,8 +123,11 @@ class halfFunction T operator () (half x) const; private: - +#ifdef ILMBASE_HAVE_LARGE_STACK T _lut[1 << 16]; +#else + T * _lut; +#endif }; @@ -131,6 +145,11 @@ halfFunction::halfFunction (Function f, T negInfValue, T nanValue) { +#ifndef ILMBASE_HAVE_LARGE_STACK + _lut = new T[1<<16]; + memset (_lut, 0 , (1<<16) * sizeof(T)); +#endif + for (int i = 0; i < (1 << 16); i++) { half x; diff --git a/IlmBase/config/IlmBaseConfig.h.in b/IlmBase/config/IlmBaseConfig.h.in index 5e89280441..af243e40a7 100644 --- a/IlmBase/config/IlmBaseConfig.h.in +++ b/IlmBase/config/IlmBaseConfig.h.in @@ -15,6 +15,14 @@ #undef HAVE_UCONTEXT_H +// +// Define and set to 1 if the target system has support for large +// stack sizes. +// + +#undef ILMBASE_HAVE_LARGE_STACK + + // // Version string for runtime access // diff --git a/IlmBase/configure.ac b/IlmBase/configure.ac index ba469d1e3d..054af4a462 100644 --- a/IlmBase/configure.ac +++ b/IlmBase/configure.ac @@ -81,6 +81,29 @@ AC_DEFINE(HAVE_COMPLETE_IOMANIP) complete_iomanip=yes) AC_MSG_RESULT($complete_iomanip) AC_LANG_RESTORE +dnl --enable-large-stack +case "$host" in +*linux*) + AC_ARG_ENABLE(large-stack, + AC_HELP_STRING([--enable-large-stack], + [enable optimizations for systems that support + large stack sizes [[default=yes]]]), + [large_stack="${enableval}"], + [large_stack=yes]) + ;; +*) + AC_ARG_ENABLE(large-stack, + AC_HELP_STRING([--enable-large-stack], + [enable optimizations for systems that support + large stack sizes [[default=no]]]), + [large_stack="${enableval}"], + [large_stack=no]) + ;; +esac + +if test "x${large_stack}" != xno ; then + AC_DEFINE(ILMBASE_HAVE_LARGE_STACK) +fi dnl Define the version string AC_DEFINE_UNQUOTED(ILMBASE_VERSION_STRING, "${VERSION}") @@ -188,6 +211,7 @@ Summary for IlmBase features: OS X architectures $osx_arch OS X SDK $osx_sdk OS X two-way universal build (deprecated) $build_osxuniversal +enable large stack optimizations $large_stack --------------------------------------------- ]) else @@ -195,7 +219,7 @@ else --------------------------------------------- Summary for IlmBase features: -No variable options in this package. Configure completed successfully. +enable large stack optimizations $large_stack --------------------------------------------- ]) fi From b8008b1726650b68d4702ba0f3cd1f9a327a9bfd Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 30 Jul 2012 15:45:58 -0700 Subject: [PATCH 23/25] Updated Changelog --- IlmBase/ChangeLog | 3 +++ 1 file changed, 3 insertions(+) diff --git a/IlmBase/ChangeLog b/IlmBase/ChangeLog index c78cfe5658..2e409d2de4 100644 --- a/IlmBase/ChangeLog +++ b/IlmBase/ChangeLog @@ -1,4 +1,7 @@ Version 1.0.3 + * Added support for enabling/disabling large stack optimisations, used in + halfFunction.h. + (Piotr Stanczyk) * Added ImathNoise.(h/cpp) files. Initializes Perlin noise to match the Renderman implmenetation. (Pixar Contribution) From cbbdfb8c580a924a510d9355dcb649e227f2f69c Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 30 Jul 2012 15:52:15 -0700 Subject: [PATCH 24/25] Added the version for that last change in the Changelog - no functional changes. --- OpenEXR_Viewers/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenEXR_Viewers/ChangeLog b/OpenEXR_Viewers/ChangeLog index aae9e4732a..2fd97858b4 100644 --- a/OpenEXR_Viewers/ChangeLog +++ b/OpenEXR_Viewers/ChangeLog @@ -1,3 +1,4 @@ +Version 1.0.2: * Added a new -L command-line flag to exrdisplay. The flag specifies which layer in a multi-layer or multi-view image should be displayed on the screen. From ea2582272f8423efc3e8f58cff6f0200784c882d Mon Sep 17 00:00:00 2001 From: Piotr Stanczyk Date: Mon, 30 Jul 2012 17:48:11 -0700 Subject: [PATCH 25/25] Taking out Noise functions for the time being. We will be adding these back in but with a Perlin moniker. --- IlmBase/Imath/ImathNoise.cpp | 911 ----------------------------- IlmBase/Imath/ImathNoise.h | 253 -------- IlmBase/Imath/Makefile.am | 5 +- PyIlmBase/PyImath/Makefile.am | 2 - PyIlmBase/PyImath/PyImathNoise.cpp | 257 -------- PyIlmBase/PyImath/PyImathNoise.h | 267 --------- PyIlmBase/PyImath/imathmodule.cpp | 51 -- 7 files changed, 2 insertions(+), 1744 deletions(-) delete mode 100644 IlmBase/Imath/ImathNoise.cpp delete mode 100644 IlmBase/Imath/ImathNoise.h delete mode 100644 PyIlmBase/PyImath/PyImathNoise.cpp delete mode 100644 PyIlmBase/PyImath/PyImathNoise.h diff --git a/IlmBase/Imath/ImathNoise.cpp b/IlmBase/Imath/ImathNoise.cpp deleted file mode 100644 index b1ba29d54e..0000000000 --- a/IlmBase/Imath/ImathNoise.cpp +++ /dev/null @@ -1,911 +0,0 @@ -// -// Copyright (C) Pixar. All rights reserved. -// -// This license governs use of the accompanying software. If you -// use the software, you accept this license. If you do not accept -// the license, do not use the software. -// -// 1. Definitions -// The terms "reproduce," "reproduction," "derivative works," and -// "distribution" have the same meaning here as under U.S. -// copyright law. A "contribution" is the original software, or -// any additions or changes to the software. -// A "contributor" is any person or entity that distributes its -// contribution under this license. -// "Licensed patents" are a contributor's patent claims that read -// directly on its contribution. -// -// 2. Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, -// including the license conditions and limitations in section 3, -// each contributor grants you a non-exclusive, worldwide, -// royalty-free copyright license to reproduce its contribution, -// prepare derivative works of its contribution, and distribute -// its contribution or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, -// including the license conditions and limitations in section 3, -// each contributor grants you a non-exclusive, worldwide, -// royalty-free license under its licensed patents to make, have -// made, use, sell, offer for sale, import, and/or otherwise -// dispose of its contribution in the software or derivative works -// of the contribution in the software. -// -// 3. Conditions and Limitations -// (A) No Trademark License- This license does not grant you -// rights to use any contributor's name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over -// patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends -// automatically. -// (C) If you distribute any portion of the software, you must -// retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source -// code form, you may do so only under this license by including a -// complete copy of this license with your distribution. If you -// distribute any portion of the software in compiled or object -// code form, you may only do so under a license that complies -// with this license. -// (E) The software is licensed "as-is." You bear the risk of -// using it. The contributors give no express warranties, -// guarantees or conditions. You may have additional consumer -// rights under your local laws which this license cannot change. -// To the extent permitted under your local laws, the contributors -// exclude the implied warranties of merchantability, fitness for -// a particular purpose and non-infringement. -// - -//----------------------------------------------------- -// -// Implementation of non-template items declared in ImathNoise.h -// -//----------------------------------------------------- - -#include -#include - -namespace Imath { - -// Local namespace to avoid any possible -// conflicts -namespace { - -static const int TABSIZE = 1<<8; -static const int TABMASK = TABSIZE-1; - -// Need these structs because compiler disallows inline declaration of an array -// of templated types. -// FIXME someday? -struct gradF -{ - float x; - float y; - float z; -}; - -struct gradD -{ - double x; - double y; - double z; -}; - -// Gradient table -// Note that this gradient table is prescaled to avoid extra multiplications -#define __GRADS { \ - { 0.788314, -0.627167, -0.773665 }, \ - { 0.835654, 0.069542, 0.954034 }, \ - { 0.862828, -0.309454, 0.879260 }, \ - { 0.042682, 0.584865, 1.126696 }, \ - { 0.737730, 0.026284, 1.033633 }, \ - { 0.110664, -0.828499, 0.956388 }, \ - { 0.424872, -1.138934, 0.368302 }, \ - { 0.654991, 0.665466, -0.861089 }, \ - { 0.635469, 0.311065, -1.054870 }, \ - { 0.338959, 1.132728, -0.464077 }, \ - { 0.916530, 0.646707, 0.595883 }, \ - { 0.987652, 0.798522, 0.015472 }, \ - { 0.500117, -0.418634, -1.089937 }, \ - { -0.576124, -0.181586, 1.117337 }, \ - { 0.568912, -0.375714, -1.071686 }, \ - { -0.179357, -1.201633, 0.370459 }, \ - { -1.006695, 0.136077, -0.762483 }, \ - { 1.068612, -0.317531, -0.608748 }, \ - { 0.358635, -1.203018, 0.193550 }, \ - { -0.995783, -0.106278, 0.781316 }, \ - { -0.407784, 0.927005, -0.766622 }, \ - { 0.635842, 0.958725, 0.538411 }, \ - { 0.581987, 0.596964, 0.958258 }, \ - { 1.111869, 0.270864, 0.551103 }, \ - { 0.991703, -0.216817, 0.763445 }, \ - { -1.061301, 0.237904, 0.656030 }, \ - { -0.055740, -0.617158, 1.108757 }, \ - { 1.255156, -0.058470, -0.185734 }, \ - { -0.823359, -0.913780, -0.316890 }, \ - { -1.211957, -0.365441, -0.104626 }, \ - { 1.002084, -0.773715, -0.102592 }, \ - { -0.609635, 0.953535, 0.576585 }, \ - { 1.225272, 0.097679, 0.320154 }, \ - { 0.342458, -1.106212, 0.521874 }, \ - { -0.995704, 0.081499, -0.784386 }, \ - { -0.906387, -0.755130, 0.470716 }, \ - { -0.807056, -0.608014, -0.769619 }, \ - { 0.958624, -0.482824, -0.679156 }, \ - { 1.071986, 0.351351, -0.583722 }, \ - { 0.428542, -0.204119, -1.178143 }, \ - { 0.088317, 0.307805, 1.229141 }, \ - { 1.088993, 0.595928, 0.268879 }, \ - { 0.585054, -0.122038, -1.120782 }, \ - { -0.602183, -0.264804, 1.086548 }, \ - { -0.941179, -0.813802, -0.255425 }, \ - { 0.508118, 0.621588, 0.984264 }, \ - { -0.955647, 0.836402, -0.022417 }, \ - { 0.940401, -0.852504, 0.047080 }, \ - { 0.202505, -1.226986, 0.258515 }, \ - { 0.316072, 1.141490, -0.458730 }, \ - { 1.117972, -0.033154, 0.601973 }, \ - { 0.897958, 0.395254, -0.806708 }, \ - { -1.072434, -0.633395, -0.249058 }, \ - { -0.108024, 0.203028, -1.249177 }, \ - { 1.175307, -0.337381, -0.343747 }, \ - { -0.644246, -0.904131, 0.617112 }, \ - { -0.542979, -0.759639, 0.861078 }, \ - { 0.901807, 0.674722, -0.587219 }, \ - { 0.406597, -1.165070, -0.301035 }, \ - { 0.231152, 1.173626, -0.427204 }, \ - { 0.240216, -1.229258, 0.211081 }, \ - { 1.088987, -0.548564, 0.355693 }, \ - { 0.514074, -0.793976, 0.847740 }, \ - { -0.918495, -0.394216, -0.783770 }, \ - { -1.231720, 0.084433, -0.298444 }, \ - { 0.779848, -0.727575, -0.689786 }, \ - { -1.075781, -0.674133, 0.039659 }, \ - { 0.496633, 0.282983, -1.134289 }, \ - { 0.891475, -0.364374, 0.828152 }, \ - { 0.454983, -1.163763, 0.227991 }, \ - { -0.388587, -0.679547, -1.000274 }, \ - { 1.191951, 0.427388, 0.099628 }, \ - { 0.422267, 1.105700, 0.460923 }, \ - { 0.852907, -0.356047, 0.871271 }, \ - { 0.078403, -0.153410, -1.258432 }, \ - { -0.785527, 0.482813, 0.873597 }, \ - { -1.235010, -0.125301, -0.269042 }, \ - { 0.167053, -1.190004, 0.411482 }, \ - { 0.736825, 0.969256, 0.361893 }, \ - { 1.185784, -0.187628, 0.414782 }, \ - { 0.950462, 0.768893, -0.344616 }, \ - { 0.650843, 0.611536, -0.903194 }, \ - { 0.374910, -1.105191, -0.501329 }, \ - { 0.705070, -0.738210, 0.755814 }, \ - { -0.845956, -0.724609, -0.610436 }, \ - { -0.788504, -0.883724, -0.458942 }, \ - { 0.719097, 0.885464, 0.558737 }, \ - { -0.957466, -0.682968, -0.479736 }, \ - { 0.678558, -0.986781, 0.423267 }, \ - { -0.601691, 1.114939, -0.090623 }, \ - { -0.426899, -1.114558, -0.434568 }, \ - { -0.187710, 1.096872, -0.612348 }, \ - { 0.906217, 0.491324, 0.742095 }, \ - { -0.503540, -0.219473, 1.145256 }, \ - { -0.800428, 0.697720, 0.697017 }, \ - { 0.814789, -0.968967, -0.102735 }, \ - { -1.008348, 0.772234, 0.014864 }, \ - { 0.123590, 0.320934, -1.222726 }, \ - { 0.409058, 0.926047, 0.767099 }, \ - { 0.570782, -0.232945, 1.110530 }, \ - { -0.041734, -1.021842, -0.753280 }, \ - { 1.114086, 0.581667, -0.183877 }, \ - { -0.057148, 0.808571, -0.977895 }, \ - { 0.235176, 1.166170, -0.445052 }, \ - { 0.191218, 0.761957, 0.998092 }, \ - { 0.222648, -1.244770, -0.119625 }, \ - { -0.178733, 0.731520, -1.022871 }, \ - { 0.445567, 0.371098, 1.130083 }, \ - { 0.970801, 0.746381, 0.337333 }, \ - { -0.992364, -0.654808, -0.446960 }, \ - { 0.266218, 1.241710, 0.024866 }, \ - { 1.258707, -0.124089, 0.116583 }, \ - { -1.137213, 0.488463, -0.285456 }, \ - { 0.358283, -0.898286, 0.823436 }, \ - { 0.087521, 1.230420, -0.302886 }, \ - { -0.951069, 0.556370, -0.631864 }, \ - { -0.145136, 0.302903, -1.224956 }, \ - { 0.852662, -0.941234, 0.019464 }, \ - { 0.620505, 1.088370, -0.209184 }, \ - { -0.263752, -0.659466, 1.053030 }, \ - { -0.828791, -0.911600, 0.308908 }, \ - { -0.245717, 1.243459, 0.082263 }, \ - { -0.679384, -0.097832, -1.068738 }, \ - { -0.292610, 1.204928, 0.275430 }, \ - { 1.119552, 0.505687, -0.322825 }, \ - { 0.609661, 0.553285, -0.967223 }, \ - { -0.582157, 0.986451, 0.548945 }, \ - { 0.610331, -0.465619, 1.011942 }, \ - { -0.183770, 1.052674, -0.686614 }, \ - { -0.888905, 0.739944, -0.525038 }, \ - { -1.220009, 0.351023, -0.041166 }, \ - { -1.005903, 0.010069, -0.775494 }, \ - { -0.311862, 1.011240, -0.702473 }, \ - { -0.773117, 0.948144, 0.341536 }, \ - { -1.207578, 0.383727, 0.088551 }, \ - { 0.302053, -0.453340, 1.147422 }, \ - { -0.699607, -0.070289, 1.057801 }, \ - { 0.838653, 0.022693, 0.953666 }, \ - { -0.487446, -0.049690, 1.171862 }, \ - { -0.583229, -0.997283, 0.527828 }, \ - { 0.582716, 1.108410, -0.212604 }, \ - { 0.705140, -0.773962, -0.719092 }, \ - { 0.951171, -0.841553, -0.019865 }, \ - { -0.189525, 1.062100, -0.670340 }, \ - { -0.920539, 0.172259, 0.858060 }, \ - { -0.520160, -1.077708, -0.425809 }, \ - { -0.655485, 0.112743, -1.082109 }, \ - { -0.285007, -0.926371, 0.820939 }, \ - { -1.030567, -0.281194, -0.687164 }, \ - { 0.054927, 0.607216, 1.114272 }, \ - { 0.158439, 0.130549, -1.253470 }, \ - { 0.607180, 0.319168, 1.069017 }, \ - { 0.352076, 1.177935, -0.319130 }, \ - { -0.356005, -0.596175, 1.063565 }, \ - { -0.799209, 0.813891, -0.558731 }, \ - { -0.394995, 1.127402, 0.431599 }, \ - { 0.958186, 0.825377, -0.118173 }, \ - { 0.901745, 0.320422, 0.835176 }, \ - { 0.107000, -0.046214, -1.264812 }, \ - { 0.640494, 1.010901, 0.425652 }, \ - { 1.247362, 0.000485, 0.239629 }, \ - { -0.458720, 0.814407, -0.860030 }, \ - { 1.262387, 0.122437, 0.068710 }, \ - { 0.018970, 0.460893, 1.183448 }, \ - { 1.041231, 0.712477, -0.146786 }, \ - { -1.203936, -0.401310, 0.053105 }, \ - { -0.957886, -0.367324, 0.748905 }, \ - { 0.596976, -1.072770, -0.325754 }, \ - { -0.271895, -1.047016, -0.665706 }, \ - { -1.261994, 0.143359, 0.012337 }, \ - { 0.319336, -0.624347, 1.059031 }, \ - { -0.715401, -0.758312, -0.725603 }, \ - { 0.588401, -0.163489, -1.113727 }, \ - { 1.087744, -0.460141, -0.467350 }, \ - { 0.784349, 0.081183, -0.995760 }, \ - { -0.221156, 0.716483, 1.025221 }, \ - { 0.296764, -0.128480, 1.228315 }, \ - { -1.224266, 0.081436, -0.328441 }, \ - { -0.285543, -0.472121, -1.144072 }, \ - { -1.122514, -0.057485, -0.591600 }, \ - { 0.257123, 1.055719, -0.657783 }, \ - { 0.585054, -0.134138, 1.119397 }, \ - { -0.408430, -0.987509, -0.686545 }, \ - { -1.004570, -0.206791, -0.749272 }, \ - { -0.309829, 1.203774, 0.261282 }, \ - { -0.299370, 0.037320, 1.233822 }, \ - { 0.250466, -0.771841, 0.977170 }, \ - { 0.749622, 0.263278, 0.991002 }, \ - { 0.296587, -1.048701, -0.652376 }, \ - { -0.149659, -0.202717, -1.244926 }, \ - { 0.852538, 0.515000, -0.788217 }, \ - { 0.265281, -0.506737, -1.134097 }, \ - { -0.327238, -0.168619, 1.215655 }, \ - { 1.162758, -0.208046, 0.466951 }, \ - { 1.032532, 0.328815, 0.662639 }, \ - { 1.269059, -0.015245, 0.050896 }, \ - { -1.081859, -0.272825, 0.607027 }, \ - { 0.475025, 0.094649, -1.174191 }, \ - { 0.047901, -1.062886, 0.693767 }, \ - { -0.896166, -0.885498, -0.161599 }, \ - { -0.475727, -0.253498, 1.150111 }, \ - { 0.405294, 0.662314, 1.005191 }, \ - { 0.274705, 1.200667, 0.310273 }, \ - { 0.693373, 0.783180, 0.720552 }, \ - { 0.061456, 0.218791, 1.249675 }, \ - { 0.435662, -0.951332, -0.720070 }, \ - { -0.145699, -1.146880, 0.526092 }, \ - { -0.478284, 1.117453, -0.368616 }, \ - { 1.135808, -0.281828, 0.493807 }, \ - { -1.103055, -0.318719, 0.543158 }, \ - { 0.026058, -0.255878, 1.243858 }, \ - { -0.169674, 1.254070, -0.108868 }, \ - { -1.169501, -0.037295, 0.494178 }, \ - { -1.143053, -0.235727, 0.501195 }, \ - { 0.745852, -0.832007, 0.603988 }, \ - { -0.337013, 0.859032, 0.872823 }, \ - { -0.084982, 1.259383, 0.141651 }, \ - { 0.555071, -1.140266, 0.070868 }, \ - { -0.478393, -1.174910, 0.063697 }, \ - { -0.513698, 0.055100, -1.160350 }, \ - { -0.047833, -0.777682, -1.003122 }, \ - { 0.444149, 1.077675, 0.504658 }, \ - { 1.196798, -0.418619, 0.075926 }, \ - { 0.204415, -1.253602, -0.005455 }, \ - { 0.175366, -0.713941, -1.035794 }, \ - { 1.031947, -0.583500, 0.456009 }, \ - { 0.825104, -0.955708, -0.138414 }, \ - { 0.634382, -0.767285, 0.788777 }, \ - { -1.223932, 0.059993, 0.334253 }, \ - { -0.845312, -0.907721, 0.273539 }, \ - { -1.161587, -0.367260, 0.359399 }, \ - { 0.196107, -0.569707, -1.118172 }, \ - { -0.849886, 0.522510, -0.786135 }, \ - { -0.263671, 1.201331, -0.317197 }, \ - { -0.666174, -0.375187, 1.014288 }, \ - { 1.072889, -0.029637, -0.679238 }, \ - { 1.077886, 0.496687, 0.452545 }, \ - { 0.256237, -0.949089, 0.804305 }, \ - { -0.122358, -0.285378, 1.231633 }, \ - { 1.113703, -0.586025, -0.171966 }, \ - { 0.968073, -0.819611, 0.066380 }, \ - { 0.914228, 0.164627, -0.866266 }, \ - { 1.077638, 0.209107, -0.638987 }, \ - { 0.583443, 0.547600, -0.986439 }, \ - { -0.242707, 1.245431, -0.057689 }, \ - { 0.807001, -0.746150, -0.636664 }, \ - { -0.347392, -0.890262, -0.836710 }, \ - { -0.759495, -0.904449, -0.467411 }, \ - { -0.279167, 0.720129, 1.008371 }, \ - { 0.193653, 0.648045, -1.075113 }, \ - { -0.289260, -0.738665, -0.991985 }, \ - { 0.237874, 0.986703, 0.763653 }, \ - { -0.804498, 0.729487, -0.658760 }, \ - { 0.025529, -0.164599, 1.259201 }, \ - { -0.576384, -0.280181, 1.096637 }, \ - { -1.126249, -0.305677, -0.501456 }, \ -} - -// Gradient tables -static const gradD gradsV3d[TABSIZE] = __GRADS; -static const gradF gradsV3f[TABSIZE] = __GRADS; - -// Permutation table -static unsigned const char permute[TABSIZE] = { - 225,155,210,108,175,199,221,144,203,116, 70,213, 69,158, 33,252, - 5, 82,173,133,222,139,174, 27, 9, 71, 90,246, 75,130, 91,191, - 169,138, 2,151,194,235, 81, 7, 25,113,228,159,205,253,134,142, - 248, 65,224,217, 22,121,229, 63, 89,103, 96,104,156, 17,201,129, - 36, 8,165,110,237,117,231, 56,132,211,152, 20,181,111,239,218, - 170,163, 51,172,157, 47, 80,212,176,250, 87, 49, 99,242,136,189, - 162,115, 44, 43,124, 94,150, 16,141,247, 32, 10,198,223,255, 72, - 53,131, 84, 57,220,197, 58, 50,208, 11,241, 28, 3,192, 62,202, - 18,215,153, 24, 76, 41, 15,179, 39, 46, 55, 6,128,167, 23,188, - 106, 34,187,140,164, 73,112,182,244,195,227, 13, 35, 77,196,185, - 26,200,226,119, 31,123,168,125,249, 68,183,230,177,135,160,180, - 12, 1,243,148,102,166, 38,238,251, 37,240,126, 64, 74,161, 40, - 184,149,171,178,101, 66, 29, 59,146, 61,254,107, 42, 86,154, 4, - 236,232,120, 21,233,209, 45, 98,193,114, 78, 19,206, 14,118,127, - 48, 79,147, 85, 30,207,219, 54, 88,234,190,122, 95, 67,143,109, - 137,214,145, 93, 92,100,245, 0,216,186, 60, 83,105, 97,204, 52 -}; - -inline int phi( int x ) -{ - return permute[x & TABMASK]; -} - -inline float cubicWeight( float t ) -{ - // 3 t^2 - 2 t^3 - return t * t * ( 3.0f - 2.0f * t ); -} - -inline double cubicWeight( double t ) -{ - // 3 t^2 - 2 t^3 - return t * t * ( ((double)3.0) - ((double)2.0) * t ); -} - -inline float cubicWeightGrad( float t ) -{ - // 6 t - 6 t^2 - return t * ( 6.0f - 6.0f * t ); -} - -inline double cubicWeightGrad( double t ) -{ - // 6 t - 6 t^2 - return t * ( ((double)6.0) - ((double)6.0) * t ); -} - -template -inline Vec2 cubicWeight( const Vec2 &t ) -{ - return Vec2( cubicWeight( t[0] ), - cubicWeight( t[1] ) ); -} - -template -inline Vec2 cubicWeightGrad( const Vec2 &t ) -{ - return Vec2( cubicWeightGrad( t[0] ), - cubicWeightGrad( t[1] ) ); -} - -template -inline Vec3 cubicWeight( const Vec3 &t ) -{ - return Vec3( cubicWeight( t[0] ), - cubicWeight( t[1] ), - cubicWeight( t[2] ) ); -} - -template -inline Vec3 cubicWeightGrad( const Vec3 &t ) -{ - return Vec3( cubicWeightGrad( t[0] ), - cubicWeightGrad( t[1] ), - cubicWeightGrad( t[2] ) ); -} - - -// by not templating these inoiseGrad functions, we guarantee that this -// code will only compile for float and double. -// The mysterious "17" and "34" passed into the phi functions -// are there to make the noise match prman - -inline const V3d &inoiseGrad( int ix, double *dummy ) -{ - return ( const V3d & )( gradsV3d[phi(ix + phi(17 + phi(34)))] ); -} - -inline const V3f &inoiseGrad( int ix, float *dummy ) -{ - return ( const V3f & )( gradsV3f[phi(ix + phi(17 + phi(34)))] ); -} - -inline const V3d &inoiseGrad( int ix, int iy, double *dummy ) -{ - return ( const V3d & )( gradsV3d[phi(ix + phi(iy + phi(34)))] ); -} - -inline const V3f &inoiseGrad( int ix, int iy, float *dummy ) -{ - return ( const V3f & )( gradsV3f[phi(ix + phi(iy + phi(34)))] ); -} - -inline const V3d &inoiseGrad( int ix, int iy, int iz, double *dummy ) -{ - return ( const V3d & )( gradsV3d[phi(ix + phi(iy + phi(iz)))] ); -} - -inline const V3f &inoiseGrad( int ix, int iy, int iz, float *dummy ) -{ - return ( const V3f & )( gradsV3f[phi(ix + phi(iy + phi(iz)))] ); -} - -template -inline -T dotComp( const Vec3 &v, T x ) -{ - return v.x * x; -} - -template -inline -T dotComp( const Vec3 &v, T x, T y ) -{ - return (v.x * x) + (v.y * y); -} - -template -inline -T dotComp( const Vec3 &v, T x, T y, T z ) -{ - return (v.x * x) + (v.y * y) + (v.z * z); -} - -//------------------------ -// 1D noise implementation -//------------------------ - -template -inline T noiseCen1( T v ) -{ - const int floorV = ( int ) Imath::floor( v ); - - const T t = v - ( T ) floorV; - - const T tm1 = t - ((T)1.0); - - const Vec3 &g0 = - inoiseGrad( floorV, (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV+1, (T*)NULL ); - - const T w = cubicWeight( t ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t ); - const T proj1 = dotComp( g1, tm1 ); - return Imath::lerp( proj0, proj1, w ); -} - -//------------------------ -// 2D noise implementation -//------------------------ - -template -inline T noiseCen2( const Vec2 &v ) -{ - const V2i floorV( ( int ) Imath::floor( v[0] ), - ( int ) Imath::floor( v[1] ) ); - - const Vec2 t( v[0] - ( T ) floorV[0], - v[1] - ( T ) floorV[1] ); - - const Vec2 tm1( t[0] - ((T)1.0), - t[1] - ((T)1.0) ); - - const Vec3 &g0 = - inoiseGrad( floorV[0], floorV[1], (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV[0]+1, floorV[1], (T*)NULL ); - - const Vec3 &g2 = - inoiseGrad( floorV[0], floorV[1]+1, (T*)NULL ); - - const Vec3 &g3 = - inoiseGrad( floorV[0]+1, floorV[1]+1, (T*)NULL ); - - const Vec2 w( cubicWeight( t ) ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t[0], t[1] ); - const T proj1 = dotComp( g1, tm1[0], t[1] ); - const T n0x = Imath::lerp( proj0, proj1, w[0] ); - - // n1x - const T proj2 = dotComp( g2, t[0], tm1[1] ); - const T proj3 = dotComp( g3, tm1[0], tm1[1] ); - const T n1x = Imath::lerp( proj2, proj3, w[0] ); - - // Do the y's - // n0y - return Imath::lerp( n0x, n1x, w[1] ); -} - -//------------------------ -// 3D noise implementation -//------------------------ - -template -inline T noiseCen3( const Vec3 &v ) -{ - const V3i floorV( ( int ) Imath::floor( v[0] ), - ( int ) Imath::floor( v[1] ), - ( int ) Imath::floor( v[2] ) ); - - const Vec3 t( v[0] - ( T ) floorV[0], - v[1] - ( T ) floorV[1], - v[2] - ( T ) floorV[2] ); - - const Vec3 tm1( t[0] - ((T)1.0), - t[1] - ((T)1.0), - t[2] - ((T)1.0) ); - - const Vec3 &g0 = - inoiseGrad( floorV[0], floorV[1], floorV[2], (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV[0]+1, floorV[1], floorV[2], (T*)NULL ); - - const Vec3 &g2 = - inoiseGrad( floorV[0], floorV[1]+1, floorV[2], (T*)NULL ); - - const Vec3 &g3 = - inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2], (T*)NULL ); - - const Vec3 &g4 = - inoiseGrad( floorV[0], floorV[1], floorV[2]+1, (T*)NULL ); - - const Vec3 &g5 = - inoiseGrad( floorV[0]+1, floorV[1], floorV[2]+1, (T*)NULL ); - - const Vec3 &g6 = - inoiseGrad( floorV[0], floorV[1]+1, floorV[2]+1, (T*)NULL ); - - const Vec3 &g7 = - inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2]+1, (T*)NULL ); - - const Vec3 w( cubicWeight( t ) ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t[0], t[1], t[2] ); - const T proj1 = dotComp( g1, tm1[0], t[1], t[2] ); - const T n0x = Imath::lerp( proj0, proj1, w[0] ); - - // n1x - const T proj2 = dotComp( g2, t[0], tm1[1], t[2] ); - const T proj3 = dotComp( g3, tm1[0], tm1[1], t[2] ); - const T n1x = Imath::lerp( proj2, proj3, w[0] ); - - // n2x - const T proj4 = dotComp( g4, t[0], t[1], tm1[2] ); - const T proj5 = dotComp( g5, tm1[0], t[1], tm1[2] ); - const T n2x = Imath::lerp( proj4, proj5, w[0] ); - - // n3x - const T proj6 = dotComp( g6, t[0], tm1[1], tm1[2] ); - const T proj7 = dotComp( g7, tm1[0], tm1[1], tm1[2] ); - const T n3x = Imath::lerp( proj6, proj7, w[0] ); - - // Do the y's - // n0y - const T n0y = Imath::lerp( n0x, n1x, w[1] ); - - // n1y - const T n1y = Imath::lerp( n2x, n3x, w[1] ); - - // Do the z's - return Imath::lerp( n0y, n1y, w[2] ); -} - - -//---------------------------------- -// 1D noise with grad implementation -//---------------------------------- - -template -inline T noiseCenGrad1( T v, - T &grad ) -{ - const int floorV = ( int ) Imath::floor( v ); - - const T t = v - ( T ) floorV; - - const T tm1 = t - ((T)1.0); - - const Vec3 &g0 = - inoiseGrad( floorV, (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV+1, (T*)NULL ); - - const T w = cubicWeight( t ); - const T dw = cubicWeightGrad( t ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t ); - const T proj1 = dotComp( g1, tm1 ); - grad = Imath::lerp( g0[0], g1[0], w ) + - dw * ( proj1 - proj0 ); - return Imath::lerp( proj0, proj1, w ); -} - -//---------------------------------- -// 2D noise with grad implementation -//---------------------------------- - -template -inline T noiseCenGrad2( const Vec2 &v, - Vec2 &grad ) -{ - const V2i floorV( ( int ) Imath::floor( v[0] ), - ( int ) Imath::floor( v[1] ) ); - - const Vec2 t( v[0] - ( T ) floorV[0], - v[1] - ( T ) floorV[1] ); - - const Vec2 tm1( t[0] - ((T)1.0), - t[1] - ((T)1.0) ); - - const Vec3 &g0 = - inoiseGrad( floorV[0], floorV[1], (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV[0]+1, floorV[1], (T*)NULL ); - - const Vec3 &g2 = - inoiseGrad( floorV[0], floorV[1]+1, (T*)NULL ); - - const Vec3 &g3 = - inoiseGrad( floorV[0]+1, floorV[1]+1, (T*)NULL ); - - const Vec2 w( cubicWeight( t ) ); - const Vec2 dw( cubicWeightGrad( t ) ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t[0], t[1] ); - const T proj1 = dotComp( g1, tm1[0], t[1] ); - const T n0x = Imath::lerp( proj0, proj1, w[0] ); - const T d_dx_n0x = Imath::lerp( g0[0], g1[0], w[0] ) + - dw[0] * ( proj1 - proj0 ); - const T d_dy_n0x = Imath::lerp( g0[1], g1[1], w[0] ); - - // n1x - const T proj2 = dotComp( g2, t[0], tm1[1] ); - const T proj3 = dotComp( g3, tm1[0], tm1[1] ); - const T n1x = Imath::lerp( proj2, proj3, w[0] ); - const T d_dx_n1x = Imath::lerp( g2[0], g3[0], w[0] ) + - dw[0] * ( proj3 - proj2 ); - const T d_dy_n1x = Imath::lerp( g2[1], g3[1], w[0] ); - - // Do the y's - // n0y - grad[0] = Imath::lerp( d_dx_n0x, d_dx_n1x, w[1] ); - grad[1] = Imath::lerp( d_dy_n0x, d_dy_n1x, w[1] ) + - dw[1] * ( n1x - n0x ); - return Imath::lerp( n0x, n1x, w[1] ); -} - -//---------------------------------- -// 3D noise with grad implementation -//---------------------------------- - -template -inline T noiseCenGrad3( const Vec3 &v, - Vec3 &grad ) -{ - const V3i floorV( ( int ) Imath::floor( v[0] ), - ( int ) Imath::floor( v[1] ), - ( int ) Imath::floor( v[2] ) ); - - const Vec3 t( v[0] - ( T ) floorV[0], - v[1] - ( T ) floorV[1], - v[2] - ( T ) floorV[2] ); - - const Vec3 tm1( t[0] - ((T)1.0), - t[1] - ((T)1.0), - t[2] - ((T)1.0) ); - - const Vec3 &g0 = - inoiseGrad( floorV[0], floorV[1], floorV[2], (T*)NULL ); - - const Vec3 &g1 = - inoiseGrad( floorV[0]+1, floorV[1], floorV[2], (T*)NULL ); - - const Vec3 &g2 = - inoiseGrad( floorV[0], floorV[1]+1, floorV[2], (T*)NULL ); - - const Vec3 &g3 = - inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2], (T*)NULL ); - - const Vec3 &g4 = - inoiseGrad( floorV[0], floorV[1], floorV[2]+1, (T*)NULL ); - - const Vec3 &g5 = - inoiseGrad( floorV[0]+1, floorV[1], floorV[2]+1, (T*)NULL ); - - const Vec3 &g6 = - inoiseGrad( floorV[0], floorV[1]+1, floorV[2]+1, (T*)NULL ); - - const Vec3 &g7 = - inoiseGrad( floorV[0]+1, floorV[1]+1, floorV[2]+1, (T*)NULL ); - - const Vec3 w( cubicWeight( t ) ); - const Vec3 dw( cubicWeightGrad( t ) ); - - // Do the x's - // n0x - const T proj0 = dotComp( g0, t[0], t[1], t[2] ); - const T proj1 = dotComp( g1, tm1[0], t[1], t[2] ); - const T n0x = Imath::lerp( proj0, proj1, w[0] ); - const T d_dx_n0x = Imath::lerp( g0[0], g1[0], w[0] ) + - dw[0] * ( proj1 - proj0 ); - const T d_dy_n0x = Imath::lerp( g0[1], g1[1], w[0] ); - const T d_dz_n0x = Imath::lerp( g0[2], g1[2], w[0] ); - - // n1x - const T proj2 = dotComp( g2, t[0], tm1[1], t[2] ); - const T proj3 = dotComp( g3, tm1[0], tm1[1], t[2] ); - const T n1x = Imath::lerp( proj2, proj3, w[0] ); - const T d_dx_n1x = Imath::lerp( g2[0], g3[0], w[0] ) + - dw[0] * ( proj3 - proj2 ); - const T d_dy_n1x = Imath::lerp( g2[1], g3[1], w[0] ); - const T d_dz_n1x = Imath::lerp( g2[2], g3[2], w[0] ); - - // n2x - const T proj4 = dotComp( g4, t[0], t[1], tm1[2] ); - const T proj5 = dotComp( g5, tm1[0], t[1], tm1[2] ); - const T n2x = Imath::lerp( proj4, proj5, w[0] ); - const T d_dx_n2x = Imath::lerp( g4[0], g5[0], w[0] ) + - dw[0] * ( proj5 - proj4 ); - const T d_dy_n2x = Imath::lerp( g4[1], g5[1], w[0] ); - const T d_dz_n2x = Imath::lerp( g4[2], g5[2], w[0] ); - - // n3x - const T proj6 = dotComp( g6, t[0], tm1[1], tm1[2] ); - const T proj7 = dotComp( g7, tm1[0], tm1[1], tm1[2] ); - const T n3x = Imath::lerp( proj6, proj7, w[0] ); - const T d_dx_n3x = Imath::lerp( g6[0], g7[0], w[0] ) + - dw[0] * ( proj7 - proj6 ); - const T d_dy_n3x = Imath::lerp( g6[1], g7[1], w[0] ); - const T d_dz_n3x = Imath::lerp( g6[2], g7[2], w[0] ); - - // Do the y's - // n0y - const T n0y = Imath::lerp( n0x, n1x, w[1] ); - const T d_dx_n0y = Imath::lerp( d_dx_n0x, d_dx_n1x, w[1] ); - const T d_dy_n0y = Imath::lerp( d_dy_n0x, d_dy_n1x, w[1] ) + - dw[1] * ( n1x - n0x ); - const T d_dz_n0y = Imath::lerp( d_dz_n0x, d_dz_n1x, w[1] ); - - // n1y - const T n1y = Imath::lerp( n2x, n3x, w[1] ); - const T d_dx_n1y = Imath::lerp( d_dx_n2x, d_dx_n3x, w[1] ); - const T d_dy_n1y = Imath::lerp( d_dy_n2x, d_dy_n3x, w[1] ) + - dw[1] * ( n3x - n2x ); - const T d_dz_n1y = Imath::lerp( d_dz_n2x, d_dz_n3x, w[1] ); - - // Do the z's - grad[0] = Imath::lerp( d_dx_n0y, d_dx_n1y, w[2] ); - grad[1] = Imath::lerp( d_dy_n0y, d_dy_n1y, w[2] ); - grad[2] = Imath::lerp( d_dz_n0y, d_dz_n1y, w[2] ) + - dw[2] * ( n1y - n0y ); - return Imath::lerp( n0y, n1y, w[2] ); -} - -} // End namespace - - -float noiseCen( float v ) -{ - return noiseCen1( v ); -} - -double noiseCen( double v ) -{ - return noiseCen1( v ); -} - -float noiseCen( const V2f &v ) -{ - return noiseCen2( v ); -} - -double noiseCen( const V2d &v ) -{ - return noiseCen2( v ); -} - -float noiseCen( const V3f &v ) -{ - return noiseCen3( v ); -} - -double noiseCen( const V3d &v ) -{ - return noiseCen3( v ); -} - -float noiseCenGrad( float v, - float &grad ) -{ - return noiseCenGrad1( v, grad ); -} - -double noiseCenGrad( double v, - double &grad ) -{ - return noiseCenGrad1( v, grad ); -} - -float noiseCenGrad( const V2f &v, - V2f &grad ) -{ - return noiseCenGrad2( v, grad ); -} - -double noiseCenGrad( const V2d &v, - V2d &grad ) -{ - return noiseCenGrad2( v, grad ); -} - -float noiseCenGrad( const V3f &v, - V3f &grad ) -{ - return noiseCenGrad3( v, grad ); -} - -double noiseCenGrad( const V3d &v, - V3d &grad ) -{ - return noiseCenGrad3( v, grad ); -} - -} // End namespace Imath diff --git a/IlmBase/Imath/ImathNoise.h b/IlmBase/Imath/ImathNoise.h deleted file mode 100644 index 72bcd24d6e..0000000000 --- a/IlmBase/Imath/ImathNoise.h +++ /dev/null @@ -1,253 +0,0 @@ -#ifndef INCLUDED_IMATHNOISE_H -#define INCLUDED_IMATHNOISE_H - -// -// Copyright (C) Pixar. All rights reserved. -// -// This license governs use of the accompanying software. If you -// use the software, you accept this license. If you do not accept -// the license, do not use the software. -// -// 1. Definitions -// The terms "reproduce," "reproduction," "derivative works," and -// "distribution" have the same meaning here as under U.S. -// copyright law. A "contribution" is the original software, or -// any additions or changes to the software. -// A "contributor" is any person or entity that distributes its -// contribution under this license. -// "Licensed patents" are a contributor's patent claims that read -// directly on its contribution. -// -// 2. Grant of Rights -// (A) Copyright Grant- Subject to the terms of this license, -// including the license conditions and limitations in section 3, -// each contributor grants you a non-exclusive, worldwide, -// royalty-free copyright license to reproduce its contribution, -// prepare derivative works of its contribution, and distribute -// its contribution or any derivative works that you create. -// (B) Patent Grant- Subject to the terms of this license, -// including the license conditions and limitations in section 3, -// each contributor grants you a non-exclusive, worldwide, -// royalty-free license under its licensed patents to make, have -// made, use, sell, offer for sale, import, and/or otherwise -// dispose of its contribution in the software or derivative works -// of the contribution in the software. -// -// 3. Conditions and Limitations -// (A) No Trademark License- This license does not grant you -// rights to use any contributor's name, logo, or trademarks. -// (B) If you bring a patent claim against any contributor over -// patents that you claim are infringed by the software, your -// patent license from such contributor to the software ends -// automatically. -// (C) If you distribute any portion of the software, you must -// retain all copyright, patent, trademark, and attribution -// notices that are present in the software. -// (D) If you distribute any portion of the software in source -// code form, you may do so only under this license by including a -// complete copy of this license with your distribution. If you -// distribute any portion of the software in compiled or object -// code form, you may only do so under a license that complies -// with this license. -// (E) The software is licensed "as-is." You bear the risk of -// using it. The contributors give no express warranties, -// guarantees or conditions. You may have additional consumer -// rights under your local laws which this license cannot change. -// To the extent permitted under your local laws, the contributors -// exclude the implied warranties of merchantability, fitness for -// a particular purpose and non-infringement. -// - -//---------------------------------------------------- -// -// Perlin noise -// -//---------------------------------------------------- - -#include - -//---------------------------------------------------------------------- -// README!!!! -// These noise functions are not templated because they only make sense -// for floating point types. Furthermore, because static gradient tables -// are used, I've got a different gradient table for floats and doubles -// to avoid the cost of float-double conversion, since this is a speed -// critical function. Therefore, no templates... -//---------------------------------------------------------------------- - -namespace Imath { - -//---------------------- -// Centered Perlin Noise -// Range -1.0 to 1.0 -//---------------------- - -float noiseCen( float v ); -double noiseCen( double v ); - -float noiseCen( const V2f &v ); -double noiseCen( const V2d &v ); - -float noiseCen( const V3f &v ); -double noiseCen( const V3d &v ); - -inline V3f noiseCen3d( const V3f &v ) -{ - return V3f( noiseCen( v ), - noiseCen( v + V3f( 7,0,3) ), - noiseCen( v + V3f(14,0,6) ) ); -} - -inline V3d noiseCen3d( const V3d &v ) -{ - return V3d( noiseCen( v ), - noiseCen( v + V3d( 7,0,3) ), - noiseCen( v + V3d(14,0,6) ) ); -} - -//----------------------------- -// Perlin noise centered at 0.5 -// Range 0.0 to 1.0 -//----------------------------- - -float noise( float v ); -double noise( double v ); - -float noise( const V2f &v ); -double noise( const V2d &v ); - -float noise( const V3f &v ); -double noise( const V3d &v ); - -inline V3f noise3d( const V3f &v ) -{ - return V3f( noise( v ), - noise( v + V3f( 7,0,3) ), - noise( v + V3f(14,0,6) ) ); -} - -inline V3d noise3d( const V3d &v ) -{ - return V3d( noise( v ), - noise( v + V3d( 7,0,3) ), - noise( v + V3d(14,0,6) ) ); -} - - -//---------------------- -// Centered Perlin noise -// With Gradients -// Range -1.0 to 1.0 -//---------------------- - -float noiseCenGrad( float v, float &grad ); -double noiseCenGrad( double v, double &grad ); - -float noiseCenGrad( const V2f &v, V2f &grad ); -double noiseCenGrad( const V2d &v, V2d &grad ); - -float noiseCenGrad( const V3f &v, V3f &grad ); -double noiseCenGrad( const V3d &v, V3d &grad ); - -//----------------------------- -// Perlin noise centered at 0.5 -// With Gradients -// Range 0.0 to 1.0 -//----------------------------- - -float noiseGrad( float v, float &grad ); -double noiseGrad( double v, double &grad ); - -float noiseGrad( const V2f &v, V2f &grad ); -double noiseGrad( const V2d &v, V2d &grad ); - -float noiseGrad( const V3f &v, V3f &grad ); -double noiseGrad( const V3d &v, V3d &grad ); - -//----------------------- -// INLINE IMPLEMENTATIONS -//----------------------- - -namespace { -template -inline T remap( T v ) -{ - return ((T)0.5)*v + ((T)0.5); -} -} // End unnamed namespace - -inline float noise( float v ) -{ - return remap( noiseCen( v ) ); -} - -inline double noise( double v ) -{ - return remap( noiseCen( v ) ); -} - -inline float noise( const V2f &v ) -{ - return remap( noiseCen( v ) ); -} - -inline double noise( const V2d &v ) -{ - return remap( noiseCen( v ) ); -} - -inline float noise( const V3f &v ) -{ - return remap( noiseCen( v ) ); -} - -inline double noise( const V3d &v ) -{ - return remap( noiseCen( v ) ); -} - -inline float noiseGrad( float v, float &grad ) -{ - const float ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((float)0.5); - return ret; -} - -inline double noiseGrad( double v, double &grad ) -{ - const double ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((double)0.5); - return ret; -} - -inline float noiseGrad( const V2f &v, V2f &grad ) -{ - const float ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((float)0.5); - return ret; -} - -inline double noiseGrad( const V2d &v, V2d &grad ) -{ - const double ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((double)0.5); - return ret; -} - -inline float noiseGrad( const V3f &v, V3f &grad ) -{ - const float ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((float)0.5); - return ret; -} - -inline double noiseGrad( const V3d &v, V3d &grad ) -{ - const double ret = remap( noiseCenGrad( v, grad ) ); - grad *= ((double)0.5); - return ret; -} - -} // End namespace Imath - -#endif diff --git a/IlmBase/Imath/Makefile.am b/IlmBase/Imath/Makefile.am index 01ae56951e..6752428cd9 100644 --- a/IlmBase/Imath/Makefile.am +++ b/IlmBase/Imath/Makefile.am @@ -14,7 +14,7 @@ libImath_la_SOURCES = ImathShear.cpp ImathMatrixAlgo.cpp ImathVec.cpp \ ImathHalfLimits.h ImathInterval.h ImathGLU.h \ ImathFrame.h ImathPlatform.h \ ImathBox.cpp ImathRandom.cpp ImathInt64.h \ - ImathFrustumTest.h ImathNoise.cpp + ImathFrustumTest.h libImath_la_LDFLAGS = -version-info @LIBTOOL_VERSION@ -no-undefined libImath_la_LIBADD = ../Iex/libIex.la @@ -29,8 +29,7 @@ libImathinclude_HEADERS = ImathColorAlgo.h ImathMatrixAlgo.h ImathVec.h \ ImathFrustum.h ImathMath.h ImathGL.h \ ImathColor.h ImathRandom.h ImathRoots.h \ ImathHalfLimits.h ImathInterval.h ImathGLU.h \ - ImathFrame.h ImathPlatform.h ImathInt64.h \ - ImathNoise.h + ImathFrame.h ImathPlatform.h ImathInt64.h INCLUDES = -I$(top_builddir) -I$(top_srcdir)/Iex -I$(top_srcdir)/Half \ -I$(top_srcdir)/config diff --git a/PyIlmBase/PyImath/Makefile.am b/PyIlmBase/PyImath/Makefile.am index 2a75cd3264..ffbf1c88d3 100644 --- a/PyIlmBase/PyImath/Makefile.am +++ b/PyIlmBase/PyImath/Makefile.am @@ -16,7 +16,6 @@ libPyImath_la_SOURCES = PyImath.cpp \ PyImathLine.cpp \ PyImathMatrix33.cpp \ PyImathMatrix44.cpp \ - PyImathNoise.cpp \ PyImathPlane.cpp \ PyImathQuat.cpp \ PyImathRandom.cpp \ @@ -52,7 +51,6 @@ libPyImathinclude_HEADERS = PyImath.h \ PyImathLine.h \ PyImathMathExc.h \ PyImathMatrix.h \ - PyImathNoise.h \ PyImathOperators.h \ PyImathPlane.h \ PyImathQuat.h \ diff --git a/PyIlmBase/PyImath/PyImathNoise.cpp b/PyIlmBase/PyImath/PyImathNoise.cpp deleted file mode 100644 index 349a077b43..0000000000 --- a/PyIlmBase/PyImath/PyImathNoise.cpp +++ /dev/null @@ -1,257 +0,0 @@ -// -// Copyright (c) 1998-2006 Lucas Digital Ltd. All rights reserved. -// Used under authorization. This material contains the -// confidential and proprietary information of Lucas Digital -// Ltd. and may not be copied in whole or in part without the -// express written permission of Lucas Digital Ltd. This -// copyright notice does not imply publication. -// - -#include - -namespace PyImath{ - -using namespace boost::python; - -float noise1(float f) -{ - MATH_EXC_ON; - return Imath::noise(f); -} - -double noise2(double d) -{ - MATH_EXC_ON; - return Imath::noise(d); -} - -float noise3(const Imath::Vec2 &v) -{ - MATH_EXC_ON; - return Imath::noise(v); -} - -double noise4(const Imath::Vec2 &v) -{ - MATH_EXC_ON; - return Imath::noise(v); -} - -float noise5(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noise(v); -} - -double noise6(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noise(v); -} - -float noise7(const tuple &t) -{ - return noiseTuple(t); -} - -double noise8(const tuple &t) -{ - return noiseTuple(t); -} - -float noiseCen1(float f) -{ - MATH_EXC_ON; - return Imath::noiseCen(f); -} - -double noiseCen2(double d) -{ - MATH_EXC_ON; - return Imath::noiseCen(d); -} - -float noiseCen3(const Imath::Vec2 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen(v); -} - -double noiseCen4(const Imath::Vec2 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen(v); -} - -float noiseCen5(const tuple &t) -{ - return noiseCenTuple(t); -} - -double noiseCen6(const tuple &t) -{ - return noiseCenTuple(t); -} - -float noiseCen7(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen(v); -} - -double noiseCen8(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen(v); -} - -Imath::Vec3 noiseCen3d1(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen3d(v); -} - -Imath::Vec3 noiseCen3d2(const Imath::Vec3 &v) -{ - MATH_EXC_ON; - return Imath::noiseCen3d(v); -} - -Imath::Vec3 noiseCen3d3(const tuple &t) -{ - MATH_EXC_ON; - return noiseCen3dTuple(t); -} - -Imath::Vec3 noiseCen3d4(const tuple &t) -{ - MATH_EXC_ON; - return noiseCen3dTuple(t); -} - -float noiseCenGrad1(float f, float &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(f, g); -} - -double noiseCenGrad2(double d, double &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(d, g); -} - -float noiseCenGrad3(const Imath::Vec2 &v, Imath::Vec2 &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(v, g); -} - -double noiseCenGrad4(const Imath::Vec2 &v, Imath::Vec2 &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(v, g); -} - -float noiseCenGrad5(const Imath::Vec3 &v, Imath::Vec3 &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(v, g); -} - -double noiseCenGrad6(const Imath::Vec3 &v, Imath::Vec3 &g) -{ - MATH_EXC_ON; - return Imath::noiseCenGrad(v, g); -} - -float noiseCenGrad7(const tuple &t, tuple &g) -{ - return noiseCenGradTuple1(t, g); -} - -double noiseCenGrad8(const tuple &t, tuple &g) -{ - return noiseCenGradTuple1(t, g); -} - -tuple noiseCenGrad9(const tuple &t) -{ - return noiseCenGradTuple2(t); -} - -tuple noiseCenGrad10(const tuple &t) -{ - return noiseCenGradTuple2(t); -} - -tuple noiseCenGrad11(float f) -{ - return noiseCenGradTuple3(f); -} - -tuple noiseCenGrad12(double d) -{ - return noiseCenGradTuple3(d); -} - - -float noiseGrad1(float f, float &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(f, g); -} - -double noiseGrad2(double d, double &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(d, g); -} - -float noiseGrad3(const Imath::Vec2 &v, Imath::Vec2 &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(v, g); -} - -double noiseGrad4(const Imath::Vec2 &v, Imath::Vec2 &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(v, g); -} - -float noiseGrad5(const Imath::Vec3 &v, Imath::Vec3 &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(v, g); -} - -double noiseGrad6(const Imath::Vec3 &v, Imath::Vec3 &g) -{ - MATH_EXC_ON; - return Imath::noiseGrad(v, g); -} - -tuple noiseGrad7(const tuple &t) -{ - return noiseGradTuple1(t); -} - -tuple noiseGrad8(const tuple &t) -{ - return noiseGradTuple1(t); -} - -tuple noiseGrad9(float f) -{ - return noiseGradTuple2(f); -} - -tuple noiseGrad10(double d) -{ - return noiseGradTuple2(d); -} - - -} // PyImath - diff --git a/PyIlmBase/PyImath/PyImathNoise.h b/PyIlmBase/PyImath/PyImathNoise.h deleted file mode 100644 index 066fc71a06..0000000000 --- a/PyIlmBase/PyImath/PyImathNoise.h +++ /dev/null @@ -1,267 +0,0 @@ -#ifndef _PyImathNoise_h_ -#define _PyImathNoise_h_ - -// -// Copyright (c) 1998-2006 Lucas Digital Ltd. All rights reserved. -// Used under authorization. This material contains the -// confidential and proprietary information of Lucas Digital -// Ltd. and may not be copied in whole or in part without the -// express written permission of Lucas Digital Ltd. This -// copyright notice does not imply publication. -// - -// Separate header file created to deal with the noise functions when tuples are -// input instead of vectors - -#include -#include -#include -#include -#include -#include - -namespace PyImath{ - -using namespace boost::python; - -template -T noiseTuple(const tuple &t) -{ - MATH_EXC_ON; - if(t.attr("__len__")() == 2) - { - Imath::Vec2 point; - point.x = extract(t[0]); - point.y = extract(t[1]); - - return Imath::noise(point); - } - if(t.attr("__len__")() == 3) - { - Imath::Vec3 point; - point.x = extract(t[0]); - point.y = extract(t[1]); - point.z = extract(t[2]); - - return Imath::noise(point); - } - else - THROW(Iex::LogicExc, "noise expects tuple of length 2 or 3"); -} - -template -T noiseCenTuple(const tuple &t) -{ - MATH_EXC_ON; - if(t.attr("__len__")() == 2) - { - Imath::Vec2 point; - point.x = extract(t[0]); - point.y = extract(t[1]); - - return Imath::noiseCen(point); - } - if(t.attr("__len__")() == 3) - { - Imath::Vec3 point; - point.x = extract(t[0]); - point.y = extract(t[1]); - point.z = extract(t[1]); - - return Imath::noiseCen(point); - } - else - THROW(Iex::LogicExc, "noiseCen expects tuple of length 2 or3"); -} - -template -Imath::Vec3 noiseCen3dTuple(const tuple &t) -{ - MATH_EXC_ON; - if(t.attr("__len__")() == 3) - { - Imath::Vec3 point; - point.x = extract(t[0]); - point.y = extract(t[1]); - point.z = extract(t[2]); - - return Imath::noiseCen3d(point); - } - else - THROW(Iex::LogicExc, "noiseCen3d expects tuple of length 3"); -} - -template -T noiseCenGradTuple1(const tuple &t0, tuple &t1) -{ - MATH_EXC_ON; - if(t0.attr("__len__")() == 3 && t1.attr("__len__")() == 3) - { - Imath::Vec3 point0; - Imath::Vec3 point1; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - point0.z = extract(t0[2]); - - point1.x = extract(t1[0]); - point1.y = extract(t1[1]); - point1.z = extract(t1[2]); - - return Imath::noiseCenGrad(point0, point1); - } - else if(t0.attr("__len__")() == 2 && t1.attr("__len__")() == 2) - { - Imath::Vec2 point0; - Imath::Vec2 point1; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - - point1.x = extract(t1[0]); - point1.y = extract(t1[1]); - - return Imath::noiseCenGrad(point0, point1); - } - else - THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); -} - -template -tuple noiseCenGradTuple2(const tuple &t0) -{ - MATH_EXC_ON; - tuple t; - - if(t0.attr("__len__")() == 3) - { - Imath::Vec3 point0; - Imath::Vec3 point1; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - point0.z = extract(t0[2]); - - T result = Imath::noiseCenGrad(point0, point1); - t = make_tuple(result, point1); - } - else if(t0.attr("__len__")() == 2) - { - Imath::Vec2 point0; - Imath::Vec2 point1; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - - T result = Imath::noiseCenGrad(point0, point1); - t = make_tuple(result, point1); - } - else - THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); - - return t; -} - -template -tuple noiseCenGradTuple3(T a) -{ - MATH_EXC_ON; - tuple t; - T grad; - T result = Imath::noiseCenGrad(a, grad); - t = make_tuple(result, grad); - return t; -} - -template -tuple noiseGradTuple1(const tuple &t0) -{ - MATH_EXC_ON; - tuple t; - - if(t0.attr("__len__")() == 3) - { - Imath::Vec3 point0; - Imath::Vec3 grad; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - point0.z = extract(t0[2]); - - T result = Imath::noiseGrad(point0, grad); - t = make_tuple(result, grad); - } - else if(t0.attr("__len__")() == 2) - { - Imath::Vec2 point0; - Imath::Vec2 grad; - point0.x = extract(t0[0]); - point0.y = extract(t0[1]); - - T result = Imath::noiseGrad(point0, grad); - t = make_tuple(result, grad); - } - else - THROW(Iex::LogicExc, "noiseGrad expects tuple of length 3"); - - return t; -} - -template -tuple noiseGradTuple2(T a) -{ - MATH_EXC_ON; - tuple t; - T grad; - T result = Imath::noiseGrad(a, grad); - t = make_tuple(result, grad); - return t; -} - -PYIMATH_EXPORT float noise1(float f); -PYIMATH_EXPORT double noise2(double d); -PYIMATH_EXPORT float noise3(const Imath::Vec2 &v); -PYIMATH_EXPORT double noise4(const Imath::Vec2 &v); -PYIMATH_EXPORT float noise5(const Imath::Vec3 &v); -PYIMATH_EXPORT double noise6(const Imath::Vec3 &v); -PYIMATH_EXPORT float noise7(const tuple &t); -PYIMATH_EXPORT double noise8(const tuple &t); - -PYIMATH_EXPORT float noiseCen1(float f); -PYIMATH_EXPORT double noiseCen2(double d); -PYIMATH_EXPORT float noiseCen3(const Imath::Vec2 &v); -PYIMATH_EXPORT double noiseCen4(const Imath::Vec2 &v); -PYIMATH_EXPORT float noiseCen5(const tuple &t); -PYIMATH_EXPORT double noiseCen6(const tuple &t); -PYIMATH_EXPORT float noiseCen7(const Imath::Vec3 &v); -PYIMATH_EXPORT double noiseCen8(const Imath::Vec3 &v); - -PYIMATH_EXPORT Imath::Vec3 noiseCen3d1(const Imath::Vec3 &v); -PYIMATH_EXPORT Imath::Vec3 noiseCen3d2(const Imath::Vec3 &v); -PYIMATH_EXPORT Imath::Vec3 noiseCen3d3(const tuple &t); -PYIMATH_EXPORT Imath::Vec3 noiseCen3d4(const tuple &t); - -PYIMATH_EXPORT float noiseCenGrad1(float f, float &g); -PYIMATH_EXPORT double noiseCenGrad2(double d, double &g); -PYIMATH_EXPORT float noiseCenGrad3(const Imath::Vec2 &v, Imath::Vec2 &g); -PYIMATH_EXPORT double noiseCenGrad4(const Imath::Vec2 &v, Imath::Vec2 &g); -PYIMATH_EXPORT float noiseCenGrad5(const Imath::Vec3 &v, Imath::Vec3 &g); -PYIMATH_EXPORT double noiseCenGrad6(const Imath::Vec3 &v, Imath::Vec3 &g); -PYIMATH_EXPORT float noiseCenGrad7(const tuple &t, tuple &g); -PYIMATH_EXPORT double noiseCenGrad8(const tuple &t, tuple &g); -PYIMATH_EXPORT tuple noiseCenGrad9(const tuple &t); -PYIMATH_EXPORT tuple noiseCenGrad10(const tuple &t); -PYIMATH_EXPORT tuple noiseCenGrad11(float f); -PYIMATH_EXPORT tuple noiseCenGrad12(double d); - -PYIMATH_EXPORT float noiseGrad1(float f, float &g); -PYIMATH_EXPORT double noiseGrad2(double d, double &g); -PYIMATH_EXPORT float noiseGrad3(const Imath::Vec2 &v, Imath::Vec2 &g); -PYIMATH_EXPORT double noiseGrad4(const Imath::Vec2 &v, Imath::Vec2 &g); -PYIMATH_EXPORT float noiseGrad5(const Imath::Vec3 &v, Imath::Vec3 &g); -PYIMATH_EXPORT double noiseGrad6(const Imath::Vec3 &v, Imath::Vec3 &g); -PYIMATH_EXPORT tuple noiseGrad7(const tuple &t); -PYIMATH_EXPORT tuple noiseGrad8(const tuple &t); -PYIMATH_EXPORT tuple noiseGrad9(float f); -PYIMATH_EXPORT tuple noiseGrad10(double d); - -} // PyImath - -#endif - - diff --git a/PyIlmBase/PyImath/imathmodule.cpp b/PyIlmBase/PyImath/imathmodule.cpp index aabc6c7e5c..9fcfecccd9 100644 --- a/PyIlmBase/PyImath/imathmodule.cpp +++ b/PyIlmBase/PyImath/imathmodule.cpp @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -60,7 +59,6 @@ #include #include #include -#include #include #include #include @@ -391,55 +389,6 @@ BOOST_PYTHON_MODULE(imath) // register_functions(); - // - // Noise Functions - // - def("noise", noise1); - def("noise", noise2); - def("noise", noise3); - def("noise", noise4); - def("noise", noise5); - def("noise", noise6); - def("noise", noise7); - def("noise", noise8); - - def("noiseCen", noiseCen1); - def("noiseCen", noiseCen2); - def("noiseCen", noiseCen3); - def("noiseCen", noiseCen4); - def("noiseCen", noiseCen5); - def("noiseCen", noiseCen6); - def("noiseCen", noiseCen7); - def("noiseCen", noiseCen8); - - def("noiseCen3d", noiseCen3d1); - def("noiseCen3d", noiseCen3d2); - def("noiseCen3d", noiseCen3d3); - def("noiseCen3d", noiseCen3d4); - - def("noiseCenGrad", noiseCenGrad1); - def("noiseCenGrad", noiseCenGrad2); - def("noiseCenGrad", noiseCenGrad3); - def("noiseCenGrad", noiseCenGrad4); - def("noiseCenGrad", noiseCenGrad5); - def("noiseCenGrad", noiseCenGrad6); - def("noiseCenGrad", noiseCenGrad7); - def("noiseCenGrad", noiseCenGrad8); - def("noiseCenGrad", noiseCenGrad9); - def("noiseCenGrad", noiseCenGrad10); - def("noiseCenGrad", noiseCenGrad11); - def("noiseCenGrad", noiseCenGrad12); - - def("noiseGrad", noiseGrad1); - def("noiseGrad", noiseGrad2); - def("noiseGrad", noiseGrad3); - def("noiseGrad", noiseGrad4); - def("noiseGrad", noiseGrad5); - def("noiseGrad", noiseGrad6); - def("noiseGrad", noiseGrad7); - def("noiseGrad", noiseGrad8); - def("noiseGrad", noiseGrad9); - def("noiseGrad", noiseGrad10); def("procrustesRotationAndTranslation", procrustes1, args("fromPts", "toPts", "weights", "doScale"), // Can't use 'from' and 'to' because 'from' is a reserved keywork in Python