Most visited

Recently visited

Surface

public class Surface
extends Geometry

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


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

Summary

Public constructors

Surface(float width, float height)

Construct a new Surface with the given width and height.

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

Construct a new Surface with custom texture coordinates.

Public methods

void dispose()

Release native resources associated with this Surface.

float getHeight()

Get the height of this surface.

float getWidth()

Get the width of this Surface.

void setHeight(float height)

Set the height of this Surface.

void setWidth(float width)

Set the width of this Surface.

Public constructors

Surface

Surface (float width, 
                float height)

Construct a new Surface with the given width and height.

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

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

Surface

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

Construct a new Surface with custom texture coordinates. Texture coordinates specify how to tile a Texture across the Surface'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 surface.

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 Surface, effectively displaying 4 textures on the Surface. Alternatively, setting (u1,v1) as (0.5, 0.5) will display a quarter of the texture over the entire surface.

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

height float: The extent of the Surface 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 Surface.

getHeight

float getHeight ()

Get the height of this surface.

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

getWidth

float getWidth ()

Get the width of this Surface.

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

setHeight

void setHeight (float height)

Set the height of this Surface.

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

setWidth

void setWidth (float width)

Set the width of this Surface.

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

Hooray!