public class _ObjExporter extends __CartesianExporter
Modifier and Type | Field and Description |
---|---|
private int |
circleNum
Number for the next mesh of this type.
|
private int |
coneNum
Number for the next mesh of this type.
|
private int |
currentNormalOrigin
Wavefront OBJ refers to vertices and normals and textures by their location
in the file.
|
private int |
currentTextureOrigin
Wavefront OBJ refers to vertices and normals and textures by their location
in the file.
|
private int |
currentVertexOrigin
Wavefront OBJ refers to vertices and normals and textures by their location
in the file.
|
private int |
cylinderNum
Number for the next mesh of this type.
|
private static boolean |
debug
Flag to cause debugging output to stdout.
|
private int |
ellipseNum
Number for the next mesh of this type.
|
private int |
ellipsoidNum
Number for the next mesh of this type.
|
private javajs.util.OC |
mtlout
BufferedWriter for the .mtl file.
|
private int |
nMtlBytes
Bytes written to the .mtl file.
|
private boolean |
normalizeUV
Whether to normalize UV texture coordinates.
|
(package private) java.lang.String |
objFileRootName
Path of the OBJ file without the extension.
|
private float |
pixelSize
The size of a pixel based on some assumptions about screen size
|
private javajs.util.P3 |
ptTemp |
private int |
sphereNum
Number for the next mesh of this type.
|
private int |
surfaceNum
Number for the next mesh of this type.
|
private boolean |
surfacesOnly
Flag to cause only surfaces to be output.
|
(package private) javajs.util.Lst<java.lang.String> |
textureFiles
List of texture files created.
|
(package private) java.util.Set<java.lang.Short> |
textures
HashSet for textures.
|
private int |
triangleNum
Number for the next mesh of this type.
|
ptScaled, sphereMatrix, viewpoint
aperatureAngle, backgroundColix, cameraDistance, cameraPosition, center, commandLineOptions, commentChar, degreesPerRadian, depthZ, exportScale, exportType, fileName, fixedRotationCenter, gdata, isCartesian, jmolRenderer, lightSource, lineWidthMad, out, privateKey, referenceCenter, scalePixelsPerAngstrom, screenHeight, screenWidth, slabZ, tempP1, tempP2, tempP3, tempV1, tempV2, tm, vwr
Constructor and Description |
---|
_ObjExporter() |
Modifier and Type | Method and Description |
---|---|
private void |
addMesh(java.lang.String name,
MeshSurface data,
javajs.util.M4 matrix,
javajs.util.M4 matrix1,
short colix,
int[] dim,
BS bsValid)
Adds a new mesh using the given data (faces, vertices, and normals) and
colix after transforming it via the given affine transform matrix.
|
private void |
addTexture(short colix,
java.lang.String name)
Adds a texture to the .mtl file if it is a new texture.
|
private javajs.util.OC |
createTextureFile(java.lang.String name,
MeshSurface data,
int[] dim)
Writes a texture file with the colors in the colixes array in a way that it
can be mapped by the texture coordinates vt.
|
protected void |
debugPrint(java.lang.String string)
Debug print utility.
|
protected void |
drawSurface(MeshSurface meshSurface,
short colix) |
(package private) java.lang.String |
finalizeOutput() |
private java.lang.String |
getTextureName(short colix)
Returns the name to be used for the texture associated with the given
colix.
|
(package private) boolean |
initializeOutput(Viewer vwr,
double privateKey,
GData gdata,
java.util.Map<java.lang.String,java.lang.Object> params) |
protected void |
output(javajs.util.T3 pt) |
protected void |
outputCircle(javajs.util.P3 pt1,
javajs.util.P3 pt2,
float radius,
short colix,
boolean doFill) |
private void |
outputCircle1(javajs.util.P3 ptCenter,
javajs.util.P3 ptPerp,
short colix,
float radius)
Local implementation of outputCircle.
|
protected void |
outputCone(javajs.util.P3 ptBase,
javajs.util.P3 ptTip,
float radius,
short colix) |
private void |
outputCone1(javajs.util.P3 ptBase,
javajs.util.P3 ptTip,
float radius,
short colix)
Local implementation of outputCone.
|
protected boolean |
outputCylinder(javajs.util.P3 ptCenter,
javajs.util.P3 pt1,
javajs.util.P3 pt2,
short colix,
byte endcaps,
float radius,
javajs.util.P3 ptX,
javajs.util.P3 ptY,
boolean checkRadius) |
private void |
outputCylinder1(javajs.util.P3 ptCenter,
javajs.util.P3 pt1,
javajs.util.P3 pt2,
short colix,
byte endcaps,
float radius,
javajs.util.P3 ptX,
javajs.util.P3 ptY)
Local implementation of outputCylinder.
|
private boolean |
outputEllipse1(javajs.util.P3 ptCenter,
javajs.util.P3 ptZ,
javajs.util.P3 ptX,
javajs.util.P3 ptY,
short colix)
Local implementation of outputEllipse.
|
protected void |
outputEllipsoid(javajs.util.P3 center,
javajs.util.P3[] points,
short colix) |
private void |
outputEllipsoid1(javajs.util.P3 center,
float rx,
float ry,
float rz,
javajs.util.A4 a,
short colix)
Local implementation of outputEllipsoid.
|
protected void |
outputFace(int[] face,
int[] map,
int faceVertexMax) |
private void |
outputFace1(int[] face,
int[] map,
int[] map2)
Local implementation of outputFace used for no texture coordinates.
|
private void |
outputFace2(int[] face,
int vt,
int[] map,
int[] map2)
Local implementation of outputFace used with texture coordinates.
|
protected void |
outputHeader() |
private void |
outputList(javajs.util.T3[] pts,
int nPts,
javajs.util.M4 m,
java.lang.String prefix,
BS bsValid)
create the v or vn list
|
private void |
outputMtl(java.lang.String data)
Write to the .mtl file and keep track of the bytes written.
|
protected void |
outputSphere(javajs.util.P3 center,
float radius,
short colix,
boolean checkRadius) |
protected void |
outputTextPixel(javajs.util.P3 pt,
int argb) |
protected void |
outputTriangle(javajs.util.T3 pt1,
javajs.util.T3 pt2,
javajs.util.T3 pt3,
short colix) |
private void |
outputTriangle1(javajs.util.T3 pt1,
javajs.util.T3 pt2,
javajs.util.T3 pt3,
short colix)
Local implementation of outputCylinder.
|
drawAtom, drawCircle, drawCylinder, drawEllipse, drawPixel, drawTextPixel, fillConeScreen, fillCylinderScreen, fillCylinderScreenMad, fillEllipsoid, fillSphere, fillTriangle, getCameraPosition, getCoordinateMap, getModelCenter, getNormalMap, outputIndices, plotImage, plotText, scale, scalePt, setSphereMatrix
drawFilledCircle, finalizeOutput2, getColorList, getConeMesh, getExportDate, getJmolPerspective, getRotationMatrix, getRotationMatrix, getTriad, initOutput, opacityFractionalFromArgb, opacityFractionalFromColix, output, outputComment, outputFooter, outputJmolPerspective, outputSurface, outputVertex, outputVertices, rgbFractionalFromArgb, rgbFractionalFromColix, round, round, setRenderer, setTempVertex, translucencyFractionalFromColix
private static final boolean debug
private boolean surfacesOnly
private boolean normalizeUV
private javajs.util.OC mtlout
java.lang.String objFileRootName
private int nMtlBytes
java.util.Set<java.lang.Short> textures
javajs.util.Lst<java.lang.String> textureFiles
private int sphereNum
private int cylinderNum
private int ellipseNum
private int circleNum
private int ellipsoidNum
private int coneNum
private int triangleNum
private int surfaceNum
private int currentVertexOrigin
private int currentNormalOrigin
private int currentTextureOrigin
private float pixelSize
private final javajs.util.P3 ptTemp
protected void debugPrint(java.lang.String string)
string
- protected void outputFace(int[] face, int[] map, int faceVertexMax)
outputFace
in class __CartesianExporter
protected void outputCircle(javajs.util.P3 pt1, javajs.util.P3 pt2, float radius, short colix, boolean doFill)
outputCircle
in class __CartesianExporter
protected void outputCone(javajs.util.P3 ptBase, javajs.util.P3 ptTip, float radius, short colix)
outputCone
in class __CartesianExporter
protected boolean outputCylinder(javajs.util.P3 ptCenter, javajs.util.P3 pt1, javajs.util.P3 pt2, short colix, byte endcaps, float radius, javajs.util.P3 ptX, javajs.util.P3 ptY, boolean checkRadius)
outputCylinder
in class __CartesianExporter
protected void outputEllipsoid(javajs.util.P3 center, javajs.util.P3[] points, short colix)
outputEllipsoid
in class __CartesianExporter
protected void outputSphere(javajs.util.P3 center, float radius, short colix, boolean checkRadius)
outputSphere
in class __CartesianExporter
protected void outputTextPixel(javajs.util.P3 pt, int argb)
outputTextPixel
in class __CartesianExporter
protected void outputTriangle(javajs.util.T3 pt1, javajs.util.T3 pt2, javajs.util.T3 pt3, short colix)
outputTriangle
in class __CartesianExporter
protected void outputHeader()
outputHeader
in class ___Exporter
protected void output(javajs.util.T3 pt)
output
in class ___Exporter
protected void drawSurface(MeshSurface meshSurface, short colix)
drawSurface
in class ___Exporter
boolean initializeOutput(Viewer vwr, double privateKey, GData gdata, java.util.Map<java.lang.String,java.lang.Object> params)
initializeOutput
in class ___Exporter
java.lang.String finalizeOutput()
finalizeOutput
in class ___Exporter
private void outputMtl(java.lang.String data)
data
- private java.lang.String getTextureName(short colix)
colix
- The value of colix.private void outputCircle1(javajs.util.P3 ptCenter, javajs.util.P3 ptPerp, short colix, float radius)
ptCenter
- ptPerp
- colix
- radius
- private void outputCone1(javajs.util.P3 ptBase, javajs.util.P3 ptTip, float radius, short colix)
ptBase
- ptTip
- radius
- colix
- private boolean outputEllipse1(javajs.util.P3 ptCenter, javajs.util.P3 ptZ, javajs.util.P3 ptX, javajs.util.P3 ptY, short colix)
ptCenter
- ptZ
- ptX
- ptY
- colix
- private void outputEllipsoid1(javajs.util.P3 center, float rx, float ry, float rz, javajs.util.A4 a, short colix)
center
- rx
- ry
- rz
- a
- colix
- private void outputCylinder1(javajs.util.P3 ptCenter, javajs.util.P3 pt1, javajs.util.P3 pt2, short colix, byte endcaps, float radius, javajs.util.P3 ptX, javajs.util.P3 ptY)
ptCenter
- pt1
- pt2
- colix
- endcaps
- radius
- ptX
- ptY
- private void outputTriangle1(javajs.util.T3 pt1, javajs.util.T3 pt2, javajs.util.T3 pt3, short colix)
pt1
- Vertex 1.pt2
- Vertex 2.pt3
- Vertex 3.colix
- The colix.private void addTexture(short colix, java.lang.String name)
colix
- name
- TODOprivate void addMesh(java.lang.String name, MeshSurface data, javajs.util.M4 matrix, javajs.util.M4 matrix1, short colix, int[] dim, BS bsValid)
name
- The name to be used for the mesh.data
- Where the data are located.matrix
- Transformation to transform the base mesh.matrix1
- Transformation for normalscolix
- Colix associated with the mesh.dim
- The width, height of the associated image for UV texture
coordinates. If null no UV coordinates are used.bsValid
- TODOprivate void outputList(javajs.util.T3[] pts, int nPts, javajs.util.M4 m, java.lang.String prefix, BS bsValid)
pts
- nPts
- m
- prefix
- bsValid
- TODOprivate void outputFace1(int[] face, int[] map, int[] map2)
face
- map
- Map of data vertex indexes to output indexesmap2
- Map of data normal indexes to output indexesprivate void outputFace2(int[] face, int vt, int[] map, int[] map2)
face
- Array of vertices for the face.vt
- Number of the vt texture coordinate.map
- Map of data vertex indexes to output indexesmap2
- Map of data normal indexes to output indexesprivate javajs.util.OC createTextureFile(java.lang.String name, MeshSurface data, int[] dim)
name
- The name of the file without the path or ext. This will be added to
the root name of the OBJ file along with the image suffix. The value
should be the name given to the surface.data
- dim
- A Point representing the width, height of the image.