Added Summeries

This commit is contained in:
Michel Fedde 2021-03-19 20:59:02 +01:00
parent 71a22df8bd
commit 8296d9b8a9
47 changed files with 812 additions and 177 deletions

View file

@ -15,8 +15,8 @@ namespace SM.Base.Scene
/// </summary>
public abstract class GenericItemCollection : List<IShowItem>, IShowItem, IShowCollection, IScriptable, IFixedScriptable
{
private List<IScriptable> _scriptableObjects = new List<IScriptable>();
private List<IFixedScriptable> _fixedScriptables = new List<IFixedScriptable>();
private readonly List<IScriptable> _scriptableObjects = new List<IScriptable>();
private readonly List<IFixedScriptable> _fixedScriptables = new List<IFixedScriptable>();
/// <summary>
/// Currently active script objects.
@ -45,6 +45,7 @@ namespace SM.Base.Scene
/// <inheritdoc />
public bool RenderActive { get; set; } = true;
/// <inheritdoc />
public virtual void FixedUpdate(FixedUpdateContext context)
{
if (!Active || !UpdateActive) return;
@ -126,6 +127,11 @@ namespace SM.Base.Scene
if (item is IFixedScriptable fs) _fixedScriptables.Add(fs);
}
/// <summary>
/// Removes an object from the drawing list.
/// <para>If the object is a scriptable object, it will remove the object from that list as well.</para>
/// </summary>
/// <param name="items"></param>
public void Remove(params IShowItem[] items)
{
foreach (var item in items)
@ -161,6 +167,12 @@ namespace SM.Base.Scene
if (item is IFixedScriptable fs) _fixedScriptables.Remove(fs);
}
/// <summary>
/// Returns all objects in the drawing list.
/// <para>Not reclusive.</para>
/// </summary>
/// <param name="includeCollections">If true, it will add collections as well.</param>
/// <returns></returns>
public ICollection<IShowItem> GetAllItems(bool includeCollections = false)
{
List<IShowItem> items = new List<IShowItem>();
@ -224,7 +236,6 @@ namespace SM.Base.Scene
/// <summary>
/// Contains a list of show items with transformation.
/// </summary>
/// <typeparam name="TItem">The type of show items.</typeparam>
/// <typeparam name="TTransformation">The type of transformation.</typeparam>
public abstract class GenericItemCollection<TTransformation> : GenericItemCollection,
IShowTransformItem<TTransformation>

View file

@ -213,18 +213,24 @@ namespace SM.Base.Scene
/// A generic scene that imports different functions.
/// </summary>
/// <typeparam name="TCamera">The type of cameras.</typeparam>
/// <typeparam name="TItem">The type of show items.</typeparam>
/// <typeparam name="TCollection">The type for collections</typeparam>
public abstract class GenericScene<TCamera, TCollection> : GenericScene
where TCamera : GenericCamera, new()
where TCollection : GenericItemCollection, new()
{
/// <summary>
/// Objects inside the scene, but as the collection type.
/// </summary>
public new TCollection Objects
{
get => (TCollection) base.Objects;
set => base.Objects = value;
}
/// <summary>
/// HUD-Objects inside the scene, but as the collection type.
/// </summary>
public new TCollection HUD
{
get
@ -235,18 +241,28 @@ namespace SM.Base.Scene
set => base.HUD = value;
}
/// <summary>
/// The active camera, that is used if the context doesn't force the viewport camera.
/// <para>If none set, it automaticly uses the viewport camera.</para>
/// </summary>
public new TCamera Camera
{
get => (TCamera) base.Camera;
set => base.Camera = value;
}
/// <summary>
/// A camera to control the HUD.
/// </summary>
public new TCamera HUDCamera
{
get => (TCamera) base.HUDCamera;
set => base.HUDCamera = value;
}
/// <summary>
/// A camera to control the background.
/// </summary>
public new TCamera BackgroundCamera
{
get => (TCamera) base.BackgroundCamera;

View file

@ -55,19 +55,36 @@ namespace SM.Base.Scene
void OnRemoved(object sender);
}
/// <summary>
/// Interface to implement transformation.
/// </summary>
/// <typeparam name="TTransform"></typeparam>
public interface ITransformItem<TTransform>
where TTransform : GenericTransformation
{
/// <summary>
/// Controls the transformation of the object.
/// </summary>
TTransform Transform { get; set; }
}
/// <summary>
/// Merges <see cref="IShowItem"/> and <see cref="ITransformItem{TTransform}"/>.
/// </summary>
/// <typeparam name="TTransform"></typeparam>
public interface IShowTransformItem<TTransform> : IShowItem, ITransformItem<TTransform>
where TTransform : GenericTransformation
{
}
/// <summary>
/// Interface to implement models in the object.
/// </summary>
public interface IModelItem
{
/// <summary>
/// The mesh the rendering should use.
/// </summary>
GenericMesh Mesh { get; set; }
}
}