org.jmol.g3d
Class Graphics3D
public final
class
Graphics3D
extends Object
implements JmolRendererInterface
Provides high-level graphics primitives for 3D visualization.
A pure software implementation of a 3D graphics engine.
No hardware required.
Depending upon what you are rendering ... some people say it
is pretty fast.
Author: Miguel, miguel@jmol.org
with additions by Bob Hanson hansonr@stolaf.edu
The above is an understatement to say the least.
This is a two-pass rendering system. In the first pass, all opaque
objects are rendered. In the second pass, all translucent objects
are rendered.
If there are no translucent objects, then that is found in the
first pass as follows:
The renderers first try to set the color index of the object to be
rendered using setColix(short colix), and that method returns false
if we are in the wrong pass for that type of object.
In addition, setColix records in the boolean haveTranslucentObjects
whether a translucent object was seen in the first pass.
The second pass is skipped if this flag is not set. This saves immensely
on rendering time when there are no translucent objects.
THUS, IT IS CRITICAL THAT ALL RENDERING OPTIONS CHECK THE COLIX USING
g3d.setColix(short colix) PRIOR TO RENDERING.
Translucency is rendered only approximately. We can't maintain a full
buffer of all translucent objects. Instead, we "cheat" by maintaining
one translucent z buffer. When a translucent pixel is to be written, its
z position is checked and...
...if it is behind or at the z position of any pixel, it is ignored
...if it is in front of a translucent pixel, it is added to the translucent buffer
...if it is between an opaque and translucent pixel, the translucent pixel is
turned opaque, and the new pixel is added to the translucent buffer
This guarantees accurate translucency when there are no more than two translucent
pixels between the user and an opaque pixel. It's a fudge, for sure. But it is
pretty good, and certainly fine for "draft" work.
Users needing more accurate translucencty are encouraged to use the POV-Ray export
facility for production-level work.
Antialiasing is accomplished as full scene antialiasing. This means that
the width and height are doubled (both here and in TransformManager), the
scene is rendered, and then each set of four pixels is averaged (roughly)
as the final pixel in the width*height buffer.
Antialiasing options allow for antialiasing of all objects:
antialiasDisplay = true
antialiasTranslucent = true
or just the opaque ones:
antialiasDisplay = true
antialiasTranslucent = false
or not at all:
antialiasDisplay = false
The difference will be speed and memory. Adding translucent objects
doubles the buffer requirement, and adding antialiasing quadruples
the buffer requirement.
So we have:
Memory requirements are significant, in multiples of (width) * (height) 32-bit integers:
antialias OFF ON/opaque only ON/all objects
no translucent 1p + 1z = 2 4p + 4z = 8 4p + 4z = 8
objects
with translucent 2p + 2z = 4 5p + 5z = 10 8p + 8z = 16
objects
Note that no antialising at all is required for POV-Ray output.
POV-Ray will do antialiasing on its own.
In principle we could save a bit in the case of antialiasing of
just opaque objects and reuse the p and z buffers for the
translucent buffer, but this hasn't been implemented because the
savings isn't that great, and if you are going to the trouble of
having antialiasing, you probably what it all.
Method Summary |
void | addPixel(int offset, int z, int p) |
static void | addPixelT(int offset, int z, int p, int[] zbuf, int[] pbuf, int[] zbufT, int[] pbufT, int translucencyMask, boolean isPass2, int zMargin, int bgcolor) |
void | applyBlueAnaglyph() |
static short | applyColorTranslucencyLevel(short colix, float translucentLevel) |
void | applyCustomAnaglyph(int[] stereoColors) |
void | applyCyanAnaglyph() |
void | applyGreenAnaglyph() |
static void | averageBufferPixel(int[] pIn, int[] pOut, int pt, int dp) |
void | beginRendering(Matrix3f rotationMatrix) |
static void | calcAveragePoint(Point3f pointA, Point3f pointB, Point3f pointC) |
static void | calcAveragePointN(Point3f[] points, int nPoints, Point3f averagePoint) |
static void | calcBestAxisThroughPoints(Point3f[] points, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection, int nTriesMax) |
static int | calcGreyscaleRgbFromRgb(int rgb)
Return a greyscale rgb value 0-FF using NTSC color luminance algorithm
the alpha component is set to 0xFF. |
int | calcIntensityScreen(Point3f screenA, Point3f screenB, Point3f screenC) |
static void | calcNormalizedNormal(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNormNorm, Vector3f vAB, Vector3f vAC) |
int | calcSurfaceShade(Point3i screenA, Point3i screenB, Point3i screenC) |
void | calcXYNormalToLine(Point3f pointA, Point3f pointB, Vector3f vNormNorm) |
void | changeColixArgb(short id, int argb) |
boolean | checkTranslucent(boolean isAlphaTranslucent) |
static Point3f | colorPointFromInt(int color, Point3f pt) |
static Point3f | colorPointFromString(String colorName, Point3f pt) |
boolean | currentlyRendering() |
void | destroy() |
static float | distanceToPlane(Point4f plane, Point3f pt) |
static float | distanceToPlane(Point4f plane, float d, Point3f pt) |
static float | distanceToPlane(Vector3f norm, float w, Point3f pt) |
void | downsampleFullSceneAntialiasing(boolean downsampleZBuffer) |
void | drawCircleCentered(short colix, int diameter, int x, int y, int z, boolean doFill)
draws a screened circle ... every other dot is turned on
|
void | drawCylinderTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC, int diameter) |
void | drawDashedLine(int run, int rise, Point3i pointA, Point3i pointB) |
void | drawDottedLine(Point3i pointA, Point3i pointB) |
void | drawfillTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC) |
void | drawHermite(int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3) |
void | drawHermite(boolean fill, boolean border, int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3, Point3i s4, Point3i s5, Point3i s6, Point3i s7, int aspectRatio) |
void | drawHLine(int x, int y, int z, int w) |
void | drawImage(Image image, int x, int y, int z, int zSlab, short bgcolix, int width, int height) |
void | drawLine(int x1, int y1, int z1, int x2, int y2, int z2) |
void | drawLine(short colixA, short colixB, int x1, int y1, int z1, int x2, int y2, int z2) |
void | drawLine(Point3i pointA, Point3i pointB) |
void | drawPixel(int x, int y, int z) |
void | drawPoints(int count, int[] coordinates) |
void | drawQuadrilateral(short colix, Point3i screenA, Point3i screenB, Point3i screenC, Point3i screenD) |
void | drawRect(int x, int y, int z, int zSlab, int rWidth, int rHeight)
draws a rectangle
|
void | drawString(String str, Font3D font3d, int xBaseline, int yBaseline, int z, int zSlab)
draws the specified string in the current font.
no line wrapping -- axis, labels, measures
|
void | drawStringNoSlab(String str, Font3D font3d, int xBaseline, int yBaseline, int z)
draws the specified string in the current font.
no line wrapping -- echo, frank, hover, molecularOrbital, uccage
|
void | drawTriangle(Point3i screenA, short colixA, Point3i screenB, short colixB, Point3i screenC, short colixC, int check) |
void | drawTriangle(Point3i screenA, Point3i screenB, Point3i screenC, int check) |
void | drawVLine(int x, int y, int z, int h) |
void | endRendering() |
void | fillCone(byte endcap, int diameter, Point3i screenBase, Point3i screenTip) |
void | fillCone(byte endcap, int diameter, Point3f screenBase, Point3f screenTip) |
void | fillCylinder(short colixA, short colixB, byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB) |
void | fillCylinder(byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB) |
void | fillCylinder(byte endcaps, int diameter, Point3i screenA, Point3i screenB) |
void | fillCylinderBits(byte endcaps, int diameter, Point3f screenA, Point3f screenB) |
void | fillHermite(int tension, int diameterBeg, int diameterMid, int diameterEnd, Point3i s0, Point3i s1, Point3i s2, Point3i s3) |
void | fillQuadrilateral(Point3f screenA, Point3f screenB, Point3f screenC, Point3f screenD) |
void | fillQuadrilateral(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, Point3i screenD, short colixD, short normixD) |
void | fillRect(int x, int y, int z, int zSlab, int widthFill, int heightFill)
fills background rectangle for label
|
void | fillScreenedCircleCentered(short colixFill, int diameter, int x, int y, int z) |
void | fillSphereCentered(int diameter, int x, int y, int z)
fills a solid sphere
|
void | fillSphereCentered(int diameter, Point3i center)
fills a solid sphere
|
void | fillSphereCentered(int diameter, Point3f center)
fills a solid sphere
|
void | fillTriangle(Point3i screenA, int intensityA, Point3i screenB, int intensityB, Point3i screenC, int intensityC) |
void | fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC) |
void | fillTriangle(short normix, int xScreenA, int yScreenA, int zScreenA, int xScreenB, int yScreenB, int zScreenB, int xScreenC, int yScreenC, int zScreenC) |
void | fillTriangle(Point3f screenA, Point3f screenB, Point3f screenC) |
void | fillTriangle(Point3i screenA, Point3i screenB, Point3i screenC) |
void | fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, float factor) |
static float | findAxis(Point3f[] points, int nPoints, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection) |
static void | flushShadesAndSphereCaches() |
short | get2SidedNormix(Vector3f vector) |
static int | getAmbientPercent() |
static int | getArgbFromString(String strColor)
accepts [xRRGGBB] or [0xRRGGBB] or [0xFFRRGGBB] or #RRGGBB
or a valid JavaScript color
|
short | getChangeableColix(short id, int argb) |
static short | getChangeableColixIndex(short colix) |
static short | getColix(int argb) |
static short | getColix(String colorName) |
static short | getColix(Object obj) |
int | getColixArgb(short colix) |
static short | getColixInherited(short myColix, short parentColix) |
static int | getColixTranslucencyLevel(short colix) |
static short | getColixTranslucent(short colix, boolean isTranslucent, float translucentLevel) |
static int | getColorArgb(int i) |
int | getDepth()
gets g3d depth
|
static int | getDiffusePercent() |
static float | getDirectedNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Point3f ptRef, Vector3f vNorm, Vector3f vAB, Vector3f vAC) |
JmolExportInterface | getExporter() |
Font3D | getFont3D(float fontSize) |
Font3D | getFont3D(String fontFace, float fontSize) |
Font3D | getFont3D(String fontFace, String fontStyle, float fontSize) |
Font3D | getFont3DCurrent() |
Font3D | getFont3DScaled(Font3D font, float scale) |
byte | getFontFid(float fontSize) |
byte | getFontFid(String fontFace, float fontSize) |
static void | getHermiteList(int tension, Tuple3f s0, Tuple3f s1, Tuple3f s2, Tuple3f s3, Tuple3f s4, Tuple3f[] list, int index0, int n) |
String | getHexColorFromIndex(short colix) |
static String | getHexColorFromRGB(int argb) |
short | getInverseNormix(short normix) |
static Point3f | getLightSource() |
static void | getNormalFromCenter(Point3f ptCenter, Point3f ptA, Point3f ptB, Point3f ptC, boolean isOutward, Vector3f normal) |
static float | getNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNorm, Vector3f vAB, Vector3f vAC) |
short | getNormix(Vector3f vector) |
Vector3f | getNormixVector(short normix) |
int | getRenderHeight()
gets g3d height
|
int | getRenderWidth()
gets g3d width
|
Image | getScreenImage() |
int[] | getShades(short colix) |
int | getSlab()
gets g3d slab
|
static boolean | getSpecular() |
static int | getSpecularExponent() |
static int | getSpecularPercent() |
static int | getSpecularPower() |
Vector3f[] | getTransformedVertexVectors() |
int | getZShift(int z) |
boolean | hasContent() |
boolean | haveTranslucentObjects() |
boolean | isAntialiased()
is full scene / oversampling antialiasing in effect
|
boolean | isClipped(int x, int y, int z) |
boolean | isClipped(int x, int y) |
boolean | isClippedXY(int diameter, int x, int y) |
boolean | isClippedZ(int z) |
static boolean | isColixColorInherited(short colix) |
static boolean | isColixTranslucent(short colix) |
boolean | isDirectedTowardsCamera(short normix) |
boolean | isDisplayAntialiased()
is full scene / oversampling antialiasing GENERALLY in effect
|
boolean | isInDisplayRange(int x, int y) |
static void | mergeBufferPixel(int[] pbuf, int argbB, int pt, int bgcolor) |
void | mergeOpaqueAndTranslucentBuffers() |
void | plotImage(int x, int y, int z, Image image, JmolRendererInterface jmolRenderer, short bgcolix, int width, int height) |
void | plotPixelClipped(int x, int y, int z) |
void | plotPixelClipped(Point3i screen) |
void | plotPixelClipped(int argb, int x, int y, int z) |
void | plotPixelClipped(int argb, boolean isScreened, int x, int y, int z) |
void | plotPixelClippedNoSlab(int argb, int x, int y, int z) |
void | plotPixelsClipped(int count, int x, int y, int z) |
void | plotPixelsClipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right) |
void | plotPixelsUnclipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right) |
void | plotPixelsUnclipped(int count, int x, int y, int z) |
void | plotPixelUnclipped(int x, int y, int z) |
void | plotPixelUnclipped(int argb, int x, int y, int z) |
void | plotPoints(int count, int[] coordinates) |
void | plotText(int x, int y, int z, int argb, String text, Font3D font3d, JmolRendererInterface jmolRenderer) |
static void | projectOntoAxis(Point3f point, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection) |
void | releaseBuffers() |
void | releaseScreenImage() |
void | renderBackground(JmolRendererInterface jmolRenderer) |
void | renderEllipsoid(int x, int y, int z, int diameter, Matrix3f mToEllipsoidal, double[] coef, Matrix4f mDeriv, int selectedOctant, Point3i[] octantPoints) |
void | renderIsosurface(Point3f[] vertices, short colix, short[] colixes, Vector3f[] normals, int[][] indices, BitSet bsFaces, int nVertices, int faceVertexMax) |
static void | setAmbientPercent(int ambientPercent) |
void | setBackgroundArgb(int argb)
sets background color to the specified argb value
|
void | setBackgroundImage(Image image) |
void | setBackgroundTransparent(boolean TF) |
boolean | setColix(short colix)
sets current color from colix color index |
void | setColixAndIntensity(short colix, int intensity) |
void | setColorNoisy(int intensity) |
static void | setDiffusePercent(int diffusePercent) |
void | setFont(byte fid) |
void | setFont(Font3D font3d) |
void | setg3dExporter(Graphics3D g3d, JmolExportInterface exporter) |
void | setGreyscaleMode(boolean greyscaleMode)
controls greyscale rendering |
boolean | setPass2(boolean antialiasTranslucent) |
void | setRenderer(ShapeRenderer shapeRenderer) |
void | setSlab(int slabValue) |
void | setSlabAndDepthValues(int slabValue, int depthValue, boolean zShade)
clipping from the front and the back
the plane is defined as a percentage from the back of the image
to the front
For slab values:
- 100 means 100% is shown
- 75 means the back 75% is shown
- 50 means the back half is shown
- 0 means that nothing is shown
for depth values:
- 0 means 100% is shown
- 25 means the back 25% is not shown
- 50 means the back half is not shown
- 100 means that nothing is shown
|
static void | setSpecular(boolean specular) |
static void | setSpecularExponent(int specularExponent) |
static void | setSpecularPercent(int specularPercent) |
static void | setSpecularPower(int specularPower) |
void | setWidthHeight(boolean isAntialiased) |
void | setWindowParameters(int width, int height, boolean antialias) |
void | setZMargin(int dz) |
void | snapshotAnaglyphChannelBytes() |
private static final int ALPHA_SHIFT
boolean addAllPixels
byte[] anaglyphChannelBytes
int anaglyphLength
private boolean antialias2
private boolean antialiasEnabled
private boolean antialiasThisFrame
int argbCurrent
int argbNoisyDn
int argbNoisyUp
public Image backgroundImage
public int bgcolor
int bufferSize
public static final short BLACK
public static final short BLUE
private short[] changeableColixMap
changeable colixes
give me a short ID and a color, and I will give you a colix
later, you can reassign the color if you want
Used only for colorManager coloring of elements
short colixCurrent
private static final int[] colorArgbs
private static final String[] colorNames
private int currentIntensity
boolean currentlyRendering
private static final short CHANGEABLE_MASK
public static final short CYAN
int depth
int displayMaxX
int displayMaxY
int displayMinX
int displayMinY
public static final byte ENDCAPS_FLAT
public static final byte ENDCAPS_NONE
public static final byte ENDCAPS_OPEN
public static final byte ENDCAPS_SPHERICAL
public static final short GOLD
public static final short GRAY
public static final short GREEN
boolean haveTranslucentObjects
int height
public static final short HOTPINK
boolean inGreyscaleMode
public static final byte intensitySpecularSurfaceLimit
boolean isFullSceneAntialiasingEnabled
boolean isPass2
boolean isScreened
boolean isTranslucent
public static final short INHERIT_ALL
private static final short INHERIT_COLOR
static final float[] lighting
public static final short LIME
private static final Hashtable mapJavaScriptColors
public static final short MAGENTA
public static final short MAROON
boolean newAntialiasing
int newWindowHeight
int newWindowWidth
public static final short NAVY
public static final short OLIVE
public static final short OPAQUE_MASK
public static final short ORANGE
private int[] pbuf
private int[] pbufT
public static final short PINK
public static final short PURPLE
public static final short RED
public static final byte shadeLast
public static final byte shadeMax
public static final byte shadeNormal
int[] shadesCurrent
int slab
public static final short SILVER
static final short SPECIAL_COLIX_MAX
int translucencyMask
boolean twoPass
public static final short TEAL
static final int TRANSLUCENT_50
private static final int TRANSLUCENT_MASK
private static final int TRANSLUCENT_SCREENED
private static final int TRANSLUCENT_SHIFT
private static final int TRANSPARENT
private static final short UNMASK_CHANGEABLE_TRANSLUCENT
static final short UNUSED_OPTION3
public static final short USE_PALETTE
private final Vector3f vectorAB
private final Vector3f vectorAC
private final Vector3f vectorNormal
int width
int windowHeight
int windowWidth
public static final short WHITE
int xLast
int yLast
public static final short YELLOW
int[] zbuf
private int[] zbufT
int zMargin
boolean zShade
public Graphics3D(Component awtComponent)
Allocates a g3d object
Parameters: awtComponent the java.awt.Component where the image will be drawn
void addPixel(int offset, int z, int p)
static final void addPixelT(int offset, int z, int p, int[] zbuf, int[] pbuf, int[] zbufT, int[] pbufT, int translucencyMask, boolean isPass2, int zMargin, int bgcolor)
public void applyBlueAnaglyph()
private static final short applyColorTranslucencyLevel(short colix, float translucentLevel)
public void applyCustomAnaglyph(int[] stereoColors)
public void applyCyanAnaglyph()
public void applyGreenAnaglyph()
static void averageBufferPixel(int[] pIn, int[] pOut, int pt, int dp)
public void beginRendering(Matrix3f rotationMatrix)
public static void calcAveragePoint(Point3f pointA, Point3f pointB, Point3f pointC)
public static void calcAveragePointN(Point3f[] points, int nPoints, Point3f averagePoint)
public static void calcBestAxisThroughPoints(Point3f[] points, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection, int nTriesMax)
public static int calcGreyscaleRgbFromRgb(int rgb)
Return a greyscale rgb value 0-FF using NTSC color luminance algorithm
the alpha component is set to 0xFF. If you want a value in the
range 0-255 then & the result with 0xFF;
Parameters: rgb the rgb value
Returns: a grayscale value in the range 0 - 255 decimal
private int calcIntensityScreen(Point3f screenA, Point3f screenB, Point3f screenC)
public static void calcNormalizedNormal(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNormNorm, Vector3f vAB, Vector3f vAC)
public int calcSurfaceShade(Point3i screenA, Point3i screenB, Point3i screenC)
public void calcXYNormalToLine(Point3f pointA, Point3f pointB, Vector3f vNormNorm)
public void changeColixArgb(short id, int argb)
public boolean checkTranslucent(boolean isAlphaTranslucent)
public static final Point3f colorPointFromInt(int color, Point3f pt)
public static final Point3f colorPointFromString(String colorName, Point3f pt)
public boolean currentlyRendering()
public void destroy()
public static float distanceToPlane(Point4f plane, Point3f pt)
public static float distanceToPlane(Point4f plane, float d, Point3f pt)
public static float distanceToPlane(Vector3f norm, float w, Point3f pt)
private void downsampleFullSceneAntialiasing(boolean downsampleZBuffer)
public void drawCircleCentered(short colix, int diameter, int x, int y, int z, boolean doFill)
draws a screened circle ... every other dot is turned on
Parameters: colix the color index diameter the pixel diameter x center x y center y z center z doFill fill or not
public void drawCylinderTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC, int diameter)
public void drawDashedLine(int run, int rise, Point3i pointA, Point3i pointB)
public void drawDottedLine(Point3i pointA, Point3i pointB)
public void drawfillTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC)
public void drawHermite(int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3)
public void drawHermite(boolean fill, boolean border, int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3, Point3i s4, Point3i s5, Point3i s6, Point3i s7, int aspectRatio)
private void drawHLine(int x, int y, int z, int w)
public void drawImage(Image image, int x, int y, int z, int zSlab, short bgcolix, int width, int height)
public void drawLine(int x1, int y1, int z1, int x2, int y2, int z2)
public void drawLine(short colixA, short colixB, int x1, int y1, int z1, int x2, int y2, int z2)
public void drawLine(Point3i pointA, Point3i pointB)
public void drawPixel(int x, int y, int z)
public void drawPoints(int count, int[] coordinates)
public void drawQuadrilateral(short colix, Point3i screenA, Point3i screenB, Point3i screenC, Point3i screenD)
public void drawRect(int x, int y, int z, int zSlab, int rWidth, int rHeight)
draws a rectangle
Parameters: x upper left x y upper left y z upper left z zSlab z for slab check (for set labelsFront) rWidth pixel count rHeight pixel count
public void drawString(String str,
Font3D font3d, int xBaseline, int yBaseline, int z, int zSlab)
draws the specified string in the current font.
no line wrapping -- axis, labels, measures
Parameters: str the String font3d the Font3D xBaseline baseline x yBaseline baseline y z baseline z zSlab z for slab calculation
public void drawStringNoSlab(String str,
Font3D font3d, int xBaseline, int yBaseline, int z)
draws the specified string in the current font.
no line wrapping -- echo, frank, hover, molecularOrbital, uccage
Parameters: str the String font3d the Font3D xBaseline baseline x yBaseline baseline y z baseline z
public void drawTriangle(Point3i screenA, short colixA, Point3i screenB, short colixB, Point3i screenC, short colixC, int check)
public void drawTriangle(Point3i screenA, Point3i screenB, Point3i screenC, int check)
private void drawVLine(int x, int y, int z, int h)
public void endRendering()
public void fillCone(byte endcap, int diameter, Point3i screenBase, Point3i screenTip)
public void fillCone(byte endcap, int diameter, Point3f screenBase, Point3f screenTip)
public void fillCylinder(short colixA, short colixB, byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)
public void fillCylinder(byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)
public void fillCylinder(byte endcaps, int diameter, Point3i screenA, Point3i screenB)
public void fillCylinderBits(byte endcaps, int diameter, Point3f screenA, Point3f screenB)
public void fillHermite(int tension, int diameterBeg, int diameterMid, int diameterEnd, Point3i s0, Point3i s1, Point3i s2, Point3i s3)
public void fillQuadrilateral(Point3f screenA, Point3f screenB, Point3f screenC, Point3f screenD)
public void fillQuadrilateral(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, Point3i screenD, short colixD, short normixD)
public void fillRect(int x, int y, int z, int zSlab, int widthFill, int heightFill)
fills background rectangle for label
Parameters: x upper left x y upper left y z upper left z zSlab z value for slabbing widthFill pixel count heightFill pixel count
public void fillScreenedCircleCentered(short colixFill, int diameter, int x, int y, int z)
public void fillSphereCentered(int diameter, int x, int y, int z)
fills a solid sphere
Parameters: diameter pixel count x center x y center y z center z
public void fillSphereCentered(int diameter, Point3i center)
fills a solid sphere
Parameters: diameter pixel count center javax.vecmath.Point3i defining the center
public void fillSphereCentered(int diameter, Point3f center)
fills a solid sphere
Parameters: diameter pixel count center a javax.vecmath.Point3f ... floats are casted to ints
public void fillTriangle(Point3i screenA, int intensityA, Point3i screenB, int intensityB, Point3i screenC, int intensityC)
public void fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC)
public void fillTriangle(short normix, int xScreenA, int yScreenA, int zScreenA, int xScreenB, int yScreenB, int zScreenB, int xScreenC, int yScreenC, int zScreenC)
public void fillTriangle(Point3f screenA, Point3f screenB, Point3f screenC)
public void fillTriangle(Point3i screenA, Point3i screenB, Point3i screenC)
public void fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, float factor)
static float findAxis(Point3f[] points, int nPoints, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)
public static void flushShadesAndSphereCaches()
public short get2SidedNormix(Vector3f vector)
public static int getAmbientPercent()
public static int getArgbFromString(String strColor)
accepts [xRRGGBB] or [0xRRGGBB] or [0xFFRRGGBB] or #RRGGBB
or a valid JavaScript color
Parameters: strColor
Returns: 0 if invalid or integer color
public short getChangeableColix(short id, int argb)
public static final short getChangeableColixIndex(short colix)
public static short getColix(int argb)
public static short getColix(String colorName)
public static short getColix(Object obj)
public int getColixArgb(short colix)
public static final short getColixInherited(short myColix, short parentColix)
public static final int getColixTranslucencyLevel(short colix)
public static final short getColixTranslucent(short colix, boolean isTranslucent, float translucentLevel)
public static int getColorArgb(int i)
public int getDepth()
gets g3d depth
Returns: depth
public static int getDiffusePercent()
public static float getDirectedNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Point3f ptRef, Vector3f vNorm, Vector3f vAB, Vector3f vAC)
public
Font3D getFont3D(float fontSize)
public
Font3D getFont3D(String fontFace, float fontSize)
public
Font3D getFont3D(String fontFace, String fontStyle, float fontSize)
public
Font3D getFont3DCurrent()
public byte getFontFid(float fontSize)
public byte getFontFid(String fontFace, float fontSize)
public static void getHermiteList(int tension, Tuple3f s0, Tuple3f s1, Tuple3f s2, Tuple3f s3, Tuple3f s4, Tuple3f[] list, int index0, int n)
public String getHexColorFromIndex(short colix)
public static String getHexColorFromRGB(int argb)
public short getInverseNormix(short normix)
public static Point3f getLightSource()
public static void getNormalFromCenter(Point3f ptCenter, Point3f ptA, Point3f ptB, Point3f ptC, boolean isOutward, Vector3f normal)
public static float getNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNorm, Vector3f vAB, Vector3f vAC)
public short getNormix(Vector3f vector)
public Vector3f getNormixVector(short normix)
public int getRenderHeight()
gets g3d height
Returns: height pixel count
public int getRenderWidth()
gets g3d width
Returns: width pixel count;
public Image getScreenImage()
int[] getShades(short colix)
public int getSlab()
gets g3d slab
Returns: slab
public static boolean getSpecular()
public static int getSpecularExponent()
public static int getSpecularPercent()
public static int getSpecularPower()
public Vector3f[] getTransformedVertexVectors()
int getZShift(int z)
public boolean hasContent()
public boolean haveTranslucentObjects()
public boolean isAntialiased()
is full scene / oversampling antialiasing in effect
Returns: the answer
public boolean isClipped(int x, int y, int z)
private boolean isClipped(int x, int y)
public boolean isClippedXY(int diameter, int x, int y)
public boolean isClippedZ(int z)
public static final boolean isColixColorInherited(short colix)
public static final boolean isColixTranslucent(short colix)
public boolean isDirectedTowardsCamera(short normix)
public boolean isDisplayAntialiased()
is full scene / oversampling antialiasing GENERALLY in effect
Returns: the answer
public boolean isInDisplayRange(int x, int y)
static void mergeBufferPixel(int[] pbuf, int argbB, int pt, int bgcolor)
void mergeOpaqueAndTranslucentBuffers()
public void plotImage(int x, int y, int z, Image image,
JmolRendererInterface jmolRenderer, short bgcolix, int width, int height)
void plotPixelClipped(int x, int y, int z)
public void plotPixelClipped(Point3i screen)
void plotPixelClipped(int argb, int x, int y, int z)
void plotPixelClipped(int argb, boolean isScreened, int x, int y, int z)
public void plotPixelClippedNoSlab(int argb, int x, int y, int z)
void plotPixelsClipped(int count, int x, int y, int z)
void plotPixelsClipped(int count, int x, int y, int zAtLeft, int zPastRight,
Rgb16 rgb16Left,
Rgb16 rgb16Right)
void plotPixelsUnclipped(int count, int x, int y, int zAtLeft, int zPastRight,
Rgb16 rgb16Left,
Rgb16 rgb16Right)
void plotPixelsUnclipped(int count, int x, int y, int z)
void plotPixelUnclipped(int x, int y, int z)
void plotPixelUnclipped(int argb, int x, int y, int z)
private void plotPoints(int count, int[] coordinates)
public static void projectOntoAxis(Point3f point, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)
private void releaseBuffers()
public void releaseScreenImage()
public void renderEllipsoid(int x, int y, int z, int diameter, Matrix3f mToEllipsoidal, double[] coef, Matrix4f mDeriv, int selectedOctant, Point3i[] octantPoints)
public void renderIsosurface(Point3f[] vertices, short colix, short[] colixes, Vector3f[] normals, int[][] indices, BitSet bsFaces, int nVertices, int faceVertexMax)
public static void setAmbientPercent(int ambientPercent)
public void setBackgroundArgb(int argb)
sets background color to the specified argb value
Parameters: argb an argb value with alpha channel
public void setBackgroundImage(Image image)
public void setBackgroundTransparent(boolean TF)
public boolean setColix(short colix)
sets current color from colix color index
Parameters: colix the color index
Returns: true or false if this is the right pass
private void setColixAndIntensity(short colix, int intensity)
void setColorNoisy(int intensity)
public static void setDiffusePercent(int diffusePercent)
public void setFont(byte fid)
public void setFont(
Font3D font3d)
public void setGreyscaleMode(boolean greyscaleMode)
controls greyscale rendering
Parameters: greyscaleMode Flag for greyscale rendering
public boolean setPass2(boolean antialiasTranslucent)
public void setSlab(int slabValue)
public void setSlabAndDepthValues(int slabValue, int depthValue, boolean zShade)
clipping from the front and the back
the plane is defined as a percentage from the back of the image
to the front
For slab values:
- 100 means 100% is shown
- 75 means the back 75% is shown
- 50 means the back half is shown
- 0 means that nothing is shown
for depth values:
- 0 means 100% is shown
- 25 means the back 25% is not shown
- 50 means the back half is not shown
- 100 means that nothing is shown
Parameters: slabValue front clipping percentage [0,100] depthValue rear clipping percentage [0,100] zShade whether to shade along z front to back
public static void setSpecular(boolean specular)
public static void setSpecularExponent(int specularExponent)
public static void setSpecularPercent(int specularPercent)
public static void setSpecularPower(int specularPower)
private void setWidthHeight(boolean isAntialiased)
public void setWindowParameters(int width, int height, boolean antialias)
void setZMargin(int dz)
public void snapshotAnaglyphChannelBytes()