Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function createDepthPrePassMaterial(baseMaterial: THREE.Material): THREE.Material {
baseMaterial.depthWrite = false;
baseMaterial.depthFunc = THREE.EqualDepth;
baseMaterial.colorWrite = true;
enforceBlending(baseMaterial);
const depthPassMaterial = baseMaterial.clone();
depthPassMaterial.depthWrite = true;
depthPassMaterial.depthTest = true;
depthPassMaterial.depthFunc = THREE.LessDepth;
depthPassMaterial.colorWrite = false;
depthPassMaterial.opacity = 1.0;
depthPassMaterial.blending = THREE.NoBlending;
return depthPassMaterial;
}