18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-01 08:17:09 +01:00
Commit Graph

42 Commits

Author SHA1 Message Date
lcddisplay 339d70a6e6 Moths fly about the lit lamps of the scenery
A part of the lamps of the scenery models which shine downwards (moths.share,
picked by the places of the lamps) gets a swarm of moths: an instance of
animals/cmy.t3d (animated by textures, shader vat) put at the light point when
the lamp first comes within moths.range of the camera. The swarm is shown while
its lamp shines (the light points gathered by the local lights in the frame),
not in the winter and not below moths.temperature. The swarms are made by the
game (basic_node::m_generated): not saved with the scenery, not edited.

Settings (eu07.ini): moths yes/no, moths.share 0-1 (0.4), moths.range metres
(80), moths.temperature degrees (8). Also in the debug window of the lights.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXgG7F4L42c2F9sDSAJbT2
2026-11-29 11:39:09 +01:00
Hirek d0387753f8 refactor(physics): TMoverParameters becomes physics::Vehicle, the mover is gone
The physics of a vehicle loses the name it had from the Pascal of 2001. Done by
tools/rename/mover_to_physics.py, committed with it:

  physics/mover.h                  physics/vehicle.h
  TMoverParameters                 physics::Vehicle (in namespace physics)
  TDynamicObject::MoverParameters  physics
  mvOccupied, mvControlled         occupied, controlled (TTrain, TController)
  mvSecond, mvThird                secondUnit, thirdUnit
  mvPantographUnit                 pantographUnit
  mover, Mover, movers             physics, Physics, vehicles (locals, params)
  m_mover, othermover, currentMover, from_movers, renderMoverEventSounds
                                   m_physics, otherPhysics, currentPhysics,
                                   from_vehicles, renderPhysicsEventSounds

The code and the comments are renamed, the string literals are not: no text
the game shows, logs or looks up has changed (none had the names). The movers
of the editor, the tracks a slide moves, keep their name.

By hand: two member functions of TDynamicObject (gather_off_track_terrain,
begin_off_track) had a local mover aliasing their own MoverParameters, which
the rename made physics { *physics }; the alias is gone, they use physics->.
No other function has a renamed local meeting a renamed member (checked over
all the functions of the code before the rename).

For the branches made before it: run the script on the branch (python
tools/rename/mover_to_physics.py, from the root of the repository) before
merging it with this one, and the names don't conflict. It can be run again;
the second time it changes nothing.

The class is the same as it was; breaking it into its parts (braking,
electrics, controls, load) and making its data private are the next stages.

No change in behaviour: 1149/1149 tests, golden traces exact against staging
62f7a29b.
2026-11-28 23:56:46 +01:00
Hirek fbb9dc1e89 refactor(physics): the ends and the sides of a vehicle as scoped enums
end and side were unscoped enums: front, rear, left and right sat in the
global namespace (the test PCH had to leave mover.h out for it), and an end
went into any int, a side into an end, without a word from the compiler. They
become enum class VehicleEnd and VehicleSide (physics/vehicletypes.h); the
names follow the rule for types, and leave "end" and "side" to the many
locals of that name. The numbers stay: front 0, rear 1, right 0, left 1.

- ByEnd<T> / BySide<T>: two values indexed by the enum, and by a number
  where a loop or a format counts them. The arrays of the ends and the sides
  are these now: Couplers, Neighbours, Pantographs, MotorBlowers, Lights,
  iLights, Doors.instances, pVehicles, IsAnyDoor*, m_lighthints, vCoulpler,
  m_couplersounds, m_mirrormotion, iInventory, and the voltages of the
  couplers
- VehicleEnds / VehicleSides to go through them, Opposite() in place of
  1 - end, NumberOf() where a number is needed
- the couplers and the collisions take the ends they work on as VehicleEnd:
  CouplerForce, CouplerVelocityDifference, CollisionDetect, crush_hit,
  CompatibleCoupling and the rest of their family, DirF, DirPatch, and of
  the vehicle couple, uncouple, the adapters, off_track_gap, has_signal_on;
  Attach, Dettach and DettachStatus have overloads by the ends
- neighbour_data::FacingEnd() and TCoupling::ConnectedEnd() give the end of
  the other vehicle as VehicleEnd; the fields stay numbers, as they hold -1
  and 2 for "none" in places

The walks along the consist (FirstFind, Neighbour, the AI's coupling and
uncoupling) still carry the ends as numbers; where one of them meets a typed
end, NumberOf() and EndOf() say so, and keep the number as it was.

