@footgun/cobalt 0.6.8 → 0.6.9

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.6.9
2
+ * bugfix in tile atlas setTexture function
3
+
4
+ :
1
5
  # 0.6.8 - 0.6.5
2
6
  * add sdl + webgpu support for tile node
3
7
 
package/bundle.js CHANGED
@@ -8221,16 +8221,16 @@ var tile_default = {
8221
8221
  },
8222
8222
  // optional
8223
8223
  customFunctions: {
8224
- setTexture: async function(cobalt, node, textureUrl) {
8224
+ setTexture: async function(cobalt, node, texture) {
8225
8225
  const { canvas, device } = cobalt;
8226
8226
  destroy3(node);
8227
8227
  const format = getPreferredFormat(cobalt);
8228
8228
  let material;
8229
8229
  if (canvas) {
8230
8230
  node.options.textureUrl = textureUrl;
8231
- material = await createTextureFromUrl(cobalt, "tile map", node.options.textureUrl, format);
8231
+ material = await createTextureFromUrl(cobalt, "tile map", texture, format);
8232
8232
  } else {
8233
- material = await createTextureFromBuffer(cobalt, "tile map", node.options.texture, format);
8233
+ material = await createTextureFromBuffer(cobalt, "tile map", texture, format);
8234
8234
  }
8235
8235
  const bindGroup = device.createBindGroup({
8236
8236
  layout: node.refs.tileAtlas.data.tileBindGroupLayout,
@@ -14251,9 +14251,9 @@ async function init10(cobalt, nodeData) {
14251
14251
  const format = getPreferredFormat(cobalt);
14252
14252
  let atlasMaterial;
14253
14253
  if (canvas) {
14254
- atlasMaterial = await await createTextureFromUrl(cobalt, "tile atlas", nodeData.options.textureUrl, format);
14254
+ atlasMaterial = await createTextureFromUrl(cobalt, "tile atlas", nodeData.options.textureUrl, format);
14255
14255
  } else {
14256
- atlasMaterial = await await createTextureFromBuffer(cobalt, "tile atlas", nodeData.options.texture, format);
14256
+ atlasMaterial = await createTextureFromBuffer(cobalt, "tile atlas", nodeData.options.texture, format);
14257
14257
  }
14258
14258
  const uniformBuffer = device.createBuffer({
14259
14259
  size: 32,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@footgun/cobalt",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "type": "module",
5
5
  "main": "bundle.js",
6
6
  "description": "A 2D WebGpu renderer",
package/src/cobalt.js CHANGED
@@ -1,5 +1,5 @@
1
- export { default as createTexture } from './create-texture.js'
2
- export { default as createTextureFromUrl } from './create-texture-from-url.js'
1
+ export { default as createTexture } from './create-texture.js'
2
+ export { default as createTextureFromUrl } from './create-texture-from-url.js'
3
3
  export { default as createTextureFromBuffer } from './create-texture-from-buffer.js'
4
4
 
5
5
 
package/src/tile/atlas.js CHANGED
@@ -47,11 +47,11 @@ async function init (cobalt, nodeData) {
47
47
 
48
48
  if (canvas) {
49
49
  // browser (canvas) path
50
- atlasMaterial = await await createTextureFromUrl(cobalt, 'tile atlas', nodeData.options.textureUrl, format)
50
+ atlasMaterial = await createTextureFromUrl(cobalt, 'tile atlas', nodeData.options.textureUrl, format)
51
51
  }
52
52
  else {
53
53
  // sdl + gpu path
54
- atlasMaterial = await await createTextureFromBuffer(cobalt, 'tile atlas', nodeData.options.texture, format)
54
+ atlasMaterial = await createTextureFromBuffer(cobalt, 'tile atlas', nodeData.options.texture, format)
55
55
  }
56
56
 
57
57
  const uniformBuffer = device.createBuffer({
package/src/tile/tile.js CHANGED
@@ -48,7 +48,7 @@ export default {
48
48
 
49
49
  // optional
50
50
  customFunctions: {
51
- setTexture: async function (cobalt, node, textureUrl) {
51
+ setTexture: async function (cobalt, node, texture) {
52
52
  const { canvas, device } = cobalt
53
53
 
54
54
  destroy(node)
@@ -60,11 +60,11 @@ export default {
60
60
  if (canvas) {
61
61
  // browser (canvas) path
62
62
  node.options.textureUrl = textureUrl
63
- material = await createTextureFromUrl(cobalt, 'tile map', node.options.textureUrl, format)
63
+ material = await createTextureFromUrl(cobalt, 'tile map', texture, format)
64
64
  }
65
65
  else {
66
66
  // sdl + gpu path
67
- material = await createTextureFromBuffer(cobalt, 'tile map', node.options.texture, format)
67
+ material = await createTextureFromBuffer(cobalt, 'tile map', texture, format)
68
68
  }
69
69
 
70
70
  const bindGroup = device.createBindGroup({