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.

Field Summary
static intALPHA_SHIFT
booleanaddAllPixels
byte[]anaglyphChannelBytes
intanaglyphLength
booleanantialias2
booleanantialiasEnabled
booleanantialiasThisFrame
intargbCurrent
intargbNoisyDn
intargbNoisyUp
ImagebackgroundImage
intbgcolor
intbufferSize
static shortBLACK
static shortBLUE
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
Circle3Dcircle3d
shortcolixCurrent
static int[]colorArgbs
static String[]colorNames
intcurrentIntensity
booleancurrentlyRendering
Cylinder3Dcylinder3d
static shortCHANGEABLE_MASK
static shortCYAN
intdepth
intdisplayMaxX
intdisplayMaxY
intdisplayMinX
intdisplayMinY
static byteENDCAPS_FLAT
static byteENDCAPS_NONE
static byteENDCAPS_OPEN
static byteENDCAPS_SPHERICAL
Font3Dfont3dCurrent
static shortGOLD
static shortGRAY
static shortGREEN
booleanhaveTranslucentObjects
intheight
Hermite3Dhermite3d
static shortHOTPINK
booleaninGreyscaleMode
static byteintensitySpecularSurfaceLimit
booleanisFullSceneAntialiasingEnabled
booleanisPass2
booleanisScreened
booleanisTranslucent
static shortINHERIT_ALL
static shortINHERIT_COLOR
static float[]lighting
Line3Dline3d
static shortLIME
static HashtablemapJavaScriptColors
static shortMAGENTA
static shortMAROON
booleannewAntialiasing
intnewWindowHeight
intnewWindowWidth
Normix3Dnormix3d
static shortNAVY
static shortOLIVE
static shortOPAQUE_MASK
static shortORANGE
int[]pbuf
int[]pbufT
Platform3Dplatform
static shortPINK
static shortPURPLE
static shortRED
static byteshadeLast
static byteshadeMax
static byteshadeNormal
int[]shadesCurrent
intslab
Sphere3Dsphere3d
static shortSILVER
static shortSPECIAL_COLIX_MAX
inttranslucencyMask
Triangle3Dtriangle3d
booleantwoPass
static shortTEAL
static intTRANSLUCENT_50
static intTRANSLUCENT_MASK
static intTRANSLUCENT_SCREENED
static intTRANSLUCENT_SHIFT
static intTRANSPARENT
static shortUNMASK_CHANGEABLE_TRANSLUCENT
static shortUNUSED_OPTION3
static shortUSE_PALETTE
Vector3fvectorAB
Vector3fvectorAC
Vector3fvectorNormal
intwidth
intwindowHeight
intwindowWidth
static shortWHITE
intxLast
intyLast
static shortYELLOW
int[]zbuf
int[]zbufT
intzMargin
booleanzShade
Constructor Summary
Graphics3D(Component awtComponent)
Allocates a g3d object
Method Summary
voidaddPixel(int offset, int z, int p)
static voidaddPixelT(int offset, int z, int p, int[] zbuf, int[] pbuf, int[] zbufT, int[] pbufT, int translucencyMask, boolean isPass2, int zMargin, int bgcolor)
voidapplyBlueAnaglyph()
static shortapplyColorTranslucencyLevel(short colix, float translucentLevel)
voidapplyCustomAnaglyph(int[] stereoColors)
voidapplyCyanAnaglyph()
voidapplyGreenAnaglyph()
static voidaverageBufferPixel(int[] pIn, int[] pOut, int pt, int dp)
voidbeginRendering(Matrix3f rotationMatrix)
static voidcalcAveragePoint(Point3f pointA, Point3f pointB, Point3f pointC)
static voidcalcAveragePointN(Point3f[] points, int nPoints, Point3f averagePoint)
static voidcalcBestAxisThroughPoints(Point3f[] points, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection, int nTriesMax)
static intcalcGreyscaleRgbFromRgb(int rgb)
Return a greyscale rgb value 0-FF using NTSC color luminance algorithm

the alpha component is set to 0xFF.

