Skip to content
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

Core: Clean up. #28891

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/nodes/accessors/MorphNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import { Vector2 } from '../../math/Vector2.js';
import { Vector4 } from '../../math/Vector4.js';
import { FloatType } from '../../constants.js';

const morphTextures = new WeakMap();
const morphVec4 = new Vector4();
const _morphTextures = new WeakMap();
const _morphVec4 = /*@__PURE__*/ new Vector4();

const getMorph = tslFn( ( { bufferMap, influence, stride, width, depth, offset } ) => {

Expand All @@ -43,7 +43,7 @@ function getEntry( geometry ) {
const morphAttribute = geometry.morphAttributes.position || geometry.morphAttributes.normal || geometry.morphAttributes.color;
const morphTargetsCount = ( morphAttribute !== undefined ) ? morphAttribute.length : 0;

let entry = morphTextures.get( geometry );
let entry = _morphTextures.get( geometry );

if ( entry === undefined || entry.count !== morphTargetsCount ) {

Expand Down Expand Up @@ -95,34 +95,34 @@ function getEntry( geometry ) {

if ( hasMorphPosition === true ) {

morphVec4.fromBufferAttribute( morphTarget, j );
_morphVec4.fromBufferAttribute( morphTarget, j );

buffer[ offset + stride + 0 ] = morphVec4.x;
buffer[ offset + stride + 1 ] = morphVec4.y;
buffer[ offset + stride + 2 ] = morphVec4.z;
buffer[ offset + stride + 0 ] = _morphVec4.x;
buffer[ offset + stride + 1 ] = _morphVec4.y;
buffer[ offset + stride + 2 ] = _morphVec4.z;
buffer[ offset + stride + 3 ] = 0;

}

if ( hasMorphNormals === true ) {

morphVec4.fromBufferAttribute( morphNormal, j );
_morphVec4.fromBufferAttribute( morphNormal, j );

buffer[ offset + stride + 4 ] = morphVec4.x;
buffer[ offset + stride + 5 ] = morphVec4.y;
buffer[ offset + stride + 6 ] = morphVec4.z;
buffer[ offset + stride + 4 ] = _morphVec4.x;
buffer[ offset + stride + 5 ] = _morphVec4.y;
buffer[ offset + stride + 6 ] = _morphVec4.z;
buffer[ offset + stride + 7 ] = 0;

}

if ( hasMorphColors === true ) {

morphVec4.fromBufferAttribute( morphColor, j );
_morphVec4.fromBufferAttribute( morphColor, j );

buffer[ offset + stride + 8 ] = morphVec4.x;
buffer[ offset + stride + 9 ] = morphVec4.y;
buffer[ offset + stride + 10 ] = morphVec4.z;
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? morphVec4.w : 1;
buffer[ offset + stride + 8 ] = _morphVec4.x;
buffer[ offset + stride + 9 ] = _morphVec4.y;
buffer[ offset + stride + 10 ] = _morphVec4.z;
buffer[ offset + stride + 11 ] = ( morphColor.itemSize === 4 ) ? _morphVec4.w : 1;

}

Expand All @@ -137,13 +137,13 @@ function getEntry( geometry ) {
size: new Vector2( width, height )
};

morphTextures.set( geometry, entry );
_morphTextures.set( geometry, entry );

function disposeTexture() {

bufferTexture.dispose();

morphTextures.delete( geometry );
_morphTextures.delete( geometry );

geometry.removeEventListener( 'dispose', disposeTexture );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/display/AfterImageNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import QuadMesh from '../../renderers/common/QuadMesh.js';
import { Vector2 } from '../../math/Vector2.js';
import { RenderTarget } from '../../core/RenderTarget.js';

const _size = new Vector2();
const _size = /*@__PURE__*/ new Vector2();

const quadMeshComp = new QuadMesh();
const quadMeshComp = /*@__PURE__*/ new QuadMesh();

class AfterImageNode extends TempNode {

Expand Down
6 changes: 3 additions & 3 deletions src/nodes/display/AnamorphicNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import QuadMesh from '../../renderers/common/QuadMesh.js';
import { Vector2 } from '../../math/Vector2.js';
import { RenderTarget } from '../../core/RenderTarget.js';

const quadMesh = new QuadMesh();
const _quadMesh = /*@__PURE__*/ new QuadMesh();

class AnamorphicNode extends TempNode {

Expand Down Expand Up @@ -66,15 +66,15 @@ class AnamorphicNode extends TempNode {
const currentRenderTarget = renderer.getRenderTarget();
const currentTexture = textureNode.value;

quadMesh.material = this._material;
_quadMesh.material = this._material;

this.setSize( map.image.width, map.image.height );

// render

renderer.setRenderTarget( this._renderTarget );

quadMesh.render( renderer );
_quadMesh.render( renderer );

// restore

Expand Down
6 changes: 3 additions & 3 deletions src/nodes/display/GTAONode.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import QuadMesh from '../../renderers/common/QuadMesh.js';
import { RenderTarget } from '../../core/RenderTarget.js';
import { Color } from '../../math/Color.js';

const _quadMesh = new QuadMesh();
const _currentClearColor = new Color();
const _size = new Vector2();
const _quadMesh = /*@__PURE__*/ new QuadMesh();
const _currentClearColor = /*@__PURE__*/ new Color();
const _size = /*@__PURE__*/ new Vector2();

class GTAONode extends TempNode {

Expand Down
12 changes: 6 additions & 6 deletions src/nodes/display/GaussianBlurNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { RenderTarget } from '../../core/RenderTarget.js';
// WebGPU: The use of a single QuadMesh for both gaussian blur passes results in a single RenderObject with a SampledTexture binding that
// alternates between source textures and triggers creation of new BindGroups and BindGroupLayouts every frame.

const quadMesh1 = new QuadMesh();
const quadMesh2 = new QuadMesh();
const _quadMesh1 = /*@__PURE__*/ new QuadMesh();
const _quadMesh2 = /*@__PURE__*/ new QuadMesh();

class GaussianBlurNode extends TempNode {

Expand Down Expand Up @@ -65,8 +65,8 @@ class GaussianBlurNode extends TempNode {

const currentTexture = textureNode.value;

quadMesh1.material = this._material;
quadMesh2.material = this._material;
_quadMesh1.material = this._material;
_quadMesh2.material = this._material;

this.setSize( map.image.width, map.image.height );

Expand All @@ -85,7 +85,7 @@ class GaussianBlurNode extends TempNode {

this._passDirection.value.set( 1, 0 );

quadMesh1.render( renderer );
_quadMesh1.render( renderer );

// vertical

Expand All @@ -94,7 +94,7 @@ class GaussianBlurNode extends TempNode {

this._passDirection.value.set( 0, 1 );

quadMesh2.render( renderer );
_quadMesh2.render( renderer );

// restore

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/display/PassNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Vector2 } from '../../math/Vector2.js';
import { DepthTexture } from '../../textures/DepthTexture.js';
import { RenderTarget } from '../../core/RenderTarget.js';

const _size = new Vector2();
const _size = /*@__PURE__*/ new Vector2();

class PassTextureNode extends TextureNode {

Expand Down
2 changes: 1 addition & 1 deletion src/nodes/display/ViewportTextureNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Vector2 } from '../../math/Vector2.js';
import { FramebufferTexture } from '../../textures/FramebufferTexture.js';
import { LinearMipmapLinearFilter } from '../../constants.js';

const _size = new Vector2();
const _size = /*@__PURE__*/ new Vector2();

class ViewportTextureNode extends TextureNode {

Expand Down
6 changes: 3 additions & 3 deletions src/nodes/lighting/EnvironmentNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { reference } from '../accessors/ReferenceNode.js';
import { transformedBentNormalView } from '../accessors/AccessorsUtils.js';
import { pmremTexture } from '../pmrem/PMREMNode.js';

const envNodeCache = new WeakMap();
const _envNodeCache = new WeakMap();

class EnvironmentNode extends LightingNode {

Expand All @@ -29,13 +29,13 @@ class EnvironmentNode extends LightingNode {

if ( envNode.isTextureNode ) {

let cacheEnvNode = envNodeCache.get( envNode.value );
let cacheEnvNode = _envNodeCache.get( envNode.value );

if ( cacheEnvNode === undefined ) {

cacheEnvNode = pmremTexture( envNode.value );

envNodeCache.set( envNode.value, cacheEnvNode );
_envNodeCache.set( envNode.value, cacheEnvNode );

}

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/lighting/RectAreaLightNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { RectAreaLight } from '../../lights/RectAreaLight.js';
import { Matrix4 } from '../../math/Matrix4.js';
import { Vector3 } from '../../math/Vector3.js';

const _matrix41 = new Matrix4();
const _matrix42 = new Matrix4();
const _matrix41 = /*@__PURE__*/ new Matrix4();
const _matrix42 = /*@__PURE__*/ new Matrix4();

let ltcLib = null;

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/InstancedPointsNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { viewport } from '../display/ViewportNode.js';

import { PointsMaterial } from '../../materials/PointsMaterial.js';

const defaultValues = new PointsMaterial();
const _defaultValues = /*@__PURE__*/ new PointsMaterial();

class InstancedPointsNodeMaterial extends NodeMaterial {

Expand All @@ -33,7 +33,7 @@ class InstancedPointsNodeMaterial extends NodeMaterial {

this.pointColorNode = null;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setupShaders();

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/Line2NodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { dashSize, gapSize } from '../core/PropertyNode.js';

import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';

const defaultValues = new LineDashedMaterial();
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();

class Line2NodeMaterial extends NodeMaterial {

Expand All @@ -26,7 +26,7 @@ class Line2NodeMaterial extends NodeMaterial {
this.normals = false;
this.lights = false;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.useAlphaToCoverage = true;
this.useColor = params.vertexColors;
Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/LineBasicNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import NodeMaterial, { addNodeMaterial } from './NodeMaterial.js';

import { LineBasicMaterial } from '../../materials/LineBasicMaterial.js';

const defaultValues = new LineBasicMaterial();
const _defaultValues = /*@__PURE__*/ new LineBasicMaterial();

class LineBasicNodeMaterial extends NodeMaterial {

Expand All @@ -15,7 +15,7 @@ class LineBasicNodeMaterial extends NodeMaterial {
this.lights = false;
this.normals = false;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/LineDashedNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { float } from '../shadernode/ShaderNode.js';

import { LineDashedMaterial } from '../../materials/LineDashedMaterial.js';

const defaultValues = new LineDashedMaterial();
const _defaultValues = /*@__PURE__*/ new LineDashedMaterial();

class LineDashedNodeMaterial extends NodeMaterial {

Expand All @@ -20,7 +20,7 @@ class LineDashedNodeMaterial extends NodeMaterial {
this.lights = false;
this.normals = false;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.offsetNode = null;
this.dashScaleNode = null;
Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/MeshBasicNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import BasicLightMapNode from '../lighting/BasicLightMapNode.js';
import BasicLightingModel from '../functions/BasicLightingModel.js';
import { transformedNormalView, normalView } from '../accessors/NormalNode.js';

const defaultValues = new MeshBasicMaterial();
const _defaultValues = /*@__PURE__*/ new MeshBasicMaterial();

class MeshBasicNodeMaterial extends NodeMaterial {

Expand All @@ -19,7 +19,7 @@ class MeshBasicNodeMaterial extends NodeMaterial {
this.lights = true;
//this.normals = false; @TODO: normals usage by context

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/MeshLambertNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PhongLightingModel from '../functions/PhongLightingModel.js';

import { MeshLambertMaterial } from '../../materials/MeshLambertMaterial.js';

const defaultValues = new MeshLambertMaterial();
const _defaultValues = /*@__PURE__*/ new MeshLambertMaterial();

class MeshLambertNodeMaterial extends NodeMaterial {

Expand All @@ -16,7 +16,7 @@ class MeshLambertNodeMaterial extends NodeMaterial {

this.lights = true;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/MeshMatcapNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { matcapUV } from '../utils/MatcapUVNode.js';

import { MeshMatcapMaterial } from '../../materials/MeshMatcapMaterial.js';

const defaultValues = new MeshMatcapMaterial();
const _defaultValues = /*@__PURE__*/ new MeshMatcapMaterial();

class MeshMatcapNodeMaterial extends NodeMaterial {

Expand All @@ -19,7 +19,7 @@ class MeshMatcapNodeMaterial extends NodeMaterial {

this.isMeshMatcapNodeMaterial = true;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/MeshNormalNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { float, vec4 } from '../shadernode/ShaderNode.js';

import { MeshNormalMaterial } from '../../materials/MeshNormalMaterial.js';

const defaultValues = new MeshNormalMaterial();
const _defaultValues = /*@__PURE__*/ new MeshNormalMaterial();

class MeshNormalNodeMaterial extends NodeMaterial {

Expand All @@ -19,7 +19,7 @@ class MeshNormalNodeMaterial extends NodeMaterial {

this.isMeshNormalNodeMaterial = true;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
4 changes: 2 additions & 2 deletions src/nodes/materials/MeshPhongNodeMaterial.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import PhongLightingModel from '../functions/PhongLightingModel.js';

import { MeshPhongMaterial } from '../../materials/MeshPhongMaterial.js';

const defaultValues = new MeshPhongMaterial();
const _defaultValues = /*@__PURE__*/ new MeshPhongMaterial();

class MeshPhongNodeMaterial extends NodeMaterial {

Expand All @@ -22,7 +22,7 @@ class MeshPhongNodeMaterial extends NodeMaterial {
this.shininessNode = null;
this.specularNode = null;

this.setDefaultValues( defaultValues );
this.setDefaultValues( _defaultValues );

this.setValues( parameters );

Expand Down
Loading