QuadComponent

QuadComponent

Quad component that holds a unit Quad mesh and a Material. It makes it easy to create a textured quad in 3D space, for example a logotype. When the component is added to the world, all other needed components are automatically added to the entity. Make sure your add a QuadSystem to the world before you start using this component.

Constructor

new QuadComponent(imageopt, settingsopt)

Parameters:
Name Type Attributes Description
image HTMLImageElement <optional>
settings Object <optional>
Properties
Name Type Attributes Default Description
width number <optional>
1

Width of the Quad mesh. See Quad

height number <optional>
1
tileX number <optional>
1

Number of tiles in the Quad. See Quad

tileY number <optional>
1
preserveAspectRatio number <optional>
true

Will resize the Quad mesh so that the aspect is preserved.

See:
  • QuadSystem

Members

height

The height of the component in 3D space

material :Material

The material currently used by the component.

preserveAspectRatio

Whether to preserve aspect ratio or not. If this property is true, the component will have a maximum dimension of 1 in the 3D space.

tileX

Tiling in x direction

tileY

Tiling in y direction

width

The width of the component in 3D space

Methods

rebuildMeshData()

Re-build the meshData for the meshDataComponent.

setMaterial(material)

Set the current material for the quad

Parameters:
Name Type Description
material Material