From eaae9ac8e5777c176b20f1064024d54b3dc00760 Mon Sep 17 00:00:00 2001 From: Douglass Turner Date: Mon, 4 Nov 2024 10:36:23 -0500 Subject: [PATCH] Discard materialLibrary (#303) --- glsl/diffuse_cube.frag | 10 ----- glsl/diffuse_cube.vert | 21 --------- glsl/show_st.frag | 17 -------- glsl/show_st.vert | 7 --- index.html | 61 -------------------------- js/app.js | 3 -- js/sceneManager.js | 1 - js/utils/materialLibrary.js | 87 ------------------------------------- 8 files changed, 207 deletions(-) delete mode 100644 glsl/diffuse_cube.frag delete mode 100644 glsl/diffuse_cube.vert delete mode 100644 glsl/show_st.frag delete mode 100644 glsl/show_st.vert delete mode 100644 js/utils/materialLibrary.js diff --git a/glsl/diffuse_cube.frag b/glsl/diffuse_cube.frag deleted file mode 100644 index 748d0b09..00000000 --- a/glsl/diffuse_cube.frag +++ /dev/null @@ -1,10 +0,0 @@ -#version 120 - -uniform samplerCube cubicMap; -varying vec3 vNormalWorldSpace; -varying vec3 vNormalEyeSpace; -void main() { - vec3 index = vec3(-vNormalWorldSpace.x, vNormalWorldSpace.y, vNormalWorldSpace.z); - vec3 rgb = textureCube(cubicMap, index).rgb; - gl_FragColor = vec4(rgb, 1.0); -} diff --git a/glsl/diffuse_cube.vert b/glsl/diffuse_cube.vert deleted file mode 100644 index e6e9adb4..00000000 --- a/glsl/diffuse_cube.vert +++ /dev/null @@ -1,21 +0,0 @@ -#version 120 - -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} - -// vNormalWorldSpace - world space -varying vec3 vNormalWorldSpace; - -// vNormalEyeSpace - the eye space normal -varying vec3 vNormalEyeSpace; -void main() { - - // Use the normalMatrix to convert the world space normal eye space - // normalMatrix = transpose( inverse( modelViewMatrix ) ) - vNormalEyeSpace = normalMatrix * vec4(normal, 1.0).xyz; - - vNormalWorldSpace = inverseTransformDirection(vNormalEyeSpace, viewMatrix); - - gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 ); -} diff --git a/glsl/show_st.frag b/glsl/show_st.frag deleted file mode 100644 index 8019ac36..00000000 --- a/glsl/show_st.frag +++ /dev/null @@ -1,17 +0,0 @@ -#version 120 - -uniform int showS; -uniform int showT; -varying vec2 vST; -void main() { - - if (showS == 1 && showT == 1) { - gl_FragColor = vec4(vST.s, vST.t, 0.0, 1.0); - } else if (showS == 1 && showT == 0) { - gl_FragColor = vec4(vST.s, 0.0, 0.0, 1.0); - } else if (showS == 0 && showT == 1){ - gl_FragColor = vec4(0.0, vST.t, 0.0, 1.0); - } else { - gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0); - } -} diff --git a/glsl/show_st.vert b/glsl/show_st.vert deleted file mode 100644 index b8ea0ebf..00000000 --- a/glsl/show_st.vert +++ /dev/null @@ -1,7 +0,0 @@ -#version 120 - -varying vec2 vST; -void main() { - vST = uv; - gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 ); -} diff --git a/index.html b/index.html index e674ae49..31dd0052 100644 --- a/index.html +++ b/index.html @@ -45,67 +45,6 @@ - - - - - - - - - diff --git a/js/app.js b/js/app.js index e3676065..cead275e 100644 --- a/js/app.js +++ b/js/app.js @@ -21,7 +21,6 @@ import IGVPanel from "./IGVPanel.js"; import JuiceboxPanel from "./juicebox/juiceboxPanel.js"; import { appleCrayonColorRGB255, appleCrayonColorThreeJS, highlightColor } from "./utils/colorUtils.js"; import {getUrlParams, toJSON, loadSession, uncompressSessionURL} from "./spacewalkSession.js" -import { initializeMaterialLibrary } from "./utils/materialLibrary.js"; import RenderContainerController from "./renderContainerController.js"; import {createSpacewalkFileLoaders} from './spacewalkFileLoad.js' import BallHighlighter from "./ballHighlighter.js"; @@ -124,8 +123,6 @@ const initializationHelper = async container => { $('.popover-dismiss').popover({ trigger: 'focus' }) - await initializeMaterialLibrary() - pointCloud = new PointCloud({ pickHighlighter: new PointCloudHighlighter(), deemphasizedColor: appleCrayonColorThreeJS('magnesium') }) ribbon = new Ribbon(); diff --git a/js/sceneManager.js b/js/sceneManager.js index 5e319d68..9d0812fa 100644 --- a/js/sceneManager.js +++ b/js/sceneManager.js @@ -9,7 +9,6 @@ import GroundPlane, { groundPlaneConfigurator } from './groundPlane.js' import Gnomon, { gnomonConfigurator } from './gnomon.js' import {getMouseXY, setMaterialProvider, unsetDataMaterialProviderCheckbox} from "./utils/utils.js" import { appleCrayonColorThreeJS } from "./utils/colorUtils.js" -import { sceneBackgroundTexture, sceneBackgroundDiagnosticTexture } from "./utils/materialLibrary.js" import Ribbon from './ribbon.js' import {degrees} from "./utils/mathUtils.js" import {configureColorPicker, updateColorPicker} from "./guiManager.js" diff --git a/js/utils/materialLibrary.js b/js/utils/materialLibrary.js deleted file mode 100644 index abdcb2f3..00000000 --- a/js/utils/materialLibrary.js +++ /dev/null @@ -1,87 +0,0 @@ -import * as THREE from "three"; - -import sceneBackgroundDiagnosticTextureFile from '/texture/uv.png' -import sceneBackgroundTextureFile from '/texture/scene-backdrop-grey-ramp.png' - -const shaderLibrary = - { - init: () => { - - // ST - const showSTConfig = - { - uniforms: { showS: { value: 1 }, showT: { value: 1 } }, - vertexShader: show_st_vert, - fragmentShader: show_st_frag - } - - shaderLibrary.showSTMaterial = new THREE.ShaderMaterial(showSTConfig ) - - // S - const showSConfig = - { - uniforms: { showS: { value: 1 }, showT: { value: 0 } }, - vertexShader: show_st_vert, - fragmentShader: show_st_frag - } - - shaderLibrary.showSMaterial = new THREE.ShaderMaterial(showSConfig ) - - // T - const showTConfig = - { - uniforms: { showS: { value: 0 }, showT: { value: 1 } }, - vertexShader: show_st_vert, - fragmentShader: show_st_frag - } - - shaderLibrary.showTMaterial = new THREE.ShaderMaterial(showTConfig ) - - }, - - showSTMaterial: undefined, - - showSMaterial: undefined, - - showTMaterial: undefined - - } - -const showNormalsMaterial = new THREE.MeshNormalMaterial(); - -let sceneBackgroundDiagnosticTexture = undefined; -let sceneBackgroundTexture = undefined; - -async function initializeMaterialLibrary() { - - shaderLibrary.init() - - const sceneBackgroundTexturePromise = new Promise(resolve => { - - const texas = new THREE.TextureLoader().load(sceneBackgroundTextureFile, resolve) - texas.colorSpace = THREE.SRGBColorSpace - - return texas - }); - - sceneBackgroundTexture = await sceneBackgroundTexturePromise; - - // console.timeEnd(str); - // - // str = `Scene Background Diagnostic Texture Load Complete`; - // console.time(str); - - const sceneBackgroundDiagnosticTexturePromise = new Promise(resolve => { - const texas = new THREE.TextureLoader().load(sceneBackgroundDiagnosticTextureFile, resolve) - texas.colorSpace = THREE.SRGBColorSpace - - return texas - }); - - sceneBackgroundDiagnosticTexture = await sceneBackgroundDiagnosticTexturePromise; - - // console.timeEnd(str); - -} - -export { initializeMaterialLibrary, sceneBackgroundDiagnosticTexture, sceneBackgroundTexture, showNormalsMaterial, shaderLibrary };