From 6d3e7ab7e7c2c1ae3132cc4b802353db40086080 Mon Sep 17 00:00:00 2001
From: Vincent Tavernier <vincent.tavernier@inria.fr>
Date: Thu, 12 Oct 2017 15:01:44 +0200
Subject: [PATCH] Fix support for iGlobalTime

---
 examples/50-shadertoy/main.cpp | 7 +------
 shaders/wrapper_header.fsh     | 2 ++
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/examples/50-shadertoy/main.cpp b/examples/50-shadertoy/main.cpp
index 76ddb23..5e47ae2 100644
--- a/examples/50-shadertoy/main.cpp
+++ b/examples/50-shadertoy/main.cpp
@@ -1,7 +1,6 @@
 #include <iostream>
 #include <string>
 #include <sstream>
-#include <regex>
 
 #include <curl/curl.h>
 #include <json/json.h>
@@ -161,8 +160,6 @@ int loadRemote(const string &shaderId, const string &shaderApiKey,
 		dump.close();
 
 		// Create buffer configs for each render pass
-		regex rxiGlobalTime("\\biGlobalTime\\b");
-
 		for (int i = 0; i < shaderSpec["Shader"]["renderpass"].size(); ++i)
 		{
 			auto &pass(shaderSpec["Shader"]["renderpass"][i]);
@@ -188,9 +185,7 @@ int loadRemote(const string &shaderId, const string &shaderApiKey,
 			if (!fs::exists(p))
 			{
 				ofstream ofs(p.string());
-				ofs << regex_replace(pass["code"].asString(),
-									 rxiGlobalTime,
-									 "iTime");
+				ofs << pass["code"].asString();
 				ofs.close();
 			}
 
diff --git a/shaders/wrapper_header.fsh b/shaders/wrapper_header.fsh
index 20d8e53..1f0f2a6 100644
--- a/shaders/wrapper_header.fsh
+++ b/shaders/wrapper_header.fsh
@@ -8,3 +8,5 @@ precision highp sampler2D;
 in vec2 vtexCoord;
 // Output fragment color
 out vec4 fragColor;
+// Compatibility with legacy iGlobalTime
+#define iGlobalTime iTime
-- 
GitLab