Skip to content

Commit 04c4fb0

Browse files
authored
Merge pull request #16208 from Mugen87/dev28
Docs: Add roughnessMap to material browser.
2 parents c14c769 + 3d5ff38 commit 04c4fb0

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

docs/scenes/js/material.js

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,20 @@ var diffuseMaps = ( function () {
129129

130130
} )();
131131

132+
var roughnessMaps = ( function () {
133+
134+
var bricks = textureLoader.load( '../../examples/textures/brick_roughness.jpg' );
135+
bricks.wrapT = THREE.RepeatWrapping;
136+
bricks.wrapS = THREE.RepeatWrapping;
137+
bricks.repeat.set( 9, 1 );
138+
139+
return {
140+
none: null,
141+
bricks: bricks
142+
};
143+
144+
} )();
145+
132146
var matcaps = ( function () {
133147

134148
return {
@@ -154,6 +168,7 @@ var alphaMaps = ( function () {
154168

155169
var envMapKeys = getObjectsKeys( envMaps );
156170
var diffuseMapKeys = getObjectsKeys( diffuseMaps );
171+
var roughnessMapKeys = getObjectsKeys( roughnessMaps );
157172
var matcapKeys = getObjectsKeys( matcaps );
158173
var alphaMapKeys = getObjectsKeys( alphaMaps );
159174

@@ -444,6 +459,7 @@ function guiMeshStandardMaterial( gui, mesh, material, geometry ) {
444459
emissive: material.emissive.getHex(),
445460
envMaps: envMapKeys[ 0 ],
446461
map: diffuseMapKeys[ 0 ],
462+
roughnessMap: roughnessMapKeys[ 0 ],
447463
alphaMap: alphaMapKeys[ 0 ]
448464
};
449465

@@ -461,9 +477,10 @@ function guiMeshStandardMaterial( gui, mesh, material, geometry ) {
461477
folder.add( material, 'fog' );
462478
folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
463479
folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
480+
folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );
464481
folder.add( data, 'alphaMap', alphaMapKeys ).onChange( updateTexture( material, 'alphaMap', alphaMaps ) );
465482

466-
// TODO roughnessMap and metalnessMap
483+
// TODO metalnessMap
467484

468485
}
469486

@@ -474,6 +491,7 @@ function guiMeshPhysicalMaterial( gui, mesh, material, geometry ) {
474491
emissive: material.emissive.getHex(),
475492
envMaps: envMapKeys[ 0 ],
476493
map: diffuseMapKeys[ 0 ],
494+
roughnessMap: roughnessMapKeys[ 0 ],
477495
alphaMap: alphaMapKeys[ 0 ]
478496
};
479497

@@ -494,9 +512,10 @@ function guiMeshPhysicalMaterial( gui, mesh, material, geometry ) {
494512
folder.add( material, 'fog' );
495513
folder.add( data, 'envMaps', envMapKeys ).onChange( updateTexture( material, 'envMap', envMaps ) );
496514
folder.add( data, 'map', diffuseMapKeys ).onChange( updateTexture( material, 'map', diffuseMaps ) );
515+
folder.add( data, 'roughnessMap', roughnessMapKeys ).onChange( updateTexture( material, 'roughnessMap', roughnessMaps ) );
497516
folder.add( data, 'alphaMap', alphaMapKeys ).onChange( updateTexture( material, 'alphaMap', alphaMaps ) );
498517

499-
// TODO roughnessMap and metalnessMap
518+
// TODO metalnessMap
500519

501520
}
502521

0 commit comments

Comments
 (0)