Skip to content

Commit

Permalink
Merge branch 'dev' into dev_pbr_transparency
Browse files Browse the repository at this point in the history
  • Loading branch information
WestLangley committed Aug 22, 2019
2 parents 2712f3d + 17affe6 commit f05816d
Show file tree
Hide file tree
Showing 25 changed files with 209 additions and 164 deletions.
2 changes: 2 additions & 0 deletions build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -19387,6 +19387,8 @@
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";

shadow.camera.updateProjectionMatrix();

}

_renderer.setRenderTarget( shadow.map );
Expand Down
260 changes: 130 additions & 130 deletions build/three.min.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19381,6 +19381,8 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";

shadow.camera.updateProjectionMatrix();

}

_renderer.setRenderTarget( shadow.map );
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/materials/MeshPhysicalMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ <h3>[property:Object defines]</h3>
<code>
{

'STANDARD': ''
'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''

};
</code>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/en/materials/MeshStandardMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ <h3>[property:Color color]</h3>
<h3>[property:Object defines]</h3>
<p>An object of the form:
<code>
{ 'PHYSICAL': '' };
{ 'STANDARD': '' };
</code>

This is used by the [page:WebGLRenderer] for selecting shaders.
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/materials/MeshPhysicalMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ <h3>[property:Object defines]</h3>
<code>
{

'STANDARD': ''
'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''

};
</code>
Expand Down
2 changes: 1 addition & 1 deletion docs/api/zh/materials/MeshStandardMaterial.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h3>[property:Color color]</h3>
<h3>[property:Object defines]</h3>
<p>如下形式的对象:
<code>
{ 'PHYSICAL': '' };
{ 'STANDARD': '' };
</code>
[page:WebGLRenderer]使用它来选择shaders。
</p>
Expand Down
2 changes: 1 addition & 1 deletion examples/js/effects/OutlineEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) {

var vertexShaderChunk2 = [

"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )",
"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )",
" #ifndef USE_ENVMAP",
" vec3 objectNormal = normalize( normal );",
" #endif",
Expand Down
2 changes: 1 addition & 1 deletion examples/js/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ THREE.GLTFLoader = ( function () {
materialParams.vertexShader = shader.vertexShader;
materialParams.fragmentShader = fragmentShader;
materialParams.uniforms = uniforms;
materialParams.defines = { 'PHYSICAL': '' }
materialParams.defines = { 'STANDARD': '' }

materialParams.color = new THREE.Color( 1.0, 1.0, 1.0 );
materialParams.opacity = 1.0;
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/effects/OutlineEffect.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ var OutlineEffect = function ( renderer, parameters ) {

var vertexShaderChunk2 = [

"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( PHYSICAL )",
"#if ! defined( LAMBERT ) && ! defined( PHONG ) && ! defined( TOON ) && ! defined( STANDARD )",
" #ifndef USE_ENVMAP",
" vec3 objectNormal = normalize( normal );",
" #endif",
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/loaders/GLTFLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ var GLTFLoader = ( function () {
materialParams.vertexShader = shader.vertexShader;
materialParams.fragmentShader = fragmentShader;
materialParams.uniforms = uniforms;
materialParams.defines = { 'PHYSICAL': '' }
materialParams.defines = { 'STANDARD': '' }

materialParams.color = new Color( 1.0, 1.0, 1.0 );
materialParams.opacity = 1.0;
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/nodes/StandardNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ StandardNode.prototype.build = function ( builder ) {

var code;

builder.define('PHYSICAL');
builder.define('STANDARD');

var useClearcoat = this.clearcoat || this.clearcoatRoughness || this.clearCoatNormal;

Expand Down
8 changes: 4 additions & 4 deletions src/materials/MeshPhysicalMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ function MeshPhysicalMaterial( parameters ) {

this.defines = {

'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''
'STANDARD': '',
'PHYSICAL': ''

};

Expand Down Expand Up @@ -57,8 +57,8 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {

this.defines = {

'PHYSICAL': '',
'ADVANCED_PHYSICAL': ''
'STANDARD': '',
'PHYSICAL': ''

};

Expand Down
4 changes: 2 additions & 2 deletions src/materials/MeshStandardMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function MeshStandardMaterial( parameters ) {

Material.call( this );

this.defines = { 'PHYSICAL': '' };
this.defines = { 'STANDARD': '' };

this.type = 'MeshStandardMaterial';

Expand Down Expand Up @@ -123,7 +123,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {

Material.prototype.copy.call( this, source );

this.defines = { 'PHYSICAL': '' };
this.defines = { 'STANDARD': '' };

this.color.copy( source.color );
this.roughness = source.roughness;
Expand Down
9 changes: 8 additions & 1 deletion src/math/Vector2.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,12 +396,19 @@ export class Vector2 implements Vector {
equals( v: Vector2 ): boolean;

/**
* Sets this vector's x value to be array[offset] and y value to be array[offset + 1].
* Sets this vector's x and y value from the provided array.
* @param array the source array.
* @param offset (optional) offset into the array. Default is 0.
*/
fromArray( array: number[], offset?: number ): this;

/**
* Sets this vector's x and y value from the provided array-like.
* @param array the source array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray( array: ArrayLike<number>, offset?: number ): this;

/**
* Returns an array [x, y], or copies x and y into the provided array.
* @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
Expand Down
18 changes: 15 additions & 3 deletions src/math/Vector3.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,23 +248,35 @@ export class Vector3 implements Vector {
*/
equals( v: Vector3 ): boolean;

fromArray( xyz: number[], offset?: number ): Vector3;
/**
* Sets this vector's x, y and z value from the provided array.
* @param array the source array.
* @param offset (optional) offset into the array. Default is 0.
*/
fromArray( array: number[], offset?: number ): this;

/**
* Sets this vector's x, y and z value from the provided array-lik.
* @param array the source array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray( array: ArrayLike<number>, offset?: number ): this;

/**
* Returns an array [x, y, z], or copies x, y and z into the provided array.
* @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
*/
toArray( xyz?: number[], offset?: number ): number[];
toArray( array?: number[], offset?: number ): number[];

/**
* Copies x, y and z into the provided array-like.
* @param array array-like to store the vector to.
* @param offset (optional) optional offset into the array.
* @return The provided array-like.
*/
toArray( xyz: ArrayLike<number>, offset?: number ): ArrayLike<number>;
toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>;

fromBufferAttribute(
attribute: BufferAttribute,
Expand Down
30 changes: 28 additions & 2 deletions src/math/Vector4.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,35 @@ export class Vector4 implements Vector {
*/
equals( v: Vector4 ): boolean;

fromArray( xyzw: number[], offset?: number ): this;
/**
* Sets this vector's x, y, z and w value from the provided array.
* @param array the source array.
* @param offset (optional) offset into the array. Default is 0.
*/
fromArray( array: number[], offset?: number ): this;

/**
* Sets this vector's x, y, z and w value from the provided array-like.
* @param array the source array-like.
* @param offset (optional) offset into the array-like. Default is 0.
*/
fromArray( array: ArrayLike<number>, offset?: number ): this;

toArray( xyzw?: number[], offset?: number ): number[];
/**
* Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.
* @param array (optional) array to store the vector to. If this is not provided, a new array will be created.
* @param offset (optional) optional offset into the array.
* @return The created or provided array.
*/
toArray( array?: number[], offset?: number ): number[];

/**
* Copies x, y, z and w into the provided array-like.
* @param array array-like to store the vector to.
* @param offset (optional) optional offset into the array.
* @return The provided array-like.
*/
toArray( array: ArrayLike<number>, offset?: number ): ArrayLike<number>;

fromBufferAttribute(
attribute: BufferAttribute,
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderChunk/aomap_fragment.glsl.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default /* glsl */`

reflectedLight.indirectDiffuse *= ambientOcclusion;

#if defined( USE_ENVMAP ) && defined( PHYSICAL )
#if defined( USE_ENVMAP ) && defined( STANDARD )

float dotNV = saturate( dot( geometry.normal, geometry.viewDir ) );

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export default /* glsl */`
#if NUM_CLIPPING_PLANES > 0

#if ! defined( PHYSICAL ) && ! defined( PHONG ) && ! defined( MATCAP )
#if ! defined( STANDARD ) && ! defined( PHONG ) && ! defined( MATCAP )
varying vec3 vViewPosition;
#endif

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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;
#endif
`;
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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;
#endif
`;
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default /* glsl */`

#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 );

Expand Down
8 changes: 1 addition & 7 deletions src/renderers/shaders/ShaderLib/meshphysical_frag.glsl.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
export default /* glsl */`
#define PHYSICAL_REFLECTION
#define STANDARD

#ifdef PHYSICAL

#define CLEARCOAT

#endif

#ifdef ADVANCED_PHYSICAL
#define REFLECTIVITY
#define CLEARCOAT
#define TRANSPARENCY
Expand Down
2 changes: 1 addition & 1 deletion src/renderers/shaders/ShaderLib/meshphysical_vert.glsl.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default /* glsl */`
#define PHYSICAL
#define STANDARD

varying vec3 vViewPosition;

Expand Down
2 changes: 2 additions & 0 deletions src/renderers/webgl/WebGLShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
shadow.map = new WebGLRenderTarget( _shadowMapSize.x, _shadowMapSize.y, pars );
shadow.map.texture.name = light.name + ".shadowMap";

shadow.camera.updateProjectionMatrix();

}

_renderer.setRenderTarget( shadow.map );
Expand Down

0 comments on commit f05816d

Please sign in to comment.