From 7b4dedf0ce66c405d6a4c4006862350053c71127 Mon Sep 17 00:00:00 2001 From: mattkae Date: Sat, 29 Jan 2022 10:44:32 -0500 Subject: Doing undamped simulation correctly --- 2d/softbody/softbody_1/dist/output.js | 26 ++++++++++++++++++++++++++ 2d/softbody/softbody_1/dist/output.wasm | Bin 69005 -> 69604 bytes 2 files changed, 26 insertions(+) (limited to '2d/softbody/softbody_1/dist') 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, diff --git a/2d/softbody/softbody_1/dist/output.wasm b/2d/softbody/softbody_1/dist/output.wasm index 4c82a10..b034adc 100755 Binary files a/2d/softbody/softbody_1/dist/output.wasm and b/2d/softbody/softbody_1/dist/output.wasm differ -- cgit v1.2.1