Search code examples
graphicsgeometryrenderingpixi.js

What is the PixiJS Geometry used for (as opposed to DisplayObjects)?


I am reading through the Pixi.js source code, and coming across Geometry which sounds like it would be the core of everything. But it seems the "Graphics.ts" is the core, and the "Renderer.ts". What is the purpose of Geometry as opposed to the DisplayObject? The DisplayObject, Container, and Sprite are basically a tree of rendered objects with their own matrix transforms. But what is Geometry used for?


Solution

  • Currently reading through this myself.

    I found this Medium article that discusses the new Mid Level API that was introduced in PixiJS 5. The Mid-level API being the bridge between WebGL code and the higher abstractions in DisplayObject.

    Geometry acts as part of this bridge along with the Shader and State.

    A geometry refers to a set of attributes and the buffers in which they are stored. PixiJS likes to divide that into two pieces:

    • Geometry Style: This is the set of attributes and their properties.
    • Geometry Data: This is the collection of buffers that provide the data for each attribute.