daily update on 20240424 by nitloady youmu
This commit is contained in:
@@ -11,9 +11,7 @@ namespace StgSharp.Graphics
|
||||
|
||||
public partial class Form
|
||||
{
|
||||
Dictionary<KeyboardKey, KeyEvent> keyEventDictionary = new Dictionary<KeyboardKey, KeyEvent>();
|
||||
|
||||
|
||||
Dictionary<KeyboardKey, KeyBoardEvent> keyEventDictionary = new Dictionary<KeyboardKey, KeyBoardEvent>();
|
||||
|
||||
internal void InternalLoadInput(MethodInfo[] methods)
|
||||
{
|
||||
@@ -35,17 +33,15 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
internal void InternalProcessInput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public sealed class KeyEvent
|
||||
{
|
||||
public delegate void KeyBoardEvent(KeyboardKey key, KeyStatus status);
|
||||
public delegate void MouseEvent(Mouse mouse, KeyStatus status);
|
||||
public delegate void JoystickEvent(Joystick joystick, KeyStatus status);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="IMemoryType.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;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
public interface IMemoryType
|
||||
{
|
||||
|
||||
public T Read<T>(int index) where T : struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#endif
|
||||
;
|
||||
|
||||
public void Write<T>(int index, T value) where T : struct
|
||||
#if NET8_0_OR_GREATER
|
||||
, INumber
|
||||
#endif
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,8 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
@@ -41,7 +43,7 @@ using System.Text;
|
||||
namespace StgSharp.Data
|
||||
{
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 16)]
|
||||
public unsafe struct M128
|
||||
public unsafe struct M128:IMemoryType
|
||||
{
|
||||
[FieldOffset(0)] internal Vector4 vec;
|
||||
|
||||
@@ -50,13 +52,6 @@ namespace StgSharp.Data
|
||||
vec = v;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public ulong GetLongHash()
|
||||
{
|
||||
return (Read<ulong>(0) % 2147483647L) * (Read<ulong>(1) % 2147483647L);
|
||||
}
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public T Read<T>(int index) where T : struct
|
||||
{
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
using StgSharp.Data;
|
||||
|
||||
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.Math.HighPrecession
|
||||
{
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct M256:IMemoryType
|
||||
{
|
||||
private M128 v0;
|
||||
private M128 v1;
|
||||
|
||||
|
||||
T IMemoryType.Read<T>(int index)
|
||||
{
|
||||
fixed (M128* mptr = &v0)
|
||||
{
|
||||
return *(((T*)mptr) + index);
|
||||
}
|
||||
}
|
||||
|
||||
void IMemoryType.Write<T>(int index, T value)
|
||||
{
|
||||
fixed (M128* mptr = &v0)
|
||||
{
|
||||
*(((T*)mptr) + index) = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using StgSharp.Graphics;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp
|
||||
{
|
||||
public static partial class StgSharp
|
||||
{
|
||||
private unsafe static IntPtr[] monitorsArray;
|
||||
|
||||
public static unsafe IntPtr[] MonitorsHandleArray
|
||||
{
|
||||
get
|
||||
{
|
||||
if (monitorsArray == null)
|
||||
{
|
||||
int count = 0;
|
||||
IntPtr* arrayhandle = InternalIO.glfwGetMonitors(&count);
|
||||
monitorsArray = new IntPtr[count];
|
||||
Marshal.Copy((IntPtr)arrayhandle,monitorsArray,0,count);
|
||||
Marshal.FreeHGlobal((IntPtr)arrayhandle);
|
||||
}
|
||||
return monitorsArray;
|
||||
}
|
||||
}
|
||||
|
||||
public static IntPtr DefaultMonitor
|
||||
{
|
||||
get
|
||||
{
|
||||
return MonitorsHandleArray[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -10,17 +10,14 @@ namespace StgSharp
|
||||
|
||||
public static partial class StgSharp
|
||||
{
|
||||
private static ConcurrentDictionary<int, bool> keyListener = new ConcurrentDictionary<int, bool>();
|
||||
private static ConcurrentDictionary<int, KeyStatus> keyListener
|
||||
= new ConcurrentDictionary<int, KeyStatus>();
|
||||
|
||||
public static KeyStatus CheckKey(KeyboardKey key)
|
||||
{
|
||||
int keyId = (int)key;
|
||||
if (keyListener.ContainsKey((int)keyId))
|
||||
{
|
||||
return keyListener[(int)keyId]?KeyStatus.PRESS:KeyStatus.RELEASE;
|
||||
}
|
||||
keyListener.AddOrUpdate
|
||||
return keyListener.GetOrAdd((int)key, KeyStatus.RELEASE);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public abstract class ICoord
|
||||
{
|
||||
protected Matrix44 coordMat;
|
||||
|
||||
public abstract Matrix44 GlobalCoordTransformation
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract vec3d Center
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract vec3d X_axis
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract vec3d Y_axis
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public abstract vec3d Z_axis
|
||||
{
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class StreamLocalCoordinate:ICoord
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="Class1.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.Text;
|
||||
|
||||
namespace StgSharp.Geometries
|
||||
{
|
||||
public class SpaceCoordinate
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWvidmode
|
||||
public unsafe struct glfwVideomode
|
||||
{
|
||||
|
||||
/*! The refresh rate, in Hz, of the video mode.
|
||||
@@ -140,7 +140,7 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWgammaramp
|
||||
public unsafe struct glfwGammaramp
|
||||
{
|
||||
|
||||
/*! An array of value describing the response of the blue channel.
|
||||
@@ -166,13 +166,13 @@ namespace StgSharp.Graphics
|
||||
/*! The height, in pixels, of this image.
|
||||
*/
|
||||
private int height;
|
||||
/*! The width, in pixels, of this image.
|
||||
*/
|
||||
private int width;
|
||||
/*! The pixel data of this image, arranged left-to-right, top-to-bottom.
|
||||
*/
|
||||
private byte* pixels;
|
||||
|
||||
/*! The width, in pixels, of this image.
|
||||
*/
|
||||
private int width;
|
||||
|
||||
}
|
||||
|
||||
@@ -210,35 +210,36 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmonitor
|
||||
public unsafe struct glfwMonitor
|
||||
{
|
||||
|
||||
private GLFWvidmode currentMode;
|
||||
private GLFWgammaramp currentRamp;
|
||||
private fixed byte name[128];
|
||||
private IntPtr userPointer;
|
||||
|
||||
private int width, height;
|
||||
|
||||
private glfwWindow* window;
|
||||
|
||||
private glfwVideomode* modes;
|
||||
private int modeCount;
|
||||
private glfwVideomode currentMode;
|
||||
|
||||
//GLFWvidmode* modes;
|
||||
private IntPtr modes;
|
||||
private glfwGammaramp originalRamp;
|
||||
private glfwGammaramp currentRamp;
|
||||
|
||||
private byte[] name = new byte[128];
|
||||
|
||||
private GLFWgammaramp originalRamp;
|
||||
private void* userPointer;
|
||||
|
||||
// Physical dimensions in millimeters.
|
||||
private int widthMM, heightMM;
|
||||
|
||||
// The window whose video mode is current on this monitor
|
||||
//glfwWindow* window;
|
||||
private IntPtr window;
|
||||
|
||||
// not transformed
|
||||
//GLFW_PLATFORM_MONITOR_STATE;
|
||||
|
||||
public GLFWmonitor()
|
||||
public glfwMonitor()
|
||||
{ }
|
||||
|
||||
public unsafe string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
fixed (byte* cptr = name)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi((IntPtr)cptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@@ -256,7 +257,7 @@ namespace StgSharp.Graphics
|
||||
int shouldClose;
|
||||
void* userPointer;
|
||||
int doublebuffer;
|
||||
// GLFWvidmode videoMode; // 根据GLFWvidmode的定义转换
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
IntPtr cursor; // _GLFWcursor* cursor;
|
||||
|
||||
@@ -819,10 +820,10 @@ namespace StgSharp.Graphics
|
||||
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
||||
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
||||
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
||||
GLFWvidmode* (* getVideoModes) (GLFWmonitor*, int*);
|
||||
void (* getVideoMode) (GLFWmonitor*, GLFWvidmode*);
|
||||
GLFWbool(*getGammaRamp)(GLFWmonitor*, GLFWgammaramp*);
|
||||
void (* setGammaRamp) (GLFWmonitor*,const GLFWgammaramp*);
|
||||
glfwVideomode* (* getVideoModes) (GLFWmonitor*, int*);
|
||||
void (* getVideoMode) (GLFWmonitor*, glfwVideomode*);
|
||||
GLFWbool(*getGammaRamp)(GLFWmonitor*, glfwGammaramp*);
|
||||
void (* setGammaRamp) (GLFWmonitor*,const glfwGammaramp*);
|
||||
// window
|
||||
GLFWbool(*createWindow)(glfwWindow*,const GLFWwndconfig*,const GLFWctxconfig*,const GLFWfbconfig*);
|
||||
void (* destroyWindow) (glfwWindow*);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace StgSharp.Graphics
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwGetFramebufferSize(IntPtr window, int* width, int* height);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate byte* glfwGetGamepadName(int jid);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWgammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate int glfwGetInputMode(IntPtr window, int mode);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate float* glfwGetJoystickAxes(int jid, int* count);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate byte* glfwGetJoystickButtons(int jid, int* count);
|
||||
@@ -101,8 +101,8 @@ namespace StgSharp.Graphics
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate ulong* glfwGetTimerValue();
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwGetVersion(int* major, int* minor, int* rev);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate byte* glfwGetVersionString();
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWvidmode* glfwGetVideoMode(IntPtr monitor);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWvidmode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate glfwVideomode* glfwGetVideoMode(IntPtr monitor);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate int glfwGetWindowAttrib(IntPtr window, int attrib);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwGetWindowContentScale(IntPtr window, float* xscale, float* yscale);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwGetWindowFrameSize(IntPtr window, int* left, int* top, int* right, int* bottom);
|
||||
@@ -135,7 +135,7 @@ namespace StgSharp.Graphics
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWerrorfun glfwSetErrorCallback(GLFWerrorfun callback);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate FramebuffersizeHandler glfwSetFramebufferSizeCallback(IntPtr window, IntPtr callback);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwSetGamma(IntPtr monitor, float gamma);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwSetGammaRamp(IntPtr monitor, GLFWgammaramp* ramp);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwSetInputMode(IntPtr window, int mode, int value);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate GLFWjoystickfun glfwSetJoystickCallback(GLFWjoystickfun callback);
|
||||
[UnmanagedFunctionPointer(callingConvention: CallingConvention.StdCall, CharSet = CharSet.Ansi)] internal unsafe delegate void glfwSetJoystickUserPointer(int jid, void* pointer);
|
||||
|
||||
@@ -90,7 +90,11 @@ namespace StgSharp.Graphics
|
||||
public int Height
|
||||
{
|
||||
get => height;
|
||||
set => height = value;
|
||||
set
|
||||
{
|
||||
height = value;
|
||||
InternalIO.glfwSetWindowSize(windowID, Width, Height);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldClose
|
||||
@@ -109,6 +113,7 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
width = (int)value.X;
|
||||
height = (int)value.Y;
|
||||
InternalIO.glfwSetWindowSize(windowID, Width, Height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +123,11 @@ namespace StgSharp.Graphics
|
||||
public int Width
|
||||
{
|
||||
get => width;
|
||||
set => width = value;
|
||||
set
|
||||
{
|
||||
width = value;
|
||||
InternalIO.glfwSetWindowSize(windowID, Width, Height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -206,18 +215,6 @@ namespace StgSharp.Graphics
|
||||
public void SetSizeLimit(int minWidth, int minHeight, int maxWidth, int maxHeight)
|
||||
{ InternalIO.glfwSetWindowSizeLimits(this.windowID, minWidth, minHeight, maxWidth, maxHeight); }
|
||||
|
||||
#region form main
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void InternalDeInit() { DeInit(); }
|
||||
|
||||
|
||||
unsafe ~Form() { Marshal.FreeHGlobal(graphicContextID); }
|
||||
|
||||
#endregion form main
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,6 +15,16 @@ namespace StgSharp.Graphics
|
||||
set { ContextHandle = value; }
|
||||
}
|
||||
|
||||
internal sealed override void CreateCanvas((int width, int height, int depth) size, (int x_stretch, int y_stretch, int z_stretch) coordStrech, string name)
|
||||
{
|
||||
Width = size.width; Height = size.height;
|
||||
Depth = size.depth;
|
||||
_coordStretch = coordStrech;
|
||||
Name = name;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <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.
|
||||
|
||||
@@ -28,8 +28,11 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -38,6 +41,9 @@ namespace StgSharp.Graphics
|
||||
{
|
||||
public abstract class RenderStream
|
||||
{
|
||||
protected (int x, int y, int z) _coordStretch;
|
||||
private int refDepth;
|
||||
protected Camera NativeCamera;
|
||||
|
||||
private IntPtr canvasHandle;
|
||||
private IntPtr contextHandle;
|
||||
@@ -59,12 +65,30 @@ namespace StgSharp.Graphics
|
||||
get => contextHandle;
|
||||
internal set => contextHandle = value;
|
||||
}
|
||||
|
||||
public int Depth
|
||||
{
|
||||
get => refDepth;
|
||||
internal set => refDepth = value;
|
||||
}
|
||||
|
||||
public int Height
|
||||
{
|
||||
get => height;
|
||||
internal set => height = value;
|
||||
}
|
||||
|
||||
public vec3d GlobalCoordSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return (
|
||||
Width * 1.0f / _coordStrech.x,
|
||||
Height * 1.0f / _coordStrech.y,
|
||||
refDepth * 1.0f / _coordStrech.z);
|
||||
}
|
||||
}
|
||||
|
||||
public IntPtr Monitor
|
||||
{
|
||||
get => monitor;
|
||||
@@ -89,6 +113,10 @@ namespace StgSharp.Graphics
|
||||
internal set => width = value;
|
||||
}
|
||||
|
||||
internal abstract void CreateCanvas(
|
||||
(int width,int height,int depth) size, (int x_stretch,int y_stretch, int z_stretch) coordStrech, string name
|
||||
);
|
||||
|
||||
protected abstract void Init();
|
||||
protected abstract void Main();
|
||||
protected abstract void Deinit();
|
||||
|
||||
@@ -81,15 +81,15 @@ namespace StgSharp
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetMonitorCallback")] internal static extern unsafe GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun callback);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoModes")] internal static extern unsafe GLFWvidmode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoModes")] internal static extern unsafe glfwVideomode* glfwGetVideoModes(IntPtr monitor, int* count);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoMode")] internal static extern unsafe GLFWvidmode* glfwGetVideoMode(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetVideoMode")] internal static extern unsafe glfwVideomode* glfwGetVideoMode(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGamma")] internal static extern unsafe void glfwSetGamma(IntPtr monitor, float gamma);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGammaRamp")] internal static extern unsafe GLFWgammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwGetGammaRamp")] internal static extern unsafe glfwGammaramp* glfwGetGammaRamp(IntPtr monitor);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGammaRamp")] internal static extern unsafe void glfwSetGammaRamp(IntPtr monitor, GLFWgammaramp* ramp);
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwSetGammaRamp")] internal static extern unsafe void glfwSetGammaRamp(IntPtr monitor, glfwGammaramp* ramp);
|
||||
|
||||
[DllImport(SSC_libname, EntryPoint = "glfwDefaultWindowHints")] internal static extern unsafe void glfwDefaultWindowHints();
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@
|
||||
namespace StgSharp.Math
|
||||
{
|
||||
|
||||
internal class Cordination
|
||||
internal class Coordination
|
||||
{
|
||||
}
|
||||
|
||||
public enum CordinatePlain
|
||||
public enum CoordinatePlain
|
||||
{
|
||||
XY,
|
||||
YZ,
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace StgSharp.Math
|
||||
}
|
||||
|
||||
public static Matrix44 Unit
|
||||
=> new Matrix44(
|
||||
=> new Matrix44(
|
||||
1, 0, 0, 0,
|
||||
0, 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
|
||||
@@ -36,17 +36,17 @@ namespace StgSharp.Math
|
||||
public static unsafe partial class VectorCalc
|
||||
{
|
||||
|
||||
public static vec2d To2D(vec3d vec, CordinatePlain plain)
|
||||
public static vec2d To2D(vec3d vec, CoordinatePlain plain)
|
||||
{
|
||||
switch (plain)
|
||||
{
|
||||
case CordinatePlain.XY:
|
||||
case CoordinatePlain.XY:
|
||||
return new vec2d(vec.X, vec.Y);
|
||||
break;
|
||||
case CordinatePlain.YZ:
|
||||
case CoordinatePlain.YZ:
|
||||
return new vec2d(vec.Y, vec.Z);
|
||||
break;
|
||||
case CordinatePlain.XZ:
|
||||
case CoordinatePlain.XZ:
|
||||
return new vec2d(vec.X, vec.Z);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -178,6 +178,13 @@ namespace StgSharp.Math
|
||||
return new vec3d(vec.v / value);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe implicit operator vec3d((float, float, float) tuple)
|
||||
{
|
||||
vec3d v = *(vec3d*)&tuple;
|
||||
v.vec.W = 0.0f;
|
||||
return v;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d operator +(vec3d left, vec3d right)
|
||||
@@ -203,6 +210,7 @@ namespace StgSharp.Math
|
||||
return Cross(left,right) == Zero;
|
||||
}
|
||||
|
||||
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static vec3d Cross(vec3d left, vec3d right)
|
||||
|
||||
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("StgSharp")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+915a560b4309adf0aa201a011f972121196e6b02")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+32c0a0f99bffeed87de8eedfd6d8a27bbcc94012")]
|
||||
[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