Kept as it was, and worth a look: TDynamicObject::SetLights() switches the
headlights A/B off by CabActive with the cases end::front and end::rear, that
is CabActive 0 and 1, while CabActive is 1 or -1 for the cabs; the cases are
NumberOf(VehicleEnd::front / rear) now, the same numbers.

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b. betterRenderer/, not built, has had only end:: and side:: renamed.
2026-11-28 18:32:58 +01:00
Hirek 2098614f8c refactor(physics): the couplings are Coupling and CouplingSet, not the bits of an int
What a coupling between two vehicles joins (the coupler, the brake hose, the
control cable, the high voltage...) was an int of bits, tested as
(flag & 36) == 36, (x & coupling::control) != 0, TestFlag(), SetFlag(x, -y),
compared with 0 and 3, with the same values twice (coupling:: and ctrain_).

- enum class Coupling (coupler, brakeHose, control, highVoltage, gangway,
  mainHose, heating, permanent, power24v, power110v, power3x400v), the values
  the scenery files and the definitions have always used; ctrain_* is gone
- CouplingSet, a set of them: HasAll(), HasAny(), Empty(), Set(), Clear()
  (as SetFlag() and ClearFlag() worked), Without(), |, &, ^, ==, and a test
  of any kind in a condition
- TCoupling's CouplingFlag, AllowedFlag, AutomaticCouplingFlag, PowerFlag and
  PowerCoupling, TCommand's couplings (was Coupling), the coupling parameters
  of the commands, Attach(), CompatibleCoupling(), Next(), Prev(),
  FirstFind(), is_connected(), the AI's iCoupler are CouplingSet
- the numbers are read into a set where they come in: the .fiz (BuffCoupl,
  negative AllowedFlag still meaning permanent), the scenery trainsets, the
  AI's Connect command, InvCtrCplFlag; and written as numbers where they go
  out: the scenery loader, the black box, the debug panels, DettachStatus()
- (CouplingFlag & 36) == 36 reads HasAll(Coupling::control | Coupling::mainHose)

No change in behaviour: 1144/1144 tests, golden traces exact against staging
62f7a29b.
2026-11-27 23:20:53 +01:00
Hirek b82784be92 refactor(vehicle): AnimModel.h, Sweep.h and Camera.h no longer include DynObj.h
The scenery models (AnimModel.h), the sweeps (Sweep.h) and the camera
(Camera.h, which Globals.h includes) pulled in the whole vehicle header, for
one structure (material_data) and a pointer type.

- model/materialdata.h/.cpp: material_data and TextureTest(), moved from
  DynObj.h/.cpp as they were
- Camera.h names TDynamicObject through utilities/Classes.h
- Classes.h includes interfaces/ITexture.h for null_handle, the value of the
  handles it defines; AnimModel.h includes utilities/Names.h for basic_table
  itself. Both came through DynObj.h before.
- the files that use the vehicles include vehicle/DynObj.h themselves

164 of the 730 objects of the build depend on DynObj.h now, 304 before.

No change in behaviour: 1142/1142 tests, golden traces exact against staging
62f7a29b.
2026-11-27 19:46:26 +01:00
Hirek 19f884cdbb refactor(physics): the vehicle vocabulary in physics/vehicletypes.h; DynObj.h and Driver.h no longer include mover.h
DynObj.h included physics/mover.h, so nearly every file of the simulator
compiled the whole vehicle physics (TMoverParameters and the brakes) though
most of them only name a vehicle end, a coupling or a light.

- physics/vehicletypes.h: the enums, flags and small structures the rest of
  the simulator passes around (end, side, coupling, light, sound, activation,
  train_type, TEngineType, TBrakeSystem..., TLocation, TTrackShape,
  neighbour_data), moved from mover.h as they were. mover.h includes it.
- DynObj.h and Driver.h include vehicletypes.h; TMoverParameters is forward
  declared (utilities/Classes.h). Their inline accessors that read the mover
  (NextConnected(), GetVelocity(), is_emu(), DirectionalVel()...) are defined
  in DynObj.cpp and Driver.cpp.
- the files that use the mover include physics/mover.h themselves.

Now 140 of the 730 objects of the build depend on mover.h and brakes.h,
about 80 of them unit tests.

