How to use the babylonjs-gltf2interface.MeshPrimitiveMode.TRIANGLES function in babylonjs-gltf2interface

To help you get started, we’ve selected a few babylonjs-gltf2interface examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BabylonJS / Babylon.js / loaders / src / glTF / 2.0 / Extensions / KHR_draco_mesh_compression.ts View on Github external
return GLTFLoader.LoadExtensionAsync(context, primitive, this.name, (extensionContext, extension) => {
            if (primitive.mode != undefined) {
                if (primitive.mode !== MeshPrimitiveMode.TRIANGLE_STRIP &&
                    primitive.mode !== MeshPrimitiveMode.TRIANGLES) {
                    throw new Error(`${context}: Unsupported mode ${primitive.mode}`);
                }

                // TODO: handle triangle strips
                if (primitive.mode === MeshPrimitiveMode.TRIANGLE_STRIP) {
                    throw new Error(`${context}: Mode ${primitive.mode} is not currently supported`);
                }
            }

            const attributes: { [kind: string]: number } = {};
            const loadAttribute = (name: string, kind: string) => {
                const uniqueId = extension.attributes[name];
                if (uniqueId == undefined) {
                    return;
                }
github BabylonJS / Babylon.js / loaders / src / glTF / 2.0 / glTFLoader.ts View on Github external
private static _GetDrawMode(context: string, mode: number | undefined): number {
        if (mode == undefined) {
            mode = MeshPrimitiveMode.TRIANGLES;
        }

        switch (mode) {
            case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;
            case MeshPrimitiveMode.LINES: return Material.LineListDrawMode;
            case MeshPrimitiveMode.LINE_LOOP: return Material.LineLoopDrawMode;
            case MeshPrimitiveMode.LINE_STRIP: return Material.LineStripDrawMode;
            case MeshPrimitiveMode.TRIANGLES: return Material.TriangleFillMode;
            case MeshPrimitiveMode.TRIANGLE_STRIP: return Material.TriangleStripDrawMode;
            case MeshPrimitiveMode.TRIANGLE_FAN: return Material.TriangleFanDrawMode;
        }

        throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);
    }
github BabylonJS / Babylon.js / loaders / src / glTF / 2.0 / glTFLoader.ts View on Github external
private static _GetDrawMode(context: string, mode: number | undefined): number {
        if (mode == undefined) {
            mode = MeshPrimitiveMode.TRIANGLES;
        }

        switch (mode) {
            case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;
            case MeshPrimitiveMode.LINES: return Material.LineListDrawMode;
            case MeshPrimitiveMode.LINE_LOOP: return Material.LineLoopDrawMode;
            case MeshPrimitiveMode.LINE_STRIP: return Material.LineStripDrawMode;
            case MeshPrimitiveMode.TRIANGLES: return Material.TriangleFillMode;
            case MeshPrimitiveMode.TRIANGLE_STRIP: return Material.TriangleStripDrawMode;
            case MeshPrimitiveMode.TRIANGLE_FAN: return Material.TriangleFanDrawMode;
        }

        throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);
    }
github BabylonJS / Babylon.js / loaders / src / glTF / 2.0 / glTFLoader.ts View on Github external
private static _GetDrawMode(context: string, mode: number | undefined): number {
        if (mode == undefined) {
            mode = MeshPrimitiveMode.TRIANGLES;
        }

        switch (mode) {
            case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;
            case MeshPrimitiveMode.LINES: return Material.LineListDrawMode;
            case MeshPrimitiveMode.LINE_LOOP: return Material.LineLoopDrawMode;
            case MeshPrimitiveMode.LINE_STRIP: return Material.LineStripDrawMode;
            case MeshPrimitiveMode.TRIANGLES: return Material.TriangleFillMode;
            case MeshPrimitiveMode.TRIANGLE_STRIP: return Material.TriangleStripDrawMode;
            case MeshPrimitiveMode.TRIANGLE_FAN: return Material.TriangleFanDrawMode;
        }

        throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);
    }
github BabylonJS / Babylon.js / loaders / src / glTF / 2.0 / glTFLoader.ts View on Github external
private static _GetDrawMode(context: string, mode: number | undefined): number {
        if (mode == undefined) {
            mode = MeshPrimitiveMode.TRIANGLES;
        }

        switch (mode) {
            case MeshPrimitiveMode.POINTS: return Material.PointListDrawMode;
            case MeshPrimitiveMode.LINES: return Material.LineListDrawMode;
            case MeshPrimitiveMode.LINE_LOOP: return Material.LineLoopDrawMode;
            case MeshPrimitiveMode.LINE_STRIP: return Material.LineStripDrawMode;
            case MeshPrimitiveMode.TRIANGLES: return Material.TriangleFillMode;
            case MeshPrimitiveMode.TRIANGLE_STRIP: return Material.TriangleStripDrawMode;
            case MeshPrimitiveMode.TRIANGLE_FAN: return Material.TriangleFanDrawMode;
        }

        throw new Error(`${context}: Invalid mesh primitive mode (${mode})`);
    }