I'm wondering how is the proper way to create objects of classes in the game loop once? For example I've Box, Sphere, Cyllinder classes and I want to create several objects at different time while the program is running and work with them in the future. How is the proper way to preserve this objects? Combine all of classes as vector in one class?
vector<glm::vec3> initVerts = {/*verts position*/};
class Box
{
vector<glm::vec3> verts;
Box(): verts(initVerts)
void moveBox(glm::vec3 newPos){ /*translate verts*/ }
};
while ( !windowShouldClose())
{
Box box;
box.moveBox(1.0,0.0,0.0); // on the second pass it was another box with initial position
}