Foundry Virtual Tabletop - API Documentation - Version 14
    Preparing search index...

    A special subclass of PrimarySpriteMesh used to render an interactive door.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _animatedPosition: DoorStateSnapshot

    The currently rendered position of the door.

    _closedPosition: DoorStateSnapshot

    The original position of the door in its resting CLOSED state.

    _transformID: number = -1

    The transform ID.

    _transformTrimmedID: number = -1

    The transform ID.

    indices: Uint16Array

    The indices of the geometry.

    textureAlphaThreshold: number = 0

    The texture alpha threshold used for point containment tests. If set to a value larger than 0, the texture alpha data is extracted from the texture at 25% resolution.

    texturePadding: number = 0

    An amount of pixel padding surrounding the door texture.

    _anchor: ObservablePoint<any>

    The anchor point defines the normalized coordinates in the texture that map to the position of this sprite.

    By default, this is (0,0) (or texture.defaultAnchor if you have modified that), which means the position (x,y) of this Sprite will be the top-left corner.

    Note: Updating texture.defaultAnchor after constructing a Sprite does not update its anchor.

    https://docs.cocos2d-x.org/cocos2d-x/en/sprites/manipulation.html

    _batchData: {
        _texture: Texture;
        _tintRGB: number;
        blendMode: BLEND_MODES;
        indices: number[];
        uvs: number[];
        vertexData: number[];
        worldAlpha: number;
    } = ...

    Snapshot of some parameters of this display object to render in batched mode.

    _cachedTint: [red: number, green: number, blue: number, alpha: number] = ...

    Cached tint value so we can tell when the tint is changed.

    _height: number = 0

    The height of the sprite (this is initially set by the texture)

    _paddingX: number
    _paddingY: number

    The shader bound to this mesh.

    _texture: Texture<Resource>

    The texture that the sprite is using.

    _textureAlphaData: any = null

    The texture alpha data.

    _textureID: number = -1

    The texture ID.

    _textureTrimmedID: number = -1

    The texture trimmed ID.

    _textureUvs: TextureUvs | null = null

    An instance of a texture uvs used for padded SpriteMesh. Instanced only when padding becomes non-zero.

    _tintAlphaDirty: boolean = true

    Used to track a tint or alpha change to execute a recomputation of _cachedTint.

    _tintColor: Color = ...

    The tint applied to the sprite. This is a hex value. A value of 0xFFFFFF will remove any tint effect.

    _tintRGB: number = 0xFFFFFF

    The tint applied to the sprite. This is a RGB value. A value of 0xFFFFFF will remove any tint effect.

    _width: number = 0

    The width of the sprite (this is initially set by the texture).

    "#renderedFrameId": number = -1

    Last renderer pass in which this mesh actually drew its own content.

    uvs: Float32Array

    This is used to store the uvs data of the sprite, assigned at the same time as the vertexData in calculateVertices().

    vertexData: Float32Array

    This is used to store the vertex data of the sprite (basically a quad).

    vertexTrimmedData: Float32Array | null = null

    This is used to calculate the bounds of the object IF it is a trimmed sprite.

    DOOR_STYLES: Readonly<
        { DOUBLE_LEFT: "doubleL"; DOUBLE_RIGHT: "doubleR"; SINGLE: "single" },
    > = ...

    The possible rendering styles for a door mesh.

    Accessors

    • get alphaMode(): ALPHA_MODES

      Used to force an alpha mode on this sprite mesh. If this property is non null, this value will replace the texture alphaMode when computing color channels. Affects how tint, worldAlpha and alpha are computed each others.

      Returns ALPHA_MODES

    • get anchor(): ObservablePoint<any>

      The anchor sets the origin point of the sprite. The default value is taken from the texture and passed to the constructor.

      The default is (0,0), this means the sprite's origin is the top left.

      Setting the anchor to (0.5,0.5) means the sprite's origin is centered.

      Setting the anchor to (1,1) would mean the sprite's origin point will be the bottom right corner.

      If you pass only single parameter, it will set both x and y to the same value as shown in the example below.

      Returns ObservablePoint<any>

    • get animationId(): string

      The identifier for this door animation.

      Returns string

    • set blendMode(value: BLEND_MODES): void

      The blend mode applied to the SpriteMesh.

      Parameters

      • value: BLEND_MODES

      Returns void

      PIXI.BLEND_MODES.NORMAL
      
    • get culledThisPass(): boolean

      True if the mesh was culld (visited but not drawn) during the current pass.

      Returns boolean

    • get height(): number

      Returns number

    • set height(height: number): void

      The height of the Container, setting this will actually modify the scale to achieve the value set.

      Parameters

      • height: number

      Returns void

    • get isVideo(): boolean

      Is this SpriteMesh rendering a video texture?

      Returns boolean

    • get padding(): number

      The maximum x/y padding in pixels (must be a non-negative value.)

      Returns number

    • get paddingX(): number

      The x padding in pixels (must be a non-negative value.)

      Returns number

    • get paddingY(): number

      They y padding in pixels (must be a non-negative value.)

      Returns number

    • get pluginName(): string | null

      Returns the SpriteMesh associated batch plugin. By default the returned plugin is that of the associated shader. If a plugin is forced, it will returns the forced plugin. A null value means that this SpriteMesh has no associated plugin.

      Returns string | null

    • get renderedThisPass(): boolean

      True if this mesh drew its own content during the current renderer pass.

      Returns boolean

    • set roundPixels(value: boolean): void

      If true PixiJS will Math.round() x/y values when rendering, stopping pixel interpolation. Advantages can include sharper image quality (like text) and faster rendering on canvas. The main disadvantage is movement of objects may appear less smooth. To set the global default, change PIXI.settings.ROUND_PIXELS

      Parameters

      • value: boolean

      Returns void

      PIXI.settings.ROUND_PIXELS
      
    • get sourceElement(): ImageSource | null

      The HTML source element for this SpriteMesh texture.

      Returns ImageSource | null

    • get texture(): Texture<Resource>

      The texture that the sprite is using.

      Returns Texture<Resource>

    • get tint(): number

      The tint applied to the sprite. This is a hex value.

      A value of 0xFFFFFF will remove any tint effect.

      Returns number

      0xFFFFFF
      
    • get visitedThisPass(): boolean

      True if this mesh was visited by the renderer during the current pass.

      Returns boolean

    • get width(): number

      Returns number

    • set width(width: number): void

      The width of the Container, setting this will actually modify the scale to achieve the value set.

      Parameters

      • width: number

      Returns void

    Methods

    • When the texture is updated, this event will fire to update the scale and frame.

      Returns void

    • Internal

      Render the sprite with ERASE blending. Note: The sprite must not have visible/renderable children.

      Parameters

      • renderer: Renderer

        The renderer

      Returns void

    • Animate the door to its current rendered state.

      Parameters

      • open: boolean

        Is the door now open or closed?

      Returns Promise<void>

    • Calculates worldTransform * vertices for a non texture with a trim. store it in vertexTrimmedData.

      This is used to ensure that the true width and height of a trimmed texture is respected.

      Returns void

    • Is the given point in canvas space contained in this object?

      Parameters

      • point: IPointData

        The point in canvas space

      • OptionaltextureAlphaThreshold: number = ...

        The minimum texture alpha required for containment

      Returns boolean

    • Is the given point in world space contained in this object?

      Parameters

      • point: IPointData

        The point in world space

      • OptionaltextureAlphaThreshold: number = ...

        The minimum texture alpha required for containment

      Returns boolean

    • An all-in-one helper method: Resizing the PCO according to desired dimensions and options. This helper computes the width and height based on the following factors:

      • The ratio of texture width and base width.
      • The ratio of texture height and base height.

      Additionally, It takes into account the desired fit options:

      • (default) "fill" computes the exact width and height ratio.
      • "cover" takes the maximum ratio of width and height and applies it to both.
      • "contain" takes the minimum ratio of width and height and applies it to both.
      • "width" applies the width ratio to both width and height.
      • "height" applies the height ratio to both width and height.

      You can also apply optional scaleX and scaleY options to both width and height. The scale is applied after fitting.

      Important: By using this helper, you don't need to set the height, width, and scale properties of the DisplayObject.

      Note: This is a helper method. Alternatively, you could assign properties as you would with a PIXI DisplayObject.

      Parameters

      • baseWidth: number

        The base width used for computations.

      • baseHeight: number

        The base height used for computations.

      • Optionaloptions: {
            fit?: "fill" | "width" | "height" | "cover" | "contain";
            scaleX?: number;
            scaleY?: number;
        } = {}

        The options.

        • Optionalfit?: "fill" | "width" | "height" | "cover" | "contain"

          The fit type.

        • OptionalscaleX?: number

          The scale on X axis.

        • OptionalscaleY?: number

          The scale on Y axis.

      Returns void

    • Initialize shader based on the shader class type.

      Parameters

      • shaderClass: any

        The shader class

      Returns void

    • Update uvs and push vertices and uv buffers on GPU if necessary.

      Returns void

    • Create a SpriteMesh from another source. You can specify texture options and a specific shader class derived from BaseSamplerShader.

      Parameters

      • source: string | Texture<Resource> | HTMLVideoElement | HTMLCanvasElement

        Source to create texture from.

      • OptionaltextureOptions: object

        See PIXI.BaseTexture's constructor for options.

      • OptionalshaderClass: BaseSamplerShader

        The shader class to use. BaseSamplerShader by default.

      Returns SpriteMesh

    • Special initialization needed for descending door types.

      Parameters

      Returns void

    • When opening a descending door, shift its elevation to the background after animation.

      Parameters

      Returns Promise<void>

    • When closing a descending door, shift its elevation to the foreground before animation.

      Parameters

      Returns Promise<void>