Most visited

Recently visited

Quad

public class Quad
extends Geometry

java.lang.Object
   ↳ com.viro.core.Geometry
     ↳ com.viro.core.Quad


Quad represents a one-sided plane defined by a width and height.

Summary

Public constructors

Quad(float width, float height)

Construct a new Quad with the given width and height.

Quad(float width, float height, float u0, float v0, float u1, float v1)

Construct a new Quad with custom texture coordinates.

Public methods

void dispose()

Release native resources associated with this Quad.

float getHeight()

Get the height of this Quad.

float getWidth()

Get the width of this Quad.

void setHeight(float height)

Set the height of this Quad.

void setWidth(float width)

Set the width of this Quad.

Public constructors

Quad

Quad (float width, 
                float height)

Construct a new Quad with the given width and height.

Parameters
width float: The extent of the Quad along its horizontal axis (X).

height float: The extent of the Quad along its vertical axis (Y).

Quad

Quad (float width, 
                float height, 
                float u0, 
                float v0, 
                float u1, 
                float v1)

Construct a new Quad with custom texture coordinates. Texture coordinates specify how to tile a Texture across the Quad's geometry.

Texture coordinates are represented on 2D U and V axes (essentially the X and Y axes of the image). The left edge of a texture is U = 0.0 and the right edge of the texture is U = 1.0. Similarly, the top edge of a texture is V=0.0 and the bottom edge of the texture is V=1.0.

Specifying greater than 1.0 on either the U or V axis will cause the tile to repeat itself or clamp, depending on the Texture's setWrapS(Texture.WrapMode). Specifying less than 1.0 on the U or V axis will render that texture partially over the entire quad.

For example, specifying u0,v0 as (0,0) and (u1,v2) as (2,2) will tile the Texture twice over the width and height of the Quad, effectively displaying 4 textures on the Quad. Alternatively, setting (u1,v1) as (0.5, 0.5) will display a quarter of the texture over the entire quad.

Parameters
width float: The extent of the Quad along its horizontal axis (X).

height float: The extent of the Quad along its vertical axis (Y).

u0 float: The texture coordinate that specifies the start Texture left edge.

v0 float: The texture coordinate that specifies the start Texture top edge.

u1 float: The texture coordinate that specifies the end Texture left edge.

v1 float: The texture coordinate that specifies the end Texture top edge.

Public methods

dispose

void dispose ()

Release native resources associated with this Quad.

getHeight

float getHeight ()

Get the height of this Quad.

Returns
float The extent of this Quad along its vertical axis.

getWidth

float getWidth ()

Get the width of this Quad.

Returns
float The extent of this Quad along its horizontal axis.

setHeight

void setHeight (float height)

Set the height of this Quad.

Parameters
height float: The extent of the Quad along its vertical axis.

setWidth

void setWidth (float width)

Set the width of this Quad.

Parameters
width float: The extent of the Quad along its horizontal axis.

Hooray!