Newer
Older
pixi.js / src / mesh / geometry / GeometryStyle.js
@Mat Groves Mat Groves on 4 Jan 2017 784 bytes listing pass
export default class GeometryStyle
{
    constructor()
    {
        this.attributes = {};

        this.indexBuffer = null;
    }

    addAttribute(id, attribute)
    {
        this.attributes[id] = attribute;

        return this;
    }

    addIndex(buffer)
    {
        this.indexBuffer = buffer;

        return this;
    }

    generateAttributeLocations()
    {
        const array = [];
        let i;

        for (i in this.attributes)
        {
            array.push(i);
        }

        array.sort();

        const map = {};

        for (i = 0; i < array.length; i++)
        {
            map[array[i]] = i;
        }

        console.log(map)

        return map;
    }

    destroy()
    {
        this.attributes = null;

        this.indexBuffer = null;
    }
}