intcalcIntensityScreen(Point3f screenA, Point3f screenB, Point3f screenC)
static voidcalcNormalizedNormal(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNormNorm, Vector3f vAB, Vector3f vAC)
intcalcSurfaceShade(Point3i screenA, Point3i screenB, Point3i screenC)
voidcalcXYNormalToLine(Point3f pointA, Point3f pointB, Vector3f vNormNorm)
voidchangeColixArgb(short id, int argb)
booleancheckTranslucent(boolean isAlphaTranslucent)
static Point3fcolorPointFromInt(int color, Point3f pt)
static Point3fcolorPointFromString(String colorName, Point3f pt)
booleancurrentlyRendering()
voiddestroy()
static floatdistanceToPlane(Point4f plane, Point3f pt)
static floatdistanceToPlane(Point4f plane, float d, Point3f pt)
static floatdistanceToPlane(Vector3f norm, float w, Point3f pt)
voiddownsampleFullSceneAntialiasing(boolean downsampleZBuffer)
voiddrawCircleCentered(short colix, int diameter, int x, int y, int z, boolean doFill)
draws a screened circle ... every other dot is turned on
voiddrawCylinderTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC, int diameter)
voiddrawDashedLine(int run, int rise, Point3i pointA, Point3i pointB)
voiddrawDottedLine(Point3i pointA, Point3i pointB)
voiddrawfillTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC)
voiddrawHermite(int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3)
voiddrawHermite(boolean fill, boolean border, int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3, Point3i s4, Point3i s5, Point3i s6, Point3i s7, int aspectRatio)
voiddrawHLine(int x, int y, int z, int w)
voiddrawImage(Image image, int x, int y, int z, int zSlab, short bgcolix, int width, int height)
voiddrawLine(int x1, int y1, int z1, int x2, int y2, int z2)
voiddrawLine(short colixA, short colixB, int x1, int y1, int z1, int x2, int y2, int z2)
voiddrawLine(Point3i pointA, Point3i pointB)
voiddrawPixel(int x, int y, int z)
voiddrawPoints(int count, int[] coordinates)
voiddrawQuadrilateral(short colix, Point3i screenA, Point3i screenB, Point3i screenC, Point3i screenD)
voiddrawRect(int x, int y, int z, int zSlab, int rWidth, int rHeight)
draws a rectangle
voiddrawString(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
voiddrawStringNoSlab(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
voiddrawTriangle(Point3i screenA, short colixA, Point3i screenB, short colixB, Point3i screenC, short colixC, int check)
voiddrawTriangle(Point3i screenA, Point3i screenB, Point3i screenC, int check)
voiddrawVLine(int x, int y, int z, int h)
voidendRendering()
voidfillCone(byte endcap, int diameter, Point3i screenBase, Point3i screenTip)
voidfillCone(byte endcap, int diameter, Point3f screenBase, Point3f screenTip)
voidfillCylinder(short colixA, short colixB, byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)
voidfillCylinder(byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)
voidfillCylinder(byte endcaps, int diameter, Point3i screenA, Point3i screenB)
voidfillCylinderBits(byte endcaps, int diameter, Point3f screenA, Point3f screenB)
voidfillHermite(int tension, int diameterBeg, int diameterMid, int diameterEnd, Point3i s0, Point3i s1, Point3i s2, Point3i s3)
voidfillQuadrilateral(Point3f screenA, Point3f screenB, Point3f screenC, Point3f screenD)
voidfillQuadrilateral(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, Point3i screenD, short colixD, short normixD)
voidfillRect(int x, int y, int z, int zSlab, int widthFill, int heightFill)
fills background rectangle for label

voidfillScreenedCircleCentered(short colixFill, int diameter, int x, int y, int z)
voidfillSphereCentered(int diameter, int x, int y, int z)
fills a solid sphere
voidfillSphereCentered(int diameter, Point3i center)
fills a solid sphere
voidfillSphereCentered(int diameter, Point3f center)
fills a solid sphere
voidfillTriangle(Point3i screenA, int intensityA, Point3i screenB, int intensityB, Point3i screenC, int intensityC)
voidfillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC)
voidfillTriangle(short normix, int xScreenA, int yScreenA, int zScreenA, int xScreenB, int yScreenB, int zScreenB, int xScreenC, int yScreenC, int zScreenC)
voidfillTriangle(Point3f screenA, Point3f screenB, Point3f screenC)
voidfillTriangle(Point3i screenA, Point3i screenB, Point3i screenC)
voidfillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, float factor)
static floatfindAxis(Point3f[] points, int nPoints, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)
static voidflushShadesAndSphereCaches()
shortget2SidedNormix(Vector3f vector)
static intgetAmbientPercent()
static intgetArgbFromString(String strColor)
accepts [xRRGGBB] or [0xRRGGBB] or [0xFFRRGGBB] or #RRGGBB or a valid JavaScript color
shortgetChangeableColix(short id, int argb)
static shortgetChangeableColixIndex(short colix)
static shortgetColix(int argb)
static shortgetColix(String colorName)
static shortgetColix(Object obj)
intgetColixArgb(short colix)
static shortgetColixInherited(short myColix, short parentColix)
static intgetColixTranslucencyLevel(short colix)
static shortgetColixTranslucent(short colix, boolean isTranslucent, float translucentLevel)
static intgetColorArgb(int i)
intgetDepth()
gets g3d depth
static intgetDiffusePercent()
static floatgetDirectedNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Point3f ptRef, Vector3f vNorm, Vector3f vAB, Vector3f vAC)
JmolExportInterfacegetExporter()
Font3DgetFont3D(float fontSize)
Font3DgetFont3D(String fontFace, float fontSize)
Font3DgetFont3D(String fontFace, String fontStyle, float fontSize)
Font3DgetFont3DCurrent()
Font3DgetFont3DScaled(Font3D font, float scale)
bytegetFontFid(float fontSize)
bytegetFontFid(String fontFace, float fontSize)
static voidgetHermiteList(int tension, Tuple3f s0, Tuple3f s1, Tuple3f s2, Tuple3f s3, Tuple3f s4, Tuple3f[] list, int index0, int n)
StringgetHexColorFromIndex(short colix)
static StringgetHexColorFromRGB(int argb)
shortgetInverseNormix(short normix)
static Point3fgetLightSource()
static voidgetNormalFromCenter(Point3f ptCenter, Point3f ptA, Point3f ptB, Point3f ptC, boolean isOutward, Vector3f normal)
static floatgetNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNorm, Vector3f vAB, Vector3f vAC)
shortgetNormix(Vector3f vector)
Vector3fgetNormixVector(short normix)
intgetRenderHeight()
gets g3d height
intgetRenderWidth()
gets g3d width
ImagegetScreenImage()
int[]getShades(short colix)
intgetSlab()
gets g3d slab
static booleangetSpecular()
static intgetSpecularExponent()
static intgetSpecularPercent()
static intgetSpecularPower()
Vector3f[]getTransformedVertexVectors()
intgetZShift(int z)
booleanhasContent()
booleanhaveTranslucentObjects()
booleanisAntialiased()
is full scene / oversampling antialiasing in effect
booleanisClipped(int x, int y, int z)
booleanisClipped(int x, int y)
booleanisClippedXY(int diameter, int x, int y)
booleanisClippedZ(int z)
static booleanisColixColorInherited(short colix)
static booleanisColixTranslucent(short colix)
booleanisDirectedTowardsCamera(short normix)
booleanisDisplayAntialiased()
is full scene / oversampling antialiasing GENERALLY in effect
booleanisInDisplayRange(int x, int y)
static voidmergeBufferPixel(int[] pbuf, int argbB, int pt, int bgcolor)
voidmergeOpaqueAndTranslucentBuffers()
voidplotImage(int x, int y, int z, Image image, JmolRendererInterface jmolRenderer, short bgcolix, int width, int height)
voidplotPixelClipped(int x, int y, int z)
voidplotPixelClipped(Point3i screen)
voidplotPixelClipped(int argb, int x, int y, int z)
voidplotPixelClipped(int argb, boolean isScreened, int x, int y, int z)
voidplotPixelClippedNoSlab(int argb, int x, int y, int z)
voidplotPixelsClipped(int count, int x, int y, int z)
voidplotPixelsClipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right)
voidplotPixelsUnclipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right)
voidplotPixelsUnclipped(int count, int x, int y, int z)
voidplotPixelUnclipped(int x, int y, int z)
voidplotPixelUnclipped(int argb, int x, int y, int z)
voidplotPoints(int count, int[] coordinates)
voidplotText(int x, int y, int z, int argb, String text, Font3D font3d, JmolRendererInterface jmolRenderer)
static voidprojectOntoAxis(Point3f point, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)
voidreleaseBuffers()
voidreleaseScreenImage()
voidrenderBackground(JmolRendererInterface jmolRenderer)
voidrenderEllipsoid(int x, int y, int z, int diameter, Matrix3f mToEllipsoidal, double[] coef, Matrix4f mDeriv, int selectedOctant, Point3i[] octantPoints)
voidrenderIsosurface(Point3f[] vertices, short colix, short[] colixes, Vector3f[] normals, int[][] indices, BitSet bsFaces, int nVertices, int faceVertexMax)
static voidsetAmbientPercent(int ambientPercent)
voidsetBackgroundArgb(int argb)
sets background color to the specified argb value
voidsetBackgroundImage(Image image)
voidsetBackgroundTransparent(boolean TF)
booleansetColix(short colix)
sets current color from colix color index
voidsetColixAndIntensity(short colix, int intensity)
voidsetColorNoisy(int intensity)
static voidsetDiffusePercent(int diffusePercent)
voidsetFont(byte fid)
voidsetFont(Font3D font3d)
voidsetg3dExporter(Graphics3D g3d, JmolExportInterface exporter)
voidsetGreyscaleMode(boolean greyscaleMode)
controls greyscale rendering
booleansetPass2(boolean antialiasTranslucent)
voidsetRenderer(ShapeRenderer shapeRenderer)
voidsetSlab(int slabValue)
voidsetSlabAndDepthValues(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 voidsetSpecular(boolean specular)
static voidsetSpecularExponent(int specularExponent)
static voidsetSpecularPercent(int specularPercent)
static voidsetSpecularPower(int specularPower)
voidsetWidthHeight(boolean isAntialiased)
voidsetWindowParameters(int width, int height, boolean antialias)
voidsetZMargin(int dz)
voidsnapshotAnaglyphChannelBytes()

Field Detail

ALPHA_SHIFT

private static final int ALPHA_SHIFT

addAllPixels

boolean addAllPixels

anaglyphChannelBytes

byte[] anaglyphChannelBytes

anaglyphLength

int anaglyphLength

antialias2

private boolean antialias2

antialiasEnabled

private boolean antialiasEnabled

antialiasThisFrame

private boolean antialiasThisFrame

argbCurrent

int argbCurrent

argbNoisyDn

int argbNoisyDn

argbNoisyUp

int argbNoisyUp

backgroundImage

public Image backgroundImage

bgcolor

public int bgcolor

bufferSize

int bufferSize

BLACK

public static final short BLACK

BLUE

public static final short BLUE

changeableColixMap

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

circle3d

Circle3D circle3d

colixCurrent

short colixCurrent

colorArgbs

private static final int[] colorArgbs

colorNames

private static final String[] colorNames

currentIntensity

private int currentIntensity

currentlyRendering

boolean currentlyRendering

cylinder3d

Cylinder3D cylinder3d

CHANGEABLE_MASK

private static final short CHANGEABLE_MASK

CYAN

public static final short CYAN

depth

int depth

displayMaxX

int displayMaxX

displayMaxY

int displayMaxY

displayMinX

int displayMinX

displayMinY

int displayMinY

ENDCAPS_FLAT

public static final byte ENDCAPS_FLAT

ENDCAPS_NONE

public static final byte ENDCAPS_NONE

ENDCAPS_OPEN

public static final byte ENDCAPS_OPEN

ENDCAPS_SPHERICAL

public static final byte ENDCAPS_SPHERICAL

font3dCurrent

Font3D font3dCurrent

GOLD

public static final short GOLD

GRAY

public static final short GRAY

GREEN

public static final short GREEN

haveTranslucentObjects

boolean haveTranslucentObjects

height

int height

hermite3d

Hermite3D hermite3d

HOTPINK

public static final short HOTPINK

inGreyscaleMode

boolean inGreyscaleMode

intensitySpecularSurfaceLimit

public static final byte intensitySpecularSurfaceLimit

isFullSceneAntialiasingEnabled

boolean isFullSceneAntialiasingEnabled

isPass2

boolean isPass2

isScreened

boolean isScreened

isTranslucent

boolean isTranslucent

INHERIT_ALL

public static final short INHERIT_ALL

INHERIT_COLOR

private static final short INHERIT_COLOR

lighting

static final float[] lighting

line3d

Line3D line3d

LIME

public static final short LIME

mapJavaScriptColors

private static final Hashtable mapJavaScriptColors

MAGENTA

public static final short MAGENTA

MAROON

public static final short MAROON

newAntialiasing

boolean newAntialiasing

newWindowHeight

int newWindowHeight

newWindowWidth

int newWindowWidth

normix3d

Normix3D normix3d

NAVY

public static final short NAVY

OLIVE

public static final short OLIVE

OPAQUE_MASK

public static final short OPAQUE_MASK

ORANGE

public static final short ORANGE

pbuf

private int[] pbuf

pbufT

private int[] pbufT

platform

Platform3D platform

PINK

public static final short PINK

PURPLE

public static final short PURPLE

RED

public static final short RED

shadeLast

public static final byte shadeLast

shadeMax

public static final byte shadeMax

shadeNormal

public static final byte shadeNormal

shadesCurrent

int[] shadesCurrent

slab

int slab

sphere3d

Sphere3D sphere3d

SILVER

public static final short SILVER

SPECIAL_COLIX_MAX

static final short SPECIAL_COLIX_MAX

translucencyMask

int translucencyMask

triangle3d

Triangle3D triangle3d

twoPass

boolean twoPass

TEAL

public static final short TEAL

TRANSLUCENT_50

static final int TRANSLUCENT_50

TRANSLUCENT_MASK

private static final int TRANSLUCENT_MASK

TRANSLUCENT_SCREENED

private static final int TRANSLUCENT_SCREENED

TRANSLUCENT_SHIFT

private static final int TRANSLUCENT_SHIFT

TRANSPARENT

private static final int TRANSPARENT

UNMASK_CHANGEABLE_TRANSLUCENT

private static final short UNMASK_CHANGEABLE_TRANSLUCENT

UNUSED_OPTION3

static final short UNUSED_OPTION3

USE_PALETTE

public static final short USE_PALETTE

vectorAB

private final Vector3f vectorAB

vectorAC

private final Vector3f vectorAC

vectorNormal

private final Vector3f vectorNormal

width

int width

windowHeight

int windowHeight

windowWidth

int windowWidth

WHITE

public static final short WHITE

xLast

int xLast

yLast

int yLast

YELLOW

public static final short YELLOW

zbuf

int[] zbuf

zbufT

private int[] zbufT

zMargin

int zMargin

zShade

boolean zShade

Constructor Detail

Graphics3D

public Graphics3D(Component awtComponent)
Allocates a g3d object

Parameters: awtComponent the java.awt.Component where the image will be drawn

Method Detail

addPixel

void addPixel(int offset, int z, int p)

addPixelT

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)

