"Remove this part" (Del) in the Models mode takes out any part without parts under it which nothing else
in the model points at (an animation, a light slot, a skin): with its components, its transform and its own
mesh. eu07m::remove_node now takes such a node with its geometry: its primitives go, and their vertices and
indices leave the streams where no other primitive shares them. The primitives after them move back, and
so do the meshes, the vertex groups and the references to the geometry store. A part whose mesh another
node draws too, or whose mesh has vertex groups, stays. Ctrl+Z puts the part back and picks it again.
So the flat glowing patch under a lamp post of E3D (placek) is taken out and a real light source put in the
lamp instead. Unit tests take out a part with geometry, check the streams and the primitive moved into its
place, write and read the model back, and keep a part whose mesh is shared.
The renderer lights a light point of a model only past its threshold of self-illumination, which E3D keeps
in the material of the submodel. A LGHT node without an LMAT (made in the editor, or exported anew) had the
threshold -1, never lit, so a light added to a lamp post and saved lit nothing. Such a light now shines
whenever its node is shown, as one of a .t3d with "selfillum: true"; the lamp slot of its parent still
switches it. The converter gives every light of E3D an LMAT with the threshold it had, so the converted
models don't change. TModel3d::AddEditorLight gives the light it adds the same threshold.
Self-test: modelsave and modelbrightness, and modelplace takes the parameters of the node after the skin
(lights 3). Tested on a lamp post imported from E3D: a light added in the editor, saved, and after a new
run the lamp lights the vehicle beside it, both from the scenery file and when it is put in later.
The cab of a vehicle is loaded only by getting in. "Get in the cab" in the Models mode does what the
simulation does then: it makes the train of the vehicle (TTrain::Init loads the cab, its controls and its
sounds), makes it the vehicle driven, and puts the camera in the seat of the driver. While the cab is edited
the editor draws it as from that seat: FreeFlyModeFlag is off and the vehicle owns the camera, which moves
with it by its offset (the sounds read the owner of the camera then). With the body picked, or in another
field of work, the view is free again.
A new self-test command, modelvehicle <name> [cab], picks a vehicle and gets in its cab. Tested on the
EU07-424 (303e-tv) with a light added to its cab.
The window of an EU07M model becomes the field of work "Models" (F7) beside the surroundings, the tracks,
the roads, the terrain and the catenary. The node bank says what is edited and lists the vehicles, the tool
options hold the page of the tool chosen in the toolbar (Lights, Parts of the vehicle, All parts,
Animations), and the inspector the settings of the part picked, in plain words; the fields of the format
are kept under Advanced.
- A click on the model picks its part (the smallest box of geometry of a part shown holding the point);
a light is added where the model is clicked, a spot shining towards the camera.
- A light which nothing else points at is taken out (eu07m::node_removable / remove_node, with
TModel3d::UnlinkEditorSubmodel / LinkEditorSubmodel on the model the game has).
- Ctrl+Z / Ctrl+Y take the changes of the model back and make them again, a light added or taken out
among them; another model asked for with changes not saved asks first.
- "Import to EU07M" writes <model>.eu07m beside the .e3d or .t3d of a model without one, made of the
model as the game loaded it (eu07m::import_model), so a lamp post or a cab gets its lights here.
- "Put a model in the scenery" puts a model of the folder of the models in front of the camera, "Whole
model" moves the scenery model with the gizmo of the editor, "Put a vehicle on a track..." opens the
Trainset tool.
- The inspector of a scenery model with an .eu07m file offers "Edit this model (F7)"; the floating window
is gone.
- Review: the model is written to its .tmp, closed and checked before it replaces the file, and a failed
.tmp is removed; play_clip counts From only for a positive pace again, so a pace of 0 holds the clip
and a negative one runs it backwards.
New icons at the end of editor_icons.png (the cells before them are unchanged), the strings in
lang/editor_pl.po, new self-test commands (modelmode, modeltool, modeladdlight, modelundo, modelredo,
modelremove, modelplace, modelimport) and unit tests of remove_node. No asset in the SVN is needed or
changed; the import writes an .eu07m file into the game data only when the user asks for it.
RaPrepare() applies the clips, then the channels, then the animation events, so an event on a node takes over from both.
The spec has the fixes of #538, #540 and #542 in English.
- The channel event reads the name of the channel as written (getTokens lowercased it), and set_channel() finds it
regardless of case: a channel named doorLeft couldn't be set from a scenery.
- JOIN.rest is read: the node is modelled at the rest value of its joint, which moves it by the value less rest (the
limits stay values of the joint). A part modelled half open no longer jumps when its channel is set. Files without it
(rest 0) move as before.
- The spec says so, and that no vehicle sets channels yet.
Test: a slider modelled half out.
- The clip event reads the name of the clip as written (getTokens lowercased it), and play_clip() finds the clip
regardless of case, as the submodels are found by their names: a clip named Open or Armature|Wave couldn't be started
from a scenery.
- An event without a pace (clip <name> endevent) plays the clip at its own pace with a line in the log, and leaves the
keyword it met to the event: before, endevent was read as a pace of 0 (stopping the clips) and the next token was
swallowed.
- Pace 0 with several instances of one model is held by #540's fix (the clips stopped stay set per instance).
- The spec says so.
- stop_clips() holds each clip at the moment it was stopped instead of dropping it: the pose lives in the submodels the
instances of a model share, so an instance whose clips were cleared snapped back to rest as soon as another instance of
the model played one (two doors of one model).
- RaPrepare() applies the clips before the animation events of the scenery, so an event moving a node (rotate,
translate...) takes it over from a clip, one ended or stopped included; before, a finished clip overrode the events
on its nodes on every draw.
- A node with a matrix (XFRM) has its TRS fields only as an approximation: the parts the tracks of a clip don't move are
taken from the decomposed matrix, so the node no longer jumps or skews when a clip starts moving another part of it.
- The spec says so.
- An instance with lightcolors of its own isn't instanced: the colours go onto the shared submodels as the instance is
prepared, which the instances of a bucket don't each get, so they all showed the colours of one of them.
- The walk takes the exclusive lock for the light records of a bucket only when they are stale in this frame
(Refresh_Light_Records() checks again under it): the later passes of the frame no longer stop the other walkers.
- instance_cull.comp (both renderers) puts the word of the light parts into [0][3] after the product with the view, so a
view with a translation can't stretch the first column of a lit instance.
- The spec: ls_Dark / ls_Home switch without the fade too, and the instances with light colours of their own.
The window of an EU07M model gets tabs: the tree of the nodes beside
the properties of the node picked, the parts of the vehicle, the clips
and channels, and the components of the model. The texts are Polish in
lang/editor_pl.po.
- With nothing selected, it shows the model of the vehicle driven (its
body or its cab).
- In the 3D view the node picked is framed and shows its axes and a
gizmo to move or turn it. The light sources are marked in their colour,
a spot with its axis, and a click on a mark picks its node. A press on
the gizmo or a mark doesn't pick a scenery node, and the editor's own
gizmo gives way. A double click in the tree flies the camera there.
- The settings of a node: its position, rotation (degrees) and scale,
and the distances it is drawn from and up to.
- "Add a light source here" puts in a node light_<n> with a point or
spot LGHT as the last child of the node. eu07m::insert_node moves
every reference to the nodes after it, and eu07m::add_component
appends a component; both have unit tests.
- Changes show at once on the model the game has, through new TModel3d
methods for the editor (ApplyEU07MLight, AddEditorLight,
SetEditorTransform, SetEditorRange). The spot's cones are edited as
half angles in degrees.
- Parts of the vehicle: the editor holds the lamps, coupler hooks and
hoses in their _off/_on/_xon state, and the pantographs up or down,
whatever the vehicle does. A held pantograph moves at its own pace,
in the editor too, up to the wire above it. Only the look changes:
the electrics of the vehicle don't.
- Neither the empty-scenery line nor the no-tracks hint shows in a
scenery of models alone.
- New editor self-test command: modelnode <name>.
Resolved for the rename to EU07M: the stale-file check is eu07m_up_to_date() before LoadFromEU07M, the loader catches
what reading throws, and the new tests name eu07m::.
Resolved: start_tools() parses the convertmodels flags with from_chars and both commands stop on bad flags; a vehicle's
.t3d is refused before it. The reader keeps the streams of this branch and the known sections of #535: an unknown
section the model needs is refused as unknown before its codec is looked at, and an unknown optional one in the codec of
the streams is passed over even by the tools, which can't keep it unpacked (forward compatibility of the codec flag). An
exception in a stream worker (no memory for a declared size) becomes the error of the file instead of std::terminate;
NOSONAR on the S2259 false positive there and on the seeded engines of the tests.
- The pass bits (0x30) BinInit guesses from a material when the E3D has none are marked (TSubModel::m_passguessed) and the
converter leaves them out of legacy_flags and the primitive flags: it loads through the null renderer, whose materials
all guess opaque, so the game makes the guess again with the real material.
- A vehicle's model isn't converted from its .t3d (dynamic 1): the game prepares it only after the vehicle marked its
animated parts, so the .e3d the game makes of it is converted instead.
- read_header refuses a file_size smaller than the header, which made the hash check read outside the span.
- Sections seen twice are found with a set, not O(n^2); all the sections together may claim at most 2 GiB; a section the
reader doesn't know and the model can do without is passed over before it is unpacked when keep_unknown is off.
- validate() checks that the parent of each node is the innermost node whose subtree holds it, so the tree of the ranges
is the tree of the parents.
- Light_OnNN / Light_OffNN found by the game's GetFromName, so of two submodels of a name the same one counts; a
replaceable skin drawn translucent gets material_flags::translucent; the convertmodels flags parsed without stoi.
- S3519: the matrix made with glm::make_mat4 instead of a memcpy into its first column; NOSONAR on the seeded engines of
the tests (S2245).
- The spec: u16 indices up to 65 536 vertices, and the two rules above.
Tests: a file_size below the header, a node in the subtree of another than its parent, an unknown section passed over.
Selecting a scenery model loaded from an .eu07m file opens the "EU07M
model" window: the tree of the nodes with their transforms and the
components aimed at each of them, then the components of the model.
- The fields of SOCK, JOIN, CHNL (with its bindings), LGHT, LSLT, EMIT,
COLL and MREF are edited; the other components are shown by size.
- The clip flags are edited, and a time slider holds the instance at a
pose (time stands still in the editor); TAnimModel::play_clip takes
the second to start from.
- Channel sliders try the channels on the instance without changing
the file.
- "Save the model" validates the model and writes the file through a
temporary one; the family store is kept. "Read it again" drops the
changes.
The geometry, the mapping and the materials aren't edited. The Polish
texts of the window are added to lang/editor_pl.po.
The variants of a vehicle repeat the same parts byte for byte, and each EU07M file carried them all again. PR #521 showed the
problem on E3D; EU07M solves it in the format.
- Block: the geometry of one primitive, its vertices in every vertex stream of the file and its indices, with a 16-byte header;
its id is 128 bits, two FNV-1a 64 of its bytes. Only a primitive whose vertex and index ranges are its own can be shared.
- Store: geometry.eu07mpack in the folder of the models, the blocks each once (zstd when it saves an eighth) and an index
sorted by their id (model/eu07m/eu07m_store.{h,cpp}).
- GREF, a new required section: the primitives kept in the store. The writer leaves their ranges out of the streams of the
file; the reader takes their blocks from the store (read_options::blocks), checks the id and the counts of each and puts
them back in place, so the model in memory has its whole streams and nothing past the reader knows the difference. A
model with references and no store, or with a block which isn't the one referred to, is refused with the reason. The
validator checks the references (primitive, counts, ranges of its own).
- The game opens the store of a folder once and keeps it (eu07m::family_store()); dump and validate read it too.
- Tools: "-eu07m pack <folder> [minimum bytes]" moves every block of at least 4 KiB (by default) which occurs more than
once in the models of the folder into its store, made anew from all of them, and writes the models again referring to it,
each read back and compared with what it was before it's replaced; "-eu07m unpack <folder>" writes them whole again.
Measured on copies of the converted models of the game: cd/181_v2 60.8 MB -> 4.0 MB (7%), pkp/11xa_v2/main 69.3 MB ->
5.8 MB (8%), pkp/elf_v1 109.6 MB -> 39.0 MB (36%), pkp/en57_v1 104.1 MB -> 39.3 MB (38%), 2-4 s a folder. All 223 packed
files pass -eu07m validate with their store. Four ELF parts drawn in the game (Vulkan) from the packed and from the whole
files, with the auto exposure off and the same seed: no pixel differs by more than 1. Unit tests 1208/1208, 4 new ones for a
round trip through a store, a model without its store, a wrong block, a primitive sharing its vertices and a folder packed,
packed again and unpacked.
The renderer still makes the geometry of each model on its own; sharing one range of the buffers between the models of a
family is the next step. No asset change: the game data has no .eu07m files, and the release doesn't read them.
The spec of docs/eu07m-format.md was written in Polish, after docs/world-format-eu07.md. It is translated whole, with the state of the format brought up to date and a section on the channels added. No change to the format itself.
A clip of stage 8 played on its own (autoplay) or from the code; a scenery event can start it now.
- New form of the animation event: "animation <delay> <model> clip <name> <pace>". A pace above 0 starts the clip from its
beginning at that pace (a clip playing starts over), 0 stops the clips of the model, its nodes left where the clips put
them. A clip the model hasn't gets "Bad event: ... can't find clip ..." in the log. The event is written back in the
same form. The forms before it (rotate, translate, digital, .vmd) read and run as they did. The current release doesn't
read the new form.
- The editor self-test gets "eventrun <name>", which finds the targets of the event and runs it at once, since the editor
runs no events.
Checked in the game (Vulkan): after "clip bend 0" the tube stands still (no pixel differs between three shots), after
"clip bend 2" it moves, "clip nosuchclip 1" logs the error (time let run in the editor for the test only). No unit test:
the unit tests don't link world/Event.cpp. Unit tests 1200/1200. Not built with GCC here.
The skinning of stage 4 moved the vertices on the CPU and replaced the geometry of each instance. The Vulkan renderer moves
them in a compute shader now; GL 4.6 stays on the CPU.
- gfx::skin_cache: the walks only work out the palette of the joints; flush(), before the walks of the next frame, moves
the vertices of the instances whose pose changed: through the new GfxRenderer->Skin_Geometry() where the renderer can,
else on the CPU with Replace / Replace_Indexed as before. A chunk made or emptied makes the buffers of the bank anew from
the vertices the CPU holds, so every instance skinned on the GPU is moved again then.
- Vulkan (rendering/vulkan14/vulkan14skinning.cpp, shaders/vk14/skin.comp): the bind pose with the weights of a skinned
part goes to the GPU once, the palette in the ring of the frame; the kernel writes the moved vertices over those of the
chunk of the instance in the buffer of its bank (gfx::basic_vertex), with barriers against the copies of the uploads and
the draws of the frames before, and before the draws of the frame. The vertex buffers of the plain banks get the
storage usage. The kernel is made the first time a part is skinned; without it the CPU moves them.
- eu07.ini: gfx.skinning.gpu (default yes); no moves them on the CPU in Vulkan too. Both give the same picture.
Checked in Vulkan: a tube of two joints turned by 60 degrees, GPU against CPU, with gfx.gpucull 0 and 1: no pixel
differs, and the log shows the kernel ran. Two instances, the second posed later: the first keeps its pose through the
rebuild of the bank, the same as on the CPU. A clip moving the tube every frame. GL 4.6 after the change of the cache:
both instances bent as before (time let run in the editor for the tests only). Unit tests 1200/1200. Not measured on a
large scene, not built with GCC here.
Stage 8 of the EU07M model format. A model can carry animation clips; each track of a clip sets the translation, the
rotation or the scale of a node at a time of the clip, and the parts of a node without a track keep its TRS.
- Format, five optional sections: ACLP (clips: name, duration, flags 0x1 loop and 0x2 autoplay, range of tracks), ATRK
(tracks: node, part, interpolation step / linear / cubic, ranges of keys), ATIM (key times), AVEC (vectors; with cubic
the in-tangent, value and out-tangent of glTF) and AROT (rotations in 8 bytes, "smallest three": the three smaller
components as snorm16 scaled by sqrt(2) and the index of the largest; eu07m::encode_rotation / decode_rotation).
The validator refuses a node out of range, keys out of their arrays, times which aren't numbers from 0 up, a cubic
rotation and tracks out of the range of the clip. -eu07m dump lists the clips and their tracks. The current release
doesn't read these sections; a file without them loads as before.
- Sampling (model/clip.cpp): step, lerp / slerp the shorter way, the Hermite spline of glTF with tangents per second;
the first and the last key held outside of them; a looped clip goes around its duration, another stops at its end.
- In the game: the clips play by the simulation time, from TAnimModel::play_clip(name, speed) or, flagged autoplay, from
the first time the instance is drawn. RaPrepare() samples them for the instance drawn and sets the transforms of the
nodes (TSubModel::SetClipTransform(), the new animation type at_Clip, gated by the instance like the others), so a clip
moving the joints of a skin bends the skinned parts. The nodes a clip moves are flagged animated at load, which keeps
the model out of the instancing. stop_clips() stops them.
- The editor self-test gets "clip <node> <name> [speed]".
Not yet: a scenery event starting a clip, and the CHNL channels bound to the time of a clip.
Checked: a skinned tube with an autoplay clip (the tip to 60 degrees and back in 2 s, looped) beside a still one, six
screenshots in Vulkan and in GL 4.6 go from straight to fully bent while the other stays (time let run in the editor for
the test only). Unit tests 1200/1200, 6 new ones for the packing, the interpolations, the time and the file. Not built
with GCC here.
Stage 4 of the EU07M model format. A primitive with a skin (SKIN, SKJT, weights in VSKN or VSKW) was drawn in its bind
pose. Now it follows the joints of its skin, in both renderers.
- The joints are nodes of the model, so they're posed as before: animation events, the .mmd, SetRotate / SetTranslate
from the vehicle code. The matrix of a joint is world(joint) * inverse bind(joint), world being the transform of the
joint from the root of the model with the animations of the instance drawn (TSubModel::posed_transform()); the
vertices lie in the bind pose in the space of the model, the transform of the node of the mesh left out, as in glTF.
- The loader keeps the bind pose and the weights of a skinned primitive (skinning::skinned_geometry on the submodel) and
the skins of the model (TModel3d::skins()).
- The first pass of a frame to draw a skinned submodel of an instance works out the palette and, when it changed, moves
the vertices on the CPU: positions by the blended matrix, normals and tangents by its rotation (model/skinning.cpp,
gfx::skin_cache in rendering/common/skincache.cpp). The geometry of the instance is made or replaced before the passes
of the next frame (flush() in the frame setup of both renderers), as nothing the passes draw may change while they draw
(gfx::walk_sync): the vertices follow the joints a frame late. In the bind pose the shared geometry of the model is
drawn; an instance not drawn for 600 frames lets go of its own.
- Fix: a node with range_max_sq 0, which the spec gives as no limit, was never drawn (a model made anew rather than
converted from E3D); it keeps the default range of a submodel now.
- The editor self-test gets "animate <node> <submodel> <x> <y> <z>", which turns a submodel of an instance as an
animation event does, since the editor doesn't run the events.
Not in this commit: the skinning in a compute shader, bounds of the posed submodel, motion vectors and ray tracing of the
moved vertices.
Checked: a tube of two joints in two instances, one turned by 60 degrees at its middle, bends smoothly while the other
stays straight, in Vulkan and GL 4.6, with gfx.gpucull 0 and 1 (time let run in the editor for the test only). Unit
tests 1194/1194, 5 new ones for the weights, the bind pose, the blending and the file. Not built with GCC here.
Stage 5 of the EU07M model format. A model with lights (lights, Light_On## / Light_Off##), such as a signal head, was
drawn instance by instance, a draw call for each part of each one. With gfx.instancedlights 1 the instances of such a
model go into the instanced batches like the others, in both renderers, with the culling of the GPU and without it. The
default 0 draws them as before. It applies to EU07M and E3D models alike.
- The light state of an instance is a word in the element [0][3] of its instance matrix, which an affine matrix leaves
unused: bits 0-7 the lit parts shown, bits 8-15 the dark parts, in the mantissa of a float of exponent 128
(0x40000000), a normal number the GPU carries through its matrix products whole. Without that marker the shader
draws everything, as before.
- model_ubs.light_part says which part of which slot a draw is (0 none, 1 + slot lit, 9 + slot dark); a part the
instance doesn't show gets a zero matrix in the vertex shader (instance_hides_part() and effective_modelview() in
shaders/vk14/common.glsl and shaders/ogl46/common.glsl). The batch instance shows every light part
(TAnimModel::RaPrepareInstanced()).
- CPU path: each instance drawn is animated (RaAnimate) and its word put in its matrix (Render_Instanced). GPU culling:
the word is in rotationscale[0].w of the instance record, refreshed once a frame for buckets with lights
(Refresh_Light_Records), which marks the records to send again when a word changes.
- An instance shows the whole lit part or the whole dark one: blinking and switching (ls_On / ls_Off / ls_Blink) change
over at half the fade, where the draw instance by instance fades the lit part in over the dark one. Steady states look
the same as before.
- The freespot lights (TP_FREESPOTLIGHT with flag 0x4000 and no animation) don't keep a model out of the instancing
when gfx.instancedlights is on. Light parts aren't put in the ray tracing of an instance batch.
Measured on Vulkan, 200 heads s4ipcpb_dd: with gfx.gpucull 0 frame 9.2 ms -> 1.5-2.5 ms and 2400 -> 16 draw calls, with
gfx.gpucull 1 9.1 ms -> 3.0 ms and 2410 -> 26 draw calls. Steady light states pixel for pixel the same as drawn
instance by instance on all three paths in Vulkan, and on GL 4.6 where the editor panels don't cover them; blinking
checked in Vulkan on all three paths (with time let run in the editor for the test only). Not run in the driver mode,
blinking not checked on GL 4.6, not built with GCC here. Unit tests 1189/1189.
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.
Stage 3 of the E4D model format. A model loaded from .e4d (modelformat e4d) reaches the Vulkan renderer as its compact
streams: positions (12 B), attributes (QTangent snorm16x4 + uv f32x2, 16 B), user data and indices, without the 48-byte
gfx::basic_vertex in between.
- gfx: gfx::compact_attributes, geometry_bank::create_compact() and GfxRenderer->Insert_Compact(). The default of
Insert_Compact decodes to basic_vertex, so the OpenGL 4.6 and the null renderers get the models as before. The CPU
readers of a chunk (pantograph, bounds, picking, the editor) get basic_vertex made from the streams the first time they
read it; a chunk which is changed (replace, append) turns into basic_vertex first.
- Vulkan: a bank whose chunks are all compact keeps positions, user data, attributes and indices in buffers of their own;
vertex_kind::scene_compact reads them (location 5 the quaternion as R16G16B16A16_SNORM). A program gets a COMPACT_VERTEX
variant the first time a compact chunk is drawn with it, in the background with gfx.vulkan.asyncresources, as the
MODEL_DRAWS one; the variant of the multi draws makes a compact one of its own. Only vertex.vert and cabprobe.vert
decode the normal (compact_frame() in common.glsl); the shaders of shadows, prepass, picking and cube shadows read
position and uv as before.
- Ray tracing: the BLAS of a compact chunk reads the positions with a stride of 12, and the reflections read the normal
and uv from the attributes (RT_FLAG_COMPACT in the record). Not tried with ray tracing on.
- The loader hands the streams of the file to Insert_Compact as they are; the stars keep their colours in the normals
of basic_vertex and go as before.
Measured on Vulkan (self-test, 250 models of the game, runs alternating with legacy): device memory 1.60-1.64 GiB
against 1.89 GiB, GPU time a frame 1.27-1.39 ms against 1.37-1.57 ms, the same frame time and load time, the picture
within 1/255 of the legacy one, no errors of Vulkan in the log. Unit tests 1189/1189; -e4d diff gives the same results
through the new decode. Not built with GCC here.
Stage 2 of the E4D model format. With modelformat e4d a model with an .e4d file beside its .e3d / .t3d is loaded from it;
legacy, the default, leaves the .e4d files alone and the game loads models exactly as before. The key is written to the
log at the start.
- TModel3d::LoadFromE4D (model/e4d/e4d_load.cpp) builds the same tree of submodels LoadFromBinFile builds from E3D,
and both go on through the same finish_binary() (the end of the E3D loading, moved out of deserialize unchanged).
.mmd, events, GetFromName and the editor work as before. A file that can't be read or isn't valid is logged and the
.e3d / .t3d is loaded instead. TModelsManager finds a model which comes as an .e4d alone.
- Format additions found by comparing loads (the format isn't released, so still version 1.0):
- the LMAT component: the material of a node without geometry (light points, rotators), whose light threshold,
colours and material the lights use;
- node_flags::no_transform: an E3D submodel without a matrix, told apart from one with the identity matrix;
- section_flags::meshopt: the vertex and index streams in the codecs of meshoptimizer (vertex codec version 1,
index sequence codec), lossless, several times faster to unpack than zstd on this data. zstd packs the other
sections; zstd over the coded streams is an option for archives (write_options::compress_streams).
- meshoptimizer v1.3 (MIT) as a submodule in ref/meshoptimizer; only its vertex and index codecs are built, into
eu07_core.
- Loading speed: the big streams unpack on threads of their own, and a model of 100 000 vertices or more fills the
vertices and indices of its submodels on up to 8 threads (std::jthread); the vertices are written once, without the
zeroes of resize(). QTangent decoding takes the two matrix columns it needs without a square root.
- eu07 -e4d diff <e3d|t3d> <e4d> [dynamic] compares the two loads submodel by submodel and times them.
Checked:
- 250 random models of the installed game: all convert, and loaded from E4D they give the same tree, names, flags,
materials and indices as from E3D; positions and UVs bit for bit, transforms within 6.5e-5, normals within 0.03 deg
(4 vertices with a broken normal in the E3D get a proper one).
- Size 39% of the E3D (263 MB against 682 MB). Load outside the game, with the files in the system's cache: 516 ms
against 561 ms, 0.75 of the time for the models of 5 MB and more, 1.21 for the smaller ones.
- In the game on Vulkan (self-test, the same 250 models): 3.05 s against 3.15 s to load them, the same frame time and
device memory, the picture within 1/255 of the legacy one.
- Unit tests 1189/1189, among them the codecs with and without zstd, a codec on a wrong section and a cut stream. Not
built with GCC here.
No asset change is needed: the game data has no .e4d files, and the release doesn't read them.
A fully binary successor of E3D, laid out for the GL 4.6 and Vulkan 1.4 renderers. Stage 1 of the plan: the format
and its tools. The game doesn't load .e4d yet; that is stage 2, behind a switch in eu07.ini.
- docs/e4d-format.md: the spec (in Polish, like world-format-eu07.md).
- model/e4d/e4d_format.h: the records and FourCCs, with static_asserts on sizes and offsets.
- A table of sections with required/optional flags and zstd per section; tables carry count and stride, so a later
version appends fields and an older reader takes the part it knows.
- Nodes in depth-first order with TRS (XFRM for sheared matrices), meshes, 48-byte primitives.
- Split vertex streams: VPOS f32x3, VATT QTangent snorm16x4 + UV f32x2 (28 B a vertex instead of 48 B), VSKN/VSKW
skin weights, VUSR user data, VBND for primitives merged from several nodes (rigid joints, light slots).
- Indices u16 or u32 per primitive, local to its base vertex.
- Typed components on the model, nodes, meshes and vertex groups (PROP, SOCK, JOIN, SPRG, CHAN, VARI, CHNL, LSLT,
LGHT, EMIT, MREF, COLL, LANM, LTXT, STAR), skins, vertex groups, a name index and bounds.
- model/e4d/e4d_io: write and read; the file is untrusted, so every offset, size, index, parent and reference is
checked (validate) before anything is used, and a broken file is refused with a reason.
- model/e4d/e4d_build: QTangent packing, TRS from matrices, the name index and the bounds.
- model/e4d/e4d_convert: a model loaded from E3D or T3D into E4D, and the command line:
eu07 -e4d convert <in.e3d|in.t3d> <out.e4d> [dynamic], eu07 -e4d dump <file>, eu07 -e4d validate <file>.
- zstd moves to eu07_core, which the unit tests link.
- tests/unit/test_e4d.cpp: round trip, section alignment, records of a later version, broken files, random mutations,
QTangent, TRS, name lookup, bounds, merged primitives.
Checked: 250 random .e3d of the installed game convert (E4D 21% of their size with zstd, 60% without), and the
vehicle families en57_v2, t448p_v2 and vectron_v1 (701 files). Unit tests 1188/1188. Not built with GCC here.
origin/staging 7ac2472c3 into feat/gl46-migration db26a33ed, so that #468
merges into staging. Merge base 037158104. Staging carries master up to
571487612 (squashed in #514); this branch had merged master up to 7c12b83ba.
Conflicts, file by file:
- README.md: WITH_BETTER_RENDERER row dropped (gl46), USE_SYSTEM_JSON row kept (staging)
- CMakeLists.txt: gl46 lists, plus staging's new core sources (hardwareinfo, sn_utils, regionfile, inionlysettings, fieldshunting, gaugewrap, drivingaid, signalpassing, brakereleaser, crew, brakecharge); none listed twice
- tests/unit/CMakeLists.txt: both (texturealpha, freecameramotion; editorSwitchDrives, Camera)
- vehicle/brakingcurve.{h,cpp}, tests/unit/test_braking_curve.cpp (add/add): staging (#479 brake_acting on the same #409 code)
- editor/editorHttp.cpp: staging (it has gl46's #432 and certificate fixes, plus #439 libcurl loaded at run time)
- tests/unit/test_editor_http.cpp (add/add): staging (adds the available() case of #439)
- utilities/Globals.h: gl46 crashdump_full (staging's CrashDumpFull is #425, replaced here by utilities/crashdump.cpp); fmradio and staging's OpenAL options both; gfx_headlights_beamwidth (#481) not taken
- utilities/Globals.cpp: both (odometer.expiry, OpenAL keys, fmradio, gl46 gfx keys); gfx.headlights.beamwidth (#481) not taken
- utilities/Logs.cpp: staging's log_file_name() for both files, with gl46's crashdump_set_log_file() for both
- utilities/utilities.h: gl46 set_thread_random_engine(); Random(int, int) gone on both sides
- tests/unit/test_utilities.cpp: staging's includes
- simulation/simulationtest.cpp: gl46 (no NvRenderer, LegacyRenderer, BasicRenderer here)
- ci_shadervalidator/* (incl. add/add utilities/Logs.h): gl46's validator of shaders/ogl46 and shaders/vk14; staging's #437 fixed the GL 3.3 one
- gl/shader.cpp, gl/glsl_common.cpp: gl46 (shaders come from rendering/common/shadersource.cpp); HEADLIGHT_BEAM_WIDTH (#481) not taken
- shaders/mat_wire.frag: gl46. Rename detection paired staging's mat_colored.frag (#481) with it
- lang/editor_pl.po: union; the 12 camera speed / orthophoto entries staging adds are here already (master #312)
- audio/audiorenderer.{h,cpp}: both (fmradio; startsample and the low-pass filter); the destructor releases the radio, then the filter
- application/editormode.h, application/editormodeswitchdrive.cpp: staging (#509 on #330, which is all this side had)
- application/application.cpp: gl46's start sequence (no init_ogl, ANGLE or NvRenderer; crash window after init_ui) with staging's hardware::log_system() (#389)
- EU07.cpp: gl46 (crash reports of utilities/crashdump.cpp); staging's side was #425's handler, replaced here
- model/Texture.{h,cpp}: gl46 (texture_source); staging's side is master #399/#411/#362/#386, merged here before
- world/Track.h, world/TrackSleepers.h: both (TrackBlend, lay(Fastened)/fasten; TrackBuckle, pack_models)
- world/Segment.cpp: staging's track buckling on the split stray factors both sides have
- vehicle/Driver.h: staging's additions (#444, #494, #473, #346, timetable flags)
- vehicle/Driver.cpp: staging's file, with this branch's f4f8c75e4 (road orders measured along the lane) and 8fbf05674 (a holding road order blocks the ones past it) applied again; #409's SeenAheadTolerance gives way to #473
- vehicle/DynObj.h: friend opengl46_renderer and friend class vehicle_table
- vehicle/DynObj.cpp: gl46's vehicle_table::update() with staging's update_off_track_contacts() and update_brake_pipes()
- McZapkie/Mover.cpp: staging's function splits (#239) and hose exchange (#388); every line this branch added to Mover.cpp/MOVER.h is kept
- .github/workflows/build_bin.yml: staging's apt-install step (#497) and pinned download-artifact (#331)
Modify/delete, kept deleted:
- rendering/opengl33renderer.{cpp,h}, rendering/openglparticles.cpp, rendering/openglrenderer.{cpp,h}: staging's versions are master's, and every master change to them is in this branch's history already
- shaders/light_common.glsl, shaders/mat_sunlessnormalmap_specgloss.frag: see below
Carried into this branch's code:
- the hose exchange after each sub-step (#387/#388) also in update_steps_parallel(), per group of vehicles, as update() does it single-threaded
- physics.pipewake (pipe_wakes(), wake_cause::scndpipe) in staging's GetScndDVc(), where the main reservoir hose exchange went
- hardware::log_gl_context() (#389) in after_window() of the GL 4.6 backend, init_ogl() being gone
Taken back out of the auto-merge (renderers this branch removed):
- shaders/vk14/tonemapping.glsl: #481's switch to ACES, applied there by rename detection
- environment/skydome.cpp, simulation/simulationenvironment.cpp: #415, the sky of the legacy renderer
- application/application.cpp: #384's fallback of an unknown gfxrenderer, which this branch had dropped
Not carried from staging (renderer files removed here):
- master #481 (571487612): old assets drawn as in 26.05 (metal diffuse, sun highlight tint, ACES, SUN_DIFFUSE_SCALE 2.5, untinted Diffuse, mat_colored base) and gfx.headlights.beamwidth. Made for the GL 3.3 shaders; the PBR shaders of shaders/ogl46 and vk14 (and their SPIR-V binaries) are the author's call
- #437: the unique temporary file of the shader validator (Sonar S5443); gl46's validator still writes /tmp/shader*
Unit tests: 1133 of 1137 cases pass. Four staging tests fail (derailment: a
repaired vehicle is back on the rails; three pullee cases): the vehicle
stands, and with physics.sleepheld (on by default here) its physics sleeps
with the Fb / FStand of before. With physics.sleepheld off they pass. Left
to the author.
* docs: behaviour changes accepted in review, for release notes and triage
* docs: the physics log entries after the revert of #408#443 reverted #408 on staging and brought master's #385. physicslog yes
logs road vehicles again, the closing waits for every log, and the
2 s thread, the illegal characters, physicslog.trains and blackbox come
from #385. The test.* keys show in the settings dump of log.txt, not in
an editor save.
* docs: track_uneven_doc.md from the root of the repository to docs/ (#237)
The tool that grades the tracks points to its new place; directoryDescription.md
names docs/.
* docs: the local changes of the bundled ImGui (#236)
docs/imgui_patches.md lists what imgui/ changes against upstream
v1.91.9b-docking (io.ConfigViewportsNoAutoDetach, io.ConfigTooltipsWrapWidth,
BufferingBar/Spinner, the glad loader, the main-window origin of the GLFW
backend, the gamma of the OpenGL 3 backend) and in ImGuizmo, with the commits
that brought them, so an update of ImGui carries them over.
* build: the license texts of the audio DLLs from ref/licenses instead of downloads (#405)
The Windows build downloaded 14 license texts on every run without a cache
hit, from raw.githubusercontent.com, scm.orgis.org (mpg123) and
sources.debian.org (LAME). They are now in ref/licenses, byte for byte as at
the pinned URLs (-text in .gitattributes, so a checkout with CRLF doesn't
change them), and the step copies them from there, still checked by their
SHA-256. ref/licenses/README.md names the URL of each. The two release zips
are still downloaded and cached as before.
* docs: the ImAbs shim of ImGuizmo listed, stale comments of the DLL step, a plain docs/ row
* Local lights: street lamps of the scenery light their surroundings
Optional settings, all off by default (nothing changes without them):
- gfx.lights.stars: Stars submodels (e.g. "lamp" of the SGP340 street lights) whose glowing points light downwards as lamps;
signal LEDs, chimneys and the sky only glow
- gfx.lights.points.near: scenery lamps shining downwards light also closer than their glare is seen from
- gfx.lights.freespot.mincone: wider cones for scenery lamps shining downwards (many have the narrow cone of their glare)
- gfx.lights.lamps.gain: brightness of the scenery lamps shining downwards
- gfx.lights.hideglow: textures of the planes faking the light of lamps (pools of light, glows), hidden while the lamps light
Lights shining sideways (signals) keep their cones, brightness and distances.
The lamps made of glowing points are gathered also from the opaque instances of a cell.
* Local lights: the lamp settings in a parser of their own, the draw phase test in a helper
The entries of the lamps are read by ConfigParse_gfx_lamps, which the parser of the sky hands the tokens it doesn't know, and
the opaque and translucent draws ask drawn_in_phase whether a submodel has a part in them, so the long functions keep their
complexity. The fake glow cache is private, the colour of a light point is lightcolor (no shadowing of rendermode::color),
the minimal distance of a submodel comes from walk_min_distance and the lit instances of a cell from add_lit_instances.
* Settings: the lamp entries are tried by the main loop of the parser, the parser of the sky stays as it was
* Local lights: the fake glows are left out only within the reach the lamps are gathered from
Beyond gfx.lights.range nothing lights the ground in place of the pools of light and glows of the lamps, so a scenery model
keeps them there. Render_Alpha(TAnimModel *) tells hide_fake_glows() which model it draws, and is_fake_glow() leaves out the
glows of that model only, when it is within the range (and its radius) of the camera the lamps are gathered around. The glow
planes are translucent, so the opaque draws are as they were.
* Local lights: hide_fake_glows() takes the model as it is drawn (radius() isn't const)
* Local lights: the fake glows hidden at any distance again, gfx.lights.lamps.range to see the lamps from afar
Glow planes kept beyond the reach of the lamps don't light a distant station either, they only float above it, so the glows
listed in gfx.lights.hideglow are left out at any distance again. A lit station is seen from afar with gfx.lights.lamps.range
instead: the lamps are gathered from that far when it's above gfx.lights.range (0, the default: from gfx.lights.range).
* Local lights: gfx.lights.lamps.range for the lamps of the scenery only, the vehicles keep gfx.lights.range
* Local lights: the fake glows are kept with gfx.lights.range 0, the limits of gfx.lights.hideglow in the docs