aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2018-05-02 21:39:30 +0100
committerTomasz Kramkowski <tk@the-tk.com>2018-05-02 21:39:30 +0100
commit362f70b04da8f8e9c0c159527bce7da65591c260 (patch)
tree4547bf3ad23c663b4cae20a56560aab235bd03c1
parent0ce30b0e09621694430e3afe25c8209b147064de (diff)
downloadfaqe-362f70b04da8f8e9c0c159527bce7da65591c260.tar.gz
faqe-362f70b04da8f8e9c0c159527bce7da65591c260.tar.xz
faqe-362f70b04da8f8e9c0c159527bce7da65591c260.zip
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.
-rw-r--r--ensize.c4
-rw-r--r--ensize.h4
-rw-r--r--faqe.c2
-rw-r--r--frag.glsl10
-rw-r--r--ieee754.c4
-rw-r--r--ieee754.h4
-rw-r--r--mtl.c4
-rw-r--r--mtl.h4
-rw-r--r--test_ieee754.c4
-rw-r--r--tex.c4
-rw-r--r--vert.glsl10
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 <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
#include <assert.h>
#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 <tk@the-tk.com>
+ * 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 <tk@the-tk.com>
-// SPDX-License-Identifier: MIT
+/*
+ * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
+ * 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 <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
#include <assert.h>
#include <math.h>
#include <stdbool.h>
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 <tk@the-tk.com>
+ * 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 <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
#include <assert.h>
#include <stdio.h>
#include <string.h>
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 <tk@the-tk.com>
+ * 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 <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
#include <math.h>
#include <stdint.h>
#include <stdio.h>
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 <tk@the-tk.com>
+ * SPDX-License-Identifier: MIT
+ */
#include <assert.h>
#include <png.h>
#include <stdlib.h>
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 <tk@the-tk.com>
-// SPDX-License-Identifier: MIT
+/*
+ * Copyright (C) 2018 Tomasz Kramkowski <tk@the-tk.com>
+ * 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));
}