relief map support, small refactoring, shadow bias now based on geometry normal

This commit is contained in:
2023-03-02 11:46:52 +03:00
parent adf8c4d7f0
commit 64eee9e607
26 changed files with 465 additions and 174 deletions

View File

@@ -4,13 +4,16 @@ flat out uint object_flags;
out float distance;
out vec4 pos;
const vec3 luma = vec3(0.299, 0.587, 0.114);
void main(void) {
object_flags = qgl_ObjectFlags;
if (bitfieldExtract(object_flags, 2, 1) == 0)
return;
qgl_MaterialIndex = qgl_Material;
qgl_FragTexture = qgl_getFragTexture();
pos = qgl_ftransform();
float height = dot(qgl_materialTexture(QGL_MAP_RELIEF, qgl_FragTexture, vec4(0.)).rgb, luma);
pos = qgl_ViewProjMatrix * (qgl_ModelMatrix * (vec4(qgl_Vertex + qgl_Normal * height, 1.)));//qgl_ftransform();
gl_Position = pos;
}