Skip to content

Commit

Permalink
fix: blending
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Oct 30, 2024
1 parent 5432b8a commit cfa8890
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/modules/world-edit/utils/blending.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { LimitedSet } from 'lib/database/persistent-set'
import { Vector } from 'lib/vector'

const blendStorage = new LimitedSet<string>(1_000)

function blend(vectorId: string) {
blendStorage.add(vectorId)
return true
}

const dontBlend = false

export function skipForBlending(
Expand All @@ -23,12 +17,15 @@ export function skipForBlending(

if (blending === 0) {
// Circle
if (distance > radius) return blend(vectorId)
if (distance > radius) return true
} else {
// Blending
if (blending < radius) {
const blendingFactor = 1 + factor * 0.01
if (Math.randomInt(radius - blending, radius) < distance * blendingFactor) return blend(vectorId)
if (Math.randomInt(radius - blending, radius) < distance * blendingFactor) {
blendStorage.add(vectorId)
return true
}
}
}
}

0 comments on commit cfa8890

Please sign in to comment.