mirror of https://github.com/bjornbytes/lovr.git
Animate normals; Use material color;
This commit is contained in:
parent
d088c5471d
commit
0d23d10e43
|
@ -47,4 +47,10 @@ void main() {
|
|||
vertexOut[vertexIndex].x = skinned.x;
|
||||
vertexOut[vertexIndex].y = skinned.y;
|
||||
vertexOut[vertexIndex].z = skinned.z;
|
||||
|
||||
vec3 normal = vec3(vertexIn[vertexIndex].nx, vertexIn[vertexIndex].ny, vertexIn[vertexIndex].nz);
|
||||
vec3 skinnedNormal = mat3(matrix) * normal;
|
||||
vertexOut[vertexIndex].nx = skinnedNormal.x;
|
||||
vertexOut[vertexIndex].ny = skinnedNormal.y;
|
||||
vertexOut[vertexIndex].nz = skinnedNormal.z;
|
||||
}
|
||||
|
|
|
@ -108,5 +108,5 @@ layout(location = 11) in vec2 FragUV;
|
|||
#define WorldFromLocal (Transform)
|
||||
|
||||
#define DefaultPosition (ClipFromLocal * VertexPosition)
|
||||
#define DefaultColor (FragColor)
|
||||
#define DefaultColor (FragColor * texture(sampler2D(Texture, Sampler), FragUV) * Material.color)
|
||||
#endif
|
||||
|
|
|
@ -5,5 +5,5 @@
|
|||
#include "lovr.glsl"
|
||||
|
||||
void main() {
|
||||
PixelColors[0] = FragColor * texture(sampler2D(Texture, Sampler), FragUV);
|
||||
PixelColors[0] = FragColor * texture(sampler2D(Texture, Sampler), FragUV) * Material.color;
|
||||
}
|
||||
|
|
|
@ -4213,7 +4213,7 @@ static void renderNode(Pass* pass, Model* model, uint32_t index, bool recurse, u
|
|||
|
||||
for (uint32_t i = 0; i < node->primitiveCount; i++) {
|
||||
Draw draw = model->draws[node->primitiveIndex + i];
|
||||
draw.transform = globalTransform;
|
||||
if (node->skin == ~0u) draw.transform = globalTransform;
|
||||
draw.instances = instances;
|
||||
lovrPassDraw(pass, &draw);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue