* Updated target to Raylib 6 + synced invoke called with the changes in C. [WARNING: Breaking changes!] * Added severial examples. Corrected towards the correct return type and add utilities to prevent working with pointers * Additional resources from the Raylib repo. * Fixed additional pinvokes to match with the new raylib bindings. [Warning breaking changes!] * Fixing the QOL utils * Fixing the Mesh struct * Applying changes after review. Merged resources.LICENSE + raylib-cs.Native.csproj only targets dotnet8 * Updated README to reflect .NET 10 and Raylib 6 compatibility changes. * Updated shader colors, adjusted car model scale, disabled HDR in SkyboxDemo, and fixed camera mode assignment. Removed unused `Capacity` field in FilePathList struct. * Improved XML comments for consistency, fixed spacing and formatting across examples, added new resources to `resources.LICENSE`. * Updated XML comment for `GetDirectoryFileCountEx` to clarify behavior and filtering options. * Updated and clarified XML comments for methods and parameters, improved naming consistency, and refined shader-related functions. Renamed enums in `Shader.cs` for so it is inline with the upstream. * Improved XML comments for clarity and consistency in `Model.cs` and `Mesh.cs`, updated method and variable names for better readability, and adjusted logic in span creation methods. * Corrected XML comment capitalization in `Model.cs`. --------- Co-authored-by: Meatcorps <info@meatcorps.nl>
48 lines
1.4 KiB
GLSL
48 lines
1.4 KiB
GLSL
#version 330
|
|
|
|
// Input vertex attributes
|
|
in vec3 vertexPosition;
|
|
in vec2 vertexTexCoord;
|
|
in vec3 vertexNormal;
|
|
in vec4 vertexTangent;
|
|
in vec4 vertexColor;
|
|
|
|
// Input uniform values
|
|
uniform mat4 mvp;
|
|
uniform mat4 matModel;
|
|
|
|
// Output vertex attributes (to fragment shader)
|
|
out vec3 fragPosition;
|
|
out vec2 fragTexCoord;
|
|
out vec3 fragNormal; //used for when normal mapping is toggled off
|
|
out vec4 fragColor;
|
|
out mat3 TBN;
|
|
|
|
void main()
|
|
{
|
|
// Compute binormal from vertex normal and tangent. W component is the tangent handedness
|
|
vec3 vertexBinormal = cross(vertexNormal, vertexTangent.xyz)*vertexTangent.w;
|
|
|
|
// Compute fragment normal based on normal transformations
|
|
mat3 normalMatrix = transpose(inverse(mat3(matModel)));
|
|
|
|
// Compute fragment position based on model transformations
|
|
fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
|
|
|
|
//Create TBN matrix for transforming the normal map values from tangent-space to world-space
|
|
fragNormal = normalize(normalMatrix*vertexNormal);
|
|
|
|
vec3 fragTangent = normalize(normalMatrix*vertexTangent.xyz);
|
|
fragTangent = normalize(fragTangent - dot(fragTangent, fragNormal)*fragNormal);
|
|
|
|
vec3 fragBinormal = normalize(normalMatrix*vertexBinormal);
|
|
fragBinormal = cross(fragNormal, fragTangent);
|
|
|
|
TBN = transpose(mat3(fragTangent, fragBinormal, fragNormal));
|
|
|
|
fragColor = vertexColor;
|
|
|
|
fragTexCoord = vertexTexCoord;
|
|
|
|
gl_Position = mvp*vec4(vertexPosition, 1.0);
|
|
}
|