RopeGeometry allows you to draw a geometry across several points and then manipulate these points.

Example

import { Point, RopeGeometry } from 'pixi.js';

for (let i = 0; i < 20; i++) {
points.push(new Point(i * 50, 0));
};
const rope = new RopeGeometry(100, points);

Memberof

PIXI

Hierarchy (view full)

Constructors

  • Parameters

    • width: number

      The width (i.e., thickness) of the rope.

    • points: IPoint[]

      An array of PIXI.Point objects to construct this rope.

    • Optional textureScale: number

      By default the rope texture will be stretched to match rope length. If textureScale is positive this value will be treated as a scaling factor and the texture will preserve its aspect ratio instead. To create a tiling rope set baseTexture.wrapMode to PIXI.WRAP_MODES.REPEAT and use a power of two texture, then set textureScale=1 to keep the original texture pixel size. In order to reduce alpha channel artifacts provide a larger texture and downsample - i.e. set textureScale=0.5 to scale it down twice.

    Returns RopeGeometry

Properties

_width: number

The width (i.e., thickness) of the rope.

attributes: {
    [key: string]: Attribute;
}

Type declaration

buffers: Buffer[]
disposeRunner: Runner<any, any[]>
glVertexArrayObjects: {
    [key: number]: {
        [key: string]: WebGLVertexArrayObject;
    };
}

A map of renderer IDs to webgl VAOs

Type declaration

  • [key: number]: {
        [key: string]: WebGLVertexArrayObject;
    }
    • [key: string]: WebGLVertexArrayObject
id: number
indexBuffer: Buffer
instanceCount: number

Number of instances in this geometry, pass it to GeometrySystem.draw().

Default

1
instanced: boolean

Whether the geometry is instanced.

points: IPoint[]

An array of points that determine the rope.

refCount: number

Count of existing (not destroyed) meshes that reference this geometry.

textureScale: number

Rope texture scale, if zero then the rope texture is stretched.

Accessors

  • get width(): number
  • The width (i.e., thickness) of the rope.

    Returns number

Methods

  • Adds an attribute to the geometry Note: stride and start should be undefined if you dont know them, not 0!

    Parameters

    • id: string

      the name of the attribute (matching up to a shader)

    • buffer: number[] | Float32Array | Uint32Array | Buffer

      the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.

    • Optional size: number

      the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2

    • Optional normalized: boolean

      should the data be normalized.

    • Optional type: TYPES

      what type of number is the attribute. Check PIXI.TYPES to see the ones available

    • Optional stride: number

      How far apart, in bytes, the start of each value is. (used for interleaving data)

    • Optional start: number

      How far into the array to start reading values (used for interleaving data)

    • Optional instance: boolean

      Instancing flag

    Returns this

    • Returns self, useful for chaining.
  • 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.

    Parameters

    • Optional buffer: number[] | IArrayBuffer | Buffer

      The buffer that holds the data of the index buffer. You can also provide an Array and a buffer will be created from it.

    Returns Geometry

    • Returns self, useful for chaining.
  • Returns a clone of the geometry.

    Returns Geometry

    • A new clone of this geometry.
  • Destroys the geometry.

    Returns void

  • Disposes WebGL resources that are connected to this geometry.

    Returns void

  • Returns the requested attribute.

    Parameters

    • id: string

      The name of the attribute required

    Returns Attribute

    • The attribute requested.
  • Returns the requested buffer.

    Parameters

    • id: string

      The name of the buffer required.

    Returns Buffer

    • The buffer requested.
  • Returns the index buffer

    Returns Buffer

    • The index buffer.
  • Get the size of the geometries, in vertices.

    Returns number

  • 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 Geometry

    • Returns self, useful for chaining.
  • Returns void

  • refreshes vertices of Rope mesh

    Returns void

  • Merges an array of geometries into a new single one.

    Geometry attribute styles must match for this operation to work.

    Parameters

    • geometries: Geometry[]

      array of geometries to merge

    Returns Geometry

    • Shiny new geometry!

Generated using TypeDoc