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
|
||||
{
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Controlling
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user