Load lights from model
authorLuke Lau <luke_lau@icloud.com>
Wed, 12 Feb 2020 01:10:47 +0000 (01:10 +0000)
committerLuke Lau <luke_lau@icloud.com>
Wed, 12 Feb 2020 01:10:47 +0000 (01:10 +0000)
main.cpp
models/ik.blend
models/newtonsCradle.blend
models/newtonsCradle.glb
models/newtonsCradle.gltf [deleted file]
models/vaporwave.glb [new file with mode: 0644]
pbrfrag.glsl

index 15599b078cd64aa72465777a7dbf71659fb84005..281da276905660e1e4a5935c1caf961f9c53d97f 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -41,17 +41,11 @@ float fov = glm::radians(30.f), znear = 0.01f, zfar = 10000.f;
 float yaw = 1.57, pitch = 0;
 
 struct Light {
-       glm::vec3 pos;
+       glm::mat4 trans;
        glm::vec3 color;
 };
 
-std::vector<Light> lights = {
-       { glm::vec3(5, 2, -5), glm::vec3(1) },
-       { glm::vec3(0, 2, -5), glm::vec3(1) },
-       { glm::vec3(-5, 2, -5), glm::vec3(1) },
-};
-
-int activeLight = 0;
+std::vector<Light> lights;
 
 bool discoLights = false;
 
