<commit_before>pc.extend(pc, function () {

    var maxSize = 2048;
    var maskDynamic = 1;
    var maskBaked = 2;
    var maskLightmap = 4;

    var sceneLightmaps = [];
    var sceneLightmapsNode = [];
    var lmCamera;
    var tempVec = new pc.Vec3();
    var bounds = new pc.BoundingBox();

    function collectModels(node, nodes, allNodes) {
        if (!node.enabled) return;

        if (node.model && node.model.model) {
            if (allNodes) allNodes.push(node);
            if (node.model.data.lightmapped) {
                if (nodes) nodes.push(node);
            }
        }
        var children = node.getChildren();
        for(var i=0; i<children.length; i++) {
            collectModels(children[i], nodes, allNodes);
        }
    }

    var Lightmapper = function (device, root, scene, renderer, assets) {
        this.device = device;
        this.root = root;
        this.scene = scene;
        this.renderer = renderer;
        this.assets = assets;
    };

    Lightmapper.prototype = {

        calculateLightmapSize: function(node) {
            var sizeMult = this.scene.lightmapSizeMultiplier || 1;
            var scale = tempVec;
            var parent;
            var area = 1;
            var area3 = {x:1, y:1, z:1};
            var areaUv = 1;

            if (node.model.asset) {
                var data = this.assets.get(node.model.asset).data;
                area = data.area || area;
                if (data.multiArea) {
                    area3.x = (data.multiArea.x) / area;
                    area3.y = (data.multiArea.y) / area;
                    area3.z = (data.multiArea.z) / area;
                }
                areaUv = data.uv1Area || areaUv;
            } else if (node.model._area) {
                var data = node.model;
                area = data._area || area;
                if (data._multiArea) {
                    area3.x = (data._multiArea.x) / area;
                    area3.y = (data._multiArea.y) / area;
                    area3.z = (data._multiArea.z) / area;
                }
                areaUv = data._uv1Area || areaUv;
            }
            var areaMult = node.model.lightmapSizeMultiplier || 1;
            area *= areaMult;

            scale.copy(node.getLocalScale());
            parent = node.getParent();
            while(parent) {
                scale.mul(parent.getLocalScale());
                parent = parent.getParent();
            }

            var totalArea = area * area3.x * scale.y * scale.z +
                            area * area3.y * scale.x * scale.z +
                            area * area3.z * scale.x * scale.y;
            totalArea /= areaUv;
            totalArea = Math.sqrt(totalArea);

            return Math.min(pc.math.nextPowerOfTwo(totalArea * sizeMult), this.scene.lightmapMaxResolution || maxSize);
        },
<commit_msg>simplify weird code<commit_after>pc.extend(pc, function () {

    var maxSize = 2048;
    var maskDynamic = 1;
    var maskBaked = 2;
    var maskLightmap = 4;

    var sceneLightmaps = [];
    var sceneLightmapsNode = [];
    var lmCamera;
    var tempVec = new pc.Vec3();
    var bounds = new pc.BoundingBox();

    function collectModels(node, nodes, allNodes) {
        if (!node.enabled) return;

        if (node.model && node.model.model) {
            if (allNodes) allNodes.push(node);
            if (node.model.data.lightmapped) {
                if (nodes) nodes.push(node);
            }
        }
        var children = node.getChildren();
        for(var i=0; i<children.length; i++) {
            collectModels(children[i], nodes, allNodes);
        }
    }

    var Lightmapper = function (device, root, scene, renderer, assets) {
        this.device = device;
        this.root = root;
        this.scene = scene;
        this.renderer = renderer;
        this.assets = assets;
    };

    Lightmapper.prototype = {

        calculateLightmapSize: function(node) {
            var sizeMult = this.scene.lightmapSizeMultiplier || 1;
            var scale = tempVec;
            var parent;
            var area = 1;
            var area3 = {x:1, y:1, z:1};
            var areaUv = 1;

            if (node.model.asset) {
                var data = this.assets.get(node.model.asset).data;
                area = data.area || area;
                if (data.multiArea) {
                    area3.x = data.multiArea.x;
                    area3.y = data.multiArea.y;
                    area3.z = data.multiArea.z;
                }
                areaUv = data.uv1Area || areaUv;
            } else if (node.model._area) {
                var data = node.model;
                area = data._area || area;
                if (data._multiArea) {
                    area3.x = data._multiArea.x;
                    area3.y = data._multiArea.y;
                    area3.z = data._multiArea.z;
                }
                areaUv = data._uv1Area || areaUv;
            }
            var areaMult = node.model.lightmapSizeMultiplier || 1;
            area *= areaMult;

            scale.copy(node.getLocalScale());
            parent = node.getParent();
            while(parent) {
                scale.mul(parent.getLocalScale());
                parent = parent.getParent();
            }

            var totalArea = area3.x * scale.y * scale.z +
                            area3.y * scale.x * scale.z +
                            area3.z * scale.x * scale.y;
            totalArea /= areaUv;
            totalArea = Math.sqrt(totalArea);

            return Math.min(pc.math.nextPowerOfTwo(totalArea * sizeMult), this.scene.lightmapMaxResolution || maxSize);
        },

{'fraction_non_alphanumeric': 0.11535064476240947, 'fraction_numerical': 0.009892245186362834, 'mean_word_length': 1.4042462845010615, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3067629', 'n_tokens_mistral': 1699, 'n_tokens_neox': 1625, 'n_words': 349}