#pragma once #include #include "Deer/Path.h" namespace Deer { // This struct represents the data save in a position vertex, this is // defined by: integerPart.decimalPart, where each decimal part represents // 1 / 256. And the integer part is substracted 128 // Example: integerPart = 129; decimalPart = 32; // Result = (129-128).(32/256) = 1.125f struct PositionAxis { uint8_t integerPart = 0; uint8_t decimalPart = 0; }; struct VertexPosition { PositionAxis x; PositionAxis y; PositionAxis z; }; // Vertex normal is represented with a number fromn [-64,64], and then its // divided by 64 to know the decimal number struct VertexNormal { int8_t x; int8_t y; int8_t z; }; struct ModelData { uint16_t vertexCount = 0; VertexPosition* vertexPositionsData = nullptr; VertexNormal* vertexNormalData = nullptr; uint16_t indexCount = 0; uint16_t* indexData = nullptr; }; namespace DataStore { void saveModel(const ModelData&, const Path& name); ModelData loadModel(const Path& name); } // namespace DataStore } // namespace Deer