applyBlueAnaglyph

public void applyBlueAnaglyph()

applyColorTranslucencyLevel

private static final short applyColorTranslucencyLevel(short colix, float translucentLevel)

applyCustomAnaglyph

public void applyCustomAnaglyph(int[] stereoColors)

applyCyanAnaglyph

public void applyCyanAnaglyph()

applyGreenAnaglyph

public void applyGreenAnaglyph()

averageBufferPixel

static void averageBufferPixel(int[] pIn, int[] pOut, int pt, int dp)

beginRendering

public void beginRendering(Matrix3f rotationMatrix)

calcAveragePoint

public static void calcAveragePoint(Point3f pointA, Point3f pointB, Point3f pointC)

calcAveragePointN

public static void calcAveragePointN(Point3f[] points, int nPoints, Point3f averagePoint)

calcBestAxisThroughPoints

public static void calcBestAxisThroughPoints(Point3f[] points, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection, int nTriesMax)

calcGreyscaleRgbFromRgb

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

calcIntensityScreen

private int calcIntensityScreen(Point3f screenA, Point3f screenB, Point3f screenC)

calcNormalizedNormal

public static void calcNormalizedNormal(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNormNorm, Vector3f vAB, Vector3f vAC)

calcSurfaceShade

public int calcSurfaceShade(Point3i screenA, Point3i screenB, Point3i screenC)

