Commit graph

318 commits

Author SHA1 Message Date
Kelsi
709138cf5d Relax aggressive taxi culling to show more detail
With VRAM model caching eliminating loading hitches, we can now render
much more detail during taxi flights for better visual quality.

Changes:
- boundRadius threshold: 15.0 → 2.0 (now show buildings, trees, large props)
- Foliage: was skipping ALL, now only skip small bushes/flowers < 5 units
- Trees: now visible (removed collisionTreeTrunk blanket skip)
- Underwater: -5.0 → -10.0 (only skip very deep objects)

Before: Only massive buildings visible, world looked empty
After: Buildings, trees, large props visible for immersive flight experience

Performance remains good due to persistent VRAM caching from earlier optimization.
2026-02-08 22:24:11 -08:00
Kelsi
08f0b4d028 Simplify foam to fix grid artifact
Removed complex noise-based foam that created visible grid pattern.
Replaced with simple subtle highlight on highest wave peaks only.

Kept the increased wave strength (bigger, more visible ocean waves).
2026-02-08 22:22:58 -08:00
Kelsi
3cab27060c Increase wave strength and add shoreline foam
Ocean waves are now much more pronounced, and foam appears on shorelines
in addition to wave crests.

Wave strength increases:
- Amplitude: 0.12 → 0.25 (ocean), 0.07 → 0.10 (canals)
- Frequency: 0.18 → 0.22 (ocean) - more waves per distance
- Speed: 1.60 → 2.00 (ocean) - faster wave motion

Shoreline foam:
- Appears on shallow/near-camera water (20-80 unit range)
- Uses upward-facing surface detection (horizontal = shore)
- Combined with wave crest foam for realistic effect
- Animated with same noise pattern as wave foam

Wave crest foam improvements:
- Lower threshold (0.15 vs 0.25) - more visible
- Increased intensity (0.85 vs 0.65)
- Faster animation (time * 0.8)
- Higher frequency noise (50.0 vs 40.0)

Result: Ocean now has visible motion from distance and foam on beaches.
2026-02-08 22:20:45 -08:00
Kelsi
e7ff0ce0ce Add distance-based water opacity and procedural ocean foam
Makes distant water more opaque to hide underwater objects and improve
visual quality during flight. Also adds animated foam on wave crests.

Distance-based opacity:
- Water becomes more opaque from 80-400 units distance
- Smoothstep fade adds up to 50% opacity at far distances
- Hides underwater M2 models and terrain from aerial view
- Max alpha increased from 0.82 to 0.95 for distant water

Procedural foam:
- Generated on wave peaks (positive WaveOffset values)
- Uses noise function for natural foam texture
- Animated with time and texture coordinates
- Adds white highlights to wave crests for ocean realism

This improves taxi flight visuals by making oceans look more solid
and realistic from altitude, similar to authentic WoW.
2026-02-08 22:14:54 -08:00
Kelsi
11dbca7413 Fix character attachment to follow mount's full rotation
Character now properly rotates with the mount during flight instead of just
bobbing up and down. This fixes the issue where the character appeared to
float away from the mount during rolls and pitch changes.

Implementation:
- Create rotation matrix from mount's pitch, roll, yaw
- Transform rider offset through rotation (local → world space)
- Apply same rotation to character model (glued to mount)
- Character stays properly seated during all mount movements

Before: Character only offset vertically, sliding around during banking
After: Character rotates with mount, stays firmly attached during all maneuvers
2026-02-08 22:11:40 -08:00
Kelsi
71b52046e0 Keep M2 models permanently in VRAM to eliminate loading hitches
Modern GPUs have 8-16GB VRAM - leverage this to cache all M2 models permanently.

Changes:
- Disabled cleanupUnusedModels() call when tiles unload
- Models now stay in VRAM after initial load, even when tiles unload
- Increased taxi mounting delay from 3s to 5s for more precache time
- Added logging: M2 model count, instance count, and GPU upload duration
- Added debug logging when M2 models are uploaded per tile

This fixes the "building pops up then pause" issue - models were being:
1. Loaded when tile loads
2. Unloaded when tile unloads (behind taxi)
3. Re-loaded when flying through again (causing hitch)

