// // EuropaTools // // (C) 2021-2025 modeco80 // // SPDX-License-Identifier: LGPL-3.0-or-later // import std.io; import std.mem; // Fundamental Types struct Vec3 { float x; float y; float z; // std::print("Vec3: {:4.4f}, {:4.4f}, {:4.4f}", // x, // y, // z //); }; struct Uvf { float u; float v; }; struct Face { u16 faceX; u16 faceY; u16 faceZ; }; // Europa .MSH types // a generic block struct tMeshBlock { u16 count; // count == 0 means no items in block if(count != 0) { std::print("Block with {:6d} items", count); Item items[count]; } }; // Used for vertex colors. struct VertexColor { u8 r; u8 g; u8 b; u8 a; }; struct UvBlockEntry { Uvf uvs[parent.parent.vertexBlock.count]; }; struct MeshPiece { char mtl_filename[while(std::mem::read_unsigned($-1, 1) != '\n')]; tMeshBlock vertexBlock; tMeshBlock vertexColorBlock; tMeshBlock normalBlock; tMeshBlock uvBlock; tMeshBlock faceBlock; }; struct MshFile { // This should just be read as lines in any real code. // I just do this to feel something char magic[while(std::mem::read_unsigned($-1, 1) != '\n')]; char version[while(std::mem::read_unsigned($, 1) != '\n')]; char dummy; // fuckkk dude // There is a meshpiece per material change I guess. tMeshBlock meshPieceBlock; }; MshFile msh @ 0;