The maximum number of points to consider an object "batchable", able to be batched by the renderer's batch system.
Get the current bounds of the graphic geometry.
Adds an attribute to the geometry
Note: stride
and start
should be undefined
if you dont know them, not 0!
the name of the attribute (matching up to a shader)
the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.
returns self, useful for chaining.
Add colors.
List of colors to add to
Color to add
Alpha to use
Number of colors to add
Adds an index buffer to the geometry The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.
returns self, useful for chaining.
Add texture id that the shader/fragment wants to use.
Converts intermediate batches data to drawCalls.
Update the local bounds of the object. Expensive to use performance-wise.
Clears the graphics that were drawn to this Graphics object, and resets fill and line style settings.
This GraphicsGeometry object. Good for chaining method calls
returns a clone of the geometry
a new clone of this geometry
Check to see if a point is contained within this geometry.
Point to check if it's contained.
true
if the point is contained within geometry.
Destroys the GraphicsGeometry object.
disposes WebGL resources that are connected to this geometry
Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
The shape object to draw.
Transform applied to the points of the shape.
Returns geometry for chaining.
Draws the given shape to this Graphics object. Can be any of Circle, Rectangle, Ellipse, Line or Polygon.
The shape object to draw.
Defines style of the fill.
Defines style of the lines.
Transform applied to the points of the shape.
Returns geometry for chaining.
returns the requested attribute
the name of the attribute required
the attribute requested.
returns the requested buffer
the name of the buffer required
the buffer requested.
returns the index buffer
the index buffer.
this function modifies the structure so that all current attributes become interleaved into a single buffer This can be useful if your model remains static as it offers a little performance boost
returns self, useful for chaining.
Call if you changed graphicsData manually. Empties all batch buffers.
Checks to see if this graphics geometry can be batched. Currently it needs to be small enough and not contain any native lines.
Packs attributes to single buffer.
Offset the indices so that it works with the batcher.
Process fill part of Graphics.
Process the holes data.
Holes to render
Process line part of Graphics.
Transform points using matrix.
Points to transform
Transform matrix
Generates intermediate batch data. Either gets converted to drawCalls or used to convert to batch objects directly by the Graphics object.
Test geometry for batching process.
Generated using TypeDoc
The Graphics class contains methods used to draw primitive shapes such as lines, circles and rectangles to the display, and to color and fill them.
GraphicsGeometry is designed to not be continually updating the geometry since it's expensive to re-tesselate using earcut. Consider using PIXI.Mesh for this use-case, it's much faster.
PIXI