mirror of
https://github.com/simtactics/mysimulation.git
synced 2025-07-04 21:50:35 -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
86
server/tso.common/Rendering/Framework/Shapes/3DCube.cs
Executable file
86
server/tso.common/Rendering/Framework/Shapes/3DCube.cs
Executable file
|
@ -0,0 +1,86 @@
|
|||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace FSO.Common.Rendering.Framework.Shapes
|
||||
{
|
||||
public class _3DCube : _3DComponent
|
||||
{
|
||||
private BasicEffect Effect;
|
||||
|
||||
private VertexPositionColor[] Geom;
|
||||
private List<VertexPositionColor> GeomList;
|
||||
|
||||
private Color Color;
|
||||
private Vector3 Size;
|
||||
|
||||
public _3DCube(Color color, Vector3 size)
|
||||
{
|
||||
this.Color = color;
|
||||
this.Size = size;
|
||||
}
|
||||
|
||||
public override void Initialize(){
|
||||
|
||||
Effect = new BasicEffect(Device);
|
||||
|
||||
/** Bottom Face **/
|
||||
var btmTL = new Vector3(0.0f, 0.0f, 0.0f);
|
||||
var btmTR = new Vector3(Size.X, 0.0f, 0.0f);
|
||||
var btmBR = new Vector3(Size.X, 0.0f, Size.Z);
|
||||
var btmBL = new Vector3(0.0f, 0.0f, Size.Z);
|
||||
|
||||
/** Top face **/
|
||||
var topTL = new Vector3(0.0f, Size.Y, 0.0f);
|
||||
var topTR = new Vector3(Size.X, Size.Y, 0.0f);
|
||||
var topBR = new Vector3(Size.X, Size.Y, Size.Z);
|
||||
var topBL = new Vector3(0.0f, Size.Y, Size.Z);
|
||||
|
||||
|
||||
GeomList = new List<VertexPositionColor>();
|
||||
AddQuad(Color, topTL, topTR, topBR, topBL);
|
||||
AddQuad(Color.Yellow, btmTL, btmTR, btmBR, btmBL);
|
||||
AddQuad(Color.Green, topTL, topTR, btmTR, btmTL);
|
||||
AddQuad(Color.Blue, topBL, topTL, btmTL, btmBL);
|
||||
AddQuad(Color.Orange, topBR, topTR, btmTR, btmBR);
|
||||
AddQuad(Color.White, topBL, topBR, btmBR, btmBL);
|
||||
|
||||
Geom = GeomList.ToArray();
|
||||
}
|
||||
|
||||
private void AddQuad(Color color, Vector3 tl, Vector3 tr, Vector3 br, Vector3 bl)
|
||||
{
|
||||
GeomList.Add(new VertexPositionColor(tl, color));
|
||||
GeomList.Add(new VertexPositionColor(tr, color));
|
||||
GeomList.Add(new VertexPositionColor(br, color));
|
||||
|
||||
GeomList.Add(new VertexPositionColor(br, color));
|
||||
GeomList.Add(new VertexPositionColor(bl, color));
|
||||
GeomList.Add(new VertexPositionColor(tl, color));
|
||||
}
|
||||
|
||||
public override void Draw(GraphicsDevice device)
|
||||
{
|
||||
|
||||
Effect.World = World;
|
||||
Effect.View = View;
|
||||
Effect.Projection = Projection;
|
||||
Effect.VertexColorEnabled = true;
|
||||
//Effect.EnableDefaultLighting();
|
||||
|
||||
foreach (var pass in Effect.CurrentTechnique.Passes)
|
||||
{
|
||||
pass.Apply();
|
||||
device.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleList, Geom, 0, Geom.Length / 3);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(FSO.Common.Rendering.Framework.Model.UpdateState state)
|
||||
{
|
||||
}
|
||||
|
||||
public override void DeviceReset(GraphicsDevice Device)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue