<commit_before>import gl from './constants'; // web workers don't have access to GL context, so import all GL constants
import VertexData from './vertex_data';
import hashString from '../utils/hash';

// Describes a vertex layout that can be used with many different GL programs.
export default class VertexLayout {
    // Attribs are an array, in layout order, of: name, size, type, normalized
    // ex: { name: 'position', size: 3, type: gl.FLOAT, normalized: false }
    constructor (attribs) {
        this.attribs = attribs; // array of attributes, specified as standard GL attrib options
        this.dynamic_attribs = this.attribs.filter(x => !x.static); // attributes with per-vertex values, used to build VBOs
        this.static_attribs = this.attribs.filter(x => x.static); // attributes with fixed values
        this.components = [];   // list of type and offset info about each attribute component
        this.index = {};        // JS buffer index of each attribute component, e.g. this.index.position
        this.offset = {};       // VBO buffer byte offset of each attribute component, e.g. this.offset.color
        this.stride = 0;        // byte stride of a single vertex

        let index = 0, count = 0;
        for (let a=0; a < this.attribs.length; a++) {
            let attrib = this.attribs[a];
            // Dynamic attribute
            if (attrib.static == null) {
                attrib.offset = this.stride;
                attrib.byte_size = attrib.size;
                let shift = 0;

                switch (attrib.type) {
                case gl.FLOAT:<commit_msg>be more explicit about vertex layout static values<commit_after>import gl from './constants'; // web workers don't have access to GL context, so import all GL constants
import VertexData from './vertex_data';
import hashString from '../utils/hash';

// Describes a vertex layout that can be used with many different GL programs.
export default class VertexLayout {
    // Attribs are an array, in layout order, of: name, size, type, normalized
    // ex: { name: 'position', size: 3, type: gl.FLOAT, normalized: false }
    constructor (attribs) {
        this.attribs = attribs; // array of attributes, specified as standard GL attrib options
        this.dynamic_attribs = this.attribs.filter(x => x.static == null); // attributes with per-vertex values, used to build VBOs
        this.static_attribs = this.attribs.filter(x => x.static != null); // attributes with fixed values
        this.components = [];   // list of type and offset info about each attribute component
        this.index = {};        // JS buffer index of each attribute component, e.g. this.index.position
        this.offset = {};       // VBO buffer byte offset of each attribute component, e.g. this.offset.color
        this.stride = 0;        // byte stride of a single vertex

        let index = 0, count = 0;
        for (let a=0; a < this.attribs.length; a++) {
            let attrib = this.attribs[a];
            // Dynamic attribute
            if (attrib.static == null) {
                attrib.offset = this.stride;
                attrib.byte_size = attrib.size;
                let shift = 0;

                switch (attrib.type) {
                case gl.FLOAT:
{'fraction_non_alphanumeric': 0.10331085223789087, 'fraction_numerical': 0.003678724708767627, 'mean_word_length': 2.2695390781563125, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5181831', 'n_tokens_mistral': 897, 'n_tokens_neox': 870, 'n_words': 336}