Browse Source

emulate round function for webgl1 compatibility

Alexander Rose 3 years ago
parent
commit
f266dfadc6
1 changed files with 4 additions and 0 deletions
  1. 4 0
      src/mol-gl/shader/chunks/common.glsl.ts

+ 4 - 0
src/mol-gl/shader/chunks/common.glsl.ts

@@ -25,6 +25,10 @@ export const common = `
 
 #define saturate(a) clamp(a, 0.0, 1.0)
 
+#if __VERSION__ == 100
+    #define round(x) floor((x) + 0.5)
+#endif
+
 float intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }
 vec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }
 float intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }