daily update on 20230322 by nitload youmu, new geometry structure rewritten 70%

This commit is contained in:
Nitload
2023-03-22 20:32:17 +08:00
parent db2ca36fd7
commit eedab82f6e
66 changed files with 1382 additions and 785 deletions
+82
View File
@@ -0,0 +1,82 @@
using Steamworks;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
namespace StgSharp.Geometries
{
public class Arc : IGeometry
{
internal Point _basePoint;
internal Point _center;
internal Point _radius;
internal Point _angle;
internal RenderMode _renderMode;
public override Point BasePoint => _basePoint;
public override Point RefPoint => _center;
public override Point RefVec01 => _radius;
public override Point RefVec02 => _angle;
public override RenderMode renderMode => _renderMode;
internal sealed override void CalcVec01(uint tick)
{
_center._position = _basePoint._position + MoveCenter(tick);
}
internal sealed override void CalcVec02(vec2d vec, uint tick)
{
_radius._position = vec + UpdateRadius(tick);
}
internal sealed override void CalcVec03(StgSharp.Math.vec2d vec, uint tick)
{
_angle._position = vec + UpdateAngle(tick);
}
public virtual vec2d MoveCenter(uint tick) => default;
public virtual vec2d UpdateRadius(uint tick) => default;
public virtual vec2d UpdateAngle(uint tick) => default;
internal override void OnRender(uint tick)
{
CalcVec01(tick);
switch (_renderMode)
{
case RenderMode.BasePoint:
CalcVec02(_basePoint._position,tick);
CalcVec03(_basePoint._position,tick);
break;
case RenderMode.RefPoint:
CalcVec02(_center._position,tick);
CalcVec03(_center._position, tick);
break;
default:
break;
}
}
public override float SetArrayX()
{
throw new NotImplementedException();
}
public override float SetArrayY()
{
throw new NotImplementedException();
}
}
}
+47 -22
View File
@@ -1,4 +1,5 @@
using System;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
@@ -6,45 +7,69 @@ namespace StgSharp
{
public class Circle : IGeometry
{
private StgSharp.ContainerNode<INode> _id;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
internal Point _baseCenter;
internal Point _center;
internal Point _radiusVec;
internal RenderMode _renderMode;
public Point ReferencePoint
public override Point BasePoint => _baseCenter;
public override Point RefPoint => _center;
public override Point RefVec01 => _radiusVec;
public override Point RefVec02 => default;
public override RenderMode renderMode => _renderMode;
internal override void CalcVec01(uint tick)
{
get { return _referencePoint; }
_center._position = _baseCenter._position + MoveCenter(tick);
}
float IGeometry.ExpressionX => throw new NotImplementedException();
float IGeometry.ExpressionY => throw new NotImplementedException();
ContainerNode<INode> INode.ID
internal override void CalcVec02(vec2d vec, uint tick)
{
get { return _id; }
_radiusVec._position = vec + UpdateRadius(tick);
}
public float SetArrayX(Counter<uint> tickCounter)
internal override void CalcVec03(vec2d vec, uint tick)
{
throw new NotImplementedException();
}
public float SetArrayY(Counter<uint> tickCounter)
public virtual vec2d MoveCenter(uint tick) => default;
public virtual vec2d UpdateRadius(uint tick) => default;
public override float SetArrayX()
{
throw new NotImplementedException();
}
void INode.setID<T>(ContainerNode<T> id)
public override float SetArrayY()
{
if (_id == default(ContainerNode<INode>))
throw new NotImplementedException();
}
internal override void OnRender(uint tick)
{
CalcVec01(tick);
switch (_renderMode)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentException();
case RenderMode.BasePoint:
CalcVec02(_baseCenter._position,tick);
CalcVec03(_baseCenter._position,tick);
break;
case RenderMode.RefPoint:
CalcVec02(_center._position, tick);
CalcVec03(_center._position, tick);
break;
default:
break;
}
}
}
}
@@ -1,9 +1,11 @@
using StgSharp;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public delegate float GetLocationHandler(Counter<uint> tickCounter);
public delegate vec2d GetLocationHandler(vec2d vec, Counter<uint> tickCounter);
}
+46 -16
View File
@@ -1,30 +1,60 @@
using StgSharp;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public interface IGeometry:INode
public abstract class IGeometry:INode<IGeometry>
{
public Point ReferencePoint
internal ContainerNode<IGeometry> _id;
public abstract Point BasePoint { get; }
public abstract Point RefPoint{ get; }
public abstract Point RefVec01{ get; }
public abstract Point RefVec02{ get; }
internal abstract void CalcVec01(uint tick);
internal abstract void CalcVec02(vec2d vec, uint tick);
internal abstract void CalcVec03(vec2d vec, uint tick);
internal abstract void OnRender(uint tick);
public abstract RenderMode renderMode { get; }
public abstract float SetArrayX();
public abstract float SetArrayY();
ContainerNode<IGeometry> INode<IGeometry>.ID => _id;
void INode<IGeometry>.setID<T>(ContainerNode<T> id)
{
get;
if (_id != default)
{
throw new ArgumentException("Cannot set id twice");
}
else
{
_id = id as ContainerNode<IGeometry>;
}
}
internal float ExpressionX
{
get;
}
internal float ExpressionY
{
get;
}
public float SetArrayX(Counter<uint> tickCounter);
public float SetArrayY(Counter<uint> tickCounter);
}
public enum RenderMode
{
/// <summary>
/// 坐标点将基于参考原点构建
/// </summary>
BasePoint,
/// <summary>
/// 坐标点将基于参考起点构建
/// </summary>
RefPoint
}
}
+45 -32
View File
@@ -1,4 +1,6 @@
using StgSharp;
using Steamworks;
using StgSharp;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
@@ -7,53 +9,64 @@ namespace StgSharp
{
public class Line:IGeometry
{
private ContainerNode<INode> _id;
internal Point _basePoint;
internal Point _beginPoint;
internal Point _endPoint;
internal GetLocationHandler _beginPointMov;
internal GetLocationHandler _endPointMov;
internal RenderMode _renderMode;
internal Point _referencePoint;
internal float _vecX;
internal float _vecY;
public Point ReferencePoint
public override Point BasePoint => _basePoint;
public override Point RefPoint => _beginPoint;
public override Point RefVec01 => _endPoint;
public override Point RefVec02 => default;
public override RenderMode renderMode => _renderMode;
public override float SetArrayX()
{
get { return _referencePoint; }
throw new NotImplementedException();
}
ContainerNode<INode> INode.ID
public override float SetArrayY()
{
get { return _id; }
throw new NotImplementedException();
}
float IGeometry.ExpressionX => throw new NotImplementedException();
float IGeometry.ExpressionY => throw new NotImplementedException();
public Line( Point referencePoint, float vecX, float vecY)
internal sealed override void CalcVec01(uint tick)
{
_referencePoint = referencePoint;
_vecX = vecX;
_vecY = vecY;
_beginPoint._position = _basePoint._position + MoveBeginPoint(tick);
}
public float SetArrayX(Counter<uint> tickCounter)
internal sealed override void CalcVec02(vec2d vec, uint tick)
{
return 0.0f;
}
public float SetArrayY(Counter<uint> tickCounter)
{
return 0.0f;
_endPoint._position = vec + MoveEndPoint(tick);
}
void INode.setID<T>(ContainerNode<T> id)
internal sealed override void CalcVec03(vec2d vec, uint tick)
{
if (id == null)
throw new ArgumentException("Lines do not need the third parameter to define!");
}
public virtual vec2d MoveBeginPoint(uint tick) => default;
public virtual vec2d MoveEndPoint(uint tick) => default;
internal override void OnRender(uint tick)
{
CalcVec01(tick);
switch (_renderMode)
{
_id = id as ContainerNode<INode>;
}
else
{
throw new ArgumentNullException("Cannot set id teice!");
case RenderMode.BasePoint:
CalcVec02(_basePoint._position, tick);
break;
case RenderMode.RefPoint:
CalcVec02(_beginPoint._position, tick);
break;
default:
break;
}
}
}
+1 -2
View File
@@ -48,8 +48,7 @@ namespace StgSharp
public void OnRender()
{
this.getXHandler.Invoke(Control.TimeLine.tickCounter);
this.getYHandler.Invoke(Control.TimeLine.tickCounter);
this.getXHandler.Invoke(this._position, Control.TimeLine.tickCounter);
}
}
}
@@ -0,0 +1,68 @@
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp.Geometries
{
public class Rectangle : IGeometry
{
internal Point _basePoint;
internal Point _center;
internal Point _centerToCorner1;
internal Point _centerToCorner2;
internal GetLocationHandler _centerMov;
internal GetLocationHandler _CTC1Handler;
internal GetLocationHandler _CTC2Handler;
Point IGeometry.BasePoint
{
get { return _basePoint; }
}
Point IGeometry.RefPoint
{
get { return _center; }
}
Point IGeometry.RefVec01
{
get { return _centerToCorner1; }
}
Point IGeometry.RefVec02
{
get { return _centerToCorner2; }
}
void IGeometry.OnRender()
{
this._CTC2Handler.Invoke(_centerToCorner2._position, Control.TimeLine.tickCounter);
}
float IGeometry.SetArrayX()
{
throw new NotImplementedException();
}
float IGeometry.SetArrayY()
{
throw new NotImplementedException();
}
void INode<IGeometry>.setID<T>(ContainerNode<T> id)
{
if (_id != default(ContainerNode<IGeometry>))
{
throw new ArgumentException();
}
else
{
_id = id as ContainerNode<IGeometry>;
}
}
}
}
+54 -17
View File
@@ -1,46 +1,83 @@
using StgSharp;
using StgSharp.Math;
using System;
using System.Collections.Generic;
using System.Text;
namespace StgSharp
{
public class Triangle
public class Triangle :IGeometry
{
internal ContainerNode<INode> _id;
internal ContainerNode<IGeometry> _id;
internal Point _basePoint;
internal Point _refPoint;
internal Point _line1;
internal Point _line2;
internal Point _referencePoint;
internal GetLocationHandler _refMovHandler;
internal GetLocationHandler _line01MovHandler;
internal GetLocationHandler _line02MovHandler;
internal GetLocationHandler _setArrayXHandler;
internal GetLocationHandler _setArrayYHandler;
public Point ReferencePoint
Point IGeometry.BasePoint
{
get { return _referencePoint; }
get { return _basePoint; }
}
public float VecX
Point IGeometry.RefPoint
{
get { return _referencePoint.X; }
get { return _refPoint; }
}
public float VecY
Point IGeometry.RefVec01
{
get { return _referencePoint.Y; }
get { return _refPoint; }
}
Point IGeometry.RefVec02
{
get { return _line1; }
}
GetLocationHandler IGeometry.Vec01Expression
{
get { return _refMovHandler; }
}
GetLocationHandler IGeometry.Vec02Expression
{
get { return _line01MovHandler; }
}
GetLocationHandler IGeometry.Vec03Expression
{
get { return _line02MovHandler; }
}
ContainerNode<IGeometry> INode<IGeometry>.ID
{
get { return _id; }
}
public float SetArrayX(Counter<uint> tickCounter)
void IGeometry.OnRender()
{
return _setArrayXHandler.Invoke(tickCounter);
throw new NotImplementedException();
}
public float SetArrayY(Counter<uint> tickCounter)
float IGeometry.SetArrayX()
{
return _setArrayYHandler.Invoke(tickCounter);
throw new NotImplementedException();
}
float IGeometry.SetArrayY()
{
throw new NotImplementedException();
}
void INode<IGeometry>.setID<T>(ContainerNode<T> id)
{
throw new NotImplementedException();
}
}
}