Watch
2
0
Fork
You've already forked raylib-cs
0
Added new extension "byte.Lerp".
Added new extension "Log" for "TraceLogLevel".
Constructors on Color no longer just truncate the float value, but also round it (+ 0.5f).
New static method on Color, "Color.Lerp".
Added static method "FromHSV" to Color.
Added new getter method "GetHSV" on Color.
Added index security on the FilePathList indexer.
Merged Rectangle extensions with the type itself as read-only methods.
Merged Image extensions with the type itself.
Merged Texture2D extensions with the type itself.
New file "Raymath.Utils" with some useful methods taken from Unity.
Added "MoveTowards" extensions to RaylibExtensions.
Added "TranslateLocal" and "TranslateGlobal" to Transform.
Added "Load", "Export", "ExportAsCode", "Format", "Crop", and "Unload" shortcut methods to Wave.
Added "IsValid" property to Wave, Texture2D, Sound, Shader, RenderTexture2D, Music, Image, Model, Material, Font, and AudioStream.
Added "IsPlaying" and "IsProcessed" properties to AudioStream.
Added "Load", "Play", "Stop", "Pause", "Resume", "SetBufferSizeDefault", "SetPan", "SetPitch", "SetVolume", and "Unload" shortcut methods to AudioStream.
Added "Load", "Export", and "Unload" methods to AutomationEventList.
Added "Default" property to Font.
Added "Load", "GetMaterial", "GetTexture", "SetTexture", "SetShader", and "Unload" methods to material.
Added "Draw", "DrawInstanced", "Export", "ExportAsCode", "Upload", and "Unload" methods to Mesh.
Added "Load", "LoadFromMesh", "Unload", and a lot of "Draw" overloads.
Added "Load", "Play", "Pause", "Stop", "SetPan", "SetPitch", "SetVolume", "Seek", and "Unload" methods to Music.
Added "Load" and "Unload" methods to RenderTexture2D.
Added "Load", "LoadFromMemory", "GetLocationAttrib", "SetValue", "SetTexture", "SetMatrix", and "Unload" methods to Shader.
Removed unnecessary "partial" declarations.
This commit is contained in:
Matorio 2025-07-17 03:14:57 -05:00
commit b84a0d4f12
31 changed files with 1090 additions and 395 deletions

View file

@ -76,7 +76,7 @@ public enum ShaderUniformDataType
/// Shader type (generic)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Shader
public unsafe struct Shader
{
/// <summary>
/// Shader program id
@ -87,4 +87,47 @@ public unsafe partial struct Shader
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
/// </summary>
public int* Locs;
public readonly CBool IsValid => Raylib.IsShaderValid(this);
public static Shader Load(string vsFileName, string fsFileName)
{
return Raylib.LoadShader(vsFileName, fsFileName);
}
public static Shader LoadFromMemory(string vsCode, string fsCode)
{
return Raylib.LoadShaderFromMemory(vsCode, fsCode);
}
public void GetLocationAttrib(string attribName)
{
Raylib.GetShaderLocationAttrib(this, attribName);
}
public void SetValue<T>(int locationIndex, T value, ShaderUniformDataType uniformDataType) where T : unmanaged
{
void* val = &value;
Raylib.SetShaderValue(this, locationIndex, val, uniformDataType);
}
public void SetValues<T>(int locationIndex, T[] values, ShaderUniformDataType uniformDataType) where T : unmanaged
{
Raylib.SetShaderValueV(this, locationIndex, values, uniformDataType, values.Length);
}
public void SetTexture(int locationIndex, Texture2D texture)
{
Raylib.SetShaderValueTexture(this, locationIndex, texture);
}
public void SetMatrix(int locationIndex, System.Numerics.Matrix4x4 matrix)
{
Raylib.SetShaderValueMatrix(this, locationIndex, matrix);
}
public void Unload()
{
Raylib.UnloadShader(this);
}
}