119 lines
4.3 KiB
C#
Raw Normal View History

2025-09-11 20:42:09 +08:00
//using System.Collections.Generic;
//using Unity.Collections;
//using UnityEngine;
//namespace X.Rendering.Feature
//{
// public class XRenderFeatureManager : MonoBehaviour
// {
// public static XRenderFeatureManager Instance
// {
// get; private set;
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// #region CapsuleAO
// public NativeArray<Character> CharacterArray;
// public NativeArray<Capsule> CapsuleArray;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// public Transform TestLightTrans;
// public Transform TestCharacterTrans;
// public float TestW;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// private Dictionary<Transform, CapsuleCollider[]> characterTransform2CapsuleCollider = new();
// private int capsuleColliderCount = 0;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// public void AddCapsuleAOCharacter(Transform transform)
// {
// var oldCapsuleArray = CapsuleArray;
// var oldCharacterArray = CharacterArray;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// var capsules = transform.GetComponentsInChildren<CapsuleCollider>(true);
// characterTransform2CapsuleCollider.Add(transform, capsules);
// capsuleColliderCount += capsules.Length;
// CapsuleArray = new (capsuleColliderCount, Allocator.Persistent);
// CharacterArray = new (characterTransform2CapsuleCollider.Count, Allocator.Persistent);
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// if (oldCharacterArray.IsCreated)
// {
// oldCharacterArray.Dispose();
// oldCapsuleArray.Dispose();
// }
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// public void RemoveCapsuleAOCharacter(Transform transform)
// {
// capsuleColliderCount -= characterTransform2CapsuleCollider[transform].Length;
// characterTransform2CapsuleCollider.Remove(transform);
// var oldCapsuleArray = CapsuleArray;
// var oldCharacterArray = CharacterArray;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// CapsuleArray = new(capsuleColliderCount, Allocator.Persistent);
// CharacterArray = new(characterTransform2CapsuleCollider.Count, Allocator.Persistent);
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// if (oldCharacterArray.IsCreated)
// {
// oldCharacterArray.Dispose();
// oldCapsuleArray.Dispose();
// }
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// #endregion
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// private void Awake()
// {
// Instance = this;
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// private void Start()
// {
// AddCapsuleAOCharacter(TestCharacterTrans);
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// private void Update()
// {
// Transform transform = null;
// int capsuleArrayIndex = 0;
// int characterArrayIndex = 0;
// int startID = 0;
// Instance = this;
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// foreach (var item in characterTransform2CapsuleCollider)
// {
// for (int i = 0; i < item.Value.Length; i++)
// {
// var capsule = item.Value[i];
// //capsule.direction
// var a = capsule.center - new Vector3(0, capsule.height / 2 - capsule.radius, 0);
// var b = capsule.center + new Vector3(0, capsule.height / 2 - capsule.radius, 0);
// //var a = capsule.center - new Vector3(0, capsule.height / 2, 0);
// //var b = capsule.center + new Vector3(0, capsule.height / 2, 0);
// a = capsule.transform.TransformPoint(a);
// b = capsule.transform.TransformPoint(b);
// CapsuleArray[capsuleArrayIndex++] = new()
// {
// a = a,
// b = b,
// radius = capsule.radius,
// };
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// if (transform != item.Key)
// {
// transform = item.Key;
// CharacterArray[characterArrayIndex++] = new()
// {
// position = transform.position,
// radius = transform.lossyScale.x,
// lightDir = -new Vector4(TestLightTrans.position.x, TestLightTrans.position.y, TestLightTrans.position.z, -TestW),
// startID = startID,
// endID = capsuleArrayIndex,
// };
// startID = capsuleArrayIndex;
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// }
// }
2025-07-22 20:36:15 +08:00
2025-09-11 20:42:09 +08:00
// }
//}