daily update on 20230418 by nitload youmu.
rewrite of geometry is completed. ready for release of ver0.1.0
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using Steamworks;
|
||||
using StgSharp;
|
||||
using StgSharp.Control;
|
||||
using StgSharp.Linear;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -11,83 +10,37 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
public class Line:IPlainGeometry
|
||||
{
|
||||
internal Point _basePoint = default ;
|
||||
internal Point _beginPoint = default ;
|
||||
internal Point _endPoint = default;
|
||||
internal Point basePoint = default ;
|
||||
internal Point beginPoint = default ;
|
||||
internal Point endPoint = default;
|
||||
internal GetLocationHandler movBegin;
|
||||
internal GetLocationHandler movEnd;
|
||||
internal RenderMode _renderMode;
|
||||
internal readonly uint bornTick;
|
||||
|
||||
public override Point RefOrigin => _basePoint;
|
||||
|
||||
public override Point RefPoint => _beginPoint;
|
||||
|
||||
public override Point RefVec01 => _endPoint;
|
||||
public override Point RefVec02 => default;
|
||||
public override RenderMode renderMode => _renderMode;
|
||||
|
||||
public Line(uint bornTime) : base(bornTime)
|
||||
{
|
||||
bornTick = bornTime;
|
||||
}
|
||||
|
||||
public Line(Counter<uint> tickCounter) : base(tickCounter)
|
||||
{
|
||||
bornTick = tickCounter._value;
|
||||
}
|
||||
public override Point RefPoint01 => beginPoint;
|
||||
public override Point RefPoint02 => endPoint;
|
||||
public override Point RefPoint03 => default;
|
||||
|
||||
public Line(Point begin, Point end)
|
||||
{
|
||||
this._beginPoint = begin;
|
||||
this._endPoint = end;
|
||||
this.beginPoint = begin;
|
||||
this.endPoint = end;
|
||||
}
|
||||
|
||||
public Line() { }
|
||||
|
||||
public override float SetArrayX()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override float SetArrayY()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
internal sealed override void CalcVec01(uint tick)
|
||||
{
|
||||
_beginPoint._position = _basePoint._position + MoveBeginPoint(tick);
|
||||
}
|
||||
|
||||
internal sealed override void CalcVec02(vec3d vec, uint tick)
|
||||
{
|
||||
_endPoint._position = vec + MoveEndPoint(tick);
|
||||
}
|
||||
|
||||
//计算线起点的方法,通过对线的派生的重写实现功能
|
||||
public virtual vec3d MoveBeginPoint(uint tick)
|
||||
=> movBegin.Invoke( GameTimeLine.tickCounter);
|
||||
=> movBegin.Invoke(tick);
|
||||
|
||||
//计算线重点的方法,通过对线的派生的重写实现功能
|
||||
public virtual vec3d MoveEndPoint(uint tick)
|
||||
=> movEnd.Invoke( GameTimeLine.tickCounter);
|
||||
=> movEnd.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
CalcVec01(tick);
|
||||
switch (_renderMode)
|
||||
{
|
||||
case RenderMode.BasePoint:
|
||||
CalcVec02(_basePoint._position, tick);
|
||||
break;
|
||||
case RenderMode.RefPoint:
|
||||
CalcVec02(_beginPoint._position, tick);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
beginPoint._position = refOrigin._position + MoveBeginPoint(tick);
|
||||
endPoint._position = refOrigin._position + MoveEndPoint(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
|
||||
Reference in New Issue
Block a user