Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aardgoose committed Sep 16, 2024
1 parent 898bec6 commit c002fe8
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/renderers/common/extras/PMREMGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { equirectUV } from '../../../nodes/utils/EquirectUVNode.js';
import { userData } from '../../../nodes/accessors/UserDataNode.js';
import { texture } from '../../../nodes/accessors/TextureNode.js';
import { cubeTexture } from '../../../nodes/accessors/CubeTextureNode.js';
import { float, vec3, Fn } from '../../../nodes/tsl/TSLBase.js';
import { float, vec3 } from '../../../nodes/tsl/TSLBase.js';
import { uv } from '../../../nodes/accessors/UV.js';
import { attribute } from '../../../nodes/core/AttributeNode.js';

Expand Down Expand Up @@ -519,7 +519,7 @@ class PMREMGenerator {
const blurMesh = this._lodMeshes[ lodOut ];

blurMesh.material = blurMaterial;
blurMesh.userData = this._setUniformsBlur( targetIn, lodIn, sigmaRadians, direction, poleAxis );
blurMesh.userData = this._getUserDataBlur( targetIn, lodIn, sigmaRadians, direction, poleAxis );

targetIn.texture.frame = ( targetIn.texture.frame || 0 ) + 1;

Expand All @@ -537,19 +537,22 @@ class PMREMGenerator {

}

_setUniformsBlur( targetIn, lodIn, sigmaRadians, direction, poleAxis ) {
_getUserDataBlur( targetIn, lodIn, sigmaRadians, direction, poleAxis ) {

if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {
const cacheKey = `${ direction }-${ lodIn }`;

console.error( 'blur direction must be either latitudinal or longitudinal!' );
const u = this._userData[ cacheKey ];

}
if ( u !== undefined ) return u;

const cacheKey = `${ direction }-${ lodIn }`;

const u = this._userData[ cacheKey ];
// populate data for this pass

if ( u !== undefined ) return u;
if ( direction !== 'latitudinal' && direction !== 'longitudinal' ) {

console.error( 'blur direction must be either latitudinal or longitudinal!' );

}

const { _lodMax } = this;

Expand All @@ -569,7 +572,8 @@ class PMREMGenerator {

}

const weights = new Array( MAX_SAMPLES ).fill( 0 )
const weights = new Array( MAX_SAMPLES ).fill( 0 );

let sum = 0;

for ( let i = 0; i < MAX_SAMPLES; ++ i ) {
Expand All @@ -596,7 +600,7 @@ class PMREMGenerator {

}

const blurUniforms = {
const userData = {
latitudinal: direction === 'latitudinal' ? 1 : 0,
weights,
poleAxis,
Expand All @@ -607,9 +611,9 @@ class PMREMGenerator {
mipInt: _lodMax - lodIn
};

this._userData[ cacheKey ] = blurUniforms;
this._userData[ cacheKey ] = userData;

return blurUniforms;
return userData;

}

Expand Down

0 comments on commit c002fe8

Please sign in to comment.