@bigmistqke/view.gl 0.1.3 → 0.1.5

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.
@@ -71,26 +71,26 @@ export const kindToUniformFnName = <T extends UniformKind>(
71
71
  switch (kind[0]) {
72
72
  // mat
73
73
  case 'm':
74
- return 'Matrix' + kind.slice(3) + 'fv'
74
+ return ('Matrix' + kind.slice(3) + 'fv') as KIND_TO_UNIFORM_FN_NAME_MAP[T]
75
75
  // sampler/booleans/integer
76
76
  case 's':
77
77
  case 'b':
78
78
  case 'i':
79
- return (kind.match(/\d/)?.[0] ?? '1') + 'i'
79
+ return ((kind.match(/\d/)?.[0] ?? '1') + 'i') as KIND_TO_UNIFORM_FN_NAME_MAP[T]
80
80
  // unsigned integers
81
81
  case 'u':
82
- return (kind[4] || '1') + 'ui'
82
+ return ((kind[4] || '1') + 'ui') as KIND_TO_UNIFORM_FN_NAME_MAP[T]
83
83
  // vec
84
84
  case 'v':
85
- return kind[3] + 'f'
85
+ return (kind[3] + 'f') as KIND_TO_UNIFORM_FN_NAME_MAP[T]
86
86
  default:
87
87
  switch (kind) {
88
88
  case 'float':
89
- return '1f'
89
+ return '1f' as KIND_TO_UNIFORM_FN_NAME_MAP[T]
90
90
  case 'uint':
91
- return '1ui'
91
+ return '1ui' as KIND_TO_UNIFORM_FN_NAME_MAP[T]
92
92
  default:
93
- return '1i'
93
+ return '1i' as KIND_TO_UNIFORM_FN_NAME_MAP[T]
94
94
  }
95
95
  }
96
96
  }
@@ -167,7 +167,7 @@ export function createTexture(
167
167
  if (!(name in gl)) {
168
168
  throw new Error(`Attempted to create webgl2-only texture (${name}) in webgl1`)
169
169
  }
170
- return gl[name]
170
+ return gl[name as keyof typeof gl] as any
171
171
  }
172
172
 
173
173
  gl.bindTexture(gl[target], texture)
@@ -268,7 +268,7 @@ export function createFramebuffer(gl: GL, { attachment, texture, ...options }: F
268
268
  /* */
269
269
  /**********************************************************************************/
270
270
 
271
- type UpsertMapKind<T, U> = Map<T, U> | WeakMap<T, U>
271
+ type UpsertMapKind<T, U> = Map<T, U> | (T extends WeakKey ? WeakMap<T, U> : never)
272
272
 
273
273
  export function createUpsertMap<T extends UpsertMapKind<any, any> = Map<any, any>>(
274
274
  constructor?: new () => T,