calcXYNormalToLine

public void calcXYNormalToLine(Point3f pointA, Point3f pointB, Vector3f vNormNorm)

changeColixArgb

public void changeColixArgb(short id, int argb)

checkTranslucent

public boolean checkTranslucent(boolean isAlphaTranslucent)

colorPointFromInt

public static final Point3f colorPointFromInt(int color, Point3f pt)

colorPointFromString

public static final Point3f colorPointFromString(String colorName, Point3f pt)

currentlyRendering

public boolean currentlyRendering()

destroy

public void destroy()

distanceToPlane

public static float distanceToPlane(Point4f plane, Point3f pt)

distanceToPlane

public static float distanceToPlane(Point4f plane, float d, Point3f pt)

distanceToPlane

public static float distanceToPlane(Vector3f norm, float w, Point3f pt)

downsampleFullSceneAntialiasing

private void downsampleFullSceneAntialiasing(boolean downsampleZBuffer)

drawCircleCentered

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

drawCylinderTriangle

public void drawCylinderTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC, int diameter)

drawDashedLine

public void drawDashedLine(int run, int rise, Point3i pointA, Point3i pointB)

drawDottedLine

public void drawDottedLine(Point3i pointA, Point3i pointB)

drawfillTriangle

public void drawfillTriangle(int xA, int yA, int zA, int xB, int yB, int zB, int xC, int yC, int zC)

