I’ve code to transform voxels to polygons:
extern class voxel
{
public:
sf::Vector3f place;
sf::Vector3f rotation;
sf::Vector3f attraction_direction;
sf::Shade* shade;
float weight = 0;
};
extern class polygon
{
public:
sf::Vector3f place[3];
sf::Shade* shade;
};
extern class mannequin
{
public:
voxel* voxels = new voxel[1];
polygon* polygons = new polygon[1];
sf::Vector3f heart = sf::Vector3f(0, 0, 0);
int voxels_count = 0;
int polygons_count = 0;
void set_voxel(int voxel_count, sf::Vector3f voxel_position, sf::Shade* voxel_color, sf::Vector3f voxel_rotation, sf::Int16 voxel_weight = 0)
{
voxels[voxel_count].place = voxel_position;
voxels[voxel_count].shade = voxel_color;
voxels[voxel_count].rotation = voxel_rotation;
voxels[voxel_count].weight = voxel_weight;
voxels_count++;
}
mannequin()
{
for (int i = 0; i (voxels_count);
};
~mannequin()
{
delete[] voxels;
delete[] polygons;
}
void optimize()
{
polygons_count = 0;
polygon* polygons__ = new polygon[voxels_count * 12];
auto add_polygon = [this](const sf::Vector3f& v0, const sf::Vector3f& v1, const sf::Vector3f& v2, sf::Shade* shade, polygon* polygons_) {
polygons_[polygons_count].place[0] = v0;
polygons_[polygons_count].place[1] = v1;
polygons_[polygons_count].place[2] = v2;
polygons_[polygons_count].shade = shade;
polygons_count++;
};
for (int i = 0; i
BUT it would not have in mind their colours and I do not know learn how to implement this
And I wrote this code a few 12 months in the past and I do not perceive what is going on on right here anymore