I'm writing a class that reads an obj file, indexes each mesh and creates a VAO and GameObject of the appropriate type. I've stumbled on a design issue. Objects of the same name (Tree_A001, Tree_A002) are currently skipped over, and their min and max extents are used to calculate their centre, and therefore where to position the a copy of that mesh. Not only does this mean I've read in the mesh twice, just to ignore all the data as soon as I've got the min and max, but in my case I have 230 trees. It works but takes 12-15 seconds to read in the file itself, and I've not been able to gleam the rotation or scale of said object. I understand that comparing the min and max extents of the duplicate mesh to the original could let me get the scale, but as soon as the mesh is rotated in the scene file then it breaks. I'd like to do something more efficient than this however, and I'm stuck on what do to. What is the done thing in professional games, that allows multiple objects to be placed in a 3d modelling software, and their individual position rotation and scale to be kept? I've experimented with using single triangles to represent the position and scale etc but it makes designing the scene much harder as you can't see what you're placing. Thanks for any advice
There are a couple of issues here, but it looks like they are all solvable for you.
A good starting point is to distinguish between a Scene and a Mesh. A Scene might contain many Meshes. The Mesh here is the obj file and the Scene is a list including, for example,
"meshname.obj", position(x,y,z), scale(x,y,z), rotation, ...
and so on for each object in the scene.
From here, you can identify the mesh object by it's filename, load it once, and place instances of it at each location as specified by the scene file.
Also, while you load it you can check the data in place to calculate the extents of the bounding box. That is, load the model from disk into a buffer, use the buffer to calculate extents, use the same buffer to build the VBOs.
Calculating the center point may or may not be necessary anymore. What I would do in this situation is export each obj file individually from the modelling package, with the pivot point at the origin of the model. That way it doesn't need to be calculated at run-time, the zero point for each model is already where I want it. It sounds like you tried to export a whole scene as an obj, but you really want to split up the scene and just the individual elements are obj.
Finally, you can do this kind of thing in Blender using scene export plugins. This will depend on your engine and your modelling program, but it can be done. Many games develop a custom editor to handle this kind of thing.