We have the dev environment. What's next?
- Pablo Narvaja

- Oct 10, 2019
- 2 min read
In the last post Llamathrust finished with a dev environment ready to continue coding and i thought what is what every game need? Player interaction! So I focused in getting keyboard and mouse input. Llamathrust use GLFW to query input from the OS but that will change in the future as I want to do my own per platform input query so I continue to do an input abstraction layer where I define my own keycodes and implement an event based input.
The input event system was tricky at the moment, so i searched for tutorials and found The Cherno's tutorials that helped me with it.
Next I want to render a obj file. Rendering a mesh was really simple as i already had done it before so were the texture and shaders, no struggles at all.
In the last post I also mentioned that I did my own mesh file based on xml, the problem with it was that is too slow to load large meshes so I moved on to make a binary version of it.
Reading and writing text to a binary file was simple but storing data was more complicated that I thought. Dealing with endianness for the first time was kinda frustrating since writing a whole array of float was tricky to say the least.
Once I knew how to write the mesh into the file it was time to make serialization more easy for every data I want to; I considered a serialzation library, mostly FlatBuffers by Google, but was too big and complicatedd to integrate into my simple project so I decided to do my own based on the serialization interface from Android and worked perfectly.
Since I implemented this interface in my vertex structure it gave me truble rendering because it changed the structure size by 8bytes. After testing where this 8bytes "padding" were place in the structure I figured out after searching in stackoverflow that virtual classes/structures in c++ have a pointer to its virtual members and that's why, in x64, it added 8bytes to my structure.
Finally I had all this working and was time to make a mesh cooker to convert my *.mudm files (mud models, xml based format) to *.ltbm files (llamathrust binary models).
That's all for this post, folks. Bye!

Comments