"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.GltfTechniqueState = exports.GltfBufferTarget = exports.GltfWrapMode = exports.GltfMinFilter = exports.GltfMagFilter = exports.GltfDataType = exports.GltfMeshMode = void 0;
exports.gltfDictionaryIterator = gltfDictionaryIterator;
exports.getGltfNodeMeshIds = getGltfNodeMeshIds;
exports.traverseGltfNodes = traverseGltfNodes;
exports.isGltf1Material = isGltf1Material;
/** Enumerates the types of [[GltfMeshPrimitive]] topologies.
 * @internal
 */
var GltfMeshMode;
(function (GltfMeshMode) {
    GltfMeshMode[GltfMeshMode["Points"] = 0] = "Points";
    GltfMeshMode[GltfMeshMode["Lines"] = 1] = "Lines";
    GltfMeshMode[GltfMeshMode["LineLoop"] = 2] = "LineLoop";
    GltfMeshMode[GltfMeshMode["LineStrip"] = 3] = "LineStrip";
    GltfMeshMode[GltfMeshMode["Triangles"] = 4] = "Triangles";
    /** Not currently supported. */
    GltfMeshMode[GltfMeshMode["TriangleStrip"] = 5] = "TriangleStrip";
    /** Not currently supported. */
    GltfMeshMode[GltfMeshMode["TriangleFan"] = 6] = "TriangleFan";
})(GltfMeshMode || (exports.GltfMeshMode = GltfMeshMode = {}));
/** Enumerates the basic data types supported by accessors, material values, technique uniforms, etc.
 * @internal
 */
var GltfDataType;
(function (GltfDataType) {
    GltfDataType[GltfDataType["SignedByte"] = 5120] = "SignedByte";
    GltfDataType[GltfDataType["UnsignedByte"] = 5121] = "UnsignedByte";
    GltfDataType[GltfDataType["SignedShort"] = 5122] = "SignedShort";
    GltfDataType[GltfDataType["UnsignedShort"] = 5123] = "UnsignedShort";
    GltfDataType[GltfDataType["UInt32"] = 5125] = "UInt32";
    GltfDataType[GltfDataType["Float"] = 5126] = "Float";
    GltfDataType[GltfDataType["Rgb"] = 6407] = "Rgb";
    GltfDataType[GltfDataType["Rgba"] = 6408] = "Rgba";
    GltfDataType[GltfDataType["IntVec2"] = 35667] = "IntVec2";
    GltfDataType[GltfDataType["IntVec3"] = 35668] = "IntVec3";
    GltfDataType[GltfDataType["FloatVec2"] = 35664] = "FloatVec2";
    GltfDataType[GltfDataType["FloatVec3"] = 35665] = "FloatVec3";
    GltfDataType[GltfDataType["FloatVec4"] = 35666] = "FloatVec4";
    GltfDataType[GltfDataType["FloatMat3"] = 35675] = "FloatMat3";
    GltfDataType[GltfDataType["FloatMat4"] = 35676] = "FloatMat4";
    GltfDataType[GltfDataType["Sampler2d"] = 35678] = "Sampler2d";
})(GltfDataType || (exports.GltfDataType = GltfDataType = {}));
/** @internal */
var GltfMagFilter;
(function (GltfMagFilter) {
    GltfMagFilter[GltfMagFilter["Nearest"] = 9728] = "Nearest";
    GltfMagFilter[GltfMagFilter["Linear"] = 9729] = "Linear";
})(GltfMagFilter || (exports.GltfMagFilter = GltfMagFilter = {}));
/** @internal */
var GltfMinFilter;
(function (GltfMinFilter) {
    GltfMinFilter[GltfMinFilter["Nearest"] = 9728] = "Nearest";
    GltfMinFilter[GltfMinFilter["Linear"] = 9729] = "Linear";
    GltfMinFilter[GltfMinFilter["NearestMipMapNearest"] = 9984] = "NearestMipMapNearest";
    GltfMinFilter[GltfMinFilter["LinearMipMapNearest"] = 9985] = "LinearMipMapNearest";
    GltfMinFilter[GltfMinFilter["NearestMipMapLinear"] = 9986] = "NearestMipMapLinear";
    GltfMinFilter[GltfMinFilter["LinearMipMapLinear"] = 9987] = "LinearMipMapLinear";
})(GltfMinFilter || (exports.GltfMinFilter = GltfMinFilter = {}));
/** Describes how texture coordinates outside of the range [0..1] are handled.
 * @internal
 */
var GltfWrapMode;
(function (GltfWrapMode) {
    GltfWrapMode[GltfWrapMode["ClampToEdge"] = 33071] = "ClampToEdge";
    GltfWrapMode[GltfWrapMode["MirroredRepeat"] = 33648] = "MirroredRepeat";
    GltfWrapMode[GltfWrapMode["Repeat"] = 10497] = "Repeat";
})(GltfWrapMode || (exports.GltfWrapMode = GltfWrapMode = {}));
/** Describes the intended target of a [[GltfBufferViewProps]].
 * @internal
 */
var GltfBufferTarget;
(function (GltfBufferTarget) {
    GltfBufferTarget[GltfBufferTarget["ArrayBuffer"] = 34962] = "ArrayBuffer";
    GltfBufferTarget[GltfBufferTarget["ElementArrayBuffer"] = 24963] = "ElementArrayBuffer";
})(GltfBufferTarget || (exports.GltfBufferTarget = GltfBufferTarget = {}));
/** Iterate the contents of a [[GltfDictionary]].
 * @internal
 */
function* gltfDictionaryIterator(dict) {
    if (Array.isArray(dict)) {
        for (const elem of dict)
            yield elem;
    }
    else {
        for (const key of Object.keys(dict)) {
            const value = dict[key];
            if (undefined !== value)
                yield value;
        }
    }
}
/** Get the Ids of the meshes associated with a node.
 * @internal
 */
function getGltfNodeMeshIds(node) {
    if (undefined !== node.meshes)
        return typeof node.meshes === "string" ? [node.meshes] : node.meshes;
    else if (undefined !== node.mesh)
        return [node.mesh];
    return [];
}
/** @internal */
function* traverseGltfNodes(ids, nodes, traversed) {
    for (const id of ids) {
        if (traversed.has(id))
            throw new Error("Cycle detected while traversing glTF nodes");
        const node = nodes[id];
        if (!node)
            continue;
        traversed.add(id);
        yield node;
        if (node.children)
            for (const child of traverseGltfNodes(node.children, nodes, traversed))
                yield child;
    }
}
/** GL states that can be enabled by a [[GltfTechnique]]. Only those queried by this implementation are enumerated.
 * @internal
 */
var GltfTechniqueState;
(function (GltfTechniqueState) {
    /** Enables alpha blending. */
    GltfTechniqueState[GltfTechniqueState["Blend"] = 3042] = "Blend";
})(GltfTechniqueState || (exports.GltfTechniqueState = GltfTechniqueState = {}));
/** @internal */
function isGltf1Material(material) {
    const mat1 = material;
    return undefined !== mat1.technique || undefined !== mat1.values;
}
//# sourceMappingURL=GltfSchema.js.map