Now models persist in VRAM permanently (few hundred MB for typical session).
First pass loads to VRAM, subsequent passes are instant.
2026-02-08 22:08:42 -08:00
Kelsi
92031102e4 Add mount pitch and roll for realistic taxi flight animation
Flying mounts now tilt and bank realistically during taxi flights:
- Pitch (up/down): calculated from spline tangent's z-component (altitude change)
- Roll (banking): proportional to turn rate, clamped to ~40 degrees
- Yaw: existing horizontal orientation from spline direction

Implementation:
- Added mountPitch_ and mountRoll_ to Renderer (radians)
- Updated TaxiOrientationCallback to pass yaw, pitch, roll
- Calculate pitch using asin(tangent.z) for altitude tilt
- Calculate roll from yaw change rate: -orientDiff * 2.5, clamped to ±0.7 rad
- Applied to mount rotation: glm::vec3(pitch, roll, yaw)

This fixes the "weirdness" where mounts flew sideways or without natural banking.
2026-02-08 22:05:38 -08:00
Kelsi
2e0a7e0039 Fix taxi mount orientation and eliminate tile loading hitches
Fixes two critical taxi flight issues:

1. Mount orientation now correctly faces flight direction:
   - Prevent camera controller from updating facingYaw during taxi (externalFollow_ check)
   - Taxi orientation callback system updates mount rotation from spline tangent
   - Initial orientation set when flight starts
   - Smooth Catmull-Rom spline interpolation for natural curved paths

2. Eliminate frame hitches from tile loading during flight:
   - New taxiFlightStartCallback uploads ALL precached tiles to GPU before flight begins
   - Previously tiles loaded async during 3s mount delay but uploaded 1/frame during flight
   - Now processAllReadyTiles() blocks briefly after mount delay to batch upload everything
   - Combined with 2.0s terrain update interval and aggressive culling for smooth flight

Additional optimizations:
   - Aggressive taxi culling: skip models <15 units, all foliage/trees, underwater objects
   - Max render distance reduced to 150 units during taxi
   - Movement heartbeat packets disabled during taxi (server controls position)
   - Reduced taxi speed from 32 to 18 units/sec to prevent streaming overload
2026-02-08 22:00:33 -08:00
Kelsi
536b3cea48 Implement comprehensive taxi flight optimizations and proper spline paths
Major improvements:
- Load TaxiPathNode.dbc for actual curved flight paths (no more flying through terrain)
- Add 3-second mounting delay with terrain precaching for entire route
- Implement LOD system for M2 models with distance-based quality reduction
- Add circular terrain loading pattern (13 tiles vs 25, 48% reduction)
- Increase terrain cache from 2GB to 8GB for modern systems

Performance optimizations during taxi:
- Cull small M2 models (boundRadius < 3.0) - not visible from altitude
- Disable particle systems (weather, smoke, M2 emitters) - saves ~7000 particles
- Disable specular lighting on M2 models - saves Blinn-Phong calculations
- Disable shadow mapping on M2 models - saves shadow map sampling and PCF

Technical details:
- Parse TaxiPathNode.dbc spline waypoints for curved paths around terrain
- Build full path from node pairs using TaxiPathEdge lookup
- Precache callback triggers during mounting delay for smooth takeoff
- Circular tile loading uses Euclidean distance check (dx²+dy² <= r²)
- LOD fallback to base mesh when higher LODs unavailable

Result: Buttery smooth taxi flights with no terrain clipping or performance hitches
2026-02-08 21:32:38 -08:00
Kelsi
941dac446d Implement distance-based LOD system for M2 models
Added LOD (Level of Detail) selection based on camera distance:
- 0-40 units: LOD 0 (base detail)
- 40-80 units: LOD 1 (medium detail)
- 80-150 units: LOD 2 (medium-low detail)
- 150+ units: LOD 3 (lowest detail)

