Refactor: extract shared helpers across scripts, trim remaining doc redundancy

Deduplication pass (44 extractions):
- New SmoothedLook: shared smoothed yaw/pitch look tick + view seeding
  (FirstPersonController, FreeCamController)
- New CharacterTeleport: disable-CC-around-teleport idiom (rescue,
  owner position apply, free-cam sync)
- New GeometryUtil: RescaleToUnitScale + TransformBounds (concealment
  meter/volume, skinned collider baker)
- Paint family: canonical map read/write shared between Net and
  Persistence, snapshot decode, backend stroke dispatch, RebuildBackend,
  ResolveSeed, chunked RPC send/gate/copy, CamoKnobs/HeightKnobs
  aggregates, SanitizeFileKey, NewMaskTexture, AdoptAlbedo, FindSlider
- Player/modes: GameMode SetPlayerControl/SetPainting/SetOrbitInputEnabled,
  InputUtil.GameplayKeyPressed, NearestClimbHit, ComputeXRay delegates to
  ComputeResolutionFreeze, FingerIK TryInPlaneAngle
- Match/misc: UnhookSessionCallbacks, SendEmptyNamedMessage, SwapScenes,
  RunSessionOpAsync, CovarianceEigen, CollectClusterPoints, MatchHud
  GUIStyle cache, HsvColorPicker rehook, VoxelCenter

Documentation pass: remove 6 triplicated doc blocks and 2 restating
inline comments left after the previous reduction.

Behavior-neutral; hot-path rasterizer loops intentionally untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-02 12:33:48 +02:00
1 parent 066e308cde
commit 2243cc823e
40 files changed
+681 -724

No files matched your search

+9 -22
View File
@@ -60,16 +60,9 @@ public class ConcealmentVolume : MonoBehaviour
{
Vector3 mn = origin;
Vector3 mx = origin + new Vector3(nx * voxelSize, ny * voxelSize, nz * voxelSize);
Matrix4x4 m = transform.localToWorldMatrix;
Bounds b = new Bounds(m.MultiplyPoint3x4(mn), Vector3.zero);
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mx.x, mn.y, mn.z)));
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mn.x, mx.y, mn.z)));
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mn.x, mn.y, mx.z)));
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mx.x, mx.y, mn.z)));
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mx.x, mn.y, mx.z)));
b.Encapsulate(m.MultiplyPoint3x4(new Vector3(mn.x, mx.y, mx.z)));
b.Encapsulate(m.MultiplyPoint3x4(mx));
return b;
var local = new Bounds();
local.SetMinMax(mn, mx);
return GeometryUtil.TransformBounds(transform.localToWorldMatrix, local);
}
}
@@ -184,13 +177,7 @@ public class ConcealmentVolume : MonoBehaviour
bool enclosed = useFlood && !outside[idx];
bool solid = false;
if (useWinding)
{
Vector3 cWorldLocal = new Vector3(
origin.x + (ix + 0.5f) * vs,
origin.y + (iy + 0.5f) * vs,
origin.z + (iz + 0.5f) * vs);
solid = WindingNumber(cWorldLocal, verts, tris) > 0.5;
}
solid = WindingNumber(VoxelCenter(origin, ix, iy, iz, vs), verts, tris) > 0.5;
bool inside = enclosed || solid;
if (!inside) continue;
bits[idx >> 5] |= 1u << (idx & 31);
@@ -253,6 +240,10 @@ public class ConcealmentVolume : MonoBehaviour
return sum / (4.0 * System.Math.PI);
}
/// <summary>Local-space center of grid voxel (ix, iy, iz).</summary>
private static Vector3 VoxelCenter(Vector3 origin, int ix, int iy, int iz, float size)
=> new Vector3(origin.x + (ix + 0.5f) * size, origin.y + (iy + 0.5f) * size, origin.z + (iz + 0.5f) * size);
private void OnDrawGizmosSelected()
{
if (!drawBakedGizmos || !HasBake) return;
@@ -265,11 +256,7 @@ public class ConcealmentVolume : MonoBehaviour
{
int idx = ix + nx * (iy + ny * iz);
if ((bits[idx >> 5] & (1u << (idx & 31))) == 0) continue;
Vector3 c = new Vector3(
origin.x + (ix + 0.5f) * voxelSize,
origin.y + (iy + 0.5f) * voxelSize,
origin.z + (iz + 0.5f) * voxelSize);
Gizmos.DrawCube(c, cube);
Gizmos.DrawCube(VoxelCenter(origin, ix, iy, iz, voxelSize), cube);
}
}
#endif