How to inject earcut to this project!
Closed this issue · 4 comments
I use this responsity as template, and it work well,
But is there any way to inject earcut to this project?
Hi @Laioyu Yes, do you need it for extruding shapes? Here is an example:
import * as Earcut from 'earcut';
<extrudePolygon
ref={ref}
name='wall'
holes={holes}
shape={starPath}
depth={2}
sideOrientation= {Mesh.DOUBLESIDE}
earcutInjection={Earcut}
>
Full example here for that:
https://github.com/brianzinn/react-babylonjs/blob/master/stories/babylonjs/Basic/shapes.stories.js
Let me know if that works or if you have a different use case.
Thanks a lot, it works!
Due to my carelessness, I even didn't realize there is a earcut inject param in MeshBuilder.CreatePolygon function!
I didn't use the react-babylonjs, I use babylonjs in a react app directly.
I am developing a web program which for designing some houses easily. and I have referenced your repository during the developing process, Your work has been very helpful!
@Laioyu cool you got it working. I've started working again on a project that doesn't use react-babylonjs
. My intention is to have more projects like react-babylonjs-loaders
that will work with or without the react-babylonjs
renderer going forward - it's still early stages. I would imagine your houses are using lots of models/textures - the react-babylonjs-loaders
NPM is new and you can use the SceneLoader or AssetManager in react with Suspense/fallback:
https://github.com/brianzinn/babylonjs-cra-vanilla-ts
I really need to frequently loading pbr texture such as asphalt tile, metope, floor , and models such as furniture and pot plants, I've done related to try, but this aspect is still at the early stage, now I am paying more attention on providing UI for user operations to modify their house, such as providing toolbar to switch to modify tool, provides properties panel to modify a certain wall thickness. In the interoperability of babylongjs and react, I noticed that you have this responsity, I haven't tried it, but I think this is the right path, I'm still in the react's new.I need to spend several days getting familiar with the states and props of react.