"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Rendering
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPointStringParams = void 0;
const core_bentley_1 = require("@itwin/core-bentley");
const VertexTableBuilder_1 = require("./VertexTableBuilder");
const VertexIndices_1 = require("./VertexIndices");
/** @internal */
function createPointStringParams(args, maxTextureSize) {
    if (!args.flags.isDisjoint)
        return undefined;
    const vertices = VertexTableBuilder_1.VertexTableBuilder.buildFromPolylines(args, maxTextureSize);
    if (undefined === vertices)
        return undefined;
    const polylines = args.polylines;
    let vertIndices = polylines[0];
    if (1 < polylines.length) {
        // We used to assert this wouldn't happen - apparently it does...
        vertIndices = [];
        for (const polyline of polylines)
            for (const vertIndex of polyline)
                vertIndices.push(vertIndex);
    }
    const vertexIndices = VertexIndices_1.VertexIndices.fromArray(vertIndices);
    (0, core_bentley_1.assert)(vertexIndices.length === vertIndices.length);
    return {
        vertices,
        indices: vertexIndices,
        weight: args.width,
    };
}
exports.createPointStringParams = createPointStringParams;
//# sourceMappingURL=PointStringParams.js.map