Added frustum culling;
Added geometry data; Changed name of VolumeObject to AoVolume; Removed the capsule type in VolumeType, all volumes are box volume now;
This commit is contained in:
40
Runtime/Models/AoVolume.cs
Normal file
40
Runtime/Models/AoVolume.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Misaki.AoVolume
|
||||
{
|
||||
internal class AoVolume : MonoBehaviour
|
||||
{
|
||||
private VolumeEntity _entity = VolumeEntity.InvalidEntity;
|
||||
|
||||
public VolumeData data;
|
||||
|
||||
protected virtual void InitializeEntity()
|
||||
{
|
||||
if (_entity.IsValid)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_entity = VolumeDatabase.Instance.CreateEntity(this);
|
||||
}
|
||||
|
||||
protected virtual void OnEnable()
|
||||
{
|
||||
InitializeEntity();
|
||||
}
|
||||
|
||||
protected virtual void OnDisable()
|
||||
{
|
||||
if (_entity.IsValid)
|
||||
{
|
||||
VolumeDatabase.Instance.DestroyEntity(_entity);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
{
|
||||
data.worldMatrix = transform.localToWorldMatrix;
|
||||
data.inverseWorldMatrix = data.worldMatrix.inverse;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user