public class Sphere3D
extends java.lang.Object
Implements high performance rendering of shaded spheres.
Drawing spheres quickly is critically important to Jmol. These routines implement high performance rendering of spheres in 3D.
If you can think of a faster way to implement this, please let us know.
There is a lot of bit-twiddling going on here, which may make the code difficult to understand for non-systems programmers.
Ellipsoid code added 4/2008 -- Bob Hanson hansonr@stolaf.eduModifier and Type | Field and Description |
---|---|
private boolean |
addAllPixels |
private double[] |
coef |
private int |
depth |
private int |
diameter |
private float[][] |
dxyz |
private static byte[][][] |
ellipsoidShades |
(package private) Graphics3D |
g3d |
private int |
height |
private javax.vecmath.Matrix3f |
mat |
private static int |
maxOddSizeSphere |
private static int |
maxSphereCache |
(package private) static int |
maxSphereDiameter |
(package private) static int |
maxSphereDiameter2 |
private int |
maxX |
private int |
maxY |
private int |
maxZ |
private javax.vecmath.Matrix4f |
mDeriv |
private int |
minX |
private int |
minY |
private int |
minZ |
private static int |
nIn |
private static int |
nOut |
private javax.vecmath.Point3i[] |
octantPoints |
private int |
offsetPbufBeginLine |
private int |
planeShade |
private int[] |
planeShades |
private javax.vecmath.Point3f |
ptTemp |
private static int |
SDIM |
private int |
selectedOctant |
private static int |
SHADE_SLAB_CLIPPED |
private int[] |
shades |
private int |
slab |
private static int |
SLIM |
private static int[][] |
sphereShapeCache |
private boolean |
tScreened |
private int |
width |
private int |
x |
private int |
y |
private int |
z |
private int |
z0 |
private int[] |
zbuf |
private double[] |
zroot |
Constructor and Description |
---|
Sphere3D(Graphics3D g3d) |
Modifier and Type | Method and Description |
---|---|
private static void |
createEllipsoidShades() |
private static int[] |
createSphereShape(int diameter) |
(package private) static void |
flushSphereCache() |
private static int |
getEllipsoidShade(float x,
float y,
float z,
int radius,
javax.vecmath.Matrix4f mDeriv) |
private int |
getPlaneShade(int xCurrent,
int yCurrent,
double[] zroot) |
private static int[] |
getSphereShape(int diameter) |
(package private) void |
render(int[] shades,
boolean tScreened,
int diameter,
int x,
int y,
int z,
javax.vecmath.Matrix3f mat,
double[] coef,
javax.vecmath.Matrix4f mDeriv,
int selectedOctant,
javax.vecmath.Point3i[] octantPoints) |
private void |
renderLarge() |
private void |
renderQuadrant(int xSign,
int ySign) |
private void |
renderQuadrantClipped(int radius,
int xSign,
int ySign) |
private void |
renderQuadrantUnclipped(int radius,
int xSign,
int ySign) |
private void |
renderShapeClipped(int[] sphereShape) |
private void |
renderShapeUnclipped(int[] sphereShape) |
private void |
setPlaneDerivatives() |
Graphics3D g3d
private static final int maxSphereCache
private static final int maxOddSizeSphere
static final int maxSphereDiameter
static final int maxSphereDiameter2
private static final int[][] sphereShapeCache
private double[] zroot
private static int nOut
private static int nIn
private javax.vecmath.Matrix3f mat
private double[] coef
private javax.vecmath.Matrix4f mDeriv
private int selectedOctant
private javax.vecmath.Point3i[] octantPoints
private int planeShade
private int[] zbuf
private int width
private int height
private int depth
private int slab
private int offsetPbufBeginLine
private boolean addAllPixels
private int minX
private int maxX
private int minY
private int maxY
private int minZ
private int maxZ
private int x
private int y
private int z
private int diameter
private boolean tScreened
private int[] shades
private static final int SHADE_SLAB_CLIPPED
private final javax.vecmath.Point3f ptTemp
private final int[] planeShades
private final float[][] dxyz
private int z0
private static byte[][][] ellipsoidShades
private static final int SLIM
private static final int SDIM
Sphere3D(Graphics3D g3d)
static void flushSphereCache()
private static int[] getSphereShape(int diameter)
private static int[] createSphereShape(int diameter)
void render(int[] shades, boolean tScreened, int diameter, int x, int y, int z, javax.vecmath.Matrix3f mat, double[] coef, javax.vecmath.Matrix4f mDeriv, int selectedOctant, javax.vecmath.Point3i[] octantPoints)
private void renderShapeUnclipped(int[] sphereShape)
private void renderShapeClipped(int[] sphereShape)
private void renderLarge()
private void renderQuadrant(int xSign, int ySign)
private void renderQuadrantUnclipped(int radius, int xSign, int ySign)
private void renderQuadrantClipped(int radius, int xSign, int ySign)
private void setPlaneDerivatives()
private int getPlaneShade(int xCurrent, int yCurrent, double[] zroot)
private static void createEllipsoidShades()
private static int getEllipsoidShade(float x, float y, float z, int radius, javax.vecmath.Matrix4f mDeriv)