(imageWidth/
const width = scalingFactor *
1000)
const height = scalingFactor * (imageHeight/1000)
// Setup the box mesh info
// prettier-ignore
const boxVertices = [ 0, 0, 0, width , 0, 0, 0, -height, 0,
width, 0, 0, width, -height, 0, 0, -height, 0 ];
const boxUvs = [ 0, 1, 1, 1, 0, 0, // Bottom-left
1, 1, 1, 0, 0, 0 ];
let boxCreationFlags =
Communicator.MeshInstanceCreationFlags.Invisible |
Communicator.MeshInstanceCreationFlags.DoNotLight |
Communicator.MeshInstanceCreationFlags.ExcludeBounding
const scaleMatrix = new Communicator.Matrix()
const textWorldHeight = await this._calculateTextBoxHeight()
scaleMatrix.setScaleComponent(textWorldHeight, textWorldHeight, 1.0)
// Let the system continually rotate the text for us
boxCreationFlags |= Communicator.MeshInstanceCreationFlags.ScreenOriented
boxMatrix = scaleMatrix
// Setup the mesh instance data now. No color required since we're going to
// place a texture over the entire face
const boxMeshData = new Communicator.MeshData()
boxMeshData.setFaceWinding(Communicator.FaceWinding.Clockwise)
boxMeshData.setBackfacesEnabled(false)
boxMeshData.addFaces(boxVertices, undefined, undefined, null)
const boxMeshId = await this._viewer.model.createMesh(boxMeshData)
const boxMeshInstanceData = new Communicator.MeshInstanceData(
boxMeshId,
boxMatrix,
"box",
null,
null,
null,
boxCreationFlags
)
const boxNodeId = await this._viewer.model.createMeshInstance(
boxMeshInstanceData
)