public final class Shader
extends java.lang.Object
All static functions. Implements the shading of RGB values to support shadow and lighting highlights.
Each RGB value has 64 shades. shade[0] represents ambient lighting. shade[63] is white ... a full specular highlight.
Modifier and Type | Field and Description |
---|---|
static float |
ambientFraction |
static int |
ambientPercent |
static float |
diffuseFactor |
static int |
diffusePercent |
static float |
intenseFraction |
private static float |
magnitudeLight |
static int |
phongExponent |
private static int |
seed |
static int |
shadeIndexLast |
static int |
shadeIndexMax |
static byte |
shadeIndexNoisyLimit |
static byte |
shadeIndexNormal |
static int |
specularExponent |
static float |
specularFactor |
static boolean |
specularOn |
static int |
specularPercent |
static int |
specularPower |
static byte[] |
sphereShadeIndexes |
static boolean |
sphereShadingCalculated |
static boolean |
usePhongExponent |
static float |
xLight |
private static float |
xLightsource |
static float |
yLight |
private static float |
yLightsource |
static float |
zLight |
private static float |
zLightsource |
static int |
zPower |
Constructor and Description |
---|
Shader() |
Modifier and Type | Method and Description |
---|---|
static void |
calcSphereShading() |
static byte |
getDitheredNoisyShadeIndex(float x,
float y,
float z,
float r) |
private static float |
getFloatShadeIndexNormalized(float x,
float y,
float z) |
static int |
getFp8ShadeIndex(float x,
float y,
float z) |
static int |
getShadeIndex(float x,
float y,
float z) |
static byte |
getShadeIndexNormalized(float x,
float y,
float z) |
static int[] |
getShades(int rgb,
boolean greyScale) |
static int |
nextRandom8Bit()
Implements RANDU algorithm for random noise in lighting/shading.
|
public static final int shadeIndexMax
public static final int shadeIndexLast
public static final byte shadeIndexNormal
public static final byte shadeIndexNoisyLimit
public static int zPower
private static final float xLightsource
private static final float yLightsource
private static final float zLightsource
private static final float magnitudeLight
public static final float xLight
public static final float yLight
public static final float zLight
public static boolean specularOn
public static boolean usePhongExponent
public static int ambientPercent
public static int diffusePercent
public static int specularExponent
public static int specularPercent
public static int specularPower
public static int phongExponent
public static float ambientFraction
public static float diffuseFactor
public static float intenseFraction
public static float specularFactor
public static boolean sphereShadingCalculated
public static final byte[] sphereShadeIndexes
private static int seed
public static int[] getShades(int rgb, boolean greyScale)
public static int getShadeIndex(float x, float y, float z)
public static byte getShadeIndexNormalized(float x, float y, float z)
public static int getFp8ShadeIndex(float x, float y, float z)
private static float getFloatShadeIndexNormalized(float x, float y, float z)
public static byte getDitheredNoisyShadeIndex(float x, float y, float z, float r)
public static void calcSphereShading()
public static int nextRandom8Bit()
Implements RANDU algorithm for random noise in lighting/shading.
RANDU is the classic example of a poor random number generator. But it is very cheap to calculate and is good enough for our purposes.