Skip to content

Commit

Permalink
Remove isVideoTexture hack from camera tool
Browse files Browse the repository at this point in the history
  • Loading branch information
netpro2k committed Jul 15, 2022
1 parent 8433044 commit bad24f1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/bit-systems/camera-tool.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,21 @@ export function cameraToolSystem(world) {
depth: false,
stencil: false
});

renderTarget.lastUpdated = 0;
renderTarget.needsUpdate = true;

// Bit of a hack here to only update the renderTarget when the screens are in view
renderTarget.texture.isVideoTexture = true;
renderTarget.texture.update = () => {
// Only update the renderTarget when the screens are in view
function setRendertargetDirty() {
renderTarget.needsUpdate = true;
};
}

const screenObj = world.eid2obj.get(CameraTool.screenRef[eid]);
const selfieScreenObj = world.eid2obj.get(CameraTool.selfieScreenRef[eid]);
screenObj.material.map = renderTarget.texture;
screenObj.onBeforeRender = setRendertargetDirty;

const selfieScreenObj = world.eid2obj.get(CameraTool.selfieScreenRef[eid]);
selfieScreenObj.material.map = renderTarget.texture;
selfieScreenObj.onBeforeRender = setRendertargetDirty;

renderTargets.set(eid, renderTarget);
});
Expand Down

0 comments on commit bad24f1

Please sign in to comment.