Skip to content

Commit 82e7c95

Browse files
committed
Update colorSpace
1 parent e8c2ed3 commit 82e7c95

10 files changed

+30
-19
lines changed

src/examples/car-using-physics-constraints.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
this.warpSpeed('-ground')
9696

9797
const grass = await this.load.texture('grass')
98+
grass.colorSpace = THREE.SRGBColorSpace
9899
grass.wrapS = grass.wrapT = 1000 // RepeatWrapping
99100
grass.offset.set(0, 0)
100101
grass.repeat.set(50, 50)

src/examples/create-3d-geometry-from-png-file.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -42,6 +42,7 @@
4242

4343
// load grass texture
4444
const grass = await this.third.load.texture('/assets/img/grass.jpg')
45+
grass.colorSpace = THREE.SRGBColorSpace
4546
grass.wrapS = THREE.RepeatWrapping
4647
grass.wrapT = THREE.RepeatWrapping
4748
grass.repeat.set(4, 4)

src/examples/first-phaser-game-3d-version.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -47,7 +47,10 @@
4747
this.third.physics.debug.enable()
4848

4949
// add background image
50-
this.third.load.texture('sky').then(sky => (this.third.scene.background = sky))
50+
this.third.load.texture('sky').then(sky => {
51+
sky.colorSpace = THREE.SRGBColorSpace
52+
this.third.scene.background = sky
53+
})
5154

5255
// add score text
5356
this.scoreText = this.add.text(32, this.cameras.main.height - 32, 'score: 0', {

src/examples/load-and-use-textures.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -17,7 +17,7 @@
1717
<body>
1818
<div id="info-text">(scene restarts every 5 seconds)</div>
1919
<script>
20-
const { enable3d, Scene3D, Canvas } = ENABLE3D
20+
const { enable3d, Scene3D, Canvas, THREE } = ENABLE3D
2121

2222
class MainScene extends Scene3D {
2323
constructor() {
@@ -42,6 +42,7 @@
4242
// get the texture and add the ground
4343

4444
this.third.load.texture('grass').then(grass => {
45+
grass.colorSpace = THREE.SRGBColorSpace
4546
grass.wrapS = grass.wrapT = 1000 // RepeatWrapping
4647
grass.offset.set(0, 0)
4748
grass.repeat.set(2, 2)

src/examples/phaser-gltf-loader-with-animation-speed.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -17,7 +17,7 @@
1717
<body>
1818
<div id="info-text">Loads the drone and play all of its animation at the same time.</div>
1919
<script>
20-
const { enable3d, Scene3D, Canvas, ExtendedObject3D, LinearEncoding } = ENABLE3D
20+
const { enable3d, Scene3D, Canvas, ExtendedObject3D, THREE } = ENABLE3D
2121

2222
class MainScene extends Scene3D {
2323
constructor() {
@@ -66,7 +66,7 @@
6666
child.material.metalness = 0
6767
child.material.roughness = 1
6868

69-
if (child.material.map) child.material.map.encoding = LinearEncoding
69+
if (child.material.map) child.material.map.colorSpace = THREE.SRGBColorSpace
7070
})
7171

7272
drone.scale.set(0.05, 0.05, 0.05)

src/examples/project-options-and-multiple-scenes.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161

6262
// add grass
6363
const grass = await this.load.texture('grass')
64+
grass.colorSpace = THREE.SRGBColorSpace
6465
grass.wrapS = grass.wrapT = 1000 // RepeatWrapping
6566
grass.offset.set(0, 0)
6667
grass.repeat.set(2, 2)
@@ -72,12 +73,14 @@
7273
robot.name = 'robot'
7374
robot.add(gltf.scene.children[0])
7475
robot.traverse(child => {
75-
if (child.isMesh) child.castShadow = child.receiveShadow = true
76+
if (child instanceof THREE.Mesh) {
77+
child.castShadow = child.receiveShadow = true
78+
}
7679
})
7780
robot.position.set(0, 5, 0)
7881
robot.scale.set(0.5, 0.5, 0.5)
7982
this.add.existing(robot)
80-
this.physics.add.existing(robot, { shape: 'box', offset: { y: -0.5 } })
83+
this.physics.add.existing(robot, { shape: 'box', offset: { y: -0.3 } })
8184

8285
// load the next level after 3 seconds
8386
setTimeout(() => {

src/examples/raycast-vehicle.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,17 @@
192192
// this.physics.debug?.enable()
193193

194194
const grass = await this.load.texture('/assets/img/grass.jpg')
195+
grass.colorSpace = THREE.SRGBColorSpace
195196
const grassGround = grass.clone()
196197
grassGround.needsUpdate = true
197198
grassGround.wrapS = grassGround.wrapT = 1000 // RepeatWrapping
198199
grassGround.offset.set(0, 0)
199200
grassGround.repeat.set(10, 10)
200201

201-
this.physics.add.ground({ y: -1, width: 100, height: 100 }, { lambert: { map: grassGround } })
202+
this.physics.add.ground({ y: -1, width: 120, height: 120 }, { lambert: { map: grassGround } })
202203

203-
const ramp = this.add.box({ width: 5, height: 10, z: -20 }, { lambert: { map: grass } })
204-
ramp.rotateX(-Math.PI / 3)
204+
const ramp = this.add.box({ width: 8, height: 10, z: 20 })
205+
ramp.rotateX(Math.PI / 3)
205206
this.physics.add.existing(ramp, { collisionFlags: 1, mass: 0 })
206207

207208
const gltf = await this.load.gltf('/assets/glb/car.glb')

src/examples/standalone/texture-cube.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,16 @@
3030

3131
// create the texture cube
3232
const leftRight = await this.load.texture('side')
33-
leftRight.encoding = THREE.sRGBEncoding
33+
leftRight.colorSpace = THREE.SRGBColorSpace
3434
leftRight.needUpdate = true
3535
// if we clone a texture, we have to manually set needsUpdate to true
3636
const backFront = leftRight.clone()
3737
backFront.needsUpdate = true
3838
const top = await this.load.texture('top')
39-
top.encoding = THREE.sRGBEncoding
39+
top.colorSpace = THREE.SRGBColorSpace
4040
top.needUpdate = true
4141
const bottom = await this.load.texture('bottom')
42-
bottom.encoding = THREE.sRGBEncoding
42+
bottom.colorSpace = THREE.SRGBColorSpace
4343
bottom.needUpdate = true
4444

4545
const textureCube = this.misc.textureCube([leftRight, leftRight, top, bottom, backFront, backFront])

src/examples/switch-camera-between-2d-and-3d.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -101,7 +101,7 @@
101101

102102
// add background image
103103
this.third.load.texture('sky').then(sky => {
104-
sky.encoding = THREE.sRGBEncoding
104+
sky.colorSpace = THREE.SRGBColorSpace
105105
sky.needUpdate = true
106106
this.third.scene.background = sky
107107
})

src/examples/texture-on-a-plane.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
@@ -28,6 +28,7 @@
2828
this.physics.debug.enable()
2929

3030
const texture = await this.load.texture('grass')
31+
texture.colorSpace = THREE.SRGBColorSpace
3132
texture.wrapS = THREE.RepeatWrapping
3233
texture.wrapT = THREE.RepeatWrapping
3334
texture.repeat.set(2, 2)

0 commit comments

Comments
 (0)