unlekker.data
Class POVRay

java.lang.Object
  extended by processing.core.PImage
      extended by processing.core.PGraphics
          extended by processing.core.PGraphics3D
              extended by unlekker.data.POVRay
All Implemented Interfaces:
java.lang.Cloneable, processing.core.PConstants

public class POVRay
extends processing.core.PGraphics3D

Class to export POV-Ray files from Processing. Only triangles are supported at the moment. See the POV-Ray documentation for more info about the format.

Mechanisms are provided to use the #declare imperative (beginObject()) and textures (beginTexture()).

Author:
Marius Watz

Field Summary
 
Fields inherited from class processing.core.PGraphics3D
camera, cameraFar, cameraFOV, cameraNear, cameraX, cameraY, cameraZ, cameraAspect, currentLightFalloffConstant, currentLightFalloffLinear, currentLightFalloffQuadratic, currentLightSpecular, lightCount, lightDiffuse, lightFalloffConstant, lightFalloffLinear, lightFalloffQuadratic, lightNormal, lightPosition, lightSpecular, lightSpotAngle, lightSpotAngleCos, lightSpotConcentration, lightType, line, MAX_LIGHTS, modelview, modelviewInv, projection, smoothTriangle, TRI_COLOR_COUNT, TRI_DIFFUSE_A, TRI_DIFFUSE_B, TRI_DIFFUSE_G, TRI_DIFFUSE_R, TRI_SPECULAR_B, TRI_SPECULAR_G, TRI_SPECULAR_R, triangle, zbuffer
 
Fields inherited from class processing.core.PGraphics
ambientB, ambientG, ambientR, backgroundColor, bezierDetail, colorMode, colorModeA, colorModeX, colorModeY, colorModeZ, curveTightness, edge, ellipseMode, emissiveB, emissiveG, emissiveR, fill, fillColor, image, imageMode, normalX, normalY, normalZ, pixelCount, rectMode, shapeMode, shininess, smooth, specularB, specularG, specularR, sphereDetailU, sphereDetailV, stroke, strokeCap, strokeColor, strokeJoin, strokeWeight, textAlign, textAlignY, textFont, textLeading, textMode, textSize, textureImage, textureMode, textureU, textureV, tint, tintColor
 
Fields inherited from class processing.core.PImage
format, height, parent, pixels, width
 
Fields inherited from interface processing.core.PConstants
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MOVE, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z
 
Constructor Summary
POVRay()
          Constructor for use with beginRaw().
 
Method Summary
 void beginDraw()
           
 void beginObject(java.lang.String objname)
          Outputs a #declare statement declaring a union with name "objname".
 void beginShape(int kind)
           
 void beginTexture()
          Starts a texture declaration.
 void beginTexture(java.lang.String texname)
          Declare a named texture.
 void dispose()
           
 void endDraw()
           
 void endObject()
          Ends the object declaration.
 void endShape(int mode)
           
 void endTexture()
          Ends the texture declaration.
 java.lang.String nf(float val)
           
 void setParent(processing.core.PApplet _p)
           
 void setPath(java.lang.String path)
           
 void setSize(int w, int h)
           
 void texture(java.lang.String tex)
          Ends the object declaration.
 void vertex(float x, float y)
           
 void vertex(float x, float y, float z)
           
 void writeTri(Face f)
          Write triangle from STLFace object.
 
Methods inherited from class processing.core.PGraphics3D
ambientLight, ambientLight, applyMatrix, applyMatrix, applyMatrix, applyMatrix, beginCamera, box, camera, camera, directionalLight, endCamera, flush, frustum, getMatrix, getMatrix, hint, is2D, is3D, lightFalloff, lights, lightSpecular, modelX, modelY, modelZ, noLights, noSmooth, ortho, ortho, perspective, perspective, pointLight, popMatrix, printCamera, printMatrix, printProjection, pushMatrix, resetMatrix, rotate, rotate, rotateX, rotateY, rotateZ, scale, scale, scale, screenX, screenX, screenY, screenY, screenZ, setMatrix, setMatrix, smooth, sphere, spotLight, strokeCap, strokeJoin, texture, translate, translate, vertex
 
Methods inherited from class processing.core.PGraphics
alpha, ambient, ambient, ambient, applyMatrix, arc, background, background, background, background, background, background, background, beginRaw, beginShape, bezier, bezier, bezierDetail, bezierPoint, bezierTangent, bezierVertex, bezierVertex, blue, box, breakShape, brightness, canDraw, color, color, color, color, color, color, color, color, color, colorMode, colorMode, colorMode, colorMode, curve, curve, curveDetail, curvePoint, curveTangent, curveTightness, curveVertex, curveVertex, displayable, edge, ellipse, ellipseMode, emissive, emissive, emissive, endRaw, endShape, fill, fill, fill, fill, fill, fill, getMatrix, getStyle, getStyle, green, hue, image, image, image, imageMode, lerpColor, lerpColor, line, line, noFill, normal, noStroke, noTint, point, point, popStyle, pushStyle, quad, rect, rectMode, red, saturation, setMatrix, setPrimary, shape, shape, shape, shapeMode, shininess, showException, showWarning, specular, specular, specular, sphereDetail, sphereDetail, stroke, stroke, stroke, stroke, stroke, stroke, strokeWeight, style, text, text, text, text, text, text, text, text, text, text, text, text, text, text, textAlign, textAlign, textAscent, textDescent, textFont, textFont, textLeading, textMode, textSize, textureMode, textWidth, textWidth, tint, tint, tint, tint, tint, tint, triangle, vertex, vertex
 
Methods inherited from class processing.core.PImage
blend, blend, blendColor, clone, copy, copy, filter, filter, get, get, get, getCache, getImage, init, isModified, loadPixels, mask, mask, removeCache, resize, save, set, set, setCache, setModified, setModified, updatePixels, updatePixels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POVRay

public POVRay()
Constructor for use with beginRaw().

Method Detail

setParent

public void setParent(processing.core.PApplet _p)
Overrides:
setParent in class processing.core.PGraphics

setPath

public void setPath(java.lang.String path)
Overrides:
setPath in class processing.core.PGraphics

setSize

public void setSize(int w,
                    int h)
Overrides:
setSize in class processing.core.PGraphics3D

beginObject

public void beginObject(java.lang.String objname)
Outputs a #declare statement declaring a union with name "objname".

Parameters:
objname -

endObject

public void endObject()
Ends the object declaration. It will also output a texture with a RGB pigment given by the current fill color.


beginTexture

public void beginTexture(java.lang.String texname)
Declare a named texture.


beginTexture

public void beginTexture()
Starts a texture declaration.


endTexture

public void endTexture()
Ends the texture declaration.


writeTri

public void writeTri(Face f)
Write triangle from STLFace object.


texture

public void texture(java.lang.String tex)
Ends the object declaration. It will also output a texture with a RGB pigment given by the current fill color.


dispose

public void dispose()
Overrides:
dispose in class processing.core.PGraphics

beginDraw

public void beginDraw()
Overrides:
beginDraw in class processing.core.PGraphics3D

endDraw

public void endDraw()
Overrides:
endDraw in class processing.core.PGraphics3D

beginShape

public void beginShape(int kind)
Overrides:
beginShape in class processing.core.PGraphics3D

endShape

public void endShape(int mode)
Overrides:
endShape in class processing.core.PGraphics3D

vertex

public void vertex(float x,
                   float y)
Overrides:
vertex in class processing.core.PGraphics3D

vertex

public void vertex(float x,
                   float y,
                   float z)
Overrides:
vertex in class processing.core.PGraphics

nf

public java.lang.String nf(float val)