mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-07 15:10:27 -04:00
Removed NioTSO client and server
- NioTSO client isn't needed because we're using RayLib - Added FreeSO's API server to handle most backend operations
This commit is contained in:
parent
f12ba1502b
commit
22191ce648
591 changed files with 53264 additions and 3362 deletions
125
server/tso.common/Rendering/Framework/3DScene.cs
Executable file
125
server/tso.common/Rendering/Framework/3DScene.cs
Executable file
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FSO.Common.Rendering.Framework.Camera;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using FSO.Common.Rendering.Framework.Model;
|
||||
|
||||
namespace FSO.Common.Rendering.Framework
|
||||
{
|
||||
/// <summary>
|
||||
/// A scene capable of rendering 3D elements.
|
||||
/// </summary>
|
||||
public class _3DScene : _3DAbstract
|
||||
{
|
||||
private List<_3DComponent> m_Elements = new List<_3DComponent>();
|
||||
|
||||
public new _3DLayer Parent;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new _3DScene instance.
|
||||
/// </summary>
|
||||
/// <param name="Device">A GraphicsDevice instance used for rendering.</param>
|
||||
/// <param name="camera">A camera inheriting from ICamera used for rendering.</param>
|
||||
public _3DScene(GraphicsDevice Device, ICamera camera) : base(Device)
|
||||
{
|
||||
this.Camera = camera;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new _3DScene instance.
|
||||
/// </summary>
|
||||
/// <param name="Device">A GraphicsDevice instance used for rendering.</param>
|
||||
public _3DScene(GraphicsDevice Device) : base(Device)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Graphics device was reset (happens when scene is updated or minimized.)
|
||||
/// </summary>
|
||||
void m_Device_DeviceReset(object sender, EventArgs e)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the _3DComponents that make up this scene.
|
||||
/// </summary>
|
||||
/// <returns>A List of _3DComponent instances.</returns>
|
||||
public override List<_3DComponent> GetElements()
|
||||
{
|
||||
return m_Elements;
|
||||
}
|
||||
|
||||
public override void Initialize(_3DLayer layer)
|
||||
{
|
||||
this.Parent = layer;
|
||||
|
||||
foreach (var element in m_Elements)
|
||||
{
|
||||
element.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(UpdateState state)
|
||||
{
|
||||
for (int i = 0; i < m_Elements.Count; i++)
|
||||
{
|
||||
m_Elements[i].Update(state);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a 3D element from this 3DScene.
|
||||
/// </summary>
|
||||
/// <param name="item">The _3DComponent instance to remove.</param>
|
||||
public void Remove(_3DComponent item)
|
||||
{
|
||||
m_Elements.Remove(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a 3D element to this 3DScene.
|
||||
/// </summary>
|
||||
/// <param name="item">The _3DComponent instance to add.</param>
|
||||
public override void Add(_3DComponent item)
|
||||
{
|
||||
m_Elements.Add(item);
|
||||
item.Scene = this;
|
||||
if (this.Parent != null)
|
||||
{
|
||||
item.Initialize();
|
||||
}
|
||||
}
|
||||
|
||||
public override void PreDraw(GraphicsDevice device){
|
||||
}
|
||||
|
||||
public override void Draw(GraphicsDevice device)
|
||||
{
|
||||
for (int i = 0; i < m_Elements.Count; i++)
|
||||
{
|
||||
m_Elements[i].Draw(device);
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (ID != null)
|
||||
{
|
||||
return ID;
|
||||
}
|
||||
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GraphicsDevice was reset.
|
||||
/// </summary>
|
||||
/// <param name="Device">The GraphicsDevice instance.</param>
|
||||
public override void DeviceReset(GraphicsDevice Device)
|
||||
{
|
||||
for (int i = 0; i < m_Elements.Count; i++)
|
||||
m_Elements[i].DeviceReset(Device);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue