correct models get picked and rendered

This commit is contained in:
dompia5 2024-02-08 03:09:40 +01:00
parent 966f3fdc39
commit 06fe86f652

View File

@ -659,17 +659,21 @@ void renderScene(GLFWwindow* window)
int plant_type_count = plants.size();
int types_count = 1;
std::vector<glm::vec3> current_type_plant_positions;
current_type_plant_positions.clear();
int iterator = 0;
for (int i = 0; i < planet.Plant_type_count.size(); i++)
{
if (planet.Plant_type_count[i] > 0)
{
for (int j = 0; j < planet.Plant_type_count[i]; j++)
{
//current_type_plant_positions.push_back(0);
current_type_plant_positions.push_back(std::get<1>(plants[iterator]));
iterator += 1;
}
placeObjectOnPlanet(plant_specimens[0].modelContext, glm::mat4(), 0.2, current_type_plant_positions, planet, plant_type_count, plant_specimens[0].material);
placeObjectOnPlanet(plant_specimens[i].modelContext, glm::mat4(), 0.2, current_type_plant_positions, planet, plant_type_count, plant_specimens[0].material);
}
current_type_plant_positions.clear();
}
for (const auto& plant : plants)
{
@ -759,8 +763,8 @@ void init(GLFWwindow* window)
loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material);
loadMTLAndGetTextureID("./models/plant_2_1_small.mtl", plant2_1Material);
plant_specimens.push_back(Plant::Plant(7, 3, 7, 3, "plant1_s", "./models/plant_1_1.obj", plant3Material));
plant_specimens.push_back(Plant::Plant(5, 3, 5, 3, "plant1_m", "./models/plant_2_1.obj", plant2_1Material));
plant_specimens.push_back(Plant::Plant(7, 5, 7, 5, "plant1_s", "./models/plant_1_1.obj", plant3Material));
plant_specimens.push_back(Plant::Plant(5, 5, 5, 5, "plant1_m", "./models/plant_2_1.obj", plant2_1Material));
//plant_specimens.push_back(Plant::Plant(1, 0.90, 1, 1, "testPlantCCCCCCCCCCC", "./models/plant_4.ply"));
//plant_specimens.push_back(Plant::Plant(1, 0.5, 1, 1, "testPlantBBBBBBBBB", "./models/plant_4.ply"));