How to make decal addition smoother?

I have a modal and when I click on the modal a decal is added onto the modal. The actual function I want is a brush just like this:

Monkehpaint by manthrax

That when click and dragges decals are added to the model. But mine is way too laggy and takes too much time to add even a single decal.

My project

Is there a way to make it smoother or any code that does the same what I am doing.

Question: Why decals?
Answer: That’s because I want the decals to remain after the modal is deleted using the delete button in the GUI.

Use meshbvh to shapecast the region of geometry that you want to place decals on. Build a new, smaller geometry out of just the triangles resulting from the shapecast, and then run the decal generator on that geometry instead of the large high res mesh. once the decal is created… you can throw that smaller mesh away.