REVIEWED: skinning shader for GLSL 100 #4412

This commit is contained in:
Ray 2024-10-22 10:41:43 +02:00
parent fe66bfb785
commit b2dca724c7
2 changed files with 27 additions and 21 deletions

View file

@ -1,17 +1,20 @@
#version 100 #version 100
precision mediump float;
// Input vertex attributes (from vertex shader) // Input vertex attributes (from vertex shader)
in vec2 fragTexCoord; varying vec2 fragTexCoord;
in vec4 fragColor; varying vec4 fragColor;
// Output fragment color
out vec4 finalColor;
// Input uniform values
uniform sampler2D texture0; uniform sampler2D texture0;
uniform vec4 colDiffuse; uniform vec4 colDiffuse;
void main() void main()
{ {
// Fetch color from texture sampler
vec4 texelColor = texture(texture0, fragTexCoord); vec4 texelColor = texture(texture0, fragTexCoord);
finalColor = texelColor*colDiffuse*fragColor;
// Calculate final fragment color
gl_FragColor = texelColor*colDiffuse*fragColor;
} }

View file

@ -1,18 +1,21 @@
#version 100 #version 100
in vec3 vertexPosition; #define MAX_BONE_NUM 64
in vec2 vertexTexCoord;
in vec4 vertexColor;
in vec4 vertexBoneIds;
in vec4 vertexBoneWeights;
#define MAX_BONE_NUM 128 // Input vertex attributes
attribute vec3 vertexPosition;
attribute vec2 vertexTexCoord;
attribute vec4 vertexColor;
attribute vec4 vertexBoneIds;
attribute vec4 vertexBoneWeights;
// Input uniform values
uniform mat4 mvp;
uniform mat4 boneMatrices[MAX_BONE_NUM]; uniform mat4 boneMatrices[MAX_BONE_NUM];
uniform mat4 mvp; // Output vertex attributes (to fragment shader)
varying vec2 fragTexCoord;
out vec2 fragTexCoord; varying vec4 fragColor;
out vec4 fragColor;
void main() void main()
{ {