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

Merge pull request #17318 from arobertson0/descriptive-defines-2

Matching js material class names with glsl defines
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
<code> <code>
{ {
'STANDARD': ''
'PHYSICAL': '', 'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''
}; };
</code> </code>
......
...@@ -122,7 +122,7 @@ ...@@ -122,7 +122,7 @@
<h3>[property:Object defines]</h3> <h3>[property:Object defines]</h3>
<p>An object of the form: <p>An object of the form:
<code> <code>
{ 'PHYSICAL': '' }; { 'STANDARD': '' };
</code> </code>
This is used by the [page:WebGLRenderer] for selecting shaders. This is used by the [page:WebGLRenderer] for selecting shaders.
......
...@@ -69,8 +69,8 @@ ...@@ -69,8 +69,8 @@
<code> <code>
{ {
'STANDARD': ''
'PHYSICAL': '', 'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''
}; };
</code> </code>
......
...@@ -97,7 +97,7 @@ ...@@ -97,7 +97,7 @@
<h3>[property:Object defines]</h3> <h3>[property:Object defines]</h3>
<p>如下形式的对象: <p>如下形式的对象:
<code> <code>
{ 'PHYSICAL': '' }; { 'STANDARD': '' };
</code> </code>
[page:WebGLRenderer]使用它来选择shaders。 [page:WebGLRenderer]使用它来选择shaders。
</p> </p>
......
...@@ -125,7 +125,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) { ...@@ -125,7 +125,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) {
var vertexShaderChunk2 = [ var vertexShaderChunk2 = [
"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )", "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )",
" #ifndef USE_ENVMAP", " #ifndef USE_ENVMAP",
" vec3 objectNormal = normalize( normal );", " vec3 objectNormal = normalize( normal );",
" #endif", " #endif",
......
...@@ -726,7 +726,7 @@ THREE.GLTFLoader = ( function () { ...@@ -726,7 +726,7 @@ THREE.GLTFLoader = ( function () {
materialParams.vertexShader = shader.vertexShader; materialParams.vertexShader = shader.vertexShader;
materialParams.fragmentShader = fragmentShader; materialParams.fragmentShader = fragmentShader;
materialParams.uniforms = uniforms; materialParams.uniforms = uniforms;
materialParams.defines = { 'PHYSICAL': '' } materialParams.defines = { 'STANDARD': '' }
materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 ); materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
materialParams.opacity = 1.0; materialParams.opacity = 1.0;
......
...@@ -132,7 +132,7 @@ var OutlineEffect = function ( renderer, parameters ) { ...@@ -132,7 +132,7 @@ var OutlineEffect = function ( renderer, parameters ) {
var vertexShaderChunk2 = [ var vertexShaderChunk2 = [
"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )", "#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )",
" #ifndef USE_ENVMAP", " #ifndef USE_ENVMAP",
" vec3 objectNormal = normalize( normal );", " vec3 objectNormal = normalize( normal );",
" #endif", " #endif",
......
...@@ -791,7 +791,7 @@ var GLTFLoader = ( function () { ...@@ -791,7 +791,7 @@ var GLTFLoader = ( function () {
materialParams.vertexShader = shader.vertexShader; materialParams.vertexShader = shader.vertexShader;
materialParams.fragmentShader = fragmentShader; materialParams.fragmentShader = fragmentShader;
materialParams.uniforms = uniforms; materialParams.uniforms = uniforms;
materialParams.defines = { 'PHYSICAL': '' } materialParams.defines = { 'STANDARD': '' }
materialParams.color = new Color( 1.0, 1.0, 1.0 ); materialParams.color = new Color( 1.0, 1.0, 1.0 );
materialParams.opacity = 1.0; materialParams.opacity = 1.0;
......
...@@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) { ...@@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) {
var code; var code;
builder.define('PHYSICAL'); builder.define('STANDARD');
var useClearcoat = this.clearcoat || this.clearcoatRoughness || this.clearCoatNormal; var useClearcoat = this.clearcoat || this.clearcoatRoughness || this.clearCoatNormal;
......
...@@ -23,8 +23,8 @@ function MeshPhysicalMaterial( parameters ) { ...@@ -23,8 +23,8 @@ function MeshPhysicalMaterial( parameters ) {
this.defines = { this.defines = {
'PHYSICAL': '', 'STANDARD': '',
'ADVANCED_PHYSICAL': '' 'PHYSICAL': ''
}; };
...@@ -55,8 +55,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) { ...@@ -55,8 +55,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
this.defines = { this.defines = {
'PHYSICAL': '', 'STANDARD': '',
'ADVANCED_PHYSICAL': '' 'PHYSICAL': ''
}; };
......
...@@ -59,7 +59,7 @@ function MeshStandardMaterial( parameters ) { ...@@ -59,7 +59,7 @@ function MeshStandardMaterial( parameters ) {
Material.call( this ); Material.call( this );
this.defines = { 'PHYSICAL': '' }; this.defines = { 'STANDARD': '' };
this.type = 'MeshStandardMaterial'; this.type = 'MeshStandardMaterial';
...@@ -123,7 +123,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) { ...@@ -123,7 +123,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
Material.prototype.copy.call( this, source ); Material.prototype.copy.call( this, source );
this.defines = { 'PHYSICAL': '' }; this.defines = { 'STANDARD': '' };
this.color.copy( source.color ); this.color.copy( source.color );
this.roughness = source.roughness; this.roughness = source.roughness;
......
...@@ -6,7 +6,7 @@ export default /* glsl */` ...@@ -6,7 +6,7 @@ export default /* glsl */`
reflectedLight.indirectDiffuse *= ambientOcclusion; reflectedLight.indirectDiffuse *= ambientOcclusion;
#if defined( USE_ENVMAP ) && defined( PHYSICAL ) #if defined( USE_ENVMAP ) && defined( STANDARD )
float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) ); float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );
......
export default /* glsl */` export default /* glsl */`
#if NUM_CLIPPING_PLANES > 0 #if NUM_CLIPPING_PLANES > 0
#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) #if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
varying vec3 vViewPosition; varying vec3 vViewPosition;
#endif #endif
......
export default /* glsl */` export default /* glsl */`
#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) #if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
varying vec3 vViewPosition; varying vec3 vViewPosition;
#endif #endif
`; `;
export default /* glsl */` export default /* glsl */`
#if NUM_CLIPPING_PLANES > 0 && ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP ) #if NUM_CLIPPING_PLANES > 0 && ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
vViewPosition = - mvPosition.xyz; vViewPosition = - mvPosition.xyz;
#endif #endif
`; `;
...@@ -15,7 +15,7 @@ export default /* glsl */` ...@@ -15,7 +15,7 @@ export default /* glsl */`
#endif #endif
#if defined( USE_ENVMAP ) && defined( PHYSICAL ) && defined( ENVMAP_TYPE_CUBE_UV ) #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel ); irradiance += getLightProbeIndirectIrradiance( /*lightProbe,*/ geometry, maxMipLevel );
......
export default /* glsl */` export default /* glsl */`
#define PHYSICAL_REFLECTION #define STANDARD
#ifdef PHYSICAL #ifdef PHYSICAL
#define CLEARCOAT
#endif
#ifdef ADVANCED_PHYSICAL
#define REFLECTIVITY #define REFLECTIVITY
#define CLEARCOAT #define CLEARCOAT
#endif #endif
......
export default /* glsl */` export default /* glsl */`
#define PHYSICAL #define STANDARD
varying vec3 vViewPosition; varying vec3 vViewPosition;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册