drawHermite

public void drawHermite(int tension, Point3i s0, Point3i s1, Point3i s2, Point3i s3)

drawHermite

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)

drawHLine

private void drawHLine(int x, int y, int z, int w)

drawImage

public void drawImage(Image image, int x, int y, int z, int zSlab, short bgcolix, int width, int height)

drawLine

public void drawLine(int x1, int y1, int z1, int x2, int y2, int z2)

drawLine

public void drawLine(short colixA, short colixB, int x1, int y1, int z1, int x2, int y2, int z2)

drawLine

public void drawLine(Point3i pointA, Point3i pointB)

drawPixel

public void drawPixel(int x, int y, int z)

drawPoints

public void drawPoints(int count, int[] coordinates)

drawQuadrilateral

public void drawQuadrilateral(short colix, Point3i screenA, Point3i screenB, Point3i screenC, Point3i screenD)

drawRect

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

drawString

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

drawStringNoSlab

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

drawTriangle

public void drawTriangle(Point3i screenA, short colixA, Point3i screenB, short colixB, Point3i screenC, short colixC, int check)

drawTriangle

public void drawTriangle(Point3i screenA, Point3i screenB, Point3i screenC, int check)

drawVLine

private void drawVLine(int x, int y, int z, int h)

endRendering

public void endRendering()

