Pack shape normals into a word8
This commit is contained in:
@@ -9,5 +9,6 @@ void main()
|
||||
{
|
||||
fCol = vCol;
|
||||
fPos = vPos;
|
||||
fNorm = vec4(vNorm.xyz - vPos.xyz,1);
|
||||
//fNorm = vec4(vNorm.xyz - vPos.xyz,1);
|
||||
fNorm = vNorm ;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#version 450 core
|
||||
struct PosColNorm { vec4 pos; uint col; vec4 norm; };
|
||||
//struct PosColNorm { vec4 pos; vec4 norm;uint col; uint dummy; };
|
||||
struct PosColNorm { vec4 pos; uint norm;uint d1;uint d2; uint d3;uint col; uint dummy; };
|
||||
// I don't know if the dummy is necessary
|
||||
layout (std140, binding = 0) uniform TheMat { mat4 theMat; } ;
|
||||
layout (std430, binding = 3) readonly buffer Data { PosColNorm data[]; };
|
||||
layout (std430, binding = 4) readonly buffer Indices { uint indices[]; };
|
||||
@@ -9,7 +11,8 @@ out vec4 vNorm;
|
||||
void main() {
|
||||
vPos = data[indices[gl_VertexID]].pos;
|
||||
vCol = unpackUnorm4x8(data[indices[gl_VertexID]].col);
|
||||
vNorm = data[indices[gl_VertexID]].norm;
|
||||
vec4 n = unpackUnorm4x8(data[indices[gl_VertexID]].norm);
|
||||
vNorm = n *2 - vec4(1,1,1,1);
|
||||
gl_Position = theMat * vec4(vPos.xyz,1);
|
||||
}
|
||||
//layout (location = 0) in vec4 pos;
|
||||
|
||||
Reference in New Issue
Block a user