Package org.sunflow.core
Class Texture
- java.lang.Object
-
- org.sunflow.core.Texture
-
public class Texture extends java.lang.Object
Represents a 2D texture, typically used byshaders
.
-
-
Constructor Summary
Constructors Constructor Description Texture(java.lang.String filename, boolean isLinear)
Creates a new texture from the specfied file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Bitmap
getBitmap()
Vector3
getBump(float x, float y, OrthoNormalBasis basis, float scale)
Vector3
getNormal(float x, float y, OrthoNormalBasis basis)
Color
getOpacity(float x, float y)
float
getOpacityAlpha(float x, float y)
Color
getPixel(float x, float y)
Gets the color at location (x,y) in the texture.boolean
isTransparent()
private void
load()
-
-
-
Field Detail
-
filename
private java.lang.String filename
-
isLinear
private boolean isLinear
-
bitmap
private Bitmap bitmap
-
loaded
private int loaded
-
isTransparent
private boolean isTransparent
-
-
Method Detail
-
load
private void load()
-
getBitmap
public Bitmap getBitmap()
-
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 texturey
- y coordinate into the texture- Returns:
- filtered color at location (x,y)
-
getOpacity
public Color getOpacity(float x, float y)
-
getOpacityAlpha
public float getOpacityAlpha(float x, float y)
-
isTransparent
public boolean isTransparent()
-
getNormal
public Vector3 getNormal(float x, float y, OrthoNormalBasis basis)
-
getBump
public Vector3 getBump(float x, float y, OrthoNormalBasis basis, float scale)
-
-