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 |
---|---|
(package private) float |
ambientFraction |
(package private) int |
ambientPercent |
private int[][] |
ashades |
private int[][] |
ashadesGreyscale |
(package private) boolean |
celOn |
(package private) int |
celPower |
private int |
celRGB |
private float |
celZ |
(package private) float |
diffuseFactor |
(package private) int |
diffusePercent |
byte[][][] |
ellipsoidShades |
(package private) float |
intenseFraction |
(package private) javajs.util.V3 |
lightSource |
static int |
maxSphereCache |
int |
nIn |
int |
nOut |
(package private) int |
phongExponent |
private static int |
SDIM |
private int |
seed |
static int |
SHADE_INDEX_LAST |
private static int |
SHADE_INDEX_MAX |
static byte |
SHADE_INDEX_NOISY_LIMIT |
static byte |
SHADE_INDEX_NORMAL |
private static int |
SLIM |
(package private) int |
specularExponent |
(package private) float |
specularFactor |
(package private) boolean |
specularOn |
(package private) int |
specularPercent |
(package private) int |
specularPower |
byte[] |
sphereShadeIndexes |
int[][] |
sphereShapeCache |
private boolean |
useLight |
(package private) 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(int n) |
void |
createEllipsoidShades() |
(package private) void |
flushCaches() |
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) |
(package private) int[] |
getShades(short colix) |
private int[] |
getShades2(int rgb,
boolean greyScale) |
(package private) int[] |
getShadesG(short colix) |
int |
nextRandom8Bit()
Implements RANDU algorithm for random noise in lighting/shading.
|
(package private) 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 final int SHADE_INDEX_MAX
public static final int SHADE_INDEX_LAST
public static final byte SHADE_INDEX_NORMAL
public static final byte SHADE_INDEX_NOISY_LIMIT
private float xLight
private float yLight
private float zLight
javajs.util.V3 lightSource
boolean specularOn
boolean usePhongExponent
int ambientPercent
int diffusePercent
int specularExponent
int specularPercent
int specularPower
int phongExponent
float ambientFraction
float diffuseFactor
float intenseFraction
float specularFactor
private int[][] ashades
private int[][] ashadesGreyscale
boolean celOn
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)
void setCel(boolean celShading, int celShadingPower, int argb)
void flushCaches()
public void setLastColix(int argb, boolean asGrey)
int[] getShades(short colix)
int[] getShadesG(short colix)
private void checkShades(int n)
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()