Skip to content

Commit 682ea9d

Browse files
committed
Set THREE.ColorManagement.legacyMode to false when using color management
1 parent 68156a3 commit 682ea9d

18 files changed

+19
-61
lines changed

src/components/generic-tracked-controller-controls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ module.exports.Component = registerComponent('generic-tracked-controller-control
6767
this.controllerPresent = false;
6868
this.wasControllerConnected = false;
6969
this.lastControllerCheck = 0;
70-
this.rendererSystem = this.el.sceneEl.systems.renderer;
7170
this.bindMethods();
7271

7372
// generic-tracked-controller-controls has the lowest precedence.

src/components/hp-mixed-reality-controls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ module.exports.Component = registerComponent('hp-mixed-reality-controls', {
6161
this.onButtonTouchEnd = function (evt) { onButtonEvent(evt.detail.id, 'touchend', self, self.data.hand); };
6262
this.onButtonTouchStart = function (evt) { onButtonEvent(evt.detail.id, 'touchstart', self, self.data.hand); };
6363
this.previousButtonValues = {};
64-
this.rendererSystem = this.el.sceneEl.systems.renderer;
6564

6665
this.bindMethods();
6766
},

src/components/light.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ module.exports.Component = registerComponent('light', {
5656
var el = this.el;
5757
this.light = null;
5858
this.defaultTarget = null;
59-
this.rendererSystem = this.el.sceneEl.systems.renderer;
6059
this.system.registerLight(el);
6160
},
6261

@@ -67,7 +66,6 @@ module.exports.Component = registerComponent('light', {
6766
var data = this.data;
6867
var diffData = diff(data, oldData);
6968
var light = this.light;
70-
var rendererSystem = this.rendererSystem;
7169
var self = this;
7270

7371
// Existing light.
@@ -80,13 +78,11 @@ module.exports.Component = registerComponent('light', {
8078
switch (key) {
8179
case 'color': {
8280
light.color.set(value);
83-
rendererSystem.applyColorCorrection(light.color);
8481
break;
8582
}
8683

8784
case 'groundColor': {
8885
light.groundColor.set(value);
89-
rendererSystem.applyColorCorrection(light.groundColor);
9086
break;
9187
}
9288

@@ -281,12 +277,10 @@ module.exports.Component = registerComponent('light', {
281277
getLight: function (data) {
282278
var angle = data.angle;
283279
var color = new THREE.Color(data.color);
284-
this.rendererSystem.applyColorCorrection(color);
285280
color = color.getHex();
286281
var decay = data.decay;
287282
var distance = data.distance;
288283
var groundColor = new THREE.Color(data.groundColor);
289-
this.rendererSystem.applyColorCorrection(groundColor);
290284
groundColor = groundColor.getHex();
291285
var intensity = data.intensity;
292286
var type = data.type;

src/components/line.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ module.exports.Component = registerComponent('line', {
1616
var data = this.data;
1717
var geometry;
1818
var material;
19-
this.rendererSystem = this.el.sceneEl.systems.renderer;
2019
material = this.material = new THREE.LineBasicMaterial({
2120
color: data.color,
2221
opacity: data.opacity,
@@ -26,7 +25,6 @@ module.exports.Component = registerComponent('line', {
2625
geometry = this.geometry = new THREE.BufferGeometry();
2726
geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(2 * 3), 3));
2827

29-
this.rendererSystem.applyColorCorrection(material.color);
3028
this.line = new THREE.Line(geometry, material);
3129
this.el.setObject3D(this.attrName, this.line);
3230
},
@@ -59,7 +57,6 @@ module.exports.Component = registerComponent('line', {
5957
}
6058

6159
material.color.setStyle(data.color);
62-
this.rendererSystem.applyColorCorrection(material.color);
6360
material.opacity = data.opacity;
6461
material.transparent = data.opacity < 1;
6562
material.visible = data.visible;

src/components/magicleap-controls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ module.exports.Component = registerComponent('magicleap-controls', {
5656
this.onButtonTouchEnd = function (evt) { onButtonEvent(evt.detail.id, 'touchend', self); };
5757
this.onButtonTouchStart = function (evt) { onButtonEvent(evt.detail.id, 'touchstart', self); };
5858
this.previousButtonValues = {};
59-
this.rendererSystem = this.el.sceneEl.systems.renderer;
6059

6160
this.bindMethods();
6261
},

src/components/obj-model.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ module.exports.Component = registerComponent('obj-model', {
6464
self.model.traverse(function (object) {
6565
if (object.isMesh) {
6666
var material = object.material;
67-
if (material.color) rendererSystem.applyColorCorrection(material.color);
6867
if (material.map) rendererSystem.applyColorCorrection(material.map);
69-
if (material.emissive) rendererSystem.applyColorCorrection(material.emissive);
7068
if (material.emissiveMap) rendererSystem.applyColorCorrection(material.emissiveMap);
7169
}
7270
});

src/components/oculus-go-controls.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ module.exports.Component = registerComponent('oculus-go-controls', {
8383
this.onButtonTouchEnd = function (evt) { onButtonEvent(evt.detail.id, 'touchend', self); };
8484
this.controllerPresent = false;
8585
this.lastControllerCheck = 0;
86-
this.rendererSystem = this.el.sceneEl.systems.renderer;
8786
this.bindMethods();
8887
},
8988

@@ -197,6 +196,5 @@ module.exports.Component = registerComponent('oculus-go-controls', {
197196
}
198197
button = buttonMeshes[buttonName];
199198
button.material.color.set(color);
200-
this.rendererSystem.applyColorCorrection(button.material.color);
201199
}
202200
});

src/components/oculus-touch-controls.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,6 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
197197
this.controllerPresent = false;
198198
this.lastControllerCheck = 0;
199199
this.previousButtonValues = {};
200-
this.rendererSystem = this.el.sceneEl.systems.renderer;
201200
this.bindMethods();
202201
this.triggerEuler = new THREE.Euler();
203202
},
@@ -501,7 +500,6 @@ module.exports.Component = registerComponent('oculus-touch-controls', {
501500
color = (state === 'up' || state === 'touchend') ? buttonMeshes[buttonName].originalColor || this.data.buttonColor : state === 'touchstart' ? this.data.buttonTouchColor : this.data.buttonHighlightColor;
502501
button = buttonMeshes[buttonName];
503502
button.material.color.set(color);
504-
this.rendererSystem.applyColorCorrection(button.material.color);
505503
}
506504
}
507505
});

src/components/scene/screenshot.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ module.exports.Component = registerComponent('screenshot', {
8585

8686
getRenderTarget: function (width, height) {
8787
return new THREE.WebGLRenderTarget(width, height, {
88-
encoding: this.el.sceneEl.renderer.outputEncoding,
88+
colorSpace: this.el.sceneEl.renderer.outputColorSpace,
8989
minFilter: THREE.LinearFilter,
9090
magFilter: THREE.LinearFilter,
9191
wrapS: THREE.ClampToEdgeWrapping,
@@ -153,7 +153,7 @@ module.exports.Component = registerComponent('screenshot', {
153153
format: THREE.RGBFormat,
154154
generateMipmaps: true,
155155
minFilter: THREE.LinearMipmapLinearFilter,
156-
encoding: THREE.sRGBEncoding
156+
colorSpace: THREE.SRGBColorSpace
157157
});
158158
// Create cube camera and copy position from scene camera.
159159
cubeCamera = new THREE.CubeCamera(el.camera.near, el.camera.far, cubeRenderTarget);

src/components/valve-index-controls.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ module.exports.Component = registerComponent('valve-index-controls', {
7373
this.onButtonTouchEnd = function (evt) { onButtonEvent(evt.detail.id, 'touchend', self); };
7474
this.onButtonTouchStart = function (evt) { onButtonEvent(evt.detail.id, 'touchstart', self); };
7575
this.previousButtonValues = {};
76-
this.rendererSystem = this.el.sceneEl.systems.renderer;
7776

7877
this.bindMethods();
7978
},

0 commit comments

Comments
 (0)