So… I’m deploying r133 when I get errors in BufferGeometry and Three.Font. In r132 I was just using TTFLoader, calling a .ttf file and then setting it as:
import { TTFLoader } from 'three/examples/jsm/loaders/TTFLoader.js';
const fLoader = new TTFLoader( manager);
var font1 = '';
var textMeshArray = [];
var textInstances = [];
var text = "some text";
fLoader.load( '/node_modules/fonts/ttf/arial.ttf', function ( json ) { font1 = json });
loop...{
var textGeo = new THREE.TextBufferGeometry( text, {
font: font1,
size: size,
height: height,
curveSegments: curveSeg,
bevelEnabled: false
});
var textsBufferInstance = new THREE.InstancedBufferGeometry( textGeo );
textsBufferInstance.setAttribute( 'position', textGeo.getAttribute( 'position' ));
textsBufferInstance.setAttribute( 'normal', textGeo.getAttribute( 'normal' ));
textInstances.push( textsBufferInstance );
... more texts...
var mergedText = mergeBufferGeometries( textInstances );
var setI = setInstance( mergedText, i );
undefined === textMeshArray [ i ] ? ( textMeshArray.push( setInstance( mergedText, i )),
m2.userData.instanceMatrices.value.push( new THREE.Matrix4() )) : null;
} // end loop
Then I merge all the text “groups” with:
var textMeshes = mergeBufferGeometries( textMeshArray );
This is now a batchedMesh of a bunch of text that gets converted into an InstancedMesh cache later where I can swap the text based on user input. The segments are kept low, the bevel is turned off, the height is used for extrude depth. This is a very performance solution for text. The vertices are controllable. In no way do I want to use extrudeGeometry which instantly kills performance when a bunch of text is present. I like this solution for the text, personally.
This was working in r132. In r133 this changed somehow. I played with it for a while, nothing worked. So I went back to r132, installing as "npm install three@0.132.2"
.
Getting exact same errors. However, if I dont install r132 from scratch and use the ZIP I previously downloaded this works fine. I’m getting errors not only on the TTFLoader and Font, but I’m also getting errors from BufferGeometryUtils complaining about:
...
if ( attribute.isInterleavedBufferAttribute ) {
console.error( 'THREE.BufferGeometryUtils: .mergeBufferAttributes() failed. InterleavedBufferAttributes are not supported.' );
return null;
}
What’s the give? If I dont like the new implementation I can’t go back to the previous? The diffs between the versions Cores look the same to me. I mean, I’ll be glad to fix it if someone can point the error but this is a breaking change as far as I can tell that persists to the previous version now too? Am I wrong? What’s the correct method? I looked inside the new files and in Font. I tried going back to FontLoader too but regardless I couldn’t get this to work. YES, I saw the change notes and applied them. I saw how the new GeometryUtils is supposed to be applied. Though I didn’t put all that in my example I did test it. I couldn’t get it to work. Help?
r133 looks like it takes care of creating the Text as BufferGeometry so I would love to be able to use it and skip the extra step I’m performing here with new THREE.TextBufferGeometry()
but I can’t get it to work right. I’m also concerned that using extrudeGeometry is going to increase the vertice count on the text but I haven’t seen it work yet so I’m not sure.