Skip to content

Commit 0754459

Browse files
committed
Implement updateSilhouette to allow updates to happen when needed
1 parent e616ab5 commit 0754459

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/SVGSkin.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ class SVGSkin extends Skin {
101101
if (this._texture) {
102102
gl.bindTexture(gl.TEXTURE_2D, this._texture);
103103
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this._svgRenderer.canvas);
104-
this._silhouette.update(this._svgRenderer.canvas);
105104
} else {
106105
// TODO: mipmaps?
107106
const textureOptions = {
@@ -111,8 +110,8 @@ class SVGSkin extends Skin {
111110
};
112111

113112
this._texture = twgl.createTexture(gl, textureOptions);
114-
this._silhouette.update(this._svgRenderer.canvas);
115113
}
114+
this._silhouetteDirty = true;
116115

117116
const maxDimension = Math.max(this._svgRenderer.canvas.width, this._svgRenderer.canvas.height);
118117
let testScale = 2;
@@ -126,6 +125,12 @@ class SVGSkin extends Skin {
126125
});
127126
}
128127

128+
updateSilhouette () {
129+
if (this._silhouetteDirty) {
130+
this._silhouette.update(this._svgRenderer.canvas);
131+
this._silhouetteDirty = false;
132+
}
133+
}
129134
}
130135

131136
module.exports = SVGSkin;

0 commit comments

Comments
 (0)