Skip to content

Commit

Permalink
Fixed misusage of material.type.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 10, 2020
1 parent 7b361d7 commit 70ea4fd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions examples/js/objects/Sky.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ THREE.Sky = function () {
var shader = THREE.Sky.SkyShader;

var material = new THREE.ShaderMaterial( {
name: 'SkyShader',
fragmentShader: shader.fragmentShader,
vertexShader: shader.vertexShader,
uniforms: THREE.UniformsUtils.clone( shader.uniforms ),
Expand Down
1 change: 1 addition & 0 deletions examples/jsm/objects/Sky.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var Sky = function () {
var shader = Sky.SkyShader;

var material = new ShaderMaterial( {
name: 'SkyShader',
fragmentShader: shader.fragmentShader,
vertexShader: shader.vertexShader,
uniforms: UniformsUtils.clone( shader.uniforms ),
Expand Down
12 changes: 6 additions & 6 deletions src/extras/PMREMGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,8 @@ function _getBlurShader( maxSamples ) {
const poleAxis = new Vector3( 0, 1, 0 );
const shaderMaterial = new RawShaderMaterial( {

name: 'SphericalGaussianBlur',

defines: { 'n': maxSamples },

uniforms: {
Expand Down Expand Up @@ -674,8 +676,6 @@ void main() {

} );

shaderMaterial.type = 'SphericalGaussianBlur';

return shaderMaterial;

}
Expand All @@ -685,6 +685,8 @@ function _getEquirectShader() {
const texelSize = new Vector2( 1, 1 );
const shaderMaterial = new RawShaderMaterial( {

name: 'EquirectangularToCubeUV',

uniforms: {
'envMap': { value: null },
'texelSize': { value: texelSize },
Expand Down Expand Up @@ -731,8 +733,6 @@ void main() {

} );

shaderMaterial.type = 'EquirectangularToCubeUV';

return shaderMaterial;

}
Expand All @@ -741,6 +741,8 @@ function _getCubemapShader() {

const shaderMaterial = new RawShaderMaterial( {

name: 'CubemapToCubeUV',

uniforms: {
'envMap': { value: null },
'inputEncoding': { value: ENCODINGS[ LinearEncoding ] },
Expand Down Expand Up @@ -770,8 +772,6 @@ void main() {

} );

shaderMaterial.type = 'CubemapToCubeUV';

return shaderMaterial;

}
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/WebGLCubeRenderTarget.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function ( renderer

const material = new ShaderMaterial( {

type: 'CubemapFromEquirect',
name: 'CubemapFromEquirect',

uniforms: cloneUniforms( shader.uniforms ),
vertexShader: shader.vertexShader,
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/webgl/WebGLBackground.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
boxMesh = new Mesh(
new BoxBufferGeometry( 1, 1, 1 ),
new ShaderMaterial( {
type: 'BackgroundCubeMaterial',
name: 'BackgroundCubeMaterial',
uniforms: cloneUniforms( ShaderLib.cube.uniforms ),
vertexShader: ShaderLib.cube.vertexShader,
fragmentShader: ShaderLib.cube.fragmentShader,
Expand Down Expand Up @@ -125,7 +125,7 @@ function WebGLBackground( renderer, state, objects, premultipliedAlpha ) {
planeMesh = new Mesh(
new PlaneBufferGeometry( 2, 2 ),
new ShaderMaterial( {
type: 'BackgroundMaterial',
name: 'BackgroundMaterial',
uniforms: cloneUniforms( ShaderLib.background.uniforms ),
vertexShader: ShaderLib.background.vertexShader,
fragmentShader: ShaderLib.background.fragmentShader,
Expand Down

2 comments on commit 70ea4fd

@Mugen87
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should RoughnessMipmapper be change, too?

shaderMaterial.type = 'RoughnessMipmapper';

@mrdoob
Copy link
Owner Author

@mrdoob mrdoob commented on 70ea4fd Jun 11, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! 👍

Please sign in to comment.