daily update on 20241226 by nitload youmu
This commit is contained in:
@@ -88,15 +88,6 @@ namespace StgSharp
|
||||
GLtype.Add( TypeCode.SByte, GLconst.BYTE );
|
||||
GLtype.Add( TypeCode.Byte, GLconst.UNSIGNED_BYTE );
|
||||
|
||||
int statCode;
|
||||
|
||||
fixed( IntrinsicContext* cptr = &_intrinsicContext ) {
|
||||
statCode = LoadIntrinsicFunction( cptr );
|
||||
}
|
||||
if (statCode == -1)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
|
||||
internal static void InternalAppendLog( string log )
|
||||
|
||||
@@ -42,6 +42,7 @@ namespace StgSharp.Data.Intrinsic
|
||||
[StructLayout( LayoutKind.Sequential )]
|
||||
internal unsafe struct IntrinsicContext
|
||||
{
|
||||
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet2*, ColumnSet2*, ColumnSet2*, void> add_mat_2;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet3*, ColumnSet3*, ColumnSet3*, void> add_mat_3;
|
||||
public delegate* unmanaged[Cdecl]<ColumnSet4*, ColumnSet4*, ColumnSet4*, void> add_mat_4;
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
using StgSharp.Data.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp
|
||||
@@ -51,5 +52,25 @@ namespace StgSharp
|
||||
private static extern int LoadIntrinsicFunction(
|
||||
IntrinsicContext* context );
|
||||
|
||||
internal static void InitIntrinsicContext()
|
||||
{
|
||||
int statCode;
|
||||
|
||||
fixed (IntrinsicContext* cptr = &_intrinsicContext)
|
||||
{
|
||||
statCode = LoadIntrinsicFunction(cptr);
|
||||
}
|
||||
|
||||
switch (statCode)
|
||||
{
|
||||
|
||||
case 0:
|
||||
Dialogue.PostError(new PlatformNotSupportedException("No SIMD instructions supported on current hardware platform"));
|
||||
Environment.Exit(-1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
@@ -36,6 +37,9 @@ using System.IO.Pipes;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
using Windows.Win32.UI.WindowsAndMessaging;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
@@ -44,7 +48,58 @@ namespace StgSharp
|
||||
|
||||
private static Process? _dialogueProcess;
|
||||
private static AnonymousPipeServerStream _dialogueClientPipe,_dialogueServerPipe;
|
||||
private static ConcurrentBag<string> msgCache = new ConcurrentBag<string>(
|
||||
);
|
||||
private static int _readAndWriteThreadId;
|
||||
private static ProcessStartInfo _dialogueProcessInfo;
|
||||
private static StreamReader _dr;
|
||||
private static StreamWriter _dw;
|
||||
|
||||
public static bool NeedShowWhenStartup
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
public static void SetReadAndWriteThread(Thread thread)
|
||||
{
|
||||
_readAndWriteThreadId = thread.ManagedThreadId;
|
||||
}
|
||||
|
||||
private static void AssertThread()
|
||||
{
|
||||
if (_readAndWriteThreadId != Thread.CurrentThread.ManagedThreadId)
|
||||
{
|
||||
throw new InvalidOperationException("Communication with dialogue can only call from certain thread.");
|
||||
}
|
||||
}
|
||||
|
||||
internal static void CreateDialogueProcessIfNotExist()
|
||||
{
|
||||
if( _dialogueProcess != null ) {
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(_dialogueProcessInfo.FileName))
|
||||
{
|
||||
|
||||
}
|
||||
_dialogueProcess = Process.Start( _dialogueProcessInfo );
|
||||
|
||||
_dr = new StreamReader(_dialogueClientPipe);
|
||||
_dw = new StreamWriter(_dialogueServerPipe);
|
||||
|
||||
_dialogueProcess!.Exited += DialogueProcessExitCallback;
|
||||
|
||||
_dialogueServerPipe.DisposeLocalCopyOfClientHandle();
|
||||
_dialogueClientPipe.DisposeLocalCopyOfClientHandle();
|
||||
}
|
||||
|
||||
private static void DialogueProcessExitCallback(object? sender, EventArgs e)
|
||||
{
|
||||
_dialogueProcess = null;
|
||||
_dr.Close();
|
||||
_dw.Close();
|
||||
}
|
||||
|
||||
internal static void LoadDialogue()
|
||||
{
|
||||
@@ -67,20 +122,36 @@ namespace StgSharp
|
||||
throw new PlatformNotSupportedException( "Unknown OS platform" );
|
||||
}
|
||||
|
||||
string consoleRoute = $"{path}{Path.DirectorySeparatorChar}StgSharpErrorConsole{exeName}";
|
||||
string consoleRoute = $"{path}{Path.DirectorySeparatorChar}StgSharpTerminalDialogue{Path.DirectorySeparatorChar}StgSharpTerminalDialogue{exeName}";
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo
|
||||
_dialogueProcessInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = path,
|
||||
Arguments = _dialogueServerPipe.GetClientHandleAsString() + " " + _dialogueClientPipe.GetClientHandleAsString(),
|
||||
FileName = consoleRoute,
|
||||
Arguments = $"{_dialogueServerPipe.GetClientHandleAsString()} {_dialogueClientPipe.GetClientHandleAsString()}",
|
||||
UseShellExecute = true,
|
||||
RedirectStandardOutput = false,
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
internal static void PostMessage(
|
||||
string instruction,
|
||||
params string[] operands ) { }
|
||||
params string[] operands)
|
||||
{
|
||||
CreateDialogueProcessIfNotExist();
|
||||
|
||||
_dw.WriteLine($"{instruction} {operands}");
|
||||
|
||||
}
|
||||
|
||||
public static void PostError(Exception ex)
|
||||
{
|
||||
CreateDialogueProcessIfNotExist();
|
||||
|
||||
_dw.WriteLine($"posterror {ex.Message}");
|
||||
|
||||
_dialogueProcess!.Exited -= DialogueProcessExitCallback;
|
||||
}
|
||||
|
||||
internal static void UnloadDialogue()
|
||||
{
|
||||
@@ -93,20 +164,23 @@ namespace StgSharp
|
||||
_dialogueClientPipe.Dispose();
|
||||
}
|
||||
|
||||
private static void CreateDialogueProcessIfNotExist()
|
||||
internal static string WaitCertainReturn( string target )
|
||||
{
|
||||
if( _dialogueProcess != null ) {
|
||||
return;
|
||||
if( _dialogueProcess == null ) {
|
||||
return string.Empty;
|
||||
}
|
||||
_dialogueProcess = Process.Start( _dialogueProcessInfo );
|
||||
|
||||
_dialogueProcess.Exited += ( sender, e ) => {
|
||||
_dialogueProcess = null;
|
||||
_dialogueProcess = null;
|
||||
};
|
||||
string temp = string .Empty;
|
||||
do {
|
||||
temp = _dr.ReadLine();
|
||||
temp = temp ?? string.Empty;
|
||||
if( !temp!.StartsWith( target ) ) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
|
||||
_dialogueServerPipe.DisposeLocalCopyOfClientHandle();
|
||||
_dialogueClientPipe.DisposeLocalCopyOfClientHandle();
|
||||
int index = temp.IndexOf( ' ' );
|
||||
return index != -1 ? temp.Substring( index + 1 ) : string.Empty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
// using StgSharp.Graphics;
|
||||
// using StgSharp.Math;
|
||||
|
||||
using StgSharp.Data.Intrinsic;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -82,7 +84,7 @@ namespace StgSharp
|
||||
private static uint markCount = 0;
|
||||
internal static GraphicAPI API = default;
|
||||
|
||||
public static void Init()
|
||||
public static unsafe void Init()
|
||||
{
|
||||
mainTimeProvider = new StgSharpTime();
|
||||
MainTimeProvider.StartProvidingTime();
|
||||
@@ -92,6 +94,15 @@ namespace StgSharp
|
||||
$"Program {Assembly.GetEntryAssembly()!.FullName} Started.",
|
||||
LogType.Info );
|
||||
_mainThreadID = Environment.CurrentManagedThreadId;
|
||||
|
||||
|
||||
Dialogue.LoadDialogue();
|
||||
if (Dialogue.NeedShowWhenStartup)
|
||||
{
|
||||
Dialogue.CreateDialogueProcessIfNotExist();
|
||||
}
|
||||
|
||||
InternalIO.InitIntrinsicContext();
|
||||
}
|
||||
|
||||
public static void LogError( Exception ex )
|
||||
|
||||
@@ -50,7 +50,6 @@ namespace StgSharp.Graphics
|
||||
public abstract class RenderStream
|
||||
{
|
||||
|
||||
private protected (int x, int y, int z) _coordStretch;
|
||||
private protected ViewPort primeArgs;
|
||||
private Camera nativeCamera;
|
||||
internal TimeSpanProvider _timeProvider;
|
||||
@@ -86,8 +85,6 @@ namespace StgSharp.Graphics
|
||||
get => primeArgs.Name;
|
||||
}
|
||||
|
||||
public Vec2 GlobalCoordSize => (( Width * 1.0f ) / _coordStretch.x, ( Height * 1.0f ) / _coordStretch.y);
|
||||
|
||||
public ViewPort BindedViewPortContext
|
||||
{
|
||||
get => primeArgs;
|
||||
@@ -152,7 +149,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
TTarget target = new TTarget();
|
||||
target.Initialize(
|
||||
source.BindedViewPortContext, source._coordStretch,
|
||||
source.BindedViewPortContext,
|
||||
source._timeProvider );
|
||||
return target;
|
||||
}
|
||||
@@ -204,7 +201,6 @@ namespace StgSharp.Graphics
|
||||
|
||||
public void Initialize(
|
||||
ViewPort v,
|
||||
(int, int, int) unitCubeSize,
|
||||
TimeSpanProvider timeProvider )
|
||||
{
|
||||
if( v == null ) {
|
||||
@@ -212,7 +208,6 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
primeArgs = v;
|
||||
this._timeProvider = timeProvider;
|
||||
_coordStretch = unitCubeSize;
|
||||
nativeCamera = new Camera();
|
||||
PlatformSpecifiedInitialize();
|
||||
CustomizeInit();
|
||||
|
||||
@@ -106,22 +106,20 @@ namespace StgSharp.MVVM.View
|
||||
|
||||
protected ViewResponder<TView> Responder => ( _binding.Responder as ViewResponder<TView> )!;
|
||||
|
||||
public T CreateRenderStream<T>( (int x, int y, int z) unitCubeSize )
|
||||
public T CreateRenderStream<T>()
|
||||
where T: RenderStream, new()
|
||||
{
|
||||
T ret = new T();
|
||||
ret.Initialize(
|
||||
_binding.context, unitCubeSize, Binding.TimeProvider );
|
||||
_binding.context, Binding.TimeProvider );
|
||||
return ret;
|
||||
}
|
||||
|
||||
public T CreateRenderStream<T>(
|
||||
ViewPort vp,
|
||||
(int x, int y, int z) unitCubeSize )
|
||||
public T CreateRenderStream<T>( ViewPort vp )
|
||||
where T: RenderStream, new()
|
||||
{
|
||||
T ret = new T();
|
||||
ret.Initialize( vp, unitCubeSize, Binding.TimeProvider );
|
||||
ret.Initialize( vp, Binding.TimeProvider );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ namespace StgSharp.MVVM.ViewModel
|
||||
{
|
||||
Interlocked.Exchange( ref _frameSpeed, _frameCount );
|
||||
Interlocked.Exchange( ref _frameCount, 0 );
|
||||
/**/
|
||||
/*
|
||||
Console.Clear();
|
||||
Console.WriteLine( FrameSpeed );
|
||||
/**/
|
||||
|
||||
@@ -70,10 +70,10 @@ namespace StgSharp.MVVM
|
||||
_handleToViewPortIndex.TryAdd( ViewPortID, this );
|
||||
}
|
||||
|
||||
internal ViewPort( Vec2 size, string name, IntPtr monitor )
|
||||
internal ViewPort(int width, int height, string name, IntPtr monitor )
|
||||
{
|
||||
_newWidth = ( int )size.X;
|
||||
_newHeight = ( int )size.Y;
|
||||
_newWidth = width;
|
||||
_newHeight = height;
|
||||
FlushSize();
|
||||
Name = name;
|
||||
Monitor = monitor;
|
||||
|
||||
@@ -52,8 +52,8 @@ namespace StgSharp.Math
|
||||
|
||||
public Matrix22()
|
||||
{
|
||||
Unsafe.SkipInit( out _mat );
|
||||
Unsafe.SkipInit(out _transpose);
|
||||
Unsafe.SkipInit( out this );
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix22( ColumnSet2 mat )
|
||||
@@ -63,12 +63,16 @@ namespace StgSharp.Math
|
||||
|
||||
internal Matrix22( Vector4 c0, Vector4 c1 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
_mat.colum0 = c0;
|
||||
_mat.colum1 = c1;
|
||||
}
|
||||
|
||||
public Matrix22( float a00, float a01, float a10, float a11 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
_mat.colum0 = new Vector4( a00, a10, 0, 0 );
|
||||
_mat.colum1 = new Vector4( a01, a11, 0, 0 );
|
||||
}
|
||||
@@ -163,7 +167,7 @@ namespace StgSharp.Math
|
||||
Vector4.Dot( left._transpose.colum1, right.mat.colum0 ),
|
||||
Vector4.Dot( left._transpose.colum1, right.mat.colum1 ),
|
||||
Vector4.Dot( left._transpose.colum1, right.mat.colum2 ),
|
||||
Vector4.Dot( left._transpose.colum1, right.mat.colum3 ) );
|
||||
Vector4.Dot( left._transpose.colum1, right.mat.colum3 ));
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace StgSharp.Math
|
||||
Pack = 16 )]
|
||||
public struct Matrix24 : IMat
|
||||
{
|
||||
|
||||
[FieldOffset( 6 * 4 * sizeof( float ) )] internal bool isTransposed;
|
||||
[FieldOffset( 4 * 4 * sizeof( float ) )] internal ColumnSet2 transpose;
|
||||
|
||||
@@ -54,8 +53,16 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 32 )] public Vec2 Colum2;
|
||||
[FieldOffset( 48 )] public Vec2 Colum3;
|
||||
|
||||
public Matrix24()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix24( Vector4 c0, Vector4 c1, Vector4 c2, Vector4 c3 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
mat.colum2 = c2;
|
||||
@@ -72,6 +79,8 @@ namespace StgSharp.Math
|
||||
float a12,
|
||||
float a13 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, 0, 0 );
|
||||
mat.colum1 = new Vector4( a01, a11, 0, 0 );
|
||||
mat.colum2 = new Vector4( a02, a12, 0, 0 );
|
||||
@@ -200,13 +209,11 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix24 operator +( Matrix24 left, Matrix24 right )
|
||||
public static unsafe Matrix24 operator +( Matrix24 left, Matrix24 right )
|
||||
{
|
||||
return new Matrix24(
|
||||
left.mat.colum0 + right.mat.colum0,
|
||||
left.mat.colum1 + right.mat.colum1,
|
||||
left.mat.colum2 + right.mat.colum2,
|
||||
left.mat.colum3 + right.mat.colum3 );
|
||||
Matrix24 ret = new Matrix24();
|
||||
InternalIO.Intrinsic.add_mat_4(&left.mat,&right.mat,&ret.mat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,8 +52,16 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 0 )] internal Vec3 colum0;
|
||||
[FieldOffset( 4 * 4 )] internal Vec3 colum1;
|
||||
|
||||
public Matrix32()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix32( Vector4 c0, Vector4 c1 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
}
|
||||
@@ -66,11 +74,8 @@ namespace StgSharp.Math
|
||||
float a20,
|
||||
float a21 )
|
||||
{
|
||||
#if NET5_0_OR_GREATER
|
||||
Unsafe.SkipInit( out colum0 );
|
||||
Unsafe.SkipInit( out colum1 );
|
||||
Unsafe.SkipInit( out transpose );
|
||||
#endif
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, 0 );
|
||||
mat.colum1 = new Vector4( a01, a11, a21, 0 );
|
||||
}
|
||||
@@ -204,11 +209,11 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix32 operator +( Matrix32 left, Matrix32 right )
|
||||
public static unsafe Matrix32 operator +( Matrix32 left, Matrix32 right )
|
||||
{
|
||||
return new Matrix32(
|
||||
left.mat.colum0 + right.mat.colum0,
|
||||
left.mat.colum1 + right.mat.colum1 );
|
||||
Matrix32 ret = new Matrix32();
|
||||
InternalIO.Intrinsic.add_mat_2(&left.mat, &right.mat, &ret.mat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,8 +52,16 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 1 * 4 * sizeof( float ) )] public Vec3 Colum1;
|
||||
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
||||
|
||||
public Matrix33()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix33( Vector4 c0, Vector4 c1, Vector4 c2 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
mat.colum2 = c2;
|
||||
@@ -70,6 +78,8 @@ namespace StgSharp.Math
|
||||
float a21,
|
||||
float a22 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, 0 );
|
||||
mat.colum1 = new Vector4( a01, a11, a21, 0 );
|
||||
mat.colum2 = new Vector4( a02, a12, a22, 0 );
|
||||
@@ -219,12 +229,11 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix33 operator +( Matrix33 left, Matrix33 right )
|
||||
public static unsafe Matrix33 operator +( Matrix33 left, Matrix33 right )
|
||||
{
|
||||
return new Matrix33(
|
||||
left.mat.colum0 + right.mat.colum0,
|
||||
left.mat.colum1 + right.mat.colum1,
|
||||
left.mat.colum2 + right.mat.colum2 );
|
||||
Matrix33 ret = new Matrix33();
|
||||
InternalIO.Intrinsic.add_mat_3(&left.mat, &right.mat, &ret.mat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -55,13 +55,23 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 2 * 4 * sizeof( float ) )] public Vec3 Colum2;
|
||||
[FieldOffset( 3 * 4 * sizeof( float ) )] public Vec3 Colum3;
|
||||
|
||||
public Matrix34()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix34( ColumnSet4 mat )
|
||||
{
|
||||
Unsafe.SkipInit( out this );
|
||||
isTransposed = false;
|
||||
this.mat = mat;
|
||||
}
|
||||
|
||||
internal Matrix34( Vector4 c0, Vector4 c1, Vector4 c2, Vector4 c3 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
mat.colum2 = c2;
|
||||
@@ -82,6 +92,8 @@ namespace StgSharp.Math
|
||||
float a22,
|
||||
float a23 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, 0 );
|
||||
mat.colum0 = new Vector4( a01, a11, a21, 0 );
|
||||
mat.colum0 = new Vector4( a02, a12, a22, 0 );
|
||||
@@ -215,13 +227,12 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix34 operator +( Matrix34 left, Matrix34 right )
|
||||
public static unsafe Matrix34 operator +( Matrix34 left, Matrix34 right )
|
||||
{
|
||||
return new Matrix34(
|
||||
left.mat.colum0 + right.mat.colum0,
|
||||
left.mat.colum1 + right.mat.colum1,
|
||||
left.mat.colum2 + right.mat.colum2,
|
||||
left.mat.colum3 + right.mat.colum3 );
|
||||
Matrix34 ret = new Matrix34();
|
||||
InternalIO.Intrinsic.add_mat_4(&left.mat,&right.mat,&ret.mat);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,13 +49,23 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 0 )] internal ColumnSet2 mat;
|
||||
[FieldOffset( 8 * sizeof( float ) )] internal ColumnSet4 transpose;
|
||||
|
||||
public Matrix42()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix42( ColumnSet2 mat )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
this.mat = mat;
|
||||
}
|
||||
|
||||
internal Matrix42( Vector4 c0, Vector4 c1 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed= false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
}
|
||||
@@ -70,6 +80,8 @@ namespace StgSharp.Math
|
||||
float a30,
|
||||
float a31 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, a30 );
|
||||
mat.colum1 = new Vector4( a01, a11, a21, a31 );
|
||||
}
|
||||
|
||||
@@ -35,11 +35,12 @@ using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.AccessControl;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
[StructLayout(
|
||||
LayoutKind.Explicit,
|
||||
layoutKind: LayoutKind.Explicit,
|
||||
Size = ( 7 * 4 * sizeof( float ) ) + sizeof( bool ),
|
||||
Pack = 16 )]
|
||||
public struct Matrix43 : IEquatable<Matrix43>, IMat
|
||||
@@ -50,12 +51,19 @@ namespace StgSharp.Math
|
||||
|
||||
[FieldOffset( 0 )]
|
||||
internal ColumnSet3 mat;
|
||||
|
||||
[FieldOffset( 3 * 4 * sizeof( float ) )]
|
||||
internal ColumnSet4 transpose;
|
||||
|
||||
public Matrix43()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix43( Vector4 c0, Vector4 c1, Vector4 c2 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = c0;
|
||||
mat.colum1 = c1;
|
||||
mat.colum2 = c2;
|
||||
@@ -75,6 +83,8 @@ namespace StgSharp.Math
|
||||
float a31,
|
||||
float a32 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, a30 );
|
||||
mat.colum1 = new Vector4( a01, a11, a21, a31 );
|
||||
mat.colum2 = new Vector4( a02, a12, a22, a32 );
|
||||
@@ -135,12 +145,10 @@ namespace StgSharp.Math
|
||||
internal unsafe void InternalTranspose()
|
||||
{
|
||||
if( !isTransposed ) {
|
||||
fixed( ColumnSet3* source = &this.mat ) {
|
||||
fixed( ColumnSet4* target = &this.transpose ) {
|
||||
InternalIO.Intrinsic.transpose34( source, target );
|
||||
}
|
||||
fixed( ColumnSet3* source = &this.mat )
|
||||
fixed( ColumnSet4* target = &this.transpose ) {
|
||||
InternalIO.Intrinsic.transpose34( source, target );
|
||||
}
|
||||
|
||||
isTransposed = true;
|
||||
}
|
||||
}
|
||||
@@ -160,7 +168,7 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix43 operator *( Matrix43 mat, float value )
|
||||
public static unsafe Matrix43 operator *( Matrix43 mat, float value )
|
||||
{
|
||||
return new Matrix43(
|
||||
mat.mat.colum0 * value, mat.mat.colum1 * value,
|
||||
@@ -242,12 +250,11 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static Matrix43 operator +( Matrix43 left, Matrix43 right )
|
||||
public static unsafe Matrix43 operator +( Matrix43 left, Matrix43 right )
|
||||
{
|
||||
return new Matrix43(
|
||||
left.mat.colum0 + right.mat.colum0,
|
||||
left.mat.colum1 + right.mat.colum1,
|
||||
left.mat.colum2 + right.mat.colum2 );
|
||||
Matrix43 ret = new Matrix43();
|
||||
InternalIO.Intrinsic.add_mat_3(&left.mat, &right.mat, &ret.mat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool operator ==( Matrix43 left, Matrix43 right )
|
||||
|
||||
@@ -55,8 +55,16 @@ namespace StgSharp.Math
|
||||
[FieldOffset( 8 * sizeof( float ) )] internal Vec4 colum2;
|
||||
[FieldOffset( 12 * sizeof( float ) )] internal Vec4 colum3;
|
||||
|
||||
public Matrix44()
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
}
|
||||
|
||||
internal Matrix44( ColumnSet4 mat )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
this.mat = mat;
|
||||
}
|
||||
|
||||
@@ -66,6 +74,8 @@ namespace StgSharp.Math
|
||||
Vector4 vec2,
|
||||
Vector4 vec3 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = vec0;
|
||||
mat.colum1 = vec1;
|
||||
mat.colum2 = vec2;
|
||||
@@ -90,6 +100,8 @@ namespace StgSharp.Math
|
||||
float a32,
|
||||
float a33 )
|
||||
{
|
||||
Unsafe.SkipInit(out this);
|
||||
isTransposed = false;
|
||||
mat.colum0 = new Vector4( a00, a10, a20, a30 );
|
||||
mat.colum1 = new Vector4( a01, a11, a21, a31 );
|
||||
mat.colum2 = new Vector4( a02, a12, a22, a32 );
|
||||
@@ -295,15 +307,11 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
[MethodImpl( MethodImplOptions.AggressiveInlining )]
|
||||
public static unsafe Matrix44 operator +(
|
||||
Matrix44 left,
|
||||
Matrix44 right )
|
||||
public static unsafe Matrix44 operator +(Matrix44 left, Matrix44 right )
|
||||
{
|
||||
return new Matrix44(
|
||||
right.mat.colum0 + left.mat.colum0,
|
||||
right.mat.colum1 + left.mat.colum1,
|
||||
right.mat.colum2 + left.mat.colum2,
|
||||
right.mat.colum3 + left.mat.colum3 );
|
||||
Matrix44 ret = new Matrix44();
|
||||
InternalIO.Intrinsic.add_mat_4(&left.mat, &right.mat, &ret.mat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static bool operator ==( Matrix44 left, Matrix44 right )
|
||||
|
||||
@@ -126,11 +126,9 @@ namespace StgSharp.Stg
|
||||
public void Init( Radius angleStride, string name )
|
||||
{
|
||||
primeArgs = new ViewPort(
|
||||
(1, ( ( new Radius( Scaler.Pi ) ) / angleStride )), name,
|
||||
1, (int)(( new Radius( Scaler.Pi ) ) / angleStride), name,
|
||||
IntPtr.Zero );
|
||||
|
||||
_coordStretch = (1, 1, 1);
|
||||
|
||||
PlatformSpecifiedInitialize();
|
||||
CustomizeInit();
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy $(SolutionDir)StgSharpC.dll $(OutDir)StgSharpC.dll
copy $(SolutionDir)StgSharpC.dll $(OutDir) " />
|
||||
<Exec Command="xcopy /E /I /Y $(SolutionDir)build $(OutDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
||||
+149
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"runtimeTarget": {
|
||||
"name": ".NETCoreApp,Version=v8.0",
|
||||
"signature": ""
|
||||
},
|
||||
"compilationOptions": {},
|
||||
"targets": {
|
||||
".NETCoreApp,Version=v8.0": {
|
||||
"StgSharpTerminalDialogue/1.0.0": {
|
||||
"dependencies": {
|
||||
"Terminal.Gui": "2.0.0-v2-develop.2329"
|
||||
},
|
||||
"runtime": {
|
||||
"StgSharpTerminalDialogue.dll": {}
|
||||
}
|
||||
},
|
||||
"ColorHelper/1.8.1": {
|
||||
"runtime": {
|
||||
"lib/netstandard2.0/ColorHelper.dll": {
|
||||
"assemblyVersion": "1.8.1.0",
|
||||
"fileVersion": "1.8.1.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.IO.Abstractions/21.0.22": {
|
||||
"dependencies": {
|
||||
"TestableIO.System.IO.Abstractions": "21.0.22",
|
||||
"TestableIO.System.IO.Abstractions.Wrappers": "21.0.22"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/System.IO.Abstractions.dll": {
|
||||
"assemblyVersion": "21.0.0.0",
|
||||
"fileVersion": "21.0.22.62509"
|
||||
}
|
||||
}
|
||||
},
|
||||
"System.Text.Encodings.Web/8.0.0": {},
|
||||
"System.Text.Json/8.0.4": {
|
||||
"dependencies": {
|
||||
"System.Text.Encodings.Web": "8.0.0"
|
||||
}
|
||||
},
|
||||
"Terminal.Gui/2.0.0-v2-develop.2329": {
|
||||
"dependencies": {
|
||||
"ColorHelper": "1.8.1",
|
||||
"System.IO.Abstractions": "21.0.22",
|
||||
"System.Text.Json": "8.0.4",
|
||||
"Wcwidth": "2.0.0"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/Terminal.Gui.dll": {
|
||||
"assemblyVersion": "2.0.0.0",
|
||||
"fileVersion": "2.0.0.0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TestableIO.System.IO.Abstractions/21.0.22": {
|
||||
"runtime": {
|
||||
"lib/net8.0/TestableIO.System.IO.Abstractions.dll": {
|
||||
"assemblyVersion": "21.0.0.0",
|
||||
"fileVersion": "21.0.22.62509"
|
||||
}
|
||||
}
|
||||
},
|
||||
"TestableIO.System.IO.Abstractions.Wrappers/21.0.22": {
|
||||
"dependencies": {
|
||||
"TestableIO.System.IO.Abstractions": "21.0.22"
|
||||
},
|
||||
"runtime": {
|
||||
"lib/net8.0/TestableIO.System.IO.Abstractions.Wrappers.dll": {
|
||||
"assemblyVersion": "21.0.0.0",
|
||||
"fileVersion": "21.0.22.62509"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Wcwidth/2.0.0": {
|
||||
"runtime": {
|
||||
"lib/net8.0/Wcwidth.dll": {
|
||||
"assemblyVersion": "2.0.0.0",
|
||||
"fileVersion": "2.0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"libraries": {
|
||||
"StgSharpTerminalDialogue/1.0.0": {
|
||||
"type": "project",
|
||||
"serviceable": false,
|
||||
"sha512": ""
|
||||
},
|
||||
"ColorHelper/1.8.1": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-rblWXd/02TfwJjX53xEfQnbnDRKxCm09VtavV8JaIcmIFWt9efNf6xTQ3WeXgy/she5R31eRTtnizFoUoDrs5w==",
|
||||
"path": "colorhelper/1.8.1",
|
||||
"hashPath": "colorhelper.1.8.1.nupkg.sha512"
|
||||
},
|
||||
"System.IO.Abstractions/21.0.22": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-DRnFyMIjO1KG9fqUPKV7XDPgECEwrNpsb3OLD0mImViVpRZ5747o7vqrOYbn9AMaQ8eajLeKH0fXQglgH7v42A==",
|
||||
"path": "system.io.abstractions/21.0.22",
|
||||
"hashPath": "system.io.abstractions.21.0.22.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Encodings.Web/8.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-yev/k9GHAEGx2Rg3/tU6MQh4HGBXJs70y7j1LaM1i/ER9po+6nnQ6RRqTJn1E7Xu0fbIFK80Nh5EoODxrbxwBQ==",
|
||||
"path": "system.text.encodings.web/8.0.0",
|
||||
"hashPath": "system.text.encodings.web.8.0.0.nupkg.sha512"
|
||||
},
|
||||
"System.Text.Json/8.0.4": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-bAkhgDJ88XTsqczoxEMliSrpijKZHhbJQldhAmObj/RbrN3sU5dcokuXmWJWsdQAhiMJ9bTayWsL1C9fbbCRhw==",
|
||||
"path": "system.text.json/8.0.4",
|
||||
"hashPath": "system.text.json.8.0.4.nupkg.sha512"
|
||||
},
|
||||
"Terminal.Gui/2.0.0-v2-develop.2329": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-1WRHeZKN5tnF8DUu0vHz5pGZIY9ETwufKbUHCoH3UTcIeOlduhRCpBhTyJWri/fePsUkij2euFMGX2yHfk4h/A==",
|
||||
"path": "terminal.gui/2.0.0-v2-develop.2329",
|
||||
"hashPath": "terminal.gui.2.0.0-v2-develop.2329.nupkg.sha512"
|
||||
},
|
||||
"TestableIO.System.IO.Abstractions/21.0.22": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-yq3I8rUjNoo4JTOT3jbGfTM5VfowaSYiooDO2bfvQe6XGVyZiSIzaKyCmSnuUEyuktw6zzuVE1lJnUeDhJWtyQ==",
|
||||
"path": "testableio.system.io.abstractions/21.0.22",
|
||||
"hashPath": "testableio.system.io.abstractions.21.0.22.nupkg.sha512"
|
||||
},
|
||||
"TestableIO.System.IO.Abstractions.Wrappers/21.0.22": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-ETpw1B6VOsQ5zbfqxqLKjITnMvB9M0K5/bK8qJc6jih+tnlKQmtnnOPSS+OeKCqsZDYeHxPNp4ytQPJS3R+WXA==",
|
||||
"path": "testableio.system.io.abstractions.wrappers/21.0.22",
|
||||
"hashPath": "testableio.system.io.abstractions.wrappers.21.0.22.nupkg.sha512"
|
||||
},
|
||||
"Wcwidth/2.0.0": {
|
||||
"type": "package",
|
||||
"serviceable": true,
|
||||
"sha512": "sha512-eGZYH/V+X1DwEXrPUlUcAp8pU5a38d8IvaQzq4pclJxF1x8bizssIo4uWc3qxmS64BNGK5WnDxyBYJz84+Msqg==",
|
||||
"path": "wcwidth/2.0.0",
|
||||
"hashPath": "wcwidth.2.0.0.nupkg.sha512"
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"runtimeOptions": {
|
||||
"tfm": "net8.0",
|
||||
"framework": {
|
||||
"name": "Microsoft.NETCore.App",
|
||||
"version": "8.0.0"
|
||||
},
|
||||
"configProperties": {
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ 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+6e2f93b053825680d03e27c9acae8ded6bd00dc4")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7c8d462ca5da46abdfb0e7278f81d25abe890887")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6e2f93b053825680d03e27c9acae8ded6bd00dc4")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7c8d462ca5da46abdfb0e7278f81d25abe890887")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
Reference in New Issue
Block a user