Constimport { DecalPool } from '@jbcom/strata';
import { useRef } from 'react';
function CombatScene() {
const poolRef = useRef<DecalPoolRef>(null);
const onBulletHit = (point: Vector3, normal: Vector3) => {
poolRef.current?.addDecal(point, normal, {
texture: bulletHoleTexture,
size: 0.15,
fadeTime: 10
});
};
return (
<>
<DecalPool
ref={poolRef}
maxDecals={200}
fadeTime={8}
defaultTexture={bulletHoleTexture}
/>
<mesh onClick={(e) => onBulletHit(e.point, e.face.normal)}>
<boxGeometry />
</mesh>
</>
);
}
High-Performance Decal Pooling System.
Efficiently manages hundreds of temporary surface decals with automatic memory reuse, smooth fade-outs, and zero garbage collection spikes. Essential for action games with bullet holes, blood splatters, footprints, or any dynamic surface details.
Key Features:
Performance: Handles 100+ decals at 60fps with minimal overhead.