forked from Misaki/GhostEngine
Update rendering architecture and resource management
Added a new `Ref<T>` struct for reference semantics. Added the `RenderGraph` system for managing rendering passes. Added the `RenderTexture` class for encapsulating GPU resources. Added `GraphicsBuffer` class for effective GPU resource management. Changed `CommandList` methods from public to internal for visibility control. Changed `IRenderPass` interface from internal to public for accessibility. Changed `GetData<T>()` in `ComponentObject.cs` to return `CompRef<T>`. Changed `GetComponent<T>()` in `EntityManager.cs` to return `CompRef<T>`. Changed `GetSingleton<T>()` in `World.cs` to use `CompRef<T>`. Changed `IQueryTypeParameter` to use `CompRef<T>` for consistency. Changed `QueryItem<T0>` and related structs to use `CompRef<T>`. Changed `Material` class to support bindless textures. Changed `Shader` class to support bindless rendering. Changed `Mesh` class to support bindless vertex and index buffer access. Updated documentation to reflect the new bindless rendering architecture.
This commit is contained in:
@@ -192,18 +192,18 @@ public readonly struct EntityManager : IDisposable
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the component to retrieve.</typeparam>
|
||||
/// <param name="entity">The entity whose component is to be retrieved.</param>
|
||||
/// <returns>A <see cref="Ref{T}"/> to the component, or a null reference if the component does not exist.</returns>
|
||||
/// <returns>A <see cref="CompRef{T}"/> to the component, or a null reference if the component does not exist.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Ref<T> GetComponent<T>(Entity entity)
|
||||
public readonly CompRef<T> GetComponent<T>(Entity entity)
|
||||
where T : unmanaged, IComponentData
|
||||
{
|
||||
if (_world.ComponentStorage.TryGetPool<T>(out var pool) && pool.Has(entity))
|
||||
{
|
||||
return new Ref<T>(ref pool.GetRef(entity));
|
||||
return new CompRef<T>(ref pool.GetRef(entity));
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Ref<T>(ref Unsafe.NullRef<T>(), false);
|
||||
return new CompRef<T>(ref Unsafe.NullRef<T>(), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user