Shaku

Shaku JS

Back To Table of Content

Vertex

Vertex

A vertex we can push to sprite batch.

Kind: global class

new Vertex(position, textureCoord, color, normal)

Create the vertex data.

Param Type Description
position Vector2 | Vector3 Vertex position.
textureCoord Vector2 Vertex texture coord (in pixels).
color Color Vertex color (undefined will default to white).
normal Vector3 Vertex normal.

vertex.setPosition(position, useRef) ⇒ Vertex

Set position.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
position Vector2 | Vector3 Vertex position.
useRef Boolean If true, will not clone the given position vector and use its reference instead.

vertex.setTextureCoords(textureCoord, useRef) ⇒ Vertex

Set texture coordinates.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
textureCoord Vector2 Vertex texture coord (in pixels).
useRef Boolean If true, will not clone the given coords vector and use its reference instead.

vertex.setColor(color, useRef) ⇒ Vertex

Set vertex color.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
color Color Vertex color.
useRef Boolean If true, will not clone the given color and use its reference instead.

vertex.setNormal(normal, useRef) ⇒ Vertex

Set vertex normal.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
normal Vector3 Vertex normal.
useRef Boolean If true, will not clone the given normal and use its reference instead.

vertex.setBinormal(binormal, useRef) ⇒ Vertex

Set vertex binormal.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
binormal Vector3 Vertex binormal.
useRef Boolean If true, will not clone the given binormal and use its reference instead.

vertex.setTangent(tangent, useRef) ⇒ Vertex

Set vertex tangent.

Kind: instance method of Vertex
Returns: Vertex - this.

Param Type Description
tangent Vector3 Vertex tangent.
useRef Boolean If true, will not clone the given tangent and use its reference instead.