public class TextureCreateUtils extends Object
Convenience class with a collection of useful utility methods taking an image and turning it into a Aviatrix3D texture object.
Internationalisation Resource Names| Constructor and Description |
|---|
TextureCreateUtils()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
TextureComponent2D |
create2DTextureComponent(Object content)
Load the image component from the given object type.
|
BufferedImage |
createNormalMap(BufferedImage bumpImage,
BufferedImage destImage)
Convert an image that is a greyscale heightmap into a normal map, for
use in DOT3 bump mapping.
|
Texture2D |
createTexture2D(RenderedImage img)
Given the image, create a texture object from it, resizing the image to
up to a power of 2 if needed.
|
int |
getTextureFormat(TextureComponent comp)
From the image component format, generate the appropriate texture
format.
|
int |
nearestPowerTwo(int val,
boolean scaleUp)
Determine the nearest power of two value for a given argument.
|
RenderedImage |
scaleTexture(RenderedImage ri,
int newWidth,
int newHeight)
Scale a texture to a new size.
|
void |
setErrorReporter(org.j3d.util.ErrorReporter reporter)
Register an error reporter with the engine so that any errors generated
by the node's internals can be reported in a nice, pretty fashion.
|
public void setErrorReporter(org.j3d.util.ErrorReporter reporter)
reporter - The instance to use or nullpublic Texture2D createTexture2D(RenderedImage img)
img - The source image to work withpublic int getTextureFormat(TextureComponent comp)
comp - The image component to get the value frompublic RenderedImage scaleTexture(RenderedImage ri, int newWidth, int newHeight)
ri - The texture to scalenewWidth - The new widthnewHeight - The new heightpublic TextureComponent2D create2DTextureComponent(Object content)
content - The object that was loaded and needs to be convertedpublic int nearestPowerTwo(int val,
boolean scaleUp)
val - The initial sizescaleUp - true to scale the value up, false for downpublic BufferedImage createNormalMap(BufferedImage bumpImage, BufferedImage destImage)
bumpImage - The source image to take the heights fromdestImage - An image to write the normal map to or null if creating new
Copyright © 2001 - 2015 j3d.org