shithub: tinygl

Download patch

ref: 7d2f0e1dc929a0bb7dc086e63171210a9208cbea
parent: 47f57bd42b9d8eb3ee5d9b34c4221c61cc161395
author: MHS <gek@katherine>
date: Mon Mar 15 20:45:22 EDT 2021

Automatic commit.

--- a/README.md
+++ b/README.md
@@ -35,6 +35,9 @@
 TinyGL is written in pure C99, and requires very few functions from the C standard library, it doesn't even require malloc and free
 (The calls are aliased to gl_malloc() and gl_free(), which you can replace with your own memory management model if you desire)
 
+Important: TinyGL still compiles under bellard's Tiny C Compiler. The demos cannot be compiled with TCC
+due to issues with getting SDL to work with tcc, but gcc can link to TinyGL built with tiny C. Try it!
+
 You can test compiling TinyGL and running it on platforms without SDL by running the RAW DEMOS, which do not require ANYTHING
 Except the C standard library and stdio. You may have to change the destination written to by the raw demos on platforms
 without standard file systems.
--- a/include/zfeatures.h
+++ b/include/zfeatures.h
@@ -74,6 +74,14 @@
 //Enable stdalign
 #define TGL_FEATURE_ALIGNAS 1
 
+
+//Disable it for TinyC
+#ifdef __TINYC__
+#undef TGL_FEATURE_ALIGNAS
+#define TGL_FEATURE_ALIGNAS 0
+#endif
+
+
 #if TGL_FEATURE_ALIGNAS == 1
 #include <stdalign.h>
 #define TGL_ALIGN alignas(16)
--- a/src/zmath.h
+++ b/src/zmath.h
@@ -76,7 +76,7 @@
 	return conv.f;
 }*/
 //Defined behavior fastinvsqrt
-inline GLfloat fastInvSqrt(GLfloat x){
+static inline GLfloat fastInvSqrt(GLfloat x){
 	GLint i; 
 	GLfloat x2;
 	memcpy(&i, &x, 4);
@@ -88,7 +88,7 @@
 #endif
 
 
-inline int gl_V3_Norm_Fast(V3* a) {
+static inline int gl_V3_Norm_Fast(V3* a) {
 	GLfloat n;
 #if TGL_FEATURE_FISR == 1
 	n = fastInvSqrt(a->X * a->X + a->Y * a->Y + a->Z * a->Z); //FISR