@idetik/core 0.5.0 → 0.5.1

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.
package/dist/index.d.ts CHANGED
@@ -691,7 +691,6 @@ declare class WebGLRenderer extends Renderer {
691
691
  private glGetPrimitive;
692
692
  protected resize(width: number, height: number): void;
693
693
  protected clear(): void;
694
- private get gl();
695
694
  }
696
695
 
697
696
  type PerspectiveCameraOptions = {
package/dist/index.js CHANGED
@@ -1802,22 +1802,24 @@ class pQ {
1802
1802
  }
1803
1803
  const mQ = DQ(AA(), [1, -1, 1]);
1804
1804
  class uQ extends OB {
1805
- gl_ = null;
1805
+ gl_;
1806
1806
  programs_;
1807
1807
  bindings_;
1808
1808
  textures_;
1809
1809
  state_;
1810
1810
  renderedObjectsPerFrame_ = 0;
1811
1811
  constructor(A) {
1812
- if (super(A), this.gl_ = this.canvas.getContext("webgl2", {
1812
+ super(A);
1813
+ const I = this.canvas.getContext("webgl2", {
1813
1814
  depth: !0,
1814
1815
  antialias: !0
1815
- }), !this.gl_)
1816
+ });
1817
+ if (!I)
1816
1818
  throw new Error("Failed to initialize WebGL2 context");
1817
- U.info(
1819
+ this.gl_ = I, U.info(
1818
1820
  "WebGLRenderer",
1819
- `WebGL version ${this.gl.getParameter(this.gl.VERSION)}`
1820
- ), this.programs_ = new EQ(this.gl), this.bindings_ = new lQ(this.gl), this.textures_ = new fQ(this.gl), this.state_ = new pQ(this.gl), this.resize(this.canvas.width, this.canvas.height);
1821
+ `WebGL version ${I.getParameter(I.VERSION)}`
1822
+ ), this.programs_ = new EQ(I), this.bindings_ = new lQ(I), this.textures_ = new fQ(I), this.state_ = new pQ(I), this.resize(this.canvas.width, this.canvas.height);
1821
1823
  }
1822
1824
  render(A) {
1823
1825
  const I = A.getBoxRelativeTo(this.canvas), B = new z(
@@ -1902,16 +1904,16 @@ class uQ extends OB {
1902
1904
  y in a && Q.setUniform(y, a[y]);
1903
1905
  }
1904
1906
  const D = this.glGetPrimitive(A.primitive), h = A.indexData;
1905
- h.length ? this.gl.drawElements(D, h.length, this.gl.UNSIGNED_INT, 0) : this.gl.drawArrays(D, 0, A.vertexCount);
1907
+ h.length ? this.gl_.drawElements(D, h.length, this.gl_.UNSIGNED_INT, 0) : this.gl_.drawArrays(D, 0, A.vertexCount);
1906
1908
  }
1907
1909
  glGetPrimitive(A) {
1908
1910
  switch (A) {
1909
1911
  case "points":
1910
- return this.gl.POINTS;
1912
+ return this.gl_.POINTS;
1911
1913
  case "triangles":
1912
- return this.gl.TRIANGLES;
1914
+ return this.gl_.TRIANGLES;
1913
1915
  case "lines":
1914
- return this.gl.LINES;
1916
+ return this.gl_.LINES;
1915
1917
  default: {
1916
1918
  const I = A;
1917
1919
  throw new Error(`Unknown Primitive type: ${I}`);
@@ -1926,10 +1928,7 @@ class uQ extends OB {
1926
1928
  this.state_.setViewport(B);
1927
1929
  }
1928
1930
  clear() {
1929
- this.gl.clearColor(...this.backgroundColor.rgba), this.gl.clear(this.gl.COLOR_BUFFER_BIT | this.gl.DEPTH_BUFFER_BIT), this.state_.setDepthTesting(!0), this.gl.depthFunc(this.gl.LEQUAL);
1930
- }
1931
- get gl() {
1932
- return this.gl_;
1931
+ this.gl_.clearColor(...this.backgroundColor.rgba), this.gl_.clear(this.gl_.COLOR_BUFFER_BIT | this.gl_.DEPTH_BUFFER_BIT), this.state_.setDepthTesting(!0), this.gl_.depthFunc(this.gl_.LEQUAL);
1933
1932
  }
1934
1933
  }
1935
1934
  const TQ = 8;