18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-02 00:22:42 +01:00

refactor(model): the new model format is EU07M (.eu07m), not E4D

E4D read as the next version of E3D, which the format isn't meant to be tied to; EU07M goes with the world format .eu07.
The format isn't released, so nothing reads the old name.

- The extension .eu07m, the magic EU7M (the four bytes of the header), model/eu07m/ with eu07m_*.{h,cpp},
  namespace eu07m, docs/eu07m-format.md, tests/unit/test_eu07m.cpp.
- The command line -eu07m convert|dump|validate|diff, TModel3d::LoadFromEU07M, and the key modelformat eu07m|legacy
  of eu07.ini (Global.modelformat_eu07m).
- Nothing else changes: the sections, the records and the components are the same, so a converted file needs only its
  magic and its extension changed.

Unit tests 1189/1189.
This commit is contained in:
maj00r
2026-11-28 22:02:05 +01:00
parent 5185d69dc9
commit 92cc2dcc28
29 changed files with 300 additions and 300 deletions
+1 -1
View File
@@ -307,7 +307,7 @@ decode_compact( position_array const &Positions, compact_array const &Attributes
auto const count { std::min( Positions.size(), Attributes.size() ) };
vertices.reserve( count );
for( std::size_t idx = 0; idx < count; ++idx ) {
// the first and the third column of the rotation matrix of the quaternion, made unit by 2 / |q|^2 (e4d::decode_qtangent)
// the first and the third column of the rotation matrix of the quaternion, made unit by 2 / |q|^2 (eu07m::decode_qtangent)
auto const &packed { Attributes[ idx ].qtangent };
auto const x { packed[ 0 ] / 32767.f };
auto const y { packed[ 1 ] / 32767.f };
+1 -1
View File
@@ -79,7 +79,7 @@ using vertex_array = std::vector<basic_vertex>;
using userdata_array = std::vector<vertex_userdata>;
using index_array = std::vector<basic_index>;
// the attributes of a vertex in the compact layout of the E4D models: the tangent frame as a snorm16 quaternion (its w is negative
// the attributes of a vertex in the compact layout of the EU07M models: the tangent frame as a snorm16 quaternion (its w is negative
// where the bitangent is flipped), then the texture coordinates. with the position in a stream of its own a vertex takes 28 bytes
// against the 48 of basic_vertex, and the depth and shadow passes read 12 of them
struct compact_attributes {
+1 -1
View File
@@ -101,7 +101,7 @@ public:
virtual auto Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
// creates a new geometry chunk of specified type from supplied data, in specified bank. returns: handle to the chunk or NULL
virtual auto Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle = 0;
// creates a new chunk from the compact streams of an E4D model (positions, tangent frames as quaternions and texture
// creates a new chunk from the compact streams of an EU07M model (positions, tangent frames as quaternions and texture
// coordinates), with indices or without, in specified bank. a renderer which draws basic_vertex only gets them as such
virtual auto Insert_Compact(gfx::index_array &Indices, gfx::position_array &Positions, gfx::compact_array &Attributes, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) -> gfx::geometry_handle {
auto vertices { gfx::decode_compact( Positions, Attributes ) };
+1 -1
View File
@@ -66,7 +66,7 @@ enum class vertex_kind : std::uint8_t
particle, // position, colour and texture coordinates in one stream, the smoke
position_uv, // position and texture coordinates in two streams, the precipitation
particle_instance, // three vec4 of gl::particle_draw for each instance, the particles of the gpu
scene_compact // the compact streams of the E4D models: positions, user data, tangent quaternions with texture coordinates
scene_compact // the compact streams of the EU07M models: positions, user data, tangent quaternions with texture coordinates
};
// the vertices of a particle of the smoke of the cpu (vertex_kind::particle, as opengl46_particles has them)
+1 -1
View File
@@ -149,7 +149,7 @@ bool vulkan14_geometrybank::build()
}
release_();
// the compact layout when every chunk of the bank is of it (an E4D model); otherwise its chunks go as basic_vertex
// the compact layout when every chunk of the bank is of it (an EU07M model); otherwise its chunks go as basic_vertex
m_compact = (false == m_chunks.empty()) && std::ranges::all_of(m_chunks, [](geometry_chunk const &Chunk) { return Chunk.compact(); });
if (false == m_compact)
{
+1 -1
View File
@@ -52,7 +52,7 @@ std::uint64_t constexpr bottom_lifetime{1800};
std::uint64_t constexpr texture_lifetime{600};
// the size of the vertices of the banks (gfx::basic_vertex)
VkDeviceSize constexpr vertex_stride{48};
// a bank of the compact layout (the E4D models): the positions apart (12 bytes), the attributes (gfx::compact_attributes, 16 bytes)
// a bank of the compact layout (the EU07M models): the positions apart (12 bytes), the attributes (gfx::compact_attributes, 16 bytes)
VkDeviceSize constexpr compact_position_stride{sizeof(glm::vec3)};
VkDeviceSize constexpr compact_attribute_stride{sizeof(gfx::compact_attributes)};
// the vertices of the record are the attributes of the compact layout (rt_reflections.glsl, RT_FLAG_COMPACT)
+1 -1
View File
@@ -80,7 +80,7 @@ class vulkan14_renderer : public gfx_renderer, public gfx::scene_walk
gfx::geometrybank_handle Create_Bank() override;
gfx::geometry_handle Insert(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
gfx::geometry_handle Insert(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
// the compact streams stay as they are: the bank of an E4D model keeps them on the gpu, 28 bytes a vertex
// the compact streams stay as they are: the bank of an EU07M model keeps them on the gpu, 28 bytes a vertex
gfx::geometry_handle Insert_Compact(gfx::index_array &Indices, gfx::position_array &Positions, gfx::compact_array &Attributes, gfx::userdata_array &Userdata, gfx::geometrybank_handle const &Geometry, int const Type) override;
bool Replace(gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry, int const Type, std::size_t const Offset = 0) override;
bool Replace_Indexed(gfx::index_array &Indices, gfx::vertex_array &Vertices, gfx::userdata_array &Userdata, gfx::geometry_handle const &Geometry) override;