summaryrefslogtreecommitdiff
path: root/2d/softbody/softbody_1/dist/output.js
diff options
context:
space:
mode:
authormattkae <mattkae@protonmail.com>2022-01-29 10:44:32 -0500
committermattkae <mattkae@protonmail.com>2022-01-29 10:44:32 -0500
commit7b4dedf0ce66c405d6a4c4006862350053c71127 (patch)
treea44b4f7634c035b366bdbc859596af91ba9b64d2 /2d/softbody/softbody_1/dist/output.js
parent606d9ee1f0f11727471e133cc001c83c0d47e9df (diff)
Doing undamped simulation correctly
Diffstat (limited to '2d/softbody/softbody_1/dist/output.js')
-rw-r--r--2d/softbody/softbody_1/dist/output.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/2d/softbody/softbody_1/dist/output.js b/2d/softbody/softbody_1/dist/output.js
index 9de60fb..9992b73 100644
--- a/2d/softbody/softbody_1/dist/output.js
+++ b/2d/softbody/softbody_1/dist/output.js
@@ -2676,6 +2676,31 @@ var ASM_CONSTS = {
GL.postDrawHandleClientVertexAttribBindings();
}
+ function _glDrawElements(mode, count, type, indices) {
+ var buf;
+ if (!GLctx.currentElementArrayBufferBinding) {
+ var size = GL.calcBufLength(1, type, 0, count);
+ buf = GL.getTempIndexBuffer(size);
+ GLctx.bindBuffer(0x8893 /*GL_ELEMENT_ARRAY_BUFFER*/, buf);
+ GLctx.bufferSubData(0x8893 /*GL_ELEMENT_ARRAY_BUFFER*/,
+ 0,
+ HEAPU8.subarray(indices, indices + size));
+ // the index is now 0
+ indices = 0;
+ }
+
+ // bind any client-side buffers
+ GL.preDrawHandleClientVertexAttribBindings(count);
+
+ GLctx.drawElements(mode, count, type, indices);
+
+ GL.postDrawHandleClientVertexAttribBindings(count);
+
+ if (!GLctx.currentElementArrayBufferBinding) {
+ GLctx.bindBuffer(0x8893 /*GL_ELEMENT_ARRAY_BUFFER*/, null);
+ }
+ }
+
function _glEnable(x0) { GLctx['enable'](x0) }
function _glEnableVertexAttribArray(index) {
@@ -3059,6 +3084,7 @@ var asmLibraryArg = {
"glDepthFunc": _glDepthFunc,
"glDepthMask": _glDepthMask,
"glDrawArrays": _glDrawArrays,
+ "glDrawElements": _glDrawElements,
"glEnable": _glEnable,
"glEnableVertexAttribArray": _glEnableVertexAttribArray,
"glGenBuffers": _glGenBuffers,