fillCone

public void fillCone(byte endcap, int diameter, Point3i screenBase, Point3i screenTip)

fillCone

public void fillCone(byte endcap, int diameter, Point3f screenBase, Point3f screenTip)

fillCylinder

public void fillCylinder(short colixA, short colixB, byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)

fillCylinder

public void fillCylinder(byte endcaps, int diameter, int xA, int yA, int zA, int xB, int yB, int zB)

fillCylinder

public void fillCylinder(byte endcaps, int diameter, Point3i screenA, Point3i screenB)

fillCylinderBits

public void fillCylinderBits(byte endcaps, int diameter, Point3f screenA, Point3f screenB)

fillHermite

public void fillHermite(int tension, int diameterBeg, int diameterMid, int diameterEnd, Point3i s0, Point3i s1, Point3i s2, Point3i s3)

fillQuadrilateral

public void fillQuadrilateral(Point3f screenA, Point3f screenB, Point3f screenC, Point3f screenD)

fillQuadrilateral

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)

fillRect

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

fillScreenedCircleCentered

public void fillScreenedCircleCentered(short colixFill, int diameter, int x, int y, int z)

fillSphereCentered

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

fillSphereCentered

public void fillSphereCentered(int diameter, Point3i center)
fills a solid sphere

Parameters: diameter pixel count center javax.vecmath.Point3i defining the center

fillSphereCentered

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

fillTriangle

public void fillTriangle(Point3i screenA, int intensityA, Point3i screenB, int intensityB, Point3i screenC, int intensityC)

fillTriangle

public void fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC)

fillTriangle

public void fillTriangle(short normix, int xScreenA, int yScreenA, int zScreenA, int xScreenB, int yScreenB, int zScreenB, int xScreenC, int yScreenC, int zScreenC)

fillTriangle

public void fillTriangle(Point3f screenA, Point3f screenB, Point3f screenC)

fillTriangle

public void fillTriangle(Point3i screenA, Point3i screenB, Point3i screenC)

fillTriangle

public void fillTriangle(Point3i screenA, short colixA, short normixA, Point3i screenB, short colixB, short normixB, Point3i screenC, short colixC, short normixC, float factor)