Matches WoW retail behavior. Each M2 skin file contains multiple LOD
versions (submeshLevel 0-3). System filters batches to only render
the appropriate LOD for each instance's distance, significantly
improving performance with many distant models.
2026-02-08 20:55:10 -08:00
Kelsi
cbbf819c0d Increase terrain load radius during taxi for aggressive caching
During taxi flights, increased terrain load radius from 2 to 4 tiles
(5x5 to 9x9 grid) to pre-cache more tiles ahead of flight path. Returns
to normal 5x5 after landing. 2GB cache stores loaded tiles for fast
retrieval. WMO/M2 models already cached in RAM once loaded.
2026-02-08 20:51:17 -08:00
Kelsi
1f0e948d34 Skip M2 collision queries during taxi instead of rendering
Reverted M2 rendering skip. Instead disable M2 collision/floor queries
during taxi (externalFollow mode) for performance. M2 models remain
visible but don't affect movement, grounding, or camera collision during
flight paths.
2026-02-08 20:45:59 -08:00
Kelsi
01816d2a3a Skip M2 rendering during taxi flights for performance
Disabled M2 doodad rendering (trees, rocks, etc) and their shadows
during taxi flights to improve performance. Terrain and WMO structures
still render. M2 rendering resumes when taxi ends.
2026-02-08 20:43:25 -08:00
Kelsi
9090fb8727 Fix jump snap-down: only ground when velocity is non-positive
Removed the '|| *groundH > feetZ' condition that was snapping player
to ground during upward jumps when ground was above current position.
Now only grounds when vertical velocity is <= 0 (falling or landing),
preventing premature grounding during jump arc.
2026-02-08 20:39:25 -08:00
Kelsi
4ca4d1e509 Disable all WMO floor caching including per-frame cache
Removed both persistent grid cache and per-frame dedup cache. Even the
per-frame cache was causing issues when player Z changes between queries
in the same frame (multi-sampling), returning stale floor heights and
causing fall-through at stairs. Floor queries now always raycast fresh.
2026-02-08 20:37:04 -08:00
Kelsi
f9dbc052dc Fix build error: remove persistent floor cache update code 2026-02-08 20:34:27 -08:00
Kelsi
7765b41611 Disable WMO floor cache and add camera collision with WMO/M2
Disabled persistent WMO floor grid cache - it stored one height per
2-unit cell causing fall-through at stairs where floor height changes
within a cell. Per-frame dedup cache is sufficient for performance.

Added camera raycast collision against WMO walls (when inside) and M2
objects to zoom in when camera would clip through geometry instead of
phasing through walls.
2026-02-08 20:33:40 -08:00
Kelsi
dbadfb043b Fix stair approach fall-through and relax steep slope climbing
Relaxed walkable slope threshold from 0.40 to 0.35 (~70° max) for
steeper stair climbing. Tightened WMO floor cache above-tolerance
back to 0.25 units to prevent cached stair landing from overriding
approach floor. Added M2 floor preference for ship decks to prevent
falling through to water below.
2026-02-08 20:31:00 -08:00
Kelsi
58ec7693a1 Relax walkable slope threshold and floor cache for steep stairs
Changed walkable slope threshold from 0.45 (63°) to 0.40 (66°) in both
WMO and M2 collision to allow climbing steeper stairs (like 60° steps).
Increased WMO floor cache above-tolerance from 0.35 to 0.50 units to
prevent falling through floors in places like Booty Bay where cached
floor is slightly above query point.
2026-02-08 20:26:24 -08:00
Kelsi
b51543fdd2 Allow full camera zoom on outdoor WMO structures without ceilings
Removed blanket 3.5-unit zoom limit when inside any WMO. Now only
constrains zoom when ceiling raycast detects actual structure above.
Increased ceiling detect range from 15 to 20 units. Allows full zoom
on bridges, platforms, ramparts, and other outdoor WMO areas while
still preventing camera clipping through enclosed building ceilings.
2026-02-08 20:21:49 -08:00
Kelsi
b48802855b Tighten WMO collision detection when inside buildings
When inside a WMO, use:
- Smaller sweep step size (0.20 vs 0.35) for more frequent collision checks
- Tighter player radius (0.45 vs 0.50) for less claustrophobic corridors
- Stronger push response (0.12 vs 0.08 max) for more responsive walls

