public class EnvironmentMap
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
BLUR_TYPE_GAUSSIAN
constant indicating a gaussian blur
|
static int |
BLUR_TYPE_NONE
constant indicating no blur
|
static int |
BLUR_TYPE_SIMPLE
constant indicating simple blur (no weighting)
|
static int |
DEFAULT_DOWNSAMPLE
default setting for downsampling the map
|
static float |
DEFAULT_GAUSSIAN_SIGMA
the default sigma setting for the gaussian kernel
|
static int |
DEFAULT_KERNEL_SIZE
default gaussian kernel size
|
int |
MAX_DOWNSAMPLE_SZ
The maximum downsample size, determined by the environment map image
|
Constructor and Description |
---|
EnvironmentMap(java.awt.image.BufferedImage source,
PTM ptm)
Creates a new instance of EnvironmentMap
|
Modifier and Type | Method and Description |
---|---|
int |
getDownSample()
Gets the down sample.
|
int |
getHeight()
returns the height of the environment map
|
java.awt.image.BufferedImage |
getImage()
Returns the sphere map image used for the environment map
|
int |
getMapIndex(Vec3f normal)
Returns the pixel value indexed by the provided normal in a flat (1D)
pixel buffer
|
int |
getMaxDownsample()
Returns the current amount by which the map can be downsampled
|
int |
getPixel(Vec3f normal)
Returns the pixel indexed by light reflected by the provided normal
|
java.awt.Point |
getPosition(Vec3f normal)
Returns the point on a 2D plane indexed by the provided normal
|
int |
getWidth()
Returns the width of the PTM
|
void |
refresh()
Refreshes the sampling and blur routines
|
void |
release()
free all storage used by this class
|
int[] |
rotatedMap()
Returns a pixel buffer of the rotated map
|
void |
setAngle(int degrees)
Sets the angle for rotation of the map
|
void |
setBlurKernelSize(int i)
Sets the kernel size for the gaussian blur
|
void |
setGaussianBlur()
Set the blur type to gaussian blur
|
void |
setGaussianSigma(float f)
Sets the sigma value for the gaussian blur algorithm
|
void |
setImage(java.awt.image.BufferedImage source)
Set the sphere map image to be used
|
void |
setNoBlur()
Turn off blurring
|
void |
setSampleSize(int i)
Sets the downsample size for the map
|
void |
setSimpleBlur()
Set the blur type to a simple blur (no weights)
|
void |
updateMonitor(Vec3f[] normals)
Updates the local monitor (for debugging)
|
public static final int BLUR_TYPE_GAUSSIAN
public static final int BLUR_TYPE_NONE
public static final int BLUR_TYPE_SIMPLE
public static final int DEFAULT_DOWNSAMPLE
public static final int DEFAULT_KERNEL_SIZE
public static final float DEFAULT_GAUSSIAN_SIGMA
public int MAX_DOWNSAMPLE_SZ
public EnvironmentMap(java.awt.image.BufferedImage source, PTM ptm)
source
- the sphere map imageptm
- the parent PTM to be mappedpublic int getDownSample()
public int getHeight()
public java.awt.image.BufferedImage getImage()
public int getMapIndex(Vec3f normal)
normal
- a normal from the PTM surfacepublic int getMaxDownsample()
public int getPixel(Vec3f normal)
normal
- the normal on the PTMpublic java.awt.Point getPosition(Vec3f normal)
normal
- normal from the PTMpublic int getWidth()
public void refresh()
public void release()
public int[] rotatedMap()
public void setAngle(int degrees)
degrees
- angle in degrees to rotate the mappublic void setBlurKernelSize(int i)
i
- sets the blur kernel sizepublic void setGaussianBlur()
public void setGaussianSigma(float f)
f
- the sigma value for the gaussian blurpublic void setImage(java.awt.image.BufferedImage source)
source
- the sphere map imagepublic void setNoBlur()
public void setSampleSize(int i)
i
- the downsample sizepublic void setSimpleBlur()
public void updateMonitor(Vec3f[] normals)
normals
- list of normals to highlight for debugging