findAxis

static float findAxis(Point3f[] points, int nPoints, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)

flushShadesAndSphereCaches

public static void flushShadesAndSphereCaches()

get2SidedNormix

public short get2SidedNormix(Vector3f vector)

getAmbientPercent

public static int getAmbientPercent()

getArgbFromString

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

getChangeableColix

public short getChangeableColix(short id, int argb)

getChangeableColixIndex

public static final short getChangeableColixIndex(short colix)

getColix

public static short getColix(int argb)

getColix

public static short getColix(String colorName)

getColix

public static short getColix(Object obj)

getColixArgb

public int getColixArgb(short colix)

getColixInherited

public static final short getColixInherited(short myColix, short parentColix)

getColixTranslucencyLevel

public static final int getColixTranslucencyLevel(short colix)

getColixTranslucent

public static final short getColixTranslucent(short colix, boolean isTranslucent, float translucentLevel)

getColorArgb

public static int getColorArgb(int i)

getDepth

public int getDepth()
gets g3d depth

Returns: depth

getDiffusePercent

public static int getDiffusePercent()

getDirectedNormalThroughPoints

public static float getDirectedNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Point3f ptRef, Vector3f vNorm, Vector3f vAB, Vector3f vAC)

getExporter

public JmolExportInterface getExporter()

getFont3D

public Font3D getFont3D(float fontSize)

getFont3D

public Font3D getFont3D(String fontFace, float fontSize)

getFont3D

public Font3D getFont3D(String fontFace, String fontStyle, float fontSize)

getFont3DCurrent

public Font3D getFont3DCurrent()

getFont3DScaled

public Font3D getFont3DScaled(Font3D font, float scale)

getFontFid

public byte getFontFid(float fontSize)

getFontFid

public byte getFontFid(String fontFace, float fontSize)

getHermiteList

public static void getHermiteList(int tension, Tuple3f s0, Tuple3f s1, Tuple3f s2, Tuple3f s3, Tuple3f s4, Tuple3f[] list, int index0, int n)

getHexColorFromIndex

public String getHexColorFromIndex(short colix)

getHexColorFromRGB

public static String getHexColorFromRGB(int argb)

getInverseNormix

public short getInverseNormix(short normix)

getLightSource

public static Point3f getLightSource()

getNormalFromCenter

public static void getNormalFromCenter(Point3f ptCenter, Point3f ptA, Point3f ptB, Point3f ptC, boolean isOutward, Vector3f normal)

getNormalThroughPoints

public static float getNormalThroughPoints(Point3f pointA, Point3f pointB, Point3f pointC, Vector3f vNorm, Vector3f vAB, Vector3f vAC)

getNormix

public short getNormix(Vector3f vector)

getNormixVector

public Vector3f getNormixVector(short normix)

getRenderHeight

public int getRenderHeight()
gets g3d height

Returns: height pixel count

getRenderWidth

public int getRenderWidth()
gets g3d width

Returns: width pixel count;

getScreenImage

public Image getScreenImage()

getShades

int[] getShades(short colix)

getSlab

public int getSlab()
gets g3d slab

Returns: slab

getSpecular

public static boolean getSpecular()

getSpecularExponent

public static int getSpecularExponent()

getSpecularPercent

public static int getSpecularPercent()

getSpecularPower

public static int getSpecularPower()

getTransformedVertexVectors

public Vector3f[] getTransformedVertexVectors()

getZShift

int getZShift(int z)

hasContent

public boolean hasContent()

haveTranslucentObjects

public boolean haveTranslucentObjects()

isAntialiased

public boolean isAntialiased()
is full scene / oversampling antialiasing in effect

Returns: the answer

isClipped

public boolean isClipped(int x, int y, int z)

isClipped

private boolean isClipped(int x, int y)

isClippedXY

public boolean isClippedXY(int diameter, int x, int y)

isClippedZ

public boolean isClippedZ(int z)

isColixColorInherited

public static final boolean isColixColorInherited(short colix)

isColixTranslucent

public static final boolean isColixTranslucent(short colix)

isDirectedTowardsCamera

public boolean isDirectedTowardsCamera(short normix)

isDisplayAntialiased

public boolean isDisplayAntialiased()
is full scene / oversampling antialiasing GENERALLY in effect

Returns: the answer

