Skip to content

Commit 34e6c93

Browse files
AlaricBaraoulojjic
authored andcommitted
Prevent rendering Text while GlyphsGeometry is not ready
1 parent b6565f4 commit 34e6c93

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/troika-three-text/src/GlyphsGeometry.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ class GlyphsGeometry extends InstancedBufferGeometry {
6767
// Preallocate empty bounding objects
6868
this.boundingSphere = new Sphere()
6969
this.boundingBox = new Box3()
70+
71+
// Prevent rendering while we don't have any glyphs
72+
this.instanceCount = 0
73+
this.setDrawRange(0, 0)
7074
}
7175

7276
computeBoundingSphere () {
@@ -124,6 +128,7 @@ class GlyphsGeometry extends InstancedBufferGeometry {
124128
this._blockBounds = blockBounds
125129
this._chunkedBounds = chunkedBounds
126130
this.instanceCount = glyphAtlasIndices.length
131+
this.setDrawRange(0, Infinity)
127132
this._updateBounds()
128133
}
129134

0 commit comments

Comments
 (0)