<commit_before>window.FCScene = (function () {
    "use strict";
    
    var Scene = function () {
        console.log("Initialising scene...");
        this.gl = null;
        
        this.sceneObjects = [];
        this.textures = {}; /* label: {obj: , ptr: } */
        this.shaders = {}; /* {obj:, label: } */
        this.modelSources = {};
        this.meshes = {};
        this.materials = {}; /* label:, texture:, textureLabel:, ambient:, diffuse:, specular:, shininess:, shader:, shaderLabel:,  */ 
        this.texturesPtr = 0;
        
        this.sceneVerts = [];
        this.sceneIndices = [];
        
        this.stageParams = null;
        this.playerLocation = {x: 0, z: 0, y: 0}; /* For room-scale, this is the location of the floor origin */
        
        this.isRendering = false;
        
        this.playerSpatialState = {
            head: {
                pos: null,
                ori: null
            },
            hands: [],
            needsUpdate: true
        };
        
        /* obj params: shader: <label> , texture: <label> */
                
    };
    
    Scene.prototype.setPlayerLocation = function (loc) {
        this.playerLocation.x = loc.x;
        this.playerLocation.y = loc.y;
        this.playerLocation.z = loc.z;
    }
    
    Scene.prototype.moveRaftAndPlayerTo = function (loc, tween) {
        if (tween) {
            /* TODO Tweening the floor is one thing but tweening the player is quite another */
            /* Maybe add a virtual object representing the player, and then use animate()? */
        }
        this.getObjectByLabel('raft').relocateTo({x:loc.x, y:loc.y+0.01, z:loc.z});
        this.setPlayerLocation(loc);
    }
    
    Scene.prototype.addObject = function (obj, params) {
        // sceneObjects = sceneObjects.concat([object]);
        this.prepareObject(obj);
        this.sceneObjects.push(obj);
    };
    
    Scene.prototype.addObjects = function (objs) {
        for (var i=0; i<objs.length; i++) {
            this.addObject(objs[i]);
        }
    }
    
    /* NOTE: returns the object wrappers, not the drawables themselves */
    Scene.prototype.getObjectByLabel = function (label) {
        for (var i=0; i<this.sceneObjects.length; i++) {
            var sO = this.sceneObjects[i];
            if (sO.label == label) {
                return this.sceneObjects[i];<commit_msg>moveRaftAndPlayerTo made more intuitive, now moves player's feet to target location rather than moving center of raft<commit_after>window.FCScene = (function () {
    "use strict";
    
    var Scene = function () {
        console.log("Initialising scene...");
        this.gl = null;
        
        this.sceneObjects = [];
        this.textures = {}; /* label: {obj: , ptr: } */
        this.shaders = {}; /* {obj:, label: } */
        this.modelSources = {};
        this.meshes = {};
        this.materials = {}; /* label:, texture:, textureLabel:, ambient:, diffuse:, specular:, shininess:, shader:, shaderLabel:,  */ 
        this.texturesPtr = 0;
        
        this.sceneVerts = [];
        this.sceneIndices = [];
        
        this.stageParams = null;
        this.playerLocation = {x: 0, z: 0, y: 0}; /* For room-scale, this is the location of the floor origin */
        
        this.isRendering = false;
        
        this.playerSpatialState = {
            head: {
                pos: null,
                ori: null
            },
            hands: [],
            needsUpdate: true
        };
        
        /* obj params: shader: <label> , texture: <label> */
                
    };
    
    Scene.prototype.setPlayerLocation = function (loc) {
        this.playerLocation.x = loc.x;
        this.playerLocation.y = loc.y;
        this.playerLocation.z = loc.z;
    }
    
    /* Relocate the player's feet to loc. Tween is currently unsupported. */
    Scene.prototype.moveRaftAndPlayerTo = function (loc, tween) {
        var pose = window.vrDisplay.getPose();
        var position = vec3.fromValues(pose.position[0], pose.position[1], pose.position[2]);
        var orientation = quat.create();
        var out = mat4.create()
        mat4.fromRotationTranslation(out, orientation, position);
        mat4.multiply(out, vrDisplay.stageParameters.sittingToStandingTransform, out);

        var translation = vec3.create();
        mat4.getTranslation(translation, out);
        
        var raftloc = {x:loc.x-translation[0], y:loc.y+0.01, z:loc.z-translation[2]};
        this.getObjectByLabel('raft').relocateTo(raftloc);
        this.setPlayerLocation(raftloc);
    }
    
    Scene.prototype.addObject = function (obj, params) {
        // sceneObjects = sceneObjects.concat([object]);
        this.prepareObject(obj);
        this.sceneObjects.push(obj);
    };
    
    Scene.prototype.addObjects = function (objs) {
        for (var i=0; i<objs.length; i++) {
            this.addObject(objs[i]);
        }
    }
    
    /* NOTE: returns the object wrappers, not the drawables themselves */
    Scene.prototype.getObjectByLabel = function (label) {
        for (var i=0; i<this.sceneObjects.length; i++) {
            var sO = this.sceneObjects[i];
            if (sO.label == label) {
                return this.sceneObjects[i];
{'fraction_non_alphanumeric': 0.1343226788432268, 'fraction_numerical': 0.005517503805175038, 'mean_word_length': 1.8900494777350192, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 7, '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': '179111', 'n_tokens_mistral': 1584, 'n_tokens_neox': 1534, 'n_words': 341}