The Simulation class may be extended to design a personal universe in which one is free to create any kind of 3D rendered environment.
This simulation requires 2 virtual functions to be overridden:
void init(): this function will be called when the simulation is created. This is the place to create any object
<aside> ⚠️ This function is also called on the reset of the simulation, after all objects have been cleared.
</aside>
void update(double deltaTime): this function will be called every frame. The deltaTime parameter correspond to the ellapsed time between the current frame and the previous one.
An Object is always attached to a Mesh. The Mesh part is just the abstract creation of a list of triangle. Once you got a Mesh, you can create any object with the createObject method.
<aside> 🧠 A Mesh doesn’t have any physical attribute such as Transform since it does not exist in the simulation. It is only a blueprint meant to create Object from it.
</aside>
<aside> 👀 You can create a Mesh using the createFrom static method of the Mesh class. Please provide a path to a 3d object file. You can also check out the generateXXX methods of the Mesh class.
</aside>
Since the Mesh acts as a Blueprint and is required to be instanciated only once, please create it in the constructor.
After the creation of the Mesh, it is required to register it to the simulation in order for the simulation to render it. This can be done using the registerMesh method.