@@ -18,7 +18,7 @@ import {title} from './_textured-quads-from-tileset.json';
18
18
}
19
19
body {
20
20
background-color: #391e39;
21
- background: radial-gradient(circle, rgba(189, 70, 98, 1 ) 0%, rgba(37, 4, 73, 1 ) 100%);
21
+ background: radial-gradient(circle, rgba(109 80 87 ) 0%, rgba(21 2 41 ) 100%);
22
22
}
23
23
.texture-preview {
24
24
background-color: rgba(86, 101, 115, 80%);
@@ -60,9 +60,9 @@ import {title} from './_textured-quads-from-tileset.json';
60
60
<script >
61
61
import {TileSet, TileSetLoader, VertexObjects} from '@spearwolf/twopoint5d';
62
62
import {DoubleSide, RawShaderMaterial, Texture} from 'three';
63
+ import {InstancedQuadsGeometry} from '~demos/instanced-quads/InstancedQuadsGeometry';
63
64
import fragmentShaderSource from '~demos/shaders/textured-quads.frag?url';
64
65
import vertexShaderSource from '~demos/shaders/textured-quads.vert?url';
65
- import {InstancedQuadsGeometry} from '~demos/instanced-quads/InstancedQuadsGeometry';
66
66
import {PerspectiveOrbitDemo} from '~demos/utils/PerspectiveOrbitDemo';
67
67
import assetsUrl from '~demos/utils/assetsUrl';
68
68
import loadShaderSource from '~demos/utils/loadShaderSource';
@@ -87,6 +87,7 @@ import {title} from './_textured-quads-from-tileset.json';
87
87
]);
88
88
89
89
const texCoords = tileset.atlas.randomFrame().coords;
90
+ console.log('texCoords', [texCoords.s, texCoords.t, texCoords.u, texCoords.v]);
90
91
quad.setTexCoords([texCoords.s, texCoords.t, texCoords.u, texCoords.v]);
91
92
}
92
93
}
@@ -112,21 +113,20 @@ import {title} from './_textured-quads-from-tileset.json';
112
113
113
114
const demo = new PerspectiveOrbitDemo(document.getElementById('canvas-container'), {antialias: false});
114
115
115
- const {imgEl, texture, tileSet} = await new TileSetLoader().loadAsync(
116
- assetsUrl('nobinger-anim-sheet.png'),
117
- {
118
- tileWidth: 64,
119
- tileHeight: 64 ,
120
- margin: 1 ,
121
- },
122
- ['nearest'],
123
- );
116
+ await demo.start(async () => {
117
+ const {imgEl, texture, tileSet} = await new TileSetLoader().loadAsync(
118
+ assetsUrl('glaskugeln-2-256x.png'),
119
+ {
120
+ tileWidth: 256 ,
121
+ tileHeight: 256 ,
122
+ },
123
+ ['nearest'],
124
+ );
124
125
125
- console.log('loaded tileset', {imgEl, tileSet, texture});
126
+ console.log('loaded tileset', {imgEl, tileSet, texture});
126
127
127
- document.getElementById('texture-preview').appendChild(imgEl);
128
+ document.getElementById('texture-preview').appendChild(imgEl.cloneNode() );
128
129
129
- await demo.start(async () => {
130
130
demo.scene.add(await makeMesh(16, 32, 3.5, 1, tileSet, texture));
131
131
});
132
132
0 commit comments