mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-09-09 03:01:41 -04:00
Big unsafe update 2
This commit is contained in:
@@ -9,7 +9,7 @@ namespace Raylib_cs
|
|||||||
public static unsafe class Raylib
|
public static unsafe class Raylib
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by DllImport to load the native library.
|
/// Used by DllImport to load the native library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
@@ -163,10 +163,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetWindowSize(int width, int height);
|
public static extern void SetWindowSize(int width, int height);
|
||||||
|
|
||||||
/// <summary>Get native window handle<br/>
|
/// <summary>Get native window handle</summary>
|
||||||
/// IntPtr refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr GetWindowHandle();
|
public static extern void* GetWindowHandle();
|
||||||
|
|
||||||
/// <summary>Get current screen width</summary>
|
/// <summary>Get current screen width</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -483,15 +482,15 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Internal memory allocator</summary>
|
/// <summary>Internal memory allocator</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr MemAlloc(int size);
|
public static extern void* MemAlloc(int size);
|
||||||
|
|
||||||
/// <summary>Internal memory reallocator</summary>
|
/// <summary>Internal memory reallocator</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr MemRealloc(IntPtr ptr, int size);
|
public static extern void* MemRealloc(void* ptr, int size);
|
||||||
|
|
||||||
/// <summary>Internal memory free</summary>
|
/// <summary>Internal memory free</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void MemFree(IntPtr ptr);
|
public static extern void MemFree(void* ptr);
|
||||||
|
|
||||||
|
|
||||||
// Set custom callbacks
|
// Set custom callbacks
|
||||||
@@ -520,19 +519,17 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// Files management functions
|
// Files management functions
|
||||||
|
|
||||||
/// <summary>Load file data as byte array (read)<br/>
|
/// <summary>Load file data as byte array (read)</summary>
|
||||||
/// IntPtr refers to unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadFileData(string fileName, ref int bytesRead);
|
public static extern byte* LoadFileData(string fileName, ref int bytesRead);
|
||||||
|
|
||||||
/// <summary>Unload file data allocated by LoadFileData()<br/>
|
/// <summary>Unload file data allocated by LoadFileData()</summary>
|
||||||
/// data refers to a unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadFileData(IntPtr data);
|
public static extern void UnloadFileData(byte* data);
|
||||||
|
|
||||||
/// <summary>Save data to file from byte array (write)</summary>
|
/// <summary>Save data to file from byte array (write)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern CBool SaveFileData(string fileName, IntPtr data, int bytesToWrite);
|
public static extern CBool SaveFileData(string fileName, void* data, int bytesToWrite);
|
||||||
|
|
||||||
/// <summary>Check file extension</summary>
|
/// <summary>Check file extension</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -556,11 +553,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Compress data (DEFLATE algorythm)</summary>
|
/// <summary>Compress data (DEFLATE algorythm)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr CompressData(byte[] data, int dataLength, ref int compDataLength);
|
public static extern byte* CompressData(byte[] data, int dataLength, ref int compDataLength);
|
||||||
|
|
||||||
/// <summary>Decompress data (DEFLATE algorythm)</summary>
|
/// <summary>Decompress data (DEFLATE algorythm)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr DecompressData(byte[] compData, int compDataLength, ref int dataLength);
|
public static extern byte* DecompressData(byte[] compData, int compDataLength, ref int dataLength);
|
||||||
|
|
||||||
|
|
||||||
// Persistent storage management
|
// Persistent storage management
|
||||||
@@ -1025,10 +1022,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image LoadImageAnim(string fileName, ref int frames);
|
public static extern Image LoadImageAnim(string fileName, ref int frames);
|
||||||
|
|
||||||
/// <summary>Load image from memory buffer, fileType refers to extension: i.e. "png"<br/>
|
/// <summary>Load image from memory buffer, fileType refers to extension: i.e. "png"</summary>
|
||||||
/// fileData refers to const unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image LoadImageFromMemory(string fileType, IntPtr fileData, int dataSize);
|
public static extern Image LoadImageFromMemory(string fileType, byte* fileData, int dataSize);
|
||||||
|
|
||||||
/// <summary>Load image from GPU texture data</summary>
|
/// <summary>Load image from GPU texture data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1188,25 +1184,21 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void ImageColorReplace(ref Image image, Color color, Color replace);
|
public static extern void ImageColorReplace(ref Image image, Color color, Color replace);
|
||||||
|
|
||||||
/// <summary>Load color data from image as a Color array (RGBA - 32bit)<br/>
|
/// <summary>Load color data from image as a Color array (RGBA - 32bit)</summary>
|
||||||
/// IntPtr refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadImageColors(Image image);
|
public static extern Color* LoadImageColors(Image image);
|
||||||
|
|
||||||
/// <summary>Load colors palette from image as a Color array (RGBA - 32bit)<br/>
|
/// <summary>Load colors palette from image as a Color array (RGBA - 32bit)</summary>
|
||||||
/// IntPtr refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadImagePaletee(Image image, int maxPaletteSize, ref int colorsCount);
|
public static extern Color* LoadImagePalette(Image image, int maxPaletteSize, ref int colorsCount);
|
||||||
|
|
||||||
/// <summary>Unload color data loaded with LoadImageColors()<br/>
|
/// <summary>Unload color data loaded with LoadImageColors()</summary>
|
||||||
/// colors refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadImageColors(IntPtr colors);
|
public static extern void UnloadImageColors(Color* colors);
|
||||||
|
|
||||||
/// <summary>Unload colors palette loaded with LoadImagePalette()
|
/// <summary>Unload colors palette loaded with LoadImagePalette()</summary>
|
||||||
/// colors refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadImagePaletee(IntPtr colors);
|
public static extern void UnloadImagePalette(Color* colors);
|
||||||
|
|
||||||
/// <summary>Get image alpha border rectangle</summary>
|
/// <summary>Get image alpha border rectangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1304,15 +1296,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadRenderTexture(RenderTexture2D target);
|
public static extern void UnloadRenderTexture(RenderTexture2D target);
|
||||||
|
|
||||||
/// <summary>Update GPU texture with new data<br/>
|
/// <summary>Update GPU texture with new data</summary>
|
||||||
/// pixels refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateTexture(Texture2D texture, IntPtr pixels);
|
public static extern void UpdateTexture(Texture2D texture, void* pixels);
|
||||||
|
|
||||||
/// <summary>Update GPU texture rectangle with new data
|
/// <summary>Update GPU texture rectangle with new data</summary>
|
||||||
/// pixels refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateTextureRec(Texture2D texture, Rectangle rec, IntPtr pixels);
|
public static extern void UpdateTextureRec(Texture2D texture, Rectangle rec, void* pixels);
|
||||||
|
|
||||||
|
|
||||||
// Texture configuration functions
|
// Texture configuration functions
|
||||||
@@ -1405,11 +1395,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Get Color from a source pixel pointer of certain format</summary>
|
/// <summary>Get Color from a source pixel pointer of certain format</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Color GetPixelColor(IntPtr srcPtr, PixelFormat format);
|
public static extern Color GetPixelColor(void* srcPtr, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Set color formatted into destination pixel pointer</summary>
|
/// <summary>Set color formatted into destination pixel pointer</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetPixelColor(IntPtr dstPtr, Color color, PixelFormat format);
|
public static extern void SetPixelColor(void* dstPtr, Color color, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Get pixel data size in bytes for certain format</summary>
|
/// <summary>Get pixel data size in bytes for certain format</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1441,22 +1431,19 @@ namespace Raylib_cs
|
|||||||
/// <summary>Load font from memory buffer, fileType refers to extension: i.e. "ttf"<br/>
|
/// <summary>Load font from memory buffer, fileType refers to extension: i.e. "ttf"<br/>
|
||||||
/// fileData refers to const unsigned char *</summary>
|
/// fileData refers to const unsigned char *</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Font LoadFontFromMemory(string fileType, IntPtr fileData, int dataSize, int fontSize, int[] fontChars, int charsCount);
|
public static extern Font LoadFontFromMemory(string fileType, byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount);
|
||||||
|
|
||||||
/// <summary>Load font data for further use<br/>
|
/// <summary>Load font data for further use</summary>
|
||||||
/// fileData refers to const unsigned char *<br/>
|
|
||||||
/// IntPtr refers to GlyphInfo *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadFontData(IntPtr fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type);
|
public static extern GlyphInfo* LoadFontData(byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type);
|
||||||
|
|
||||||
/// <summary>Generate image font atlas using chars info</summary>
|
/// <summary>Generate image font atlas using chars info</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image GenImageFontAtlas(IntPtr chars, ref IntPtr recs, int charsCount, int fontSize, int padding, int packMethod);
|
public static extern Image GenImageFontAtlas(GlyphInfo* chars, Rectangle** recs, int charsCount, int fontSize, int padding, int packMethod);
|
||||||
|
|
||||||
/// <summary>Unload font chars info data (RAM)<br/>
|
/// <summary>Unload font chars info data (RAM)</summary>
|
||||||
/// chars refers to GlpyhInfo *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadFontData(IntPtr chars, int charsCount);
|
public static extern void UnloadFontData(GlyphInfo* chars, int charsCount);
|
||||||
|
|
||||||
/// <summary>Unload Font from GPU memory (VRAM)</summary>
|
/// <summary>Unload Font from GPU memory (VRAM)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1538,10 +1525,9 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// UTF8 text strings management functions
|
// UTF8 text strings management functions
|
||||||
|
|
||||||
/// <summary>Get all codepoints in a string, codepoints count returned by parameters<br/>
|
/// <summary>Get all codepoints in a string, codepoints count returned by parameters</summary>
|
||||||
/// IntPtr refers to a int *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr GetCodepoints(string text, ref int count);
|
public static extern int* GetCodepoints(string text, ref int count);
|
||||||
|
|
||||||
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary>
|
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1679,10 +1665,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UploadMesh(ref Mesh mesh, CBool dynamic);
|
public static extern void UploadMesh(ref Mesh mesh, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Update mesh vertex data in GPU for a specific buffer index<br/>
|
/// <summary>Update mesh vertex data in GPU for a specific buffer index</summary>
|
||||||
/// data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateMeshBuffer(Mesh mesh, int index, IntPtr data, int dataSize, int offset);
|
public static extern void UpdateMeshBuffer(Mesh mesh, int index, void* data, int dataSize, int offset);
|
||||||
|
|
||||||
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
|
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1715,10 +1700,9 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// Material loading/unloading functions
|
// Material loading/unloading functions
|
||||||
|
|
||||||
/// <summary>Load materials from model file<br/>
|
/// <summary>Load materials from model file</summary>
|
||||||
/// IntPtr refers to Material *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadMaterials(string fileName, ref int materialCount);
|
public static extern Material* LoadMaterials(string fileName, ref int materialCount);
|
||||||
|
|
||||||
/// <summary>Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)</summary>
|
/// <summary>Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1819,10 +1803,9 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// Model animations loading/unloading functions
|
// Model animations loading/unloading functions
|
||||||
|
|
||||||
/// <summary>Load model animations from file<br/>
|
/// <summary>Load model animations from file</summary>
|
||||||
/// IntPtr refers to ModelAnimation *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadModelAnimations(string fileName, ref int animsCount);
|
public static extern ModelAnimation* LoadModelAnimations(string fileName, ref int animsCount);
|
||||||
|
|
||||||
/// <summary>Update model animation pose</summary>
|
/// <summary>Update model animation pose</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1911,7 +1894,7 @@ namespace Raylib_cs
|
|||||||
/// <summary>Load wave from memory buffer, fileType refers to extension: i.e. "wav"<br/>
|
/// <summary>Load wave from memory buffer, fileType refers to extension: i.e. "wav"<br/>
|
||||||
/// fileData refers to a const unsigned char *</summary>
|
/// fileData refers to a const unsigned char *</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Wave LoadWaveFromMemory(string fileType, IntPtr fileData, int dataSize);
|
public static extern Wave LoadWaveFromMemory(string fileType, byte* fileData, int dataSize);
|
||||||
|
|
||||||
/// <summary>Load sound from file</summary>
|
/// <summary>Load sound from file</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1921,10 +1904,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Sound LoadSoundFromWave(Wave wave);
|
public static extern Sound LoadSoundFromWave(Wave wave);
|
||||||
|
|
||||||
/// <summary>Update sound buffer with new data<br/>
|
/// <summary>Update sound buffer with new data</summary>
|
||||||
/// refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateSound(Sound sound, IntPtr data, int samplesCount);
|
public static extern void UpdateSound(Sound sound, void* data, int samplesCount);
|
||||||
|
|
||||||
/// <summary>Unload wave data</summary>
|
/// <summary>Unload wave data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1997,15 +1979,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void WaveCrop(ref Wave wave, int initSample, int finalSample);
|
public static extern void WaveCrop(ref Wave wave, int initSample, int finalSample);
|
||||||
|
|
||||||
/// <summary>Get samples data from wave as a floats array<br/>
|
/// <summary>Get samples data from wave as a floats array</summary>
|
||||||
/// IntPtr refers to float *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadWaveSamples(Wave wave);
|
public static extern float* LoadWaveSamples(Wave wave);
|
||||||
|
|
||||||
/// <summary>Unload samples data loaded with LoadWaveSamples()<br/>
|
/// <summary>Unload samples data loaded with LoadWaveSamples()</summary>
|
||||||
/// samples refers to float *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadWaveSamples(IntPtr samples);
|
public static extern void UnloadWaveSamples(float* samples);
|
||||||
|
|
||||||
// Music management functions
|
// Music management functions
|
||||||
|
|
||||||
@@ -2015,7 +1995,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Load music stream from data</summary>
|
/// <summary>Load music stream from data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Music LoadMusicStreamFromMemory(string fileType, IntPtr data, int dataSize);
|
public static extern Music LoadMusicStreamFromMemory(string fileType, byte* data, int dataSize);
|
||||||
|
|
||||||
/// <summary>Unload music stream</summary>
|
/// <summary>Unload music stream</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2076,10 +2056,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadAudioStream(AudioStream stream);
|
public static extern void UnloadAudioStream(AudioStream stream);
|
||||||
|
|
||||||
/// <summary>Update audio stream buffers with data<br/>
|
/// <summary>Update audio stream buffers with data</summary>
|
||||||
/// data refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateAudioStream(AudioStream stream, IntPtr data, int samplesCount);
|
public static extern void UpdateAudioStream(AudioStream stream, void* data, int samplesCount);
|
||||||
|
|
||||||
/// <summary>Check if any audio stream buffers requires refill</summary>
|
/// <summary>Check if any audio stream buffers requires refill</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
@@ -16,333 +16,392 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
public static class Raymath
|
public static unsafe class Raymath
|
||||||
{
|
{
|
||||||
// Used by DllImport to load the native library.
|
/// <summary>
|
||||||
|
/// Used by DllImport to load the native library
|
||||||
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
// Clamp float value
|
/// <summary>Clamp float value</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Clamp(float value, float min, float max);
|
public static extern float Clamp(float value, float min, float max);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Lerp(float start, float end, float amount);
|
public static extern float Lerp(float start, float end, float amount);
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
/// <summary>Normalize input value within input range</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern float Normalize(float value, float start, float end);
|
||||||
|
|
||||||
|
/// <summary>Remap input value within input range to output range</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>Vector with components value 0.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Zero();
|
public static extern Vector2 Vector2Zero();
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
/// <summary>Vector with components value 1.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2One();
|
public static extern Vector2 Vector2One();
|
||||||
|
|
||||||
// Add two vectors (v1 + v2)
|
/// <summary>Add two vectors (v1 + v2)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Subtract two vectors (v1 - v2)
|
/// <summary>Add vector and float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Vector2 Vector2AddValue(Vector2 v, float add);
|
||||||
|
|
||||||
|
/// <summary>Subtract two vectors (v1 - v2)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate vector length
|
/// <summary>Subtract vector by float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Vector2 Vector2SubtractValue(Vector2 v, float sub);
|
||||||
|
|
||||||
|
/// <summary>Calculate vector length</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector2Length(Vector2 v);
|
public static extern float Vector2Length(Vector2 v);
|
||||||
|
|
||||||
// Calculate two vectors dot product
|
/// <summary>Calculate vector square length</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern float Vector2LengthSqr(Vector2 v);
|
||||||
|
|
||||||
|
/// <summary>Calculate two vectors dot product</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate distance between two vectors
|
/// <summary>Calculate distance between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
|
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate angle from two vectors in X-axis
|
/// <summary>Calculate angle from two vectors in X-axis</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Scale vector (multiply by value)
|
/// <summary>Scale vector (multiply by value)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
|
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
|
||||||
|
|
||||||
// Multiply vector by vector
|
/// <summary>Multiply vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2MultiplyV(Vector2 v1, Vector2 v2);
|
public static extern Vector2 Vector2Multiply(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Negate vector
|
/// <summary>Negate vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Negate(Vector2 v);
|
public static extern Vector2 Vector2Negate(Vector2 v);
|
||||||
|
|
||||||
// Divide vector by a float value
|
/// <summary>Divide vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Divide(Vector2 v, float div);
|
public static extern Vector2 Vector2Divide(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Divide vector by vector
|
/// <summary>Normalize provided vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector2 Vector2DivideV(Vector2 v1, Vector2 v2);
|
|
||||||
|
|
||||||
// Normalize provided vector
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Normalize(Vector2 v);
|
public static extern Vector2 Vector2Normalize(Vector2 v);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
|
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Rotate(Vector2 v, float degs);
|
public static extern Vector2 Vector2Rotate(Vector2 v, float degs);
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
|
||||||
|
/// <summary>Vector with components value 0.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Zero();
|
public static extern Vector3 Vector3Zero();
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
/// <summary>Vector with components value 1.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3One();
|
public static extern Vector3 Vector3One();
|
||||||
|
|
||||||
// Add two vectors
|
/// <summary>Add two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Subtract two vectors
|
/// <summary>Add vector and float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Vector3 Vector3AddValue(Vector3 v, float add);
|
||||||
|
|
||||||
|
/// <summary>Subtract two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Multiply vector by scalar
|
/// <summary>Subtract vector and float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Vector3 Vector3SubtractValue(Vector3 v, float sub);
|
||||||
|
|
||||||
|
/// <summary>Multiply vector by scalar</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Scale(Vector3 v, float scalar);
|
public static extern Vector3 Vector3Scale(Vector3 v, float scalar);
|
||||||
|
|
||||||
// Multiply vector by vector
|
/// <summary>Multiply vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate two vectors cross product
|
/// <summary>Calculate two vectors cross product</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate one vector perpendicular vector
|
/// <summary>Calculate one vector perpendicular vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
||||||
|
|
||||||
// Calculate vector length
|
/// <summary>Calculate vector length</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector3Length(Vector3 v);
|
public static extern float Vector3Length(Vector3 v);
|
||||||
|
|
||||||
// Calculate two vectors dot product
|
/// <summary>Calculate vector square length</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern float Vector3LengthSqr(Vector3 v);
|
||||||
|
|
||||||
|
/// <summary>Calculate two vectors dot product</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate distance between two vectors
|
/// <summary>Calculate distance between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
|
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Negate provided vector (invert direction)
|
/// <summary>Calculate angle between two vectors in XY and XZ</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Vector2 Vector3Angle(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
|
/// <summary>Negate provided vector (invert direction)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Negate(Vector3 v);
|
public static extern Vector3 Vector3Negate(Vector3 v);
|
||||||
|
|
||||||
// Divide vector by a float value
|
/// <summary>Divide vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Divide(Vector3 v, float div);
|
public static extern Vector3 Vector3Divide(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Divide vector by vector
|
/// <summary>Normalize provided vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector3 Vector3DivideV(Vector3 v1, Vector3 v2);
|
|
||||||
|
|
||||||
// Normalize provided vector
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Normalize(Vector3 v);
|
public static extern Vector3 Vector3Normalize(Vector3 v);
|
||||||
|
|
||||||
// Orthonormalize provided vectors
|
/// <summary>Orthonormalize provided vectors<br/>
|
||||||
// Makes vectors normalized and orthogonal to each other
|
/// Makes vectors normalized and orthogonal to each other<br/>
|
||||||
// Gram-Schmidt function implementation
|
/// Gram-Schmidt function implementation</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void Vector3OrthoNormalize(ref Vector3 v1, ref Vector3 v2);
|
public static extern void Vector3OrthoNormalize(Vector3* v1, Vector3* v2);
|
||||||
|
|
||||||
// Transforms a Vector3 by a given Matrix
|
/// <summary>Transforms a Vector3 by a given Matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
|
public static extern Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
|
||||||
|
|
||||||
// Transform a vector by quaternion rotation
|
/// <summary>Transform a vector by quaternion rotation</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
||||||
|
|
||||||
// Calculate reflected vector to normal
|
/// <summary>Calculate reflected vector to normal</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
||||||
|
|
||||||
// Return min value for each pair of components
|
/// <summary>Return min value for each pair of components</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Return max value for each pair of components
|
/// <summary>Return max value for each pair of components</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
|
/// <summary>Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)<br/>
|
||||||
// NOTE: Assumes P is on the plane of the triangle
|
/// NOTE: Assumes P is on the plane of the triangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
||||||
|
|
||||||
// Returns Vector3 as float array
|
/// <summary>Projects a Vector3 from screen space into object space<br/>
|
||||||
|
/// NOTE: We are avoiding calling other raymath functions despite available</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float3 Vector3ToFloatV(Vector3 v);
|
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
|
||||||
|
|
||||||
// Compute matrix determinant
|
|
||||||
|
/// <summary>Compute matrix determinant</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float MatrixDeterminant(Matrix4x4 mat);
|
public static extern float MatrixDeterminant(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns the trace of the matrix (sum of the values along the diagonal)
|
/// <summary>Get the trace of the matrix (sum of the values along the diagonal)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float MatrixTrace(Matrix4x4 mat);
|
public static extern float MatrixTrace(Matrix4x4 mat);
|
||||||
|
|
||||||
// Transposes provided matrix
|
/// <summary>Transposes provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
||||||
|
|
||||||
// Invert provided matrix
|
/// <summary>Invert provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
||||||
|
|
||||||
// Normalize provided matrix
|
/// <summary>Normalize provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixNormalize(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixNormalize(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns identity matrix
|
/// <summary>Get identity matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixIdentity();
|
public static extern Matrix4x4 MatrixIdentity();
|
||||||
|
|
||||||
// Add two matrices
|
/// <summary>Add two matrices</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Subtract two matrices (left - right)
|
/// <summary>Subtract two matrices (left - right)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
|
public static extern Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Returns translation matrix
|
/// <summary>Get two matrix multiplication<br/>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
/// NOTE: When multiplying matrices... the order matters!</summary>
|
||||||
public static extern Matrix4x4 MatrixTranslate(float x, float y, float z);
|
|
||||||
|
|
||||||
// Create rotation matrix from axis and angle
|
|
||||||
// NOTE: Angle should be provided in radians
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
|
||||||
|
|
||||||
// Returns xyz-rotation matrix (angles in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
|
||||||
|
|
||||||
// Returns x-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateX(float angle);
|
|
||||||
|
|
||||||
// Returns y-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateY(float angle);
|
|
||||||
|
|
||||||
// Returns z-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateZ(float angle);
|
|
||||||
|
|
||||||
// Returns scaling matrix
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixScale(float x, float y, float z);
|
|
||||||
|
|
||||||
// Returns two matrix multiplication
|
|
||||||
// NOTE: When multiplying matrices... the order matters!
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Returns perspective projection matrix
|
/// <summary>Get translation matrix</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixTranslate(float x, float y, float z);
|
||||||
|
|
||||||
|
/// <summary>Create rotation matrix from axis and angle<br/>
|
||||||
|
/// NOTE: Angle should be provided in radians</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
||||||
|
|
||||||
|
/// <summary>Get x-rotation matrix (angle in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateX(float angle);
|
||||||
|
|
||||||
|
/// <summary>Get y-rotation matrix (angle in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateY(float angle);
|
||||||
|
|
||||||
|
/// <summary>Get z-rotation matrix (angle in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateZ(float angle);
|
||||||
|
|
||||||
|
/// <summary>Get xyz-rotation matrix (angles in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
||||||
|
|
||||||
|
/// <summary>Get zyx-rotation matrix (angles in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateZYX(Vector3 ang);
|
||||||
|
|
||||||
|
/// <summary>Get scaling matrix</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixScale(float x, float y, float z);
|
||||||
|
|
||||||
|
/// <summary>Get perspective projection matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixFrustum(double left, double right, double bottom, double top, double near, double far);
|
public static extern Matrix4x4 MatrixFrustum(double left, double right, double bottom, double top, double near, double far);
|
||||||
|
|
||||||
// Returns perspective projection matrix
|
/// <summary>Get perspective projection matrix<br/>
|
||||||
// NOTE: Angle should be provided in radians
|
/// NOTE: Angle should be provided in radians</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
|
public static extern Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
|
||||||
|
|
||||||
// Returns orthographic projection matrix
|
/// <summary>Get orthographic projection matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
|
public static extern Matrix4x4 MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
|
||||||
|
|
||||||
// Returns camera look-at matrix (view matrix)
|
/// <summary>Get camera look-at matrix (view matrix)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
|
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
|
||||||
|
|
||||||
// Returns float array of matrix data
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float16 MatrixToFloatV(Matrix4x4 mat);
|
|
||||||
|
|
||||||
// Returns identity quaternion
|
/// <summary>Add 2 quaternions</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionAdd(Quaternion q1, Quaternion q2);
|
||||||
|
|
||||||
|
/// <summary>Add quaternion and float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionAddValue(Quaternion q, float add);
|
||||||
|
|
||||||
|
/// <summary>Subtract 2 quaternions</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2);
|
||||||
|
|
||||||
|
/// <summary>Subtract quaternion and float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionSubtractValue(Quaternion q, float add);
|
||||||
|
|
||||||
|
/// <summary>Get identity quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionIdentity();
|
public static extern Quaternion QuaternionIdentity();
|
||||||
|
|
||||||
// Computes the length of a quaternion
|
/// <summary>Computes the length of a quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float QuaternionLength(Quaternion q);
|
public static extern float QuaternionLength(Quaternion q);
|
||||||
|
|
||||||
// Normalize provided quaternion
|
/// <summary>Normalize provided quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
||||||
|
|
||||||
// Invert provided quaternion
|
/// <summary>Invert provided quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionInvert(Quaternion q);
|
public static extern Quaternion QuaternionInvert(Quaternion q);
|
||||||
|
|
||||||
// Calculate two quaternion multiplication
|
/// <summary>Calculate two quaternion multiplication</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
||||||
|
|
||||||
// Calculate linear interpolation between two quaternions
|
/// <summary>Scale quaternion by float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionScale(Quaternion q, float mul);
|
||||||
|
|
||||||
|
/// <summary>Divide two quaternions</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);
|
||||||
|
|
||||||
|
/// <summary>Calculate linear interpolation between two quaternions</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculate slerp-optimized interpolation between two quaternions
|
/// <summary>Calculate slerp-optimized interpolation between two quaternions</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculates spherical linear interpolation between two quaternions
|
/// <summary>Calculates spherical linear interpolation between two quaternions</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculate quaternion based on the rotation from one vector to another
|
/// <summary>Calculate quaternion based on the rotation from one vector to another</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
||||||
|
|
||||||
// Returns a quaternion for a given rotation matrix
|
/// <summary>Get a quaternion for a given rotation matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionFromMatrix(Matrix4x4 mat);
|
public static extern Quaternion QuaternionFromMatrix(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns a matrix for a given quaternion
|
/// <summary>Get a matrix for a given quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 QuaternionToMatrix(Quaternion q);
|
public static extern Matrix4x4 QuaternionToMatrix(Quaternion q);
|
||||||
|
|
||||||
// Returns rotation quaternion for an angle and axis
|
/// <summary>Get rotation quaternion for an angle and axis<br/>
|
||||||
// NOTE: angle must be provided in radians
|
/// NOTE: angle must be provided in radians</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
||||||
|
|
||||||
// Returns the rotation angle and axis for a given quaternion
|
/// <summary>Get the rotation angle and axis for a given quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void QuaternionToAxisAngle(Quaternion q, ref Vector3 outAxis, ref float outAngle);
|
public static extern void QuaternionToAxisAngle(Quaternion q, Vector3* outAxis, float* outAngle);
|
||||||
|
|
||||||
// Returns he quaternion equivalent to Euler angles
|
/// <summary>Get the quaternion equivalent to Euler angles<br/>
|
||||||
|
/// NOTE: Rotation order is ZYX</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionFromEuler(float roll, float pitch, float yaw);
|
public static extern Quaternion QuaternionFromEuler(float pitch, float yaw, float roll);
|
||||||
|
|
||||||
// Return the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
/// <summary>Get the Euler angles equivalent to quaternion (roll, pitch, yaw)<br/>
|
||||||
// NOTE: Angles are returned in a Vector3 struct in degrees
|
/// NOTE: Angles are returned in a Vector3 struct in radians</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 QuaternionToEuler(Quaternion q);
|
public static extern Vector3 QuaternionToEuler(Quaternion q);
|
||||||
|
|
||||||
// Transform a quaternion given a transformation matrix
|
/// <summary>Transform a quaternion given a transformation matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
|
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
|
||||||
}
|
}
|
||||||
|
@@ -6,9 +6,11 @@ using System.Security;
|
|||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
public static class Rlgl
|
public static unsafe class Rlgl
|
||||||
{
|
{
|
||||||
// Used by DllImport to load the native library.
|
/// <summary>
|
||||||
|
/// Used by DllImport to load the native library
|
||||||
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
public const int DEFAULT_BATCH_BUFFER_ELEMENTS = 8192;
|
public const int DEFAULT_BATCH_BUFFER_ELEMENTS = 8192;
|
||||||
@@ -200,10 +202,9 @@ namespace Raylib_cs
|
|||||||
public static extern void rlDisableVertexAttribute(uint index);
|
public static extern void rlDisableVertexAttribute(uint index);
|
||||||
|
|
||||||
/// <summary>Enable attribute state pointer<br/>
|
/// <summary>Enable attribute state pointer<br/>
|
||||||
/// buffer refers to a void *<br/>
|
|
||||||
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlEnableStatePointer(int vertexAttribType, IntPtr buffer);
|
public static extern void rlEnableStatePointer(int vertexAttribType, void* buffer);
|
||||||
|
|
||||||
/// <summary>Disable attribute state pointer<br/>
|
/// <summary>Disable attribute state pointer<br/>
|
||||||
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
||||||
@@ -379,10 +380,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlglClose();
|
public static extern void rlglClose();
|
||||||
|
|
||||||
/// <summary>Load OpenGL extensions<br/>
|
/// <summary>Load OpenGL extensions</summary>
|
||||||
/// loader refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlLoadExtensions(IntPtr loader);
|
public static extern void rlLoadExtensions(void* loader);
|
||||||
|
|
||||||
/// <summary>Get current OpenGL version</summary>
|
/// <summary>Get current OpenGL version</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -406,7 +406,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Get default shader locations</summary>
|
/// <summary>Get default shader locations</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern int* rlGetShaderLocsDefault();
|
public static extern int* rlGetShaderLocsDefault();
|
||||||
|
|
||||||
// Render batch management
|
// Render batch management
|
||||||
|
|
||||||
@@ -449,15 +449,15 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Load a vertex buffer attribute</summary>
|
/// <summary>Load a vertex buffer attribute</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadVertexBuffer(IntPtr buffer, int size, CBool dynamic);
|
public static extern uint rlLoadVertexBuffer(void* buffer, int size, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Load a new attributes element buffer</summary>
|
/// <summary>Load a new attributes element buffer</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadVertexBufferElement(IntPtr buffer, int size, CBool dynamic);
|
public static extern uint rlLoadVertexBufferElement(void* buffer, int size, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Update GPU buffer with new data</summary>
|
/// <summary>Update GPU buffer with new data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUpdateVertexBuffer(uint bufferId, IntPtr data, int dataSize, int offset);
|
public static extern void rlUpdateVertexBuffer(uint bufferId, void* data, int dataSize, int offset);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUnloadVertexArray(uint vaoId);
|
public static extern void rlUnloadVertexArray(uint vaoId);
|
||||||
@@ -466,48 +466,45 @@ namespace Raylib_cs
|
|||||||
public static extern void rlUnloadVertexBuffer(uint vboId);
|
public static extern void rlUnloadVertexBuffer(uint vboId);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttribute(uint index, int compSize, int type, CBool normalized, int stride, IntPtr pointer);
|
public static extern void rlSetVertexAttribute(uint index, int compSize, int type, CBool normalized, int stride, void* pointer);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttributeDivisor(uint index, int divisor);
|
public static extern void rlSetVertexAttributeDivisor(uint index, int divisor);
|
||||||
|
|
||||||
/// <summary>Set vertex attribute default value</summary>
|
/// <summary>Set vertex attribute default value</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttributeDefault(int locIndex, IntPtr value, int attribType, int count);
|
public static extern void rlSetVertexAttributeDefault(int locIndex, void* value, int attribType, int count);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArray(int offset, int count);
|
public static extern void rlDrawVertexArray(int offset, int count);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayElements(int offset, int count, IntPtr buffer);
|
public static extern void rlDrawVertexArrayElements(int offset, int count, void* buffer);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayInstanced(int offset, int count, int instances);
|
public static extern void rlDrawVertexArrayInstanced(int offset, int count, int instances);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayElementsInstanced(int offset, int count, IntPtr buffer, int instances);
|
public static extern void rlDrawVertexArrayElementsInstanced(int offset, int count, void* buffer, int instances);
|
||||||
|
|
||||||
|
|
||||||
// Textures data management
|
// Textures data management
|
||||||
|
|
||||||
/// <summary>Load texture in GPU<br/>
|
/// <summary>Load texture in GPU</summary>
|
||||||
/// data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTexture(IntPtr data, int width, int height, PixelFormat format, int mipmapCount);
|
public static extern uint rlLoadTexture(void* data, int width, int height, PixelFormat format, int mipmapCount);
|
||||||
|
|
||||||
/// <summary>Load depth texture/renderbuffer (to be attached to fbo)</summary>
|
/// <summary>Load depth texture/renderbuffer (to be attached to fbo)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTextureDepth(int width, int height, CBool useRenderBuffer);
|
public static extern uint rlLoadTextureDepth(int width, int height, CBool useRenderBuffer);
|
||||||
|
|
||||||
/// <summary>Load texture cubemap<br/>
|
/// <summary>Load texture cubemap</summary>
|
||||||
/// data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTextureCubemap(IntPtr data, int size, PixelFormat format);
|
public static extern uint rlLoadTextureCubemap(void* data, int size, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Update GPU texture with new data<br/>
|
/// <summary>Update GPU texture with new data</summary>
|
||||||
/// data refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, IntPtr data);
|
public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, void* data);
|
||||||
|
|
||||||
/// <summary>Get OpenGL internal formats</summary>
|
/// <summary>Get OpenGL internal formats</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -515,7 +512,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Get OpenGL internal formats</summary>
|
/// <summary>Get OpenGL internal formats</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr rlGetPixelFormatName(PixelFormat format);
|
public static extern sbyte* rlGetPixelFormatName(PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Unload texture from GPU memory</summary>
|
/// <summary>Unload texture from GPU memory</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -525,15 +522,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlGenTextureMipmaps(uint id, int width, int height, PixelFormat format, ref int[] mipmaps);
|
public static extern void rlGenTextureMipmaps(uint id, int width, int height, PixelFormat format, ref int[] mipmaps);
|
||||||
|
|
||||||
/// <summary>Read texture pixel data<br/>
|
/// <summary>Read texture pixel data</summary>
|
||||||
/// IntPtr refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr rlReadTexturePixels(uint id, int width, int height, PixelFormat format);
|
public static extern void* rlReadTexturePixels(uint id, int width, int height, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Read screen pixel data (color buffer)<br/>
|
/// <summary>Read screen pixel data (color buffer)</summary>
|
||||||
/// IntPtr refers to a unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr rlReadScreenPixels(int width, int height);
|
public static extern byte* rlReadScreenPixels(int width, int height);
|
||||||
|
|
||||||
|
|
||||||
// Framebuffer management (fbo)
|
// Framebuffer management (fbo)
|
||||||
@@ -584,7 +579,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Set shader value uniform</summary>
|
/// <summary>Set shader value uniform</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetUniform(int locIndex, IntPtr value, int uniformType, int count);
|
public static extern void rlSetUniform(int locIndex, void* value, int uniformType, int count);
|
||||||
|
|
||||||
/// <summary>Set shader value matrix</summary>
|
/// <summary>Set shader value matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -611,7 +606,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Load shader storage buffer object (SSBO)</summary>
|
/// <summary>Load shader storage buffer object (SSBO)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe uint rlLoadShaderBuffer(ulong size, void* data, int usageHint);
|
public static extern uint rlLoadShaderBuffer(ulong size, void* data, int usageHint);
|
||||||
|
|
||||||
/// <summary>Unload shader storage buffer object (SSBO)</summary>
|
/// <summary>Unload shader storage buffer object (SSBO)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -623,11 +618,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Get SSBO buffer size</summary>
|
/// <summary>Get SSBO buffer size</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe ulong rlGetShaderBufferSize(uint id, void* dest, ulong count, ulong offset);
|
public static extern ulong rlGetShaderBufferSize(uint id, void* dest, ulong count, ulong offset);
|
||||||
|
|
||||||
/// <summary>Bind SSBO buffer</summary>
|
/// <summary>Bind SSBO buffer</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern unsafe void rlReadShaderBufferElements(uint id, void* dest, ulong count, ulong offset);
|
public static extern void rlReadShaderBufferElements(uint id, void* dest, ulong count, ulong offset);
|
||||||
|
|
||||||
/// <summary> Copy SSBO buffer data</summary>
|
/// <summary> Copy SSBO buffer data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
Reference in New Issue
Block a user