Skip to content

Commit

Permalink
* improved rendering debugger for better profiling
Browse files Browse the repository at this point in the history
  • Loading branch information
BeauPrime committed Jul 8, 2024
1 parent d9077a5 commit f46da11
Show file tree
Hide file tree
Showing 3 changed files with 267 additions and 41 deletions.
32 changes: 32 additions & 0 deletions Assets/FieldDay/Components/ComponentMgr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,22 @@ public ComponentIterator<IComponentData> ComponentsOfType(Type componentType)
return default;
}

/// <summary>
/// Enumerates all the components of the given type.
/// </summary>
public int ComponentsOfType(Type componentType, ICollection<IComponentData> componentOutput)
{
int index = ComponentIndex.Get(componentType);
List<IComponentData> components = m_ComponentLists[index];
if (components != null) {
foreach(var c in components) {
componentOutput.Add(c);
}
return components.Count;
}
return 0;
}

/// <summary>
/// Enumerates all the components of the given type.
/// </summary>
Expand All @@ -205,6 +221,22 @@ public ComponentIterator<T> ComponentsOfType<T>() where T : class, IComponentDat
return default;
}

/// <summary>
/// Enumerates all the components of the given type.
/// </summary>
public int ComponentsOfType<T>(ICollection<T> componentOutput) where T : class, IComponentData
{
int index = ComponentIndex.Get<T>();
List<IComponentData> components = m_ComponentLists[index];
if (components != null) {
foreach(var c in components) {
componentOutput.Add((T) c);
}
return components.Count;
}
return 0;
}

/// <summary>
/// Returns the first component of the given type.
/// </summary>
Expand Down
16 changes: 16 additions & 0 deletions Assets/FieldDay/Rendering/CameraUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#endif // UNITY_2019_1_OR_NEWER

using System;
using System.Runtime.CompilerServices;
using BeauUtil;
using UnityEngine;

Expand Down Expand Up @@ -93,5 +94,20 @@ static public bool WillRenderDirectly(Camera camera) {

return true;
}

/// <summary>
/// Returns if the given camera is a game camera.
/// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static public bool IsGameCamera(Camera camera) {
switch (camera.cameraType) {
case CameraType.SceneView:
case CameraType.Preview:
return false;

default:
return true;
}
}
}
}
Loading

0 comments on commit f46da11

Please sign in to comment.