Skip to content

Commit

Permalink
perf(troika-xr): avoid setting grip material colors every frame
Browse files Browse the repository at this point in the history
  • Loading branch information
lojjic committed Mar 31, 2020
1 parent 8886bc1 commit d3f1246
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/troika-xr/src/facade/grip-models/OculusTouchGrip.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,11 @@ class OculusTouchGrip extends Object3DFacade {
for (let name in meshes) {
const color = name === 'body' ? this.bodyColor : this.buttonColor
const material = meshes[name].material
material.color.set(color)
material.emissive.set(color)
if (color !== material._lastColor) {
material.color.set(color)
material.emissive.set(color)
material._lastColor = color
}
material.emissiveIntensity = this.emissiveIntensity
}
}
Expand Down

0 comments on commit d3f1246

Please sign in to comment.