How to use the @pixi/core.Geometry function in @pixi/core

To help you get started, we’ve selected a few @pixi/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pixijs / pixi.js / packages / sprite / src / SpriteRenderer.js View on Github external
}

        currentGroup.size = i - currentGroup.start;

        if (!settings.CAN_UPLOAD_SAME_BUFFER)
        {
            // this is still needed for IOS performance..
            // it really does not like uploading to the same buffer in a single frame!
            if (this.vaoMax <= this.vertexCount)
            {
                this.vaoMax++;

                const buffer = new Buffer(null, false);

                /* eslint-disable max-len */
                this.vaos[this.vertexCount] = new Geometry()
                    .addAttribute('aVertexPosition', buffer, 2, false, gl.FLOAT)
                    .addAttribute('aTextureCoord', buffer, 2, true, gl.UNSIGNED_SHORT)
                    .addAttribute('aColor', buffer, 4, true, gl.UNSIGNED_BYTE)
                    .addAttribute('aTextureId', buffer, 1, true, gl.FLOAT)
                    .addIndex(this.indexBuffer);
                /* eslint-enable max-len */

                this.vertexBuffers[this.vertexCount] = buffer;
            }

            this.vertexBuffers[this.vertexCount].update(buffer.vertices, 0);
            this.renderer.geometry.bind(this.vaos[this.vertexCount]);

            this.vertexCount++;
        }
        else
github pixijs / pixi.js / packages / sprite / src / SpriteRenderer.js View on Github external
// step 2: check the maximum number of if statements the shader can have too..
            this.MAX_TEXTURES = checkMaxIfStatementsInShader(this.MAX_TEXTURES, gl);
        }

        // generate generateMultiTextureProgram, may be a better move?
        this.shader = generateMultiTextureShader(gl, this.MAX_TEXTURES);

        // we use the second shader as the first one depending on your browser may omit aTextureId
        // as it is not used by the shader so is optimized out.
        for (let i = 0; i < this.vaoMax; i++)
        {
            const buffer = new Buffer(null, false);

            /* eslint-disable max-len */
            this.vaos[i] = new Geometry()
                .addAttribute('aVertexPosition', buffer, 2, false, gl.FLOAT)
                .addAttribute('aTextureCoord', buffer, 2, true, gl.UNSIGNED_SHORT)
                .addAttribute('aColor', buffer, 4, true, gl.UNSIGNED_BYTE)
                .addAttribute('aTextureId', buffer, 1, true, gl.FLOAT)
                .addIndex(this.indexBuffer);
            /* eslint-enable max-len */

            this.vertexBuffers[i] = buffer;
        }
    }
github pixijs / pixi.js / packages / graphics / src / WebGLGraphicsData.js View on Github external
/**
         * Whether this graphics is nativeLines or not
         * @member {boolean}
         */
        this.nativeLines = false;

        this.glPoints = null;
        this.glIndices = null;

        /**
         *
         * @member {PIXI.Shader}
         */
        this.shader = shader;

        this.geometry = new Geometry()
            .addAttribute('aVertexPosition|aColor', this.buffer)
            .addIndex(this.indexBuffer);
    }
github pixijs / pixi.js / packages / particles / src / ParticleBuffer.js View on Github external
constructor(properties, dynamicPropertyFlags, size)
    {
        this.geometry = new Geometry();

        this.indexBuffer = null;

        /**
         * The number of particles the buffer can hold
         *
         * @private
         * @member {number}
         */
        this.size = size;

        /**
         * A list of the properties that are dynamic.
         *
         * @private
         * @member {object[]}