Hello together,
I could need some help to calculate the starting Index and indexCount for a Submesh, which should be a “Side” from a Polygon Mesh.
Here is the background story, if it’s too long, you may skip it reading. It’s just for understanding what happened in my mind and how i got to the conclusion using SubMeshes:
In my Project the main goal is to somehow configure a building. Currently I’m busy with making the Walls look pretty. I used to use the PolygonMeshBuilder and switched to the MeshBuilder.ExtrudePolygon (more convenient and new). To scale my Material according to the length of my Wall, I calculated the needed uScale/vScale for the diffuseTexture. Everything was fine. Well, except when I got to the problem, when I had to use another Texture for the backside of the wall. At first it sounded pretty easy, because you can use the FaceUV (Parameter in ExtrudePolygon to chanve u/v, cropping the area you need). This is where the pain started. You can’t scale the Texture and have the Scale changed and expect to get the “cropped” image repeated on your mesh. That’s not how it works (obviously after reading the documentation again ). Now I’m trying to part the Polygon into Submeshes and use different Materials.
Good idea and it worked. But only if the Polygon was a rectangle and the the holes too.
TL;DR;
My current Situation:
I have a Polygon which has 5 Corner points and n-amount of holes (all rectangles) and it is extruded.
I need to calculate somehow the indices for the “front-side” and “back-side” of it.
There should be a smart way to do it, but I can’t get into it.
Sorry if it’s rude to ask directly for maybe something simple like that, but I realy need it asap done
I already did it successfully with the other walls, which are always sole rectangles. But this shape with more than 4 is killing me right now.
Thank you in advance and excuse my bad english.
To explain the image:
this is the 5 Corner Wall with 4 Holes (presented by solid walls, dev purposes)
Wireframe is turned on, so sorry for confusion
Here are the working walls, I mentioned before. This is how it should look like in the end (except it is not a rectangle)
FRONT SIDE
BACK SIDE