Skip to content

Commit

Permalink
Merge branch 'dev' into dev-transpiler-tsl
Browse files Browse the repository at this point in the history
  • Loading branch information
sunag committed Oct 20, 2023
2 parents 1a223ff + 1c565de commit 4f6181a
Show file tree
Hide file tree
Showing 82 changed files with 289 additions and 86 deletions.
8 changes: 7 additions & 1 deletion build/three.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16164,6 +16164,8 @@ const MAX_SAMPLES = 20;
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
const _clearColor = /*@__PURE__*/ new Color();
let _oldTarget = null;
let _oldActiveCubeFace = 0;
let _oldActiveMipmapLevel = 0;

// Golden Ratio
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
Expand Down Expand Up @@ -16229,6 +16231,8 @@ class PMREMGenerator {
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

this._setSize( 256 );

Expand Down Expand Up @@ -16341,7 +16345,7 @@ class PMREMGenerator {

_cleanup( outputTarget ) {

this._renderer.setRenderTarget( _oldTarget );
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
outputTarget.scissorTest = false;
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );

Expand All @@ -16360,6 +16364,8 @@ class PMREMGenerator {
}

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

const cubeUVRenderTarget = renderTarget || this._allocateTargets();
this._textureToCubeUV( texture, cubeUVRenderTarget );
Expand Down
8 changes: 7 additions & 1 deletion build/three.js
Original file line number Diff line number Diff line change
Expand Up @@ -16169,6 +16169,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
const _clearColor = /*@__PURE__*/ new Color();
let _oldTarget = null;
let _oldActiveCubeFace = 0;
let _oldActiveMipmapLevel = 0;

// Golden Ratio
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
Expand Down Expand Up @@ -16234,6 +16236,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

this._setSize( 256 );

Expand Down Expand Up @@ -16346,7 +16350,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated

_cleanup( outputTarget ) {

this._renderer.setRenderTarget( _oldTarget );
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
outputTarget.scissorTest = false;
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );

Expand All @@ -16365,6 +16369,8 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
}

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

const cubeUVRenderTarget = renderTarget || this._allocateTargets();
this._textureToCubeUV( texture, cubeUVRenderTarget );
Expand Down
2 changes: 1 addition & 1 deletion build/three.min.js

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion build/three.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -16162,6 +16162,8 @@ const MAX_SAMPLES = 20;
const _flatCamera = /*@__PURE__*/ new OrthographicCamera();
const _clearColor = /*@__PURE__*/ new Color();
let _oldTarget = null;
let _oldActiveCubeFace = 0;
let _oldActiveMipmapLevel = 0;

// Golden Ratio
const PHI = ( 1 + Math.sqrt( 5 ) ) / 2;
Expand Down Expand Up @@ -16227,6 +16229,8 @@ class PMREMGenerator {
fromScene( scene, sigma = 0, near = 0.1, far = 100 ) {

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

this._setSize( 256 );

Expand Down Expand Up @@ -16339,7 +16343,7 @@ class PMREMGenerator {

_cleanup( outputTarget ) {

this._renderer.setRenderTarget( _oldTarget );
this._renderer.setRenderTarget( _oldTarget, _oldActiveCubeFace, _oldActiveMipmapLevel );
outputTarget.scissorTest = false;
_setViewport( outputTarget, 0, 0, outputTarget.width, outputTarget.height );

Expand All @@ -16358,6 +16362,8 @@ class PMREMGenerator {
}

_oldTarget = this._renderer.getRenderTarget();
_oldActiveCubeFace = this._renderer.getActiveCubeFace();
_oldActiveMipmapLevel = this._renderer.getActiveMipmapLevel();

const cubeUVRenderTarget = renderTarget || this._allocateTargets();
this._textureToCubeUV( texture, cubeUVRenderTarget );
Expand Down
2 changes: 1 addition & 1 deletion build/three.module.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples/en/objects/Lensflare.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h2>Import</h2>
</p>

<code>
import { Lensflare } from 'three/addons/objects/Lensflare.js';
import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js';
</code>

<h2>Code Example</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/zh/objects/Lensflare.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>镜头光晕([name])</h1>
</p>

<code>
import { Lensflare } from 'three/addons/objects/Lensflare.js';
import { Lensflare, LensflareElement } from 'three/addons/objects/Lensflare.js';
</code>

<h2>代码示例</h2>
Expand Down
2 changes: 1 addition & 1 deletion examples/files.json
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@
"webgpu_depth_texture",
"webgpu_equirectangular",
"webgpu_instance_mesh",
"webgpu_instance_points",
"webgpu_instance_uniform",
"webgpu_lights_custom",
"webgpu_lights_ies_spotlight",
Expand All @@ -340,7 +341,6 @@
"webgpu_morphtargets",
"webgpu_occlusion",
"webgpu_particles",
"webgpu_points_fat",
"webgpu_rtt",
"webgpu_sandbox",
"webgpu_shadertoy",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {

const _vector = new Vector3();

class FatPointsGeometry extends InstancedBufferGeometry {
class InstancedPointsGeometry extends InstancedBufferGeometry {

constructor() {

super();

this.isFatPointsGeometry = true;
this.isInstancedPointsGeometry = true;

this.type = 'FatPointsGeometry';
this.type = 'InstancedPointsGeometry';

const positions = [ - 1, 1, 0, 1, 1, 0, - 1, - 1, 0, 1, - 1, 0 ];
const uvs = [ - 1, 1, 1, 1, - 1, - 1, 1, - 1 ];
Expand Down Expand Up @@ -171,4 +171,4 @@ class FatPointsGeometry extends InstancedBufferGeometry {

}

export { FatPointsGeometry };
export default InstancedPointsGeometry;
2 changes: 2 additions & 0 deletions examples/jsm/materials/MeshGouraudMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { UniformsUtils, UniformsLib, ShaderMaterial, Color, MultiplyOperation }

const GouraudShader = {

name: 'GouraudShader',

uniforms: UniformsUtils.merge( [
UniformsLib.common,
UniformsLib.specularmap,
Expand Down
2 changes: 1 addition & 1 deletion examples/jsm/nodes/Nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export { default as NodeUniform } from './core/NodeUniform.js';
export { default as NodeVar } from './core/NodeVar.js';
export { default as NodeVarying } from './core/NodeVarying.js';
export { default as ParameterNode, parameter } from './core/ParameterNode.js';
export { default as PropertyNode, property, output, diffuseColor, roughness, metalness, specularColor, shininess } from './core/PropertyNode.js';
export { default as PropertyNode, property, output, diffuseColor, roughness, metalness, clearcoat, clearcoatRoughness, sheen, sheenRoughness, iridescence, iridescenceIOR, iridescenceThickness, specularColor, shininess, dashSize, gapSize, pointWidth } from './core/PropertyNode.js';
export { default as StackNode, stack } from './core/StackNode.js';
export { default as TempNode } from './core/TempNode.js';
export { default as UniformNode, uniform } from './core/UniformNode.js';
Expand Down
21 changes: 21 additions & 0 deletions examples/jsm/nodes/accessors/InstancedPointsMaterialNode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import MaterialNode from './MaterialNode.js';
import { addNodeClass } from '../core/Node.js';
import { nodeImmutable } from '../shadernode/ShaderNode.js';

class InstancedPointsMaterialNode extends MaterialNode {

setup( /*builder*/ ) {

return this.getFloat( this.scope );

}

}

InstancedPointsMaterialNode.POINT_WIDTH = 'pointWidth';

export default InstancedPointsMaterialNode;

export const materialPointWidth = nodeImmutable( InstancedPointsMaterialNode, InstancedPointsMaterialNode.POINT_WIDTH );

addNodeClass( 'FatPointsMaterialNode', InstancedPointsMaterialNode );
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ import { materialColor, materialPointWidth } from '../accessors/MaterialNode.js'
import { modelViewMatrix } from '../accessors/ModelNode.js';
import { positionGeometry } from '../accessors/PositionNode.js';
import { smoothstep } from '../math/MathNode.js';
import { tslFn, vec2, vec4 } from '../shadernode/ShaderNode.js';
import { tslFn, vec2, vec4, color } from '../shadernode/ShaderNode.js';
import { uv } from '../accessors/UVNode.js';
import { viewport } from '../display/ViewportNode.js';
import { color } from 'three/nodes';

import { PointsMaterial } from 'three';

const defaultValues = new PointsMaterial();

class FatPointsNodeMaterial extends NodeMaterial {
class InstancedPointsNodeMaterial extends NodeMaterial {

constructor( params = {} ) {

Expand Down Expand Up @@ -158,6 +157,6 @@ class FatPointsNodeMaterial extends NodeMaterial {

}

export default FatPointsNodeMaterial;
export default InstancedPointsNodeMaterial;

addNodeMaterial( 'FatPointsNodeMaterial', FatPointsNodeMaterial );
addNodeMaterial( 'InstancedPointsNodeMaterial', InstancedPointsNodeMaterial );
2 changes: 1 addition & 1 deletion examples/jsm/nodes/materials/Materials.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @TODO: We can simplify "export { default as SomeNode, other, exports } from '...'" to just "export * from '...'" if we will use only named exports

export { default as NodeMaterial, addNodeMaterial, createNodeMaterialFromType } from './NodeMaterial.js';
export { default as FatPointsNodeMaterial } from './FatPointsNodeMaterial.js';
export { default as InstancedPointsNodeMaterial } from './InstancedPointsNodeMaterial.js';
export { default as LineBasicNodeMaterial } from './LineBasicNodeMaterial.js';
export { default as LineDashedNodeMaterial } from './LineDashedNodeMaterial.js';
export { default as Line2NodeMaterial } from './Line2NodeMaterial.js';
Expand Down
21 changes: 21 additions & 0 deletions examples/jsm/objects/InstancedPoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {
Mesh
} from 'three';
import InstancedPointsGeometry from '../geometries/InstancedPointsGeometry.js';
import InstancedPointsNodeMaterial from '../nodes/materials/InstancedPointsNodeMaterial.js';

class InstancedPoints extends Mesh {

constructor( geometry = new InstancedPointsGeometry(), material = new InstancedPointsNodeMaterial() ) {

super( geometry, material );

this.isInstancedPoints = true;

this.type = 'InstancedPoints';

}

}

export default InstancedPoints;
3 changes: 3 additions & 0 deletions examples/jsm/objects/Lensflare.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ class Lensflare extends Mesh {
const shader = LensflareElement.Shader;

const material2 = new RawShaderMaterial( {
name: shader.name,
uniforms: {
'map': { value: null },
'occlusionMap': { value: occlusionMap },
Expand Down Expand Up @@ -300,6 +301,8 @@ class LensflareElement {

LensflareElement.Shader = {

name: 'LensflareElementShader',

uniforms: {

'map': { value: null },
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/ReflectorForSSRPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ class ReflectorForSSRPass extends Mesh {
const renderTarget = new WebGLRenderTarget( textureWidth, textureHeight, parameters );

const material = new ShaderMaterial( {
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
transparent: useDepthTexture,
defines: Object.assign( {}, ReflectorForSSRPass.ReflectorShader.defines, {
useDepthTexture
Expand Down Expand Up @@ -251,6 +252,8 @@ class ReflectorForSSRPass extends Mesh {

ReflectorForSSRPass.ReflectorShader = {

name: 'ReflectorShader',

defines: {
DISTANCE_ATTENUATION: true,
FRESNEL: true,
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Refractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class Refractor extends Mesh {
// material

this.material = new ShaderMaterial( {
name: ( shader.name !== undefined ) ? shader.name : 'unspecified',
uniforms: UniformsUtils.clone( shader.uniforms ),
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader,
Expand Down Expand Up @@ -261,6 +262,8 @@ class Refractor extends Mesh {

Refractor.RefractorShader = {

name: 'RefractorShader',

uniforms: {

'color': {
Expand Down
8 changes: 5 additions & 3 deletions examples/jsm/objects/Sky.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class Sky extends Mesh {
const shader = Sky.SkyShader;

const material = new ShaderMaterial( {
name: 'SkyShader',
fragmentShader: shader.fragmentShader,
vertexShader: shader.vertexShader,
name: shader.name,
uniforms: UniformsUtils.clone( shader.uniforms ),
vertexShader: shader.vertexShader,
fragmentShader: shader.fragmentShader,
side: BackSide,
depthWrite: false
} );
Expand All @@ -46,6 +46,8 @@ class Sky extends Mesh {

Sky.SkyShader = {

name: 'SkyShader',

uniforms: {
'turbidity': { value: 2 },
'rayleigh': { value: 1 },
Expand Down
7 changes: 5 additions & 2 deletions examples/jsm/objects/Water.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Water extends Mesh {

const mirrorShader = {

name: 'MirrorShader',

uniforms: UniformsUtils.merge( [
UniformsLib[ 'fog' ],
UniformsLib[ 'lights' ],
Expand Down Expand Up @@ -188,9 +190,10 @@ class Water extends Mesh {
};

const material = new ShaderMaterial( {
fragmentShader: mirrorShader.fragmentShader,
vertexShader: mirrorShader.vertexShader,
name: mirrorShader.name,
uniforms: UniformsUtils.clone( mirrorShader.uniforms ),
vertexShader: mirrorShader.vertexShader,
fragmentShader: mirrorShader.fragmentShader,
lights: true,
side: side,
fog: fog
Expand Down
3 changes: 3 additions & 0 deletions examples/jsm/objects/Water2.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Water extends Mesh {
// material

this.material = new ShaderMaterial( {
name: shader.name,
uniforms: UniformsUtils.merge( [
UniformsLib[ 'fog' ],
shader.uniforms
Expand Down Expand Up @@ -205,6 +206,8 @@ class Water extends Mesh {

Water.WaterShader = {

name: 'WaterShader',

uniforms: {

'color': {
Expand Down
Loading

0 comments on commit 4f6181a

Please sign in to comment.