UNPKG

@threlte/extras

Version:

Utilities, abstractions and plugins for your Threlte apps

18 lines (17 loc) 536 B
import { NotEqualStencilFunc, EqualStencilFunc, KeepStencilOp } from 'three'; /** * Use in combination with the Mask component. * * @param id number to link useMask objects with <Mask> * @param inverse inverse the mask */ export const useMask = (id = 1, inverse = false) => { return { stencilRef: id, stencilWrite: true, stencilFunc: inverse ? NotEqualStencilFunc : EqualStencilFunc, stencilFail: KeepStencilOp, stencilZFail: KeepStencilOp, stencilZPass: KeepStencilOp }; };