Skip to content

Commit

Permalink
Merge pull request #4253 from mozilla/fix-light-cloning
Browse files Browse the repository at this point in the history
When we clone a light we need to update its target
  • Loading branch information
netpro2k authored May 10, 2021
2 parents 3da6fd1 + 8a31e86 commit 6c3afd5
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/components/avatar-audio-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,14 @@ AFRAME.registerComponent("avatar-audio-source", {
});

function createWhiteNoise(audioContext, gain) {
var bufferSize = 2 * audioContext.sampleRate,
const bufferSize = 2 * audioContext.sampleRate,
noiseBuffer = audioContext.createBuffer(1, bufferSize, audioContext.sampleRate),
output = noiseBuffer.getChannelData(0);
for (var i = 0; i < bufferSize; i++) {
for (let i = 0; i < bufferSize; i++) {
output[i] = (Math.random() * 2 - 1) * gain;
}

var whiteNoise = audioContext.createBufferSource();
const whiteNoise = audioContext.createBufferSource();
whiteNoise.buffer = noiseBuffer;
whiteNoise.loop = true;
whiteNoise.start(0);
Expand Down
6 changes: 4 additions & 2 deletions src/react-components/preferences-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,9 @@ function ListItem({ children, disabled, indent }) {
return <div className={classNames(styles.listItem, { disabled, indent })}>{children}</div>;
}
ListItem.propTypes = {
children: PropTypes.node.isRequired
children: PropTypes.node.isRequired,
disabled: PropTypes.bool,
indent: PropTypes.bool
};

const preferenceLabels = defineMessages({
Expand Down Expand Up @@ -384,7 +386,7 @@ const preferenceLabels = defineMessages({
},
enableAECHack: {
id: "preferences-screen.preference.enable-echo-cancellation-hack",
defaultMessage: "Enable agressive echo cancellation (significantly reduces audio quality)"
defaultMessage: "Enable aggressive echo cancellation (significantly reduces audio quality)"
},
disableNoiseSuppression: {
id: "preferences-screen.preference.disable-noise-suppression",
Expand Down
3 changes: 3 additions & 0 deletions src/react-components/room/ContentMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export function PeopleMenuButton(props) {
</ContentMenuButton>
);
}
PeopleMenuButton.propTypes = {
presenceCount: PropTypes.number
};

export function ContentMenu({ children }) {
return <div className={styles.contentMenu}>{joinChildren(children, () => <div className={styles.separator} />)}</div>;
Expand Down
3 changes: 2 additions & 1 deletion src/react-components/room/TipContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ let turnRightKey = "E";
// implimentation we may want to cook up our own polyfill based on observing key inputs
if (window.navigator.keyboard !== undefined && window.navigator.keyboard.getLayoutMap) {
window.navigator.keyboard.getLayoutMap().then(function(map) {
moveKeys = `${map.get("KeyW") || "W"} ${map.get("KeyA") || "A"} ${map.get("KeyS") || "S"} ${map.get("KeyD") || "D"}`.toUpperCase()
moveKeys = `${map.get("KeyW") || "W"} ${map.get("KeyA") || "A"} ${map.get("KeyS") || "S"} ${map.get("KeyD") ||
"D"}`.toUpperCase();
turnLeftKey = map.get("KeyQ")?.toUpperCase();
turnRightKey = map.get("KeyE")?.toUpperCase();
});
Expand Down
4 changes: 4 additions & 0 deletions src/utils/three-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ export function cloneObject3D(source, preserveUUIDs) {
clonedNode.geometry.boundsTree = sourceNode.geometry.boundsTree;
}

if ((clonedNode.isDirectionalLight || clonedNode.isSpotLight) && sourceNode.target) {
clonedNode.target = cloneLookup.get(sourceNode.target);
}

if (!sourceNode.isSkinnedMesh) return;

const sourceBones = sourceNode.skeleton.bones;
Expand Down

0 comments on commit 6c3afd5

Please sign in to comment.