diff --git a/src/application/renderers/three.js b/src/application/renderers/three.js index 54b9fdaa3..68ca85629 100644 --- a/src/application/renderers/three.js +++ b/src/application/renderers/three.js @@ -21,8 +21,10 @@ store.dispatch("outputs/addAuxillaryOutput", { const renderer = new THREE.WebGLRenderer({ alpha: true, - antialias: true, - canvas: threeCanvas + antialias: false, + canvas: threeCanvas, + powerPreference: "high-performance", + premultipliedAlpha: false }); renderer.setPixelRatio(1); @@ -178,6 +180,10 @@ function resize({ width, height }) { renderer.setSize(width, height, false); } +function getModuleData(name) { + return threeModuleData[name]; +} + export default { render, updateModule, @@ -186,6 +192,7 @@ export default { setupModule, removeModule, createPresetData, - loadPresetData + loadPresetData, + getModuleData }; export { threeModuleData }; diff --git a/src/application/worker/index.worker.js b/src/application/worker/index.worker.js index 9b52ead43..7a8432f0e 100644 --- a/src/application/worker/index.worker.js +++ b/src/application/worker/index.worker.js @@ -129,7 +129,8 @@ async function start() { tick, resize, createPresetData, - loadPresetData + loadPresetData, + getModuleData } = renderers(rendererName).default; store.commit("renderers/ADD_RENDERER", { @@ -142,6 +143,7 @@ async function start() { resizeModule, createPresetData, loadPresetData, + getModuleData, tick }); } diff --git a/src/application/worker/store/modules/modules.js b/src/application/worker/store/modules/modules.js index 143627d56..91bbcc814 100644 --- a/src/application/worker/store/modules/modules.js +++ b/src/application/worker/store/modules/modules.js @@ -462,8 +462,8 @@ const actions = { }, async updateProp( - { state, commit }, - { moduleId, prop, data, group, path = "", groupName, writeToSwap } + { state, commit, rootState }, + { moduleId, prop, data, path = "", writeToSwap } ) { if (!state.active[moduleId]) { console.error(`The module with the moduleId ${moduleId} doesn't exist.`); @@ -480,10 +480,6 @@ const actions = { ); const { type } = propData; - // if (group || groupName) { - // propData = state.active[name].props[groupName].props[prop]; - // } - if (data === currentValue) { return; } @@ -520,28 +516,32 @@ const actions = { type: propData.type, path }, - group, - groupName, writeToSwap }); - if (group || groupName) { - if ("set" in state.registered[moduleName].props[groupName].props[prop]) { - state.registered[moduleName].props[groupName].props[prop].set.bind( - state.registered[moduleName] - )({ - data: { ...state.active[moduleId].data }, - props: state.active[moduleId].props - }); - } - } else if ("set" in state.registered[moduleName].props[prop]) { - state.registered[moduleName].props[prop].set.bind( - state.registered[moduleName] - )({ + const registeredModule = state.registered[moduleName]; + + if ("set" in registeredModule.props[prop]) { + const { renderers } = rootState; + + const { getModuleData = () => ({}) } = renderers[ + registeredModule.meta.type + ]; + + const newData = registeredModule.props[prop].set.bind(registeredModule)({ + ...getModuleData(registeredModule.meta.name), data: { ...state.active[moduleId].data }, props: state.active[moduleId].props }); + + if (newData) { + commit("UPDATE_ACTIVE_MODULE", { + id: moduleId, + key: "data", + value: newData + }); + } } },