-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Unify texture loading and map property fixes #5453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -53,19 +53,17 @@ module.exports.Shader = registerShader('phong', { | |
| */ | ||
| init: function (data) { | ||
| this.materialData = { color: new THREE.Color(), specular: new THREE.Color(), emissive: new THREE.Color() }; | ||
| this.textureSrc = null; | ||
| getMaterialData(data, this.materialData); | ||
| this.material = new THREE.MeshPhongMaterial(this.materialData); | ||
| utils.material.updateMap(this, data); | ||
| }, | ||
|
|
||
| update: function (data) { | ||
| this.updateMaterial(data); | ||
| utils.material.updateMap(this, data); | ||
| if (data.normalMap) { utils.material.updateDistortionMap('normal', this, data); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. checks no needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as for |
||
| if (data.displacementMap) { utils.material.updateDistortionMap('displacement', this, data); } | ||
| if (data.ambientOcclusionMap) { utils.material.updateDistortionMap('ambientOcclusion', this, data); } | ||
| if (data.bump) { utils.material.updateDistortionMap('bump', this, data); } | ||
| utils.material.updateDistortionMap('normal', this, data); | ||
| utils.material.updateDistortionMap('displacement', this, data); | ||
| utils.material.updateDistortionMap('ambientOcclusion', this, data); | ||
| utils.material.updateDistortionMap('bump', this, data); | ||
| this.updateEnvMap(data); | ||
| }, | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,11 +69,11 @@ module.exports.Shader = registerShader('standard', { | |
| update: function (data) { | ||
| this.updateMaterial(data); | ||
| utils.material.updateMap(this, data); | ||
| if (data.normalMap) { utils.material.updateDistortionMap('normal', this, data); } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This guards no longer needed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The guards prevented these textures from being removed. Similar to how the main (diffuse) map is handled, the underlying implementation of |
||
| if (data.displacementMap) { utils.material.updateDistortionMap('displacement', this, data); } | ||
| if (data.ambientOcclusionMap) { utils.material.updateDistortionMap('ambientOcclusion', this, data); } | ||
| if (data.metalnessMap) { utils.material.updateDistortionMap('metalness', this, data); } | ||
| if (data.roughnessMap) { utils.material.updateDistortionMap('roughness', this, data); } | ||
| utils.material.updateDistortionMap('normal', this, data); | ||
| utils.material.updateDistortionMap('displacement', this, data); | ||
| utils.material.updateDistortionMap('ambientOcclusion', this, data); | ||
| utils.material.updateDistortionMap('metalness', this, data); | ||
| utils.material.updateDistortionMap('roughness', this, data); | ||
| this.updateEnvMap(data); | ||
| }, | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove because of redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, this is in the
initmethod, which is followed byupdatewhich also callsupdateMap. Bothflatandstandardlet the update handle this andphongwas the odd one out.