c-o
This commit is contained in:
@@ -0,0 +1,961 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="StructDefine.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.GL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
/**/
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
//rename types in style of GLFW
|
||||
|
||||
using GLFWbool = Boolean;
|
||||
|
||||
//strucs defined in GLFW3.h
|
||||
|
||||
#region GLFW3 struct
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWcontext
|
||||
{
|
||||
|
||||
private int client;
|
||||
private IntPtr destroy;
|
||||
private delegate*<byte*> extensionSupported;
|
||||
private GLFWbool forward, debug, noerror;
|
||||
|
||||
//PFNGLGETINTEGERVPROC GetIntegerv;
|
||||
private IntPtr GetIntegerv;
|
||||
private delegate*<delegate*<void>, void> getProcAddress;
|
||||
|
||||
//PFNGLGETSTRINGPROC GetString;
|
||||
private IntPtr GetString;
|
||||
|
||||
//PFNGLGETSTRINGIPROC GetStringi;
|
||||
private IntPtr GetStringi;
|
||||
private int major, minor, revision;
|
||||
|
||||
/*
|
||||
void (* makeCurrent) (glfwWindow*);
|
||||
void (* swapBuffers) (glfwWindow*);
|
||||
void (* swapInterval) (int);
|
||||
int (* extensionSupported) (const byte*);
|
||||
GLFWglproc(*getProcAddress)(const byte*);
|
||||
void (* destroy) (glfwWindow*);
|
||||
*/
|
||||
|
||||
private delegate*<glfwWindow*> makeCurrent;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
private int source;
|
||||
private delegate*<glfwWindow*> swapBuffer;
|
||||
private delegate*<int> swapInterval;
|
||||
|
||||
internal struct egl
|
||||
{
|
||||
|
||||
private void* client;
|
||||
|
||||
/*
|
||||
EGLConfig config;
|
||||
EGLContext handle;
|
||||
EGLSurface surface;
|
||||
*/
|
||||
private void* config;
|
||||
private void* handle;
|
||||
private void* surface;
|
||||
|
||||
}
|
||||
|
||||
internal struct osmesa
|
||||
{
|
||||
|
||||
private void* buffer;
|
||||
|
||||
//OSMesaContext handle;
|
||||
private void* handle;
|
||||
private int height;
|
||||
|
||||
private int width;
|
||||
|
||||
}
|
||||
|
||||
// This is defined in platform.h
|
||||
//GLFW_PLATFORM_CONTEXT_STATE
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwVideomode
|
||||
{
|
||||
|
||||
/*! The refresh rate, in Hz, of the video mode.
|
||||
*/
|
||||
private int refreshRate;
|
||||
/*! The bit depth of the blue channel of the video mode.
|
||||
*/
|
||||
public int blueBits;
|
||||
/*! The bit depth of the green channel of the video mode.
|
||||
*/
|
||||
public int greenBits;
|
||||
/*! The height, in screen coordinates, of the video mode.
|
||||
*/
|
||||
public int height;
|
||||
/*! The bit depth of the red channel of the video mode.
|
||||
*/
|
||||
public int redBits;
|
||||
|
||||
/*! The width, in screen coordinates, of the video mode.
|
||||
*/
|
||||
public int width;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwGammaramp
|
||||
{
|
||||
|
||||
/*! An array of value describing the response of the blue channel.
|
||||
*/
|
||||
private ushort* blue;
|
||||
/*! An array of value describing the response of the green channel.
|
||||
*/
|
||||
private ushort* green;
|
||||
|
||||
/*! An array of value describing the response of the red channel.
|
||||
*/
|
||||
private ushort* red;
|
||||
/*! The number of elements in each array.
|
||||
*/
|
||||
private uint size;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWimage
|
||||
{
|
||||
|
||||
/*! 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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWgamepadstate
|
||||
{
|
||||
|
||||
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
||||
* to 1.0 inclusive.
|
||||
*/
|
||||
public fixed float axes[6];
|
||||
|
||||
/*! The states of each [gamepad button](@ref gamepad_buttons), `GLFW_PRESS`
|
||||
* or `GLFW_RELEASE`.
|
||||
*/
|
||||
public fixed byte buttons[15];
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWallocator
|
||||
{
|
||||
|
||||
//GLFWallocatefun allocate;
|
||||
private IntPtr allocate;
|
||||
|
||||
//GLFWdeallocatefun deallocate;
|
||||
private IntPtr deallocate;
|
||||
|
||||
//GLFWreallocatefun reallocate;
|
||||
private IntPtr reallocate;
|
||||
|
||||
private void* user;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct glfwMonitor
|
||||
{
|
||||
|
||||
private fixed byte name[128];
|
||||
private IntPtr userPointer;
|
||||
|
||||
private int width, height;
|
||||
|
||||
private glfwWindow* window;
|
||||
|
||||
private glfwVideomode* modes;
|
||||
private int modeCount;
|
||||
private glfwVideomode currentMode;
|
||||
|
||||
private glfwGammaramp originalRamp;
|
||||
private glfwGammaramp currentRamp;
|
||||
|
||||
public glfwMonitor()
|
||||
{ }
|
||||
|
||||
public unsafe string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
fixed (byte* cptr = name)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi((IntPtr)cptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
unsafe struct glfwWindow
|
||||
{
|
||||
glfwWindow* next;
|
||||
|
||||
// Window settings and state
|
||||
int resizable;
|
||||
int decorated;
|
||||
int autoIconify;
|
||||
int floating;
|
||||
int focusOnShow;
|
||||
int mousePassthrough;
|
||||
int shouldClose;
|
||||
void* userPointer;
|
||||
int doublebuffer;
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
IntPtr cursor; // _GLFWcursor* cursor;
|
||||
|
||||
int minwidth, minheight;
|
||||
int maxwidth, maxheight;
|
||||
int numer, denom;
|
||||
|
||||
int stickyKeys;
|
||||
int stickyMouseButtons;
|
||||
int lockKeyMods;
|
||||
int cursorMode;
|
||||
public fixed byte mouseButtons[GLconst.GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
public fixed byte keys[GLconst.GLFW_KEY_LAST + 1];
|
||||
|
||||
// Virtual cursor position when cursor is disabled
|
||||
double virtualCursorPosX, virtualCursorPosY;
|
||||
bool rawMouseMotion;
|
||||
|
||||
// _GLFWcontext context; // 根据_GLFWcontext的定义转换
|
||||
|
||||
// Callbacks are represented as IntPtr since we don't need the actual function pointers in C#
|
||||
internal struct Callbacks
|
||||
{
|
||||
internal IntPtr pos;
|
||||
internal IntPtr size;
|
||||
internal IntPtr close;
|
||||
internal IntPtr refresh;
|
||||
internal IntPtr focus;
|
||||
internal IntPtr iconify;
|
||||
internal IntPtr maximize;
|
||||
internal IntPtr fbsize;
|
||||
internal IntPtr scale;
|
||||
internal IntPtr mouseButton;
|
||||
internal IntPtr cursorPos;
|
||||
internal IntPtr cursorEnter;
|
||||
internal IntPtr scroll;
|
||||
internal IntPtr key;
|
||||
internal IntPtr character;
|
||||
internal IntPtr charmods;
|
||||
internal IntPtr drop;
|
||||
}
|
||||
Callbacks callbacks;
|
||||
|
||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLFWwindowCallback
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct GLFWcursor
|
||||
{
|
||||
|
||||
//GLFWcursor* next;
|
||||
private IntPtr next;
|
||||
|
||||
// This is defined in platform.h
|
||||
// not completed in tranformation
|
||||
// GLFW_PLATFORM_CURSOR_STATE;
|
||||
}
|
||||
|
||||
/*
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWerror
|
||||
{
|
||||
//GLFWerror* next;
|
||||
IntPtr next;
|
||||
int code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = (int)GLconst.GLFW_MESSAGE_SIZE)]
|
||||
byte[] description = new byte[GLconst.GLFW_MESSAGE_SIZE];
|
||||
|
||||
public GLFWerror()
|
||||
{
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWinitconfig
|
||||
{
|
||||
|
||||
private int angleType;
|
||||
|
||||
private GLFWbool hatButtons;
|
||||
private int platformID;
|
||||
|
||||
//PFN_vkGetInstanceProcAddr vulkanLoader;
|
||||
private IntPtr vulkanLoader;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWwndconfig
|
||||
{
|
||||
|
||||
private GLFWbool autoIconify;
|
||||
private GLFWbool centerCursor;
|
||||
private GLFWbool decorated;
|
||||
private GLFWbool floating;
|
||||
private GLFWbool focused;
|
||||
private GLFWbool focusOnShow;
|
||||
private int height;
|
||||
private GLFWbool maximized;
|
||||
private GLFWbool mousePassthrough;
|
||||
private GLFWbool resizable;
|
||||
private GLFWbool scaleToMonitor;
|
||||
private byte* title;
|
||||
private GLFWbool visible;
|
||||
private int width;
|
||||
|
||||
private int xpos;
|
||||
private int ypos;
|
||||
|
||||
internal Ns ns = new Ns();
|
||||
|
||||
internal Win32 win32 = new Win32();
|
||||
|
||||
internal Wl wl = new Wl();
|
||||
|
||||
internal X11 x11 = new X11();
|
||||
|
||||
public GLFWwndconfig()
|
||||
{
|
||||
}
|
||||
|
||||
internal struct Ns
|
||||
{
|
||||
|
||||
private GLFWbool retina = false;
|
||||
public fixed byte frameName[256];
|
||||
|
||||
public Ns()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal struct X11
|
||||
{
|
||||
|
||||
public fixed byte className[256];
|
||||
public fixed byte instanceName[256];
|
||||
|
||||
public X11()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal struct Win32
|
||||
{
|
||||
|
||||
private GLFWbool keymenu;
|
||||
|
||||
}
|
||||
|
||||
internal struct Wl
|
||||
{
|
||||
|
||||
public fixed byte appId[256];
|
||||
|
||||
public Wl()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWctxconfig
|
||||
{
|
||||
|
||||
private int client;
|
||||
private GLFWbool debug;
|
||||
private GLFWbool forward;
|
||||
private int major;
|
||||
private int minor;
|
||||
private GLFWbool noerror;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
|
||||
//glfwWindow* share;
|
||||
private IntPtr share;
|
||||
private int source;
|
||||
|
||||
internal Nsgl nsgl = new Nsgl();
|
||||
|
||||
public GLFWctxconfig()
|
||||
{
|
||||
}
|
||||
|
||||
internal struct Nsgl
|
||||
{
|
||||
|
||||
private GLFWbool offline;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWfbconfig
|
||||
{
|
||||
|
||||
private int accumAlphaBits;
|
||||
private int accumBlueBits;
|
||||
private int accumGreenBits;
|
||||
private int accumRedBits;
|
||||
private int alphaBits;
|
||||
private int auxBuffers;
|
||||
private int blueBits;
|
||||
private int depthBits;
|
||||
private GLFWbool doublebuffer;
|
||||
private int greenBits;
|
||||
private uintptr_t handle;
|
||||
|
||||
private int redBits;
|
||||
private int samples;
|
||||
private GLFWbool sRGB;
|
||||
private int stencilBits;
|
||||
private GLFWbool stereo;
|
||||
private GLFWbool transparent;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GLFWlibrary
|
||||
{
|
||||
|
||||
private GLFWallocator allocator;
|
||||
private GLFWls contextSlot;
|
||||
|
||||
//GLFWcursor* cursorListHead;
|
||||
private IntPtr cursorListHead;
|
||||
|
||||
//GLFWerror* errorListHead;
|
||||
private IntPtr errorListHead;
|
||||
private GLFWmutex errorLock;
|
||||
|
||||
private GLFWls errorSlot;
|
||||
|
||||
private GLFWbool initialized;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = GLconst.GLFW_JOYSTICK_LAST + 1)]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[GLconst.GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
private GLFWbool joysticksInitialized;
|
||||
|
||||
private int mappingCount;
|
||||
|
||||
//GLFWmapping* mappings;
|
||||
private IntPtr mappings;
|
||||
|
||||
private int monitorCount;
|
||||
|
||||
//GLFWmonitor** monitors;
|
||||
private IntPtr monitors;
|
||||
|
||||
private GLFWplatform platform;
|
||||
|
||||
//glfwWindow* windowListHead;
|
||||
private IntPtr windowListHead;
|
||||
|
||||
internal Callbacks callbacks = new Callbacks();
|
||||
|
||||
internal Egl egl = new Egl();
|
||||
|
||||
internal Hints hints = new Hints();
|
||||
|
||||
internal Osmesa osmesa = new Osmesa();
|
||||
|
||||
public GLFWlibrary()
|
||||
{
|
||||
}
|
||||
|
||||
internal unsafe struct Hints
|
||||
{
|
||||
|
||||
private GLFWctxconfig context;
|
||||
private GLFWfbconfig framebuffer;
|
||||
|
||||
private GLFWinitconfig init;
|
||||
private int refreshRate;
|
||||
private GLFWwndconfig window;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct timer
|
||||
{
|
||||
|
||||
private ulong offset;
|
||||
// This is defined in platform.h
|
||||
|
||||
//not transformed function defination
|
||||
//GLFW_PLATFORM_LIBRARY_TIMER_STATE
|
||||
}
|
||||
|
||||
internal unsafe struct Egl
|
||||
{
|
||||
|
||||
internal bool ANGLE_platform_angle;
|
||||
internal bool ANGLE_platform_angle_d3d;
|
||||
internal bool ANGLE_platform_angle_metal;
|
||||
internal bool ANGLE_platform_angle_opengl;
|
||||
internal bool ANGLE_platform_angle_vulkan;
|
||||
internal IntPtr BindAPI;
|
||||
internal IntPtr CreateContext;
|
||||
internal IntPtr CreatePlatformWindowSurfaceEXT;
|
||||
internal IntPtr CreateWindowSurface;
|
||||
internal IntPtr DestroyContext;
|
||||
internal IntPtr DestroySurface;
|
||||
internal void* display;
|
||||
internal bool EXT_client_extensions;
|
||||
internal bool EXT_platform_base;
|
||||
internal bool EXT_platform_wayland;
|
||||
internal bool EXT_platform_x11;
|
||||
internal bool EXT_present_opaque;
|
||||
|
||||
internal IntPtr GetConfigAttrib;
|
||||
internal IntPtr GetConfigs;
|
||||
internal IntPtr GetDisplay;
|
||||
internal IntPtr GetError;
|
||||
|
||||
internal IntPtr GetPlatformDisplayEXT;
|
||||
internal IntPtr GetProcAddress;
|
||||
|
||||
internal void* handle;
|
||||
internal IntPtr Initialize;
|
||||
internal bool KHR_colorSpace;
|
||||
internal bool KHR_context_flush_control;
|
||||
|
||||
internal bool KHR_create_context;
|
||||
internal bool KHR_create_context_no_error;
|
||||
internal bool KHR_get_all_proc_addresses;
|
||||
internal int major, minor;
|
||||
internal IntPtr MakeCurrent;
|
||||
|
||||
internal int platform;
|
||||
internal bool prefix;
|
||||
internal IntPtr QueryString;
|
||||
internal IntPtr SwapBuffers;
|
||||
internal IntPtr SwapInterval;
|
||||
internal IntPtr Terminate;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct Osmesa
|
||||
{
|
||||
|
||||
private IntPtr CreateContextAttribs;
|
||||
|
||||
private IntPtr CreateContextExt;
|
||||
private IntPtr DestroyContext;
|
||||
private IntPtr GetColorBuffer;
|
||||
private IntPtr GetDepthBuffer;
|
||||
private IntPtr GetProcAddress;
|
||||
|
||||
private void* handle;
|
||||
private IntPtr MakeCurrent;
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct vk
|
||||
{
|
||||
|
||||
private GLFWbool available;
|
||||
private GLFWbool EXT_metal_surface;
|
||||
private fixed ulong extensions[2];
|
||||
private IntPtr GetInstanceProcAddr;
|
||||
private void* handle;
|
||||
private GLFWbool KHR_surface;
|
||||
private GLFWbool KHR_wayland_surface;
|
||||
private GLFWbool KHR_win32_surface;
|
||||
private GLFWbool KHR_xcb_surface;
|
||||
private GLFWbool KHR_xlib_surface;
|
||||
private GLFWbool MVK_macos_surface;
|
||||
|
||||
public vk()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal unsafe struct Callbacks
|
||||
{
|
||||
|
||||
private IntPtr joystick;
|
||||
|
||||
private IntPtr monitor;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmapelement
|
||||
{
|
||||
|
||||
private sbyte axisOffset;
|
||||
private sbyte axisScale;
|
||||
private byte index;
|
||||
|
||||
private byte type;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmapping
|
||||
{
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
|
||||
private GLFWmapelement[] axes = new GLFWmapelement[6];
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 15)]
|
||||
private GLFWmapelement[] buttons = new GLFWmapelement[15];
|
||||
private fixed byte guid[33];
|
||||
|
||||
private fixed byte name[128];
|
||||
|
||||
public GLFWmapping()
|
||||
{ }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWjoystick
|
||||
{
|
||||
|
||||
private GLFWbool allocated;
|
||||
private float* axes;
|
||||
private int axisCount;
|
||||
private int buttonCount;
|
||||
private byte* buttons;
|
||||
private GLFWbool connected;
|
||||
private fixed byte guid[33];
|
||||
private int hatCount;
|
||||
private byte* hats;
|
||||
|
||||
//GLFWmapping* mapping;
|
||||
private IntPtr mapping;
|
||||
private fixed byte name[128];
|
||||
private void* userPointer;
|
||||
|
||||
// This is defined in platform.h
|
||||
// not completed in transforming
|
||||
// GLFW_PLATFORM_JOYSTICK_STATE;
|
||||
|
||||
public GLFWjoystick()
|
||||
{ }
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWls
|
||||
{
|
||||
// This is defined in platform.h
|
||||
|
||||
//GLFW_PLATFORM_TLS_STATE
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWplatform
|
||||
{
|
||||
|
||||
// init
|
||||
//GLFWbool(*init)(void);
|
||||
private IntPtr init;
|
||||
|
||||
private int platformID;
|
||||
|
||||
//void (* terminate) (void);
|
||||
private IntPtr terminate;
|
||||
internal IntPtr createCursor;
|
||||
internal IntPtr createStandardCursor;
|
||||
|
||||
// window
|
||||
internal IntPtr createWindow;
|
||||
internal IntPtr destroyCursor;
|
||||
|
||||
internal IntPtr destroyWindow;
|
||||
internal IntPtr focusWindow;
|
||||
internal IntPtr framebufferTransparent;
|
||||
|
||||
// monitor
|
||||
internal IntPtr freeMonitor;
|
||||
internal IntPtr getClipboardString;
|
||||
|
||||
internal IntPtr getEGLNativeDisplay;
|
||||
internal IntPtr getEGLNativeWindow;
|
||||
|
||||
// EGL
|
||||
//EGLenum(*getEGLPlatform)(EGLint**);
|
||||
//EGLNativeDisplayType(*getEGLNativeDisplay)(void);
|
||||
//EGLNativeWindowType(*getEGLNativeWindow)(glfwWindow*);
|
||||
internal IntPtr getEGLPlatform;
|
||||
internal IntPtr getFramebufferSize;
|
||||
internal IntPtr getGammaRamp;
|
||||
internal IntPtr getKeyScancode;
|
||||
internal IntPtr getMappingName;
|
||||
internal IntPtr getMonitorContentScale;
|
||||
|
||||
internal IntPtr getMonitorPos;
|
||||
internal IntPtr getMonitorWorkarea;
|
||||
|
||||
// vulkan
|
||||
//void (* getRequiredInstanceExtensions) (byte**);
|
||||
//GLFWbool(*getPhysicalDevicePresentationSupport)(VkInstance, VkPhysicalDevice, uint32_t);
|
||||
//VkResult(*createWindowSurface)(VkInstance, glfwWindow*,const VkAllocationCallbacks*, VkSurfaceKHR*);
|
||||
internal IntPtr getRequiredInstanceExtensions;
|
||||
internal IntPtr getScancodeName;
|
||||
internal IntPtr getVideoMode;
|
||||
internal IntPtr getVideoModes;
|
||||
internal IntPtr getWindowContentScale;
|
||||
internal IntPtr getWindowFrameSize;
|
||||
internal IntPtr getWindowOpacity;
|
||||
internal IntPtr getWindowPos;
|
||||
internal IntPtr getWindowSize;
|
||||
internal IntPtr GLFWwindow;
|
||||
internal IntPtr hideWindow;
|
||||
internal IntPtr iconifyWindow;
|
||||
internal IntPtr initJoysticks;
|
||||
internal IntPtr maximizeWindow;
|
||||
internal IntPtr pollEvents;
|
||||
internal IntPtr pollJoystick;
|
||||
internal IntPtr postEmptyEvent;
|
||||
internal IntPtr rawMouseMotionSupported;
|
||||
internal IntPtr requestWindowAttention;
|
||||
internal IntPtr restoreWindow;
|
||||
internal IntPtr setClipboardString;
|
||||
internal IntPtr setCursor;
|
||||
internal IntPtr setCursorMode;
|
||||
|
||||
#region input
|
||||
/* void (* getCursorPos) (glfwWindow*, double*, double*);
|
||||
void (* setCursorPos) (glfwWindow*, double, double);
|
||||
void (* setCursorMode) (glfwWindow*, int);
|
||||
void (* setRawMouseMotion) (glfwWindow*, GLFWbool);
|
||||
GLFWbool(*rawMouseMotionSupported)(void);
|
||||
GLFWbool(*createCursor)(GLFWcursor*,const GLFWimage*,int,int);
|
||||
GLFWbool(*createStandardCursor)(GLFWcursor*, int);
|
||||
void (* destroyCursor) (GLFWcursor*);
|
||||
void (* setCursor) (glfwWindow*, GLFWcursor*);
|
||||
const byte* (*getScancodeName)(int);
|
||||
int (* getKeyScancode) (int);
|
||||
void (* setClipboardString) (const byte*);
|
||||
const byte* (*getClipboardString)(void);
|
||||
GLFWbool(*initJoysticks)(void);
|
||||
void (* terminateJoysticks) (void);
|
||||
GLFWbool(*pollJoystick)(GLFWjoystick*, int);
|
||||
const byte* (*getMappingName)(void);
|
||||
void (* updateGamepadGUID) (byte*);
|
||||
// monitor
|
||||
void (* freeMonitor) (GLFWmonitor*);
|
||||
void (* getMonitorPos) (GLFWmonitor*, int*, int*);
|
||||
void (* getMonitorContentScale) (GLFWmonitor*, float*, float*);
|
||||
void (* getMonitorWorkarea) (GLFWmonitor*, int*, int*, int*, int*);
|
||||
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*);
|
||||
void (* setWindowTitle) (glfwWindow*,const byte*);
|
||||
void (* setWindowIcon) (glfwWindow*, int,const GLFWimage*);
|
||||
void (* getWindowPos) (glfwWindow*, int*, int*);
|
||||
void (* setWindowPos) (glfwWindow*, int, int);
|
||||
void (* getWindowSize) (glfwWindow*, int*, int*);
|
||||
void (* setWindowSize) (glfwWindow*, int, int);
|
||||
void (* setWindowSizeLimits) (glfwWindow*, int, int, int, int);
|
||||
void (* setWindowAspectRatio) (glfwWindow*, int, int);
|
||||
void (* getFramebufferSize) (glfwWindow*, int*, int*);
|
||||
void (* getWindowFrameSize) (glfwWindow*, int*, int*, int*, int*);
|
||||
void (* getWindowContentScale) (glfwWindow*, float*, float*);
|
||||
void (* iconifyWindow) (glfwWindow*);
|
||||
void (* restoreWindow) (glfwWindow*);
|
||||
void (* maximizeWindow) (glfwWindow*);
|
||||
void (* showWindow) (glfwWindow*);
|
||||
void (* hideWindow) (glfwWindow*);
|
||||
void (* requestWindowAttention) (glfwWindow*);
|
||||
void (* focusWindow) (glfwWindow*);
|
||||
void (* setWindowMonitor) (glfwWindow*, GLFWmonitor*, int, int, int, int, int);
|
||||
GLFWbool(*windowFocused)(glfwWindow*);
|
||||
GLFWbool(*windowIconified)(glfwWindow*);
|
||||
GLFWbool(*windowVisible)(glfwWindow*);
|
||||
GLFWbool(*windowMaximized)(glfwWindow*);
|
||||
GLFWbool(*windowHovered)(glfwWindow*);
|
||||
GLFWbool(*framebufferTransparent)(glfwWindow*);
|
||||
float (* getWindowOpacity) (glfwWindow*);
|
||||
void (* setWindowResizable) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowDecorated) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowFloating) (glfwWindow*, GLFWbool);
|
||||
void (* setWindowOpacity) (glfwWindow*, float);
|
||||
void (* setWindowMousePassthrough) (glfwWindow*, GLFWbool);
|
||||
void (* pollEvents) (void);
|
||||
void (* waitEvents) (void);
|
||||
void (* waitEventsTimeout) (double);
|
||||
void (* postEmptyEvent) (void);
|
||||
*/
|
||||
#endregion
|
||||
|
||||
internal IntPtr setCursorPos;
|
||||
internal IntPtr setGammaRamp;
|
||||
internal IntPtr setRawMouseMotion;
|
||||
internal IntPtr setWindowAspectRatio;
|
||||
internal IntPtr setWindowDecorated;
|
||||
internal IntPtr setWindowFloating;
|
||||
internal IntPtr setWindowIcon;
|
||||
internal IntPtr setWindowMonitor;
|
||||
internal IntPtr setWindowMousePassthrough;
|
||||
internal IntPtr setWindowOpacity;
|
||||
internal IntPtr setWindowPos;
|
||||
internal IntPtr setWindowResizable;
|
||||
internal IntPtr setWindowSize;
|
||||
internal IntPtr setWindowSizeLimits;
|
||||
internal IntPtr setWindowTitle;
|
||||
internal IntPtr showWindow;
|
||||
internal IntPtr terminateJoysticks;
|
||||
internal IntPtr updateGamepadGUID;
|
||||
|
||||
internal IntPtr VkPhysicalDevice;
|
||||
internal IntPtr waitEvents;
|
||||
internal IntPtr waitEventsTimeout;
|
||||
internal IntPtr windowFocused;
|
||||
internal IntPtr windowHovered;
|
||||
internal IntPtr windowIconified;
|
||||
internal IntPtr windowMaximized;
|
||||
internal IntPtr windowVisible;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWmutex
|
||||
{
|
||||
// This is defined in platform.h
|
||||
//GLFW_PLATFORM_MUTEX_STATE
|
||||
}
|
||||
|
||||
//public unsafe struct VkAllocationCallbacks { }
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct VkExtensionProperties
|
||||
{
|
||||
|
||||
private fixed byte extensionName[256];
|
||||
private uint specVersion;
|
||||
|
||||
public VkExtensionProperties()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal unsafe struct GLFWerror
|
||||
{
|
||||
IntPtr next;
|
||||
int code;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1024)]
|
||||
byte[] description = new byte[1024];
|
||||
|
||||
public GLFWerror()
|
||||
{
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
[StructLayout(LayoutKind.Explicit, Size = 16)]
|
||||
public struct uintptr_t
|
||||
{
|
||||
|
||||
[FieldOffset(0)]
|
||||
private long part1;
|
||||
|
||||
[FieldOffset(8)]
|
||||
private long part2;
|
||||
|
||||
}
|
||||
|
||||
#endregion GLFW3 struct
|
||||
|
||||
#region glad struct
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GLsync
|
||||
{
|
||||
}
|
||||
|
||||
#endregion glad struct
|
||||
}
|
||||
|
||||
/**/
|
||||
@@ -0,0 +1,70 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="glApiDefine.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.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
/*
|
||||
* This file is created to link functions in OpenGL to version in C#
|
||||
* The name of delegates and organization to init all these delegates
|
||||
* are refferd from GLAD1 in agreement of MIT license generated from
|
||||
* https://glad.dav1d.de/
|
||||
*/
|
||||
|
||||
|
||||
using StgSharp.Math;
|
||||
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
#region StgSharpDele
|
||||
|
||||
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, uint width, uint height);
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Function handler to load an opengl function by searching its name.
|
||||
/// </summary>
|
||||
/// <param name="name">the name of the Opengl function</param>
|
||||
/// <returns>An intptr value representing the pointer to the function</returns>
|
||||
public delegate IntPtr glLoader(string name);
|
||||
|
||||
#region glDEBUG
|
||||
|
||||
internal unsafe delegate void GLDEBUGPROC(int source, int type, uint id, int severity, int length, sbyte* message, void* userParam);
|
||||
internal unsafe delegate void GLDEBUGPROCARB(int source, int type, uint id, int severity, int length, sbyte* message, void* userParam);
|
||||
internal unsafe delegate void GLDEBUGPROCKHR(int source, int type, uint id, int severity, int length, sbyte* message, void* userParam);
|
||||
internal unsafe delegate void GLDEBUGPROCAMD(uint id, int category, int severity, int length, sbyte* message, void* userParam);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,210 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="glEnum.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.
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace StgSharp.Graphics.GL
|
||||
{
|
||||
public enum ImageChannelLayout
|
||||
{
|
||||
UByte = GLconst.UNSIGNED_BYTE,
|
||||
Byte = GLconst.BYTE,
|
||||
UShort = GLconst.UNSIGNED_SHORT,
|
||||
Short = GLconst.SHORT,
|
||||
UInt = GLconst.UNSIGNED_INT,
|
||||
Int = GLconst.INT,
|
||||
Float = GLconst.FLOAT,
|
||||
UByte332 = 0x8032, // GL_UNSIGNED_BYTE_3_3_2
|
||||
UByte233Rev = 0x8362, // GL_UNSIGNED_BYTE_2_3_3_REV
|
||||
UShort565 = 0x8363, // GL_UNSIGNED_SHORT_5_6_5
|
||||
UShort565Rev = 0x8364, // GL_UNSIGNED_SHORT_5_6_5_REV
|
||||
UShort4444 = 0x8033, // GL_UNSIGNED_SHORT_4_4_4_4
|
||||
UShort4444Rev = 0x8034, // GL_UNSIGNED_SHORT_4_4_4_4_REV
|
||||
UShort5551 = 0x8035, // GL_UNSIGNED_SHORT_5_5_5_1
|
||||
UShort1555Rev = 0x8366, // GL_UNSIGNED_SHORT_1_5_5_5_REV
|
||||
UInt8888 = 0x8035, // GL_UNSIGNED_INT_8_8_8_8
|
||||
UInt8888Rev = 0x8367, // GL_UNSIGNED_INT_8_8_8_8_REV
|
||||
UInt1010102 = 0x8036, // GL_UNSIGNED_INT_10_10_10_2
|
||||
UInt2101010Rev = 0x8368 // GL_UNSIGNED_INT_2_10_10_10_REV
|
||||
}
|
||||
|
||||
|
||||
internal enum VkStructureType : uint
|
||||
{
|
||||
VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000,
|
||||
VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000,
|
||||
VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000,
|
||||
VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000,
|
||||
VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000,
|
||||
VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000,
|
||||
VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
public enum FrameBufferChannel
|
||||
{
|
||||
STENCIL_INDEX = GLconst.STENCIL_INDEX,
|
||||
DEPTH_COMPONENT = GLconst.DEPTH_COMPONENT,
|
||||
DEPTH_STENCIL = GLconst.DEPTH_STENCIL,
|
||||
RED = GLconst.RED,
|
||||
GREEN = GLconst.GREEN,
|
||||
BLUE = GLconst.BLUE,
|
||||
RGB = GLconst.RGB,
|
||||
BGR = GLconst.BGR,
|
||||
RGBA = GLconst.RGBA,
|
||||
BGRA = GLconst.BGRA
|
||||
}
|
||||
|
||||
|
||||
public enum Texture2DTarget
|
||||
{
|
||||
Texture2D = GLconst.TEXTURE_2D,
|
||||
ProxyTexture2D = GLconst.PROXY_TEXTURE_2D,
|
||||
Texture1DArray = GLconst.TEXTURE_1D_ARRAY,
|
||||
ProxyTexture1DArray = GLconst.PROXY_TEXTURE_1D_ARRAY,
|
||||
TextureRectangle = GLconst.TEXTURE_RECTANGLE,
|
||||
ProxyTextureRectangle = GLconst.PROXY_TEXTURE_RECTANGLE,
|
||||
TextureCubeMapPositiveX = GLconst.TEXTURE_CUBE_MAP_POSITIVE_X,
|
||||
TextureCubeMapNegativeX = GLconst.TEXTURE_CUBE_MAP_NEGATIVE_X,
|
||||
TextureCubeMapPositiveY = GLconst.TEXTURE_CUBE_MAP_POSITIVE_Y,
|
||||
TextureCubeMapNegativeY = GLconst.TEXTURE_CUBE_MAP_NEGATIVE_Y,
|
||||
TextureCubeMapPositiveZ = GLconst.TEXTURE_CUBE_MAP_POSITIVE_Z,
|
||||
TextureCubeMapNegativeZ = GLconst.TEXTURE_CUBE_MAP_NEGATIVE_Z,
|
||||
ProxyTextureCubeMap = GLconst.PROXY_TEXTURE_CUBE_MAP
|
||||
}
|
||||
|
||||
public enum RenderBufferInternalFormat : uint
|
||||
{
|
||||
RGBA8 = GLconst.RGBA8,
|
||||
Depth24_Stencil8 = GLconst.DEPTH24_STENCIL8,
|
||||
}
|
||||
|
||||
public enum GLOperation : uint
|
||||
{
|
||||
StencilTest = GLconst.STENCIL_TEST,
|
||||
}
|
||||
|
||||
internal enum VkResult
|
||||
{
|
||||
VK_SUCCESS = 0,
|
||||
VK_NOT_READY = 1,
|
||||
VK_TIMEOUT = 2,
|
||||
VK_EVENT_SET = 3,
|
||||
VK_EVENT_RESET = 4,
|
||||
VK_INCOMPLETE = 5,
|
||||
VK_ERROR_OUT_OF_HOST_MEMORY = -1,
|
||||
VK_ERROR_OUT_OF_DEVICE_MEMORY = -2,
|
||||
VK_ERROR_INITIALIZATION_FAILED = -3,
|
||||
VK_ERROR_DEVICE_LOST = -4,
|
||||
VK_ERROR_MEMORY_MAP_FAILED = -5,
|
||||
VK_ERROR_LAYER_NOT_PRESENT = -6,
|
||||
VK_ERROR_EXTENSION_NOT_PRESENT = -7,
|
||||
VK_ERROR_FEATURE_NOT_PRESENT = -8,
|
||||
VK_ERROR_INCOMPATIBLE_DRIVER = -9,
|
||||
VK_ERROR_TOO_MANY_OBJECTS = -10,
|
||||
VK_ERROR_FORMAT_NOT_SUPPORTED = -11,
|
||||
VK_ERROR_SURFACE_LOST_KHR = -1000000000,
|
||||
VK_SUBOPTIMAL_KHR = 1000001003,
|
||||
VK_ERROR_OUT_OF_DATE_KHR = -1000001004,
|
||||
VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001,
|
||||
VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001,
|
||||
VK_ERROR_VALIDATION_FAILED_EXT = -1000011001,
|
||||
VK_RESULT_MAX_ENUM = 0x7FFFFFFF
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008
|
||||
public enum ShaderType : int
|
||||
#pragma warning restore CA1008
|
||||
{
|
||||
Fragment = GLconst.FRAGMENT_SHADER,
|
||||
Vertex = GLconst.VERTEX_SHADER,
|
||||
Compute = GLconst.COMPUTE_SHADER,
|
||||
Geometry = GLconst.GEOMETRY_SHADER,
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
public enum BufferType : int
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
{
|
||||
ArrayBuffer = GLconst.ARRAY_BUFFER,
|
||||
ElementArrayBuffer = GLconst.ELEMENT_ARRAY_BUFFER,
|
||||
AtomicCounterBuffer = 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,
|
||||
}
|
||||
|
||||
#pragma warning disable CA1008 // 枚举应具有零值
|
||||
public enum BufferUsage : int
|
||||
#pragma warning restore CA1008 // 枚举应具有零值
|
||||
{
|
||||
StreamDraw = 0x88E0,
|
||||
StreamRead = 0x88E1,
|
||||
StreamCopy = 0x88E2,
|
||||
StaticDraw = 0x88E4,
|
||||
StaticRead = 0x88E5,
|
||||
StaticCopy = 0x88E6,
|
||||
DynamicDraw = 0x88E8,
|
||||
DynamicRead = 0x88E9,
|
||||
DynamicCopy = 0x88EA
|
||||
}
|
||||
|
||||
|
||||
public enum MaskBufferBit
|
||||
{
|
||||
COLOR = GLconst.COLOR_BUFFER_BIT,
|
||||
DEPTH = GLconst.DEPTH_BUFFER_BIT,
|
||||
STENCIL = GLconst.STENCIL_BUFFER_BIT,
|
||||
}
|
||||
|
||||
public enum GeometryType : uint
|
||||
{
|
||||
POINTS = 0x0000,
|
||||
LINES = 0x0001,
|
||||
LINE_LOOP = 0x0002,
|
||||
LINE_STRIP = 0x0003,
|
||||
TRIANGLES = 0x0004,
|
||||
TRIANGLE_STRIP = 0x0005,
|
||||
TRIANGLE_FAN = 0x0006
|
||||
}
|
||||
|
||||
public enum TextureFiltering
|
||||
{
|
||||
Nearest = 0x2600,
|
||||
Linear = 0x2601
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="glType.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.Geometries;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
|
||||
public delegate IntPtr GLfuncLoader(string name);
|
||||
|
||||
internal delegate void GLVULKANPROCNV();
|
||||
|
||||
public unsafe struct GLhandleARB
|
||||
{
|
||||
|
||||
dynamic value;
|
||||
|
||||
public unsafe GLhandleARB(dynamic value)
|
||||
{
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
if (value.GetType().Name != "Uint32")
|
||||
{
|
||||
goto errorlog;
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value.GetType().Name != "IntPtr")
|
||||
{
|
||||
goto errorlog;
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
errorlog:
|
||||
{
|
||||
InternalIO.InternalWriteLog(
|
||||
$"{value.GetType().Name} does not match definination of GLhandlARB on OS {Environment.OSVersion.Platform} ",
|
||||
LogType.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static implicit operator uint(GLhandleARB value)
|
||||
{
|
||||
return (uint)value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#region GLFW_dele
|
||||
|
||||
internal unsafe delegate void GLFWwindowsizefun(glfwWindow* window, int width, int height);
|
||||
internal unsafe delegate void GLFWwindowrefreshfun(glfwWindow* window);
|
||||
internal unsafe delegate void GLFWwindowposfun(glfwWindow* window, int xpos, int ypos);
|
||||
internal unsafe delegate void GLFWwindowmaximizefun(glfwWindow* window, int maximized);
|
||||
internal unsafe delegate void GLFWwindowiconifyfun(glfwWindow* window, int iconified);
|
||||
internal unsafe delegate void GLFWwindowfocusfun(glfwWindow* window, int focused);
|
||||
internal unsafe delegate void GLFWwindowcontentscalefun(glfwWindow* window, float xscale, float yscale);
|
||||
internal unsafe delegate void GLFWwindowclosefun(glfwWindow* window);
|
||||
internal unsafe delegate void GLFWvkproc();
|
||||
internal unsafe delegate void GLFWscrollfun(glfwWindow* window, double xoffset, double yoffset);
|
||||
internal unsafe delegate void GLFWmousebuttonfun(glfwWindow* window, int button, int action, int mods);
|
||||
internal unsafe delegate void GLFWmonitorfun(glfwMonitor* monitor, int monitorevent);
|
||||
internal unsafe delegate void GLFWkeyfun(glfwWindow* window, int key, int scancode, int action, int mods);
|
||||
internal unsafe delegate void GLFWjoystickfun(int jid, int keyevent);
|
||||
public unsafe delegate void GLFWglproc();
|
||||
internal unsafe delegate void FramebuffersizeHandler(IntPtr window, int width, int height); //window is the pointer to a glfwWindow instance
|
||||
internal unsafe delegate void GLFWerrorfun(int error_code, sbyte* description);
|
||||
internal unsafe delegate void GLFWdropfun(glfwWindow* window, int path_count, sbyte*[] paths);
|
||||
internal unsafe delegate void GLFWcursorposfun(glfwWindow* window, double xpos, double ypos);
|
||||
internal unsafe delegate void GLFWcursorenterfun(glfwWindow* window, int entered);
|
||||
internal unsafe delegate void GLFWcharmodsfun(glfwWindow* window, uint codepoint, int mods);
|
||||
internal unsafe delegate void GLFWcharfun(glfwWindow* window, uint codepoint);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user