<commit_before>// In this demo model, view and world space all use a right-handed coordinate system such that 
// +ve x points right, +ve y points into the screen and +ve z points up.

const DRAW_TARGET = Object.freeze({
    MODEL:   Symbol("model"),
    MIRROR:  Symbol("mirror"),
    NORMALS: Symbol("normals")
});

let g_GL = null; // GL rendering context:

function main() {
    g_GL = document.getElementById('webgl').getContext("webgl");
    if (g_GL) {
        g_GL.loadScene = function(url) {
            function initTextures(textures) {
                g_GL.mapOfTextures = new Map();

                for (let t of textures) {
                    g_GL.mapOfTextures.set(t.name, g_GL.createTexture());
                    g_GL.bindTexture(g_GL.TEXTURE_2D, g_GL.mapOfTextures.get(t.name));
                    g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGBA, 1, 1, 0, g_GL.RGBA, g_GL.UNSIGNED_BYTE, new Uint8Array([0, 0, 255, 255]));

                    const image = new Image();
                    image.onload = () => {
                        g_GL.bindTexture(g_GL.TEXTURE_2D, g_GL.mapOfTextures.get(t.name));
                        if (t.hasAlpha) {
                            g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGBA, g_GL.RGBA, g_GL.UNSIGNED_BYTE, image);
                        } else {
                            g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGB,  g_GL.RGB,  g_GL.UNSIGNED_BYTE, image);
                        }
                        g_GL.generateMipmap(g_GL.TEXTURE_2D);
                    };

                    image.crossOrigin = 'anonymous';
                    image.src = 'http://localhost:8888/textures/' + t.name + '.png';
                }
            }

            function initMaterials(materials) {
                g_GL.mapOfMaterials = new Map();

                for (let m of materials) {
                    g_GL.mapOfMaterials.set(m.name, m);
                    m.textures.forEach((t, i) => {
                        if (t) {
                            m.textures[i] = g_GL.mapOfTextures.get(t); 
                        }
                    });
                    m.shader = g_GL.mapOfShaders.get(m.shaderProgram);
                }
            }

            function initSceneGraph(node, parent) {
                let refFrame = null;

                switch(node.nodeType) {
                    case 'OmniDirLS':
                        refFrame = new OmniDirLS(parent, node); 
                        g_GL.omniDirLS = refFrame;
                        break;
                    case 'RefFrame':
                        refFrame = new RefFrame(parent, node); 
                        break;
                    case 'Camera':
                        refFrame = new Camera(parent, node);
                        g_GL.cameras.push(refFrame); 
                        break;
                    case 'MirrorCamera':
                        refFrame = new Camera(parent, node);
                        g_GL.mirrorCam = refFrame; 
                    case 'Model':
                        refFrame = new Model(parent, node); 
                        break;
                }

                if (node.hasOwnProperty('children')) {
                    for (child of node.children) {
                        initSceneGraph(child, refFrame);
                    }
                }

                if (!parent) {
                    g_GL.rootNode = refFrame;
                }
            }

            const request = new XMLHttpRequest();
            request.overrideMimeType("application/json");
            request.onreadystatechange = () => {
                if (request.readyState === 4 && request.status == 200) {
                    const scene = JSON.parse(request.responseText);
                    initTextures(scene.textures);
                    initMaterials(scene.materials);
                    initSceneGraph(scene.sceneRoot);
                }
            }
            request.open('GET', url, true);
            request.send();                    
        };

        g_GL.drawScene = function() {<commit_msg>Add missing break in switch case.<commit_after>// In this demo model, view and world space all use a right-handed coordinate system such that 
// +ve x points right, +ve y points into the screen and +ve z points up.

const DRAW_TARGET = Object.freeze({
    MODEL:   Symbol("model"),
    MIRROR:  Symbol("mirror"),
    NORMALS: Symbol("normals")
});

let g_GL = null; // GL rendering context:

function main() {
    g_GL = document.getElementById('webgl').getContext("webgl");
    if (g_GL) {
        g_GL.loadScene = function(url) {
            function initTextures(textures) {
                g_GL.mapOfTextures = new Map();

                for (let t of textures) {
                    g_GL.mapOfTextures.set(t.name, g_GL.createTexture());
                    g_GL.bindTexture(g_GL.TEXTURE_2D, g_GL.mapOfTextures.get(t.name));
                    g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGBA, 1, 1, 0, g_GL.RGBA, g_GL.UNSIGNED_BYTE, new Uint8Array([0, 0, 255, 255]));

                    const image = new Image();
                    image.onload = () => {
                        g_GL.bindTexture(g_GL.TEXTURE_2D, g_GL.mapOfTextures.get(t.name));
                        if (t.hasAlpha) {
                            g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGBA, g_GL.RGBA, g_GL.UNSIGNED_BYTE, image);
                        } else {
                            g_GL.texImage2D(g_GL.TEXTURE_2D, 0, g_GL.RGB,  g_GL.RGB,  g_GL.UNSIGNED_BYTE, image);
                        }
                        g_GL.generateMipmap(g_GL.TEXTURE_2D);
                    };

                    image.crossOrigin = 'anonymous';
                    image.src = 'http://localhost:8888/textures/' + t.name + '.png';
                }
            }

            function initMaterials(materials) {
                g_GL.mapOfMaterials = new Map();

                for (let m of materials) {
                    g_GL.mapOfMaterials.set(m.name, m);
                    m.textures.forEach((t, i) => {
                        if (t) {
                            m.textures[i] = g_GL.mapOfTextures.get(t); 
                        }
                    });
                    m.shader = g_GL.mapOfShaders.get(m.shaderProgram);
                }
            }

            function initSceneGraph(node, parent) {
                let refFrame = null;

                switch(node.nodeType) {
                    case 'OmniDirLS':
                        refFrame = new OmniDirLS(parent, node); 
                        g_GL.omniDirLS = refFrame;
                        break;
                    case 'RefFrame':
                        refFrame = new RefFrame(parent, node); 
                        break;
                    case 'Camera':
                        refFrame = new Camera(parent, node);
                        g_GL.cameras.push(refFrame); 
                        break;
                    case 'MirrorCamera':
                        refFrame = new Camera(parent, node);
                        g_GL.mirrorCam = refFrame; 
                        break;
                    case 'Model':
                        refFrame = new Model(parent, node); 
                        break;
                }

                if (node.hasOwnProperty('children')) {
                    for (child of node.children) {
                        initSceneGraph(child, refFrame);
                    }
                }

                if (!parent) {
                    g_GL.rootNode = refFrame;
                }
            }

            const request = new XMLHttpRequest();
            request.overrideMimeType("application/json");
            request.onreadystatechange = () => {
                if (request.readyState === 4 && request.status == 200) {
                    const scene = JSON.parse(request.responseText);
                    initTextures(scene.textures);
                    initMaterials(scene.materials);
                    initSceneGraph(scene.sceneRoot);
                }
            }
            request.open('GET', url, true);
            request.send();                    
        };

        g_GL.drawScene = function() {
{'fraction_non_alphanumeric': 0.10265744448489261, 'fraction_numerical': 0.007766047809731828, 'mean_word_length': 1.159853249475891, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3655947', 'n_tokens_mistral': 2385, 'n_tokens_neox': 2161, 'n_words': 430}