sketchpunk / FunWithWebGL2

Fun with WebGL 2.0 Youtube Tutorial Series
666 stars 141 forks source link

lesson_033 fix for non-windows users #20

Open Philius opened 3 years ago

Philius commented 3 years ago

Here's the patch

From 3f43ae33ab0e000d2d6937ffefae27104110f69a Mon Sep 17 00:00:00 2001
From: Philip Ashmore <contact@philipashmore.com>
Date: Wed, 13 Jan 2021 12:45:53 +0000
Subject: [PATCH] Fixed lesson_033 for non Windows users

---
 lesson_033/fungi.core.js | 6 ++----
 lesson_033/test.html     | 2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/lesson_033/fungi.core.js b/lesson_033/fungi.core.js
index cc38c8c..0996c54 100644
--- a/lesson_033/fungi.core.js
+++ b/lesson_033/fungi.core.js
@@ -1775,10 +1775,8 @@ var Fungi = (function(){
            }

            //Check if the final offset is divisiable by 16, if not add remaining chunk space to last element.
-           //if(offset % 16 != 0){
-               //ary[ary.length-1].chunkLen += 16 - offset % 16;
-               //offset += 16 - offset % 16;
-           //}
+           let padding = offset % 16;
+           if( padding != 0) offset += 16 - padding;

            //console.log("UBO Buffer Size ",offset);
            return offset;
diff --git a/lesson_033/test.html b/lesson_033/test.html
index 6479b8a..5ac3fdf 100644
--- a/lesson_033/test.html
+++ b/lesson_033/test.html
@@ -12,7 +12,7 @@
        <script src="fungi.core.js"></script>
        <script src="fungi.primatives.js"></script>
        <script src="fungi.KBMCtrl.js"></script>
-       <script src="fungi.Debug.js"></script>
+       <script src="fungi.debug.js"></script>
        <script src="fungi.ext.js"></script>
        <script src="fungiApp.js"></script>

-- 
2.29.2