daily update on 20240828 by nitload youmu, autotexture added
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
// file="BufferObjectBase.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.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StgSharp.Graphics
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface of all kinds OpenGL buffer objects
|
||||
/// </summary>
|
||||
public abstract class BufferObjectBase : IDisposable
|
||||
{
|
||||
|
||||
protected GlHandle[] _bufferHandle;
|
||||
protected RenderStream binding;
|
||||
|
||||
/// <summary>
|
||||
/// Get the only handle to one of the Object instance
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public GlHandle this[int index] => _bufferHandle[index];
|
||||
|
||||
/// <summary>
|
||||
/// Bind a buffer instance to OpenGL
|
||||
/// </summary>
|
||||
/// <param name="index">Index of handle of the object in this instance to be bind</param>
|
||||
public abstract void Bind(int index);
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"This is a {GetType().FullName}, containing {_bufferHandle.Length} buffer handles: {_bufferHandle.ToString()}.";
|
||||
}
|
||||
|
||||
protected abstract void Dispose(bool disposing);
|
||||
|
||||
~BufferObjectBase()
|
||||
{
|
||||
Dispose(disposing: false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
using StgSharp.Graphics.GL;
|
||||
using StgSharp.Graphics.OpenGL;
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
@@ -49,22 +49,9 @@ namespace StgSharp.Graphics
|
||||
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*);
|
||||
@@ -75,12 +62,26 @@ namespace StgSharp.Graphics
|
||||
*/
|
||||
|
||||
private delegate*<glfwWindow*> makeCurrent;
|
||||
private delegate*<glfwWindow*> swapBuffer;
|
||||
private delegate*<int> swapInterval;
|
||||
private GLFWbool forward, debug, noerror;
|
||||
|
||||
private int client;
|
||||
private int major, minor, revision;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
private int source;
|
||||
private delegate*<glfwWindow*> swapBuffer;
|
||||
private delegate*<int> swapInterval;
|
||||
private IntPtr destroy;
|
||||
|
||||
//PFNGLGETINTEGERVPROC GetIntegerv;
|
||||
private IntPtr GetIntegerv;
|
||||
|
||||
//PFNGLGETSTRINGPROC GetString;
|
||||
private IntPtr GetString;
|
||||
|
||||
//PFNGLGETSTRINGIPROC GetStringi;
|
||||
private IntPtr GetStringi;
|
||||
|
||||
internal struct egl
|
||||
{
|
||||
@@ -165,15 +166,16 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWimage
|
||||
{
|
||||
|
||||
/*! The pixel _data of this image, arranged left-to-right, top-to-bottom.
|
||||
*/
|
||||
private byte* pixels;
|
||||
|
||||
/*! 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;
|
||||
|
||||
|
||||
}
|
||||
@@ -182,22 +184,24 @@ namespace StgSharp.Graphics
|
||||
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];
|
||||
|
||||
/*! The states of each [gamepad axis](@ref gamepad_axes), in the range -1.0
|
||||
* to 1.0 inclusive.
|
||||
*/
|
||||
public fixed float axes[6];
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public unsafe struct GLFWallocator
|
||||
{
|
||||
|
||||
private void* user;
|
||||
|
||||
//GLFWallocatefun allocate;
|
||||
private IntPtr allocate;
|
||||
|
||||
@@ -207,34 +211,32 @@ namespace StgSharp.Graphics
|
||||
//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 glfwVideomode* modes;
|
||||
|
||||
private glfwWindow* window;
|
||||
|
||||
private glfwVideomode* modes;
|
||||
private int modeCount;
|
||||
private glfwVideomode currentMode;
|
||||
private fixed byte name[128];
|
||||
private glfwGammaramp currentRamp;
|
||||
|
||||
private glfwGammaramp originalRamp;
|
||||
private glfwGammaramp currentRamp;
|
||||
private glfwVideomode currentMode;
|
||||
private int modeCount;
|
||||
|
||||
private int width, height;
|
||||
private IntPtr userPointer;
|
||||
|
||||
public glfwMonitor()
|
||||
{ }
|
||||
|
||||
public unsafe string Name
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
fixed (byte* cptr = name)
|
||||
{
|
||||
@@ -242,69 +244,73 @@ namespace StgSharp.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[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];
|
||||
bool rawMouseMotion;
|
||||
Callbacks callbacks;
|
||||
|
||||
// Virtual cursor position when cursor is disabled
|
||||
double virtualCursorPosX, virtualCursorPosY;
|
||||
bool rawMouseMotion;
|
||||
int autoIconify;
|
||||
int cursorMode;
|
||||
int decorated;
|
||||
int doublebuffer;
|
||||
int floating;
|
||||
int focusOnShow;
|
||||
int lockKeyMods;
|
||||
int maxwidth, maxheight;
|
||||
|
||||
// _GLFWcontext context; // 根据_GLFWcontext的定义转换
|
||||
int minwidth, minheight;
|
||||
int mousePassthrough;
|
||||
int numer, denom;
|
||||
|
||||
// Window settings and state
|
||||
int resizable;
|
||||
int shouldClose;
|
||||
|
||||
int stickyKeys;
|
||||
int stickyMouseButtons;
|
||||
IntPtr cursor; // _GLFWcursor* cursor;
|
||||
// glfwVideomode videoMode; // 根据GLFWvidmode的定义转换
|
||||
IntPtr monitor; // _GLFWmonitor* monitor;
|
||||
public fixed byte keys[GLconst.GLFW_KEY_LAST + 1];
|
||||
public fixed byte mouseButtons[GLconst.GLFW_MOUSE_BUTTON_LAST + 1];
|
||||
|
||||
// _GLFWcontext viewPortDisplay; // 根据_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 close;
|
||||
internal IntPtr cursorEnter;
|
||||
internal IntPtr cursorPos;
|
||||
internal IntPtr drop;
|
||||
}
|
||||
Callbacks callbacks;
|
||||
internal IntPtr fbsize;
|
||||
internal IntPtr focus;
|
||||
internal IntPtr iconify;
|
||||
internal IntPtr key;
|
||||
internal IntPtr maximize;
|
||||
internal IntPtr mouseButton;
|
||||
internal IntPtr pos;
|
||||
internal IntPtr refresh;
|
||||
internal IntPtr scale;
|
||||
internal IntPtr scroll;
|
||||
internal IntPtr size;
|
||||
|
||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
||||
}
|
||||
}
|
||||
|
||||
// GLFW_PLATFORM_WINDOW_STATE platformWindowState;
|
||||
}
|
||||
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@@ -345,9 +351,9 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWinitconfig
|
||||
{
|
||||
|
||||
private int angleType;
|
||||
|
||||
private GLFWbool hatButtons;
|
||||
|
||||
private int angleType;
|
||||
private int platformID;
|
||||
|
||||
//PFN_vkGetInstanceProcAddr vulkanLoader;
|
||||
@@ -359,19 +365,20 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWwndconfig
|
||||
{
|
||||
|
||||
private byte* title;
|
||||
|
||||
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 height;
|
||||
private int width;
|
||||
|
||||
private int xpos;
|
||||
@@ -437,19 +444,20 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWctxconfig
|
||||
{
|
||||
|
||||
private int client;
|
||||
private GLFWbool debug;
|
||||
private GLFWbool forward;
|
||||
private GLFWbool noerror;
|
||||
|
||||
private int client;
|
||||
private int major;
|
||||
private int minor;
|
||||
private GLFWbool noerror;
|
||||
private int profile;
|
||||
private int release;
|
||||
private int robustness;
|
||||
private int source;
|
||||
|
||||
//glfwWindow* share;
|
||||
private IntPtr share;
|
||||
private int source;
|
||||
|
||||
internal Nsgl nsgl = new Nsgl();
|
||||
|
||||
@@ -470,6 +478,11 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWfbconfig
|
||||
{
|
||||
|
||||
private GLFWbool doublebuffer;
|
||||
private GLFWbool sRGB;
|
||||
private GLFWbool stereo;
|
||||
private GLFWbool transparent;
|
||||
|
||||
private int accumAlphaBits;
|
||||
private int accumBlueBits;
|
||||
private int accumGreenBits;
|
||||
@@ -478,16 +491,12 @@ namespace StgSharp.Graphics
|
||||
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;
|
||||
private uintptr_t handle;
|
||||
|
||||
}
|
||||
|
||||
@@ -495,37 +504,37 @@ namespace StgSharp.Graphics
|
||||
internal unsafe struct GLFWlibrary
|
||||
{
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = GLconst.GLFW_JOYSTICK_LAST + 1)]
|
||||
private GLFWjoystick[] joysticks = new GLFWjoystick[GLconst.GLFW_JOYSTICK_LAST + 1];
|
||||
|
||||
private GLFWallocator allocator;
|
||||
|
||||
private GLFWbool initialized;
|
||||
|
||||
private GLFWbool joysticksInitialized;
|
||||
private GLFWls contextSlot;
|
||||
|
||||
private GLFWls errorSlot;
|
||||
private GLFWmutex errorLock;
|
||||
|
||||
private GLFWplatform platform;
|
||||
|
||||
private int mappingCount;
|
||||
|
||||
private int monitorCount;
|
||||
|
||||
//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;
|
||||
|
||||
@@ -548,8 +557,8 @@ namespace StgSharp.Graphics
|
||||
private GLFWfbconfig framebuffer;
|
||||
|
||||
private GLFWinitconfig init;
|
||||
private int refreshRate;
|
||||
private GLFWwndconfig window;
|
||||
private int refreshRate;
|
||||
|
||||
}
|
||||
|
||||
@@ -566,23 +575,36 @@ namespace StgSharp.Graphics
|
||||
internal unsafe struct Egl
|
||||
{
|
||||
|
||||
internal void* display;
|
||||
|
||||
internal void* handle;
|
||||
|
||||
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 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 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 bool prefix;
|
||||
internal int major, minor;
|
||||
|
||||
internal int platform;
|
||||
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;
|
||||
@@ -591,20 +613,8 @@ namespace StgSharp.Graphics
|
||||
|
||||
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;
|
||||
@@ -615,6 +625,8 @@ namespace StgSharp.Graphics
|
||||
internal unsafe struct Osmesa
|
||||
{
|
||||
|
||||
private void* handle;
|
||||
|
||||
private IntPtr CreateContextAttribs;
|
||||
|
||||
private IntPtr CreateContextExt;
|
||||
@@ -622,8 +634,6 @@ namespace StgSharp.Graphics
|
||||
private IntPtr GetColorBuffer;
|
||||
private IntPtr GetDepthBuffer;
|
||||
private IntPtr GetProcAddress;
|
||||
|
||||
private void* handle;
|
||||
private IntPtr MakeCurrent;
|
||||
|
||||
}
|
||||
@@ -631,17 +641,18 @@ namespace StgSharp.Graphics
|
||||
internal unsafe struct vk
|
||||
{
|
||||
|
||||
private void* handle;
|
||||
|
||||
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;
|
||||
private IntPtr GetInstanceProcAddr;
|
||||
private fixed ulong extensions[2];
|
||||
|
||||
public vk()
|
||||
{
|
||||
@@ -664,12 +675,13 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWmapelement
|
||||
{
|
||||
|
||||
private sbyte axisOffset;
|
||||
private sbyte axisScale;
|
||||
private byte index;
|
||||
|
||||
private byte type;
|
||||
|
||||
private sbyte axisOffset;
|
||||
private sbyte axisScale;
|
||||
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
@@ -694,20 +706,21 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWjoystick
|
||||
{
|
||||
|
||||
private GLFWbool allocated;
|
||||
private float* axes;
|
||||
private byte* buttons;
|
||||
private byte* hats;
|
||||
private void* userPointer;
|
||||
private fixed byte guid[33];
|
||||
private fixed byte name[128];
|
||||
|
||||
private GLFWbool allocated;
|
||||
private GLFWbool connected;
|
||||
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
|
||||
@@ -730,12 +743,12 @@ namespace StgSharp.Graphics
|
||||
public unsafe struct GLFWplatform
|
||||
{
|
||||
|
||||
private int platformID;
|
||||
|
||||
// init
|
||||
//GLFWbool(*init)(void);
|
||||
private IntPtr init;
|
||||
|
||||
private int platformID;
|
||||
|
||||
//void (* terminate) (void);
|
||||
private IntPtr terminate;
|
||||
internal IntPtr createCursor;
|
||||
@@ -953,6 +966,9 @@ namespace StgSharp.Graphics
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct GLsync
|
||||
{
|
||||
|
||||
public IntPtr Handle;
|
||||
|
||||
}
|
||||
|
||||
#endregion glad struct
|
||||
|
||||
@@ -28,14 +28,6 @@
|
||||
//
|
||||
//-----------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------
|
||||
/*
|
||||
* 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;
|
||||
@@ -44,19 +36,22 @@ 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>
|
||||
/// <returns>An Intptr value representing the pointer to the function</returns>
|
||||
public delegate IntPtr glLoader(string name);
|
||||
|
||||
#region StgSharpDele
|
||||
|
||||
public unsafe delegate void FrameBufferSizeHandler(IntPtr window, uint width, uint height);
|
||||
|
||||
public unsafe delegate void FramePositionHandler(IntPtr window, float width, float height);
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region glDEBUG
|
||||
|
||||
internal unsafe delegate void GLDEBUGPROC(int source, int type, uint id, int severity, int length, sbyte* message, void* userParam);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace StgSharp.Graphics.GL
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
//rename types in style of GLconst
|
||||
|
||||
@@ -4849,13 +4849,18 @@ namespace StgSharp.Graphics.GL
|
||||
|
||||
public static class glAttachment
|
||||
{
|
||||
|
||||
public const uint Depth = GLconst.DEPTH_ATTACHMENT;
|
||||
public const uint DepthAndStencil = GLconst.DEPTH_STENCIL_ATTACHMENT;
|
||||
public const uint Stencil = GLconst.STENCIL_ATTACHMENT;
|
||||
|
||||
private static int colorRange =
|
||||
glFunc.GetMaskInteger((uint)GLconst.MAX_COLOR_ATTACHMENTS);
|
||||
OpenGLFunction.CurrentGL.GetMaskInteger((uint)GLconst.MAX_COLOR_ATTACHMENTS);
|
||||
|
||||
public static uint Color(int i)
|
||||
{
|
||||
#if DEBUG
|
||||
if (i>colorRange||i<0)
|
||||
if ((i > colorRange) || (i < 0))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
@@ -4863,8 +4868,5 @@ namespace StgSharp.Graphics.GL
|
||||
return (uint)(GLconst.COLOR_ATTACHMENT0 + i);
|
||||
}
|
||||
|
||||
public const uint Depth = GLconst.DEPTH_ATTACHMENT;
|
||||
public const uint Stencil = GLconst.STENCIL_ATTACHMENT;
|
||||
public const uint DepthAndStencil = GLconst.DEPTH_STENCIL_ATTACHMENT;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,11 @@
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace StgSharp.Graphics.GL
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace StgSharp.Graphics.OpenGL
|
||||
{
|
||||
public enum ImageChannelLayout
|
||||
public enum PixelChannelLayout
|
||||
{
|
||||
UByte = GLconst.UNSIGNED_BYTE,
|
||||
Byte = GLconst.BYTE,
|
||||
@@ -41,20 +43,31 @@ namespace StgSharp.Graphics.GL
|
||||
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
|
||||
UByte332 = GLconst.UNSIGNED_BYTE_3_3_2,
|
||||
UByte233Rev = GLconst.UNSIGNED_BYTE_2_3_3_REV,
|
||||
UShort565 = GLconst.UNSIGNED_SHORT_5_6_5,
|
||||
UShort565Rev = GLconst.UNSIGNED_SHORT_5_6_5_REV,
|
||||
UShort4444 = GLconst.UNSIGNED_SHORT_4_4_4_4,
|
||||
UShort4444Rev = GLconst.UNSIGNED_SHORT_4_4_4_4_REV,
|
||||
UShort5551 = GLconst.UNSIGNED_SHORT_5_5_5_1,
|
||||
UShort1555Rev = GLconst.UNSIGNED_SHORT_1_5_5_5_REV,
|
||||
UInt8888 = GLconst.UNSIGNED_INT_8_8_8_8,
|
||||
UInt8888Rev = GLconst.UNSIGNED_INT_8_8_8_8_REV,
|
||||
UInt1010102 = GLconst.UNSIGNED_INT_10_10_10_2,
|
||||
UInt2101010Rev = GLconst.UNSIGNED_INT_2_10_10_10_REV
|
||||
}
|
||||
|
||||
public enum FrameBufferStatus
|
||||
{
|
||||
Complete = GLconst.FRAMEBUFFER_COMPLETE, // GL_FRAMEBUFFER_COMPLETE
|
||||
IncompleteAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
|
||||
IncompleteMissingAttachment = GLconst.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, // GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT
|
||||
IncompleteDrawBuffer = GLconst.FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER
|
||||
IncompleteReadBuffer = GLconst.FRAMEBUFFER_INCOMPLETE_READ_BUFFER, // GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER
|
||||
Unsupported = GLconst.FRAMEBUFFER_UNSUPPORTED, // GL_FRAMEBUFFER_UNSUPPORTED
|
||||
IncompleteMultisample = GLconst.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, // GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE
|
||||
IncompleteLayerTargets = GLconst.FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS // GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS
|
||||
}
|
||||
|
||||
internal enum VkStructureType : uint
|
||||
{
|
||||
@@ -81,6 +94,12 @@ namespace StgSharp.Graphics.GL
|
||||
BGRA = GLconst.BGRA
|
||||
}
|
||||
|
||||
public enum FrameBufferAttachment
|
||||
{
|
||||
Color = GLconst.COLOR_ATTACHMENT0,
|
||||
Depth = GLconst.DEPTH_ATTACHMENT,
|
||||
Stencil = GLconst.STENCIL_ATTACHMENT,
|
||||
}
|
||||
|
||||
public enum Texture2DTarget
|
||||
{
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace StgSharp.Graphics
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user