Hello I get some black parts on custom shapes created with BABYLON.MeshBuilder.ExtrudeShape
Here is my code (this.points is an array of Vector2):
if (!this._shapeInScene) {
let points: Array<BABYLON.Vector3>;
let path: Array<BABYLON.Vector3>;
let color: BABYLON.Color4;
//
points = new Array<BABYLON.Vector3>();
for (let p of this.points) {
points.push(new BABYLON.Vector3(p.x, p.y, this.plan.planCenter.y));
}
points.push(points[0]);
path = new Array<BABYLON.Vector3>();
path.push(new BABYLON.Vector3(0, 0, 0));
path.push(new BABYLON.Vector3(0, this.height, 0));
this._shapeInScene = BABYLON.MeshBuilder.ExtrudeShape(
this.name,
{
shape: points,
path: path,
sideOrientation: BABYLON.Mesh.DOUBLESIDE,
updatable: true,
cap: BABYLON.Mesh.CAP_END
}
);
color = new BABYLON.Color4(this.color.r / 255, this.color.g / 255, this.color.b / 255, 1);
this.colors = new Array<number>();
var positions = this._shapeInScene.getVerticesData(BABYLON.VertexBuffer.PositionKind);
this.positions = [];
for(var p = 0; p < positions.length; p++) {
this.positions.push(positions[p]);
}
for(var p = 0; p < positions.length / 3; p++) {
this.colors.push(color.r, color.g, color.b, color.a);
}
this._shapeInScene.hasVertexAlpha = true;
this._shapeInScene.setVerticesData(BABYLON.VertexBuffer.ColorKind, this.colors);
}
And here a screenshot of my issue :
And my question is what could be the reason of this issue?
Maybe my points in my Vector2 Array are not sorted properly?
Here an exemple on a babylon playground: Babylon.js Playground