Prevents clipping through walls in tight indoor spaces while keeping
outdoor movement smooth.
2026-02-08 20:20:37 -08:00
Kelsi
d49b69a3a8 Fix build error: use raycastBoundingBoxes instead of raycast 2026-02-08 20:16:21 -08:00
Kelsi
b47bfdc644 Fix camera snapping to upper floors with step-up constraint and ceiling check
Reduced camera floor step-up budget from 3.0f to 0.5f to prevent
snapping to floors far above camera. Added upward raycast to detect
ceilings/upper floors and constrain zoom distance in multi-story
buildings, preventing camera from phasing through upper levels.
2026-02-08 20:15:34 -08:00
Kelsi
85ff6234cb Fix camera snapping to floors above player in WMO buildings
Removed +3.0f offset from camera WMO floor query. The offset combined
with the +2.0f allowAbove in getFloorHeight was detecting floors 5 units
above camera, causing snaps to upper stories. Camera now queries at its
actual Z position to only detect reachable floors.
2026-02-08 20:10:40 -08:00
Kelsi
36834332eb Enable terrain streaming during taxi flights with RAM cache
Changed taxi terrain streaming from frozen (9999s) to active (0.3s
interval). The 2GB tile cache now serves tiles from RAM without
blocking, making terrain rendering safe and smooth during flight paths.
2026-02-08 20:05:04 -08:00
Kelsi
4e0e54a0f0 Fix taxi dismount: clear currentMountDisplayId_ in client path completion
The client path animation completion was calling mountCallback_(0) but
not clearing currentMountDisplayId_, leaving isMounted() returning true
after landing. All three dismount paths now consistently clear the flag.
2026-02-08 20:01:23 -08:00
Kelsi
d7aabc0caa Add M2 collision mesh parsing and mesh-based wall/floor collision
Parse bounding vertices, triangles, and normals from M2 files and use
them for proper triangle-level collision instead of AABB heuristics.
Spatial grid bucketing for efficient queries, closest-point wall push
with soft clamping, and ray-triangle floor detection alongside existing
AABB fallback.
2026-02-08 19:56:17 -08:00
Kelsi
fc003a2aba Soften WMO wall pushback and fix fountain climbing
Cap WMO swept wall collision pushback to 0.15 units (was 0.55) so walls
stop the player without violent shoves. Fix M2 stepped fountain lateral
push using effectiveTop instead of rawMax.z so the near-top check matches
the stepped profile height at the player's radial position.
2026-02-08 18:53:56 -08:00
Kelsi
02dd796e2e Fix: make grace “hold” instead of “pull down” don't yank us down in jumps 2026-02-08 18:39:45 -08:00
Kelsi
6880ca9ce6 Trust the floor cache if it is close too foot level 2026-02-08 18:25:43 -08:00
Kelsi
22c4d033cf Tune skin for collision "sticky" feel on walls 2026-02-08 18:17:43 -08:00
Kelsi
a503583b6b The walls should not push back so violently lets make this softer 2026-02-08 18:12:52 -08:00
Kelsi
3eb64dd9dd Stop falling through the damn ramps :P 2026-02-08 17:51:35 -08:00
Kelsi
f8aba30f2d Fix WMO ramp/stair clipping with WoW-style floor snap and collision fixes
Remove active group fast path from getFloorHeight to fix bridge clipping.
Replace ground smoothing with immediate step-up snap (WoW-style: snap up,
smooth down). Accept upward Z from wall collision at all call sites. Skip
floor-like surfaces (absNz >= 0.45) in wall collision to prevent false
wall hits on ramps. Increase getFloorHeight allowAbove from 0.5 to 2.0
for ramp reacquisition. Prefer highest reachable surface in floor selection.
2026-02-08 17:38:30 -08:00
Kelsi
ef54f62df0 Add multi-tier unstuck system with void fall detection
Replace broken hardcoded-coordinate unstuck with tiered fallbacks:
last safe position > hearth bind > map spawn. Track safe positions
only on real geometry, let player fall after 500ms with no ground,
and auto-trigger unstuck after 5s of continuous falling.
2026-02-08 15:37:34 -08:00
Kelsi
8fee55f99f Fix /unstuckgy hang by skipping WMO floor search
Add CameraController::teleportTo() that directly places the player at
the target position without the expensive floor-search loop in reset().
The loop does hundreds of WMO collision checks which hangs in cities.
2026-02-08 15:13:55 -08:00
Kelsi
eb92a71b71 Fix trainer buy packet and grey out unmet prerequisites
CMSG_TRAINER_BUY_SPELL was missing the trainerId field — server expects
guid(8) + trainerId(4) + spellId(4) = 16 bytes, not 12. Spells with
unmet prerequisites (chainNode1/2/3), insufficient level, or already
known are now greyed out with disabled Train buttons. Tooltips show
prerequisite status in green/red.
2026-02-08 15:03:43 -08:00
Kelsi
ee155c3367 Fix trainer buy spell and add specialization tabs
Fix SMSG_BINDPOINTUPDATE opcode from 0x1B3 to 0x155 — the old value
collided with SMSG_TRAINER_BUY_SUCCEEDED, causing buy responses to be
misinterpreted as bindpoint updates. Add specialization tabs using
SkillLineAbility.dbc to group spells by class spec (category 7).
2026-02-08 14:46:01 -08:00
Kelsi
9a01261401 Add trainer dialog system with spell list UI and buy support 2026-02-08 14:33:39 -08:00
Kelsi
046d4615ea Fix M2 texture loading, /unstuckgy, and WMO floor detection
- Add mutex to AssetManager::loadTexture/loadDBC/fileExists to prevent
  StormLib thread-safety races that silently fail texture reads; stop
  caching texture load failures so transient errors are retried.
