Might as well post this, I found a way to do an extrusion which doesn’t consume a lot of resources, however beware since because of the way is constructed the fill() function doesn’t work properly
//function for extrusion, returns a single PShape which will be the whole solid
//takes as arguments the figure to extrude and the thickness
PShape extrusion(PShape baseExtrusion, float extrudeT) {
//initialize the result and generates a vector that will have the base vertices
PShape parte=new PShape();
PVector[] v=new PVector[0];
//fill the vector with the vertices
for (int i=0; i<baseExtrusion.getVertexCount(); i++) {
v=(PVector[])append(v,baseExtrusion.getVertex(i));
}
//starts constructing the whole solid
parte=createShape();
parte.beginShape();
for (int i=0; i<baseExtrusion.getVertexCount(); i++) {
/*
creates the lateral rectangles of the extrusion in a single motion by looping around itself*/
if (i+1<baseExtrusion.getVertexCount()) {
parte.vertex(v[i+1].x, v[i+1].y, v[i+1].z);
parte.vertex(v[i+1].x, v[i+1].y, v[i+1].z+extrudeT);
parte.vertex(v[i].x, v[i].y, v[i].z+extrudeT);
parte.vertex(v[i].x, v[i].y, v[i].z);
parte.vertex(v[i+1].x, v[i+1].y, v[i+1].z);
} else {
//when is at the last rectangle it just conects to the start
parte.vertex(v[0].x, v[0].y, v[0].z);
parte.vertex(v[0].x, v[0].y, v[0].z+extrudeT);
parte.vertex(v[i].x, v[i].y, v[i].z+extrudeT);
}
}
parte.endShape();
return parte;
}
}