{"_id":"@bitowl/three-instanced-mesh","_rev":"5-cddee72bd515385914c110ac683d4e51","name":"@bitowl/three-instanced-mesh","dist-tags":{"latest":"0.118.0"},"versions":{"0.97.0":{"name":"@bitowl/three-instanced-mesh","version":"0.97.0","description":"Scene graph level abstraction for three.js InstancedBufferGeometry","main":"index.js","types":"index.d.ts","scripts":{"build":"browserify example.js --o build.js"},"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"author":{"name":"Dusan Bosnjak"},"license":"MIT","bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"homepage":"https://github.com/pailhead/three-instanced-mesh#readme","devDependencies":{"three":"^0.96.0"},"licenseText":"The MIT License\n\nCopyright © 2010-2018 three.js authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","_id":"@bitowl/three-instanced-mesh@0.97.0","dist":{"shasum":"9a3838a579d9688ef0e85f2010ad22786c096500","integrity":"sha512-ha2l91MhHXwQyHALh55b3OLdesZnLC0sOwW1w8D4DnusfCTAbOOoJ1PiEMH/mz9aYgtWsqpqsP8+YN/tt72NiQ==","tarball":"https://registry.npmjs.org/@bitowl/three-instanced-mesh/-/three-instanced-mesh-0.97.0.tgz","fileCount":26,"unpackedSize":102044,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdhPidCRA9TVsSAnZWagAAaMsP/j/WYLJ7KTW7qwKN36mI\nzKarolWGTUQRfzT8/DVwFu+wvu4QO7jdBmeRHuKOZzFiLs6XLc/d/8hDvdtj\nNrIqy3hAAmiL7vuI3OLD0LArozyLZilUEqNfjrygXyD94sNIsR9aR/uumU2k\n/A/AreNOrYP+mKMZbHcOITey1A+63JaqkMjlSQXmzyRy95JdOqsgFqLeBrUV\ngHiJaNQ3++NPtnjhDxkcSTYiiFjdOwLpy4vdcKT2wNgnbeSBGIGdFuZK9nzC\ncIUFcY+/dMttfB/5kuPFOFyeO8r/wab94UDPufc8eiGi13bBczRL7RnmYAyZ\nAuX4dP7fVovGosl2YRU43kaxGhurWfM8B+yfSR3u8gQr61vaqIHbLFunmsG0\nM8c30vho6q8y1lp81m7Lvbyg4/jlZZ1OUzybfYn528dqfxTnLDu14vqze0+k\nEqwSl42nOot3lRjGV444YoSuwMBa95L9V1oeM4iEiEI5pFHtoD9Dch/6laav\nRYRZeqNt9rgR1dwIu2L/P3oLjleRcAuE3negufbn7YyTlPj6wiZlJJQ6bQYn\n2S6V0an0LHkuUlhcbLaecakO7THCKUbt9m2VSNFO/MqMGLUISf7aLZK099oY\noOhPTo0MsdLwGAEO88ClrbrocnDM/ivDo0EBPzNUrtlJEap7RC2JlVb/n9oZ\nKTOG\r\n=9u7L\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAZv+go2+jeY/1HGO3F2hG8c4uEvsEc2NiB6VGUCEm8TAiEAxTJVlErD6k1FN3+2UGywZz1YKJxk599jUA2esTF/XIU="}]},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"_npmUser":{"name":"bitowl","email":"npm@bitowl.de"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/three-instanced-mesh_0.97.0_1568995484428_0.13131247360213627"},"_hasShrinkwrap":false},"0.98.0":{"name":"@bitowl/three-instanced-mesh","version":"0.98.0","description":"Scene graph level abstraction for three.js InstancedBufferGeometry","main":"index.js","types":"index.d.ts","scripts":{"build":"browserify example.js --o build.js"},"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"author":{"name":"Dusan Bosnjak"},"license":"MIT","bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"homepage":"https://github.com/pailhead/three-instanced-mesh#readme","devDependencies":{"three":"^0.96.0"},"licenseText":"The MIT License\n\nCopyright © 2010-2018 three.js authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.","_id":"@bitowl/three-instanced-mesh@0.98.0","dist":{"shasum":"96715a7a9d30d9949b1363130185b1e2b212ac91","integrity":"sha512-EhiBLCRkniIozwq1LoKwdjVt1ECzgNwNW1nug7lOhJ3rOweRxZsoNWUid1H4BgIfZs735/Bp0TuPmxqO/CKRkw==","tarball":"https://registry.npmjs.org/@bitowl/three-instanced-mesh/-/three-instanced-mesh-0.98.0.tgz","fileCount":26,"unpackedSize":102261,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJedrLQCRA9TVsSAnZWagAAeLoP/0zqMTJlnNeeOlwMYecy\n1/Bf550K5qKULXrnDfN6Io+qR9Moz6muT5jYHzCbdESldLwRLqPKRUYaEbnd\n6RDU2/6FNpBwO+24YiBn7ABwoQofqpB2qsDrv0hFP0O2xohfw0mAaqOd2cNm\nDcY94nkzfeblhMxFK4nzXcQ+XlqFqNFUnZyybtueDyjXH9BU4Uj0HjmbekBi\nCue1yXCqifDcfy5m6rVNU0hsUegB8mPJcQoiJ1fCe6d1gYYmy4aacsyxasJt\nrnhwxRAzEFzsIcGWH5pcjiUkP6f+FUA3xKI9v7LTthh6e1tj1apAOBOcGF8t\nnSv+N3HByRFMjish5lrR6MOVKZ0yAiUi3WXPxEwLF5rpMqeypWOYCtPeix2D\n002HmUbB9E9seHgZ87EOiMYe8rUp6Ag4yokpaXoQeylpwRcOExfxX48IZoGj\nGCTNCUEk5Szgi2FCTxA3Qb+SJ/73dlOuYnJzU0uR/FZ+huFFul5RbCL8KqwN\n76dN4ro+buYIsmQW9+BZy2Id3NxsP0tRLgkxE65m+2utAc9ipATcpdL5/IaP\nttSavWsGfN+G8uWcRtE23y8olDhZdZOLxpFbLy9RGi/jEKDZN9PNw56YHL39\n9lyMlOfSHn2R//6LlLAOnErs5B8l4PZBa3QsGfa1svKy0qxfZow/dAiMdMcg\nbrik\r\n=UW58\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICI5P+zihZVKR6DtZYrwHDamhQuvyHqxYypy6EJTTFrrAiBFvN/KVaXWTSxryeQXiPAeSg3kzzqsvb+bKF/F7b4wRQ=="}]},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"_npmUser":{"name":"bitowl","email":"npm@bitowl.de"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/three-instanced-mesh_0.98.0_1584837327535_0.6237769991768454"},"_hasShrinkwrap":false},"0.117.0":{"name":"@bitowl/three-instanced-mesh","version":"0.117.0","description":"Scene graph level abstraction for three.js InstancedBufferGeometry","main":"index.js","types":"index.d.ts","directories":{"example":"example"},"scripts":{"build":"browserify example.js --o build.js"},"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"author":{"name":"Dusan Bosnjak"},"license":"MIT","bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"homepage":"https://github.com/pailhead/three-instanced-mesh#readme","devDependencies":{"three":"^0.117.1"},"gitHead":"7e42abb518fc2d936a0b0422d2e5f9d6c091a821","_id":"@bitowl/three-instanced-mesh@0.117.0","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-fs6wnmaRJ5Zyy4PLnqpfj09cbXERthETLJfR7rmlR+TKNaWLmrF/yiLB2uikIptnzyrYKsQR+sd/HAECGFNI+g==","shasum":"65e6941b03b7be6efa98312efc94f81a86dd033a","tarball":"https://registry.npmjs.org/@bitowl/three-instanced-mesh/-/three-instanced-mesh-0.117.0.tgz","fileCount":22,"unpackedSize":122805,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe0WPxCRA9TVsSAnZWagAAPlgP/3fRkHcwD/bXZx2j7xTH\nYff4+e90WM20vbwxLGdmIePbijeEu3AAp4OzPtt593SDE5XdyA4Iq+myUyoU\naoMio6P37hPuF1YLmRhncSiUWHJ0/JE2YPsqeHJNK1I7iy4J8sVqyLdrQyPp\nbvbwId4o6d+jN8auWToZDe8uQBR8uu1y4u9kTuNyH25kqEbbAfLhkbAhAZGa\nf0ZKi9a2kTAKJg+lYMosMWZLO2wbH/LNK2uCAyQTlE/HAMy5IxxF86YhQudB\nxe5okKISglsKkxV34jKEQhhxIIF1faBMbx+hpo1s0MCKK54z/rlp2np+fbaX\nqbZ2PIqdAMiU/CafyBxr15yrLRYQF+8wKHAnJSmO3v9Odd2U1wowdzMmqrjS\nMpyXOJjK2frg/Nt/CSB/4M8AM9uPvF+AVVsAUs0GiHfPVApYHnQHWGwdKBgB\nn7GdkzOyjyhbaMpN+eLhY9r6JchBCaU3lD/SSXb4Fs6xBtKlvhG6V8MulPtE\ndYiRHDdeeNQg4STc27/4T95DwiaGwKpjGS3HMuLYwfKPPShyI5OtMLFdjkS1\nr/+YfRkDz8Q6uhngkrdvPaoSAPzLDuEGIuot99Va16X6933MA/Vf8LsSOYYi\nh0bll5W45tmwloPO4/k0VNvQA5TnQ4FH6kKEoaOPxfooBM248PCm4Ofk7h+E\nkkky\r\n=LBXx\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCr94rZU/byxvqf7tuSdpVdw4I6q50n2B2++7Otuj07rQIgf9dpxRX2/sKJWJGgrB3In+i9SuK+6emzFrqpghiXPSw="}]},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"_npmUser":{"name":"bitowl","email":"npm@bitowl.de"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/three-instanced-mesh_0.117.0_1590780912988_0.8237354887013644"},"_hasShrinkwrap":false},"0.117.1":{"name":"@bitowl/three-instanced-mesh","version":"0.117.1","description":"Scene graph level abstraction for three.js InstancedBufferGeometry","main":"index.js","types":"index.d.ts","directories":{"example":"example"},"scripts":{"build":"browserify example.js --o build.js"},"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"author":{"name":"Dusan Bosnjak"},"license":"MIT","bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"homepage":"https://github.com/pailhead/three-instanced-mesh#readme","devDependencies":{"three":"^0.117.1"},"gitHead":"029348df8c217c85ca99d96268f17fa277b72c6b","_id":"@bitowl/three-instanced-mesh@0.117.1","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-q6jq30Rs4qNcGlg0EIZBzzEwnDfWUZ6ik+J8xlceY5S8GiPcpJgxshDe2w8eaKEQf0Jz7dyaJ0RMEaD7MHvt9w==","shasum":"b060336f737423c03dbd1822b09d0851fe3a4dbb","tarball":"https://registry.npmjs.org/@bitowl/three-instanced-mesh/-/three-instanced-mesh-0.117.1.tgz","fileCount":22,"unpackedSize":123027,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe2srzCRA9TVsSAnZWagAA6s8P/A6un4xApp2KkmXuAl0N\nK60UNt733lLdvuFubN9PDmDnlKcM63unObs+NC12PZEPCXvLVaXmylF+zaiU\nAXxPKJvmp3ZNmKeFxtP26CTrDhmiPt0TRp8s0CqLgatQ5SB8hVOhDh9spE0m\nPl3hNXdaO/s24kwYSWNzn+NICdzoNpd1VtxVs2LTrek8JY/G/QZ1rfWg+LMY\nk62yAc8+ZDuRSbQ4LJedd07jA0shWVs5fQlEWcJNuyNWi6P1qOQ2/2Fp8UPG\nV23H5+tlJi/CDgNogJ9EtiKizNXtu2D2U8c00+rpWWOElZmDZ5mPks2WSq96\nN0/2Fr7kRaOeOuELnvLs98Nt7HxqHdr6nW8Ep2g/6knBbNVRMpSFcwQXo/6v\nZ5aOwqiK31jgIprgmm3VG2oLRq47KcR7qUWUu3GUPlsyNgKr6zjL0VAjzaB9\nKjOdR5/p+ZJ3IedZEZrNnhhepapMwY9l5SRmhauVvIji9c/SSR3ApGBWA1Qt\n0nrqgNM8GLNNax2VL0KyisdaVkYpK4tOX1EzxvqVmaaCv8qWRfOUuwdKUnwu\noPq1jyNOR8H+TYw/yHBH0uDl5jjsNaR1C9aAFktUDpYtvzT3dyvrgsCfFtfB\n9QWU6T1sat4ColByPMJYcOUfIhn5mPnE4hl0hnlAqKbrRvCL4P6/d+Rry+Nj\napEz\r\n=jZDQ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICuariay85cooyWunjPYeHn2S8ZeCrEYjnVEzWSgNiaAAiBQTCvjJh9cwIz48r5fjpDEHlLpVYME6dBxUZTYjYQCSA=="}]},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"_npmUser":{"name":"bitowl","email":"npm@bitowl.de"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/three-instanced-mesh_0.117.1_1591397106627_0.8886970939164012"},"_hasShrinkwrap":false},"0.118.0":{"name":"@bitowl/three-instanced-mesh","version":"0.118.0","description":"Scene graph level abstraction for three.js InstancedBufferGeometry","main":"index.js","types":"index.d.ts","directories":{"example":"example"},"scripts":{"build":"browserify example.js --o build.js"},"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"author":{"name":"Dusan Bosnjak"},"license":"MIT","bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"homepage":"https://github.com/pailhead/three-instanced-mesh#readme","devDependencies":{"three":"^0.118.3"},"gitHead":"5f3f9a37c3d7e3681acf4a05a0a6b5be0e9776b3","_id":"@bitowl/three-instanced-mesh@0.118.0","_nodeVersion":"12.11.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-aRjFctBgcjRD6s/iH1TJcocFr247zsBmNCTlBYRf5xtJODgp7BiUfYwewWqV5J8ecnuyUlzc7tWN8+VpvwcuBA==","shasum":"28a1661d8bb7fd09ceff89386d8fc2d99581b12b","tarball":"https://registry.npmjs.org/@bitowl/three-instanced-mesh/-/three-instanced-mesh-0.118.0.tgz","fileCount":22,"unpackedSize":122179,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfIZ7HCRA9TVsSAnZWagAAe0gQAIdR82ksn0R6lH2pyzF0\nZDE8HCYVsdGtDkh3BV3pza0l5RT6VagK1zb/KUSnoyctDn7yadZzDHziXUwk\n1WGnZwV75uazW7R36wFFbUaNtFUf6E2OTO4BcJhJLegF2ftCH88RR+OW/kp+\njD/BYdgFuX4eVkVKik5sPqwL9GOE88sde2BzXfWh6z02xApLEW+JEYm+3u7h\nGeAQaGJFUq9gnbkkP6XfZhaTBpzNg3tedhSCIslTV6X88d6RUbpVlUlrOkTK\nRtAvUQT2KQZiubERaY5l5N3tHYsEEFXnqVbRcMi8hYGtibTl0l7Y4GdCEDcO\nhDX1KxjDRkf/ze927NqhAkPGmUOwjir8yLckqZRKEE8rtCVZrOwVMAArBK+P\n2InH6fQNacaeIO21nLsWtKYZ5kH0KMKDMg8RcXSdQidSJFs1r2s5hpZzsQ8j\n9uL0eqi3SRGyNXyXkTTEoFZrVMQEAuf8RmyUQPpT9aGuZR0oa9Qmgi81fnUe\nY8sxIaaIDnXwENF+SMXDn/nJg0BcO8N4vxiEROiN55mZulySG9CjjzSz27Qs\ndWOYR1kR2o7hVAyh4hpmfyN6mGeqo1uY+jIye1CO2hp9yAIKMu2Eyoqy7Hkn\nyN3qrzdcaA70cv17P4sbEBNU1LJDuXU8MsdszE10ZV7AnVN8ZchgXOTJW6f8\noX/V\r\n=D3Qo\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHyoObjunM05aCfLVPQRP/bIJaMfzrEbH+UoJLP5hxjTAiBsE5Q9CfxSrRoQOp6WncihCkDyNybBVZA2+6DhXCNX+A=="}]},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"_npmUser":{"name":"bitowl","email":"npm@bitowl.de"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/three-instanced-mesh_0.118.0_1596038855325_0.7527475011576343"},"_hasShrinkwrap":false}},"time":{"created":"2019-09-20T16:04:44.207Z","0.97.0":"2019-09-20T16:04:44.568Z","modified":"2022-04-04T19:12:49.533Z","0.98.0":"2020-03-22T00:35:27.704Z","0.117.0":"2020-05-29T19:35:13.083Z","0.117.1":"2020-06-05T22:45:06.815Z","0.118.0":"2020-07-29T16:07:35.482Z"},"maintainers":[{"name":"bitowl","email":"npm@bitowl.de"}],"description":"Scene graph level abstraction for three.js InstancedBufferGeometry","homepage":"https://github.com/pailhead/three-instanced-mesh#readme","keywords":["threejs","webgl","instancing","ANGLE_instanced_arrays","glsl","javascript","3d"],"repository":{"type":"git","url":"git+https://github.com/pailhead/three-instanced-mesh.git"},"author":{"name":"Dusan Bosnjak"},"bugs":{"url":"https://github.com/pailhead/three-instanced-mesh/issues"},"license":"MIT","readme":"# three-instanced-mesh\r\n\r\nFork of https://github.com/pailhead/three-instanced-mesh that is updated for three.js r118.\r\n\r\nHigher level abstraction of `THREE.InstancedBufferGeometry` for [three.js](https://github.com/mrdoob/three.js/). For a webgl level overview check out [TojiCode](http://blog.tojicode.com/2013/07/webgl-instancing-with.html). For a more in depth overview on how this works, [i've written an article more or less on how to build this from scratch](https://medium.com/@pailhead011/instancing-with-three-js-36b4b62bc127).\r\n\r\n# API\r\n\r\n## Methods:\r\n\r\n**.setPositionAt( index: Int , position: THREE.Vector3 )**\r\n\r\n_Updates the position attribute at given index._\r\n\r\n**.setQuaternionAt( index: Int , quaternion: THREE.Quaternion )**\r\n\r\n_Updates the quaternion attribute at given index._\r\n\r\n**.setScaleAt( index: Int , scale: THREE.Vector3 )**\r\n\r\n_Updates the scale attribute at given index._\r\n\r\n**.setColorAt( index: Int , color: THREE.Color )**\r\n\r\n_Updates the color attribute at given index if instance colors are enabled._\r\n\r\n**.getPositionAt( index: Int , target: THREE.Vector3)**\r\n\r\n_Write value from position attribute at index into target THREE.Vector3._\r\n\r\n**.getQuaternionAt( index: Int , target: THREE.Quaternion)**\r\n\r\n_Write value from quaternion attribute at index into target THREE.Quaternion._\r\n\r\n**.getScaleAt( index: Int , target: THREE.Vector3)**\r\n\r\n_Write value from scale attribute at index into target THREE.Vector3._\r\n\r\n**.getColorAt( index: Int , target: THREE.Color)**\r\n\r\n_Write value from color attribute at index into target THREE.Color if instance colors are enabled._\r\n\r\n**.needsUpdate( attributeName: String )**\r\n\r\n_Set appropriate attribute needsUpdate flags. If `attributeName` is omitted all of the attributes will be marked for updates. Valid names are `position, quaternion, scale, colors`._\r\n\r\n## Properties:\r\n\r\nAll of these have some side effects. This should probably be revisited but here are some notes:\r\n\r\n**.material: THREE.Material**\r\n\r\n_Whenever you set `myInstanceMesh.material = material` the material will be cloned and decorated with the instancing flags. This is supposed to make it simple to use, but is quite a side effect._\r\n\r\n**.numInstances: Int**\r\n\r\n_Number of instances, when this changes the attributes need to be reinstantiated._ \r\n\r\n**.geometry: THREE.BufferGeometry**\r\n\r\n_If regular BufferGeometry is passed, this will create an instance of InstancedBufferGeometry and copy the attributes into it._ \r\n\r\n\r\n\r\n\r\n\r\n# what it should do\r\n\r\nProvide an abstraction for relatively low level `THREE.InstancedBufferGeometry`, allows for the instancing attributes to be setup by a \"placement function\" and converts a regular buffer geometry to instanced. This is a modified [example](http://dusanbosnjak.com/test/webGL/three-instanced-mesh/webgl_performance_doublesided.html) running 30k objects instead of 5. All of the objects should be drawn with one draw call, thus speeding things up. It does a simple transformation of normals to view space if the instances are known to be uniformly scaled. If not, it does a mat3 inversion on the gpu (yikes!) but it works. \r\n\r\n- [Working with shadows.](http://dusanbosnjak.com/test/webGL/three-instanced-mesh/webgl_instanced_mesh_v4.html)\r\n- [An attampt at \"auto instancing\"](http://dusanbosnjak.com/test/webGL/three-auto-instancing/)\r\n\r\nSo for example, if you have static world assets that need to be scattered, you can group them with this thus saving a bit of memory (over merging) and a bit of overhead ( less draw calls ). You should still probably take care of how the assets are grouped so they could be culled. The class computes no bounding information. Swithing to different geometries should be really fast since only one is uploaded to the gpu, it shouldn't stutter much when initializing new geometry (when you first change the box to a sphere in the example).\r\n\r\nIn order to pull this off with three.js you need some 400 lines of code as per this example. https://raw.githubusercontent.com/mrdoob/three.js/dev/examples/webgl_buffergeometry_instancing_lambert.html\r\n\r\n# how it works\r\n\r\n- Including the module will allow the usage of `THREE.InstancedMesh` constructor. This will also patch different shader chunks to attach the instancing logic to `THREE.ShaderChunks{}` (overrides certain chunks).\r\n- A `THREE.InstancedBufferGeometry` is instantiated and the provided `THREE.BufferGeometry` argument copied into it (instancing only works on `InstancedBufferGeometry`).\r\n- Three optimization flags - `dynamic`, `uniformScale` and `colors` are set. These should only be provided upon construction. `color` would instantiate another buffer which is wasteful if not used, `uniform` would require a shader recompilation (when false it uses a branch in glsl to do a heavy matrix computation), `dynamic` sets a buffer of a different type and is a property of `THREE.BufferGeometry`.\r\n- Instancing attributes are set taking these flags into consideration (`instancePosition`,`instanceQuaternion` and `instanceScale` are always created, `instanceColor` depends on the flag). Their arrays are **not instantiated**. *The idea behind this is noble, why do any work you are going to make reduntant right away. Scale on the other hand can likely be just 1,1,1, maybe an optional method to \"init\" the mesh should be provided? Please give feedback*\r\n- **The provided material is cloned.** It needs to be decorated with defines, `customDistanceMaterial` and `customDepthMaterial` in order to allow for instancing to interact with the rest of three's rendering logic that relies on depth (shadows, AO...). Three manages the default materials under the hood of `THREE.WebGLRenderer`. Internally it holds a cache of shader programs which are created based on the properties of a `Material` (and other stuff like lights). In order to not alter the renderer. This is all done here through a fancy `.material` setter, which is not the most elegant solution. *Please provide feedback and use cases.*\r\n- Methods are used to fill buffers. \r\n\r\n# Usage\r\n\r\n[![NPM](https://nodei.co/npm/three-instanced-mesh.png)](https://npmjs.org/package/three-instanced-mesh)\r\n\r\n```javascript\r\n\r\n//var InstancedMesh = require('three-instanced-mesh')( THREE ); //should replace shaders on first call\r\n\r\n//or just patch three\r\nrequire( 'three-instanced-mesh' )(THREE);\r\n\r\n//geometry to be instanced\r\nvar boxGeometry = new THREE.BoxBufferGeometry(2,2,2,1,1,1);\r\n\r\n//material that the geometry will use\r\nvar material = new THREE.MeshPhongMaterial();\r\n\r\n//the instance group\r\nvar cluster = new THREE.InstancedMesh( \r\n  boxGeometry,                 //this is the same \r\n  material, \r\n  10000,                       //instance count\r\n  false,                       //is it dynamic\r\n  false                        //does it have color\r\n  true,                        //uniform scale, if you know that the placement function will not do a non-uniform scale, this will optimize the shader\r\n);\r\n\r\nvar _v3 = new THREE.Vector3();\r\nvar _q = new THREE.Quaternion();\r\n\r\nfor ( var i = 0 ; i < 10000 ; i ++ ) {\r\n  \r\n  cluster.setQuaternionAt( i , _q );\r\n  cluster.setPositionAt( i , _v3.set( Math.random() , Math.random(), Math.random() ) );\r\n  cluster.setScaleAt( i , _v3.set(1,1,1) );\r\n\r\n}\r\n\r\nscene.add( cluster );\r\n```\r\n\r\n## please provide feedback or examples use cases:)\r\n\r\n\r\nA man once stopped me in the street down in the TenderLoin and asked me \"What's the best nation?\" and I said \"Giants!\" thinking he said \"Who's the best in the nation?\". The answer was \"Donation\". If you find this useful you can totally support it by [donating to my pizza budget](http://paypal.me/pailhead) :) \r\n","readmeFilename":"README.md"}