micugl 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var w=Object.defineProperty;var b=(d,r,o)=>r in d?w(d,r,{enumerable:!0,configurable:!0,writable:!0,value:o}):d[r]=o;var m=(d,r,o)=>b(d,typeof r!="symbol"?r+"":r,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./FBOManager.js");class p{constructor(r,o){m(this,"gl");m(this,"fboManager");m(this,"resources",new Map);m(this,"compileCache",new Map);m(this,"uniformUpdateFns",new Map);m(this,"extensions",new Map);const t={alpha:!1,depth:!1,stencil:!1,antialias:!1,powerPreference:"low-power",preserveDrawingBuffer:!1},e=r.getContext("webgl",{...t,...o});if(!e)throw new Error("WebGL not supported");this.gl=e,this.fboManager=new E.FBOManager(e),this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_vertex_array_object"),this.getExtension("ANGLE_instanced_arrays")}getExtension(r){if(this.extensions.has(r))return this.extensions.get(r);const o=this.gl.getExtension(r);return this.extensions.set(r,o),o}createProgram(r,o){const{vertexShader:t,fragmentShader:e,uniforms:s,attributes:i}=o,n=this.gl,h=this.getOrCompileShader("vertex:"+t,n.VERTEX_SHADER,t),l=this.getOrCompileShader("fragment:"+e,n.FRAGMENT_SHADER,e),f=n.createProgram();if(!f)throw new Error("Failed to create WebGL program");if(n.attachShader(f,h),n.attachShader(f,l),n.linkProgram(f),!n.getProgramParameter(f,n.LINK_STATUS)){const g=n.getProgramInfoLog(f);throw n.deleteProgram(f),new Error(`Could not link shader program: ${g}`)}const c={};for(const g of s)c[g.name]=n.getUniformLocation(f,g.name);const u={};if(i)for(const g of i)u[g.name]=n.getAttribLocation(f,g.name);const a={program:f,uniforms:c,attributes:u,buffers:{}};return this.resources.set(r,a),this.uniformUpdateFns.set(r,new Map),a}getOrCompileShader(r,o,t){if(this.compileCache.has(r)){const s=this.compileCache.get(r);if(s)return s}const e=this.compileShader(o,t);return this.compileCache.set(r,e),e}compileShader(r,o){const t=this.gl,e=t.createShader(r);if(!e)throw new Error("Failed to create shader");if(t.shaderSource(e,o),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(e);throw t.deleteShader(e),new Error(`Shader compilation failed: ${s}`)}return e}createBuffer(r,o,t){const e=this.gl,s=this.resources.get(r);if(!s)throw new Error(`Program with id ${r} not found`);const i=e.createBuffer();if(!i)throw new Error("Failed to create buffer");return e.bindBuffer(e.ARRAY_BUFFER,i),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),s.buffers[o]={buffer:i,data:t},i}updateBuffer(r,o,t){const e=this.gl,s=this.resources.get(r);if(!s)throw new Error(`Program with id ${r} not found`);const i=s.buffers[o];if(!i)throw new Error(`Buffer for attribute ${o} not found`);e.bindBuffer(e.ARRAY_BUFFER,i.buffer),e.bufferData(e.ARRAY_BUFFER,t,e.STATIC_DRAW),i.data=t}registerUniformUpdater(r,o,t,e){const s=this.resources.get(r);if(!s)throw new Error(`Program with id ${r} not found`);const i=this.uniformUpdateFns.get(r);if(!i)throw new Error(`Program uniforms for id ${r} not found`);const n=s.uniforms[o];if(n===null)return;const h=this.gl;let l;switch(t){case"int":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform1i(n,a),a};break;case"float":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform1f(n,a),a};break;case"sampler2D":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform1i(n,a),a};break;case"vec2":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform2fv(n,a),a};break;case"vec3":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform3fv(n,a),a};break;case"vec4":l=(f,c,u)=>{const a=e(f,c,u);return h.uniform4fv(n,a),a};break;case"mat2":l=(f,c,u)=>{const a=e(f,c,u);return h.uniformMatrix2fv(n,!1,a),a};break;case"mat3":l=(f,c,u)=>{const a=e(f,c,u);return h.uniformMatrix3fv(n,!1,a),a};break;case"mat4":l=(f,c,u)=>{const a=e(f,c,u);return h.uniformMatrix4fv(n,!1,a),a};break;default:throw new Error(`Unsupported uniform type: ${t}`)}i.set(o,l)}updateUniforms(r,o){const t=this.uniformUpdateFns.get(r);if(!t)return;const e=this.gl.canvas,s=e.width,i=e.height;t.forEach(n=>{n(o,s,i)})}setSize(r,o,t,e){const s=this.gl.canvas,i=t??r,n=e??o;(s.width!==r||s.height!==o)&&(s.width=r,s.height=o,this.gl.viewport(0,0,r,o)),s.style.width=`${i}px`,s.style.height=`${n}px`}prepareRender(r,o={}){const{clear:t=!0,clearColor:e=[0,0,0,1]}=o,s=this.gl,i=this.resources.get(r);if(!i)throw new Error(`Program with id ${r} not found`);s.useProgram(i.program),t&&(s.clearColor(...e),s.clear(s.COLOR_BUFFER_BIT))}fastRender(r,o,t=!0){const e=this.gl,s=this.resources.get(r);if(!s)throw new Error(`Program with id ${r} not found`);e.useProgram(s.program),t&&e.clear(e.COLOR_BUFFER_BIT),this.updateUniforms(r,o)}setUniform(r,o,t,e){const s=this.gl,i=this.resources.get(r);if(!i)throw new Error(`Program with id ${r} not found`);const n=i.uniforms[o];if(n!==null)switch(s.useProgram(i.program),e){case"float":s.uniform1f(n,t);break;case"vec2":s.uniform2fv(n,t);break;case"vec3":s.uniform3fv(n,t);break;case"vec4":s.uniform4fv(n,t);break;case"int":s.uniform1i(n,t);break;case"mat2":s.uniformMatrix2fv(n,!1,t);break;case"mat3":s.uniformMatrix3fv(n,!1,t);break;case"mat4":s.uniformMatrix4fv(n,!1,t);break;case"sampler2D":s.uniform1i(n,t);break;default:throw new Error(`Unsupported uniform type: ${e}`)}}setAttributeOnce(r,o,t){const e=this.gl,s=this.resources.get(r);if(!s)throw new Error(`Program with id ${r} not found`);const i=s.attributes[o];if(i===-1){console.warn(`Attribute ${o} not found or is unused`);return}const n=s.buffers[o];if(!n)throw new Error(`Buffer for attribute ${o} not found`);if(e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.enableVertexAttribArray(i),e.vertexAttribPointer(i,t.size,e[t.type],t.normalized,t.stride,t.offset),t.instanced){const h=this.getExtension("ANGLE_instanced_arrays");if(h!=null&&h.vertexAttribDivisorANGLE)h.vertexAttribDivisorANGLE(i,1);else if(e.vertexAttribDivisor)e.vertexAttribDivisor(i,1);else throw new Error("Instanced rendering not supported")}}drawArrays(r,o,t){this.gl.drawArrays(r,o,t)}drawElements(r,o,t,e){this.gl.drawElements(r,o,t,e)}destroy(r){const o=this.gl,t=this.resources.get(r);t&&(Object.values(t.buffers).forEach(({buffer:e})=>{o.deleteBuffer(e)}),o.deleteProgram(t.program),this.resources.delete(r),this.uniformUpdateFns.delete(r))}destroyAll(){for(const r of Array.from(this.resources.keys()))this.destroy(r);this.compileCache.clear(),this.fboManager.destroyAll()}get context(){return this.gl}get fbo(){return this.fboManager}}exports.WebGLManager=p;
1
+ "use strict";var b=Object.defineProperty;var A=(d,e,o)=>e in d?b(d,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):d[e]=o;var w=(d,e,o)=>A(d,typeof e!="symbol"?e+"":e,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("./FBOManager.js");class v{constructor(e,o){w(this,"gl");w(this,"fboManager");w(this,"resources",new Map);w(this,"compileCache",new Map);w(this,"uniformUpdateFns",new Map);w(this,"extensions",new Map);const t={alpha:!1,depth:!1,stencil:!1,antialias:!1,powerPreference:"low-power",preserveDrawingBuffer:!1},r=e.getContext("webgl",{...t,...o});if(!r)throw new Error("WebGL not supported");this.gl=r,this.fboManager=new E.FBOManager(r),this.getExtension("OES_texture_float"),this.getExtension("OES_texture_float_linear"),this.getExtension("OES_vertex_array_object"),this.getExtension("ANGLE_instanced_arrays")}getExtension(e){if(this.extensions.has(e))return this.extensions.get(e);const o=this.gl.getExtension(e);return this.extensions.set(e,o),o}createProgram(e,o){const{vertexShader:t,fragmentShader:r,uniforms:s,attributes:f}=o,n=this.gl,u=this.getOrCompileShader("vertex:"+t,n.VERTEX_SHADER,t),m=this.getOrCompileShader("fragment:"+r,n.FRAGMENT_SHADER,r),i=n.createProgram();if(!i)throw new Error("Failed to create WebGL program");if(n.attachShader(i,u),n.attachShader(i,m),n.linkProgram(i),!n.getProgramParameter(i,n.LINK_STATUS)){const a=n.getProgramInfoLog(i);throw n.deleteProgram(i),new Error(`Could not link shader program: ${a}`)}const l={};for(const a of s)l[a.name]=n.getUniformLocation(i,a.name);const h={};if(f)for(const a of f)h[a.name]=n.getAttribLocation(i,a.name);const c={program:i,uniforms:l,attributes:h,buffers:{}};return this.resources.set(e,c),this.uniformUpdateFns.set(e,new Map),c}getOrCompileShader(e,o,t){if(this.compileCache.has(e)){const s=this.compileCache.get(e);if(s)return s}const r=this.compileShader(o,t);return this.compileCache.set(e,r),r}compileShader(e,o){const t=this.gl,r=t.createShader(e);if(!r)throw new Error("Failed to create shader");if(t.shaderSource(r,o),t.compileShader(r),!t.getShaderParameter(r,t.COMPILE_STATUS)){const s=t.getShaderInfoLog(r);throw t.deleteShader(r),new Error(`Shader compilation failed: ${s}`)}return r}createBuffer(e,o,t){const r=this.gl,s=this.resources.get(e);if(!s)throw new Error(`Program with id ${e} not found`);const f=r.createBuffer();if(!f)throw new Error("Failed to create buffer");return r.bindBuffer(r.ARRAY_BUFFER,f),r.bufferData(r.ARRAY_BUFFER,t,r.STATIC_DRAW),s.buffers[o]={buffer:f,data:t},f}updateBuffer(e,o,t){const r=this.gl,s=this.resources.get(e);if(!s)throw new Error(`Program with id ${e} not found`);const f=s.buffers[o];if(!f)throw new Error(`Buffer for attribute ${o} not found`);r.bindBuffer(r.ARRAY_BUFFER,f.buffer),r.bufferData(r.ARRAY_BUFFER,t,r.STATIC_DRAW),f.data=t}registerUniformUpdater(e,o,t,r){const s=this.resources.get(e);if(!s)throw new Error(`Program with id ${e} not found`);const f=this.uniformUpdateFns.get(e);if(!f)throw new Error(`Program uniforms for id ${e} not found`);const n=s.uniforms[o];if(n===null)return;const u=this.gl;let m;switch(t){case"int":m=(i,l,h)=>{const c=r(i,l,h);return u.uniform1i(n,c),c};break;case"float":m=(i,l,h)=>{const c=r(i,l,h);return u.uniform1f(n,c),c};break;case"sampler2D":m=(i,l,h)=>{const c=r(i,l,h);return u.uniform1i(n,c),c};break;case"vec2":{const i=new Float32Array(2);m=(l,h,c)=>{const a=r(l,h,c);return Array.isArray(a)?(i[0]=a[0],i[1]=a[1],u.uniform2fv(n,i)):u.uniform2fv(n,a),i};break}case"vec3":{const i=new Float32Array(3);m=(l,h,c)=>{const a=r(l,h,c);return Array.isArray(a)?(i[0]=a[0],i[1]=a[1],i[2]=a[2],u.uniform3fv(n,i)):u.uniform3fv(n,a),i};break}case"vec4":{const i=new Float32Array(4);m=(l,h,c)=>{const a=r(l,h,c);return Array.isArray(a)?(i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3],u.uniform4fv(n,i)):u.uniform4fv(n,a),i};break}case"mat2":{const i=new Float32Array(4);m=(l,h,c)=>{const a=r(l,h,c);if(Array.isArray(a)){for(let g=0;g<4;g++)i[g]=a[g];u.uniformMatrix2fv(n,!1,i)}else u.uniformMatrix2fv(n,!1,a);return i};break}case"mat3":{const i=new Float32Array(9);m=(l,h,c)=>{const a=r(l,h,c);if(Array.isArray(a)){for(let g=0;g<9;g++)i[g]=a[g];u.uniformMatrix3fv(n,!1,i)}else u.uniformMatrix3fv(n,!1,a);return i};break}case"mat4":{const i=new Float32Array(16);m=(l,h,c)=>{const a=r(l,h,c);if(Array.isArray(a)){for(let g=0;g<16;g++)i[g]=a[g];u.uniformMatrix4fv(n,!1,i)}else u.uniformMatrix4fv(n,!1,a);return i};break}default:throw new Error(`Unsupported uniform type: ${t}`)}f.set(o,m)}updateUniforms(e,o){const t=this.uniformUpdateFns.get(e);if(!t)return;const r=this.gl.canvas,s=r.width,f=r.height;t.forEach(n=>{n(o,s,f)})}setSize(e,o,t,r){const s=this.gl.canvas,f=t??e,n=r??o;(s.width!==e||s.height!==o)&&(s.width=e,s.height=o,this.gl.viewport(0,0,e,o)),s.style.width=`${f}px`,s.style.height=`${n}px`}prepareRender(e,o={}){const{clear:t=!0,clearColor:r=[0,0,0,1]}=o,s=this.gl,f=this.resources.get(e);if(!f)throw new Error(`Program with id ${e} not found`);s.useProgram(f.program),t&&(s.clearColor(...r),s.clear(s.COLOR_BUFFER_BIT))}fastRender(e,o,t=!0){const r=this.gl,s=this.resources.get(e);if(!s)throw new Error(`Program with id ${e} not found`);r.useProgram(s.program),t&&r.clear(r.COLOR_BUFFER_BIT),this.updateUniforms(e,o)}setUniform(e,o,t,r){const s=this.gl,f=this.resources.get(e);if(!f)throw new Error(`Program with id ${e} not found`);const n=f.uniforms[o];if(n!==null)switch(s.useProgram(f.program),r){case"float":s.uniform1f(n,t);break;case"vec2":s.uniform2fv(n,t);break;case"vec3":s.uniform3fv(n,t);break;case"vec4":s.uniform4fv(n,t);break;case"int":s.uniform1i(n,t);break;case"mat2":s.uniformMatrix2fv(n,!1,t);break;case"mat3":s.uniformMatrix3fv(n,!1,t);break;case"mat4":s.uniformMatrix4fv(n,!1,t);break;case"sampler2D":s.uniform1i(n,t);break;default:throw new Error(`Unsupported uniform type: ${r}`)}}setAttributeOnce(e,o,t){const r=this.gl,s=this.resources.get(e);if(!s)throw new Error(`Program with id ${e} not found`);const f=s.attributes[o];if(f===-1){console.warn(`Attribute ${o} not found or is unused`);return}const n=s.buffers[o];if(!n)throw new Error(`Buffer for attribute ${o} not found`);if(r.bindBuffer(r.ARRAY_BUFFER,n.buffer),r.enableVertexAttribArray(f),r.vertexAttribPointer(f,t.size,r[t.type],t.normalized,t.stride,t.offset),t.instanced){const u=this.getExtension("ANGLE_instanced_arrays");if(u!=null&&u.vertexAttribDivisorANGLE)u.vertexAttribDivisorANGLE(f,1);else if(r.vertexAttribDivisor)r.vertexAttribDivisor(f,1);else throw new Error("Instanced rendering not supported")}}drawArrays(e,o,t){this.gl.drawArrays(e,o,t)}drawElements(e,o,t,r){this.gl.drawElements(e,o,t,r)}destroy(e){const o=this.gl,t=this.resources.get(e);t&&(Object.values(t.buffers).forEach(({buffer:r})=>{o.deleteBuffer(r)}),o.deleteProgram(t.program),this.resources.delete(e),this.uniformUpdateFns.delete(e))}destroyAll(){for(const e of Array.from(this.resources.keys()))this.destroy(e);this.compileCache.clear(),this.fboManager.destroyAll()}get context(){return this.gl}get fbo(){return this.fboManager}}exports.WebGLManager=v;
@@ -1,15 +1,15 @@
1
- var d = Object.defineProperty;
2
- var b = (w, e, o) => e in w ? d(w, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : w[e] = o;
3
- var m = (w, e, o) => b(w, typeof e != "symbol" ? e + "" : e, o);
1
+ var b = Object.defineProperty;
2
+ var A = (d, e, o) => e in d ? b(d, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : d[e] = o;
3
+ var w = (d, e, o) => A(d, typeof e != "symbol" ? e + "" : e, o);
4
4
  import { FBOManager as E } from "./FBOManager.mjs";
5
- class A {
5
+ class x {
6
6
  constructor(e, o) {
7
- m(this, "gl");
8
- m(this, "fboManager");
9
- m(this, "resources", /* @__PURE__ */ new Map());
10
- m(this, "compileCache", /* @__PURE__ */ new Map());
11
- m(this, "uniformUpdateFns", /* @__PURE__ */ new Map());
12
- m(this, "extensions", /* @__PURE__ */ new Map());
7
+ w(this, "gl");
8
+ w(this, "fboManager");
9
+ w(this, "resources", /* @__PURE__ */ new Map());
10
+ w(this, "compileCache", /* @__PURE__ */ new Map());
11
+ w(this, "uniformUpdateFns", /* @__PURE__ */ new Map());
12
+ w(this, "extensions", /* @__PURE__ */ new Map());
13
13
  const t = {
14
14
  alpha: !1,
15
15
  depth: !1,
@@ -29,27 +29,27 @@ class A {
29
29
  return this.extensions.set(e, o), o;
30
30
  }
31
31
  createProgram(e, o) {
32
- const { vertexShader: t, fragmentShader: r, uniforms: s, attributes: i } = o, n = this.gl, h = this.getOrCompileShader("vertex:" + t, n.VERTEX_SHADER, t), l = this.getOrCompileShader("fragment:" + r, n.FRAGMENT_SHADER, r), f = n.createProgram();
33
- if (!f)
32
+ const { vertexShader: t, fragmentShader: r, uniforms: s, attributes: f } = o, n = this.gl, u = this.getOrCompileShader("vertex:" + t, n.VERTEX_SHADER, t), m = this.getOrCompileShader("fragment:" + r, n.FRAGMENT_SHADER, r), i = n.createProgram();
33
+ if (!i)
34
34
  throw new Error("Failed to create WebGL program");
35
- if (n.attachShader(f, h), n.attachShader(f, l), n.linkProgram(f), !n.getProgramParameter(f, n.LINK_STATUS)) {
36
- const g = n.getProgramInfoLog(f);
37
- throw n.deleteProgram(f), new Error(`Could not link shader program: ${g}`);
35
+ if (n.attachShader(i, u), n.attachShader(i, m), n.linkProgram(i), !n.getProgramParameter(i, n.LINK_STATUS)) {
36
+ const a = n.getProgramInfoLog(i);
37
+ throw n.deleteProgram(i), new Error(`Could not link shader program: ${a}`);
38
38
  }
39
- const c = {};
40
- for (const g of s)
41
- c[g.name] = n.getUniformLocation(f, g.name);
42
- const u = {};
43
- if (i)
44
- for (const g of i)
45
- u[g.name] = n.getAttribLocation(f, g.name);
46
- const a = {
47
- program: f,
48
- uniforms: c,
49
- attributes: u,
39
+ const l = {};
40
+ for (const a of s)
41
+ l[a.name] = n.getUniformLocation(i, a.name);
42
+ const h = {};
43
+ if (f)
44
+ for (const a of f)
45
+ h[a.name] = n.getAttribLocation(i, a.name);
46
+ const c = {
47
+ program: i,
48
+ uniforms: l,
49
+ attributes: h,
50
50
  buffers: {}
51
51
  };
52
- return this.resources.set(e, a), this.uniformUpdateFns.set(e, /* @__PURE__ */ new Map()), a;
52
+ return this.resources.set(e, c), this.uniformUpdateFns.set(e, /* @__PURE__ */ new Map()), c;
53
53
  }
54
54
  getOrCompileShader(e, o, t) {
55
55
  if (this.compileCache.has(e)) {
@@ -74,110 +74,137 @@ class A {
74
74
  const r = this.gl, s = this.resources.get(e);
75
75
  if (!s)
76
76
  throw new Error(`Program with id ${e} not found`);
77
- const i = r.createBuffer();
78
- if (!i)
77
+ const f = r.createBuffer();
78
+ if (!f)
79
79
  throw new Error("Failed to create buffer");
80
- return r.bindBuffer(r.ARRAY_BUFFER, i), r.bufferData(r.ARRAY_BUFFER, t, r.STATIC_DRAW), s.buffers[o] = { buffer: i, data: t }, i;
80
+ return r.bindBuffer(r.ARRAY_BUFFER, f), r.bufferData(r.ARRAY_BUFFER, t, r.STATIC_DRAW), s.buffers[o] = { buffer: f, data: t }, f;
81
81
  }
82
82
  updateBuffer(e, o, t) {
83
83
  const r = this.gl, s = this.resources.get(e);
84
84
  if (!s)
85
85
  throw new Error(`Program with id ${e} not found`);
86
- const i = s.buffers[o];
87
- if (!i)
86
+ const f = s.buffers[o];
87
+ if (!f)
88
88
  throw new Error(`Buffer for attribute ${o} not found`);
89
- r.bindBuffer(r.ARRAY_BUFFER, i.buffer), r.bufferData(r.ARRAY_BUFFER, t, r.STATIC_DRAW), i.data = t;
89
+ r.bindBuffer(r.ARRAY_BUFFER, f.buffer), r.bufferData(r.ARRAY_BUFFER, t, r.STATIC_DRAW), f.data = t;
90
90
  }
91
91
  registerUniformUpdater(e, o, t, r) {
92
92
  const s = this.resources.get(e);
93
93
  if (!s)
94
94
  throw new Error(`Program with id ${e} not found`);
95
- const i = this.uniformUpdateFns.get(e);
96
- if (!i)
95
+ const f = this.uniformUpdateFns.get(e);
96
+ if (!f)
97
97
  throw new Error(`Program uniforms for id ${e} not found`);
98
98
  const n = s.uniforms[o];
99
99
  if (n === null)
100
100
  return;
101
- const h = this.gl;
102
- let l;
101
+ const u = this.gl;
102
+ let m;
103
103
  switch (t) {
104
104
  case "int":
105
- l = (f, c, u) => {
106
- const a = r(f, c, u);
107
- return h.uniform1i(n, a), a;
105
+ m = (i, l, h) => {
106
+ const c = r(i, l, h);
107
+ return u.uniform1i(n, c), c;
108
108
  };
109
109
  break;
110
110
  case "float":
111
- l = (f, c, u) => {
112
- const a = r(f, c, u);
113
- return h.uniform1f(n, a), a;
111
+ m = (i, l, h) => {
112
+ const c = r(i, l, h);
113
+ return u.uniform1f(n, c), c;
114
114
  };
115
115
  break;
116
116
  case "sampler2D":
117
- l = (f, c, u) => {
118
- const a = r(f, c, u);
119
- return h.uniform1i(n, a), a;
117
+ m = (i, l, h) => {
118
+ const c = r(i, l, h);
119
+ return u.uniform1i(n, c), c;
120
120
  };
121
121
  break;
122
- case "vec2":
123
- l = (f, c, u) => {
124
- const a = r(f, c, u);
125
- return h.uniform2fv(n, a), a;
122
+ case "vec2": {
123
+ const i = new Float32Array(2);
124
+ m = (l, h, c) => {
125
+ const a = r(l, h, c);
126
+ return Array.isArray(a) ? (i[0] = a[0], i[1] = a[1], u.uniform2fv(n, i)) : u.uniform2fv(n, a), i;
126
127
  };
127
128
  break;
128
- case "vec3":
129
- l = (f, c, u) => {
130
- const a = r(f, c, u);
131
- return h.uniform3fv(n, a), a;
129
+ }
130
+ case "vec3": {
131
+ const i = new Float32Array(3);
132
+ m = (l, h, c) => {
133
+ const a = r(l, h, c);
134
+ return Array.isArray(a) ? (i[0] = a[0], i[1] = a[1], i[2] = a[2], u.uniform3fv(n, i)) : u.uniform3fv(n, a), i;
132
135
  };
133
136
  break;
134
- case "vec4":
135
- l = (f, c, u) => {
136
- const a = r(f, c, u);
137
- return h.uniform4fv(n, a), a;
137
+ }
138
+ case "vec4": {
139
+ const i = new Float32Array(4);
140
+ m = (l, h, c) => {
141
+ const a = r(l, h, c);
142
+ return Array.isArray(a) ? (i[0] = a[0], i[1] = a[1], i[2] = a[2], i[3] = a[3], u.uniform4fv(n, i)) : u.uniform4fv(n, a), i;
138
143
  };
139
144
  break;
140
- case "mat2":
141
- l = (f, c, u) => {
142
- const a = r(f, c, u);
143
- return h.uniformMatrix2fv(n, !1, a), a;
145
+ }
146
+ case "mat2": {
147
+ const i = new Float32Array(4);
148
+ m = (l, h, c) => {
149
+ const a = r(l, h, c);
150
+ if (Array.isArray(a)) {
151
+ for (let g = 0; g < 4; g++) i[g] = a[g];
152
+ u.uniformMatrix2fv(n, !1, i);
153
+ } else
154
+ u.uniformMatrix2fv(n, !1, a);
155
+ return i;
144
156
  };
145
157
  break;
146
- case "mat3":
147
- l = (f, c, u) => {
148
- const a = r(f, c, u);
149
- return h.uniformMatrix3fv(n, !1, a), a;
158
+ }
159
+ case "mat3": {
160
+ const i = new Float32Array(9);
161
+ m = (l, h, c) => {
162
+ const a = r(l, h, c);
163
+ if (Array.isArray(a)) {
164
+ for (let g = 0; g < 9; g++) i[g] = a[g];
165
+ u.uniformMatrix3fv(n, !1, i);
166
+ } else
167
+ u.uniformMatrix3fv(n, !1, a);
168
+ return i;
150
169
  };
151
170
  break;
152
- case "mat4":
153
- l = (f, c, u) => {
154
- const a = r(f, c, u);
155
- return h.uniformMatrix4fv(n, !1, a), a;
171
+ }
172
+ case "mat4": {
173
+ const i = new Float32Array(16);
174
+ m = (l, h, c) => {
175
+ const a = r(l, h, c);
176
+ if (Array.isArray(a)) {
177
+ for (let g = 0; g < 16; g++) i[g] = a[g];
178
+ u.uniformMatrix4fv(n, !1, i);
179
+ } else
180
+ u.uniformMatrix4fv(n, !1, a);
181
+ return i;
156
182
  };
157
183
  break;
184
+ }
158
185
  default:
159
186
  throw new Error(`Unsupported uniform type: ${t}`);
160
187
  }
161
- i.set(o, l);
188
+ f.set(o, m);
162
189
  }
163
190
  updateUniforms(e, o) {
164
191
  const t = this.uniformUpdateFns.get(e);
165
192
  if (!t)
166
193
  return;
167
- const r = this.gl.canvas, s = r.width, i = r.height;
194
+ const r = this.gl.canvas, s = r.width, f = r.height;
168
195
  t.forEach((n) => {
169
- n(o, s, i);
196
+ n(o, s, f);
170
197
  });
171
198
  }
172
199
  setSize(e, o, t, r) {
173
- const s = this.gl.canvas, i = t ?? e, n = r ?? o;
174
- (s.width !== e || s.height !== o) && (s.width = e, s.height = o, this.gl.viewport(0, 0, e, o)), s.style.width = `${i}px`, s.style.height = `${n}px`;
200
+ const s = this.gl.canvas, f = t ?? e, n = r ?? o;
201
+ (s.width !== e || s.height !== o) && (s.width = e, s.height = o, this.gl.viewport(0, 0, e, o)), s.style.width = `${f}px`, s.style.height = `${n}px`;
175
202
  }
176
203
  prepareRender(e, o = {}) {
177
- const { clear: t = !0, clearColor: r = [0, 0, 0, 1] } = o, s = this.gl, i = this.resources.get(e);
178
- if (!i)
204
+ const { clear: t = !0, clearColor: r = [0, 0, 0, 1] } = o, s = this.gl, f = this.resources.get(e);
205
+ if (!f)
179
206
  throw new Error(`Program with id ${e} not found`);
180
- s.useProgram(i.program), t && (s.clearColor(...r), s.clear(s.COLOR_BUFFER_BIT));
207
+ s.useProgram(f.program), t && (s.clearColor(...r), s.clear(s.COLOR_BUFFER_BIT));
181
208
  }
182
209
  fastRender(e, o, t = !0) {
183
210
  const r = this.gl, s = this.resources.get(e);
@@ -186,12 +213,12 @@ class A {
186
213
  r.useProgram(s.program), t && r.clear(r.COLOR_BUFFER_BIT), this.updateUniforms(e, o);
187
214
  }
188
215
  setUniform(e, o, t, r) {
189
- const s = this.gl, i = this.resources.get(e);
190
- if (!i)
216
+ const s = this.gl, f = this.resources.get(e);
217
+ if (!f)
191
218
  throw new Error(`Program with id ${e} not found`);
192
- const n = i.uniforms[o];
219
+ const n = f.uniforms[o];
193
220
  if (n !== null)
194
- switch (s.useProgram(i.program), r) {
221
+ switch (s.useProgram(f.program), r) {
195
222
  case "float":
196
223
  s.uniform1f(n, t);
197
224
  break;
@@ -227,27 +254,27 @@ class A {
227
254
  const r = this.gl, s = this.resources.get(e);
228
255
  if (!s)
229
256
  throw new Error(`Program with id ${e} not found`);
230
- const i = s.attributes[o];
231
- if (i === -1) {
257
+ const f = s.attributes[o];
258
+ if (f === -1) {
232
259
  console.warn(`Attribute ${o} not found or is unused`);
233
260
  return;
234
261
  }
235
262
  const n = s.buffers[o];
236
263
  if (!n)
237
264
  throw new Error(`Buffer for attribute ${o} not found`);
238
- if (r.bindBuffer(r.ARRAY_BUFFER, n.buffer), r.enableVertexAttribArray(i), r.vertexAttribPointer(
239
- i,
265
+ if (r.bindBuffer(r.ARRAY_BUFFER, n.buffer), r.enableVertexAttribArray(f), r.vertexAttribPointer(
266
+ f,
240
267
  t.size,
241
268
  r[t.type],
242
269
  t.normalized,
243
270
  t.stride,
244
271
  t.offset
245
272
  ), t.instanced) {
246
- const h = this.getExtension("ANGLE_instanced_arrays");
247
- if (h != null && h.vertexAttribDivisorANGLE)
248
- h.vertexAttribDivisorANGLE(i, 1);
273
+ const u = this.getExtension("ANGLE_instanced_arrays");
274
+ if (u != null && u.vertexAttribDivisorANGLE)
275
+ u.vertexAttribDivisorANGLE(f, 1);
249
276
  else if (r.vertexAttribDivisor)
250
- r.vertexAttribDivisor(i, 1);
277
+ r.vertexAttribDivisor(f, 1);
251
278
  else
252
279
  throw new Error("Instanced rendering not supported");
253
280
  }
@@ -277,5 +304,5 @@ class A {
277
304
  }
278
305
  }
279
306
  export {
280
- A as WebGLManager
307
+ x as WebGLManager
281
308
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),c=require("react"),I=require("../../../core/managers/WebGLManager.js"),h={},v="",M={},U={},q=({programConfigs:E,renderCallback:p,renderOptions:o=h,className:F=v,style:y=M,width:T,height:w,uniformUpdaters:L=U,useFastPath:R=!1,useDevicePixelRatio:S=!0,pixelRatio:_})=>{const f=c.useRef(null),a=c.useRef(null),l=c.useRef(null),u=c.useRef(null),g=c.useRef(0),d=c.useRef(n=>{const e=a.current,r=l.current;if(!e||!r)return;const t=n-g.current,s=e.context;if(R)e.fastRender(r,t,o.clear),s.drawArrays(s.TRIANGLE_STRIP,0,4);else{const i=e.resources.get(r);if(!i)return;e.prepareRender(r,o),A(t,i,s)}u.current=requestAnimationFrame(d.current)}),A=c.useCallback((n,e,r)=>{p(n,e,r)},[p]);c.useEffect(()=>{d.current=n=>{const e=a.current,r=l.current;if(!e||!r)return;const t=n-g.current,s=e.context;if(R)e.fastRender(r,t,o.clear),s.drawArrays(s.TRIANGLE_STRIP,0,4);else{const i=e.resources.get(r);if(!i)return;e.prepareRender(r,o),A(t,i,s)}u.current=requestAnimationFrame(d.current)}},[o,R,A]);const m=c.useCallback(()=>{if(!f.current||!a.current)return;const n=T??window.innerWidth,e=w??window.innerHeight,r=_??(S?window.devicePixelRatio:1),t=Math.floor(n*r),s=Math.floor(e*r);a.current.setSize(t,s,n,e)},[S,_,T,w]);return c.useEffect(()=>{if(!f.current)return;const n=new I.WebGLManager(f.current);a.current=n,m();const[[e,r]]=Object.entries(E);return n.createProgram(e,r),n.createBuffer(e,"a_position",new Float32Array([-1,-1,1,-1,-1,1,1,1])),n.setAttributeOnce(e,"a_position",{name:"a_position",size:2,type:"FLOAT",normalized:!1,stride:0,offset:0}),l.current=e,g.current=performance.now(),u.current=requestAnimationFrame(d.current),window.addEventListener("resize",m),()=>{window.removeEventListener("resize",m),u.current&&cancelAnimationFrame(u.current),n.destroyAll()}},[E,m]),c.useEffect(()=>{const n=a.current,e=l.current;if(!n||!e)return;const r=L[e];r&&r.forEach(t=>{n.registerUniformUpdater(e,t.name,t.type,t.updateFn)})},[L]),b.jsx("canvas",{ref:f,className:F,style:y})};exports.ShaderEngine=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("react/jsx-runtime"),s=require("react"),h=require("../../../core/managers/WebGLManager.js"),I={},v="",M={},U={},q=({programConfigs:A,renderCallback:T,renderOptions:o=I,className:_=v,style:y=M,width:w,height:L,uniformUpdaters:f=U,useFastPath:g=!1,useDevicePixelRatio:F=!0,pixelRatio:S})=>{const l=s.useRef(null),a=s.useRef(null),d=s.useRef(null),i=s.useRef(null),E=s.useRef(0),m=s.useRef(n=>{const e=a.current,r=d.current;if(!e||!r)return;const t=n-E.current,c=e.context;if(g)e.fastRender(r,t,o.clear),c.drawArrays(c.TRIANGLE_STRIP,0,4);else{const u=e.resources.get(r);if(!u)return;e.prepareRender(r,o),p(t,u,c)}i.current=requestAnimationFrame(m.current)}),p=s.useCallback((n,e,r)=>{T(n,e,r)},[T]);s.useEffect(()=>{m.current=n=>{const e=a.current,r=d.current;if(!e||!r)return;const t=n-E.current,c=e.context;if(g)e.fastRender(r,t,o.clear),c.drawArrays(c.TRIANGLE_STRIP,0,4);else{const u=e.resources.get(r);if(!u)return;e.prepareRender(r,o),p(t,u,c)}i.current=requestAnimationFrame(m.current)}},[o,g,p]);const R=s.useCallback(()=>{if(!l.current||!a.current)return;const n=w??window.innerWidth,e=L??window.innerHeight,r=S??(F?window.devicePixelRatio:1),t=Math.floor(n*r),c=Math.floor(e*r);a.current.setSize(t,c,n,e)},[F,S,w,L]);return s.useEffect(()=>{if(!l.current)return;const n=new h.WebGLManager(l.current);a.current=n,R();const[[e,r]]=Object.entries(A);n.createProgram(e,r),n.createBuffer(e,"a_position",new Float32Array([-1,-1,1,-1,-1,1,1,1])),n.setAttributeOnce(e,"a_position",{name:"a_position",size:2,type:"FLOAT",normalized:!1,stride:0,offset:0}),d.current=e;const t=f[e];return t&&t.forEach(c=>{n.registerUniformUpdater(e,c.name,c.type,c.updateFn)}),E.current=performance.now(),i.current=requestAnimationFrame(m.current),window.addEventListener("resize",R),()=>{window.removeEventListener("resize",R),i.current&&cancelAnimationFrame(i.current),n.destroyAll()}},[A,R,f]),s.useEffect(()=>{const n=a.current,e=d.current;if(!n||!e)return;const r=f[e];r&&r.forEach(t=>{n.registerUniformUpdater(e,t.name,t.type,t.updateFn)})},[f]),b.jsx("canvas",{ref:l,className:_,style:y})};exports.ShaderEngine=q;
@@ -1,82 +1,86 @@
1
- import { jsx as h } from "react/jsx-runtime";
2
- import { useRef as s, useCallback as y, useEffect as g } from "react";
1
+ import { jsx as U } from "react/jsx-runtime";
2
+ import { useRef as s, useCallback as S, useEffect as E } from "react";
3
3
  import { WebGLManager as v } from "../../../core/managers/WebGLManager.mjs";
4
4
  const z = {}, N = "", b = {}, D = {}, q = ({
5
- programConfigs: E,
6
- renderCallback: T,
5
+ programConfigs: T,
6
+ renderCallback: w,
7
7
  renderOptions: a = z,
8
8
  className: I = N,
9
- style: U = b,
10
- width: w,
11
- height: L,
12
- uniformUpdaters: _ = D,
13
- useFastPath: p = !1,
14
- useDevicePixelRatio: F = !0,
15
- pixelRatio: S
9
+ style: h = b,
10
+ width: L,
11
+ height: F,
12
+ uniformUpdaters: f = D,
13
+ useFastPath: A = !1,
14
+ useDevicePixelRatio: _ = !0,
15
+ pixelRatio: y
16
16
  }) => {
17
- const f = s(null), o = s(null), m = s(null), i = s(null), A = s(0), d = s((n) => {
18
- const e = o.current, r = m.current;
17
+ const m = s(null), o = s(null), d = s(null), i = s(null), R = s(0), l = s((n) => {
18
+ const e = o.current, r = d.current;
19
19
  if (!e || !r) return;
20
- const t = n - A.current, c = e.context;
21
- if (p)
20
+ const t = n - R.current, c = e.context;
21
+ if (A)
22
22
  e.fastRender(r, t, a.clear), c.drawArrays(c.TRIANGLE_STRIP, 0, 4);
23
23
  else {
24
24
  const u = e.resources.get(r);
25
25
  if (!u) return;
26
- e.prepareRender(r, a), R(t, u, c);
26
+ e.prepareRender(r, a), g(t, u, c);
27
27
  }
28
- i.current = requestAnimationFrame(d.current);
29
- }), R = y((n, e, r) => {
30
- T(n, e, r);
31
- }, [T]);
32
- g(() => {
33
- d.current = (n) => {
34
- const e = o.current, r = m.current;
28
+ i.current = requestAnimationFrame(l.current);
29
+ }), g = S((n, e, r) => {
30
+ w(n, e, r);
31
+ }, [w]);
32
+ E(() => {
33
+ l.current = (n) => {
34
+ const e = o.current, r = d.current;
35
35
  if (!e || !r) return;
36
- const t = n - A.current, c = e.context;
37
- if (p)
36
+ const t = n - R.current, c = e.context;
37
+ if (A)
38
38
  e.fastRender(r, t, a.clear), c.drawArrays(c.TRIANGLE_STRIP, 0, 4);
39
39
  else {
40
40
  const u = e.resources.get(r);
41
41
  if (!u) return;
42
- e.prepareRender(r, a), R(t, u, c);
42
+ e.prepareRender(r, a), g(t, u, c);
43
43
  }
44
- i.current = requestAnimationFrame(d.current);
44
+ i.current = requestAnimationFrame(l.current);
45
45
  };
46
- }, [a, p, R]);
47
- const l = y(() => {
48
- if (!f.current || !o.current) return;
49
- const n = w ?? window.innerWidth, e = L ?? window.innerHeight, r = S ?? (F ? window.devicePixelRatio : 1), t = Math.floor(n * r), c = Math.floor(e * r);
46
+ }, [a, A, g]);
47
+ const p = S(() => {
48
+ if (!m.current || !o.current) return;
49
+ const n = L ?? window.innerWidth, e = F ?? window.innerHeight, r = y ?? (_ ? window.devicePixelRatio : 1), t = Math.floor(n * r), c = Math.floor(e * r);
50
50
  o.current.setSize(t, c, n, e);
51
- }, [F, S, w, L]);
52
- return g(() => {
53
- if (!f.current) return;
54
- const n = new v(f.current);
55
- o.current = n, l();
56
- const [[e, r]] = Object.entries(E);
57
- return n.createProgram(e, r), n.createBuffer(e, "a_position", new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])), n.setAttributeOnce(e, "a_position", {
51
+ }, [_, y, L, F]);
52
+ return E(() => {
53
+ if (!m.current) return;
54
+ const n = new v(m.current);
55
+ o.current = n, p();
56
+ const [[e, r]] = Object.entries(T);
57
+ n.createProgram(e, r), n.createBuffer(e, "a_position", new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1])), n.setAttributeOnce(e, "a_position", {
58
58
  name: "a_position",
59
59
  size: 2,
60
60
  type: "FLOAT",
61
61
  normalized: !1,
62
62
  stride: 0,
63
63
  offset: 0
64
- }), m.current = e, A.current = performance.now(), i.current = requestAnimationFrame(d.current), window.addEventListener("resize", l), () => {
65
- window.removeEventListener("resize", l), i.current && cancelAnimationFrame(i.current), n.destroyAll();
64
+ }), d.current = e;
65
+ const t = f[e];
66
+ return t && t.forEach((c) => {
67
+ n.registerUniformUpdater(e, c.name, c.type, c.updateFn);
68
+ }), R.current = performance.now(), i.current = requestAnimationFrame(l.current), window.addEventListener("resize", p), () => {
69
+ window.removeEventListener("resize", p), i.current && cancelAnimationFrame(i.current), n.destroyAll();
66
70
  };
67
- }, [E, l]), g(() => {
68
- const n = o.current, e = m.current;
71
+ }, [T, p, f]), E(() => {
72
+ const n = o.current, e = d.current;
69
73
  if (!n || !e) return;
70
- const r = _[e];
74
+ const r = f[e];
71
75
  r && r.forEach((t) => {
72
76
  n.registerUniformUpdater(e, t.name, t.type, t.updateFn);
73
77
  });
74
- }, [_]), /* @__PURE__ */ h(
78
+ }, [f]), /* @__PURE__ */ U(
75
79
  "canvas",
76
80
  {
77
- ref: f,
81
+ ref: m,
78
82
  className: I,
79
- style: U
83
+ style: h
80
84
  }
81
85
  );
82
86
  };
@@ -1,4 +1,6 @@
1
1
  import { UniformParam, UniformUpdaterDef } from '../../types';
2
2
  export declare const useUniformUpdaters: (programId: string, uniforms: Record<string, UniformParam>, options?: {
3
3
  skipDefaultUniforms?: boolean;
4
- }) => Record<string, UniformUpdaterDef<import('../../types').UniformType>[]>;
4
+ }) => {
5
+ [x: string]: UniformUpdaterDef<import('../../types').UniformType>[];
6
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react"),l=require("../lib/createUniformUpdater.js");function y(n){return Object.keys(n).sort().map(t=>{const e=n[t],c=typeof e.value=="function"?e.value.toString():JSON.stringify(e.value);return`${t}:${e.type}:${c}`}).join("|")}const _=(n,i,t)=>{const e=d.useRef(null),c=(t==null?void 0:t.skipDefaultUniforms)??!1,s=`${n}|${c}|${y(i)}`;if(e.current&&e.current.key===s)return typeof window<"u"&&window.__micuglMetrics&&window.__micuglMetrics.hookCacheHits++,e.current.result;typeof window<"u"&&window.__micuglMetrics&&window.__micuglMetrics.hookCacheMisses++;const u=c?[]:l.createCommonUpdaters().filter(r=>r.name==="u_time"&&!("u_time"in i)||r.name==="u_resolution"&&!("u_resolution"in i));Object.entries(i).forEach(([r,a])=>{const f=r.startsWith("u_")?r:`u_${r}`;u.push(l.createUniformUpdater(f,a.type,a.value))});const o={[n]:u};return e.current={key:s,result:o},o};exports.useUniformUpdaters=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react"),c=require("../lib/createUniformUpdater.js"),U=(u,t,e)=>n.useMemo(()=>{const a=(e==null?void 0:e.skipDefaultUniforms)??!1?[]:c.createCommonUpdaters().filter(r=>r.name==="u_time"&&!("u_time"in t)||r.name==="u_resolution"&&!("u_resolution"in t));return Object.entries(t).forEach(([r,s])=>{const i=r.startsWith("u_")?r:`u_${r}`;a.push(c.createUniformUpdater(i,s.type,s.value))}),{[u]:a}},[u,t,e==null?void 0:e.skipDefaultUniforms]);exports.useUniformUpdaters=U;
@@ -1,26 +1,14 @@
1
- import { useRef as l } from "react";
2
- import { createCommonUpdaters as _, createUniformUpdater as d } from "../lib/createUniformUpdater.mjs";
3
- function m(i) {
4
- return Object.keys(i).sort().map((t) => {
5
- const e = i[t], c = typeof e.value == "function" ? e.value.toString() : JSON.stringify(e.value);
6
- return `${t}:${e.type}:${c}`;
7
- }).join("|");
8
- }
9
- const p = (i, n, t) => {
10
- const e = l(null), c = (t == null ? void 0 : t.skipDefaultUniforms) ?? !1, s = `${i}|${c}|${m(n)}`;
11
- if (e.current && e.current.key === s)
12
- return typeof window < "u" && window.__micuglMetrics && window.__micuglMetrics.hookCacheHits++, e.current.result;
13
- typeof window < "u" && window.__micuglMetrics && window.__micuglMetrics.hookCacheMisses++;
14
- const o = c ? [] : _().filter(
15
- (r) => r.name === "u_time" && !("u_time" in n) || r.name === "u_resolution" && !("u_resolution" in n)
1
+ import { useMemo as f } from "react";
2
+ import { createCommonUpdaters as c, createUniformUpdater as i } from "../lib/createUniformUpdater.mjs";
3
+ const n = (u, t, e) => f(() => {
4
+ const a = (e == null ? void 0 : e.skipDefaultUniforms) ?? !1 ? [] : c().filter(
5
+ (r) => r.name === "u_time" && !("u_time" in t) || r.name === "u_resolution" && !("u_resolution" in t)
16
6
  );
17
- Object.entries(n).forEach(([r, f]) => {
18
- const a = r.startsWith("u_") ? r : `u_${r}`;
19
- o.push(d(a, f.type, f.value));
20
- });
21
- const u = { [i]: o };
22
- return e.current = { key: s, result: u }, u;
23
- };
7
+ return Object.entries(t).forEach(([r, m]) => {
8
+ const s = r.startsWith("u_") ? r : `u_${r}`;
9
+ a.push(i(s, m.type, m.value));
10
+ }), { [u]: a };
11
+ }, [u, t, e == null ? void 0 : e.skipDefaultUniforms]);
24
12
  export {
25
- p as useUniformUpdaters
13
+ n as useUniformUpdaters
26
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micugl",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Micu gl - Small React shader library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",