mirror of
https://github.com/storytold/spark.git
synced 2026-10-17 00:12:59 +00:00
Fix ref counting and originToWorld in SparkViewpoint.prepare (#207)
This commit is contained in:
@@ -302,7 +302,9 @@ export class SparkViewpoint {
|
|||||||
while (update ?? true) {
|
while (update ?? true) {
|
||||||
// Force an update, possibly with origin centered at this camera
|
// Force an update, possibly with origin centered at this camera
|
||||||
// to yield the best quality output.
|
// to yield the best quality output.
|
||||||
const originToWorld = forceOrigin ? this.viewToWorld : undefined;
|
const originToWorld = forceOrigin
|
||||||
|
? this.viewToWorld
|
||||||
|
: this.spark.matrixWorld;
|
||||||
const updated = this.spark.updateInternal({ scene, originToWorld });
|
const updated = this.spark.updateInternal({ scene, originToWorld });
|
||||||
if (updated) {
|
if (updated) {
|
||||||
break;
|
break;
|
||||||
@@ -312,10 +314,11 @@ export class SparkViewpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const accumulator = this.spark.active;
|
const accumulator = this.spark.active;
|
||||||
if (accumulator !== this.display?.accumulator) {
|
// Hold reference to accumulator while sorting
|
||||||
this.spark.active.refCount += 1;
|
accumulator.refCount += 1;
|
||||||
}
|
|
||||||
await this.sortUpdate({ accumulator, viewToWorld: this.viewToWorld });
|
await this.sortUpdate({ accumulator, viewToWorld: this.viewToWorld });
|
||||||
|
// Release accumulator reference
|
||||||
|
this.spark.releaseAccumulator(accumulator);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render out the viewpoint to the view target RGBA buffer.
|
// Render out the viewpoint to the view target RGBA buffer.
|
||||||
|
|||||||
Reference in New Issue
Block a user