未验证 提交 01ef2a2e 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #17307 from WestLangley/dev_material_tonemapped

Material: Added .toneMapped property
......@@ -267,6 +267,11 @@
Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
</p>
<h3>[property:Boolean toneMapped]</h3>
<p>
Defines whether this material is tone mapped according to the renderer's [page:WebGLRenderer.toneMapping toneMapping] setting. Default is *true*.
</p>
<h3>[property:Boolean transparent]</h3>
<p>
Defines whether this material is transparent. This has an effect on rendering
......
......@@ -97,6 +97,9 @@ Object.assign( MaterialLoader.prototype, {
if ( json.dithering !== undefined ) material.dithering = json.dithering;
if ( json.visible !== undefined ) material.visible = json.visible;
if ( json.toneMapped !== undefined ) material.toneMapped = json.toneMapped;
if ( json.userData !== undefined ) material.userData = json.userData;
// Shader Material
......
......@@ -70,6 +70,8 @@ function Material() {
this.visible = true;
this.toneMapped = true;
this.userData = {};
this.needsUpdate = true;
......@@ -290,6 +292,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
if ( this.skinning === true ) data.skinning = true;
if ( this.visible === false ) data.visible = false;
if ( this.toneMapped === false ) data.toneMapped = false;
if ( JSON.stringify( this.userData ) !== '{}' ) data.userData = this.userData;
// TODO: Copied from Object3D.toJSON
......@@ -378,6 +383,9 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
this.premultipliedAlpha = source.premultipliedAlpha;
this.visible = source.visible;
this.toneMapped = source.toneMapped;
this.userData = JSON.parse( JSON.stringify( source.userData ) );
this.clipShadows = source.clipShadows;
......
......@@ -2,7 +2,7 @@
* @author mrdoob / http://mrdoob.com/
*/
import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, GammaEncoding, LinearEncoding, ObjectSpaceNormalMap, TangentSpaceNormalMap } from '../../constants.js';
import { BackSide, DoubleSide, CubeUVRefractionMapping, CubeUVReflectionMapping, GammaEncoding, LinearEncoding, ObjectSpaceNormalMap, TangentSpaceNormalMap, NoToneMapping } from '../../constants.js';
import { WebGLProgram } from './WebGLProgram.js';
function WebGLPrograms( renderer, extensions, capabilities ) {
......@@ -208,7 +208,7 @@ function WebGLPrograms( renderer, extensions, capabilities ) {
shadowMapEnabled: renderer.shadowMap.enabled && object.receiveShadow && shadows.length > 0,
shadowMapType: renderer.shadowMap.type,
toneMapping: renderer.toneMapping,
toneMapping: material.toneMapped ? renderer.toneMapping : NoToneMapping,
physicallyCorrectLights: renderer.physicallyCorrectLights,
premultipliedAlpha: material.premultipliedAlpha,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册