daily uodate on 20231208 by nitload youmu, preparation for multi thread rendering
This commit is contained in:
@@ -4,35 +4,15 @@ using System;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static partial class Control
|
||||
public static partial class Operation
|
||||
{
|
||||
/// <summary>
|
||||
/// Add a pool to timeline controller, and return the instance of the pool.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Pool InitPool()
|
||||
{
|
||||
Pool pool = new Pool();
|
||||
AddPool(pool);
|
||||
return pool;
|
||||
}
|
||||
|
||||
public static void AddPool(Pool pool)
|
||||
{
|
||||
StgSharp.Controlling.TimeLine.allPool.Add(pool);
|
||||
StgSharp.Controlling.TimeLine._currentPool = pool;
|
||||
}
|
||||
|
||||
public static void LoadTimeline()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal static void InitVector4map(Pool target)
|
||||
{
|
||||
Vector4Map map = new Vector4Map();
|
||||
TimeLine.GetCurrentPool()._Vector4mapContainer.Add(map);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace StgSharp
|
||||
{
|
||||
|
||||
public static partial class Control
|
||||
public static partial class Operation
|
||||
{
|
||||
//method used for chaging the value of paameters will be listed here
|
||||
|
||||
|
||||
@@ -5,48 +5,9 @@ using StgSharp.Math;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static unsafe partial class Control
|
||||
public static unsafe partial class Operation
|
||||
{
|
||||
public static LinkedList<T> GetAllActivatedPool<T>() where T : Pool
|
||||
{
|
||||
/**/
|
||||
LinkedList<T> pool = new LinkedList<T>();
|
||||
foreach (Pool item in TimeLine.allPool)
|
||||
{
|
||||
pool.Add((T)item);
|
||||
}
|
||||
return pool;
|
||||
/**/
|
||||
}
|
||||
|
||||
internal static Vector4Map GetAvailabeVector4map()
|
||||
{
|
||||
Pool p = TimeLine.GetCurrentPool();
|
||||
Vector4Map lastMap = p._Vector4mapContainer.Tail;
|
||||
|
||||
if (lastMap.isFull)
|
||||
{
|
||||
lastMap = new Vector4Map();
|
||||
p._Vector4mapContainer.Add(lastMap);
|
||||
}
|
||||
|
||||
return lastMap;
|
||||
}
|
||||
|
||||
internal static long GetAvailableVector4ptr()
|
||||
{
|
||||
Pool p = TimeLine.GetCurrentPool();
|
||||
Vector4Map lastMap = p._Vector4mapContainer.Tail;
|
||||
|
||||
if (lastMap.isFull)
|
||||
{
|
||||
lastMap = new Vector4Map();
|
||||
p._Vector4mapContainer.Add(lastMap);
|
||||
}
|
||||
long ptr = lastMap.RegistManagedVector4Ptr();
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the status of a certain key on the keyboard.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Graphics;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -31,6 +32,9 @@ namespace StgSharp
|
||||
CallingConvention = CallingConvention.Cdecl)]
|
||||
internal static extern unsafe IntPtr InternalReadLog();
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "loadImageData",
|
||||
CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
internal static extern unsafe void InternalLoadImage(string fileName, Image.ImageInfo* output, ImageLoader loader);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -41,6 +45,9 @@ namespace StgSharp
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
|
||||
public delegate IntPtr ImageLoader(string name, ref int width, ref int height, ref int definedChannel, int desiredChannel);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLcontextIO
|
||||
{
|
||||
@@ -2590,7 +2597,6 @@ namespace StgSharp.Graphics
|
||||
|
||||
public GLcontextIO()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
internal enum LogType
|
||||
public enum LogType
|
||||
{
|
||||
Error,
|
||||
Warning,
|
||||
@@ -37,6 +37,7 @@ namespace StgSharp
|
||||
GLtype.Add(typeof(ushort), GLconst.UNSIGNED_SHORT);
|
||||
GLtype.Add(typeof(sbyte), GLconst.BYTE);
|
||||
GLtype.Add(typeof(byte), GLconst.UNSIGNED_BYTE);
|
||||
|
||||
}
|
||||
|
||||
internal static T InternalLoadProc<T>(IntPtr libPtr, string name) where T : Delegate
|
||||
@@ -49,7 +50,6 @@ namespace StgSharp
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
throw;
|
||||
}
|
||||
}
|
||||
@@ -98,16 +98,15 @@ namespace StgSharp
|
||||
|
||||
internal static void InternalWriteLog(string logLine, LogType logType)
|
||||
{
|
||||
if (!File.Exists(InternalIO.SS_errorlog))
|
||||
if (!File.Exists(SS_errorlog))
|
||||
{
|
||||
FileStream stream = File.Create(InternalIO.SS_errorlog);
|
||||
FileStream stream = File.Create(SS_errorlog);
|
||||
stream.Close();
|
||||
}
|
||||
|
||||
using (StreamWriter logStream = File.AppendText(SS_errorlog))
|
||||
{
|
||||
logStream.WriteLine($"{logType}\t@\t{DateTime.Now.ToString("o")}");
|
||||
|
||||
logStream.WriteLine(logLine);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace StgSharp
|
||||
{
|
||||
public static partial class Control
|
||||
public static partial class Operation
|
||||
{
|
||||
public enum Key : int
|
||||
{
|
||||
|
||||
@@ -4,10 +4,14 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Math
|
||||
namespace StgSharp.Controlling
|
||||
{
|
||||
public static unsafe partial class VectorCalc
|
||||
public static partial class TimeLine
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,17 +2,19 @@
|
||||
using StgSharp.Graphics;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading;
|
||||
|
||||
namespace StgSharp.Controlling
|
||||
{
|
||||
public static partial class TimeLine
|
||||
{
|
||||
public const long version = 10;
|
||||
|
||||
internal static Pool _currentPool = default;
|
||||
internal static LinkedList<Pool> allPool = new LinkedList<Pool>();
|
||||
public const long version = 430;
|
||||
internal static LinkedList<Form> allForm;
|
||||
|
||||
private static SemaphoreSlim ping;
|
||||
private static SemaphoreSlim pong;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tick counter count the frames passed since the program start.
|
||||
/// </summary>
|
||||
@@ -24,15 +26,14 @@ namespace StgSharp.Controlling
|
||||
static unsafe TimeLine()
|
||||
{
|
||||
allForm = new LinkedList<Form>();
|
||||
allPool = new LinkedList<Pool>();
|
||||
}
|
||||
|
||||
public static TimelineBlock CurrentOperation
|
||||
{
|
||||
get { return currentOperation; }
|
||||
set
|
||||
set
|
||||
{
|
||||
if (currentOperation==default||
|
||||
if (currentOperation == default ||
|
||||
currentOperation.isComplete)
|
||||
{
|
||||
currentOperation = value;
|
||||
@@ -40,39 +41,20 @@ namespace StgSharp.Controlling
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnRender()
|
||||
public static void TimelineMain()
|
||||
{
|
||||
tickCounter.QuickAdd();
|
||||
foreach (Pool p in allPool)
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
internal static void UodateAllFrame()
|
||||
{
|
||||
foreach (Form item in allForm)
|
||||
{
|
||||
_currentPool = p;
|
||||
if (!currentOperation.isComplete)
|
||||
{
|
||||
currentOperation.OnUpdating();
|
||||
}
|
||||
item.formThread.Start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void InitProgram()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static unsafe void StartProgram()
|
||||
{
|
||||
}
|
||||
|
||||
public static void LoadPool(Pool pool)
|
||||
{
|
||||
allPool.Add(pool);
|
||||
Console.WriteLine(allPool.count.Value);
|
||||
}
|
||||
|
||||
public static Pool GetCurrentPool()
|
||||
{
|
||||
return _currentPool;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
{
|
||||
public abstract class TimelineBlock
|
||||
{
|
||||
public T GetCurrentPool<T>() where T:Pool
|
||||
{
|
||||
return TimeLine._currentPool as T;
|
||||
}
|
||||
|
||||
public abstract bool isComplete
|
||||
{
|
||||
@@ -18,6 +14,6 @@
|
||||
the result of the cycle, that if there is any error in the cycle
|
||||
*/
|
||||
public abstract int OnUpdating();
|
||||
public abstract bool GetShouldComplete();
|
||||
public abstract bool GetShouldComplete();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,10 @@ namespace StgSharp.Entities
|
||||
public LinkedList<Launcher<EntityPartical>> CommonBulletLauncher { get; set; }
|
||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||
|
||||
internal void InternalDieOperation(Pool home)
|
||||
internal void InternalDieOperation(Control home)
|
||||
{
|
||||
_dieBulletLauncher.Launch();
|
||||
_awardLauncher.Launch();
|
||||
TimeLine._currentPool._enemyContainer.Remove(this);
|
||||
}
|
||||
|
||||
public override void OnRenderFrame()
|
||||
|
||||
@@ -14,11 +14,10 @@ namespace StgSharp.Entities
|
||||
public Launcher<EntityPartical> CommonBulletLauncher { get; set; }
|
||||
public Launcher<EntityPartical> DieBulletLauncher { get; set; }
|
||||
|
||||
internal void InternalDieOperation(Pool home)
|
||||
internal void InternalDieOperation(Control home)
|
||||
{
|
||||
_dieBulletLauncher.Launch();
|
||||
_awardLauncher.Launch();
|
||||
TimeLine._currentPool._enemyContainer.Remove(this);
|
||||
}
|
||||
|
||||
public override void OnRenderFrame()
|
||||
|
||||
@@ -12,12 +12,6 @@ namespace StgSharp.Geometries
|
||||
internal GetLocationHandler movBeginOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
public override Point RefPoint0 => center;
|
||||
|
||||
public override Point RefPoint1 => beginPoint;
|
||||
|
||||
public override Point RefPoint2 => endPoint;
|
||||
|
||||
internal override int[] Indices => throw new NotImplementedException();
|
||||
|
||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
@@ -26,12 +20,12 @@ namespace StgSharp.Geometries
|
||||
|
||||
public virtual vec3d MovEnd(uint tick) => movEndOperation.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
center.Position = refOrigin.Position + MoveCenter(tick);
|
||||
beginPoint.Position = refOrigin.Position + MovBegin(tick);
|
||||
endPoint.Position = refOrigin.Position + MovEnd(tick);
|
||||
center.Position = this.coordinate.origin + MoveCenter(tick);
|
||||
beginPoint.Position = this.coordinate.origin + MovBegin(tick);
|
||||
endPoint.Position = this.coordinate.origin + MovEnd(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides() => throw new NotImplementedException();
|
||||
@@ -40,5 +34,6 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
return new Plain(this.center, this.beginPoint, this.endPoint);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,6 @@ namespace StgSharp.Geometries
|
||||
internal GetLocationHandler movEndOperation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
|
||||
public override Point RefPoint0 => center;
|
||||
|
||||
public override Point RefPoint1 => pointOnCircle;
|
||||
|
||||
public override Point RefPoint2 => pointOnPlain;
|
||||
|
||||
internal override int[] Indices => throw new NotImplementedException();
|
||||
|
||||
public virtual vec3d MoveCenter(uint tick) => movCenterOperation.Invoke(tick);
|
||||
@@ -32,12 +26,12 @@ namespace StgSharp.Geometries
|
||||
return new Plain(center, pointOnCircle, pointOnPlain);
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
center.Position = refOrigin.Position + MoveCenter(tick);
|
||||
pointOnCircle.Position = refOrigin.Position + UpdateRadius(tick);
|
||||
pointOnPlain.Position = refOrigin.Position + UpdatePlain(tick);
|
||||
center.Position = this.coordinate.origin + MoveCenter(tick);
|
||||
pointOnCircle.Position = this.coordinate.origin + UpdateRadius(tick);
|
||||
pointOnPlain.Position = this.coordinate.origin + UpdatePlain(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PartialPlainCoordinate
|
||||
{
|
||||
/// <summary>
|
||||
/// The origin of this coordinate.
|
||||
/// </summary>
|
||||
public vec3d origin;
|
||||
internal Matrix3x2 axis;
|
||||
|
||||
/// <summary>
|
||||
/// The horizontial axis of the coordinate.
|
||||
/// Point to the right direction.
|
||||
/// </summary>
|
||||
public vec3d axis_H
|
||||
{
|
||||
get { return axis.colum0; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The vertical axis of the coordinate.
|
||||
/// Point to the top direction.
|
||||
/// </summary>
|
||||
public vec3d axis_V
|
||||
{
|
||||
get { return axis.colum1; }
|
||||
}
|
||||
|
||||
public PartialPlainCoordinate
|
||||
(
|
||||
vec3d origin,
|
||||
vec3d horiziontial,
|
||||
vec3d vertical
|
||||
)
|
||||
{
|
||||
this.origin = origin;
|
||||
axis = new Matrix3x2();
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit(out axis.mat);
|
||||
#endif
|
||||
axis.colum0 = horiziontial;
|
||||
axis.colum1 = vertical;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public vec3d GetRealLocate(Vec2d raletiveLocation)
|
||||
{
|
||||
return origin + axis.VerticalVecMultiply(raletiveLocation);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,6 @@ namespace StgSharp.Geometries
|
||||
internal GetLocationHandler movBegin;
|
||||
internal GetLocationHandler movEnd;
|
||||
|
||||
public override Point RefPoint0 => beginPoint;
|
||||
public override Point RefPoint1 => endPoint;
|
||||
public override Point RefPoint2 => default;
|
||||
|
||||
internal override int[] Indices
|
||||
{
|
||||
@@ -35,7 +32,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public Line() { }
|
||||
|
||||
//计算线起点的方法,通过对线的派生的重写实现功能
|
||||
//method to calculate begin point of the the line
|
||||
public virtual vec3d MoveBeginPoint(uint tick)
|
||||
=> movBegin.Invoke(tick);
|
||||
|
||||
@@ -43,11 +40,11 @@ namespace StgSharp.Geometries
|
||||
public virtual vec3d MoveEndPoint(uint tick)
|
||||
=> movEnd.Invoke(tick);
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
tick -= bornTick;
|
||||
beginPoint.Position = refOrigin.Position + MoveBeginPoint(tick);
|
||||
endPoint.Position = refOrigin.Position + MoveEndPoint(tick);
|
||||
beginPoint.Position = coordinate.origin + MoveBeginPoint(tick);
|
||||
endPoint.Position = coordinate.origin + MoveEndPoint(tick);
|
||||
}
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
|
||||
@@ -7,10 +7,6 @@ namespace StgSharp.Geometries
|
||||
{
|
||||
internal Point center;
|
||||
|
||||
public sealed override Point RefPoint0 => center;
|
||||
public sealed override Point RefPoint1 => new Point(vertexMat.mat.colum0);
|
||||
public sealed override Point RefPoint2 => new Point(vertexMat.mat.colum1);
|
||||
|
||||
internal readonly GetLocationHandler movCenterOperation =
|
||||
new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
@@ -66,13 +62,9 @@ namespace StgSharp.Geometries
|
||||
throw new UnusedVertexException();
|
||||
}
|
||||
|
||||
internal sealed override void OnRender(uint tick)
|
||||
internal sealed override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
uint nowTick = TimeLine.tickCounter._value;
|
||||
this.vertexMat.Colum0 = RefOrigin.Position + moveVertex0Operation(nowTick);
|
||||
this.vertexMat.Colum1 = RefOrigin.Position + moveVertex1Operation(nowTick);
|
||||
this.vertexMat.Colum2 = center.Position * 2 - vertexMat.Colum0;
|
||||
this.vertexMat.Colum3 = center.Position * 2 - vertexMat.Colum1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,13 +9,14 @@ namespace StgSharp.Geometries
|
||||
public abstract class PlainGeometry
|
||||
{
|
||||
protected readonly uint bornTick;
|
||||
internal readonly Point refOrigin;
|
||||
|
||||
public Point RefOrigin { get { return refOrigin; } }
|
||||
internal PartialPlainCoordinate coordinate;
|
||||
internal Matrix2x4 textureFrame;
|
||||
|
||||
public abstract Point RefPoint0 { get; }
|
||||
public abstract Point RefPoint1 { get; }
|
||||
public abstract Point RefPoint2 { get; }
|
||||
public PartialPlainCoordinate ReferenceCoordinate
|
||||
{
|
||||
get => this.coordinate;
|
||||
}
|
||||
|
||||
public uint BornTime => bornTick;
|
||||
|
||||
@@ -33,13 +34,14 @@ namespace StgSharp.Geometries
|
||||
|
||||
public PlainGeometry() { }
|
||||
|
||||
|
||||
internal abstract void OnRender(uint tick);
|
||||
internal abstract void UpdateCoordinate(uint tick);
|
||||
|
||||
public abstract Line[] GetAllSides();
|
||||
|
||||
public abstract Plain GetPlain();
|
||||
|
||||
//public abstract Rectangle GetRenderFrame();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,12 +11,43 @@ namespace StgSharp.Geometries
|
||||
internal readonly GetLocationHandler moveVertex2Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
internal readonly GetLocationHandler moveVertex3Operation = new GetLocationHandler(GeometryOperation.DefualtMotion);
|
||||
|
||||
internal Matrix3x4 vertexMat;
|
||||
internal Matrix2x4 vertexMat;
|
||||
|
||||
internal Polygon4()
|
||||
{
|
||||
}
|
||||
|
||||
public Polygon4(PartialPlainCoordinate coordinate,
|
||||
Vec2d topLeft,
|
||||
Vec2d topRight,
|
||||
Vec2d bottomRight,
|
||||
Vec2d bottomLeft,
|
||||
bool Orth
|
||||
)
|
||||
{
|
||||
this.coordinate = coordinate;
|
||||
vertexMat.Colum0 = topLeft;
|
||||
vertexMat.Colum1 = topRight;
|
||||
vertexMat.Colum2 = bottomRight;
|
||||
vertexMat.Colum3 = bottomLeft;
|
||||
|
||||
Vector4 maxCoord = vertexMat.mat.colum0;
|
||||
Vector4 minCoord = vertexMat.mat.colum0;
|
||||
|
||||
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum1);
|
||||
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum2);
|
||||
maxCoord = Vector4.Max(maxCoord, vertexMat.mat.colum3);
|
||||
|
||||
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum1);
|
||||
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum2);
|
||||
minCoord = Vector4.Min(minCoord, vertexMat.mat.colum3);
|
||||
|
||||
textureFrame.mat.colum1 = maxCoord;
|
||||
textureFrame.mat.colum3 = minCoord;
|
||||
textureFrame.Colum0 = new Vec2d(minCoord.X, maxCoord.Y);
|
||||
textureFrame.Colum2 = new Vec2d(maxCoord.X, minCoord.Y);
|
||||
}
|
||||
|
||||
public Polygon4(
|
||||
float v0x, float v0y, float v0z,
|
||||
float v1x, float v1y, float v1z,
|
||||
@@ -35,20 +66,7 @@ namespace StgSharp.Geometries
|
||||
public GetLocationHandler MovVertex2Operaion { get { return moveVertex2Operation; } }
|
||||
public GetLocationHandler MovVertex3Operaion { get { return moveVertex3Operation; } }
|
||||
|
||||
public override Point RefPoint0
|
||||
{
|
||||
get { return new Point(vertexMat.mat.colum0); }
|
||||
}
|
||||
|
||||
public override Point RefPoint1
|
||||
{
|
||||
get { return new Point(vertexMat.mat.colum1); }
|
||||
}
|
||||
|
||||
public override Point RefPoint2
|
||||
{
|
||||
get { return new Point(vertexMat.mat.colum2); }
|
||||
}
|
||||
|
||||
internal sealed override int[] Indices
|
||||
{
|
||||
@@ -89,6 +107,7 @@ namespace StgSharp.Geometries
|
||||
set { vertexMat.mat.colum1 = value.position.vec; }
|
||||
}
|
||||
|
||||
|
||||
public override Line[] GetAllSides()
|
||||
{
|
||||
Line[] sides = new Line[4]
|
||||
@@ -112,25 +131,22 @@ namespace StgSharp.Geometries
|
||||
}
|
||||
|
||||
public virtual vec3d MoveVertex0(uint tick)
|
||||
=> moveVertex0Operation.Invoke(tick);
|
||||
=> moveVertex0Operation(tick);
|
||||
|
||||
public virtual vec3d MoveVertex1(uint tick)
|
||||
=> moveVertex1Operation.Invoke(tick);
|
||||
=> moveVertex1Operation(tick);
|
||||
|
||||
public virtual vec3d MoveVertex2(uint tick)
|
||||
=> moveVertex2Operation.Invoke(tick);
|
||||
=> moveVertex2Operation(tick);
|
||||
|
||||
public virtual vec3d MoveVertex3(uint tick)
|
||||
=> moveVertex3Operation.Invoke(tick);
|
||||
=> moveVertex3Operation(tick);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
uint nowTick = TimeLine.tickCounter._value;
|
||||
this.vertexMat.Colum0 = RefOrigin.position + moveVertex1Operation(nowTick);
|
||||
this.vertexMat.Colum1 = RefOrigin.position + moveVertex1Operation(nowTick);
|
||||
this.vertexMat.Colum2 = RefOrigin.position + moveVertex2Operation(nowTick);
|
||||
this.vertexMat.Colum3 = RefOrigin.position + moveVertex3Operation(nowTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,6 @@ namespace StgSharp.Geometries
|
||||
public GetLocationHandler MovP04Operation { get => movP04Operation; }
|
||||
public GetLocationHandler MovP05Operation { get => movP05Operation; }
|
||||
|
||||
public override Point RefPoint0 => Vertex0;
|
||||
public override Point RefPoint1 => Vertex1;
|
||||
public override Point RefPoint2 => Vertex2;
|
||||
|
||||
public mat5 VertexBuffer
|
||||
{
|
||||
get { return vertexMat; }
|
||||
@@ -118,14 +114,14 @@ namespace StgSharp.Geometries
|
||||
public virtual vec3d movVertex05(uint tick) => movP05Operation.Invoke(TimeLine.tickCounter._value);
|
||||
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
vertexMat.vec0 = (RefOrigin.Position + movVertex01(nowTick)).vec;
|
||||
vertexMat.vec1 = (RefOrigin.Position + movVertex02(nowTick)).vec;
|
||||
vertexMat.vec2 = (RefOrigin.Position + movVertex03(nowTick)).vec;
|
||||
vertexMat.vec3 = (RefOrigin.Position + movVertex04(nowTick)).vec;
|
||||
vertexMat.vec4 = (RefOrigin.Position + movVertex05(nowTick)).vec;
|
||||
vertexMat.vec0 = (coordinate.origin + movVertex01(nowTick)).vec;
|
||||
vertexMat.vec1 = (coordinate.origin + movVertex02(nowTick)).vec;
|
||||
vertexMat.vec2 = (coordinate.origin + movVertex03(nowTick)).vec;
|
||||
vertexMat.vec3 = (coordinate.origin + movVertex04(nowTick)).vec;
|
||||
vertexMat.vec4 = (coordinate.origin + movVertex05(nowTick)).vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace StgSharp.Geometries
|
||||
internal GetLocationHandler movVertex5Operation;
|
||||
internal mat6 vertexMat;
|
||||
|
||||
|
||||
public GetLocationHandler MovVertex0Operation { get => movVertex0Operation; }
|
||||
public GetLocationHandler MovVertex1Operation { get => movVertex1Operation; }
|
||||
public GetLocationHandler MovVertex2Operation { get => movVertex2Operation; }
|
||||
@@ -24,10 +23,6 @@ namespace StgSharp.Geometries
|
||||
public GetLocationHandler MovVertex4Operation { get => movVertex4Operation; }
|
||||
public GetLocationHandler MovVertex5Operation { get => movVertex5Operation; }
|
||||
|
||||
public override Point RefPoint0 => Vertex0;
|
||||
public override Point RefPoint1 => Vertex1;
|
||||
public override Point RefPoint2 => Vertex2;
|
||||
|
||||
internal override int[] Indices
|
||||
{
|
||||
get
|
||||
@@ -124,10 +119,10 @@ namespace StgSharp.Geometries
|
||||
return movVertex5Operation.Invoke(TimeLine.tickCounter._value);
|
||||
}
|
||||
|
||||
internal override void OnRender(uint tick)
|
||||
internal override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
uint nowTick = tick - BornTime;
|
||||
Vector4 origin = RefOrigin.Position.vec;
|
||||
Vector4 origin = coordinate.origin.vec;
|
||||
vertexMat.vec0 = origin + movVertex0(nowTick).vec;
|
||||
vertexMat.vec1 = origin + movVertex1(nowTick).vec;
|
||||
vertexMat.vec2 = origin + movVertex2(nowTick).vec;
|
||||
|
||||
@@ -19,16 +19,14 @@ namespace StgSharp.Geometries
|
||||
v3x, v2y, v3z
|
||||
)
|
||||
{
|
||||
vec3d side0 = vertexMat.Colum0 - vertexMat.Colum1;
|
||||
vec3d side1 = vertexMat.Colum2 - vertexMat.Colum1;
|
||||
if (side0.Cross(side1) == Vec3d.Zero)
|
||||
Vec2d side0 = vertexMat.Colum0 - vertexMat.Colum1;
|
||||
Vec2d side1 = vertexMat.Colum2 - vertexMat.Colum1;
|
||||
if (side0.Cross(side1) == 0)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 计算中心点相对于参考原点的位移
|
||||
/// </summary>
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace StgSharp.Geometries
|
||||
|
||||
public sealed override vec3d MoveVertex1(uint tick)
|
||||
{
|
||||
return this.center.Position * 2 - this.vertexMat.Colum0;
|
||||
return default;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ namespace StgSharp.Geometries
|
||||
public GetLocationHandler MovVertex01Operation => this.movVertex01Opearion;
|
||||
public GetLocationHandler MovVertex02Operation => this.movVertex02Opearion;
|
||||
public GetLocationHandler MovVertex03Operation => this.movVertex03Opearion;
|
||||
public sealed override Point RefPoint0 => new Point(vertexMat.mat.colum0);
|
||||
public sealed override Point RefPoint1 => new Point(vertexMat.mat.colum1);
|
||||
public sealed override Point RefPoint2 => new Point(vertexMat.mat.colum2);
|
||||
|
||||
public Mat3 VertexBuffer
|
||||
{
|
||||
@@ -81,12 +78,13 @@ namespace StgSharp.Geometries
|
||||
public virtual vec3d MovVertex02(uint tick) => movVertex02Opearion.Invoke(tick);
|
||||
|
||||
public virtual vec3d MovVertex03(uint tick) => movVertex03Opearion.Invoke(tick);
|
||||
internal sealed override void OnRender(uint tick)
|
||||
|
||||
internal sealed override void UpdateCoordinate(uint tick)
|
||||
{
|
||||
tick -= this.bornTick;
|
||||
vertexMat.mat.colum0 = RefOrigin.Position.vec + MovVertex01(tick).vec;
|
||||
vertexMat.mat.colum1 = RefOrigin.Position.vec + MovVertex02(tick).vec;
|
||||
vertexMat.mat.colum2 = RefOrigin.Position.vec + MovVertex03(tick).vec;
|
||||
vertexMat.mat.colum0 = coordinate.origin.vec + MovVertex01(tick).vec;
|
||||
vertexMat.mat.colum1 = coordinate.origin.vec + MovVertex02(tick).vec;
|
||||
vertexMat.mat.colum2 = coordinate.origin.vec + MovVertex03(tick).vec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
*/
|
||||
|
||||
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
@@ -1900,7 +1902,7 @@ namespace StgSharp.Graphics
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexGenxOES(uint coord, uint pname, int param);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexGenxvOES(uint coord, uint pname, int* param);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage1D(uint target, int level, int internalformat, int width, int border, uint format, uint type, void* pixels);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage2D(uint target, int level, int internalformat, int width, int height, int border, uint format, uint type, void* pixels);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage2D(uint target, int level, uint internalformat, int width, int height, int border, uint format, uint type, void* pixels);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage2DMultisample(uint target, int samples, uint internalformat, int width, int height, bool fixedsamplelocations);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage2DMultisampleCoverageNV(uint target, int coverageSamples, int colorSamples, int internalFormat, int width, int height, bool fixedSampleLocations);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glTexImage3D(uint target, int level, int internalformat, int width, int height, int depth, int border, uint format, uint type, void* pixels);
|
||||
@@ -2013,7 +2015,7 @@ namespace StgSharp.Graphics
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1dv(int location, int count, double* value);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1f(int location, float v0);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1fARB(int location, float v0);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1fv(int location, int count, float* value);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1fv(int location, int count, M128F* value);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1fvARB(int location, int count, float* value);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1i(int location, int v0);
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)] internal unsafe delegate void glUniform1i64ARB(int location, long x);
|
||||
|
||||
@@ -9,7 +9,6 @@ namespace StgSharp.Graphics
|
||||
|
||||
#region glfw
|
||||
|
||||
|
||||
internal const int GLFW_VERSION_MAJOR = 3;
|
||||
internal const int GLFW_VERSION_MINOR = 3;
|
||||
internal const int GLFW_VERSION_REVISION = 8;
|
||||
@@ -308,10 +307,6 @@ namespace StgSharp.Graphics
|
||||
#region glad
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
internal const int _1PASS_EXT = 0x80A1;
|
||||
internal const int _1PASS_SGIS = 0x80A1;
|
||||
internal const int _2PASS_0_EXT = 0x80A2;
|
||||
|
||||
@@ -49,7 +49,18 @@
|
||||
{
|
||||
ARRAY_BUFFER = 0x8892,
|
||||
ELEMENT_ARRAY_BUFFER = 0x8893,
|
||||
ARRAY_BUFFER_BINDING = 0x8894
|
||||
ATOMIC_COUNTER_BUFFER = GLconst.ATOMIC_COUNTER_BUFFER,
|
||||
COPY_READ_BUFFER = GLconst.COPY_READ_BUFFER,
|
||||
COPY_WRITE_BUFFER = GLconst.COPY_WRITE_BUFFER,
|
||||
DISPATCH_INDIRECT_BUFFER = GLconst.DISPATCH_INDIRECT_BUFFER,
|
||||
DRAW_INDIRECT_BUFFER = GLconst.DRAW_INDIRECT_BUFFER,
|
||||
PIXEL_PACK_BUFFER = GLconst.PIXEL_PACK_BUFFER,
|
||||
PIXEL_UNPACK_BUFFER = GLconst.PIXEL_UNPACK_BUFFER,
|
||||
QUERY_BUFFER = GLconst.QUERY_BUFFER,
|
||||
SHADER_STORAGE_BUFFER = GLconst.SHADER_STORAGE_BUFFER,
|
||||
TEXTURE_BUFFER = GLconst.TEXTURE_BUFFER,
|
||||
TRANSFORM_FEEDBACK_BUFFER = GLconst.TRANSFORM_FEEDBACK_BUFFER,
|
||||
UNIFORM_BUFFER = GLconst.UNIFORM_BUFFER,
|
||||
}
|
||||
|
||||
public enum BufferUsage : int
|
||||
@@ -65,6 +76,13 @@
|
||||
DYNAMIC_COPY = 0x88EA
|
||||
}
|
||||
|
||||
public enum MaskBufferBit
|
||||
{
|
||||
COLOR = GLconst.COLOR_BUFFER_BIT,
|
||||
DEPTH = GLconst.DEPTH_BUFFER_BIT,
|
||||
STENCIL = GLconst.STENCIL_BUFFER_BIT,
|
||||
}
|
||||
|
||||
public enum GepmetryType : int
|
||||
{
|
||||
POINTS = 0x0000,
|
||||
@@ -76,5 +94,9 @@
|
||||
TRIANGLE_FAN = 0x0006
|
||||
}
|
||||
|
||||
|
||||
public enum TextureFiltering
|
||||
{
|
||||
Nearest = 0x2600,
|
||||
Linear = 0x2601
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
using StgSharp.Math;
|
||||
using StgSharp.Controlling;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
@@ -22,38 +21,29 @@ namespace StgSharp.Graphics
|
||||
public string name;
|
||||
}
|
||||
|
||||
public unsafe partial class Form
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public unsafe abstract partial class Form
|
||||
{
|
||||
|
||||
internal LinkedList<Pool> allControl;
|
||||
internal LinkedList<Control> allControl;
|
||||
internal Vector4 color;
|
||||
internal Thread formThread;
|
||||
internal int height;
|
||||
internal IntPtr monitor;
|
||||
internal string name;
|
||||
internal Form sharedForm = null;
|
||||
internal Form sharedForm;
|
||||
internal int width;
|
||||
internal IntPtr windowID = default;
|
||||
internal IntPtr windowID;
|
||||
protected IglFunc GL;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor of a Form, creats an instance of a form and
|
||||
/// initilize all the customizing operations.
|
||||
/// </summary>
|
||||
public Form(int width, int height, string name, IntPtr monitor, Form sharedForm)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.name = name;
|
||||
this.sharedForm = sharedForm;
|
||||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
internal Form()
|
||||
{ }
|
||||
private GLonRender glRender;
|
||||
private GLonUpdate glUpdate;
|
||||
|
||||
~Form()
|
||||
{
|
||||
GL.gl = default;
|
||||
Marshal.FreeHGlobal((IntPtr)contextID);
|
||||
glRender.api = default;
|
||||
}
|
||||
|
||||
public int Height
|
||||
@@ -78,10 +68,53 @@ namespace StgSharp.Graphics
|
||||
set => width = value;
|
||||
}
|
||||
|
||||
#region form main
|
||||
|
||||
public abstract void Deinit(object[] args);
|
||||
|
||||
public abstract void Init(object[] args);
|
||||
|
||||
public abstract void OnRenderFrame(object[] args);
|
||||
|
||||
public abstract void OnUpdateFrame(object[] args);
|
||||
|
||||
internal void internalShowForm(object arg)
|
||||
{
|
||||
object[] args = (object[])arg;
|
||||
Init((object[])args[0]);
|
||||
while (InternalIO.glfw.WindowShouldClose(windowID) == 0)
|
||||
{
|
||||
OnUpdateFrame((object[])args[1]);
|
||||
}
|
||||
Deinit((object[])args[2]);
|
||||
}
|
||||
|
||||
internal void InternalUpdateFrame(object args)
|
||||
{
|
||||
OnUpdateFrame((object[])args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// Constructor of a Form, creats an instance of a form and
|
||||
/// initilize all the customizing operations.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public void InitForm(int width, int height, string name, IntPtr monitor, Form sharedForm)
|
||||
{
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.name = name;
|
||||
this.sharedForm = sharedForm;
|
||||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init an OpenGl context if current form has not been binded to any context.
|
||||
/// and set the context binded to current form as current OpenGL context.
|
||||
/// </summary>
|
||||
/// <exception cref="Exception">Something goes wrong and
|
||||
/// StgSharp fails in creating a new OpenGL context. </exception>
|
||||
public void MakeAsCurrentContext()
|
||||
{
|
||||
if (windowID == default)
|
||||
@@ -107,6 +140,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
windowID = windowPtr;
|
||||
}
|
||||
glRender = new GLonRender();
|
||||
glContext = new GLcontext();
|
||||
IntPtr ptr = Marshal.AllocHGlobal(sizeof(GLcontextIO));
|
||||
contextID = (GLcontextIO*)ptr;
|
||||
@@ -114,10 +148,10 @@ namespace StgSharp.Graphics
|
||||
InternalIO.InternalWriteLog("Successfully create a context binded to current form. " +
|
||||
$"Its ID is {(ulong)ptr}", LogType.Info);
|
||||
}
|
||||
GL.gl = glContext;
|
||||
InternalIO.InternalSetCurrentGLContext(windowID, (IntPtr)contextID);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Resize the current form
|
||||
/// </summary>
|
||||
@@ -172,5 +206,28 @@ namespace StgSharp.Graphics
|
||||
this.windowID,
|
||||
(int)minSize.X, (int)minSize.Y, (int)maxSize.X, (int)maxSize.Y);
|
||||
}
|
||||
|
||||
public void ShowForm(
|
||||
object[] initArgs,
|
||||
object[] updateArgs,
|
||||
object[] deinitArgs)
|
||||
{
|
||||
Thread t = new Thread(new ParameterizedThreadStart(internalShowForm));
|
||||
t.Start(new object[] { initArgs, updateArgs, deinitArgs });
|
||||
}
|
||||
|
||||
public void ShowForm()
|
||||
{
|
||||
Thread t = new Thread(new ParameterizedThreadStart(internalShowForm));
|
||||
t.Start(new object[3] { null, null, null });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bind this form to StgSharp platform.
|
||||
/// </summary>
|
||||
protected void BindToPlatform()
|
||||
{
|
||||
TimeLine.allForm.Add(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,46 +6,54 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal unsafe class ElementBuffer : IDisposable
|
||||
public partial class Form
|
||||
{
|
||||
uint[] _bufferID;
|
||||
|
||||
|
||||
public ElementBuffer(int n)
|
||||
protected ElementBuffer CreateElementBuffer(int n)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* id = _bufferID)
|
||||
return new ElementBuffer(n, GL);
|
||||
}
|
||||
|
||||
protected unsafe class ElementBuffer : IDisposable
|
||||
{
|
||||
uint[] _bufferID;
|
||||
private IglFunc GL;
|
||||
|
||||
internal ElementBuffer(int n, IglFunc glFunc)
|
||||
{
|
||||
GL.gl.GenBuffers(n, id);
|
||||
_bufferID = new uint[n];
|
||||
GL = glFunc;
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.GenBuffers(n, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint this[int n]
|
||||
{
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl.BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
|
||||
public void SetData<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
GL.gl.BindBuffer(GLconst.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
public uint this[int n]
|
||||
{
|
||||
GL.gl.DeleteBuffers(1, id);
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
public void SetValue<T>(int index, T[] bufferArray, BufferUsage usage)
|
||||
where T : struct, IConvertible
|
||||
{
|
||||
GL.BindBuffer(BufferType.ELEMENT_ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ELEMENT_ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferID.Length, id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal class Shader
|
||||
{
|
||||
public readonly uint programID;
|
||||
internal uint vertexShaderID;
|
||||
internal uint fragmentShaderID;
|
||||
|
||||
public unsafe Shader()
|
||||
{
|
||||
programID = GL.gl.CreateProgram();
|
||||
}
|
||||
|
||||
public unsafe void CompileVertexShader(string shaderCode)
|
||||
{
|
||||
vertexShaderID = GL.CompileShader(shaderCode, ShaderType.VERTEX);
|
||||
GL.gl.AttachShader(programID, vertexShaderID);
|
||||
}
|
||||
|
||||
public unsafe void CompileFragmentShader(string shaderCode)
|
||||
{
|
||||
fragmentShaderID = GL.CompileShader(shaderCode, ShaderType.FRAGMENT);
|
||||
GL.gl.AttachShader(programID, fragmentShaderID);
|
||||
}
|
||||
|
||||
public void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(programID) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
string log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe void Use()
|
||||
{
|
||||
GL.gl.UseProgram(programID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics.Buffer
|
||||
{
|
||||
public struct ShaderParameter<T>
|
||||
{
|
||||
private static readonly string[] supportedType = new string[] {
|
||||
"Single",
|
||||
"Int32",
|
||||
"Uint32",
|
||||
"Single*"
|
||||
};
|
||||
|
||||
internal int signiture;
|
||||
public readonly string name;
|
||||
|
||||
internal ShaderParameter(string name, int sign)
|
||||
{
|
||||
if (ShaderParameter<T>.supportedType.Contains(typeof(T).Name))
|
||||
{
|
||||
InternalIO.InternalWriteLog($"Invalid type of ShaderProgram named {name}.", LogType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
signiture = sign;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,50 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal unsafe struct VertexArray : IDisposable
|
||||
public partial class Form
|
||||
{
|
||||
internal uint[] _bufferID;
|
||||
|
||||
public VertexArray(int n)
|
||||
protected VertexArray CreateVertexArray(int n)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* id = _bufferID)
|
||||
return new VertexArray(n, GL);
|
||||
}
|
||||
|
||||
protected unsafe struct VertexArray : IDisposable
|
||||
{
|
||||
internal uint[] _bufferID;
|
||||
private IglFunc GL;
|
||||
|
||||
internal VertexArray(int n, IglFunc glFunc)
|
||||
{
|
||||
GL.gl.GenVertexArrays(n, id);
|
||||
_bufferID = new uint[n];
|
||||
GL = glFunc;
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.GenVertexArrays(n, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint this[int n]
|
||||
{
|
||||
get
|
||||
public uint this[int n]
|
||||
{
|
||||
return _bufferID[n];
|
||||
get
|
||||
{
|
||||
return _bufferID[n];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl.BindVertexArray(_bufferID[index]);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl.DeleteVertexArrays(_bufferID.Length, id);
|
||||
GL.BindVertexArray(_bufferID[index]);
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.DeleteVertexArrays(_bufferID.Length, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
|
||||
{
|
||||
GL.gl.VertexAttribPointer(
|
||||
index, vertexLength, InternalIO.GLtype[dataType],
|
||||
isNomalized,
|
||||
stride, (void*)pointer);
|
||||
public void BindNull()
|
||||
{
|
||||
GL.BindVertexArray(0);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void SetVertexAttribute(uint index, int vertexLength, Type dataType, bool isNomalized, int stride, int pointer)
|
||||
{
|
||||
GL.SetVertexAttribute(
|
||||
index, vertexLength, dataType,
|
||||
isNomalized,
|
||||
stride, pointer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,69 +1,80 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Security;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe struct VertexBuffer : IDisposable
|
||||
public partial class Form
|
||||
{
|
||||
internal uint[] _bufferID;
|
||||
|
||||
|
||||
public VertexBuffer(int n)
|
||||
protected VertexBuffer CreateVertexBuffer(int n)
|
||||
{
|
||||
_bufferID = new uint[n];
|
||||
fixed (uint* ptr = _bufferID)
|
||||
return new VertexBuffer(n, GL);
|
||||
}
|
||||
|
||||
protected unsafe struct VertexBuffer : IDisposable
|
||||
{
|
||||
internal uint[] _bufferID;
|
||||
private IglFunc GL;
|
||||
|
||||
internal VertexBuffer(int n, IglFunc glFunc)
|
||||
{
|
||||
GL.gl.GenBuffers(n, ptr);
|
||||
_bufferID = new uint[n];
|
||||
GL = glFunc;
|
||||
fixed (uint* ptr = _bufferID)
|
||||
{
|
||||
GL.GenBuffers(n, ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public uint this[int n]
|
||||
{
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public static void Unbind()
|
||||
{
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
public uint this[int n]
|
||||
{
|
||||
GL.gl.DeleteBuffers(_bufferID.Length, id);
|
||||
get { return _bufferID[n]; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="bufferData"></param>
|
||||
/// <param name="readType"></param>
|
||||
public void SetData<T>(int index, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
GL.gl.BindBuffer((int)BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public void Unbind()
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
}
|
||||
public void Bind(int index)
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
}
|
||||
|
||||
public void SetDataArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
GL.gl.BindBuffer(GLconst.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
public void Dispose()
|
||||
{
|
||||
fixed (uint* id = _bufferID)
|
||||
{
|
||||
GL.DeleteBuffers(_bufferID.Length, id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="bufferData"></param>
|
||||
/// <param name="readType"></param>
|
||||
public void SetValue<T>(int index, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferData, usage);
|
||||
|
||||
}
|
||||
|
||||
public void SetValueArray<T>(int index, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
GL.BindBuffer(BufferType.ARRAY_BUFFER, _bufferID[index]);
|
||||
GL.SetBufferData(BufferType.ARRAY_BUFFER, bufferArray, usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,27 +1,148 @@
|
||||
using System;
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe class Texture
|
||||
public partial class Form
|
||||
{
|
||||
internal uint[] textureId;
|
||||
|
||||
public Texture(int n)
|
||||
protected Texture CreateTexture(int n)
|
||||
{
|
||||
textureId = new uint[n];
|
||||
fixed (uint* id = textureId)
|
||||
{
|
||||
GL.gl.GenTextures(n, id);
|
||||
}
|
||||
return new Texture(n, GL);
|
||||
}
|
||||
|
||||
public void Bind(int index)
|
||||
protected unsafe class Texture
|
||||
{
|
||||
GL.gl.BindTexture(GLconst.PROXY_TEXTURE_2D, textureId[index]);
|
||||
internal uint[] textureId;
|
||||
internal Image[] sourceList;
|
||||
internal static bool[] unitActivated = new bool[16];
|
||||
private IglFunc GL;
|
||||
|
||||
internal Texture(int n, IglFunc glFunc)
|
||||
{
|
||||
textureId = new uint[n];
|
||||
sourceList = new Image[n];
|
||||
GL = glFunc;
|
||||
fixed (uint* id = textureId)
|
||||
{
|
||||
GL.GenTextures(n, id);
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind2D(int index)
|
||||
{
|
||||
GL.BindTexture(GLconst.TEXTURE_2D, textureId[index]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="loader"></param>
|
||||
public unsafe void LoadTexture(int index, string name, ImageLoader loader)
|
||||
{
|
||||
sourceList[index] = new Image();
|
||||
fixed (Image.ImageInfo* textureInfo = &sourceList[index].info)
|
||||
{
|
||||
InternalIO.InternalLoadImage(name, textureInfo, loader);
|
||||
}
|
||||
|
||||
if (sourceList[index].info.pixelPtr != IntPtr.Zero)
|
||||
{
|
||||
uint channel;
|
||||
switch (sourceList[index].info.channel)
|
||||
{
|
||||
case 1:
|
||||
channel = GLconst.RED; break;
|
||||
case 2:
|
||||
channel = GLconst.RG; break;
|
||||
case 3:
|
||||
channel = GLconst.RGB; break;
|
||||
case 4:
|
||||
channel = GLconst.RGBA; break;
|
||||
default:
|
||||
channel = 0;
|
||||
break;
|
||||
}
|
||||
GL.TextureImage2d(
|
||||
GLconst.TEXTURE_2D, 0, channel,
|
||||
sourceList[index].Width, sourceList[index].Height,
|
||||
channel, GLconst.UNSIGNED_BYTE, (byte*)sourceList[index].info.pixelPtr
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog($"Failed to load image file of \"{name}\".", LogType.Error);
|
||||
}
|
||||
}
|
||||
|
||||
#region texture set
|
||||
|
||||
public void Set2dFilterProperty(
|
||||
Filter onMinify, Filter onMagnify)
|
||||
{
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MIN_FILTER, (int)onMinify);
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_MAG_FILTER, (int)onMagnify);
|
||||
}
|
||||
|
||||
public void Set2dWrapProperty(
|
||||
Wrap onHorizontial, Wrap onVertical)
|
||||
{
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_S, (int)onHorizontial);
|
||||
GL.TextureParameter(GLconst.TEXTURE_2D, GLconst.TEXTURE_WRAP_T, (int)onVertical);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Activate(TextureUnit unit)
|
||||
{
|
||||
GL.ActiveTexture((uint)unit);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public enum TextureUnit
|
||||
{
|
||||
Unit0 = GLconst.TEXTURE0,
|
||||
Unit1 = GLconst.TEXTURE1,
|
||||
Unit2 = GLconst.TEXTURE2,
|
||||
Unit3 = GLconst.TEXTURE3,
|
||||
Unit4 = GLconst.TEXTURE4,
|
||||
Unit5 = GLconst.TEXTURE5,
|
||||
Unit6 = GLconst.TEXTURE6,
|
||||
Unit7 = GLconst.TEXTURE7,
|
||||
Unit8 = GLconst.TEXTURE8,
|
||||
Unit9 = GLconst.TEXTURE9,
|
||||
Unit10 = GLconst.TEXTURE10,
|
||||
Unit11 = GLconst.TEXTURE11,
|
||||
Unit12 = GLconst.TEXTURE12,
|
||||
Unit13 = GLconst.TEXTURE13,
|
||||
Unit14 = GLconst.TEXTURE14,
|
||||
Unit15 = GLconst.TEXTURE15,
|
||||
}
|
||||
|
||||
public enum Wrap
|
||||
{
|
||||
Repeat = GLconst.REPEAT,
|
||||
MirroredRepeat = GLconst.MIRRORED_REPEAT,
|
||||
ClampToEdge = GLconst.CLAMP_TO_EDGE,
|
||||
ClampToBorder = GLconst.CLAMP_TO_BORDER,
|
||||
}
|
||||
|
||||
public enum Filter
|
||||
{
|
||||
Nearest = GLconst.NEAREST,
|
||||
Linear = GLconst.LINEAR,
|
||||
Nearest_LinearMipmap = GLconst.NEAREST_MIPMAP_LINEAR,
|
||||
Linear_LinearMipmap = GLconst.LINEAR_MIPMAP_LINEAR,
|
||||
Nearest_NearestMipmap = GLconst.NEAREST_MIPMAP_NEAREST,
|
||||
Linear_NearestMipmap = GLconst.LINEAR_MIPMAP_NEAREST,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,11 +9,16 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public unsafe partial class Form
|
||||
{
|
||||
internal GLcontext glContext;
|
||||
internal GLcontextIO* contextID;
|
||||
|
||||
private int missingAPIcount = 0;
|
||||
private int problemAPIcount = 0;
|
||||
|
||||
internal GLcontext glContext
|
||||
{
|
||||
get { return glRender.api; }
|
||||
set { glRender.api = value; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,46 +7,57 @@ using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public static unsafe partial class GL
|
||||
|
||||
internal unsafe partial class GLonRender : IglFunc
|
||||
{
|
||||
internal unsafe static GLcontext gl;
|
||||
internal GLcontext api;
|
||||
|
||||
/// <summary>
|
||||
/// sets the framebuffer resize callback of the specified <see cref="Form"/>,
|
||||
///which is called when the framebuffer of the specified <see cref="Form"/> is resized.
|
||||
/// </summary>
|
||||
/// <param name="form">The Form instance to be controlled</param>
|
||||
/// <param name="handler">Method hadler </param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void SetFrameBufferSizeCallback(Form form, FrameBufferSizeHandler handler)
|
||||
void IglFunc.ActiveTexture(uint type)
|
||||
{
|
||||
InternalIO.glfw.SetFramebufferSizeCallback(form.windowID, handler);
|
||||
api.ActiveTexture(type);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Call glClearColor in OpenGL
|
||||
/// specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
/// Values specified by glClearColor are clamped to the range [0,1]
|
||||
/// </summary>
|
||||
/// <param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void ClearColor(float R, float G, float B, float A)
|
||||
void IglFunc.AttachShader(uint program, uint shader)
|
||||
{
|
||||
gl.ClearColor(R, G, B, A);
|
||||
api.AttachShader(program, shader);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conpile the provided shader code in string form.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">A string represent the shader's code</param>
|
||||
/// <param name="shaderType">An <see cref="ShaderType"/> enum represent the type of the shader to
|
||||
/// conpile, including vertex shader and fragment shader.</param>
|
||||
/// <returns>An uint value as the only mark of conpiled shader</returns>
|
||||
public static uint CompileShader(string shaderCode, ShaderType shaderType)
|
||||
void IglFunc.BindBuffer(BufferType bufferType, uint index)
|
||||
{
|
||||
api.BindBuffer((uint)bufferType, index);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.BindTexture(uint type, uint texture)
|
||||
{
|
||||
api.BindTexture(type, texture);
|
||||
}
|
||||
|
||||
void IglFunc.BindVertexArray(uint index)
|
||||
{
|
||||
api.BindVertexArray(index);
|
||||
}
|
||||
|
||||
void IglFunc.Clear(MaskBufferBit mask)
|
||||
{
|
||||
api.Clear((uint)mask);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.ClearColor(float R, float G, float B, float A)
|
||||
{
|
||||
api.ClearColor(R, G, B, A);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.ClearGraphicError()
|
||||
{
|
||||
while (api.GetError() != 0) { }
|
||||
}
|
||||
|
||||
uint IglFunc.CompileShader(string shaderCode, ShaderType shaderType)
|
||||
{
|
||||
uint shaderID;
|
||||
shaderCode += '\0';
|
||||
@@ -86,17 +97,13 @@ namespace StgSharp.Graphics
|
||||
return shaderID;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a form and its associated
|
||||
/// </summary>
|
||||
/// <param name="width">Required width</param>
|
||||
/// <param name="height">Required width</param>
|
||||
/// <param name="tittle">Tittle of the window </param>
|
||||
/// <param name="monitor"></param>
|
||||
/// <param name="share"></param>
|
||||
/// <returns>The instance of created form</returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
public static unsafe Form CreateWindow(
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
uint IglFunc.CreateProgram()
|
||||
{
|
||||
return api.CreateProgram();
|
||||
}
|
||||
|
||||
unsafe IntPtr IglFunc.CreateWindowHandle(
|
||||
int width, int height, string tittle, IntPtr monitor, Form share)
|
||||
{
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(tittle);
|
||||
@@ -118,22 +125,29 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
else
|
||||
{
|
||||
Form form = new Form();
|
||||
form.Size = new Vec2d(width, height);
|
||||
form.windowID = windowPtr;
|
||||
return form;
|
||||
return windowPtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static unsafe uint CreatGraphicProgram()
|
||||
unsafe uint IglFunc.CreatGraphicProgram()
|
||||
{
|
||||
return gl.CreateProgram();
|
||||
return api.CreateProgram();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.DeleteBuffers(int count, uint* ptr)
|
||||
{
|
||||
api.DeleteBuffers(count, ptr);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr)
|
||||
unsafe void IglFunc.DeleteVertexArrays(int count, uint* ptr)
|
||||
{
|
||||
api.DeleteVertexArrays(count, ptr);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr)
|
||||
{
|
||||
uint a;
|
||||
switch (type.Name)
|
||||
@@ -154,60 +168,31 @@ namespace StgSharp.Graphics
|
||||
LogType.Error);
|
||||
return;
|
||||
}
|
||||
gl.DrawElements((uint)mode, count, a, (void*)ptr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static unsafe bool GetWindowShouldClose(Form form)
|
||||
{
|
||||
return InternalIO.glfw.WindowShouldClose(form.windowID) == 0;
|
||||
}
|
||||
|
||||
|
||||
public static unsafe void GLswapBuffers(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.SwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
|
||||
public static unsafe void MakeContexCurrent(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.MakeContextCurrent(form.windowID);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
int size = sizeof(T);
|
||||
gl.BufferData(
|
||||
(uint)bufferType,
|
||||
size,
|
||||
&bufferData,
|
||||
(uint)usage);
|
||||
api.DrawElements((uint)mode, count, a, (void*)ptr);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void ClearGraphicError()
|
||||
unsafe void IglFunc.GenBuffers(int count, uint* ptr)
|
||||
{
|
||||
while (gl.GetError() != 0) { }
|
||||
api.GenBuffers(count, ptr);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void GetGraphicError()
|
||||
unsafe void IglFunc.GenTextures(int count, uint* ptr)
|
||||
{
|
||||
api.GenTextures(count, ptr);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.GenVertexArrays(int count, uint* ptr)
|
||||
{
|
||||
api.GenVertexArrays(count, ptr);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.GetGraphicError()
|
||||
{
|
||||
string error = null;
|
||||
uint code = gl.GetError();
|
||||
uint code = api.GetError();
|
||||
while (code != 0)
|
||||
{
|
||||
error += $"OpenGL error {code}\n";
|
||||
@@ -232,20 +217,95 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
unsafe int IglFunc.GetUniformLocation(uint program, byte* ptr)
|
||||
{
|
||||
return api.GetUniformLocation(program, ptr);
|
||||
}
|
||||
|
||||
unsafe bool IglFunc.GetWindowShouldClose(Form form)
|
||||
{
|
||||
return InternalIO.glfw.WindowShouldClose(form.windowID) == 0;
|
||||
}
|
||||
|
||||
unsafe void IglFunc.MakeContexCurrent(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.MakeContextCurrent(form.windowID);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
||||
{
|
||||
int size = sizeof(T);
|
||||
api.BufferData(
|
||||
(uint)bufferType,
|
||||
size,
|
||||
&bufferData,
|
||||
(uint)usage);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
unsafe void IglFunc.SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
|
||||
{
|
||||
int size = bufferArray.Length * Marshal.SizeOf(typeof(T));
|
||||
|
||||
fixed (void* bufferPtr = &bufferArray[0])
|
||||
gl.BufferData(
|
||||
api.BufferData(
|
||||
(uint)bufferType,
|
||||
size,
|
||||
bufferPtr,
|
||||
(uint)usage);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler)
|
||||
{
|
||||
InternalIO.glfw.SetFramebufferSizeCallback(id, handler);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.SetVertexAttribute(uint index, int size, Type t, bool normalized, int stride, int pointer)
|
||||
{
|
||||
uint type = InternalIO.GLtype[t];
|
||||
api.VertexAttribPointer(index, size, type, normalized, stride, (void*)pointer);
|
||||
api.EnableVertexAttribArray(index);
|
||||
}
|
||||
|
||||
unsafe void IglFunc.SwapBuffers(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.SwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels)
|
||||
{
|
||||
api.TexImage2D(
|
||||
target, level, internalformat, width, height, 0, format, type, pixels
|
||||
);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.TextureParameter(uint target, uint pname, int param)
|
||||
{
|
||||
api.TexParameteri(target, pname, param);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.UseProgram(uint program)
|
||||
{
|
||||
api.UseProgram(program);
|
||||
}
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
void IglFunc.Viewport(int x, int y, int width, int height)
|
||||
{
|
||||
api.Viewport(x, y, width, height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
using StgSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public partial class Form
|
||||
{
|
||||
/// <summary>
|
||||
/// Create an instance of <see cref="Shader"/> program
|
||||
/// </summary>
|
||||
/// <returns>New instance of <see cref="Shader"/> instance. </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected Shader CreateShader()
|
||||
{
|
||||
return new Shader(GL);
|
||||
}
|
||||
|
||||
public class Shader
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="uint"/> value represent this shader.
|
||||
/// </summary>
|
||||
public readonly uint programID;
|
||||
internal uint vertexShaderID;
|
||||
internal uint fragmentShaderID;
|
||||
private IglFunc GL;
|
||||
|
||||
/// <summary>
|
||||
/// Inti a shader with no program attached.
|
||||
/// </summary>
|
||||
internal unsafe Shader(IglFunc glFunc)
|
||||
{
|
||||
GL = glFunc;
|
||||
programID = GL.CreateProgram();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compile the vertex shader to be attached to this shader.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
public unsafe void CompileVertexShader(string shaderCode)
|
||||
{
|
||||
vertexShaderID = GL.CompileShader(shaderCode, ShaderType.VERTEX);
|
||||
GL.AttachShader(programID, vertexShaderID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compile the fragment shader to be attached to this shader.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">GLSL code of fragment shader.</param>
|
||||
public unsafe void CompileFragmentShader(string shaderCode)
|
||||
{
|
||||
fragmentShaderID = GL.CompileShader(shaderCode, ShaderType.FRAGMENT);
|
||||
GL.AttachShader(programID, fragmentShaderID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Link the shader to current context.
|
||||
/// </summary>
|
||||
public void Link()
|
||||
{
|
||||
if (InternalIO.InternalLinkShaderProgram(programID) == 0)
|
||||
{
|
||||
IntPtr logPtr = InternalIO.InternalReadLog();
|
||||
try
|
||||
{
|
||||
byte[] logByte = new byte[512];
|
||||
Marshal.Copy(logPtr, logByte, 0, 512);
|
||||
string log = Encoding.UTF8.GetString(logByte);
|
||||
log = log.Replace("\0", "");
|
||||
InternalIO.InternalWriteLog(log, LogType.Error);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a uniform form current shader,
|
||||
/// the value type of the uniform should be provided.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
public unsafe Uniform<T> GetUniform<T>(string name) where T : struct
|
||||
{
|
||||
byte[] bytes = Encoding.ASCII.GetBytes(name);
|
||||
int uniform;
|
||||
fixed (byte* ptr = bytes)
|
||||
{
|
||||
uniform = GL.GetUniformLocation(programID, ptr);
|
||||
}
|
||||
if (uniform != -1)
|
||||
{
|
||||
return new Uniform<T>(uniform);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception($"Cannot find the uniform {name} in shader {programID}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Let the current context use this shader.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public unsafe void Use()
|
||||
{
|
||||
GL.UseProgram(programID);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,233 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public class Uniform<T> where T : struct
|
||||
{
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(
|
||||
Form.Shader program, string name, IglFunc gL)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = gL;
|
||||
fixed (byte* ptr = namearray)
|
||||
{
|
||||
id = GL.GetUniformLocation(program.programID, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe Uniform(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class Uniform<T, U>
|
||||
where T : struct
|
||||
where U : struct
|
||||
{
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(
|
||||
Form.Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = glFunc;
|
||||
fixed (byte* ptr = namearray)
|
||||
{
|
||||
id = GL.GetUniformLocation(program.programID, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe Uniform(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Uniform<T, U, V>
|
||||
where T : struct
|
||||
where U : struct
|
||||
where V : struct
|
||||
{
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
public unsafe Uniform(Form.Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
GL = glFunc;
|
||||
fixed (byte* ptr = namearray)
|
||||
{
|
||||
id = GL.GetUniformLocation(program.programID, ptr);
|
||||
}
|
||||
}
|
||||
|
||||
internal unsafe Uniform(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
public class Uniform<T, U, V, W>
|
||||
where T : struct
|
||||
where U : struct
|
||||
where V : struct
|
||||
where W : struct
|
||||
{
|
||||
internal int id;
|
||||
private IglFunc GL;
|
||||
|
||||
internal unsafe Uniform(Form.Shader program, string name, IglFunc glFunc)
|
||||
{
|
||||
byte[] namearray = Encoding.ASCII.GetBytes(name);
|
||||
fixed (byte* ptr = namearray)
|
||||
{
|
||||
id = GL.GetUniformLocation(program.programID, ptr);
|
||||
}
|
||||
GL = glFunc;
|
||||
}
|
||||
|
||||
internal unsafe Uniform(int id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal partial class GLonRender : IglFunc
|
||||
{
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="v0">The value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
api.Uniform1f(uniform.id, v0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a int <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are int.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="i0">The value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
{
|
||||
api.Uniform1i(uniform.id, i0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
{
|
||||
api.Uniform2f(uniform.id, v0, v1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
/// <param name="v2">The third value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
{
|
||||
api.Uniform3f(uniform.id, v0, v1, v2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
||||
/// <param name="v0">The first value to be set</param>
|
||||
/// <param name="v1">The second value to be set</param>
|
||||
/// <param name="v2">The third value to be set</param>
|
||||
/// <param name="v3">The forth value to be set</param>
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
{
|
||||
api.Uniform4f(uniform.id, v0, v1, v2, v3);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T,U,V,W}"/>,
|
||||
/// all types of parameters are float.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T,U,V,W}"/> target</param>
|
||||
/// <param name="vec">A <see cref="Vec4d"/> packing four parameters of the uniform </param>
|
||||
public unsafe void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
api.Uniform1fv(uniform.id, 4, &vec.fvec);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set data value to a float <see cref="Uniform{T}"/>,
|
||||
/// all types of parameters are <see cref="Vec4d"/>.
|
||||
/// </summary>
|
||||
/// <param name="uniform">The <see cref="Uniform{T}"/> target</param>
|
||||
/// <param name="vec">A <see cref="Vec4d"/> value of the uniform </param>
|
||||
public unsafe void SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
api.Uniform1fv(uniform.id, 4, &vec.fvec);
|
||||
}
|
||||
}
|
||||
|
||||
internal partial class GLonUpdate
|
||||
{
|
||||
void IglFunc.SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float> uniform, float v0, float v1)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float, float, float, float> uniform, Vec4d vec)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<float> uniform, float v0)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<int> uniform, int i0)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetValue(Uniform<Vec4d> uniform, Vec4d vec)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,17 @@ namespace StgSharp.Graphics
|
||||
|
||||
private static string glExtensionList;
|
||||
|
||||
|
||||
public static unsafe void LoadGLapi(Form form, GLfuncLoader loader)
|
||||
/// <summary>
|
||||
/// Load all aupportable OpenGL APIs and bind them to given <see cref="Form"/> context.
|
||||
/// </summary>
|
||||
/// <param name="form">The <see cref="Form"/> used as current OpenGL context</param>
|
||||
/// <param name="loader">A delegate that can get o</param>
|
||||
public static unsafe void LoadGLapi(this Form form, GLfuncLoader loader)
|
||||
{
|
||||
if (loader == null)
|
||||
{
|
||||
loader = LoadGLfunc;
|
||||
}
|
||||
if (form.contextID->GetString != IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
@@ -775,14 +783,14 @@ namespace StgSharp.Graphics
|
||||
|
||||
}
|
||||
|
||||
internal unsafe static string GetExtensions()
|
||||
internal unsafe static string GetExtensions(this Form form)
|
||||
{
|
||||
if (GL.gl == null)
|
||||
if (form.glContext == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return Marshal.PtrToStringAnsi(
|
||||
GL.gl.GetString(glExtension));
|
||||
form.glContext.GetString(glExtension));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
@@ -0,0 +1,260 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
internal partial class GLonUpdate : IglFunc
|
||||
{
|
||||
void IglFunc.ActiveTexture(uint type)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.AttachShader(uint program, uint shader)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.BindBuffer(BufferType bufferType, uint index)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void IglFunc.BindTexture(uint type, uint texture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.BindVertexArray(uint index)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.Clear(MaskBufferBit mask)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void IglFunc.ClearColor(float R, float G, float B, float A)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.ClearGraphicError()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
uint IglFunc.CompileShader(string shaderCode, ShaderType shaderType)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
uint IglFunc.CreateProgram()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
IntPtr IglFunc.CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share)
|
||||
{
|
||||
byte[] tittleBytes = Encoding.UTF8.GetBytes(tittle);
|
||||
IntPtr windowPtr;
|
||||
if (share == null)
|
||||
{
|
||||
windowPtr = InternalIO.glfw.CreateWindow(
|
||||
width, height, tittleBytes, monitor, IntPtr.Zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
windowPtr = InternalIO.glfw.CreateWindow(
|
||||
width, height, tittleBytes, monitor, share.windowID);
|
||||
}
|
||||
|
||||
if ((long)windowPtr == -1 || (long)windowPtr == -2)
|
||||
{
|
||||
throw new Exception("Cannot create window instance!");
|
||||
}
|
||||
else
|
||||
{
|
||||
return windowPtr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
uint IglFunc.CreatGraphicProgram()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
unsafe void IglFunc.DeleteBuffers(int count, uint* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe void IglFunc.DeleteVertexArrays(int count, uint* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void IglFunc.DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe void IglFunc.GenBuffers(int count, uint* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe void IglFunc.GenTextures(int count, uint* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe void IglFunc.GenVertexArrays(int count, uint* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void GetGraphicError()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.GetGraphicError()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public unsafe int GetUniformLocation(uint program, byte* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe int IglFunc.GetUniformLocation(uint program, byte* ptr)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool GetWindowShouldClose(Form form)
|
||||
{
|
||||
return InternalIO.glfw.WindowShouldClose(form.windowID) == 0;
|
||||
}
|
||||
|
||||
bool IglFunc.GetWindowShouldClose(Form form)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void GLswapBuffers(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.SwapBuffers(form.windowID);
|
||||
}
|
||||
|
||||
public void MakeContexCurrent(Form form)
|
||||
{
|
||||
if (form.windowID == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
}
|
||||
InternalIO.glfw.MakeContextCurrent(form.windowID);
|
||||
}
|
||||
|
||||
void IglFunc.MakeContexCurrent(Form form)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage) where T : IMat
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler)
|
||||
{
|
||||
InternalIO.glfw.SetFramebufferSizeCallback(id, handler);
|
||||
}
|
||||
|
||||
void IglFunc.SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
||||
void IglFunc.SetVertexAttribute(uint index, int size, Type t, bool normalized, int stride, int pointer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.SwapBuffers(Form form)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public unsafe void TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
unsafe void IglFunc.TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void TextureParameter(uint target, uint pname, int param)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.TextureParameter(uint target, uint pname, int param)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.UseProgram(uint rogram)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
void IglFunc.Viewport(int x, int y, int width, int height)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,115 +1,16 @@
|
||||
using StgSharp.Controlling;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
namespace StgSharp.Controlling
|
||||
{
|
||||
public static unsafe partial class Graphic
|
||||
public static class Graphic
|
||||
{
|
||||
|
||||
|
||||
|
||||
internal static TDele ConvertAPI<TDele>(IntPtr funcPtr)
|
||||
{
|
||||
if (funcPtr == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
||||
}
|
||||
try
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer<TDele>(funcPtr);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static Delegate ConvertAPI(IntPtr funcPtr, Type T)
|
||||
public static void Render()
|
||||
{
|
||||
|
||||
if (funcPtr == IntPtr.Zero)
|
||||
{
|
||||
throw new Exception("Failed to convert api, the function pointer is zero.");
|
||||
}
|
||||
try
|
||||
{
|
||||
return Marshal.GetDelegateForFunctionPointer(funcPtr, T);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init an instance of OpenGL program,
|
||||
/// This method should be called before other
|
||||
/// graphic methods, after LoadGL method.
|
||||
/// </summary>
|
||||
public static void InitGL(int majorVersion, int minorVersion)
|
||||
{
|
||||
if (InternalIO.glfw == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
InternalIO.glfw = new glFramework_PInvoke();
|
||||
InternalIO.glfw.Init();
|
||||
InternalIO.InternalWriteLog("Successfully load GLFW APIs. StgSharp is now working on p/invoke mode", LogType.Info);
|
||||
}
|
||||
catch (Exception sig)
|
||||
{
|
||||
string log = $"Failed to load GLFW APIs by P/Invoke," +
|
||||
$"StgSharp will switch to delegate mode. The detailed info is:\n" +
|
||||
$"{sig.Message}\n";
|
||||
|
||||
if (InternalIO.SSClibPtr == default)
|
||||
{
|
||||
InternalIO.SSClibPtr =
|
||||
InternalIO.InternalLoadWINlib(InternalIO.SSC_libname + ".dll");
|
||||
}
|
||||
|
||||
InternalIO.glfw = new glFramework_Delegate();
|
||||
InternalIO.SSClibPtr = InternalIO.InternalLoadWINlib(InternalIO.SSC_libname);
|
||||
FieldInfo[] glfwApis = typeof(glFramework_Delegate).GetFields();
|
||||
foreach (FieldInfo item in glfwApis)
|
||||
{
|
||||
if (item.FieldType.BaseType == typeof(Delegate))
|
||||
{
|
||||
try
|
||||
{
|
||||
IntPtr funcptr = InternalIO.InternalGetWINproc(
|
||||
InternalIO.SSClibPtr, item.Name);
|
||||
item.SetValue(null, ConvertAPI(funcptr, item.FieldType));
|
||||
log += $"Successfully load GLFW API called {item.Name}";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log += $"Failed to load GLFW API called {item.Name}, the detailed info is\n" +
|
||||
$"{ex.Message}";
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
InternalIO.InternalWriteLog(log, LogType.Warning);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
InternalIO.InternalWriteLog("Attempt to load GLFW APIs twice", LogType.Warning);
|
||||
}
|
||||
InternalIO.InternalInitGL(4, 6);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public interface IglFunc
|
||||
{
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api glAttachShader
|
||||
/// </summary>
|
||||
/// <param name="program">Shader program to be attachec</param>
|
||||
/// <param name="shader">A shader part to attach</param>
|
||||
void AttachShader(uint program, uint shader);
|
||||
|
||||
/// <summary>
|
||||
/// Bind the indexed buffer object to certain type of buffer
|
||||
/// </summary>
|
||||
/// <param name="bufferType"></param>
|
||||
/// <param name="index"></param>
|
||||
void BindBuffer(BufferType bufferType, uint index);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glBindVertexArray
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
void BindVertexArray(uint index);
|
||||
|
||||
/// <summary>
|
||||
/// Clear buffers to preset values
|
||||
/// </summary>
|
||||
/// <param name="mask"></param>
|
||||
void Clear(MaskBufferBit mask);
|
||||
|
||||
/// <summary>
|
||||
/// Call apiClearColor in OpenGL
|
||||
/// specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
/// Values specified by apiClearColor are clamped to the range [0,1]
|
||||
/// </summary>
|
||||
/// <param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
/// <param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
void ClearColor(float R, float G, float B, float A);
|
||||
void ClearGraphicError();
|
||||
|
||||
/// <summary>
|
||||
/// Conpile the provided shader code in string form.
|
||||
/// </summary>
|
||||
/// <param name="shaderCode">A string represent the shader's code</param>
|
||||
/// <param name="shaderType">An <see cref="ShaderType"/> enum represent the type of the shader to
|
||||
/// conpile, including vertex shader and fragment shader.</param>
|
||||
/// <returns>An uint value as the only mark of conpiled shader</returns>
|
||||
uint CompileShader(string shaderCode, ShaderType shaderType);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glCreateProgram
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
uint CreateProgram();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a form and its associated
|
||||
/// </summary>
|
||||
/// <param name="width">Required width</param>
|
||||
/// <param name="height">Required width</param>
|
||||
/// <param name="tittle">Tittle of the window </param>
|
||||
/// <param name="monitor"></param>
|
||||
/// <param name="share"></param>
|
||||
/// <returns>The instance of created form</returns>
|
||||
/// <exception cref="Exception"></exception>
|
||||
IntPtr CreateWindowHandle(int width, int height, string tittle, IntPtr monitor, Form share);
|
||||
|
||||
uint CreatGraphicProgram();
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glDeleteBuffer.
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of bufferd to be deleted</param>
|
||||
/// <param name="ptr">Pointer of buffer to be deleted</param>
|
||||
unsafe void DeleteBuffers(int count, uint* ptr);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glDeleteVertexArrays
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of vao to be deleted</param>
|
||||
/// <param name="ptr">pointer of vao sign array</param>
|
||||
unsafe void DeleteVertexArrays(int count, uint* ptr);
|
||||
|
||||
void DrawElements(GepmetryType mode, int count, Type type, IntPtr ptr);
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as the OpenGL api glGenBuffers
|
||||
/// </summary>
|
||||
/// <param name="count"></param>
|
||||
/// <param name="ptr"></param>
|
||||
unsafe void GenBuffers(int count, uint* ptr);
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api, glGenVertexArray
|
||||
/// </summary>
|
||||
/// <param name="count">Amount of vao to be generated</param>
|
||||
/// <param name="ptr">Pointer of vao sign array</param>
|
||||
unsafe void GenVertexArrays(int count, uint* ptr);
|
||||
|
||||
void GetGraphicError();
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api, glGetUniformLocation
|
||||
/// </summary>
|
||||
/// <param name="program">Shader program to find the uniform</param>
|
||||
/// <param name="ptr">Pointer to byte array of name <see cref="string"/> of the uniform </param>
|
||||
/// <returns></returns>
|
||||
unsafe int GetUniformLocation(uint program, byte* ptr);
|
||||
|
||||
bool GetWindowShouldClose(Form form);
|
||||
|
||||
void MakeContexCurrent(Form form);
|
||||
|
||||
void SetBufferData<T>(BufferType bufferType, T bufferData, BufferUsage usage) where T : IMat;
|
||||
|
||||
void SetBufferData<T>(BufferType bufferType, T[] bufferArray, BufferUsage usage) where T : struct, IConvertible;
|
||||
|
||||
/// <summary>
|
||||
/// sets the framebuffer resize callback of the specified <see cref="Form"/>,
|
||||
///which is called when the framebuffer of the specified <see cref="Form"/> is resized.
|
||||
/// </summary>
|
||||
/// <param name="id">The only signiture stands for the <see cref="Form"/> to be controlled</param>
|
||||
/// <param name="handler">Method hadler </param>
|
||||
void SetFrameBufferSizeCallback(IntPtr id, FrameBufferSizeHandler handler);
|
||||
|
||||
void SetValue(Uniform<float, float, float, float> uniform, float v0, float v1, float v2, float v3);
|
||||
|
||||
void SetValue(Uniform<float, float, float, float> uniform, Vec4d vec);
|
||||
|
||||
void SetValue(Uniform<float, float, float> uniform, float v0, float v1, float v2);
|
||||
|
||||
void SetValue(Uniform<float, float> uniform, float v0, float v1);
|
||||
|
||||
void SetValue(Uniform<float> uniform, float v0);
|
||||
|
||||
void SetValue(Uniform<int> uniform, int i0);
|
||||
|
||||
void SetValue(Uniform<Vec4d> uniform, Vec4d vec);
|
||||
|
||||
/// <summary>
|
||||
/// Set how a shader parameter read data from a VBO.
|
||||
/// </summary>
|
||||
/// <param name="index">Serial number of the parameter</param>
|
||||
/// <param name="size">Amount of data each elements contains</param>
|
||||
/// <param name="t">Type of data read by shader</param>
|
||||
/// <param name="normalized"></param>
|
||||
/// <param name="stride">Pixels stride of each sets of data</param>
|
||||
/// <param name="pointer"></param>
|
||||
void SetVertexAttribute(uint index, int size, Type t, bool normalized, int stride, int pointer);
|
||||
|
||||
void SwapBuffers(Form form);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api glTexImage2d
|
||||
/// </summary>
|
||||
/// <param name="target">texture target to load image in</param>
|
||||
/// <param name="level">level of mipmap, 0 if default</param>
|
||||
/// <param name="internalformat">OpenGL's internal color channel format</param>
|
||||
/// <param name="width">width of image</param>
|
||||
/// <param name="height">height of image</param>
|
||||
/// <param name="format">color channels of this image</param>
|
||||
/// <param name="type">how this image express each pixel</param>
|
||||
/// <param name="pixels">pointer to data array of pixels</param>
|
||||
unsafe void TextureImage2d(uint target, int level, uint internalformat, int width, int height, uint format, uint type, void* pixels);
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api glTexParameteri
|
||||
/// </summary>
|
||||
/// <param name="target">texture target to set parameters</param>
|
||||
/// <param name="pname">name of parameter</param>
|
||||
/// <param name="param">value of parameter</param>
|
||||
void TextureParameter(uint target, uint pname, int param);
|
||||
|
||||
/// <summary>
|
||||
/// Same fucntion as OpenGL api glUseShader.
|
||||
/// </summary>
|
||||
/// <param name="program">Sign of program to be used</param>
|
||||
void UseProgram(uint program);
|
||||
|
||||
/// <summary>
|
||||
/// Same fucnction as OpenGL api glGenTextures.
|
||||
/// </summary>
|
||||
/// <param name="count">amount of textures to generate</param>
|
||||
/// <param name="ptr">pointer to texture signs' array</param>
|
||||
unsafe void GenTextures(int count, uint* ptr);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api, glBindTexture.
|
||||
/// </summary>
|
||||
/// <param name="type">Type of texture to bind</param>
|
||||
/// <param name="texture">Sign of texture</param>
|
||||
void BindTexture(uint type, uint texture);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as OpenGL api glActiveTexture
|
||||
/// </summary>
|
||||
/// <param name="type">type of texture to activate</param>
|
||||
void ActiveTexture(uint type);
|
||||
|
||||
/// <summary>
|
||||
/// Same function as the OpenGL api, glViewPort
|
||||
/// </summary>
|
||||
/// <param name="x"></param>
|
||||
/// <param name="y"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
void Viewport(int x, int y, int width, int height);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
public class Image
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct ImageInfo
|
||||
{
|
||||
internal int width;
|
||||
internal int height;
|
||||
internal int channel;
|
||||
internal IntPtr pixelPtr;
|
||||
}
|
||||
|
||||
internal byte[] pixelArray;
|
||||
internal ImageInfo info;
|
||||
|
||||
public int Width { get => info.width; }
|
||||
public int Height { get => info.height; }
|
||||
public int Channel { get => info.channel; }
|
||||
|
||||
internal Image(ImageInfo information)
|
||||
{
|
||||
info = information;
|
||||
Marshal.Copy(
|
||||
source: info.pixelPtr,
|
||||
destination: pixelArray,
|
||||
startIndex: 0,
|
||||
length: info.width * info.height * info.channel
|
||||
);
|
||||
Marshal.FreeHGlobal(info.pixelPtr);
|
||||
}
|
||||
|
||||
public unsafe Image()
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit(out pixelArray);
|
||||
#endif
|
||||
info = new ImageInfo();
|
||||
}
|
||||
|
||||
~Image()
|
||||
{
|
||||
Marshal.FreeHGlobal(info.pixelPtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public partial class Control
|
||||
{
|
||||
internal Line leftBoader;
|
||||
internal Line rightBoader;
|
||||
internal Line topBoader;
|
||||
internal Line bottomBoader;
|
||||
|
||||
public Line LeftBoarder => leftBoader;
|
||||
public Line RightBoarder => rightBoader;
|
||||
public Line TopBoarder => topBoader;
|
||||
public Line BottomBoarder => bottomBoader;
|
||||
|
||||
|
||||
private void initContainers()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
using StgSharp.Entities;
|
||||
using StgSharp.Geometries;
|
||||
using StgSharp.Math;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public class Pool
|
||||
{
|
||||
internal LinkedList<Vector4Map> _Vector4mapContainer;
|
||||
internal LinkedList<PlainGeometry> _geometryContainer;
|
||||
internal LinkedList<IEntity> _bulletContainer;
|
||||
internal LinkedList<IEntity> _awardContainer;
|
||||
internal LinkedList<IEntity> _enemyContainer;
|
||||
|
||||
internal Line leftBoader;
|
||||
internal Line rightBoader;
|
||||
internal Line topBoader;
|
||||
internal Line bottomBoader;
|
||||
|
||||
public Line LeftBoarder => leftBoader;
|
||||
public Line RightBoarder => rightBoader;
|
||||
public Line TopBoarder => topBoader;
|
||||
public Line BottomBoarder => bottomBoader;
|
||||
|
||||
public Pool()
|
||||
{
|
||||
initContainers();
|
||||
}
|
||||
|
||||
private void initContainers()
|
||||
{
|
||||
_Vector4mapContainer = new LinkedList<Vector4Map>();
|
||||
_bulletContainer = new LinkedList<IEntity>();
|
||||
_awardContainer = new LinkedList<IEntity>();
|
||||
_enemyContainer = new LinkedList<IEntity>();
|
||||
_geometryContainer = new LinkedList<PlainGeometry>();
|
||||
}
|
||||
|
||||
public void OnRender()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static unsafe partial class Vector
|
||||
{
|
||||
/*
|
||||
public static Vec2d GetVector( vec4d pointPair)
|
||||
{
|
||||
return pointPair.Point2-pointPair.Point1;
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,563 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static partial class VectorCalc
|
||||
{
|
||||
/*
|
||||
|
||||
public static unsafe float Multiple(vec3d vec1, vec3d vec2)
|
||||
{
|
||||
IntPtr retPtr = InternalIO.mulps_internal(vec1._Vector4Ptr,vec2._Vector4Ptr);
|
||||
|
||||
Vector4 Vector4 = *(Vector4*)retPtr;
|
||||
Marshal.FreeHGlobal(retPtr);
|
||||
return
|
||||
Vector4.single_0 +
|
||||
Vector4.single_1 +
|
||||
Vector4.single_2;
|
||||
}
|
||||
|
||||
public static unsafe float Multiple(Vec4d vec1,vec3d vec2)
|
||||
{
|
||||
IntPtr retPtr = InternalIO.mulps_internal(vec1._Vector4Ptr,vec2._Vector4Ptr);
|
||||
Vector4 Vector4 = *(Vector4*)retPtr;
|
||||
Marshal.FreeHGlobal(retPtr);
|
||||
return
|
||||
Vector4.single_0 +
|
||||
Vector4.single_1 +
|
||||
Vector4.single_2 +
|
||||
Vector4.single_3;
|
||||
}
|
||||
|
||||
public static Matrix2x2 Multiple(Matrix2x2 matrix1, Matrix2x2 matrix2)
|
||||
{
|
||||
if (matrix2 == Matrix2x2.Unit)
|
||||
{
|
||||
return new Matrix2x2(
|
||||
InternalIO.load_cpy_internal(matrix1._colum0Ptr),
|
||||
InternalIO.load_cpy_internal(matrix1._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
Matrix2x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x2 Multiple(Matrix2x3 matrix1, Matrix3x2 matrix2)
|
||||
{
|
||||
Matrix3x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x2 Multiple(Matrix2x4 matrix1, Matrix4x2 matrix2)
|
||||
{
|
||||
Matrix4x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x3 Multiple(Matrix2x2 matrix1, Matrix2x3 matrix2)
|
||||
{
|
||||
Matrix2x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x3 Multiple(Matrix2x3 matrix1, Matrix3x3 matrix2)
|
||||
{
|
||||
Matrix3x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x3 Multiple(Matrix2x4 matrix1, Matrix4x3 matrix2)
|
||||
{
|
||||
Matrix4x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x4 Multiple(Matrix2x2 matrix1, Matrix2x4 matrix2)
|
||||
{
|
||||
Matrix2x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x4 Multiple(Matrix2x3 matrix1, Matrix3x4 matrix2)
|
||||
{
|
||||
Matrix3x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix2x4 Multiple(Matrix2x4 matrix1, Matrix4x4 matrix2)
|
||||
{
|
||||
Matrix4x2 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix2x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x2 Multiple(Matrix3x2 matrix1, Matrix2x2 matrix2)
|
||||
{
|
||||
Matrix2x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr,matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr,matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr,matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr,matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr,matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr,matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x2 Multiple(Matrix3x3 matrix1, Matrix3x2 matrix2)
|
||||
{
|
||||
Matrix3x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x2 Multiple(Matrix3x4 matrix1, Matrix4x2 matrix2)
|
||||
{
|
||||
Matrix4x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x3 Multiple(Matrix3x2 matrix1, Matrix2x3 matrix2)
|
||||
{
|
||||
Matrix2x3 transpose = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x3(
|
||||
InternalIO.mulps_sum_internal(transpose._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(transpose._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum1Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(transpose._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(transpose._colum2Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x3 Multiple(Matrix3x3 matrix1, Matrix3x3 matrix2)
|
||||
{
|
||||
Matrix3x3 transpose = matrix2.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x3(
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr,transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr,transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr,transpose._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x3 Multiple(Matrix3x4 matrix1, Matrix4x3 matrix2)
|
||||
{
|
||||
Matrix3x4 transpose = matrix2.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x3(
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum0Ptr, transpose._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum1Ptr, transpose._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._colum2Ptr, transpose._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x4 Multiple(Matrix3x2 matrix1, Matrix2x4 matrix2)
|
||||
{
|
||||
Matrix2x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x4 Multiple(Matrix3x3 matrix1, Matrix3x4 matrix2)
|
||||
{
|
||||
Matrix3x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix3x4 Multiple(Matrix3x4 matrix1, Matrix4x4 matrix2)
|
||||
{
|
||||
Matrix4x3 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix3x4(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x2 Multiple(Matrix4x2 matrix1, Matrix2x2 matrix2)
|
||||
{
|
||||
Matrix2x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x2 Multiple(Matrix4x3 matrix1, Matrix3x2 matrix2)
|
||||
{
|
||||
Matrix3x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x2 Multiple(Matrix4x4 matrix1, Matrix4x2 matrix2)
|
||||
{
|
||||
|
||||
Matrix4x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x2(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x3 Multiple(Matrix4x2 matrix1, Matrix2x3 matrix2)
|
||||
{
|
||||
Matrix2x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x3 Multiple(Matrix4x3 matrix1, Matrix3x3 matrix2)
|
||||
{
|
||||
|
||||
Matrix3x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x3 Multiple(Matrix4x4 matrix1, Matrix4x3 matrix2)
|
||||
{
|
||||
|
||||
Matrix4x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x3(
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum0Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum1Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum2Ptr, matrix2._colum2Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(trans._colum3Ptr, matrix2._colum2Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x4 Multiple(Matrix4x2 matrix1, Matrix2x4 matrix2)
|
||||
{
|
||||
Matrix2x4 transpose = matrix1.Transpose(TransposeMode.Copy);
|
||||
return new Matrix4x4(
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr, transpose._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr, transpose._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr, transpose._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr, transpose._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr, transpose._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr, transpose._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr, transpose._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr, transpose._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr, transpose._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr, transpose._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
public static Matrix4x4 Multiple( Matrix4x3 matrix1, Matrix3x4 matrix2)
|
||||
{
|
||||
Matrix3x4 trans = matrix1.Transpose(TransposeMode.Copy);
|
||||
|
||||
return new Matrix4x4(
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr,trans._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr,trans._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr,trans._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum0Ptr,trans._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr,trans._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr,trans._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr,trans._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum1Ptr,trans._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr,trans._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr,trans._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr,trans._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum2Ptr,trans._colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr,trans._colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr,trans._colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr,trans._colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix2._colum3Ptr,trans._colum3Ptr)
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
public static Matrix4x4 Multiple( Matrix4x4 matrix1, Matrix4x4 matrix2)
|
||||
{
|
||||
matrix1.InternalTranspose();
|
||||
|
||||
return new Matrix4x4(
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum0Ptr,matrix2._matMap.colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum0Ptr,matrix2._matMap.colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum0Ptr,matrix2._matMap.colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum0Ptr,matrix2._matMap.colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum1Ptr,matrix2._matMap.colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum1Ptr,matrix2._matMap.colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum1Ptr,matrix2._matMap.colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum1Ptr,matrix2._matMap.colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum2Ptr,matrix2._matMap.colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum2Ptr,matrix2._matMap.colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum2Ptr,matrix2._matMap.colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum2Ptr,matrix2._matMap.colum3Ptr),
|
||||
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum3Ptr,matrix2._matMap.colum0Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum3Ptr,matrix2._matMap.colum1Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum3Ptr,matrix2._matMap.colum2Ptr),
|
||||
InternalIO.mulps_sum_internal(matrix1._transpose.colum3Ptr,matrix2._matMap.colum3Ptr)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**/
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,16 @@ namespace StgSharp.Math
|
||||
[FieldOffset(0)] internal Mat4 mat;
|
||||
[FieldOffset(4 * 4 * sizeof(float))] internal Mat2 transpose;
|
||||
[FieldOffset(6 * 4 * sizeof(float))] internal bool isTransposed;
|
||||
|
||||
|
||||
[FieldOffset(0)] public Vec2d Colum0;
|
||||
[FieldOffset(16)] public Vec2d Colum1;
|
||||
[FieldOffset(32)] public Vec2d Colum2;
|
||||
[FieldOffset(48)] public Vec2d Colum3;
|
||||
|
||||
|
||||
public Matrix2x4(
|
||||
float a00, float a01,float a02,float a03,
|
||||
float a10, float a11,float a12,float a13
|
||||
float a00, float a01, float a02, float a03,
|
||||
float a10, float a11, float a12, float a13
|
||||
)
|
||||
{
|
||||
mat.colum0 = new Vector4(a00, a10, 0, 0);
|
||||
@@ -144,7 +150,7 @@ namespace StgSharp.Math
|
||||
return new Matrix2x2(
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1)
|
||||
);
|
||||
@@ -158,7 +164,7 @@ namespace StgSharp.Math
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum2),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum2)
|
||||
@@ -174,7 +180,7 @@ namespace StgSharp.Math
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum2),
|
||||
Vector4.Dot(left.transpose.colum0, right.mat.colum3),
|
||||
|
||||
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum0),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum1),
|
||||
Vector4.Dot(left.transpose.colum1, right.mat.colum2),
|
||||
|
||||
@@ -9,11 +9,13 @@ namespace StgSharp.Math
|
||||
public struct Matrix3x2
|
||||
{
|
||||
[FieldOffset(0)] internal Mat2 mat;
|
||||
[FieldOffset(0)] internal vec3d colum0;
|
||||
[FieldOffset(4 * 4)] internal vec3d colum1;
|
||||
[FieldOffset(2 * 4 * sizeof(float))] internal Mat3 transpose;
|
||||
[FieldOffset(5 * 4 * sizeof(float))] internal bool isTransposed;
|
||||
|
||||
|
||||
public Matrix3x2(
|
||||
public unsafe Matrix3x2(
|
||||
float a00, float a01,
|
||||
float a10, float a11,
|
||||
float a20, float a21
|
||||
@@ -21,6 +23,11 @@ namespace StgSharp.Math
|
||||
{
|
||||
mat.colum0 = new Vector4(a00, a10, a20, 0);
|
||||
mat.colum0 = new Vector4(a01, a11, a21, 0);
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit(out colum0);
|
||||
Unsafe.SkipInit(out colum1);
|
||||
Unsafe.SkipInit(out transpose);
|
||||
#endif
|
||||
}
|
||||
|
||||
internal Matrix3x2(
|
||||
@@ -32,6 +39,11 @@ namespace StgSharp.Math
|
||||
mat.colum1 = c1;
|
||||
}
|
||||
|
||||
public vec3d VerticalVecMultiply(Vec2d vec)
|
||||
{
|
||||
return colum0 * vec.X + colum1 * vec.Y;
|
||||
}
|
||||
|
||||
public unsafe float this[int rowNum, int columNum]
|
||||
{
|
||||
get
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace StgSharp.Math
|
||||
/// Vec2Ds in StgSharp are defaultly usaed as colum vector.
|
||||
/// </summary>
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16,Pack = 16)]
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
public struct Vec2d
|
||||
{
|
||||
|
||||
@@ -27,6 +27,11 @@ namespace StgSharp.Math
|
||||
X = x; Y = y;
|
||||
}
|
||||
|
||||
public static Vec2d Zero
|
||||
{
|
||||
get { return new Vec2d(0, 0); }
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Vec2d operator +(Vec2d vec1, Vec2d vec2)
|
||||
{
|
||||
@@ -61,7 +66,20 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
public static bool operator ==(Vec2d left, Vec2d right)
|
||||
{
|
||||
return left.X == right.X && left.Y == right.Y;
|
||||
}
|
||||
|
||||
public static bool operator !=(Vec2d left, Vec2d right)
|
||||
{
|
||||
return !(left == right);
|
||||
}
|
||||
|
||||
public float Cross(Vec2d right)
|
||||
{
|
||||
return X * right.Y - Y * right.X;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,12 +6,6 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public static class Vec3d
|
||||
{
|
||||
public static vec3d Zero => new vec3d(0, 0, 0);
|
||||
public static vec3d Unit => new vec3d(1, 1, 1);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
public struct vec3d : IEquatable<vec3d>
|
||||
{
|
||||
@@ -31,9 +25,17 @@ namespace StgSharp.Math
|
||||
public vec3d(
|
||||
float x, float y, float z)
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit(out vec);
|
||||
#endif
|
||||
X = x; Y = y; Z = z;
|
||||
}
|
||||
|
||||
internal vec3d(Vector4 vector)
|
||||
{
|
||||
vec = vector;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public float Dot(vec3d right)
|
||||
{
|
||||
@@ -53,22 +55,24 @@ namespace StgSharp.Math
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal vec3d(Vector4 vector)
|
||||
{
|
||||
vec = vector;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d operator +(vec3d left, vec3d right)
|
||||
{
|
||||
return new vec3d(
|
||||
left.X + right.X,
|
||||
left.Y + right.Y,
|
||||
left.Z + right.Z
|
||||
left.vec + right.vec
|
||||
);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public float GetMaxValue()
|
||||
{
|
||||
float ret = X;
|
||||
ret = ret > Y ? ret : Y;
|
||||
ret = ret > Z ? ret : Z;
|
||||
return ret;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d operator -(vec3d left, vec3d right)
|
||||
{
|
||||
@@ -157,4 +161,10 @@ namespace StgSharp.Math
|
||||
return $"[{X},{Y},{Z}]";
|
||||
}
|
||||
}
|
||||
|
||||
public static class Vec3d
|
||||
{
|
||||
public static vec3d Unit { get => new vec3d(1, 1, 1); }
|
||||
public static vec3d Zero { get => new vec3d(0, 0, 0); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,61 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct M128F
|
||||
{
|
||||
internal float X;
|
||||
internal float Y;
|
||||
internal float Z;
|
||||
internal float W;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16, Pack = 16)]
|
||||
public struct Vec4d
|
||||
{
|
||||
[FieldOffset(0)] internal Vector4 vec;
|
||||
[FieldOffset(0)] internal M128F fvec;
|
||||
|
||||
[FieldOffset(0)]public float X;
|
||||
[FieldOffset(4)]public float Y;
|
||||
[FieldOffset(8)]public float Z;
|
||||
[FieldOffset(12)]public float W;
|
||||
[FieldOffset(0)] public float X;
|
||||
[FieldOffset(4)] public float Y;
|
||||
[FieldOffset(8)] public float Z;
|
||||
[FieldOffset(12)] public float W;
|
||||
|
||||
[FieldOffset(0)] public int X_int;
|
||||
[FieldOffset(4)] public int Y_int;
|
||||
[FieldOffset(8)] public int Z_int;
|
||||
[FieldOffset(12)] public int W_int;
|
||||
|
||||
[FieldOffset(0)] public long X_long;
|
||||
[FieldOffset(8)] public long Y_long;
|
||||
|
||||
[FieldOffset(0)] public long X_ulong;
|
||||
[FieldOffset(8)] public long Y_ulong;
|
||||
|
||||
[FieldOffset(0)] public byte byte_0;
|
||||
[FieldOffset(1)] public byte byte_1;
|
||||
[FieldOffset(2)] public byte byte_2;
|
||||
[FieldOffset(3)] public byte byte_3;
|
||||
[FieldOffset(4)] public byte byte_4;
|
||||
[FieldOffset(5)] public byte byte_5;
|
||||
[FieldOffset(6)] public byte byte_6;
|
||||
[FieldOffset(7)] public byte byte_7;
|
||||
[FieldOffset(8)] public byte byte_8;
|
||||
[FieldOffset(9)] public byte byte_9;
|
||||
[FieldOffset(10)] public byte byte_10;
|
||||
[FieldOffset(11)] public byte byte_11;
|
||||
[FieldOffset(12)] public byte byte_12;
|
||||
[FieldOffset(13)] public byte byte_13;
|
||||
[FieldOffset(14)] public byte byte_14;
|
||||
[FieldOffset(15)] public byte byte_15;
|
||||
|
||||
unsafe public Vec4d(
|
||||
float x, float y, float z, float w)
|
||||
{
|
||||
X = x; Y = y; Z = z; W = w;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,25 +14,41 @@
|
||||
<AnalysisLevel>preview-all</AnalysisLevel>
|
||||
<OutputType>Library</OutputType>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>Debug;Release;NoOps</Configurations>
|
||||
<Configurations>Debug;Release;NoOps;RealDebug</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'">
|
||||
<Optimize>True</Optimize>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Optimize>True</Optimize>
|
||||
<DebugType>embedded</DebugType>
|
||||
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|x64'">
|
||||
<Optimize>True</Optimize>
|
||||
<DebugType>embedded</DebugType>
|
||||
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='RealDebug|AnyCPU'">
|
||||
<DebugType>embedded</DebugType>
|
||||
<Optimize>True</Optimize>
|
||||
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<DebugType>none</DebugType>
|
||||
<NoWarn>1701;1702;0649;1591;0169</NoWarn>
|
||||
|
||||
Binary file not shown.
@@ -25,7 +25,12 @@
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.#ctor(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="T:StgSharp.Graphics.Form">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.InitForm(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Constructor of a Form, creats an instance of a form and
|
||||
initilize all the customizing operations.
|
||||
@@ -72,12 +77,20 @@
|
||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.Unbind">
|
||||
<member name="M:StgSharp.Graphics.Form.Texture.LoadTexture(System.Int32,System.String,StgSharp.Graphics.ImageLoader)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<param name="index"></param>
|
||||
<param name="loader"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.SetData``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.SetValue``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
@@ -85,26 +98,31 @@
|
||||
<param name="bufferData"></param>
|
||||
<param name="readType"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.SetFrameBufferSizeCallback(StgSharp.Graphics.Form,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="form">The Form instance to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call glClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
Values specified by glClearColor are clamped to the range [0,1]
|
||||
Call apiClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
Values specified by apiClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.BindBuffer(StgSharp.Graphics.BufferType,System.UInt32)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.Clear(StgSharp.Graphics.MaskBufferBit)">
|
||||
<summary>
|
||||
Clear buffers to preset values
|
||||
</summary>
|
||||
<param name="mask"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
@@ -113,7 +131,7 @@
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.CreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CreateWindowHandle(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated
|
||||
</summary>
|
||||
@@ -125,6 +143,140 @@
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetFrameBufferSizeCallback(System.IntPtr,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="id">The only signiture stands for the <see cref="T:StgSharp.Graphics.Form"/> to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetVertexAttribute(System.UInt32,System.Int32,System.Type,System.Boolean,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set how a shader parameter read data from a VBO.
|
||||
</summary>
|
||||
<param name="index">Serial number of the parameter</param>
|
||||
<param name="size">Amount of data each elements contains</param>
|
||||
<param name="t">Type of data read by shader</param>
|
||||
<param name="normalized"></param>
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single},System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="v0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Int32},System.Int32)">
|
||||
<summary>
|
||||
Set data value to a int <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are int.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="i0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single},System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`2"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`2"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single},System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`3"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`3"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
<param name="v3">The forth value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> packing four parameters of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{StgSharp.Math.Vec4d},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are <see cref="T:StgSharp.Math.Vec4d"/>.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> value of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.CreateShader">
|
||||
<summary>
|
||||
Create an instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> program
|
||||
</summary>
|
||||
<returns>New instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> instance. </returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Graphics.Form.Shader.programID">
|
||||
<summary>
|
||||
A <see cref="T:System.UInt32"/> value represent this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.#ctor(StgSharp.Graphics.Form.GLfunc)">
|
||||
<summary>
|
||||
Inti a shader with no program attached.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileVertexShader(System.String)">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileFragmentShader(System.String)">
|
||||
<summary>
|
||||
Compile the fragment shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of fragment shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Link">
|
||||
<summary>
|
||||
Link the shader to current context.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Use">
|
||||
<summary>
|
||||
Let the current context use this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
Load all aupportable OpenGL APIs and bind them to given <see cref="T:StgSharp.Graphics.Form"/> context.
|
||||
</summary>
|
||||
<param name="form">The <see cref="T:StgSharp.Graphics.Form"/> used as current OpenGL context</param>
|
||||
<param name="loader">A delegate that can get o</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLfunc(System.String)">
|
||||
<summary>
|
||||
Get the function pointer of given OpenGL api name
|
||||
@@ -132,13 +284,6 @@
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
@@ -164,6 +309,23 @@
|
||||
Y position of an enemy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Geometries.PartialPlainCoordinate.origin">
|
||||
<summary>
|
||||
The origin of this coordinate.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_H">
|
||||
<summary>
|
||||
The horizontial axis of the coordinate.
|
||||
Point to the right direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_V">
|
||||
<summary>
|
||||
The vertical axis of the coordinate.
|
||||
Point to the top direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||
<summary>
|
||||
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETStandard,Version=v2.1/",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETStandard,Version=v2.1": {},
|
||||
".NETStandard,Version=v2.1/": {
|
||||
"StgSharp/1.0.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.Bcl.HashCode": "1.1.1",
|
||||
"Microsoft.CSharp": "4.7.0"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharp.dll": {}
|
||||
}
|
||||
},
|
||||
"Microsoft.Bcl.HashCode/1.1.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.1/Microsoft.Bcl.HashCode.dll": {
|
||||
"assemblyVersion": "1.0.0.0",
|
||||
"fileVersion": "4.700.20.56604"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/Microsoft.CSharp.dll": {
|
||||
"assemblyVersion": "4.0.5.0",
|
||||
"fileVersion": "4.700.19.56404"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"StgSharp/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"Microsoft.Bcl.HashCode/1.1.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-MalY0Y/uM/LjXtHfX/26l2VtN4LDNZ2OE3aumNOHDLsT4fNYy2hiHXI4CXCqKpNUNm7iJ2brrc4J89UdaL56FA==",
|
||||
"path": "microsoft.bcl.hashcode/1.1.1",
|
||||
"hashPath": "microsoft.bcl.hashcode.1.1.1.nupkg.sha512"
|
||||
},
|
||||
"Microsoft.CSharp/4.7.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-pTj+D3uJWyN3My70i2Hqo+OXixq3Os2D1nJ2x92FFo6sk8fYS1m1WLNTs0Dc1uPaViH0YvEEwvzddQ7y4rhXmA==",
|
||||
"path": "microsoft.csharp/4.7.0",
|
||||
"hashPath": "microsoft.csharp.4.7.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,439 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Control.InitPool">
|
||||
<summary>
|
||||
Add a pool to timeline controller, and return the instance of the pool.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Control.GetKeyStatus(StgSharp.Graphics.Form,StgSharp.Control.Key)">
|
||||
<summary>
|
||||
Get the status of a certain key on the keyboard.
|
||||
</summary>
|
||||
<param name="form"></param>
|
||||
<param name="key"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.Form">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.InitForm(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Constructor of a Form, creats an instance of a form and
|
||||
initilize all the customizing operations.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSize(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Resize the current form
|
||||
</summary>
|
||||
<param name="width">New width of the window</param>
|
||||
<param name="height">New height of the window</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSize(StgSharp.Math.Vec2d)">
|
||||
<summary>
|
||||
Resize the current form
|
||||
</summary>
|
||||
<param name="size">
|
||||
A <see cref="T:StgSharp.Math.Vec2d"/> (width,height) representing the new size of current form
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param name="minWidth">Minimum width of current form </param>
|
||||
<param name="minHeight">Minimum height of current form</param>
|
||||
<param name="maxWidth">Maximum width of curent form</param>
|
||||
<param name="maxHeight">Maximum height of current form</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(StgSharp.Math.Vec2d,StgSharp.Math.Vec2d)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param name="minSize">
|
||||
Minimun size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
<param name="maxSize">
|
||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Texture.LoadTexture(System.Int32,System.String,StgSharp.Graphics.ImageLoader)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<param name="index"></param>
|
||||
<param name="loader"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.SetValue``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="bufferData"></param>
|
||||
<param name="readType"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call apiClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
Values specified by apiClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.BindBuffer(StgSharp.Graphics.BufferType,System.UInt32)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.Clear(StgSharp.Graphics.MaskBufferBit)">
|
||||
<summary>
|
||||
Clear buffers to preset values
|
||||
</summary>
|
||||
<param name="mask"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCode">A string represent the shader's code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CreateWindowHandle(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated
|
||||
</summary>
|
||||
<param name="width">Required width</param>
|
||||
<param name="height">Required width</param>
|
||||
<param name="tittle">Tittle of the window </param>
|
||||
<param name="monitor"></param>
|
||||
<param name="share"></param>
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetFrameBufferSizeCallback(System.IntPtr,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="id">The only signiture stands for the <see cref="T:StgSharp.Graphics.Form"/> to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetVertexAttribute(System.UInt32,System.Int32,System.Type,System.Boolean,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set how a shader parameter read data from a VBO.
|
||||
</summary>
|
||||
<param name="index">Serial number of the parameter</param>
|
||||
<param name="size">Amount of data each elements contains</param>
|
||||
<param name="t">Type of data read by shader</param>
|
||||
<param name="normalized"></param>
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single},System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="v0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Int32},System.Int32)">
|
||||
<summary>
|
||||
Set data value to a int <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are int.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="i0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single},System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`2"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`2"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single},System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`3"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`3"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
<param name="v3">The forth value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> packing four parameters of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{StgSharp.Math.Vec4d},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are <see cref="T:StgSharp.Math.Vec4d"/>.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> value of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.CreateShader">
|
||||
<summary>
|
||||
Create an instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> program
|
||||
</summary>
|
||||
<returns>New instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> instance. </returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Graphics.Form.Shader.programID">
|
||||
<summary>
|
||||
A <see cref="T:System.UInt32"/> value represent this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.#ctor(StgSharp.Graphics.Form.GLfunc)">
|
||||
<summary>
|
||||
Inti a shader with no program attached.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileVertexShader(System.String)">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileFragmentShader(System.String)">
|
||||
<summary>
|
||||
Compile the fragment shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of fragment shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Link">
|
||||
<summary>
|
||||
Link the shader to current context.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Use">
|
||||
<summary>
|
||||
Let the current context use this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
Load all aupportable OpenGL APIs and bind them to given <see cref="T:StgSharp.Graphics.Form"/> context.
|
||||
</summary>
|
||||
<param name="form">The <see cref="T:StgSharp.Graphics.Form"/> used as current OpenGL context</param>
|
||||
<param name="loader">A delegate that can get o</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLfunc(System.String)">
|
||||
<summary>
|
||||
Get the function pointer of given OpenGL api name
|
||||
</summary>
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.CollisionSensor">
|
||||
<summary>
|
||||
A sensor used for cheking out if a bullet hit a player or something else
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Location">
|
||||
<summary>
|
||||
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.X">
|
||||
<summary>
|
||||
X position of an enenmy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Y">
|
||||
<summary>
|
||||
Y position of an enemy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Geometries.PartialPlainCoordinate.origin">
|
||||
<summary>
|
||||
The origin of this coordinate.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_H">
|
||||
<summary>
|
||||
The horizontial axis of the coordinate.
|
||||
Point to the right direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_V">
|
||||
<summary>
|
||||
The vertical axis of the coordinate.
|
||||
Point to the top direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||
<summary>
|
||||
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||
<summary>
|
||||
Caculate the movement of a point.
|
||||
</summary>
|
||||
<param name="tick">The game tick represent time passed by</param>
|
||||
<returns>A 3d vector representing movement</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. this is a useless method for Parallelograms.
|
||||
</summary>
|
||||
<param name="tick">Current time tick</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex3(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. This method is useless for Parallelograms.
|
||||
</summary>
|
||||
<param name="tick">Current time tick</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.PlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||
<summary>
|
||||
Update the coordinate of the point. If this is a moving point,
|
||||
(Points on sides or surface if other geometry items)
|
||||
please do not define any motion here, codes will be ignored by program
|
||||
</summary>
|
||||
<param name="tick">Time passes since the program begin, counted by frames</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
|
||||
<summary>
|
||||
计算中心点相对于参考原点的位移
|
||||
</summary>
|
||||
<param name="tick">当前游戏刻</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
</summary>
|
||||
<param name="t">The item ready to add to the list</param>
|
||||
</member>
|
||||
<member name="T:StgSharp.Math.Vec2d">
|
||||
<summary>
|
||||
A two dimension vector defined by two elements.
|
||||
Vec2Ds in StgSharp are defaultly usaed as colum vector.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
|
||||
<summary>
|
||||
Reurns the value of ArcSin(x)
|
||||
</summary>
|
||||
<param name="x">The sine value of the angle</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
|
||||
<summary>
|
||||
Get the value of E ^ x;
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns>
|
||||
Returns the value of ln(x).
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
|
||||
<summary>
|
||||
calculate the value of x^y
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<param name="y"></param>
|
||||
<returns>Returns the value of x^y</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Random">
|
||||
<summary>
|
||||
returns a random float number between 0 and 1.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.RandomSeed">
|
||||
<summary>
|
||||
Generates a random seed in int value.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -70,7 +70,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.401\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Nitlo\.nuget\packages\;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.7.0</NuGetToolVersion>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.8.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<SourceRoot Include="C:\Users\Nitlo\.nuget\packages\" />
|
||||
|
||||
@@ -203,7 +203,7 @@
|
||||
"privateAssets": "all"
|
||||
}
|
||||
},
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.401\\RuntimeIdentifierGraph.json"
|
||||
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100\\RuntimeIdentifierGraph.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"version": 2,
|
||||
"dgSpecHash": "n9Xi4iZXV3QSFntRckZHzDXaJisY2FvKlYNQrLaVsXhG7L0GmeGCz292aaGFg24/a22cdlby5Tm2bmC2jHfvQA==",
|
||||
"dgSpecHash": "ZEy1DcAzD4VzqbKZ5b1WNXVTJ7ASngWdyWRK3Jo9EkNF5hdjST+BQi5eUbwUu+yqpwt9s24aXl+nV1XHMtDxuQ==",
|
||||
"success": true,
|
||||
"projectFilePath": "D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\源代码\\StgSharp\\StgSharp.csproj",
|
||||
"expectedPackageFiles": [
|
||||
|
||||
@@ -1 +1 @@
|
||||
c037a45127bb9a5e3e153dd0686c8ec78e62d669
|
||||
e8b19b35bca753348ef94df4faf984102d2e81946d465d23132400b7d6c8fb6d
|
||||
|
||||
+2
@@ -9,3 +9,5 @@ build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = StgSharp
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
|
||||
Binary file not shown.
@@ -1 +1 @@
|
||||
10ac7af9fa9833eca3eb77b212f61a7eda93e6bc
|
||||
6de3e4f960d5702a20b1070ed5f43546b6f7cbd8ad4d4a9980f3ff7469954a65
|
||||
|
||||
@@ -10,3 +10,4 @@ D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\refint\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\ref\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\Debug\netstandard2.1\StgSharp.sourcelink.json
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ae804553ce830ceaa07a752049a8a8fee9981ad8/*"}}
|
||||
@@ -25,7 +25,12 @@
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.#ctor(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="T:StgSharp.Graphics.Form">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.InitForm(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Constructor of a Form, creats an instance of a form and
|
||||
initilize all the customizing operations.
|
||||
@@ -72,12 +77,20 @@
|
||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.Unbind">
|
||||
<member name="M:StgSharp.Graphics.Form.Texture.LoadTexture(System.Int32,System.String,StgSharp.Graphics.ImageLoader)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<param name="index"></param>
|
||||
<param name="loader"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.VertexBuffer.SetData``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.SetValue``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
@@ -85,26 +98,31 @@
|
||||
<param name="bufferData"></param>
|
||||
<param name="readType"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.SetFrameBufferSizeCallback(StgSharp.Graphics.Form,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="form">The Form instance to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call glClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by glClear to clear the color buffers.
|
||||
Values specified by glClearColor are clamped to the range [0,1]
|
||||
Call apiClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
Values specified by apiClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.BindBuffer(StgSharp.Graphics.BufferType,System.UInt32)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.Clear(StgSharp.Graphics.MaskBufferBit)">
|
||||
<summary>
|
||||
Clear buffers to preset values
|
||||
</summary>
|
||||
<param name="mask"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
@@ -113,7 +131,7 @@
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.GL.CreateWindow(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CreateWindowHandle(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated
|
||||
</summary>
|
||||
@@ -125,6 +143,140 @@
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetFrameBufferSizeCallback(System.IntPtr,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="id">The only signiture stands for the <see cref="T:StgSharp.Graphics.Form"/> to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetVertexAttribute(System.UInt32,System.Int32,System.Type,System.Boolean,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set how a shader parameter read data from a VBO.
|
||||
</summary>
|
||||
<param name="index">Serial number of the parameter</param>
|
||||
<param name="size">Amount of data each elements contains</param>
|
||||
<param name="t">Type of data read by shader</param>
|
||||
<param name="normalized"></param>
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single},System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="v0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Int32},System.Int32)">
|
||||
<summary>
|
||||
Set data value to a int <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are int.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="i0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single},System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`2"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`2"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single},System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`3"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`3"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
<param name="v3">The forth value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> packing four parameters of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{StgSharp.Math.Vec4d},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are <see cref="T:StgSharp.Math.Vec4d"/>.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> value of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.CreateShader">
|
||||
<summary>
|
||||
Create an instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> program
|
||||
</summary>
|
||||
<returns>New instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> instance. </returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Graphics.Form.Shader.programID">
|
||||
<summary>
|
||||
A <see cref="T:System.UInt32"/> value represent this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.#ctor(StgSharp.Graphics.Form.GLfunc)">
|
||||
<summary>
|
||||
Inti a shader with no program attached.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileVertexShader(System.String)">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileFragmentShader(System.String)">
|
||||
<summary>
|
||||
Compile the fragment shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of fragment shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Link">
|
||||
<summary>
|
||||
Link the shader to current context.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Use">
|
||||
<summary>
|
||||
Let the current context use this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
Load all aupportable OpenGL APIs and bind them to given <see cref="T:StgSharp.Graphics.Form"/> context.
|
||||
</summary>
|
||||
<param name="form">The <see cref="T:StgSharp.Graphics.Form"/> used as current OpenGL context</param>
|
||||
<param name="loader">A delegate that can get o</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLfunc(System.String)">
|
||||
<summary>
|
||||
Get the function pointer of given OpenGL api name
|
||||
@@ -132,13 +284,6 @@
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Graphic.InitGL(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Init an instance of OpenGL program,
|
||||
This method should be called before other
|
||||
graphic methods, after LoadGL method.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
@@ -164,6 +309,23 @@
|
||||
Y position of an enemy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Geometries.PartialPlainCoordinate.origin">
|
||||
<summary>
|
||||
The origin of this coordinate.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_H">
|
||||
<summary>
|
||||
The horizontial axis of the coordinate.
|
||||
Point to the right direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_V">
|
||||
<summary>
|
||||
The vertical axis of the coordinate.
|
||||
Point to the top direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||
<summary>
|
||||
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+4
@@ -0,0 +1,4 @@
|
||||
// <autogenerated />
|
||||
using System;
|
||||
using System.Reflection;
|
||||
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
|
||||
@@ -0,0 +1,23 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("RealDebug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ae804553ce830ceaa07a752049a8a8fee9981ad8")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// 由 MSBuild WriteCodeFragment 类生成。
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ef774f8e221005539f6096a7006906b62494ddf898c07bc1b1142c4f67324745
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
is_global = true
|
||||
build_property.TargetFramework = netstandard2.1
|
||||
build_property.TargetPlatformMinVersion = 7.0
|
||||
build_property.UsingMicrosoftNETSdkWeb =
|
||||
build_property.ProjectTypeGuids =
|
||||
build_property.InvariantGlobalization =
|
||||
build_property.PlatformNeutralAssembly =
|
||||
build_property.EnforceExtendedAnalyzerRules =
|
||||
build_property._SupportedPlatformList = Linux,macOS,Windows
|
||||
build_property.RootNamespace = StgSharp
|
||||
build_property.ProjectDir = D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\
|
||||
build_property.EnableComHosting =
|
||||
build_property.EnableGeneratedComInterfaceComImportInterop =
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
e6e7a7ff7c8acfcc09d9871e7b0b8915601d076ce02bbd3bab9c398a458d904d
|
||||
@@ -0,0 +1,13 @@
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\RealDebug\netstandard2.1\StgSharp.deps.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\RealDebug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\bin\x64\RealDebug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.csproj.AssemblyReference.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.GeneratedMSBuildEditorConfig.editorconfig
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.AssemblyInfoInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.AssemblyInfo.cs
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.csproj.CoreCompileInputs.cache
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.sourcelink.json
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\refint\StgSharp.dll
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\StgSharp.xml
|
||||
D:\NitloadIndustry\研究项目\1-Flagship\TH2020\ProjectFile\源代码\StgSharp\obj\x64\RealDebug\netstandard2.1\ref\StgSharp.dll
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
{"documents":{"D:\\NitloadIndustry\\研究项目\\1-Flagship\\TH2020\\ProjectFile\\*":"https://raw.githubusercontent.com/Nitload-NSI/CCD_Github/ae804553ce830ceaa07a752049a8a8fee9981ad8/*"}}
|
||||
@@ -0,0 +1,439 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>StgSharp</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:StgSharp.Control.InitPool">
|
||||
<summary>
|
||||
Add a pool to timeline controller, and return the instance of the pool.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Control.GetKeyStatus(StgSharp.Graphics.Form,StgSharp.Control.Key)">
|
||||
<summary>
|
||||
Get the status of a certain key on the keyboard.
|
||||
</summary>
|
||||
<param name="form"></param>
|
||||
<param name="key"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.glLoader">
|
||||
<summary>
|
||||
Function handler to load an opengl function by serching its name.
|
||||
</summary>
|
||||
<param name="funcname">the name of the Opengl function</param>
|
||||
<returns>An intptr value representing the pointer to the function</returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Graphics.Form">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.InitForm(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Constructor of a Form, creats an instance of a form and
|
||||
initilize all the customizing operations.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.MakeAsCurrentContext">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSize(System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Resize the current form
|
||||
</summary>
|
||||
<param name="width">New width of the window</param>
|
||||
<param name="height">New height of the window</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSize(StgSharp.Math.Vec2d)">
|
||||
<summary>
|
||||
Resize the current form
|
||||
</summary>
|
||||
<param name="size">
|
||||
A <see cref="T:StgSharp.Math.Vec2d"/> (width,height) representing the new size of current form
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(System.Int32,System.Int32,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param name="minWidth">Minimum width of current form </param>
|
||||
<param name="minHeight">Minimum height of current form</param>
|
||||
<param name="maxWidth">Maximum width of curent form</param>
|
||||
<param name="maxHeight">Maximum height of current form</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.SetSizeLimit(StgSharp.Math.Vec2d,StgSharp.Math.Vec2d)">
|
||||
<summary>
|
||||
Set the size limit of current form
|
||||
</summary>
|
||||
<param name="minSize">
|
||||
Minimun size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
<param name="maxSize">
|
||||
Maximum size of current form. In form of a <see cref="T:StgSharp.Math.Vec2d"/> of (width,height)
|
||||
</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Texture.LoadTexture(System.Int32,System.String,StgSharp.Graphics.ImageLoader)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<param name="index"></param>
|
||||
<param name="loader"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.Unbind">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.VertexBuffer.SetValue``1(System.Int32,``0,StgSharp.Graphics.BufferUsage)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="bufferData"></param>
|
||||
<param name="readType"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.ClearColor(System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Call apiClearColor in OpenGL
|
||||
specifies the red, green, blue, and alpha values used by apiClear to clear the color buffers.
|
||||
Values specified by apiClearColor are clamped to the range [0,1]
|
||||
</summary>
|
||||
<param name="R">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="G">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="B">Specify the red values used when the color buffers are cleared.</param>
|
||||
<param name="A">Specify the red values used when the color buffers are cleared.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.BindBuffer(StgSharp.Graphics.BufferType,System.UInt32)">
|
||||
<summary>
|
||||
Bind the indexed buffer object to certain type of buffer
|
||||
</summary>
|
||||
<param name="bufferType"></param>
|
||||
<param name="index"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.Clear(StgSharp.Graphics.MaskBufferBit)">
|
||||
<summary>
|
||||
Clear buffers to preset values
|
||||
</summary>
|
||||
<param name="mask"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CompileShader(System.String,StgSharp.Graphics.ShaderType)">
|
||||
<summary>
|
||||
Conpile the provided shader code in string form.
|
||||
</summary>
|
||||
<param name="shaderCode">A string represent the shader's code</param>
|
||||
<param name="shaderType">An <see cref="T:StgSharp.Graphics.ShaderType"/> enum represent the type of the shader to
|
||||
conpile, including vertex shader and fragment shader.</param>
|
||||
<returns>An uint value as the only mark of conpiled shader</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.CreateWindowHandle(System.Int32,System.Int32,System.String,System.IntPtr,StgSharp.Graphics.Form)">
|
||||
<summary>
|
||||
Creates a form and its associated
|
||||
</summary>
|
||||
<param name="width">Required width</param>
|
||||
<param name="height">Required width</param>
|
||||
<param name="tittle">Tittle of the window </param>
|
||||
<param name="monitor"></param>
|
||||
<param name="share"></param>
|
||||
<returns>The instance of created form</returns>
|
||||
<exception cref="T:System.Exception"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetFrameBufferSizeCallback(System.IntPtr,StgSharp.Graphics.FrameBufferSizeHandler)">
|
||||
<summary>
|
||||
sets the framebuffer resize callback of the specified <see cref="T:StgSharp.Graphics.Form"/>,
|
||||
which is called when the framebuffer of the specified <see cref="T:StgSharp.Graphics.Form"/> is resized.
|
||||
</summary>
|
||||
<param name="id">The only signiture stands for the <see cref="T:StgSharp.Graphics.Form"/> to be controlled</param>
|
||||
<param name="handler">Method hadler </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetVertexAttribute(System.UInt32,System.Int32,System.Type,System.Boolean,System.Int32,System.Int32)">
|
||||
<summary>
|
||||
Set how a shader parameter read data from a VBO.
|
||||
</summary>
|
||||
<param name="index">Serial number of the parameter</param>
|
||||
<param name="size">Amount of data each elements contains</param>
|
||||
<param name="t">Type of data read by shader</param>
|
||||
<param name="normalized"></param>
|
||||
<param name="stride">Pixels stride of each sets of data</param>
|
||||
<param name="pointer"></param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single},System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="v0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Int32},System.Int32)">
|
||||
<summary>
|
||||
Set data value to a int <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are int.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="i0">The value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single},System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`2"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`2"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single},System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`3"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`3"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},System.Single,System.Single,System.Single,System.Single)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="v0">The first value to be set</param>
|
||||
<param name="v1">The second value to be set</param>
|
||||
<param name="v2">The third value to be set</param>
|
||||
<param name="v3">The forth value to be set</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{System.Single,System.Single,System.Single,System.Single},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`4"/>,
|
||||
all types of parameters are float.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`4"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> packing four parameters of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.GLfunc.SetValue(StgSharp.Graphics.Form.Uniform{StgSharp.Math.Vec4d},StgSharp.Math.Vec4d)">
|
||||
<summary>
|
||||
Set data value to a float <see cref="T:StgSharp.Graphics.Form.Uniform`1"/>,
|
||||
all types of parameters are <see cref="T:StgSharp.Math.Vec4d"/>.
|
||||
</summary>
|
||||
<param name="uniform">The <see cref="T:StgSharp.Graphics.Form.Uniform`1"/> target</param>
|
||||
<param name="vec">A <see cref="T:StgSharp.Math.Vec4d"/> value of the uniform </param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.CreateShader">
|
||||
<summary>
|
||||
Create an instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> program
|
||||
</summary>
|
||||
<returns>New instance of <see cref="T:StgSharp.Graphics.Form.Shader"/> instance. </returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Graphics.Form.Shader.programID">
|
||||
<summary>
|
||||
A <see cref="T:System.UInt32"/> value represent this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.#ctor(StgSharp.Graphics.Form.GLfunc)">
|
||||
<summary>
|
||||
Inti a shader with no program attached.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileVertexShader(System.String)">
|
||||
<summary>
|
||||
Compile the vertex shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of vertex shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.CompileFragmentShader(System.String)">
|
||||
<summary>
|
||||
Compile the fragment shader to be attached to this shader.
|
||||
</summary>
|
||||
<param name="shaderCode">GLSL code of fragment shader.</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Link">
|
||||
<summary>
|
||||
Link the shader to current context.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.GetUniform``1(System.String)">
|
||||
<summary>
|
||||
Get a uniform form current shader,
|
||||
the value type of the uniform should be provided.
|
||||
</summary>
|
||||
<param name="name"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.Form.Shader.Use">
|
||||
<summary>
|
||||
Let the current context use this shader.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLapi(StgSharp.Graphics.Form,StgSharp.Graphics.GLfuncLoader)">
|
||||
<summary>
|
||||
Load all aupportable OpenGL APIs and bind them to given <see cref="T:StgSharp.Graphics.Form"/> context.
|
||||
</summary>
|
||||
<param name="form">The <see cref="T:StgSharp.Graphics.Form"/> used as current OpenGL context</param>
|
||||
<param name="loader">A delegate that can get o</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Graphics.glManager.LoadGLfunc(System.String)">
|
||||
<summary>
|
||||
Get the function pointer of given OpenGL api name
|
||||
</summary>
|
||||
<param name="name">Name of the OpenGL api</param>
|
||||
<returns>The funtion pointer of the api in form of <see cref="T:System.IntPtr"/></returns>
|
||||
</member>
|
||||
<member name="F:StgSharp.Controlling.TimeLine.tickCounter">
|
||||
<summary>
|
||||
Tick counter count the frames passed since the program start.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.CollisionSensor">
|
||||
<summary>
|
||||
A sensor used for cheking out if a bullet hit a player or something else
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Location">
|
||||
<summary>
|
||||
A 2D vector presenting the position of an enemy entity, position can also be visited by X, Y
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.X">
|
||||
<summary>
|
||||
X position of an enenmy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.IEntity.Y">
|
||||
<summary>
|
||||
Y position of an enemy entity
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:StgSharp.Geometries.PartialPlainCoordinate.origin">
|
||||
<summary>
|
||||
The origin of this coordinate.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_H">
|
||||
<summary>
|
||||
The horizontial axis of the coordinate.
|
||||
Point to the right direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:StgSharp.Geometries.PartialPlainCoordinate.axis_V">
|
||||
<summary>
|
||||
The vertical axis of the coordinate.
|
||||
Point to the top direction.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.UnusedVertexException">
|
||||
<summary>
|
||||
当几何体调用了过多的CalcVec方法时,产生UnusedVertexException异常
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.GetLocationHandler">
|
||||
<summary>
|
||||
Caculate the movement of a point.
|
||||
</summary>
|
||||
<param name="tick">The game tick represent time passed by</param>
|
||||
<returns>A 3d vector representing movement</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex2(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. this is a useless method for Parallelograms.
|
||||
</summary>
|
||||
<param name="tick">Current time tick</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Parallelogram.MoveVertex3(System.UInt32)">
|
||||
<summary>
|
||||
Move the third vertix. This method is useless for Parallelograms.
|
||||
</summary>
|
||||
<param name="tick">Current time tick</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:StgSharp.Geometries.UnusedVertexException">Geometry overdefined</exception>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.PlainGeometry">
|
||||
<summary>
|
||||
平面几何体。包含三角形,对称四边形,自由多边形等。最多可由16个点参数定义。
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Point.Update(System.UInt32)">
|
||||
<summary>
|
||||
Update the coordinate of the point. If this is a moving point,
|
||||
(Points on sides or surface if other geometry items)
|
||||
please do not define any motion here, codes will be ignored by program
|
||||
</summary>
|
||||
<param name="tick">Time passes since the program begin, counted by frames</param>
|
||||
</member>
|
||||
<member name="M:StgSharp.Geometries.Rectangle.MovCenter(System.UInt32)">
|
||||
<summary>
|
||||
计算中心点相对于参考原点的位移
|
||||
</summary>
|
||||
<param name="tick">当前游戏刻</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:StgSharp.Geometries.Square">
|
||||
<summary>
|
||||
A square
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.LinkedList`1.Add(`0)">
|
||||
<summary>
|
||||
Add an item to the tail of linked list.
|
||||
</summary>
|
||||
<param name="t">The item ready to add to the list</param>
|
||||
</member>
|
||||
<member name="T:StgSharp.Math.Vec2d">
|
||||
<summary>
|
||||
A two dimension vector defined by two elements.
|
||||
Vec2Ds in StgSharp are defaultly usaed as colum vector.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.ASin(System.Single)">
|
||||
<summary>
|
||||
Reurns the value of ArcSin(x)
|
||||
</summary>
|
||||
<param name="x">The sine value of the angle</param>
|
||||
<returns></returns>
|
||||
<exception cref="T:System.ArgumentException"></exception>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Exp(System.Single)">
|
||||
<summary>
|
||||
Get the value of E ^ x;
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Log(System.Single)">
|
||||
<summary>
|
||||
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<returns>
|
||||
Returns the value of ln(x).
|
||||
</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Pow(System.Single,System.Single)">
|
||||
<summary>
|
||||
calculate the value of x^y
|
||||
</summary>
|
||||
<param name="x"></param>
|
||||
<param name="y"></param>
|
||||
<returns>Returns the value of x^y</returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.Random">
|
||||
<summary>
|
||||
returns a random float number between 0 and 1.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:StgSharp.Math.Calc.RandomSeed">
|
||||
<summary>
|
||||
Generates a random seed in int value.
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user