Skip to content

Commit

Permalink
fix: suggestion for fixing #242
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaellis committed Jan 19, 2021
1 parent cb64fb9 commit 13fea77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/softShadows.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@ import * as THREE from 'three'

type Props = {
frustrum?: number
frustum?: number
size?: number
near?: number
samples?: number
rings?: number
}

const pcss = ({
frustrum = 3.75,
frustrum,
frustum = 3.75,
size = 0.005,
near = 9.5,
samples = 17,
rings = 11,
}: Props = {}) => `#define LIGHT_WORLD_SIZE ${size}
#define LIGHT_FRUSTUM_WIDTH ${frustrum}
#define LIGHT_FRUSTUM_WIDTH ${frustum ?? frustrum}
#define LIGHT_SIZE_UV (LIGHT_WORLD_SIZE / LIGHT_FRUSTUM_WIDTH)
#define NEAR_PLANE ${near}
Expand Down Expand Up @@ -86,6 +88,9 @@ let deployed = false
export const softShadows = (props?: Props) => {
// Avoid adding the effect twice, which may happen in HMR scenarios
if (!deployed) {
if (props?.frustrum) {
console.warn('You have used an incorrect spelling of frustrum, this will be deprecated in the future')
}
deployed = true
let shader = THREE.ShaderChunk.shadowmap_pars_fragment
shader = shader.replace('#ifdef USE_SHADOWMAP', '#ifdef USE_SHADOWMAP\n' + pcss({ ...props }))
Expand Down

0 comments on commit 13fea77

Please sign in to comment.