public class Shader extends 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 |
boolean |
celOn |
int |
celPower |
private int |
celRGB |
private float |
celZ |
float |
diffuseFactor |
int |
diffusePercent |
byte[][][] |
ellipsoidShades |
float |
intenseFraction |
(package private) javajs.util.V3 |
lightSource |
static int |
maxSphereCache |
int |
nIn |
int |
nOut |
int |
phongExponent |
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 |
int[][] |
sphereShapeCache |
private boolean |
useLight |
boolean |
usePhongExponent |
private float |
xLight |
private float |
yLight |
private float |
zLight |
Constructor and Description |
---|
Shader() |
Modifier and Type | Method and Description |
---|---|
private void |
calcSphereShading() |
private void |
checkShades() |
void |
createEllipsoidShades() |
void |
flushCaches() |
void |
flushShades() |
void |
flushSphereCache() |
int |
getEllipsoidShade(float x,
float y,
float z,
int radius,
javajs.util.M4 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 |
occludePixels(int[] pbuf,
int[] zbuf,
int[] aobuf,
int width,
int height,
int ambientOcclusion)
not implemented; just experimenting here
|
void |
setCel(boolean celShading,
int celShadingPower,
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
javajs.util.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
public boolean celOn
public int celPower
private int celRGB
private float celZ
private boolean useLight
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 void setLightSource(float x, float y, float z)
public void setCel(boolean celShading, int celShadingPower, int argb)
public void flushCaches()
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)
private 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, javajs.util.M4 mDeriv)
public void createEllipsoidShades()
public void flushSphereCache()
public void occludePixels(int[] pbuf, int[] zbuf, int[] aobuf, int width, int height, int ambientOcclusion)
pbuf
- zbuf
- aobuf
- width
- height
- ambientOcclusion
-