modern-canvas 0.4.10 → 0.4.12
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.cjs +25 -11
- package/dist/index.d.cts +5 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +14 -14
- package/dist/index.mjs +25 -11
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3213,8 +3213,8 @@ class WebGLFramebufferModule extends WebGLModule {
|
|
|
3213
3213
|
this._renderer.viewport.bind({
|
|
3214
3214
|
x: 0,
|
|
3215
3215
|
y: 0,
|
|
3216
|
-
width: this._renderer.screen.width,
|
|
3217
|
-
height: this._renderer.screen.height
|
|
3216
|
+
width: this._renderer.screen.width * this._renderer.pixelRatio,
|
|
3217
|
+
height: this._renderer.screen.height * this._renderer.pixelRatio
|
|
3218
3218
|
});
|
|
3219
3219
|
}
|
|
3220
3220
|
}
|
|
@@ -5788,6 +5788,14 @@ let Node = class extends CoreObject {
|
|
|
5788
5788
|
return false;
|
|
5789
5789
|
}
|
|
5790
5790
|
}
|
|
5791
|
+
_update(changed) {
|
|
5792
|
+
this._tree?.log(this.name, "updating");
|
|
5793
|
+
super._update(changed);
|
|
5794
|
+
}
|
|
5795
|
+
_updateProperty(key, value, oldValue, declaration) {
|
|
5796
|
+
this._tree?.log(this.name, `updating [${String(key)}]`);
|
|
5797
|
+
super._updateProperty(key, value, oldValue, declaration);
|
|
5798
|
+
}
|
|
5791
5799
|
_onTreeEnter(tree) {
|
|
5792
5800
|
this._treeEnter(tree);
|
|
5793
5801
|
this.emit("treeEntered", tree);
|
|
@@ -6291,8 +6299,8 @@ let Viewport = class extends Node {
|
|
|
6291
6299
|
if (this.valid) {
|
|
6292
6300
|
renderer.flush();
|
|
6293
6301
|
this._tree?.setCurrentViewport(this);
|
|
6294
|
-
renderer.framebuffer.bind(this._glFramebuffer(renderer));
|
|
6295
6302
|
this.upload(renderer);
|
|
6303
|
+
renderer.framebuffer.bind(this._glFramebuffer(renderer));
|
|
6296
6304
|
return true;
|
|
6297
6305
|
}
|
|
6298
6306
|
return false;
|
|
@@ -8351,20 +8359,20 @@ class SceneTree extends MainLoop {
|
|
|
8351
8359
|
this.emit("processed");
|
|
8352
8360
|
}
|
|
8353
8361
|
_render(renderer) {
|
|
8362
|
+
this.emit("rendering");
|
|
8354
8363
|
renderer.program.uniforms.projectionMatrix = this.root.toProjectionArray(true);
|
|
8355
8364
|
this.renderStack.render(renderer);
|
|
8356
8365
|
this._renderScreen(renderer);
|
|
8366
|
+
this.emit("rendered");
|
|
8357
8367
|
}
|
|
8358
8368
|
_renderScreen(renderer) {
|
|
8359
8369
|
renderer.state.reset();
|
|
8360
|
-
const { pixelRatio } = renderer;
|
|
8361
|
-
const { width, height } = this.root;
|
|
8362
8370
|
renderer.framebuffer.bind(null);
|
|
8363
8371
|
renderer.viewport.bind({
|
|
8364
8372
|
x: 0,
|
|
8365
8373
|
y: 0,
|
|
8366
|
-
width: width * pixelRatio,
|
|
8367
|
-
height: height * pixelRatio
|
|
8374
|
+
width: this.root.width * renderer.pixelRatio,
|
|
8375
|
+
height: this.root.height * renderer.pixelRatio
|
|
8368
8376
|
});
|
|
8369
8377
|
if (this.backgroundColor) {
|
|
8370
8378
|
renderer.gl.clearColor(...this._backgroundColor.toArray());
|
|
@@ -13185,8 +13193,9 @@ class Engine extends SceneTree {
|
|
|
13185
13193
|
await this.nextTick();
|
|
13186
13194
|
}
|
|
13187
13195
|
async waitAndRender(delta = 0) {
|
|
13196
|
+
await assets.waitUntilLoad();
|
|
13188
13197
|
this._process(delta);
|
|
13189
|
-
await this.
|
|
13198
|
+
await this.nextTick();
|
|
13190
13199
|
this._render(this.renderer);
|
|
13191
13200
|
}
|
|
13192
13201
|
render(delta = 0) {
|
|
@@ -13258,11 +13267,16 @@ async function start(sleep = 100) {
|
|
|
13258
13267
|
starting = false;
|
|
13259
13268
|
}
|
|
13260
13269
|
async function task(options) {
|
|
13261
|
-
const { data, width, height, time = 0 } = options;
|
|
13262
|
-
engine ??= new Engine({
|
|
13270
|
+
const { data, width, height, debug = false, time = 0 } = options;
|
|
13271
|
+
engine ??= new Engine({
|
|
13272
|
+
width: 1,
|
|
13273
|
+
height: 1,
|
|
13274
|
+
preserveDrawingBuffer: true
|
|
13275
|
+
});
|
|
13276
|
+
engine.debug = debug;
|
|
13263
13277
|
engine.root.removeChildren();
|
|
13264
13278
|
engine.timeline.currentTime = time;
|
|
13265
|
-
engine.resize(width, height);
|
|
13279
|
+
engine.resize(width, height, true);
|
|
13266
13280
|
(Array.isArray(data) ? data : [data]).forEach((v) => {
|
|
13267
13281
|
if (v instanceof Node) {
|
|
13268
13282
|
engine.root.appendChild(v);
|