addQuantizedVertex Method

Add a vertex to the mesh and return its index in RealityMeshParamsBuilder.positions.

addQuantizedVertex(position: Readonly<WritableXYAndZ>, uv: Readonly<WritableXAndY>, normal?: number): number

@see RealityMeshParamsBuilder.addUnquantizedVertex if your vertex data is not already quantized.

@returns the index of the new vertex in RealityMeshParamsBuilder.positions.

@throws Error if normal is undefined but wantNormals was specified at construction of the builder, or vice-versa.

Parameter Type Description
position Readonly<WritableXYAndZ> The 3d position, quantized to the RealityMeshParamsBuilderOptions.positionRange supplied to the builder's constructor.
uv Readonly<WritableXAndY> The texture coordinates, quantized to the RealityMeshParamsBuilderOptions.uvRange supplied to the builder's constructor.
normal number The unsigned 16-bit OctEncodedNormal integer representation of the normal vector, to be supplied if and only if
RealityMeshParamsBuilderOptions.wantNormals was true when the builder was constructed.

Returns - number

the index of the new vertex in RealityMeshParamsBuilder.positions.

Defined in

Last Updated: 16 April, 2024