From 362f70b04da8f8e9c0c159527bce7da65591c260 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Wed, 2 May 2018 21:39:30 +0100 Subject: Cleanup: License headers, spacing, naming Rename vnorm to fnorm (fragment normal). Change shader license headers to C++ style comments. Fix spacing for PI define in faqe.c. Add missing license headers. --- ensize.c | 4 ++++ ensize.h | 4 ++++ faqe.c | 2 +- frag.glsl | 10 ++++++---- ieee754.c | 4 ++++ ieee754.h | 4 ++++ mtl.c | 4 ++++ mtl.h | 4 ++++ test_ieee754.c | 4 ++++ tex.c | 4 ++++ vert.glsl | 10 ++++++---- 11 files changed, 45 insertions(+), 9 deletions(-) diff --git a/ensize.c b/ensize.c index 82835a7..7bcf496 100644 --- a/ensize.c +++ b/ensize.c @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #include #include "ensize.h" diff --git a/ensize.h b/ensize.h index 6837294..cde84a4 100644 --- a/ensize.h +++ b/ensize.h @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #ifndef ENSIZE_H #define ENSIZE_H diff --git a/faqe.c b/faqe.c index c13b4dc..1983464 100644 --- a/faqe.c +++ b/faqe.c @@ -18,7 +18,7 @@ enum { HEIGHT = 600, }; -# define PI 3.14159265358979323846 +#define PI 3.14159265358979323846 #define FOV (PI * 0.5) void viewport(GLuint proj, int width, int height) diff --git a/frag.glsl b/frag.glsl index 5aa26d8..ff88e1f 100644 --- a/frag.glsl +++ b/frag.glsl @@ -1,8 +1,10 @@ -// Copyright (C) 2018 Tomasz Kramkowski -// SPDX-License-Identifier: MIT +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #version 330 core out vec4 color; -in vec3 vnorm; +in vec3 fnorm; in vec3 fpos; in vec2 fuv; in vec3 lipos; @@ -16,7 +18,7 @@ void main() float amb = 0.1; - vec3 norm = normalize(vnorm); + vec3 norm = normalize(fnorm); vec3 lidir = normalize(lipos - fpos); float dif = max(dot(norm, lidir), 0.0); diff --git a/ieee754.c b/ieee754.c index 3b21351..7995bd8 100644 --- a/ieee754.c +++ b/ieee754.c @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #include #include #include diff --git a/ieee754.h b/ieee754.h index 58f886d..368c2d2 100644 --- a/ieee754.h +++ b/ieee754.h @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #ifndef IEEE754_H #define IEEE754_H diff --git a/mtl.c b/mtl.c index 7f53fa2..42e5de2 100644 --- a/mtl.c +++ b/mtl.c @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #include #include #include diff --git a/mtl.h b/mtl.h index 7c427c1..00a1b70 100644 --- a/mtl.h +++ b/mtl.h @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #ifndef MTL_H #define MTL_H diff --git a/test_ieee754.c b/test_ieee754.c index 44873c9..85a1c95 100644 --- a/test_ieee754.c +++ b/test_ieee754.c @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #include #include #include diff --git a/tex.c b/tex.c index 6f27b8a..81e6d05 100644 --- a/tex.c +++ b/tex.c @@ -1,3 +1,7 @@ +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #include #include #include diff --git a/vert.glsl b/vert.glsl index 906408e..9fea064 100644 --- a/vert.glsl +++ b/vert.glsl @@ -1,11 +1,13 @@ -// Copyright (C) 2018 Tomasz Kramkowski -// SPDX-License-Identifier: MIT +/* + * Copyright (C) 2018 Tomasz Kramkowski + * SPDX-License-Identifier: MIT + */ #version 330 core layout (location = 0) in vec3 pos; layout (location = 1) in vec3 norm; layout (location = 2) in vec2 uv; -out vec3 vnorm; +out vec3 fnorm; out vec3 fpos; out vec2 fuv; out vec3 lipos; @@ -22,6 +24,6 @@ void main() fpos = vec3(view * model * vec4(pos, 1.0)); fuv = uv; // TODO: Try to work out how to only do this ONCE in C or see if it matters - vnorm = mat3(transpose(inverse(view * model))) * norm; + fnorm = mat3(transpose(inverse(view * model))) * norm; lipos = vec3(view * vec4(light, 1.0)); } -- cgit v1.2.3-54-g00ecf