public class Shader
extends java.lang.Object
All 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 |
---|---|
float |
ambientFraction |
int |
ambientPercent |
private int[][] |
ashades |
private int[][] |
ashadesGreyscale |
private boolean |
celOn |
float |
diffuseFactor |
int |
diffusePercent |
byte[][][] |
ellipsoidShades |
float |
intenseFraction |
(package private) V3 |
lightSource |
static int |
maxSphereCache |
int |
nIn |
int |
nOut |
int |
phongExponent |
private int |
rgbContrast |
private static int |
SDIM |
private int |
seed |
static int |
shadeIndexLast |
private static int |
shadeIndexMax |
static byte |
shadeIndexNoisyLimit |
static byte |
shadeIndexNormal |
private static int |
SLIM |
int |
specularExponent |
float |
specularFactor |
boolean |
specularOn |
int |
specularPercent |
int |
specularPower |
byte[] |
sphereShadeIndexes |
boolean |
sphereShadingCalculated |
int[][] |
sphereShapeCache |
boolean |
usePhongExponent |
private float |
xLight |
private float |
yLight |
private float |
zLight |
Constructor and Description |
---|
Shader() |
Modifier and Type | Method and Description |
---|---|
void |
calcSphereShading() |
private void |
checkShades() |
void |
createEllipsoidShades() |
void |
flushCaches() |
void |
flushShades() |
void |
flushSphereCache() |
boolean |
getCelOn() |
int |
getEllipsoidShade(float x,
float y,
float z,
int radius,
Matrix4f mDeriv) |
byte |
getShadeB(float x,
float y,
float z) |
private float |
getShadeF(float x,
float y,
float z) |
int |
getShadeFp8(float x,
float y,
float z) |
int |
getShadeIndex(float x,
float y,
float z) |
byte |
getShadeN(float x,
float y,
float z,
float r) |
int[] |
getShades(short colix) |
private int[] |
getShades2(int rgb,
boolean greyScale) |
int[] |
getShadesG(short colix) |
int |
nextRandom8Bit()
Implements RANDU algorithm for random noise in lighting/shading.
|
void |
setCel(boolean celOn,
int argb) |
void |
setLastColix(int argb,
boolean asGrey) |
private void |
setLightSource(float x,
float y,
float z) |
private static int shadeIndexMax
public static int shadeIndexLast
public static byte shadeIndexNormal
public static byte shadeIndexNoisyLimit
private float xLight
private float yLight
private float zLight
V3 lightSource
public boolean specularOn
public boolean usePhongExponent
public int ambientPercent
public int diffusePercent
public int specularExponent
public int specularPercent
public int specularPower
public int phongExponent
public float ambientFraction
public float diffuseFactor
public float intenseFraction
public float specularFactor
private int[][] ashades
private int[][] ashadesGreyscale
private int rgbContrast
public boolean sphereShadingCalculated
public byte[] sphereShadeIndexes
private int seed
private static final int SLIM
private static final int SDIM
public static final int maxSphereCache
public int[][] sphereShapeCache
public byte[][][] ellipsoidShades
public int nOut
public int nIn
private boolean celOn
private void setLightSource(float x, float y, float z)
public void setCel(boolean celOn, int argb)
public void flushCaches()
public boolean getCelOn()
public void setLastColix(int argb, boolean asGrey)
public int[] getShades(short colix)
public int[] getShadesG(short colix)
private void checkShades()
public void flushShades()
private int[] getShades2(int rgb, boolean greyScale)
public int getShadeIndex(float x, float y, float z)
public byte getShadeB(float x, float y, float z)
public int getShadeFp8(float x, float y, float z)
private float getShadeF(float x, float y, float z)
public byte getShadeN(float x, float y, float z, float r)
public void calcSphereShading()
public 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.
public int getEllipsoidShade(float x, float y, float z, int radius, Matrix4f mDeriv)
public void createEllipsoidShades()
public void flushSphereCache()