No change in behaviour: 1142/1142 tests, golden traces exact against staging
62f7a29b.
2026-11-27 18:53:06 +01:00
Hirek 0ce190eab2 fix: the review of the renderers PR: physics switches off by default, crashes on exit and at start, renderer, shader and editor fixes 2026-11-27 09:15:11 +01:00
Hirek 7e26e79297 feat(render): the pbr materials of the metallic and roughness workflow (pbr, pbr_detail, pbr_parallax, pbr_coat) 2026-11-26 00:31:35 +01:00
Hirek e0f07fde71 fix(render): the Vulkan renderer doesn't hang on exit, draw a minimized window with a NaN projection or quit on a lost surface 2026-11-25 09:34:58 +01:00
Hirek 51c76da927 fix(render): the free camera blurs with its own movement in the OpenGL 4.6 and Vulkan renderers 2026-11-23 20:55:50 +01:00
pawelw 3710f87fc5 feat(gl46): street lamps of the scenery light their surroundings (#371)
* 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
2026-11-20 04:25:18 +01:00
Hirek 91c2d3aba9 Clouds and fog tweaks 2026-11-17 01:02:52 +01:00
Hirek b8815a2455 Optimise raytracing and buffer building 2026-11-16 22:19:17 +01:00
Hirek 053e4cacee Merge branch 'master' into feat/renderers-cleanup 2026-11-16 21:44:48 +01:00
Hirek ff2ff308ed Some optimalisations 2026-11-09 20:58:02 +01:00
Hirek 7667e5b2ec fix: the bugs and vulnerabilities SonarCloud reports on PR #216 2026-11-07 22:11:08 +01:00
Hirek 0bc29af650 Merge remote-tracking branch 'origin/feat/switch-fastenings' into feat/renderers-cleanup 2026-10-31 17:13:45 +01:00
Hirek 765153ad91 Merge remote-tracking branch 'origin/feat/switch-blades' into feat/renderers-cleanup 2026-10-29 23:55:04 +01:00
Hirek 96100f1155 Draw the cab probe with all the lights of the cab 2026-10-29 20:05:03 +01:00
Hirek 91c6324965 Add the optional LightOnly of FreeSpotLight 2026-10-28 21:50:08 +01:00
Hirek 8c6a47f42c Light the occupied cab with the light points of its model 2026-10-28 21:16:22 +01:00
Hirek 65e104f813 Light the occupied cab with the light points of its model 2026-10-28 21:06:02 +01:00
Hirek 9904eddd0d Light the cab with cablight/dashboardlight light points of the cab model 2026-10-28 20:55:45 +01:00
Hirek c4e23932bf Add the optional Radius, ShadeSelf, CastShadows and SoftFalloff of FreeSpotLight and make FalloffAngle 360 a point light 2026-10-28 16:18:03 +01:00
Hirek 413cebed9c Hold the sky back only around tunnels and keep the cab lit by day 2026-10-28 14:01:37 +01:00
Hirek e8a90507f0 Light the cab with the sun coming in through its windows 2026-10-28 12:19:43 +01:00
Hirek 1447dcf075 Walk the shadow passes and the culled model groups on worker threads in the Vulkan renderer 2026-10-27 20:56:11 +01:00
Hirek c44b243698 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 17:11:06 +01:00
Hirek 2961ce1445 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 16:08:35 +01:00
Hirek 2a876befb0 Shade the sky and the sun by the scenery around the camera instead of the track environment flags 2026-10-27 16:02:36 +01:00
Hirek 9dde5b0e5e Take the ambient occlusion into the lighting and add a probe of the cab 2026-10-27 13:23:52 +01:00
Hirek ac0b4e5f15 Add a white balance to the tonemapping 2026-10-27 01:40:19 +01:00
Hirek 550d47e97c Merge remote-tracking branch 'jano211/siec-radio' into feat/renderers-cleanup 2026-10-26 16:36:36 +01:00
Hirek 719c729929 Improve rain shader 2026-10-26 15:51:56 +01:00
Hirek a6bdeeaa2b Add DLSS Frame Generation (gfx.framegeneration x2/x3/x4) and Reflex (gfx.reflex) to the Vulkan renderer 2026-10-25 20:52:12 +01:00
Hirek 1841e6d7b0 Add NVIDIA DLSS to the Vulkan renderer (gfx.antialiasing dlss/dlaa) and gfx.buffer.percent 2026-10-25 19:35:33 +01:00
Hirek 08f4f6ed60 Vulkan ray tracing: include tracks and roads, build triangle strips and fans 2026-10-25 15:35:26 +01:00
Hirek f20b1a3071 Replace cubemap scenery reflections with SSR, add Vulkan ray traced reflections 2026-10-25 13:54:49 +01:00
Hirek 252b9373ea Add gfx.antialiasing (off, msaax2/x4/x8, taa) with temporal anti-aliasing in the GL 4.6 and Vulkan renderers 2026-10-25 05:17:41 +01:00
Hirek c48c58776a Vulkan: parity with GL (P1–P7), shared GPU culling records (N6c), threaded command recording and render thread (M1, M4) 2026-10-25 03:06:01 +01:00
Hirek 9b7d02e5fb Vulkan: scene rendering (D1–D7) on a scene walk shared with GL (N6a, N6b) 2026-10-24 20:10:24 +02:00
Hirek bd589f272d feat(vulkan): vulkan 1.4 core with the user interface and the launcher, shaders split into ogl46/vk14 with SPIR-V binaries loaded first 2026-10-24 05:47:11 +02:00