34 lines
946 B
Lua
34 lines
946 B
Lua
return {
|
|
create = function(api)
|
|
lovr.shader = {}
|
|
lovr.shader.pbr = lovr.graphics.newShader([[
|
|
vec4 lovrmain() {
|
|
return DefaultPosition;
|
|
}
|
|
]], [[
|
|
uniform textureCube cubemap;
|
|
uniform sphericalHarmonics { vec3 sh[9]; };
|
|
|
|
vec4 lovrmain() {
|
|
Surface surface;
|
|
initSurface(surface);
|
|
|
|
vec3 color = vec3(0);
|
|
vec3 lightDirection = vec3(-1, -1, -1);
|
|
vec4 lightColorAndBrightness = vec4(1, 1, 1, 3);
|
|
float visibility = 1.;
|
|
color += getLighting(surface, lightDirection, lightColorAndBrightness, visibility);
|
|
color += getIndirectLighting(surface, cubemap, sh);
|
|
|
|
return vec4(color, 1);
|
|
}
|
|
]], {
|
|
flags = {
|
|
glow = true,
|
|
normalMap = true,
|
|
vertexTangents = false, -- DamagedHelmet doesn't have vertex tangents
|
|
tonemap = true
|
|
}
|
|
})
|
|
end
|
|
}
|