From 0e69033aa90e5c4212df9a07e7ac93e584cafd87 Mon Sep 17 00:00:00 2001 From: Karen Lucknavalai <34335343+klucknav@users.noreply.github.com> Date: Fri, 14 Jul 2023 16:06:42 -0700 Subject: [PATCH 1/3] Add missing cctype include for VS2017 (#1412) - std::isspace requires include of cctype in VS2017 --- source/MaterialXGenMsl/MslShaderGenerator.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/MaterialXGenMsl/MslShaderGenerator.cpp b/source/MaterialXGenMsl/MslShaderGenerator.cpp index 61a1c8f572..dcb0a3ed69 100644 --- a/source/MaterialXGenMsl/MslShaderGenerator.cpp +++ b/source/MaterialXGenMsl/MslShaderGenerator.cpp @@ -43,6 +43,8 @@ #include "MslResourceBindingContext.h" +#include + MATERIALX_NAMESPACE_BEGIN const string MslShaderGenerator::TARGET = "genmsl"; From 333ac964158c584ef80d2eb5cf6526230cdc9cea Mon Sep 17 00:00:00 2001 From: Jonathan Stone Date: Fri, 21 Jul 2023 15:08:10 -0700 Subject: [PATCH 2/3] Update three.js to r140 This changelist updates the version of three.js to r140 in the MaterialX Web Viewer, making a handful of adjustments to account for changes in environment texture conventions. --- javascript/MaterialXView/package-lock.json | 50 +++++++++++----------- javascript/MaterialXView/package.json | 2 +- javascript/MaterialXView/source/helper.js | 2 - javascript/MaterialXView/source/viewer.js | 2 +- 4 files changed, 27 insertions(+), 29 deletions(-) diff --git a/javascript/MaterialXView/package-lock.json b/javascript/MaterialXView/package-lock.json index 84d65f8589..f22bb7674c 100644 --- a/javascript/MaterialXView/package-lock.json +++ b/javascript/MaterialXView/package-lock.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": { "dat.gui": "^0.7.9", - "three": "^0.135.0", + "three": "^0.140.2", "webpack": "^5.88.1" }, "devDependencies": { @@ -166,9 +166,9 @@ } }, "node_modules/@types/eslint": { - "version": "8.40.2", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.40.2.tgz", - "integrity": "sha512-PRVjQ4Eh9z9pmmtaq8nTjZjQwKFk7YIHIud3lRoKRBgUQjgjRmoGxxGEPXQkF+lH7QkHJRNr5F4aBgYCW0lqpQ==", + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.44.0.tgz", + "integrity": "sha512-gsF+c/0XOguWgaOgvFs+xnnRqt9GwgTvIks36WpE6ueeI4KCEHHd8K/CKHqhOqrJKsYH8m27kRzQEvWXAwXUTw==", "dependencies": { "@types/estree": "*", "@types/json-schema": "*" @@ -245,9 +245,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.3.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.3.tgz", - "integrity": "sha512-wheIYdr4NYML61AjC8MKj/2jrR/kDQri/CIpVoZwldwhnIrD/j9jIU5bJ8yBKuB2VhpFV7Ab6G2XkBjv9r9Zzw==" + "version": "20.4.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.4.2.tgz", + "integrity": "sha512-Dd0BYtWgnWJKwO1jkmTrzofjK2QXXcai0dmtzvIBhcA+RsG5h8R3xlyta0kGOZRNfL9GuRtb1knmPEhQrePCEw==" }, "node_modules/@types/qs": { "version": "6.9.7", @@ -506,9 +506,9 @@ } }, "node_modules/acorn": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", - "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", + "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", "bin": { "acorn": "bin/acorn" }, @@ -798,9 +798,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001512", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001512.tgz", - "integrity": "sha512-2S9nK0G/mE+jasCUsMPlARhRCts1ebcp2Ji8Y8PWi4NDE1iRdLCnEPHkEfeBrGC45L4isBx5ur3IQ6yTE2mRZw==", + "version": "1.0.30001515", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001515.tgz", + "integrity": "sha512-eEFDwUOZbE24sb+Ecsx3+OvNETqjWIdabMy52oOkIgcUtAsQifjUG9q4U9dgTHJM2mfk4uEPxc0+xuFdJ629QA==", "funding": [ { "type": "opencollective", @@ -1223,9 +1223,9 @@ "dev": true }, "node_modules/electron-to-chromium": { - "version": "1.4.449", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.449.tgz", - "integrity": "sha512-TxLRpRUj/107ATefeP8VIUWNOv90xJxZZbCW/eIbSZQiuiFANCx2b7u+GbVc9X4gU+xnbvypNMYVM/WArE1DNQ==" + "version": "1.4.460", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.460.tgz", + "integrity": "sha512-kKiHnbrHME7z8E6AYaw0ehyxY5+hdaRmeUbjBO22LZMdqTYCO29EvF0T1cQ3pJ1RN5fyMcHl1Lmcsdt9WWJpJQ==" }, "node_modules/encodeurl": { "version": "1.0.2", @@ -2397,9 +2397,9 @@ } }, "node_modules/node-releases": { - "version": "2.0.12", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.12.tgz", - "integrity": "sha512-QzsYKWhXTWx8h1kIvqfnC++o0pEmpRQA/aenALsL2F4pqNVr7YzcdMlDij5WBnwftRbJCNJL/O7zdKaxKPHqgQ==" + "version": "2.0.13", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.13.tgz", + "integrity": "sha512-uYr7J37ae/ORWdZeQ1xxMJe3NtdmqMC/JZK+geofDrkLUApKRHPd18/TxtBOJ4A0/+uUIliorNrfYV6s1b02eQ==" }, "node_modules/normalize-path": { "version": "3.0.0", @@ -3405,9 +3405,9 @@ } }, "node_modules/terser": { - "version": "5.18.2", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.18.2.tgz", - "integrity": "sha512-Ah19JS86ypbJzTzvUCX7KOsEIhDaRONungA4aYBjEP3JZRf4ocuDzTg4QWZnPn9DEMiMYGJPiSOy7aykoCc70w==", + "version": "5.19.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.19.0.tgz", + "integrity": "sha512-JpcpGOQLOXm2jsomozdMDpd5f8ZHh1rR48OFgWUH3QsyZcfPgv2qDCYbcDEAYNd4OZRj2bWYKpwdll/udZCk/Q==", "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.8.2", @@ -3468,9 +3468,9 @@ "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, "node_modules/three": { - "version": "0.135.0", - "resolved": "https://registry.npmjs.org/three/-/three-0.135.0.tgz", - "integrity": "sha512-kuEpuuxRzLv0MDsXai9huCxOSQPZ4vje6y0gn80SRmQvgz6/+rI0NAvCRAw56zYaWKMGMfqKWsxF9Qa2Z9xymQ==" + "version": "0.140.2", + "resolved": "https://registry.npmjs.org/three/-/three-0.140.2.tgz", + "integrity": "sha512-DdT/AHm/TbZXEhQKQpGt5/iSgBrmXpjU26FNtj1KhllVPTKj1eG4X/ShyD5W2fngE+I1s1wa4ttC4C3oCJt7Ag==" }, "node_modules/thunky": { "version": "1.1.0", diff --git a/javascript/MaterialXView/package.json b/javascript/MaterialXView/package.json index 2113d145cf..7ee8611600 100644 --- a/javascript/MaterialXView/package.json +++ b/javascript/MaterialXView/package.json @@ -11,7 +11,7 @@ "license": "ISC", "dependencies": { "dat.gui": "^0.7.9", - "three": "^0.135.0", + "three": "^0.140.2", "webpack": "^5.88.1" }, "devDependencies": { diff --git a/javascript/MaterialXView/source/helper.js b/javascript/MaterialXView/source/helper.js index e8ffb9dcae..111dfd9b5d 100644 --- a/javascript/MaterialXView/source/helper.js +++ b/javascript/MaterialXView/source/helper.js @@ -20,8 +20,6 @@ const IMAGE_PATH_SEPARATOR = "/"; export function prepareEnvTexture(texture, capabilities) { const rgbaTexture = RGBToRGBA_Float(texture); - // RGBELoader sets flipY to true by default - rgbaTexture.flipY = false; rgbaTexture.wrapS = THREE.RepeatWrapping; rgbaTexture.anisotropy = capabilities.getMaxAnisotropy(); rgbaTexture.minFilter = THREE.LinearMipmapLinearFilter; diff --git a/javascript/MaterialXView/source/viewer.js b/javascript/MaterialXView/source/viewer.js index 0bc537faf0..126b5d5bca 100644 --- a/javascript/MaterialXView/source/viewer.js +++ b/javascript/MaterialXView/source/viewer.js @@ -777,7 +777,7 @@ export class Material Object.assign(uniforms, { u_numActiveLightSources: { value: lights.length }, u_lightData: { value: lightData }, - u_envMatrix: { value: getLightRotation() }, + u_envMatrix: { value: new THREE.Matrix4().multiplyMatrices(getLightRotation(), new THREE.Matrix4().makeScale(1, -1, 1)) }, u_envRadiance: { value: radianceTexture }, u_envRadianceMips: { value: Math.trunc(Math.log2(Math.max(radianceTexture.image.width, radianceTexture.image.height))) + 1 }, u_envRadianceSamples: { value: 16 }, From 42e8b765380efe157eaf9d072128db1835aff352 Mon Sep 17 00:00:00 2001 From: Benjamin Beilharz Date: Sun, 23 Jul 2023 20:34:46 +0200 Subject: [PATCH 3/3] Added option to install resource folder (#1419) Added an option in the CMake file which toggles the installation of resources if the renderer is built and the user wants to install the resources. --- CMakeLists.txt | 5 ++++- cmake/modules/MaterialXConfig.cmake.in | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86872f26de..a5624f0a64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,6 +49,7 @@ option(MATERIALX_BUILD_TESTS "Build unit tests." ON) option(MATERIALX_BUILD_SHARED_LIBS "Build MaterialX libraries as shared rather than static." OFF) option(MATERIALX_PYTHON_LTO "Enable link-time optimizations for MaterialX Python." ON) option(MATERIALX_INSTALL_PYTHON "Install the MaterialX Python package as a third-party library when the install target is built." ON) +option(MATERIALX_INSTALL_RESOURCES "Install the resources folder when building render modules." ON) option(MATERIALX_TEST_RENDER "Run rendering tests for MaterialX Render module. GPU required for graphics validation." ON) option(MATERIALX_WARNINGS_AS_ERRORS "Interpret all compiler warnings as errors." OFF) option(MATERIALX_DYNAMIC_ANALYSIS "Build MaterialX libraries with dynamic analysis on supporting platforms." OFF) @@ -276,7 +277,9 @@ if(MATERIALX_BUILD_RENDER) if(MATERIALX_BUILD_GRAPH_EDITOR) add_subdirectory(source/MaterialXGraphEditor) endif() - add_subdirectory(resources) + if(MATERIALX_INSTALL_RESOURCES) + add_subdirectory(resources) + endif() endif() # Add test subdirectory diff --git a/cmake/modules/MaterialXConfig.cmake.in b/cmake/modules/MaterialXConfig.cmake.in index b4c8b7fad6..e1598087bf 100644 --- a/cmake/modules/MaterialXConfig.cmake.in +++ b/cmake/modules/MaterialXConfig.cmake.in @@ -22,6 +22,8 @@ set_and_check(MATERIALX_STDLIB_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/libraries") if(@MATERIALX_BUILD_PYTHON@ AND @MATERIALX_INSTALL_PYTHON@) set_and_check(MATERIALX_PYTHON_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/python") endif() -set_and_check(MATERIALX_RESOURCES_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/resources") +if(@MATERIALX_BUILD_RENDER@ AND @MATERIALX_INSTALL_RESOURCES@) + set_and_check(MATERIALX_RESOURCES_DIR "@PACKAGE_CMAKE_INSTALL_PREFIX@/resources") +endif() check_required_components(@CMAKE_PROJECT_NAME@)