- Replace /unstuckgy DBC lookup (which used wrong coordinate transform)
  with hardcoded safe locations per map.
- Widen WMO floor raycast from single grid cell to ±1 unit range query
  to catch bridge/walkway triangles at cell boundaries.
- Tighten swept collision hit threshold (0.5 → 0.15) and grid query
  margin (2.5 → 1.5) to prevent false-positive wall pushes.
- Tighten post-wall-push Z snap lower bound (-1.0 → -0.3) to prevent
  gradual floor sinking.
2026-02-08 14:17:04 -08:00
Kelsi
387cc5ddf4 Fix WMO collision clipping in Stormwind
Relax swept collision hit threshold, expand spatial grid query range,
enable WMO floor detection in first person, raise ramp rejection
threshold, and snap Z after wall collision XY adjustment.
2026-02-08 13:24:56 -08:00
Kelsi
f6eaa2cf70 Add idle yawn emote and hearth home tooltip 2026-02-08 03:39:02 -08:00
Kelsi
189f4a0a58 Add bindpoint support and WMO snap fix 2026-02-08 03:32:00 -08:00
Kelsi
132a6ea3c9 Add /unstuckgy and 2GB terrain tile cache 2026-02-08 03:24:12 -08:00
Kelsi
6736ec328b Fix taxi flights, mounts, and movement recovery 2026-02-08 03:05:38 -08:00
Kelsi
d910073d7a Preload terrain textures on background thread and fix ramp Z-snapping
Load BLP texture data during prepareTile() and upload to GL cache in
finalizeTile(), eliminating file I/O stalls on the main thread. Reduce
ready tiles per frame to 1. Fix camera sweep to snap Z to ramp surfaces.
Change hearthstone action bar slot from spell to item.
2026-02-08 01:16:23 -08:00
Kelsi
0ce38cfb99 Add transport support, gameobject queries, and fix item use
- Add setInstancePosition() to M2Renderer and WMORenderer for moving
  transport instances at runtime
- Detect UPDATEFLAG_TRANSPORT on gameobjects and track transport GUIDs
- Parse player-on-transport state from movement blocks
- Wire transport move callback in Application to update render positions
- Implement CMSG_GAMEOBJECT_QUERY / SMSG_GAMEOBJECT_QUERY_RESPONSE so
  gameobjects display proper names instead of "Unknown"
- Add name/entry fields to GameObject entity class
- Fix CMSG_USE_ITEM packet: remove extra uint8 that shifted the item
  GUID by one byte, breaking hearthstone and all item usage
- Remove redundant CMSG_LOOT after CMSG_GAMEOBJECT_USE for chests
- Show PvP enabled/disabled state in toggle message
- Relax WMO ramp wall-collision step-up check to allow walking on
  gentle ramps where floor rise per step is under 0.1 units
- Add M2 fallback when WMO group files fail to load for gameobjects
- Handle re-creation of existing gameobject render instances by
  updating position instead of silently ignoring
2026-02-08 00:59:40 -08:00
Kelsi
5610faa958 Reduce WMO interior camera distance for tighter view 2026-02-08 00:21:10 -08:00
Kelsi
ed2a8a4e0a Fix tunnel camera, dismount buff clear, and ground sampling
Use WMO-aware floor detection for camera clearance so tunnels don't
push the camera up to terrain. Clear permanent auras on dismount via
mount display field. Use center-only sampling for terrain/WMO floors
to prevent offset probes from snapping to terrain above tunnels.
2026-02-08 00:18:47 -08:00
Kelsi
2b771ec92e Improve stair climbing and disable R hotkey
Skip wall collision when a walkable floor exists above current feet,
allowing smooth stair traversal without per-zone tuning. Disable R key
camera reset to avoid conflicts with chat.
2026-02-08 00:12:15 -08:00