pmndrs / react-three-csg

🚧 Constructive solid geometry for React
https://csg.pmnd.rs
MIT License
289 stars 12 forks source link

guidance for using this library with TextGeometry? #11

Open prechapl opened 1 year ago

prechapl commented 1 year ago

I'd like to to subtract text geometry from a mesh but I have not been able to get it to work. I get this error:

TypeError: Cannot read properties of undefined (reading 'count') at ensureIndex (buildFunctions.js:13:1) at buildTree (buildFunctions.js:737:1) at buildPackedTree (buildFunctions.js:791:1) at new MeshBVH (MeshBVH.js:164:1) at Brush.prepareGeometry (Brush.js:68:1) at Evaluator.evaluate (Evaluator.js:137:1) at index.js:68:1 at index.js:91:1 at commitHookEffectListMount (react-reconciler.development.js:14669:1) at commitLayoutEffectOnFiber (react-reconciler.development.js:14781:1)

marcofiletto commented 1 year ago

Hi! I have the same issue. What I did to partially solve it was to use inside (my case) <textGeometry args={['Test', { font, size: 1, height: 1 }]} /> where font is const font = new FontLoader().parse(myFont); and myFont it's a custom imported font import myFont from '/fonts/GreatVibes_Regular.json';

However, it seems that this approach requires more resources, because it takes longer to process.

marcofiletto commented 1 year ago

https://github.com/pmndrs/react-three-csg/issues/17