phaser - v3.90.0
    Preparing search index...

    A Vertex Geometry Object.

    This class consists of all the information required for a single vertex within a Face Geometry Object.

    Faces, and thus Vertex objects, are used by the Mesh Game Object in order to render objects in WebGL.

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • x: number

        The x position of the vertex.

      • y: number

        The y position of the vertex.

      • z: number

        The z position of the vertex.

      • u: number

        The UV u coordinate of the vertex.

      • v: number

        The UV v coordinate of the vertex.

      • Optionalcolor: number

        The color value of the vertex. Default 0xffffff.

      • Optionalalpha: number

        The alpha value of the vertex. Default 1.

      • Optionalnx: number

        The x normal value of the vertex. Default 0.

      • Optionalny: number

        The y normal value of the vertex. Default 0.

      • Optionalnz: number

        The z normal value of the vertex. Default 0.

      Returns Geom.Mesh.Vertex

    Properties

    alpha: number

    The alpha value of this vertex.

    color: number

    The color value of this vertex.

    nx: number

    The normalized projected x coordinate of this vertex.

    ny: number

    The normalized projected y coordinate of this vertex.

    nz: number

    The normalized projected z coordinate of this vertex.

    ta: number

    The translated alpha value of this vertex.

    tu: number

    The translated uv u coordinate of this vertex.

    tv: number

    The translated uv v coordinate of this vertex.

    tx: number

    The translated x coordinate of this vertex.

    ty: number

    The translated y coordinate of this vertex.

    u: number

    UV u coordinate of this vertex.

    v: number

    UV v coordinate of this vertex.

    vx: number

    The projected x coordinate of this vertex.

    vy: number

    The projected y coordinate of this vertex.

    vz: number

    The projected z coordinate of this vertex.

    x: number

    The x component of this Vector.

    y: number

    The y component of this Vector.

    z: number

    The z component of this Vector.

    A static back Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static down Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    FORWARD: Math.Vector3

    A static forward Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static left Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static one Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    RIGHT: Math.Vector3

    A static right Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static up Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    A static zero Vector3 for use by reference.

    This constant is meant for comparison operations and should not be modified directly.

    Methods

    • Add the given value to each component of this Vector.

      Parameters

      • s: number

        The amount to add to this Vector.

      Returns Math.Vector3

    • Calculate the dot product of this Vector and the given Vector.

      Parameters

      • v: Math.Vector3

        The Vector3 to dot product with this Vector3.

      Returns number

    • Check whether this Vector is equal to a given Vector.

      Performs a strict equality check against each Vector's components.

      Parameters

      Returns boolean

    • Sets the components of this Vector3 from the given array, based on the offset.

      Vector3.x = array[offset] Vector3.y = array[offset + 1] Vector3.z = array[offset + 2]

      Parameters

      • array: number[]

        The array of values to get this Vector from.

      • Optionaloffset: number

        The offset index into the array. Default 0.

      Returns Math.Vector3

    • Calculate the length (or magnitude) of this Vector.

      Returns number

    • Calculate the length of this Vector squared.

      Returns number

    • Linearly interpolate between this Vector and the given Vector.

      Interpolates this Vector towards the given Vector.

      Parameters

      • v: Math.Vector3

        The Vector3 to interpolate towards.

      • Optionalt: number

        The interpolation percentage, between 0 and 1. Default 0.

      Returns Math.Vector3

    • Loads the data from this Vertex into the given Typed Arrays.

      Parameters

      • F32: Float32Array

        A Float32 Array to insert the position, UV and unit data in to.

      • U32: Uint32Array

        A Uint32 Array to insert the color and alpha data in to.

      • offset: number

        The index of the array to insert this Vertex to.

      • textureUnit: number

        The texture unit currently in use.

      • tintEffect: number

        The tint effect to use.

      Returns number

    • Sets the components of this Vector to be the Math.max result from the given vector.

      Parameters

      • v: Math.Vector3

        The Vector3 to check the maximum values against.

      Returns Math.Vector3

    • Sets the components of this Vector to be the Math.min result from the given vector.

      Parameters

      • v: Math.Vector3

        The Vector3 to check the minimum values against.

      Returns Math.Vector3

    • Normalize this Vector.

      Makes the vector a unit length vector (magnitude of 1) in the same direction.

      Returns Math.Vector3

    • Multiplies this Vector3 by the specified matrix, applying a W divide. This is useful for projection, e.g. unprojecting a 2D point into 3D space.

      Parameters

      • mat: Math.Matrix4

        The Matrix4 to multiply this Vector3 with.

      Returns Math.Vector3

    • Resizes this Vertex by setting the x and y coordinates, then transforms this vertex by an identity matrix and dimensions, storing the results in vx, vy and vz.

      Parameters

      • x: number

        The x position of the vertex.

      • y: number

        The y position of the vertex.

      • width: number

        The width of the parent Mesh.

      • height: number

        The height of the parent Mesh.

      • originX: number

        The originX of the parent Mesh.

      • originY: number

        The originY of the parent Mesh.

      Returns this

    • Scale this Vector by the given value.

      Parameters

      • scale: number

        The value to scale this Vector by.

      Returns Math.Vector3

    • Scales the original UV values by the given amounts.

      The original properties Vertex.u and Vertex.v remain unchanged, only the translated properties Vertex.tu and Vertex.tv, as used in rendering, are updated.

      Parameters

      • x: number

        The amount to scale the UV u coordinate by.

      • y: number

        The amount to scale the UV v coordinate by.

      Returns this

    • Translates the original UV positions by the given amounts.

      The original properties Vertex.u and Vertex.v remain unchanged, only the translated properties Vertex.tu and Vertex.tv, as used in rendering, are updated.

      Parameters

      • x: number

        The amount to scroll the UV u coordinate by.

      • y: number

        The amount to scroll the UV v coordinate by.

      Returns this

    • Set the x, y, and z components of this Vector to the given x, y, and z values.

      Parameters

      • x: number | object

        The x value to set for this Vector, or an object containing x, y and z components.

      • Optionaly: number

        The y value to set for this Vector.

      • Optionalz: number

        The z value to set for this Vector.

      Returns Math.Vector3

    • Sets the U and V properties.

      Also resets the translated uv properties, undoing any scale or shift they may have had.

      Parameters

      • u: number

        The UV u coordinate of the vertex.

      • v: number

        The UV v coordinate of the vertex.

      Returns this

    • Transforms this vertex by the given matrix, storing the results in vx, vy and vz.

      Parameters

      • transformMatrix: Math.Matrix4

        The transform matrix to apply to this vertex.

      • width: number

        The width of the parent Mesh.

      • height: number

        The height of the parent Mesh.

      • cameraZ: number

        The z position of the MeshCamera.

      Returns void

    • Unproject this point from 2D space to 3D space. The point should have its x and y properties set to 2D screen space, and the z either at 0 (near plane) or 1 (far plane). The provided matrix is assumed to already be combined, i.e. projection * view * model.

      After this operation, this vector's (x, y, z) components will represent the unprojected 3D coordinate.

      Parameters

      • viewport: Vector4

        Screen x, y, width and height in pixels.

      • invProjectionView: Math.Matrix4

        Combined projection and view matrix.

      Returns Math.Vector3

    • Set this Vector to point up.

      Sets the y component of the vector to 1, and the others to 0.

      Returns Math.Vector3

    • Updates this Vertex based on the given transform.

      Parameters

      • a: number

        The parent transform matrix data a component.

      • b: number

        The parent transform matrix data b component.

      • c: number

        The parent transform matrix data c component.

      • d: number

        The parent transform matrix data d component.

      • e: number

        The parent transform matrix data e component.

      • f: number

        The parent transform matrix data f component.

      • roundPixels: boolean

        Round the vertex position or not?

      • alpha: number

        The alpha of the parent object.

      Returns this