daily update on 20240828 by nitload youmu, autotexture added

This commit is contained in:
Nitload
2024-08-28 10:58:31 +08:00
parent d082071f2d
commit 1ee4e4a42f
586 changed files with 60910 additions and 123106 deletions
@@ -1,4 +1,34 @@
using System;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="ErrorDefine.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,10 +38,12 @@ namespace StgSharp
{
public class UniformEmptyReferenceException : Exception
{
public UniformEmptyReferenceException(string program, string name):
public UniformEmptyReferenceException(string program, string name) :
base($"Location -1 returned when trying to find uniform {name} in shader program {program}")
{
}
}
}
@@ -42,10 +42,12 @@ namespace StgSharp
public static unsafe partial class StgSharp
{
internal const int ssdSegmentLength = 16;
static byte[] _currentHash;
private static bool _inited;
internal const int ssdSegmentLength = 16;
private static int _mainThreadID = -1;
public static byte[] CurrentAssemblyHash
{
@@ -65,8 +67,15 @@ namespace StgSharp
}
}
public static int MainThreadID
{
get => (_mainThreadID == -1) ?
throw new InvalidOperationException("StgSharp environment is not inited. " +
"Main thread id is not available") : _mainThreadID;
}
/// <summary>
/// Init an instance of OpenGL program,
/// CustomizeInit an instance of OpenGL program,
/// This method should be called before any other StgSharp api.
/// </summary>
public static void InitGL(int majorVersion, int minorVersion)
@@ -99,5 +108,5 @@ namespace StgSharp
}
}//------------------------end of class------------------------//
}//-------------------------------------- End of Class ---------------------------------------//
}
@@ -1,4 +1,34 @@
using StgSharp.Graphics;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="Monitors.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Graphics;
using System;
using System.Collections.Generic;
@@ -11,18 +41,19 @@ namespace StgSharp
{
public static partial class StgSharp
{
private unsafe static IntPtr[] monitorsArray;
private static unsafe IntPtr[] monitorsArray;
public static unsafe IntPtr[] MonitorsHandleArray
{
get
get
{
if (monitorsArray == null)
{
int count = 0;
IntPtr* arrayhandle = InternalIO.glfwGetMonitors(&count);
monitorsArray = new IntPtr[count];
Marshal.Copy((IntPtr)arrayhandle,monitorsArray,0,count);
Marshal.Copy((IntPtr)arrayhandle, monitorsArray, 0, count);
Marshal.FreeHGlobal((IntPtr)arrayhandle);
}
return monitorsArray;
@@ -31,11 +62,9 @@ namespace StgSharp
public static IntPtr DefaultMonitor
{
get
{
return MonitorsHandleArray[0];
}
get { return MonitorsHandleArray[0]; }
}
}
@@ -42,6 +42,7 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
#if Windows
@@ -64,8 +65,6 @@ namespace StgSharp
VK
}
public static partial class StgSharp
{
@@ -76,8 +75,9 @@ namespace StgSharp
/// </summary>
public const long version = 430;
private static uint markCount = 0;
private static bool vsyncActivated;
private static uint markCount = 0;
internal static GraphicAPI API = default;
public static void Init()
@@ -89,6 +89,7 @@ namespace StgSharp
InternalIO.InternalWriteLog(
$"Program {Assembly.GetEntryAssembly()!.FullName} Started.",
LogType.Info);
_mainThreadID = Environment.CurrentManagedThreadId;
}
public static void LogError(Exception ex)
@@ -96,6 +97,11 @@ namespace StgSharp
InternalIO.InternalWriteLog(ex.Message, LogType.Error);
}
public static void LogInfo(string log)
{
InternalIO.InternalWriteLog(log, LogType.Info);
}
public static void LogWarning(string log)
{
InternalIO.InternalWriteLog(log, LogType.Warning);
@@ -105,11 +111,6 @@ namespace StgSharp
InternalIO.InternalWriteLog(notVerySeriesException.Message, LogType.Warning);
}
public static void LogInfo(string log)
{
InternalIO.InternalWriteLog(log, LogType.Info);
}
public static void Mark(bool needConsole)
{
markCount++;
@@ -121,7 +122,7 @@ namespace StgSharp
public static void Terminate()
{
MainTimeProvider.Terminate();
MainTimeProvider.StopProvidingTime();
InternalIO.glfwTerminate();
}
@@ -28,7 +28,9 @@
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using StgSharp.Logic;
using StgSharp.Timing;
using System;
using System.Collections.Generic;
@@ -39,29 +41,28 @@ using System.Threading;
namespace StgSharp
{
public partial class StgSharp
public static partial class StgSharp
{
internal static StgSharpTime mainTimeProvider = new StgSharpTime();
internal static StgSharpTime mainTimeProvider;
internal static StgSharpTime MainTimeProvider => mainTimeProvider;
internal static TimeSourceProviderBase MainTimeProvider => mainTimeProvider;
}
public sealed class StgSharpTime : TimeSourceProviderBase
{
private static List<TimeSpanProvider> subscriberList = new List<TimeSpanProvider>();
private static long accuracy;
private static Stopwatch mainProvider = new Stopwatch();
private static List<TimeSpanProvider> subscriberList = new List<TimeSpanProvider>();
private static Thread timeProvideThread;
internal StgSharpTime()
{
}
public static StgSharpTime OnlyInstance => StgSharp.MainTimeProvider;
public static TimeSourceProviderBase OnlyInstance => StgSharp.MainTimeProvider;
public override sealed void StartProvidingTime()
{
@@ -92,6 +93,14 @@ namespace StgSharp
timeProvideThread.Start();
}
public override void StopProvidingTime()
{
lock (mainProvider)
{
mainProvider.Stop();
}
}
public void Terminate()
{
lock (mainProvider)
@@ -1,4 +1,34 @@
using System;
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
// file="globalKeyStat.cs"
// Project: StgSharp
// AuthorGroup: Nitload Space
// Copyright (c) Nitload Space. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the “Software”), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and
// this permission notice shall be included in all copies
// or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”,
// WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//-----------------------------------------------------------------------
//-----------------------------------------------------------------------
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +40,8 @@ namespace StgSharp
public static partial class StgSharp
{
private static ConcurrentDictionary<int, KeyStatus> keyListener
private static ConcurrentDictionary<int, KeyStatus> keyListener
= new ConcurrentDictionary<int, KeyStatus>();
public static KeyStatus CheckKey(KeyboardKey key)