org.sunflow.core

Class Texture


public class Texture
extends java.lang.Object

Represents a 2D texture, typically used by shaders.

Method Summary

Bitmap
getBitmap()
Vector3
getBump(float x, float y, OrthoNormalBasis basis, float scale)
Vector3
getNormal(float x, float y, OrthoNormalBasis basis)
Color
getPixel(float x, float y)
Gets the color at location (x,y) in the texture.

Method Details

getBitmap

public Bitmap getBitmap()

getBump

public Vector3 getBump(float x,
                       float y,
                       OrthoNormalBasis basis,
                       float scale)

getNormal

public Vector3 getNormal(float x,
                         float y,
                         OrthoNormalBasis basis)

getPixel

public Color getPixel(float x,
                      float y)
Gets the color at location (x,y) in the texture. The lookup is performed using the fractional component of the coordinates, treating the texture as a unit square tiled in both directions. Bicubic filtering is performed on the four nearest pixels to the lookup point.
Parameters:
x - x coordinate into the texture
y - y coordinate into the texture
Returns:
filtered color at location (x,y)