11using Basis . Scripts . Common ;
22using Basis . Scripts . Drivers ;
3- using System ;
43using System . Collections . Generic ;
54using Unity . Burst ;
65using Unity . Collections ;
@@ -250,15 +249,13 @@ struct GatherHipsJob : IJobParallelForTransform
250249 [ WriteOnly ] public NativeArray < float3 > hipsPos ;
251250 /// <summary>Output hips rotations.</summary>
252251 [ WriteOnly ] public NativeArray < quaternion > hipsRot ;
253-
254252 /// <summary>Executes per-hip sampling.</summary>
255253 public void Execute ( int index , TransformAccess tx )
256254 {
257255 hipsPos [ index ] = tx . position ;
258256 hipsRot [ index ] = tx . rotation ;
259257 }
260258}
261-
262259/// <summary>
263260/// Applies the mouth transform directly from the computed <see cref="RemoteFrameOutput"/>.
264261/// </summary>
@@ -268,14 +265,12 @@ struct ApplyMouthJob : IJobParallelForTransform
268265 /// <summary>Read-only pose data to apply.</summary>
269266 [ ReadOnly ]
270267 public NativeArray < RemoteFrameOutput > MouthRotation ;
271-
272268 /// <summary>Applies position and rotation to the bound mouth transform.</summary>
273269 public void Execute ( int index , TransformAccess tx )
274270 {
275271 tx . SetPositionAndRotation ( MouthRotation [ index ] . pos_Mouth , MouthRotation [ index ] . rot_Mouth ) ;
276272 }
277273}
278-
279274/// <summary>
280275/// Positions the floating nameplate relative to the avatar and rotates it to face the camera (yaw only).
281276/// Uses derived TPose vertical delta to place the plate above the head.
@@ -285,10 +280,8 @@ public struct MappedNameplateApplyJob : IJobParallelForTransform
285280{
286281 /// <summary>Camera world position used to bill-board the plate (yaw-only).</summary>
287282 public float3 CameraPosition ;
288-
289283 /// <summary>Input pose data (per-avatar) for nameplate placement.</summary>
290284 [ ReadOnly ] public NativeArray < RemoteFrameOutput > NamePlateIn ;
291-
292285 /// <summary>Computes position above hips and rotates toward camera.</summary>
293286 public void Execute ( int jobIndex , TransformAccess tx )
294287 {
@@ -331,11 +324,9 @@ struct AgrigateTranslationalData : IJobParallelFor
331324 [ ReadOnly ] public NativeArray < quaternion > tposeHeadRot ;
332325 /// <summary>TPose hips quaternions.</summary>
333326 [ ReadOnly ] public NativeArray < quaternion > tposeHipsRot ;
334-
335327 /// <summary>Combined output to be consumed by <see cref="BasisRemoteBoneJob"/>.</summary>
336328 [ WriteOnly ]
337329 public NativeArray < GeneratedTranslationalData > InOut ;
338-
339330 /// <summary>Aggregates inputs into a single SoA element.</summary>
340331 public void Execute ( int i )
341332 {
@@ -359,7 +350,6 @@ public void Execute(int i)
359350/// </summary>
360351public static class RemoteBoneJobSystem
361352{
362- // Persistent SoA
363353 /// <summary>Authoring TPose/offsets per avatar.</summary>
364354 static NativeList < TposeAndOffsetDataJob > sAuthoring ;
365355 /// <summary>Per-frame inputs per avatar.</summary>
@@ -368,37 +358,28 @@ public static class RemoteBoneJobSystem
368358 static NativeList < RemoteScaleCache > sScale ;
369359 /// <summary>Per-frame pose outputs per avatar.</summary>
370360 static NativeList < RemoteFrameOutput > sOut ;
371-
372- // Cached TPose quats (job friendly)
373361 /// <summary>TPose head quaternions per avatar.</summary>
374362 static NativeList < quaternion > sTPoseHeadRot ;
375363 /// <summary>TPose hips quaternions per avatar.</summary>
376364 static NativeList < quaternion > sTPoseHipsRot ;
377-
378- // Transform access arrays (roots / heads / hips)
379365 /// <summary>Root transforms per avatar.</summary>
380366 static TransformAccessArray sRoots ;
381367 /// <summary>Head transforms per avatar.</summary>
382368 static TransformAccessArray sHeads ;
383369 /// <summary>Hips transforms per avatar.</summary>
384370 static TransformAccessArray sHips ;
385-
386371 /// <summary>Nameplate transforms per avatar.</summary>
387372 static TransformAccessArray sNamePlate ;
388373 /// <summary>Avatar scale proxy transforms per avatar.</summary>
389374 static TransformAccessArray sAvatarScale ;
390375 /// <summary>Mouth transforms per avatar.</summary>
391376 static TransformAccessArray sMouth ;
392-
393- // Temp per-frame buffers (reused)
394377 /// <summary>Temp root positions.</summary>
395378 static NativeArray < float3 > sTmpRootPos , sTmpHeadPos , sTmpHipsPos ;
396379 /// <summary>Temp root scales.</summary>
397380 static NativeArray < float3 > sTmpRootScale ;
398381 /// <summary>Temp head rotations.</summary>
399382 static NativeArray < quaternion > sTmpHeadRot , sTmpHipsRot ;
400-
401- // Bookkeeping
402383 /// <summary>Map from external key → internal SoA index.</summary>
403384 static readonly Dictionary < int , int > sKeyToIndex = new Dictionary < int , int > ( ) ;
404385 /// <summary>Pending job handle chain.</summary>
@@ -413,7 +394,10 @@ public static class RemoteBoneJobSystem
413394 /// <param name="initialCapacity">Optional starting capacity hint.</param>
414395 public static void Initialize ( int initialCapacity = 0 )
415396 {
416- if ( sInitialized ) return ;
397+ if ( sInitialized )
398+ {
399+ return ;
400+ }
417401
418402 sAuthoring = new NativeList < TposeAndOffsetDataJob > ( initialCapacity , Allocator . Persistent ) ;
419403 sIn = new NativeList < GeneratedTranslationalData > ( initialCapacity , Allocator . Persistent ) ;
@@ -492,7 +476,11 @@ public static int AddRemotePlayer(int key, Transform remotePlayerRoot, Transform
492476 BasisCalibratedCoords tposeHead , BasisCalibratedCoords tposeHips , float3 authoredCenterEyeWorld ,
493477 float3 authoredMouthWorld , Transform NamePlate , Transform AvatarScale , Transform MouthTransform )
494478 {
495- if ( ! sInitialized ) Initialize ( ) ;
479+ if ( ! sInitialized )
480+ {
481+ Initialize ( ) ;
482+ }
483+
496484 CompletePending ( ) ;
497485
498486 float3 rootWorld = remotePlayerRoot . position ;
@@ -562,10 +550,17 @@ public static int AddRemotePlayer(int key, Transform remotePlayerRoot, Transform
562550 /// <returns><c>true</c> if found and removed; otherwise <c>false</c>.</returns>
563551 public static bool RemoveRemotePlayer ( int key )
564552 {
565- if ( ! sInitialized ) return false ;
553+ if ( ! sInitialized )
554+ {
555+ return false ;
556+ }
557+
566558 CompletePending ( ) ;
567559
568- if ( ! sKeyToIndex . TryGetValue ( key , out int idx ) ) return false ;
560+ if ( ! sKeyToIndex . TryGetValue ( key , out int idx ) )
561+ {
562+ return false ;
563+ }
569564
570565 int last = sAuthoring . Length - 1 ;
571566 if ( idx != last )
@@ -766,7 +761,10 @@ public static JobHandle Schedule(int batchSize = 64)
766761 public static void Complete ( JobHandle handle )
767762 {
768763 handle . Complete ( ) ;
769- if ( ! sInitialized ) return ;
764+ if ( ! sInitialized )
765+ {
766+ return ;
767+ }
770768
771769 CompletePending ( ) ;
772770 }
0 commit comments