@@ -97,8 +91,7 @@ void drawLight(Light &light) {
        glUseProgram(plainProg->progId);
        glBindVertexArray(lightVao);
        setProjectionAndViewUniforms(plainProg->progId);
-       glm::mat4 model = glm::translate(glm::mat4(1.f), light.pos);
-       model = glm::scale(model, glm::vec3(0.2));
+       glm::mat4 model = glm::scale(light.trans, glm::vec3(0.2));
        GLuint modelLoc = glGetUniformLocation(plainProg->progId, "model");
        glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
 
@@ -122,31 +115,30 @@ void display() {
        glUseProgram(pbrProg->progId);
        setProjectionAndViewUniforms(pbrProg->progId);
 
-       glm::vec3 lightPositions[6], lightColors[6];
-       for (int i = 0; i < 3; i++) {
-               lightPositions[i] = lights[i].pos;
+       size_t numLights = lights.size() + (discoLights ? 3 : 0);
+       glm::vec3 lightPositions[numLights], lightColors[numLights];
+       for (int i = 0; i < lights.size(); i++) {
+               lightPositions[i] = glm::vec3(lights[i].trans[3]);
                lightColors[i] = lights[i].color;
        }
 
-       for (int i = 3; i < 6; i++) {
        if (discoLights) {
+               for (int i = numLights - 3; i < numLights; i++) {
                        auto m = glm::translate(glm::mat4(1.f), glm::vec3(-2.5, 0, 0));
                        m = glm::rotate(m, glm::radians(d * 100 + i * 30), glm::vec3(1, 0, 0));
                        m = glm::rotate(m, glm::radians(d * 100 + i * 30), glm::vec3(0, 1, 0));
                        m = glm::rotate(m, glm::radians(d * 100 + i * 30), glm::vec3(0, 0, 1));
                        lightPositions[i] = glm::vec3(m * glm::vec4(5, 0, 0, 1));
                        lightColors[i] = glm::vec3(0.2);
-                       if (i == 3) lightColors[i].x = sin(d);
-                       if (i == 4) lightColors[i].y = cos(d * 3);
-                       if (i == 5) lightColors[i].z = cos(d);
-               } else {
-                       lightPositions[i] = glm::vec3(0);
-                       lightColors[i] = glm::vec3(0);
+                       if (i % 3 == 0) lightColors[i].x = sin(d);
+                       if (i % 3 == 1) lightColors[i].y = cos(d * 3);
+                       if (i % 3 == 2) lightColors[i].z = cos(d);
                }
        }
        
-       glUniform3fv(glGetUniformLocation(pbrProg->progId, "lightPositions"), 6, glm::value_ptr(lightPositions[0]));
-       glUniform3fv(glGetUniformLocation(pbrProg->progId, "lightColors"), 6, glm::value_ptr(lightColors[0]));
+       glUniform1ui(glGetUniformLocation(pbrProg->progId, "numLights"), numLights);
+       glUniform3fv(glGetUniformLocation(pbrProg->progId, "lightPositions"), numLights, glm::value_ptr(lightPositions[0]));
+       glUniform3fv(glGetUniformLocation(pbrProg->progId, "lightColors"), numLights, glm::value_ptr(lightColors[0]));
 
        /* sceneModel->find("Top Bone")->transform = glm::rotate(glm::mat4(1), d / 5.f, { 1, 0, 0}); */
        /* sceneModel->find("Bottom Bone")->transform = glm::rotate(glm::mat4(1), d / 3.f, { 1, 0, 0}); */
@@ -154,12 +146,13 @@ void display() {
 
        for (Light &light: lights) drawLight(light);
 
-       if (discoLights) {
-               for (int i = 3; i < 6; i++) {
-                       Light l { lightPositions[i], lightColors[i] };
-                       drawLight(l);
-               }
-       }
+       // TODO: restore
+       /* if (discoLights) { */
+       /*      for (int i = numLights - 3; i < numLights; i++) { */
+       /*              Light l = { lightPositions[i], lightColors[i] }; */
+       /*              drawLight(l); */
+       /*      } */
+       /* } */
 
        skyboxes[activeSkybox].draw(projMat(), viewMat());
 
@@ -205,6 +198,7 @@ void init() {
        setupLightBuffers(plainProg->progId);
        plainProg->validate();
 
+       skyboxes.push_back(Skybox(Image("skyboxes/loft/Newport_Loft_Ref.hdr")));
        skyboxes.push_back(Skybox(Image("skyboxes/wooden_lounge_8k.hdr")));
        skyboxes.push_back(Skybox(Image("skyboxes/machine_shop_02_8k.hdr")));
        skyboxes.push_back(Skybox(Image("skyboxes/pink_sunrise_8k.hdr")));
@@ -212,7 +206,7 @@ void init() {
        pbrProg = new Program("pbrvert.glsl", "pbrfrag.glsl");
        glUseProgram(pbrProg->progId);
 
-       const std::string scenePath = "models/ik.glb";
+       const std::string scenePath = "models/newtonsCradle.glb";
        const aiScene *scene = importer.ReadFile(scenePath, aiProcess_Triangulate | aiProcess_CalcTangentSpace | aiProcess_GenNormals | aiProcess_FlipUVs);
        if (!scene) {
                std::cerr << importer.GetErrorString() << std::endl;
@@ -220,7 +214,7 @@ void init() {
        }
 
        if (scene->mNumCameras > 0) {
-               struct aiCamera *cam = scene->mCameras[0];
+               aiCamera *cam = scene->mCameras[0];
                glm::mat4 camTrans;
                if (findNodeTrans(scene->mRootNode, cam->mName, &camTrans) != 0)
                        abort(); // there must be a node with the same name as camera
@@ -238,6 +232,14 @@ void init() {
                zfar = cam->mClipPlaneFar;
        }
 
+       for (int i = 0; i < scene->mNumLights; i++) {
+               aiLight *light = scene->mLights[i];
+               glm::mat4 trans; findNodeTrans(scene->mRootNode, light->mName, &trans);
+               glm::vec3 col = { light->mColorAmbient.r, light->mColorAmbient.g, light->mColorAmbient.b };
+               Light l = { trans, col };
+               lights.push_back(l);
+       }
+
        sceneModel = new Model(scene, *pbrProg);
 
        glEnable(GL_DEPTH_TEST); 
@@ -254,8 +256,6 @@ void keyboard(unsigned char key, int x, int y) {
        keyStates[key] = true;
        if (key == 'z')
                activeSkybox = (activeSkybox + 1) % skyboxes.size();
-       if (key == 'x')
-               activeLight = (activeLight + 1) % lights.size();
        if (key == 'c')
                discoLights = !discoLights;
 }
@@ -282,13 +282,6 @@ void timer(int _) {
        if (keyStates['e'])
                ySpeed = -0.1f;
 
-       if (keyStates['j']) lights[activeLight].pos.z += 0.1f;
-       if (keyStates['k']) lights[activeLight].pos.z -= 0.1f;
-       if (keyStates['h']) lights[activeLight].pos.x -= 0.1f;
-       if (keyStates['l']) lights[activeLight].pos.x += 0.1f;
-       if (keyStates['m']) lights[activeLight].pos.y -= 0.1f;
-       if (keyStates['n']) lights[activeLight].pos.y += 0.1f;
-
        camPos.x += xSpeed * sin(yaw) + zSpeed * cos(yaw);
        camPos.y += ySpeed;
        camPos.z += zSpeed * sin(yaw) - xSpeed * cos(yaw);
index 9aad7693b19481bd1003774d4e655c95839bc939..247fb50259ee67006f4d20757f66aa37d1cb250a 100644 (file)
Binary files a/models/ik.blend and b/models/ik.blend differ
index 199e11edf8aac50fa6188a7c1541b678f6a0eaae..73ca6f8d77d8319eade764c635939b50056e55ca 100644 (file)
Binary files a/models/newtonsCradle.blend and b/models/newtonsCradle.blend differ
index 0f1cf6b2c5a5166db7eba5bfabee0f717dd4a732..bd885bf745ec9fa2f2b38550138665c88740f437 100644 (file)
Binary files a/models/newtonsCradle.glb and b/models/newtonsCradle.glb differ
diff --git a/models/newtonsCradle.gltf b/models/newtonsCradle.gltf
deleted file mode 100644 (file)
index cd59b4f..0000000
+++ /dev/null
@@ -1,2005 +0,0 @@
-{
-    "accessors" : [
-        {
-            "bufferView" : 0,
-            "componentType" : 5123,
-            "count" : 11292,
-            "max" : [
-                5685
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 1,
-            "componentType" : 5126,
-            "count" : 5686,
-            "max" : [
-                5.326185703277588,
-                4.669686794281006,
-                2.0999999046325684
-            ],
-            "min" : [
-                -5.326185703277588,
-                0.036959342658519745,
-                -2.0999999046325684
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 2,
-            "componentType" : 5126,
-            "count" : 5686,
-            "max" : [
-                0.999969482421875,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -0.999969482421875,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 3,
-            "componentType" : 5126,
-            "count" : 5686,
-            "max" : [
-                1.0,
-                1.0
-            ],
-            "min" : [
-                0.0,
-                0.0
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 4,
-            "componentType" : 5123,
-            "count" : 100623,
-            "max" : [
-                28959
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 5,
-            "componentType" : 5126,
-            "count" : 28960,
-            "max" : [
-                12.520315170288086,
-                18.77880096435547,
-                130.2689666748047
-            ],
-            "min" : [
-                -19.99312400817871,
-                -47.20871353149414,
-                -25.837120056152344
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 6,
-            "componentType" : 5126,
-            "count" : 28960,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 7,
-            "componentType" : 5126,
-            "count" : 28960,
-            "max" : [
-                1.0,
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 8,
-            "componentType" : 5126,
-            "count" : 28960,
-            "max" : [
-                1.997664213180542,
-                0.994655984453857
-            ],
-            "min" : [
-                0.005034558475017548,
-                0.0031570792198181152
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 9,
-            "componentType" : 5123,
-            "count" : 11904,
-            "max" : [
-                2142
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 10,
-            "componentType" : 5126,
-            "count" : 2143,
-            "max" : [
-                1.0000005960464478,
-                1.0,
-                1.000001072883606
-            ],
-            "min" : [
-                -1.000000238418579,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 11,
-            "componentType" : 5126,
-            "count" : 2143,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 12,
-            "componentType" : 5126,
-            "count" : 2143,
-            "max" : [
-                1.0,
-                0.02454703114926815,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -0.02454708144068718,
-                -1.0,
-                1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 13,
-            "componentType" : 5126,
-            "count" : 2143,
-            "max" : [
-                1.0000011920928955,
-                1.0
-            ],
-            "min" : [
-                0.0,
-                0.0
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 14,
-            "componentType" : 5123,
-            "count" : 118800,
-            "max" : [
-                19999
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 15,
-            "componentType" : 5126,
-            "count" : 20000,
-            "max" : [
-                1.0000005960464478,
-                1.0,
-                1.0000009536743164
-            ],
-            "min" : [
-                -0.9999977946281433,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 16,
-            "componentType" : 5126,
-            "count" : 20000,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -0.999969482421875
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 17,
-            "componentType" : 5126,
-            "count" : 20000,
-            "max" : [
-                0.9809380769729614,
-                0.3905962109565735,
-                0.9425740242004395,
-                1.0
-            ],
-            "min" : [
-                -0.980937659740448,
-                -0.3905961215496063,
-                -0.9425736665725708,
-                1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 18,
-            "componentType" : 5126,
-            "count" : 20000,
-            "max" : [
-                1.3736257553100586,
-                0.9968895316123962
-            ],
-            "min" : [
-                3.013014793395996e-05,
-                0.0031104683876037598
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 19,
-            "componentType" : 5123,
-            "count" : 118800,
-            "max" : [
-                20387
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 20,
-            "componentType" : 5126,
-            "count" : 20388,
-            "max" : [
-                0.9999737739562988,
-                0.999972939491272,
-                1.0000009536743164
-            ],
-            "min" : [
-                -0.999971866607666,
-                -0.9999724626541138,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 21,
-            "componentType" : 5126,
-            "count" : 20388,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -0.999969482421875
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 22,
-            "componentType" : 5126,
-            "count" : 20388,
-            "max" : [
-                1.0,
-                0.007871577516198158,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -0.007871707901358604,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 23,
-            "componentType" : 5126,
-            "count" : 20388,
-            "max" : [
-                3.3800158500671387,
-                1.5
-            ],
-            "min" : [
-                -2.0200209617614746,
-                -0.5
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 24,
-            "componentType" : 5123,
-            "count" : 20388,
-            "max" : [
-                1,
-                0,
-                0,
-                0
-            ],
-            "min" : [
-                1,
-                0,
-                0,
-                0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 25,
-            "componentType" : 5126,
-            "count" : 20388,
-            "max" : [
-                1.0000008344650269,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "min" : [
-                0.9999811053276062,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 26,
-            "componentType" : 5123,
-            "count" : 2256,
-            "max" : [
-                1151
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 27,
-            "componentType" : 5126,
-            "count" : 1152,
-            "max" : [
-                4.0398759841918945,
-                4.559506893157959,
-                2.0049562454223633
-            ],
-            "min" : [
-                -4.0398759841918945,
-                2.7928314208984375,
-                -2.0049562454223633
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 28,
-            "componentType" : 5126,
-            "count" : 1152,
-            "max" : [
-                0.9970701932907104,
-                0.9795526266098022,
-                0.999755859375
-            ],
-            "min" : [
-                -0.9970701932907104,
-                -0.9920957088470459,
-                -0.999755859375
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 29,
-            "componentType" : 5126,
-            "count" : 1152,
-            "max" : [
-                3.0,
-                3.0
-            ],
-            "min" : [
-                -2.0,
-                -2.0
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 30,
-            "componentType" : 5123,
-            "count" : 1152,
-            "max" : [
-                2,
-                0,
-                0,
-                0
-            ],
-            "min" : [
-                0,
-                0,
-                0,
-                0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 31,
-            "componentType" : 5126,
-            "count" : 1152,
-            "max" : [
-                1.0,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "min" : [
-                0.0,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 32,
-            "componentType" : 5123,
-            "count" : 29400,
-            "max" : [
-                5003
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 33,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.0000009536743164,
-                1.0,
-                1.0000017881393433
-            ],
-            "min" : [
-                -1.0000007152557373,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 34,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 35,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                0.9990525245666504,
-                0.1821206957101822,
-                0.9870549440383911,
-                1.0
-            ],
-            "min" : [
-                -0.9990525245666504,
-                -0.1808946281671524,
-                -0.987054705619812,
-                -1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 36,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.4449338912963867,
-                0.9933801889419556
-            ],
-            "min" : [
-                0.00026097893714904785,
-                0.006618916988372803
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 37,
-            "componentType" : 5123,
-            "count" : 3384,
-            "max" : [
-                1727
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 38,
-            "componentType" : 5126,
-            "count" : 1728,
-            "max" : [
-                2.0387632846832275,
-                4.632749557495117,
-                2.0049562454223633
-            ],
-            "min" : [
-                -2.040559768676758,
-                2.866074323654175,
-                -2.0049562454223633
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 39,
-            "componentType" : 5126,
-            "count" : 1728,
-            "max" : [
-                0.9968565702438354,
-                0.9795526266098022,
-                0.999755859375
-            ],
-            "min" : [
-                -0.9970701932907104,
-                -0.9920957088470459,
-                -0.999755859375
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 40,
-            "componentType" : 5126,
-            "count" : 1728,
-            "max" : [
-                3.0,
-                3.0
-            ],
-            "min" : [
-                -2.0,
-                -2.0
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 41,
-            "componentType" : 5123,
-            "count" : 29400,
-            "max" : [
-                5003
-            ],
-            "min" : [
-                0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 42,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.0000009536743164,
-                1.0,
-                1.0000017881393433
-            ],
-            "min" : [
-                -1.0000007152557373,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 43,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.0,
-                1.0,
-                1.0
-            ],
-            "min" : [
-                -1.0,
-                -1.0,
-                -1.0
-            ],
-            "type" : "VEC3"
-        },
-        {
-            "bufferView" : 44,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                0.9990525245666504,
-                0.1821206957101822,
-                0.9870549440383911,
-                1.0
-            ],
-            "min" : [
-                -0.9990525245666504,
-                -0.1808946281671524,
-                -0.987054705619812,
-                -1.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 45,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.4449338912963867,
-                0.9933801889419556
-            ],
-            "min" : [
-                0.00026097893714904785,
-                0.006618916988372803
-            ],
-            "type" : "VEC2"
-        },
-        {
-            "bufferView" : 46,
-            "componentType" : 5123,
-            "count" : 5004,
-            "max" : [
-                2,
-                0,
-                0,
-                0
-            ],
-            "min" : [
-                2,
-                0,
-                0,
-                0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 47,
-            "componentType" : 5126,
-            "count" : 5004,
-            "max" : [
-                1.0000026226043701,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "min" : [
-                0.9999948740005493,
-                0.0,
-                0.0,
-                0.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 48,
-            "componentType" : 5126,
-            "count" : 3,
-            "max" : [
-                1.0000264644622803,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0000272989273071,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0,
-                0.0,
-                4.0,
-                3.0,
-                0.0,
-                1.0
-            ],
-            "min" : [
-                -7.549989788913081e-08,
-                0.0,
-                -1.0000264644622803,
-                0.0,
-                0.0,
-                -1.0000272989273071,
-                0.0,
-                0.0,
-                -1.0,
-                0.0,
-                7.549790126404332e-08,
-                0.0,
-                -6.039832101123466e-07,
-                2.0,
-                -8.0,
-                1.0
-            ],
-            "type" : "MAT4"
-        },
-        {
-            "bufferView" : 49,
-            "componentType" : 5126,
-            "count" : 3,
-            "max" : [
-                1.0,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0,
-                0.0,
-                3.019916050561733e-07,
-                5.0,
-                4.0,
-                1.0
-            ],
-            "min" : [
-                -7.549790126404332e-08,
-                0.0,
-                -1.0,
-                0.0,
-                0.0,
-                -1.0,
-                0.0,
-                0.0,
-                -1.0,
-                0.0,
-                7.549790126404332e-08,
-                0.0,
-                -3.019916050561733e-07,
-                0.0,
-                -4.0,
-                1.0
-            ],
-            "type" : "MAT4"
-        },
-        {
-            "bufferView" : 50,
-            "componentType" : 5126,
-            "count" : 3,
-            "max" : [
-                1.0000264644622803,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0000272989273071,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.0,
-                0.0,
-                6.039832101123466e-07,
-                3.0,
-                8.0,
-                1.0
-            ],
-            "min" : [
-                -7.549989788913081e-08,
-                0.0,
-                -1.0000264644622803,
-                0.0,
-                0.0,
-                -1.0000272989273071,
-                0.0,
-                0.0,
-                -1.0,
-                0.0,
-                7.549790126404332e-08,
-                0.0,
-                -4.0,
-                2.0,
-                0.0,
-                1.0
-            ],
-            "type" : "MAT4"
-        },
-        {
-            "bufferView" : 51,
-            "componentType" : 5126,
-            "count" : 80,
-            "max" : [
-                2.6333333333333333
-            ],
-            "min" : [
-                0.0
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 52,
-            "componentType" : 5126,
-            "count" : 80,
-            "max" : [
-                -0.6532814502716064,
-                0.27059805393218994,
-                0.7071068286895752,
-                0.27059808373451233
-            ],
-            "min" : [
-                -0.7071067094802856,
-                0.0,
-                0.6532815098762512,
-                0.0
-            ],
-            "type" : "VEC4"
-        },
-        {
-            "bufferView" : 53,
-            "componentType" : 5126,
-            "count" : 81,
-            "max" : [
-                5.3
-            ],
-            "min" : [
-                2.6333333333333333
-            ],
-            "type" : "SCALAR"
-        },
-        {
-            "bufferView" : 54,
-            "componentType" : 5126,
-            "count" : 81,
-            "max" : [
-                0.7064679861068726,
-                0.27059805393218994,
-                0.7071068286895752,
-                0.27059808373451233
-            ],
-            "min" : [
-                -0.7071067094802856,
-                0.0,
-                -0.7064680457115173,
-                0.0
-            ],
-            "type" : "VEC4"
-        }
-    ],
-    "animations" : [
-        {
-            "channels" : [
-                {
-                    "sampler" : 0,
-                    "target" : {
-                        "node" : 13,
-                        "path" : "rotation"
-                    }
-                },
-                {
-                    "sampler" : 1,
-                    "target" : {
-                        "node" : 14,
-                        "path" : "rotation"
-                    }
-                }
-            ],
-            "name" : "Swing",
-            "samplers" : [
-                {
-                    "input" : 51,
-                    "interpolation" : "LINEAR",
-                    "output" : 52
-                },
-                {
-                    "input" : 53,
-                    "interpolation" : "LINEAR",
-                    "output" : 54
-                }
-            ]
-        }
-    ],
-    "asset" : {
-        "generator" : "Khronos Blender glTF 2.0 exporter",
-        "version" : "2.0"
-    },
-    "bufferViews" : [
-        {
-            "buffer" : 0,
-            "byteLength" : 22584,
-            "byteOffset" : 0,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 68232,
-            "byteOffset" : 22584,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 68232,
-            "byteOffset" : 90816,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 45488,
-            "byteOffset" : 159048,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 201246,
-            "byteOffset" : 204536,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 347520,
-            "byteOffset" : 405784,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 347520,
-            "byteOffset" : 753304,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 463360,
-            "byteOffset" : 1100824,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 231680,
-            "byteOffset" : 1564184,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 23808,
-            "byteOffset" : 1795864,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 25716,
-            "byteOffset" : 1819672,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 25716,
-            "byteOffset" : 1845388,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 34288,
-            "byteOffset" : 1871104,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 17144,
-            "byteOffset" : 1905392,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 237600,
-            "byteOffset" : 1922536,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 240000,
-            "byteOffset" : 2160136,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 240000,
-            "byteOffset" : 2400136,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 320000,
-            "byteOffset" : 2640136,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 160000,
-            "byteOffset" : 2960136,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 237600,
-            "byteOffset" : 3120136,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 244656,
-            "byteOffset" : 3357736,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 244656,
-            "byteOffset" : 3602392,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 326208,
-            "byteOffset" : 3847048,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 163104,
-            "byteOffset" : 4173256,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 163104,
-            "byteOffset" : 4336360,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 326208,
-            "byteOffset" : 4499464,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 4512,
-            "byteOffset" : 4825672,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 13824,
-            "byteOffset" : 4830184,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 13824,
-            "byteOffset" : 4844008,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 9216,
-            "byteOffset" : 4857832,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 9216,
-            "byteOffset" : 4867048,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 18432,
-            "byteOffset" : 4876264,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 58800,
-            "byteOffset" : 4894696,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 60048,
-            "byteOffset" : 4953496,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 60048,
-            "byteOffset" : 5013544,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 80064,
-            "byteOffset" : 5073592,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 40032,
-            "byteOffset" : 5153656,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 6768,
-            "byteOffset" : 5193688,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 20736,
-            "byteOffset" : 5200456,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 20736,
-            "byteOffset" : 5221192,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 13824,
-            "byteOffset" : 5241928,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 58800,
-            "byteOffset" : 5255752,
-            "target" : 34963
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 60048,
-            "byteOffset" : 5314552,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 60048,
-            "byteOffset" : 5374600,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 80064,
-            "byteOffset" : 5434648,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 40032,
-            "byteOffset" : 5514712,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 40032,
-            "byteOffset" : 5554744,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 80064,
-            "byteOffset" : 5594776,
-            "target" : 34962
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 192,
-            "byteOffset" : 5674840
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 192,
-            "byteOffset" : 5675032
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 192,
-            "byteOffset" : 5675224
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 320,
-            "byteOffset" : 5675416
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 1280,
-            "byteOffset" : 5675736
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 324,
-            "byteOffset" : 5677016
-        },
-        {
-            "buffer" : 0,
-            "byteLength" : 1296,
-            "byteOffset" : 5677340
-        }
-    ],
-    "buffers" : [
-        {
-            "byteLength" : 5678636,
-            "uri" : "newtonsCradle.bin"
-        }
-    ],
-    "images" : [
-        {
-            "name" : "Cerberus_AO",
-            "uri" : "Cerberus_AO.jpg"
-        },
-        {
-            "name" : "Map #2",
-            "uri" : "Map #2.jpg"
-        },
-        {
-            "name" : "Cerberus_MR",
-            "uri" : "Cerberus_MR.png"
-        },
-        {
-            "name" : "Cerberus_N",
-            "uri" : "Cerberus_N.jpg"
-        },
-        {
-            "name" : "old-textured-fabric-albedo3",
-            "uri" : "old-textured-fabric-albedo3.png"
-        },
-        {
-            "name" : "old-textured-fabric-metallicroughness",
-            "uri" : "old-textured-fabric-metallicroughness.png"
-        },
-        {
-            "name" : "old-textured-fabric-normal",
-            "uri" : "old-textured-fabric-normal.png"
-        },
-        {
-            "name" : "old-textured-fabric-ao",
-            "uri" : "old-textured-fabric-ao.png"
-        },
-        {
-            "name" : "greasy-pan-2-albedo",
-            "uri" : "greasy-pan-2-albedo.png"
-        },
-        {
-            "name" : "greasy-pan-2-normal",
-            "uri" : "greasy-pan-2-normal.png"
-        },
-        {
-            "name" : "greasy-pan-2-ao",
-            "uri" : "greasy-pan-2-ao.png"
-        },
-        {
-            "name" : "greasy-pan-2-metallicroughness",
-            "uri" : "greasy-pan-2-metallicroughness.png"
-        },
-        {
-            "name" : "scuffed-plastic4-alb.png",
-            "uri" : "scuffed-plastic4-alb.png.png"
-        },
-        {
-            "name" : "scuffed-plastic-metalroughness.png",
-            "uri" : "scuffed-plastic-metalroughness.png.png"
-        },
-        {
-            "name" : "scuffed-plastic-normal.png",
-            "uri" : "scuffed-plastic-normal.png.png"
-        },
-        {
-            "name" : "scuffed-plastic-ao.png",
-            "uri" : "scuffed-plastic-ao.png.png"
-        },
-        {
-            "name" : "slate2-tiled-albedo2",
-            "uri" : "slate2-tiled-albedo2.png"
-        },
-        {
-            "name" : "slate2-tiled-metallicroughness",
-            "uri" : "slate2-tiled-metallicroughness.png"
-        },
-        {
-            "name" : "slate2-tiled-normal3-UE4",
-            "uri" : "slate2-tiled-normal3-UE4.png"
-        },
-        {
-            "name" : "slate2-tiled-ao",
-            "uri" : "slate2-tiled-ao.png"
-        },
-        {
-            "name" : "streakedmetal-albedo",
-            "uri" : "streakedmetal-albedo.png"
-        },
-        {
-            "name" : "streakedmetal-normal",
-            "uri" : "streakedmetal-normal.png"
-        },
-        {
-            "name" : "streakedmetal-ao",
-            "uri" : "streakedmetal-ao.png"
-        },
-        {
-            "name" : "streakedmetal-metallicroughness",
-            "uri" : "streakedmetal-metallicroughness.png"
-        },
-        {
-            "name" : "darktiles1_AO",
-            "uri" : "darktiles1_AO.png"
-        },
-        {
-            "name" : "darktiles1_basecolor",
-            "uri" : "darktiles1_basecolor.png"
-        },
-        {
-            "name" : "darktiles1_normal",
-            "uri" : "darktiles1_normal.png"
-        },
-        {
-            "name" : "darktiles1_metallicroughness",
-            "uri" : "darktiles1_metallicroughness.png"
-        }
-    ],
-    "materials" : [
-        {
-            "name" : "08 - Default",
-            "normalTexture" : {
-                "index" : 3
-            },
-            "occlusionTexture" : {
-                "index" : 0
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 1
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 2
-                }
-            }
-        },
-        {
-            "name" : "Fabric",
-            "normalTexture" : {
-                "index" : 6
-            },
-            "occlusionTexture" : {
-                "index" : 7
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 4
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 5
-                }
-            }
-        },
-        {
-            "name" : "Greasy Metal",
-            "normalTexture" : {
-                "index" : 9
-            },
-            "occlusionTexture" : {
-                "index" : 10
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 8
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 11
-                }
-            }
-        },
-        {
-            "name" : "Plastic",
-            "normalTexture" : {
-                "index" : 14
-            },
-            "occlusionTexture" : {
-                "index" : 15
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 12
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 13
-                }
-            }
-        },
-        {
-            "name" : "Rock",
-            "normalTexture" : {
-                "index" : 18
-            },
-            "occlusionTexture" : {
-                "index" : 19
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 16
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 17
-                }
-            }
-        },
-        {
-            "name" : "Streaked Metal",
-            "normalTexture" : {
-                "index" : 21
-            },
-            "occlusionTexture" : {
-                "index" : 22
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 20
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 23
-                }
-            }
-        },
-        {
-            "name" : "Tile",
-            "normalTexture" : {
-                "index" : 26
-            },
-            "occlusionTexture" : {
-                "index" : 24
-            },
-            "pbrMetallicRoughness" : {
-                "baseColorTexture" : {
-                    "index" : 25
-                },
-                "metallicRoughnessTexture" : {
-                    "index" : 27
-                }
-            }
-        }
-    ],
-    "meshes" : [
-        {
-            "name" : "Cradle",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 2,
-                        "POSITION" : 1,
-                        "TEXCOORD_0" : 3
-                    },
-                    "indices" : 0,
-                    "material" : 5
-                }
-            ]
-        },
-        {
-            "name" : "Untitled",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 6,
-                        "POSITION" : 5,
-                        "TANGENT" : 7,
-                        "TEXCOORD_0" : 8
-                    },
-                    "indices" : 4,
-                    "material" : 0
-                }
-            ]
-        },
-        {
-            "name" : "Sphere.005",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 11,
-                        "POSITION" : 10,
-                        "TANGENT" : 12,
-                        "TEXCOORD_0" : 13
-                    },
-                    "indices" : 9,
-                    "material" : 4
-                }
-            ]
-        },
-        {
-            "name" : "Sphere",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 16,
-                        "POSITION" : 15,
-                        "TANGENT" : 17,
-                        "TEXCOORD_0" : 18
-                    },
-                    "indices" : 14,
-                    "material" : 2
-                }
-            ]
-        },
-        {
-            "name" : "Sphere.001",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "JOINTS_0" : 24,
-                        "NORMAL" : 21,
-                        "POSITION" : 20,
-                        "TANGENT" : 22,
-                        "TEXCOORD_0" : 23,
-                        "WEIGHTS_0" : 25
-                    },
-                    "indices" : 19,
-                    "material" : 6
-                }
-            ]
-        },
-        {
-            "name" : "Cradle.001",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "JOINTS_0" : 30,
-                        "NORMAL" : 28,
-                        "POSITION" : 27,
-                        "TEXCOORD_0" : 29,
-                        "WEIGHTS_0" : 31
-                    },
-                    "indices" : 26,
-                    "material" : 1
-                }
-            ]
-        },
-        {
-            "name" : "Sphere.002",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 34,
-                        "POSITION" : 33,
-                        "TANGENT" : 35,
-                        "TEXCOORD_0" : 36
-                    },
-                    "indices" : 32,
-                    "material" : 3
-                }
-            ]
-        },
-        {
-            "name" : "Cradle.004",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "NORMAL" : 39,
-                        "POSITION" : 38,
-                        "TEXCOORD_0" : 40
-                    },
-                    "indices" : 37,
-                    "material" : 1
-                }
-            ]
-        },
-        {
-            "name" : "Sphere.004",
-            "primitives" : [
-                {
-                    "attributes" : {
-                        "JOINTS_0" : 46,
-                        "NORMAL" : 43,
-                        "POSITION" : 42,
-                        "TANGENT" : 44,
-                        "TEXCOORD_0" : 45,
-                        "WEIGHTS_0" : 47
-                    },
-                    "indices" : 41,
-                    "material" : 5
-                }
-            ]
-        }
-    ],
-    "nodes" : [
-        {
-            "children" : [
-                5,
-                7,
-                11,
-                12
-            ],
-            "name" : "Armature"
-        },
-        {
-            "name" : "Camera",
-            "rotation" : [
-                0.483536034822464,
-                0.33687159419059753,
-                -0.20870360732078552,
-                0.7804827094078064
-            ],
-            "translation" : [
-                7.481131553649902,
-                5.34366512298584,
-                6.5076398849487305
-            ]
-        },
-        {
-            "mesh" : 1,
-            "name" : "Cerberus",
-            "rotation" : [
-                -1.5454308055495858e-08,
-                0.7071068286895752,
-                1.5454308055495858e-08,
-                0.7071067690849304
-            ],
-            "scale" : [
-                0.029999999329447746,
-                0.029999999329447746,
-                0.029999999329447746
-            ],
-            "translation" : [
-                10.96358585357666,
-                1.8301241397857666,
-                -0.0
-            ]
-        },
-        {
-            "children" : [
-                0,
-                6,
-                8,
-                9,
-                10
-            ],
-            "mesh" : 0,
-            "name" : "Cradle"
-        },
-        {
-            "name" : "Lamp",
-            "rotation" : [
-                0.16907575726509094,
-                0.7558802962303162,
-                -0.27217137813568115,
-                0.570947527885437
-            ],
-            "scale" : [
-                1.0,
-                1.0,
-                0.9999999403953552
-            ],
-            "translation" : [
-                -4.533550262451172,
-                1.2897706031799316,
-                -1.876769781112671
-            ]
-        },
-        {
-            "mesh" : 8,
-            "name" : "Metal Sphere",
-            "scale" : [
-                1.0000264644622803,
-                1.0000272989273071,
-                1.0
-            ],
-            "skin" : 0,
-            "translation" : [
-                4.0,
-                2.0,
-                -0.0
-            ]
-        },
-        {
-            "mesh" : 2,
-            "name" : "Rocky Sphere",
-            "translation" : [
-                0.0,
-                2.0,
-                -0.0
-            ]
-        },
-        {
-            "mesh" : 5,
-            "name" : "Ropes",
-            "skin" : 1
-        },
-        {
-            "mesh" : 3,
-            "name" : "Rusty Sphere",
-            "translation" : [
-                2.0,
-                2.0,
-                -0.0
-            ]
-        },
-        {
-            "mesh" : 6,
-            "name" : "Snooker Cue",
-            "translation" : [
-                -2.0,
-                2.0,
-                -0.0
-            ]
-        },
-        {
-            "mesh" : 7,
-            "name" : "Static Ropes"
-        },
-        {
-            "mesh" : 4,
-            "name" : "Tiled Sphere",
-            "scale" : [
-                1.0000264644622803,
-                1.0000272989273071,
-                1.0
-            ],
-            "skin" : 2,
-            "translation" : [
-                -4.0,
-                2.0,
-                -0.0
-            ]
-        },
-        {
-            "children" : [
-                13,
-                14
-            ],
-            "name" : "Armature_Bone"
-        },
-        {
-            "name" : "Armature_Bone.001",
-            "rotation" : [
-                -0.7071067094802856,
-                0.0,
-                0.7071068286895752,
-                0.0
-            ],
-            "translation" : [
-                -4.0,
-                5.0,
-                0.0
-            ]
-        },
-        {
-            "name" : "Armature_Bone.002",
-            "rotation" : [
-                -0.7071067094802856,
-                0.0,
-                0.7071068286895752,
-                0.0
-            ],
-            "translation" : [
-                4.0,
-                5.0,
-                0.0
-            ]
-        }
-    ],
-    "samplers" : [
-        {}
-    ],
-    "scene" : 0,
-    "scenes" : [
-        {
-            "name" : "Scene",
-            "nodes" : [
-                2,
-                3,
-                4,
-                1
-            ]
-        }
-    ],
-    "skins" : [
-        {
-            "inverseBindMatrices" : 48,
-            "joints" : [
-                12,
-                13,
-                14
-            ],
-            "skeleton" : 0
-        },
-        {
-            "inverseBindMatrices" : 49,
-            "joints" : [
-                12,
-                13,
-                14
-            ],
-            "skeleton" : 0
-        },
-        {
-            "inverseBindMatrices" : 50,
-            "joints" : [
-                12,
-                13,
-                14
-            ],
-            "skeleton" : 0
-        }
-    ],
-    "textures" : [
-        {
-            "sampler" : 0,
-            "source" : 0
-        },
-        {
-            "sampler" : 0,
-            "source" : 1
-        },
-        {
-            "sampler" : 0,
-            "source" : 2
-        },
-        {
-            "sampler" : 0,
-            "source" : 3
-        },
-        {
-            "sampler" : 0,
-            "source" : 4
-        },
-        {
-            "sampler" : 0,
-            "source" : 5
-        },
-        {
-            "sampler" : 0,
-            "source" : 6
-        },
-        {
-            "sampler" : 0,
-            "source" : 7
-        },
-        {
-            "sampler" : 0,
-            "source" : 8
-        },
-        {
-            "sampler" : 0,
-            "source" : 9
-        },
-        {
-            "sampler" : 0,
-            "source" : 10
-        },
-        {
-            "sampler" : 0,
-            "source" : 11
-        },
-        {
-            "sampler" : 0,
-            "source" : 12
-        },
-        {
-            "sampler" : 0,
-            "source" : 13
-        },
-        {
-            "sampler" : 0,
-            "source" : 14
-        },
-        {
-            "sampler" : 0,
-            "source" : 15
-        },
-        {
-            "sampler" : 0,
-            "source" : 16
-        },
-        {
-            "sampler" : 0,
-            "source" : 17
-        },
-        {
-            "sampler" : 0,
-            "source" : 18
-        },
-        {
-            "sampler" : 0,
-            "source" : 19
-        },
-        {
-            "sampler" : 0,
-            "source" : 20
-        },
-        {
-            "sampler" : 0,
-            "source" : 21
-        },
-        {
-            "sampler" : 0,
-            "source" : 22
-        },
-        {
-            "sampler" : 0,
-            "source" : 23
-        },
-        {
-            "sampler" : 0,
-            "source" : 24
-        },
-        {
-            "sampler" : 0,
-            "source" : 25
-        },
-        {
-            "sampler" : 0,
-            "source" : 26
-        },
-        {
-            "sampler" : 0,
-            "source" : 27
-        }
-    ]
-}
diff --git a/models/vaporwave.glb b/models/vaporwave.glb
new file mode 100644 (file)
index 0000000..09e22c1
Binary files /dev/null and b/models/vaporwave.glb differ
index 1d0f759022b2acf8ee046c209f6ecd50784e95aa..d4c7eceb7e26cbb97e529768c50ce9a1469454ef 100644 (file)
@@ -22,8 +22,9 @@ uniform sampler2D brdfMap;
 
 out vec4 fragColor;
 
-uniform vec3 lightPositions[6];
-uniform vec3 lightColors[6];
+uniform int numLights;
+uniform vec3 lightPositions[8];
+uniform vec3 lightColors[8];
 
 const float PI = 3.14159265359;
 
@@ -95,7 +96,7 @@ void main() {
 
        // reflectance
        vec3 Lo = vec3(0.f);
-       for (int i = 0; i < lightPositions.length(); i++) {
+       for (int i = 0; i < numLights; i++) {
                vec3 L = normalize(lightPositions[i] - worldPos);
                vec3 H = normalize(V + L);