isInDisplayRange

public boolean isInDisplayRange(int x, int y)

mergeBufferPixel

static void mergeBufferPixel(int[] pbuf, int argbB, int pt, int bgcolor)

mergeOpaqueAndTranslucentBuffers

void mergeOpaqueAndTranslucentBuffers()

plotImage

public void plotImage(int x, int y, int z, Image image, JmolRendererInterface jmolRenderer, short bgcolix, int width, int height)

plotPixelClipped

void plotPixelClipped(int x, int y, int z)

plotPixelClipped

public void plotPixelClipped(Point3i screen)

plotPixelClipped

void plotPixelClipped(int argb, int x, int y, int z)

plotPixelClipped

void plotPixelClipped(int argb, boolean isScreened, int x, int y, int z)

plotPixelClippedNoSlab

public void plotPixelClippedNoSlab(int argb, int x, int y, int z)

plotPixelsClipped

void plotPixelsClipped(int count, int x, int y, int z)

plotPixelsClipped

void plotPixelsClipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right)

plotPixelsUnclipped

void plotPixelsUnclipped(int count, int x, int y, int zAtLeft, int zPastRight, Rgb16 rgb16Left, Rgb16 rgb16Right)

plotPixelsUnclipped

void plotPixelsUnclipped(int count, int x, int y, int z)

plotPixelUnclipped

void plotPixelUnclipped(int x, int y, int z)

plotPixelUnclipped

void plotPixelUnclipped(int argb, int x, int y, int z)

plotPoints

private void plotPoints(int count, int[] coordinates)

plotText

public void plotText(int x, int y, int z, int argb, String text, Font3D font3d, JmolRendererInterface jmolRenderer)

projectOntoAxis

public static void projectOntoAxis(Point3f point, Point3f axisA, Vector3f axisUnitVector, Vector3f vectorProjection)

releaseBuffers

private void releaseBuffers()

releaseScreenImage

public void releaseScreenImage()

renderBackground

public void renderBackground(JmolRendererInterface jmolRenderer)

renderEllipsoid

public void renderEllipsoid(int x, int y, int z, int diameter, Matrix3f mToEllipsoidal, double[] coef, Matrix4f mDeriv, int selectedOctant, Point3i[] octantPoints)

renderIsosurface

public void renderIsosurface(Point3f[] vertices, short colix, short[] colixes, Vector3f[] normals, int[][] indices, BitSet bsFaces, int nVertices, int faceVertexMax)

setAmbientPercent

public static void setAmbientPercent(int ambientPercent)

setBackgroundArgb

public void setBackgroundArgb(int argb)
sets background color to the specified argb value

Parameters: argb an argb value with alpha channel

setBackgroundImage

public void setBackgroundImage(Image image)

setBackgroundTransparent

public void setBackgroundTransparent(boolean TF)

setColix

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

setColixAndIntensity

private void setColixAndIntensity(short colix, int intensity)

setColorNoisy

void setColorNoisy(int intensity)

setDiffusePercent

public static void setDiffusePercent(int diffusePercent)

setFont

public void setFont(byte fid)

setFont

public void setFont(Font3D font3d)

setg3dExporter

public void setg3dExporter(Graphics3D g3d, JmolExportInterface exporter)

setGreyscaleMode

public void setGreyscaleMode(boolean greyscaleMode)
controls greyscale rendering

Parameters: greyscaleMode Flag for greyscale rendering

setPass2

public boolean setPass2(boolean antialiasTranslucent)

setRenderer

public void setRenderer(ShapeRenderer shapeRenderer)

setSlab

public void setSlab(int slabValue)

setSlabAndDepthValues

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:

for depth values:

Parameters: slabValue front clipping percentage [0,100] depthValue rear clipping percentage [0,100] zShade whether to shade along z front to back

setSpecular

public static void setSpecular(boolean specular)

setSpecularExponent

public static void setSpecularExponent(int specularExponent)

setSpecularPercent

public static void setSpecularPercent(int specularPercent)

setSpecularPower

public static void setSpecularPower(int specularPower)

setWidthHeight

private void setWidthHeight(boolean isAntialiased)

setWindowParameters

public void setWindowParameters(int width, int height, boolean antialias)

setZMargin

void setZMargin(int dz)

snapshotAnaglyphChannelBytes

public void snapshotAnaglyphChannelBytes()