@footgun/cobalt 0.6.7 → 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 +4 -8
- package/bundle.js +451 -451
- package/package.json +1 -1
- package/src/cobalt.js +2 -2
- package/src/tile/atlas.js +2 -2
- package/src/tile/tile.js +5 -5
package/package.json
CHANGED
package/src/cobalt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { default as createTexture }
|
|
2
|
-
export { default as createTextureFromUrl }
|
|
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
|
|
50
|
+
atlasMaterial = await createTextureFromUrl(cobalt, 'tile atlas', nodeData.options.textureUrl, format)
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
53
|
// sdl + gpu path
|
|
54
|
-
atlasMaterial = await
|
|
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,
|
|
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',
|
|
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',
|
|
67
|
+
material = await createTextureFromBuffer(cobalt, 'tile map', texture, format)
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
const bindGroup = device.createBindGroup({
|
|
@@ -100,7 +100,7 @@ async function init (cobalt, nodeData) {
|
|
|
100
100
|
let material
|
|
101
101
|
|
|
102
102
|
const format = getPreferredFormat(cobalt)
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
// build the tile layer and add it to the cobalt data structure
|
|
105
105
|
if (canvas) {
|
|
106
106
|
// browser (canvas) path
|
|
@@ -108,7 +108,7 @@ async function init (cobalt, nodeData) {
|
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
// sdl + gpu path
|
|
111
|
-
material = await createTextureFromBuffer(cobalt, 'tile map',
|
|
111
|
+
material = await createTextureFromBuffer(cobalt, 'tile map', nodeData.options.texture, format)
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const dat = new Float32Array([ nodeData.options.scrollScale, nodeData.options.scrollScale ])
|