MySchoolEngine / GLEngine

The goal of this repository is to build rendering focused game engine. Feel free to join me and extend this project.
https://myschoolengine.github.io/GLEngine-Documentation/
Other
21 stars 1 forks source link

C_StaticMeshResource get AABB #80

Closed RohacekD closed 4 years ago

RohacekD commented 4 years ago

This should be a funny and easy first task. In the constructor of C_StaticMeshResource should be also constructed S_AABB box defining its boundary. S_AABB lies in Physics module and has easy (yet years old API). The implementer should create it during the construction of C_StaticMeshResource as you have here all the vertices. Then create a setter for it.

Hints

You can validate its correctness by using the debug tool C_DebugDraw::Instance().DrawAABB() in void C_StaticMesh::PerformDraw() const. This way you will see the AABB box.

To load model, you should put .obj file into /data/models/ and than add it to the /data/levels/main.xml as new component e.g. <staticMesh filePath="model.obj" />.

You can easily obtain such file by exporting blender. Just check the option to export the mesh as triangles during export.

Motivation

This engine has no frustum culling so far, this should be the first step toward implementing it. Having correct AABB will allow us to implement frustum and scene intersection.