Experience-Monks / three-bmfont-text

renders BMFont files in ThreeJS with word-wrapping
http://jam3.github.io/three-bmfont-text/test/
MIT License
789 stars 171 forks source link

Unindexed vec4 text coordinates for easy merging and manipulation #5

Closed kig closed 4 years ago

kig commented 8 years ago

4 This PR changes the text coordinates from vec2 to vec4 and changes the geometry to use unindexed vertices.

The vec2->vec4 change makes it possible to re-position text geometry on Z & use the W-coord for alpha / palette index / bold flag.

The unindexed vertices change makes merging text geometries easy.

gigablox commented 7 years ago

"makes it possible to re-position text geometry on Z" - this will save me and my people.

mattdesl commented 4 years ago

Thanks but this diverges from the goal of having a small buffer footprint (also see https://github.com/Jam3/three-bmfont-text/issues/36). Perhaps something like this would be possible through an option, to allow users to expand the geometry positions to 3 or 4 dimensions, which provides some convenience at the expense of data storage and transfer speed.

And for Z positioning, usually I just reposition the Mesh. If you need per-glyph positioning or alpha or another feature, you can add your own attributes with geom.setAttribute. See the test-shader.js demo which adds per-glyph attribute specifying which line of text the glyph appears on.