public class TextureUtility extends Object
Modifier and Type | Field and Description |
---|---|
static String[] |
STANDARD_CUBEMAP_PARTS
{"bk","ft","dn","up","lf","rt"}
|
Modifier and Type | Method and Description |
---|---|
static CubeMap |
createCubeMap(Appearance app,
String prefix,
ImageData[] imgs)
method to create a reflectionMap for the 6 given images (as ImageData).
|
static CubeMap |
createCubeMap(Appearance app,
String prefix,
String resourcePrefix,
String[] sides,
String resourceEnding)
Convienience Method to load all 6 images for a ReflectionMap.
|
static ImageData[] |
createCubeMapData(Input zipFile) |
static ImageData[] |
createCubeMapData(String resourcePrefix,
String[] sides,
String resourceEnding)
Convienience Method to load 6 images for a CubeMap.
|
static ImageData |
createPointSprite(int textureSize,
double[] lightDirection,
Color diffuseColor,
Color specularColor,
double specularExponent) |
static CubeMap |
createReflectionMap(Appearance app,
String shader,
ImageData... imgs)
method to create a reflectionMap for the 6 given images (as ImageData).
|
static CubeMap |
createReflectionMap(Appearance app,
String shader,
Input[] data)
method to create a reflectionMap for the 6 given images (as Inputs).
|
static CubeMap |
createReflectionMap(Appearance app,
String shader,
String resourcePrefix,
String[] sides,
String resourceEnding)
Convienience Method to load all 6 images for a ReflectionMap.
|
static CubeMap |
createSkyBox(Appearance app,
ImageData[] imgs)
method to create a sky box for the 6 given images (as ImageData).
|
static CubeMap |
createSkyBox(Appearance app,
Input[] data)
method to create a sky box for the 6 given images (as Inputs).
|
static Texture2D |
createTexture(Appearance app,
String shader,
ImageData img) |
static Texture2D |
createTexture(Appearance app,
String shader,
ImageData img,
boolean readDefaults)
method to create a reflectionMap for the given image (as ImageData).
|
static Texture2D |
createTexture(Appearance app,
String shader,
Input in) |
static Texture2D |
createTexture(Appearance app,
String shader,
Input in,
boolean readDefaults)
method to create a reflectionMap for the given image (as ImageData).
|
static Texture2D |
createTexture(Appearance app,
String shader,
int i,
ImageData img) |
static Texture2D |
createTexture(Appearance app,
String shader,
int i,
ImageData img,
boolean readDefaults) |
static Texture2D |
createTexture(Appearance app,
String shader,
String resourceName) |
static Texture2D |
createTexture(Appearance app,
String shader,
String resourceName,
boolean readDefaults)
method to create a reflectionMap for the given image (as a String to locate as a resource)
|
static Texture2D |
getBackgroundTexture(Appearance rootApp) |
static ImageData[] |
getCubeMapImages(CubeMap rm) |
static boolean |
hasReflectionMap(Appearance app,
String shader) |
static boolean |
hasReflectionMap(EffectiveAppearance ea,
String shader) |
static void |
main(String[] args) |
static CubeMap |
readReflectionMap(EffectiveAppearance app,
String prefix)
method to read the 6 sides of a ReflectionMap.
|
static void |
removeReflectionMap(Appearance app,
String shader) |
static void |
removeTexture(Appearance app,
String shader) |
static void |
setBackgroundTexture(Appearance rootApp,
ImageData id)
Background image
|
public static final String[] STANDARD_CUBEMAP_PARTS
public static Texture2D createTexture(Appearance app, String shader, ImageData img, boolean readDefaults)
app
- the appearance where to create the Texture2Dshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsoimg
- the ImageDatareadDefaults
- true for the Texture2D to return default values, if false it returns null for unset valuespublic static Texture2D createTexture(Appearance app, String shader, int i, ImageData img, boolean readDefaults)
public static Texture2D createTexture(Appearance app, String shader, ImageData img)
public static Texture2D createTexture(Appearance app, String shader, int i, ImageData img)
public static Texture2D createTexture(Appearance app, String shader, Input in, boolean readDefaults) throws IOException
app
- the appearance where to create the Texture2Dshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsoin
- an Input to load the ImageData fromIOException
public static Texture2D createTexture(Appearance app, String shader, Input in) throws IOException
IOException
public static Texture2D createTexture(Appearance app, String shader, String resourceName, boolean readDefaults) throws IOException
app
- the appearance where to create the Texture2Dshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsoresourceName
- IOException
- if the resource fails to loadReaders.getInput()
public static Texture2D createTexture(Appearance app, String shader, String resourceName) throws IOException
IOException
public static CubeMap createReflectionMap(Appearance app, String shader, ImageData... imgs)
app
- the appearance where to create the ReflectionMapshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsoimgs
- public static CubeMap createReflectionMap(Appearance app, String shader, Input[] data) throws IOException
app
- the appearance where to create the ReflectionMapshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsodata
- an array of 6 imagesIOException
- if data fails to loadpublic static CubeMap createReflectionMap(Appearance app, String shader, String resourcePrefix, String[] sides, String resourceEnding) throws IOException
resourcePrefix+sides[i=0..5]+resourceEndingThe order of the 6 images is the same as for the other ReflectionMap methods: {"bk","ft","dn","up","lf","rt"}
app
- the appearance where to create the ReflectionMapshader
- the name of the shader, should be null, "", "polygonShader" maybe "lineShader" works alsoresourcePrefix
- part of the resource namessides
- part of the resource namesresourceEnding
- part of the resource namesIOException
- if the resources fail to loadpublic static CubeMap readReflectionMap(EffectiveAppearance app, String prefix)
app
- the ea to read fromprefix
- the prefix under which the ReflectionMap is written to the appearancepublic static CubeMap createCubeMap(Appearance app, String prefix, ImageData[] imgs)
app
- the appearance where to create the ReflectionMapprefix
- the prefix, i. e. "polygonShader.reflectionMap" or "skyBox", ...imgs
- public static CubeMap createSkyBox(Appearance app, ImageData[] imgs)
app
- the appearance where to create the sky boximgs
- public static CubeMap createSkyBox(Appearance app, Input[] data) throws IOException
app
- the appearance where to create the sky boxdata
- an array of 6 imagesIOException
- if data fails to loadpublic static CubeMap createCubeMap(Appearance app, String prefix, String resourcePrefix, String[] sides, String resourceEnding) throws IOException
resourcePrefix+sides[i=0..5]+resourceEndingThe order of the 6 images is the same as for the other ReflectionMap methods: {"bk","ft","dn","up","lf","rt"}
app
- the appearance where to create the sky boxresourcePrefix
- part of the resource namessides
- part of the resource namesresourceEnding
- part of the resource namesIOException
- if the resources fail to loadpublic static ImageData[] createCubeMapData(String resourcePrefix, String[] sides, String resourceEnding) throws IOException
resourcePrefix+sides[i=0..5]+resourceEndingThe order of the 6 images is the same as for the other CubeMap methods: {"bk","ft","dn","up","lf","rt"}
resourcePrefix
- part of the resource namessides
- part of the resource namesresourceEnding
- part of the resource namesImageData
sIOException
- if the resources fail to loadpublic static ImageData[] createCubeMapData(Input zipFile) throws IOException
IOException
public static ImageData createPointSprite(int textureSize, double[] lightDirection, Color diffuseColor, Color specularColor, double specularExponent)
public static void removeReflectionMap(Appearance app, String shader)
public static void removeTexture(Appearance app, String shader)
public static void main(String[] args) throws IOException
IOException
public static boolean hasReflectionMap(EffectiveAppearance ea, String shader)
public static boolean hasReflectionMap(Appearance app, String shader)
public static void setBackgroundTexture(Appearance rootApp, ImageData id)
public static Texture2D getBackgroundTexture(Appearance rootApp)