cleaned up particlefire example

really dug into example to learn and just _leaving the example better then I found it_ but cleaning up some unused values and swizzle redudency in shaders. Tested on desktop and android
This commit is contained in:
sjfricke 2018-05-06 23:27:41 -05:00
parent 6e28986d5d
commit 7e15234145
7 changed files with 15 additions and 21 deletions

View file

@ -15,20 +15,18 @@ layout (binding = 0) uniform UBO
mat4 model;
mat4 normal;
vec4 lightPos;
vec4 cameraPos;
} ubo;
out gl_PerVertex
{
vec4 gl_Position;
float gl_PointSize;
};
layout (location = 0) out vec2 outUV;
layout (location = 1) out vec3 outLightVec;
layout (location = 2) out vec3 outLightVecB;
layout (location = 5) out vec3 outLightDir;
layout (location = 6) out vec3 outViewVec;
layout (location = 3) out vec3 outLightDir;
layout (location = 4) out vec3 outViewVec;
void main(void)
{
@ -42,18 +40,18 @@ void main(void)
tbnMatrix[1] = mat3(ubo.normal) * inBiTangent;
tbnMatrix[2] = mat3(ubo.normal) * inNormal;
outLightVec.xyz = vec3(ubo.lightPos.xyz - vertexPosition.xyz) * tbnMatrix;
outLightVec.xyz = vec3(ubo.lightPos.xyz - vertexPosition) * tbnMatrix;
vec3 lightDist = ubo.lightPos.xyz - inPos.xyz;
outLightVecB.x = dot(inTangent.xyz, lightDist);
outLightVecB.y = dot(inBiTangent.xyz, lightDist);
vec3 lightDist = ubo.lightPos.xyz - inPos;
outLightVecB.x = dot(inTangent, lightDist);
outLightVecB.y = dot(inBiTangent, lightDist);
outLightVecB.z = dot(inNormal, lightDist);
outViewVec.x = dot(inTangent, inPos.xyz);
outViewVec.y = dot(inBiTangent, inPos.xyz);
outViewVec.z = dot(inNormal, inPos.xyz);
outViewVec.x = dot(inTangent, inPos);
outViewVec.y = dot(inBiTangent, inPos);
outViewVec.z = dot(inNormal, inPos);
outUV = inUV;
gl_Position = ubo.projection * ubo.model * vec4(inPos, 1.0);
}
}