public class Scene extends AbstractScene implements PConstants
Profile
instance which allows Shortcut
to
Method
bindings high-level customization (see all the
*Binding*() methods). The Scene is a specialization of the
AbstractScene
, providing an interface between Dandelion
and Processing.
PApplet.setup()
function. See the example BasicUse.
AbstractScene.proscenium()
which defines the objects in your scene. Just
make sure to define the PApplet.draw()
method, even if it's empty. See the
example AlternativeUse.
AbstractScene.keyboardAgent()
, and AbstractScene.motionAgent()
(which in the desktop version of
proscene defaults to a mouseAgent()
):
InteractiveFrame
s and scene keyboard actions (such as
AbstractScene.drawGrid()
or AbstractScene.drawAxes()
). See AbstractScene.keyboardAgent()
.
Eye
and InteractiveFrame
motion actions. Please refer to the MouseAgent
and
KeyAgent
API's.
AnimatorObject.animate()
method. In this case, once you
declare a Scene derived class, you should implement AnimatorObject.animate()
which defines
how your scene objects evolve over time. See the example Animation.
AnimatorObject.timer()
was triggered
within the frame. See the example Flock.
addAnimationHandler(Object, String)
. That method should return
void
and have one single Scene
parameter. See the example
AnimationHandler.
InteractiveFrame
s (see frames()
). An
InteractiveFrame
is a high level
Frame
PSshape wrapper (a coordinate system related to a
PShape or an arbitrary graphics procedure) which may be manipulated by any
Agent
) and for which the scene implements a
'ray-picking' with a color
buffer technique for easy and precise object selection (see pickingBuffer()
and drawFrames(PGraphics)
).AbstractScene.Platform
Modifier and Type | Field and Description |
---|---|
static String |
prettyVersion |
static String |
version |
AXES, frameCount, GRID, PATHS, PICKING, ROTATE, ZOOM
ADD, ALPHA, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CHORD, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ASYNC_SAVEFRAME, DISABLE_BUFFER_READING, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_KEY_REPEAT, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_OPTIMIZED_STROKE, DISABLE_STROKE_PERSPECTIVE, DISABLE_STROKE_PURE, DISABLE_TEXTURE_MIPMAPS, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ASYNC_SAVEFRAME, ENABLE_BUFFER_READING, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_KEY_REPEAT, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_OPTIMIZED_STROKE, ENABLE_STROKE_PERSPECTIVE, ENABLE_STROKE_PURE, ENABLE_TEXTURE_MIPMAPS, ENTER, EPSILON, ERODE, ESC, EXCLUSION, FX2D, GIF, GRAY, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, PIE, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADRATIC_VERTEX, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPAN, SPHERE, SPOT, SQUARE, SUBTRACT, SVG, TAB, TARGA, TAU, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
Constructor and Description |
---|
Scene(PApplet p)
Constructor that defines an on-screen Processing Scene.
|
Scene(PApplet p,
PGraphics renderer)
Same as
this(p, renderer, 0, 0) . |
Scene(PApplet p,
PGraphics pg,
int x,
int y)
Main constructor defining a left-handed Processing compatible Scene.
|
Modifier and Type | Method and Description |
---|---|
String |
action(Shortcut shortcut)
Same as
return profile.action(key) . |
void |
addAnimationHandler(Object obj,
String methodName)
Attempt to add an 'animation' handler method to the Scene.
|
static void |
applyTransformation(PGraphics pgraphics,
Frame frame)
Apply the local transformation defined by the given
frame on the given
pgraphics . |
static void |
applyWorldTransformation(PGraphics pgraphics,
Frame frame)
Apply the global transformation defined by the given
frame on the given
pgraphics . |
boolean |
areTimersSeq() |
void |
beginDraw()
Only if the Scene
AbstractScene.isOffscreen() . |
void |
beginScreenDrawing()
Need to override it because of this issue:
https://github.com/remixlab/proscene/issues/1
|
void |
beginScreenDrawing(PGraphics p)
Begins screen drawing on an arbitrary PGraphics instance using
AbstractScene.eye()
parameters. |
void |
bindMatrices(PGraphics pgraphics)
Same as
matrixHelper(pgraphics).bind(false) . |
ArrayList<InteractiveFrame> |
branch(GenericFrame frame)
Collects
frame and all its descendant frames. |
boolean |
checkIfGrabsInput(BogusEvent event)
Checks for the existence of the
Grabber.checkIfGrabsInput(BogusEvent) condition at the
pApplet() , having
public boolean checkIfGrabsInput(Scene, CustomEvent) as method
prototype. |
boolean |
checkIfGrabsInput(KeyboardEvent event)
Override this method when you want the object to be picked from a
KeyboardEvent . |
void |
disableAutoFocus()
Disables the off-screen scene auto-focus property.
|
void |
disableDepthTest()
Disables z-buffer.
|
void |
disableDepthTest(PGraphics p)
Disables depth test on the PGraphics instance.
|
boolean |
disableDroidKeyAgent()
Disables the droid key agent and returns it.
|
boolean |
disableDroidTouchAgent()
Disables the default droid touch agent and returns it.
|
boolean |
disableKeyAgent()
Disables the key agent and returns it.
|
boolean |
disableKeyboardAgent()
Disables the default keyboard agent and returns it.
|
boolean |
disableMotionAgent()
Disables the default mouse agent and returns it.
|
boolean |
disableMouseAgent()
Disables the default mouse agent and returns it.
|
void |
disablePickingBuffer()
Disable the
pickingBuffer() . |
void |
display()
Same as
display(pg()) . |
void |
display(PGraphics pgraphics)
Same as
pApplet().image(pgraphics, originCorner().x(), originCorner().y()) . |
void |
displayInfo(boolean onConsole)
Displays the
AbstractScene.info() bindings. |
void |
dispose()
Same as
saveConfig() . |
void |
draw()
Paint method which is called just after your
PApplet.draw() method. |
void |
drawAxes(float length)
Draws axes of length
length which origin correspond to the world coordinate
system origin. |
void |
drawAxes(PGraphics pg)
Same as
drawAxes(pg, radius()/5) . |
void |
drawAxes(PGraphics pg,
float length)
Low-level version of
drawAxes(float) . |
void |
drawCone(int detail,
float x,
float y,
float r,
float h)
Draws a cone along the positive
z axis, with its base centered at
(x,y) , height h , and radius r . |
void |
drawCone(int detail,
float x,
float y,
float r1,
float r2,
float h)
Draws a truncated cone along the positive
z axis, with its base centered at
(x,y) , height h , and radii r1 and r2 (basis and
height respectively). |
void |
drawCone(PGraphics pg)
Same as
drawCone(pg, 12, 0, 0, radius()/4, sqrt(3) * radius()/4) . |
static void |
drawCone(PGraphics pg,
float r,
float h)
Same as
cone(pg, 12, 0, 0, r, h); |
static void |
drawCone(PGraphics pg,
float r1,
float r2,
float h)
Same as
cone(pg, 18, 0, 0, r1, r2, h); |
static void |
drawCone(PGraphics pg,
int det,
float r,
float h)
Same as
cone(pg, det, 0, 0, r, h); |
static void |
drawCone(PGraphics pg,
int det,
float r1,
float r2,
float h)
Same as
cone(pg, det, 0, 0, r1, r2, h) |
static void |
drawCone(PGraphics pg,
int detail,
float x,
float y,
float r,
float h)
Low-level version of
drawCone(int, float, float, float, float) . |
static void |
drawCone(PGraphics pg,
int detail,
float x,
float y,
float r1,
float r2,
float h)
Low-level version of
drawCone(int, float, float, float, float, float) . |
void |
drawCross(float px,
float py,
float size)
Draws a cross on the screen centered under pixel
(px, py) , and edge of size
size . |
void |
drawCross(PGraphics pg,
float px,
float py,
float size) |
void |
drawCylinder(float w,
float h)
Draws a cylinder of width
w and height h , along the positive
z axis. |
void |
drawCylinder(PGraphics pg)
Same as
drawCylinder(pg, radius()/6, radius()/3) . |
static void |
drawCylinder(PGraphics pg,
float w,
float h)
Low-level version of
drawCylinder(float, float) . |
void |
drawDottedGrid(float size,
int nbSubdivisions)
Draws a dotted-grid in the XY plane, centered on (0,0,0) (defined in the current
coordinate system).
|
void |
drawDottedGrid(PGraphics pg)
Same as
drawDottedGrid(pg, radius()/4, 10) . |
void |
drawDottedGrid(PGraphics pg,
float size,
int nbSubdivisions)
Low-level version of
drawDottedGrid(float, int) . |
void |
drawEye(Eye eye)
Draws a representation of the
eye in the scene. |
void |
drawEye(Eye eye,
boolean texture)
Applies the
eye.frame() transformation and then calls
drawEye(PGraphics, Eye, boolean) on the scene pg() . |
void |
drawEye(PGraphics pg,
Eye eye)
Same as
drawEye(pg, eye, false) . |
void |
drawEye(PGraphics pg,
Eye eye,
boolean texture)
Implementation of
drawEye(Eye) . |
void |
drawEyeNearPlane(Eye eye) |
void |
drawEyeNearPlane(Eye eye,
boolean texture)
Applies the
eye.frame() transformation and then calls
drawEye(PGraphics, Eye, boolean) on the scene pg() . |
void |
drawEyeNearPlane(PGraphics pg,
Eye eye)
Same as
drawEyeNearPlane(pg, eye, false) . |
void |
drawEyeNearPlane(PGraphics pg,
Eye eye,
boolean texture)
Draws the eye near plane.
|
void |
drawFilledCircle(int subdivisions,
Vec center,
float radius)
Draws a filled circle using screen coordinates.
|
void |
drawFilledCircle(PGraphics pg,
int subdivisions,
Vec center,
float radius) |
void |
drawFilledSquare(PGraphics pg,
Vec center,
float edge) |
void |
drawFilledSquare(Vec center,
float edge)
Draws a filled square using screen coordinates.
|
void |
drawFrames()
|
void |
drawFrames(PGraphics pgraphics)
Draw all
frames() into the given pgraphics. |
void |
drawGrid(float size)
Same as
drawGrid(size, 10) . |
void |
drawGrid(float size,
int nbSubdivisions)
Draws a grid in the XY plane, centered on (0,0,0) (defined in the current coordinate
system).
|
void |
drawGrid(PGraphics pg)
Same as
drawGrid(pg, radius()/4, 10) . |
void |
drawGrid(PGraphics pg,
float size,
int nbSubdivisions)
Low-level version of
drawGrid(float) . |
void |
drawHollowCylinder(int detail,
float w,
float h,
Vec m,
Vec n)
Draws a cylinder whose bases are formed by two cutting planes (
m and
n ), along the Camera positive z axis. |
static void |
drawHollowCylinder(PGraphics pg,
int detail,
float w,
float h,
Vec m,
Vec n)
Low-level version of
drawHollowCylinder(int, float, float, Vec, Vec) . |
void |
drawPath(KeyFrameInterpolator kfi,
int mask,
int nbFrames,
float scale)
Draws the path used to interpolate the
KeyFrameInterpolator.frame() |
void |
drawPickingTarget(GenericFrame iFrame)
Draws all GrabberFrames' picking targets: a shooter target visual hint of
GenericFrame.grabsInputThreshold() pixels size. |
void |
drawProjector(Eye eye,
Vec src)
Calls
drawProjector(PGraphics, Eye, Vec) on the scene pg() . |
void |
drawProjector(PGraphics pg,
Eye eye,
Vec src)
Draws as a line (or point in 2D) the projection of
src (given in the world
coordinate system) onto the near plane. |
void |
drawProjectors(Eye eye,
List<Vec> src)
Calls
drawProjectors(PGraphics, Eye, List) on the scene pg() . |
void |
drawProjectors(PGraphics pg,
Eye eye,
List<Vec> src)
Draws as lines (or points in 2D) the projection of each vector in
src (all of
which should be given in the world coordinate system) onto the near plane. |
void |
drawShooterTarget(PGraphics pg,
Vec center,
float length) |
void |
drawShooterTarget(Vec center,
float length)
Draws the classical shooter target on the screen.
|
void |
drawTorusSolenoid(int faces,
int detail,
float insideRadius,
float outsideRadius)
Code contributed by Jacques Maire (http://www.alcys.com/) See also:
http://www.mathcurve.com/courbes3d/solenoidtoric/solenoidtoric.shtml
http://crazybiocomputing.blogspot.fr/2011/12/3d-curves-toric-solenoids.html
|
static void |
drawTorusSolenoid(PGraphics pg)
Convenience function that simply calls
drawTorusSolenoid(pg, 6) . |
static void |
drawTorusSolenoid(PGraphics pg,
float insideRadius)
Convenience function that simply calls
drawTorusSolenoid(pg, 6, insideRadius)
. |
static void |
drawTorusSolenoid(PGraphics pg,
int faces,
float insideRadius)
Convenience function that simply calls
drawTorusSolenoid(pg, faces, 100, insideRadius, insideRadius * 1.3f) . |
static void |
drawTorusSolenoid(PGraphics pg,
int faces,
int detail,
float insideRadius,
float outsideRadius)
|
DroidKeyAgent |
droidKeyAgent()
Returns the default droid key agent handling touch events.
|
DroidTouchAgent |
droidTouchAgent()
Returns the default droid touch agent handling touch events.
|
void |
enableAutoFocus()
Enables the off-screen scene auto-focus property.
|
void |
enableAutoFocus(boolean flag)
Turns on or off the off-screen scene auto-focus property according to
flag . |
void |
enableDepthTest()
Enables z-buffer.
|
void |
enableDepthTest(PGraphics p)
Enables depth test on the PGraphics instance.
|
void |
enableDroidKeyAgent()
Enables keyboard handling through the
droidKeyAgent() . |
void |
enableDroidTouchAgent()
Enables motion handling through the
droidTouchAgent() . |
void |
enableKeyAgent()
Enables keyboard handling through the
keyAgent() . |
void |
enableKeyboardAgent()
Enables Proscene keyboard handling through the
AbstractScene.keyboardAgent() . |
void |
enableMotionAgent()
Enables Proscene mouse handling through the
mouseAgent() . |
void |
enableMouseAgent()
Enables motion handling through the
mouseAgent() . |
void |
enablePickingBuffer()
Enable the
pickingBuffer() . |
void |
endDraw()
Only if the Scene
AbstractScene.isOffscreen() . |
void |
endScreenDrawing()
Need to override it because of this issue:
https://github.com/remixlab/proscene/issues/1
|
void |
endScreenDrawing(PGraphics p)
Ends screen drawing on the arbitrary PGraphics instance using
AbstractScene.eye()
parameters. |
InteractiveFrame |
eyeFrame() |
ArrayList<InteractiveFrame> |
frames()
Returns the collection of interactive frames the scene handles, including eye-frames.
|
boolean |
hasAnimationHandler()
Returns
true if the user has registered an 'animation' handler method to the
Scene and false otherwise. |
boolean |
hasAutoFocus()
When having multiple off-screen scenes displayed at once, one should decide which
scene will grab input from both, the
AbstractScene.motionAgent() and the
AbstractScene.keyboardAgent() , so that code like this: |
boolean |
hasBinding(Shortcut shortcut)
Same as
return profile.hasBinding(shortcut) . |
boolean |
hasKeyBinding(char key)
Same as
return hasBinding(new KeyboardShortcut(key)) . |
boolean |
hasKeyBinding(int vkey)
Same as
return hasBinding(new KeyboardShortcut(vkey)) . |
boolean |
hasKeyBinding(int mask,
char key)
Same as
return hasKeyBinding(mask, keyCode(key)) . |
boolean |
hasKeyBinding(int mask,
int vkey)
Same as
return hasBinding(new KeyboardShortcut(mask, vkey)) . |
int |
height() |
String |
info()
Convenience function that simply returns
inputHandler().info() . |
String |
info(Class<? extends Shortcut> cls)
Same as
profile.info(cls) . |
boolean |
invokeAnimationHandler()
Returns whether or not the animated method is defined externally, as when register it
through reflection.
|
boolean |
is3D() |
boolean |
isActionBound(String action)
Same as
return profile.isActionBound(action) . |
boolean |
isDroidKeyAgentEnabled()
|
boolean |
isDroidTouchAgentEnabled()
|
boolean |
isKeyAgentEnabled()
|
boolean |
isMouseAgentEnabled()
|
boolean |
isPickingBufferEnabled()
|
KeyAgent |
keyAgent()
Returns the default key agent handling Processing key events.
|
static int |
keyCode(char key)
Either returns
KeyAgent.keyCode(char) or
DroidKeyAgent.keyCode(char) depending on
AbstractScene.platform() . |
void |
line(float x1,
float y1,
float x2,
float y2)
Same as
pg().line(x1, y1, x2, y2) . |
void |
line(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
Same as
if (this.is2D()) line(pg(), x1, y1, x2, y2); else line(pg(), x1, y1, z1, x2, y2, z2);
. |
static void |
line(PGraphics pg,
float x1,
float y1,
float x2,
float y2)
Wrapper for PGraphics.line(x1, y1, x2, y2)
|
static void |
line(PGraphics pg,
float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
Wrapper for PGraphics.line(x1, y1, z1, x2, y2, z2)
|
void |
loadConfig()
Same as
loadConfig("data/config.json") . |
void |
loadConfig(String fileName)
Loads the
AbstractScene.eye() , the AbstractScene.radius() , the AbstractScene.visualHints() , the
Camera.type() and the
Eye.keyFrameInterpolatorArray() from
fileName . |
MatrixHelper |
matrixHelper(PGraphics pgraphics)
Returns a new matrix helper for the given
pgraphics . |
MouseAgent |
mouseAgent()
Returns the default mouse agent handling Processing mouse events.
|
PApplet |
pApplet()
Returns the PApplet instance this Scene is related to.
|
void |
performInteraction(BogusEvent event)
Same as
profile.handle(event) . |
PGraphics |
pg()
Returns the PGraphics instance this Scene is related to.
|
PGraphics |
pickingBuffer()
Returns the
frames()
'ray-picking' color
buffer. |
float |
pixelDepth(Point pixel)
Returns the depth (z-value) of the object under the
pixel . |
void |
pre()
Paint method which is called just before your
PApplet.draw() method. |
void |
preDraw()
Called before your main drawing and performs the following:
Handles the
AbstractScene.avatar()
Calls AbstractScene.bindMatrices()
Calls Eye.updateBoundaryEquations() if
AbstractScene.areBoundaryEquationsEnabled()
Calls AbstractScene.proscenium()
|
void |
registerTimingTask(TimingTask task)
Convenience wrapper function that simply calls
timingHandler().registerTask(task) . |
void |
removeAnimationHandler()
Unregisters the 'animation' handler method (if any has previously been added to the
Scene).
|
void |
removeBinding(Shortcut shortcut)
Same as
profile.removeBinding(shortcut) . |
void |
removeBindings()
Same as
profile.removeBindings() . |
void |
removeBindings(Class<? extends Shortcut> cls)
Same as
profile.removeBindings(cls) . |
void |
removeKeyBinding(char key)
Same as
removeBinding(new KeyboardShortcut(key)) . |
void |
removeKeyBinding(int vkey)
Same as
removeBinding(new KeyboardShortcut(vkey)) . |
void |
removeKeyBinding(int mask,
char key)
Same as
removeKeyBinding(mask, keyCode(key)) . |
void |
removeKeyBinding(int mask,
int vkey)
Same as
removeBinding(new KeyboardShortcut(mask, vkey)) . |
void |
removeKeyBindings()
Same as
removeBindings(KeyboardShortcut.class) . |
void |
saveConfig()
Same as
saveConfig("data/config.json") . |
void |
saveConfig(String fileName)
Saves the
AbstractScene.eye() , the AbstractScene.radius() , the AbstractScene.visualHints() , the
Camera.type() and the
Eye.keyFrameInterpolatorArray() into
fileName . |
void |
setBinding(Object object,
Shortcut shortcut,
String action)
Same as
profile.setBinding(object, shortcut, action) . |
void |
setBinding(Shortcut shortcut,
String action)
Same as
profile.setBinding(shortcut, action) . |
void |
setBindings(Scene otherScene)
Same as
profile.set(otherScene.profile) . |
void |
setDefaultKeyBindings()
Calls
removeKeyBindings() and sets the default frame key bindings which may
be queried with info() . |
void |
setKeyBinding(char key,
String methodName)
Same as
setBinding(new KeyboardShortcut(key), methodName) . |
void |
setKeyBinding(int mask,
char key,
String methodName)
Same as
setKeyBinding(mask, keyCode(key), methodName) . |
void |
setKeyBinding(int mask,
int vkey,
String methodName)
Same as
setBinding(new KeyboardShortcut(mask, vkey), methodName) . |
void |
setKeyBinding(int vkey,
String methodName)
Same as
setBinding(new KeyboardShortcut(vkey), methodName) . |
void |
setKeyBinding(Object object,
char key,
String methodName)
Same as
setBinding(object, new KeyboardShortcut(key), methodName) . |
void |
setKeyBinding(Object object,
int mask,
char key,
String methodName)
Same as
setKeyBinding(object, mask, keyCode(key), methodName) . |
void |
setKeyBinding(Object object,
int mask,
int vkey,
String methodName)
Same as
setBinding(object, new KeyboardShortcut(mask, vkey), methodName) . |
void |
setKeyBinding(Object object,
int vkey,
String methodName)
Same as
setBinding(object, new KeyboardShortcut(vkey), methodName) . |
void |
setNonSeqTimers()
Sets all
AnimatorObject.timingHandler() timers as (multi-threaded) java.util.Timer(s). |
void |
setSeqTimers()
Sets all
AnimatorObject.timingHandler() timers as (single-threaded)
SeqTimer (s). |
void |
shiftTimers()
|
static void |
showOnlyOffScreenWarning(String method)
Same as
showOnlyOffScreenWarning(method, true) . |
static void |
showOnlyOffScreenWarning(String method,
boolean offscreen)
Display a warning that the specified method is only available for off-screen scenes
if
offscreen is true , or (on-screen scenes if if offscreen is
false ). |
void |
toggleAutoFocus()
Toggles the off-screen scene auto-focus property.
|
void |
togglePickingBuffer()
Toggles availability of the
pickingBuffer() . |
static Mat |
toMat(PMatrix2D m)
Converts a PMatrix2D to a
Mat . |
static Mat |
toMat(PMatrix3D m)
Converts a PMatrix3D to a
Mat . |
static PMatrix3D |
toPMatrix(Mat m)
Converts a
Mat to a PMatrix3D. |
static PMatrix2D |
toPMatrix2D(Mat m)
Converts a
Mat to a PMatrix2D. |
static PVector |
toPVector(Vec v)
Converts a
Vec to a PVec. |
static Vec |
toVec(PVector v)
Converts a PVec to a
Vec . |
void |
vertex(float[] v)
Same as
vertex(pg(), v) . |
void |
vertex(float x,
float y)
Same as
vertex(pg(), x, y) . |
void |
vertex(float x,
float y,
float z)
Same as
if (this.is2D()) vertex(pg(), x, y); elsevertex(pg(), x, y, z) . |
void |
vertex(float x,
float y,
float u,
float v)
Same as
vertex(pg(), x, y, u, v) . |
void |
vertex(float x,
float y,
float z,
float u,
float v)
Same as
if (this.is2D()) vertex(pg(), x, y, u, v); else vertex(pg(), x, y, z, u, v); . |
static void |
vertex(PGraphics pg,
float[] v)
Wrapper for PGraphics.vertex(v)
|
static void |
vertex(PGraphics pg,
float x,
float y)
Wrapper for PGraphics.vertex(x,y)
|
static void |
vertex(PGraphics pg,
float x,
float y,
float z)
Wrapper for PGraphics.vertex(x,y,z)
|
static void |
vertex(PGraphics pg,
float x,
float y,
float u,
float v)
Wrapper for PGraphics.vertex(x,y,u,v)
|
static void |
vertex(PGraphics pg,
float x,
float y,
float z,
float u,
float v)
Wrapper for PGraphics.vertex(x,y,z,u,v)
|
int |
width() |
addKeyFrameToPath1, addKeyFrameToPath2, addKeyFrameToPath3, anchor, appendBranch, applyModelView, applyProjection, applyTransformation, applyWorldTransformation, areBoundaryEquationsEnabled, aspectRatio, avatar, axesVisualHint, ballVisibility, boxVisibility, branch, camera, cameraType, center, checkIfGrabsInput, checkIfGrabsInput, checkIfGrabsInput, checkIfGrabsInput, checkIfGrabsInput, checkIfGrabsInput, clearTree, deletePath1, deletePath2, deletePath3, disableBoundaryEquations, displayInfo, drawArrow, drawArrow, drawArrow, drawAxes, drawCone, drawCone, drawCone, drawCone, drawCross, drawDottedGrid, drawDottedGrid, drawDottedGrid, drawFilledCircle, drawGrid, drawGrid, drawPath, drawPath, drawPath, drawTorusSolenoid, drawTorusSolenoid, drawTorusSolenoid, drawTorusSolenoid, enableBoundaryEquations, enableBoundaryEquations, eye, flip, frameCount, frames, getModelView, getProjection, grabsInput, grabsInput, gridIsDotted, gridVisualHint, init, inputHandler, interpolateToFitScene, is2D, isAnimatorRegistered, isConeBackFacing, isConeBackFacing, isFaceBackFacing, isFrameReachable, isKeyboardAgentEnabled, isLeftHanded, isMotionAgentEnabled, isOffscreen, isPointVisible, isRightHanded, isTimingTaskRegistered, isUnprojectedCoordinatesOfOptimized, keyboardAgent, leadingFrames, matrixHelper, modelView, motionAgent, optimizeUnprojectedCoordinatesOf, originCorner, pathsVisualHint, pickingVisualHint, pixelDepth, platform, playPath1, playPath2, playPath3, pointUnderPixel, pointUnderPixel, popModelView, popProjection, postDraw, printModelView, printProjection, projectedCoordinatesOf, projection, proscenium, pruneBranch, pushModelView, pushProjection, radius, registerAnimator, resetAnchor, resetAvatar, resetModelView, resetProjection, rotate, rotate, rotateVisualHint, rotateX, rotateY, rotateZ, scale, scale, scale, setAnchor, setAnchorFromPixel, setAnchorFromPixel, setAvatar, setAxesVisualHint, setBoundingBox, setBoundingRect, setCamera, setCameraType, setCenter, setCenterFromPixel, setCenterFromPixel, setDottedGrid, setEye, setEyeConstraint, setGridVisualHint, setLeftHanded, setMatrixHelper, setModelView, setPathsVisualHint, setPickingVisualHint, setProjection, setRadius, setRightHanded, setRotateVisualHint, setVisualHints, setWindow, setZoomVisualHint, showAll, showDepthWarning, showEventVariationWarning, showMinDOFsWarning, showMissingImplementationWarning, showOnlyEyeWarning, showOnlyEyeWarning, showPlatformVariationWarning, showWarning, toggleAxesVisualHint, toggleBoundaryEquations, toggleCameraType, toggleGridVisualHint, togglePathsVisualHint, togglePickingVisualhint, translate, translate, traverseTree, unprojectedCoordinatesOf, unregisterAnimator, unregisterTimingTask, visualHints, window, zoomVisualHint
animate, animationPeriod, animationStarted, restartAnimation, setAnimationPeriod, setAnimationPeriod, setTimingHandler, startAnimation, stopAnimation, timer, timingHandler, toggleAnimation
public static final String prettyVersion
public static final String version
public Scene(PApplet p)
this(p, p.g
.public Scene(PApplet p, PGraphics pg, int x, int y)
AbstractScene.setMatrixHelper(MatrixHelper)
using a customized
MatrixHelper
depending on the pg
type (see
Java2DMatrixHelper
and
GLMatrixHelper
). The constructor instantiates the
AbstractScene.inputHandler()
and the AnimatorObject.timingHandler()
, sets the AXIS and GRID
visual hint flags, instantiates the AbstractScene.eye()
(a
Camera
if the Scene is3D()
or a
Window
if the Scene AbstractScene.is2D()
). It also
instantiates the AbstractScene.keyboardAgent()
and the mouseAgent()
, and finally
calls AbstractScene.init()
.
An off-screen Processing Scene is defined if pg != p.g
. In this case the
x
and y
parameters define the position of the upper-left corner where
the off-screen Scene is expected to be displayed, e.g., for instance with a call to
Processing the image(img, x, y)
function. If pg == p.g
) (which
defines an on-screen Scene, see also AbstractScene.isOffscreen()
), the values of x and y
are meaningless (both are set to 0 to be taken as dummy values). Render into an
off-screen scene requires the drawing code to be enclose by beginDraw()
and
endDraw()
. To display an off-screen scene call display()
.
public InteractiveFrame eyeFrame()
eyeFrame
in class AbstractScene
public boolean checkIfGrabsInput(BogusEvent event)
Grabber.checkIfGrabsInput(BogusEvent)
condition at the
pApplet()
, having
public boolean checkIfGrabsInput(Scene, CustomEvent)
as method
prototype. If it doesn't find it there, looks for the condition at this instance,
with a similar method prototype, but without the Scene parameter.
You don't need to call this. Automatically called by agents handling this scene.
Note: Call supercheckIfGrabsInput(BogusEvent)
at your scene
derived class, if you prefer to use inheritance to override the scene picking
condition on a custom-event.
checkIfGrabsInput
in interface Grabber
checkIfGrabsInput
in class AbstractScene
supercheckIfGrabsInput(BogusEvent)
public boolean checkIfGrabsInput(KeyboardEvent event)
AbstractScene
KeyboardEvent
.checkIfGrabsInput
in class AbstractScene
public PApplet pApplet()
public PGraphics pg()
AbstractScene.isOffscreen()
.public PGraphics pickingBuffer()
frames()
'ray-picking' color
buffer.drawFrames()
,
drawFrames(PGraphics)
public void enablePickingBuffer()
pickingBuffer()
.public void disablePickingBuffer()
pickingBuffer()
.public boolean isPickingBufferEnabled()
public void togglePickingBuffer()
pickingBuffer()
.public int width()
width
in class AbstractScene
public int height()
height
in class AbstractScene
public boolean is3D()
is3D
in class AbstractScene
public static int keyCode(char key)
KeyAgent.keyCode(char)
or
DroidKeyAgent.keyCode(char)
depending on
AbstractScene.platform()
.public void vertex(float[] v)
vertex(pg(), v)
.vertex(PGraphics, float[])
public static void vertex(PGraphics pg, float[] v)
public void vertex(float x, float y, float z)
if (this.is2D()) vertex(pg(), x, y); elsevertex(pg(), x, y, z)
.vertex(PGraphics, float, float, float)
public static void vertex(PGraphics pg, float x, float y, float z)
public void vertex(float x, float y, float z, float u, float v)
if (this.is2D()) vertex(pg(), x, y, u, v); else vertex(pg(), x, y, z, u, v);
.public static void vertex(PGraphics pg, float x, float y, float z, float u, float v)
public void vertex(float x, float y)
vertex(pg(), x, y)
.vertex(PGraphics, float, float)
public static void vertex(PGraphics pg, float x, float y)
public void vertex(float x, float y, float u, float v)
vertex(pg(), x, y, u, v)
.public static void vertex(PGraphics pg, float x, float y, float u, float v)
public void line(float x1, float y1, float z1, float x2, float y2, float z2)
if (this.is2D()) line(pg(), x1, y1, x2, y2); else line(pg(), x1, y1, z1, x2, y2, z2);
.public static void line(PGraphics pg, float x1, float y1, float z1, float x2, float y2, float z2)
public void line(float x1, float y1, float x2, float y2)
pg().line(x1, y1, x2, y2)
.public static void line(PGraphics pg, float x1, float y1, float x2, float y2)
public void enableMotionAgent()
mouseAgent()
.enableMotionAgent
in class AbstractScene
AbstractScene.isMotionAgentEnabled()
,
disableMotionAgent()
,
enableKeyboardAgent()
public boolean disableMotionAgent()
disableMotionAgent
in class AbstractScene
AbstractScene.isMotionAgentEnabled()
,
enableMotionAgent()
,
enableKeyboardAgent()
,
disableKeyboardAgent()
public void enableKeyboardAgent()
AbstractScene.keyboardAgent()
.enableKeyboardAgent
in class AbstractScene
AbstractScene.isKeyboardAgentEnabled()
,
disableKeyboardAgent()
,
enableMotionAgent()
public boolean disableKeyboardAgent()
disableKeyboardAgent
in class AbstractScene
AbstractScene.isKeyboardAgentEnabled()
,
enableKeyboardAgent()
,
disableMotionAgent()
public MouseAgent mouseAgent()
public void enableMouseAgent()
mouseAgent()
.public boolean disableMouseAgent()
public boolean isMouseAgentEnabled()
public KeyAgent keyAgent()
enableKeyAgent()
,
isKeyAgentEnabled()
,
disableKeyAgent()
,
mouseAgent()
public void enableKeyAgent()
keyAgent()
.keyAgent()
,
isKeyAgentEnabled()
,
disableKeyAgent()
,
enableMouseAgent()
public boolean disableKeyAgent()
keyAgent()
,
isKeyAgentEnabled()
,
enableKeyAgent()
,
disableMouseAgent()
public boolean isKeyAgentEnabled()
keyAgent()
,
enableKeyAgent()
,
disableKeyAgent()
,
enableKeyAgent()
public DroidTouchAgent droidTouchAgent()
public void enableDroidTouchAgent()
droidTouchAgent()
.public boolean disableDroidTouchAgent()
public boolean isDroidTouchAgentEnabled()
public DroidKeyAgent droidKeyAgent()
public void enableDroidKeyAgent()
droidKeyAgent()
.public boolean disableDroidKeyAgent()
public boolean isDroidKeyAgentEnabled()
keyAgent()
,
enableKeyAgent()
,
disableKeyAgent()
,
enableKeyAgent()
public String info()
AbstractScene
inputHandler().info()
.info
in class AbstractScene
AbstractScene.displayInfo(boolean)
public void displayInfo(boolean onConsole)
AbstractScene
AbstractScene.info()
bindings.displayInfo
in class AbstractScene
onConsole
- if this flag is true displays the help on console. Otherwise displays it on
the appletAbstractScene.info()
public void registerTimingTask(TimingTask task)
AbstractScene
timingHandler().registerTask(task)
.registerTimingTask
in class AbstractScene
TimingHandler.registerTask(TimingTask)
public void setSeqTimers()
AnimatorObject.timingHandler()
timers as (single-threaded)
SeqTimer
(s).setNonSeqTimers()
,
shiftTimers()
,
areTimersSeq()
public void setNonSeqTimers()
AnimatorObject.timingHandler()
timers as (multi-threaded) java.util.Timer(s).setSeqTimers()
,
shiftTimers()
,
areTimersSeq()
public boolean areTimersSeq()
AnimatorObject.timingHandler()
timers are (single-threaded) SeqTimer
(s)).setSeqTimers()
,
setNonSeqTimers()
,
shiftTimers()
public void shiftTimers()
public boolean invokeAnimationHandler()
Animator
invokeAnimationHandler
in interface Animator
invokeAnimationHandler
in class AnimatorObject
public void addAnimationHandler(Object obj, String methodName)
obj
- the object to handle the eventmethodName
- the method to execute in the object handler classAnimatorObject.animate()
,
removeAnimationHandler()
public void removeAnimationHandler()
addAnimationHandler(Object, String)
public boolean hasAnimationHandler()
true
if the user has registered an 'animation' handler method to the
Scene and false
otherwise.public float pixelDepth(Point pixel)
AbstractScene
pixel
.
The z-value ranges in [0..1] (near and far plane respectively). In 3D Note that this
value is not a linear interpolation between
Camera.zNear()
and
Camera.zFar()
;
z = zFar() / (zFar() - zNear()) * (1.0f - zNear() / z');
where z'
is
the distance from the point you project to the camera, along the
Camera.viewDirection()
. See the gluUnProject
man page for details.
pixelDepth
in class AbstractScene
public void disableDepthTest()
AbstractScene
disableDepthTest
in class AbstractScene
public void disableDepthTest(PGraphics p)
enableDepthTest(PGraphics)
public void enableDepthTest()
AbstractScene
enableDepthTest
in class AbstractScene
public void enableDepthTest(PGraphics p)
disableDepthTest(PGraphics)
public void preDraw()
AbstractScene.avatar()
AbstractScene.bindMatrices()
Eye.updateBoundaryEquations()
if
AbstractScene.areBoundaryEquationsEnabled()
AbstractScene.proscenium()
Note that this method overloads
AbstractScene.preDraw()
where a call to
AbstractScene.displayVisualHints()
is done. Here, however, it needs to be bypassed for the
PApplet.background() method not to hide the display of the AbstractScene.visualHints()
.
The AbstractScene.displayVisualHints()
mostly happens then at the draw()
method,
if the scene is on-screen, or at the endDraw()
if it is off-screen.
preDraw
in class AbstractScene
AbstractScene.postDraw()
public void pre()
PApplet.draw()
method. Simply
calls preDraw()
. This method is registered at the PApplet and hence you
don't need to call it. Only meaningful if the scene is on-screen (it the scene
AbstractScene.isOffscreen()
it even doesn't get registered at the PApplet.
If pg()
is resized then (re)sets the scene width()
and
height()
, and calls
Eye.setScreenWidthAndHeight(int, int)
.
public void draw()
PApplet.draw()
method. Calls
AbstractScene.proscenium()
, AbstractScene.displayVisualHints()
, draws the scene into the
pickingBuffer()
and AbstractScene.postDraw()
. This method is registered at the
PApplet and hence you don't need to call it. Only meaningful if the scene is
on-screen (it the scene AbstractScene.isOffscreen()
it even doesn't get registered at the
PApplet.
If AbstractScene.isOffscreen()
does nothing.
public static void showOnlyOffScreenWarning(String method)
showOnlyOffScreenWarning(method, true)
.public static void showOnlyOffScreenWarning(String method, boolean offscreen)
offscreen
is true
, or (on-screen scenes if if offscreen
is
false
).public void beginDraw()
AbstractScene.isOffscreen()
. Calls pg().beginDraw()
(hence
there's no need to explicitly call it) and then preDraw()
.
If pg()
is resized then (re)sets the scene width()
and
height()
, and calls
Eye.setScreenWidthAndHeight(int, int)
.
draw()
,
preDraw()
,
AbstractScene.postDraw()
,
pre()
,
endDraw()
,
AbstractScene.isOffscreen()
,
pg()
public void endDraw()
AbstractScene.isOffscreen()
. Calls
AbstractScene.proscenium()
AbstractScene.displayVisualHints()
pg().endDraw()
and hence there's no need to explicitly call ithandlePickingBuffer()
handleFocus()
if hasAutoFocus()
is true
AbstractScene.postDraw()
draw()
,
preDraw()
,
AbstractScene.postDraw()
,
beginDraw()
,
pre()
,
AbstractScene.isOffscreen()
,
pg()
public void display()
display(pg())
. Only meaningful if the scene AbstractScene.isOffscreen()
.display(PGraphics)
,
pg()
public void display(PGraphics pgraphics)
pApplet().image(pgraphics, originCorner().x(), originCorner().y())
.
Only meaningful if the scene AbstractScene.isOffscreen()
.
Displays the contents of the pgraphics (typically pg()
or the
pickingBuffer()
) into the scene pApplet()
.
public boolean hasAutoFocus()
AbstractScene.motionAgent()
and the
AbstractScene.keyboardAgent()
, so that code like this:
scene1.beginDraw();
drawScene1();
scene.endDraw();
scene.display();
scene2.beginDraw();
drawScene2();
scene2.endDraw();
scene2.display();
will behave according to a given focus policy. This property is enabled by default and it implements a "focus follows mouse" policy, so that the scene under the cursor will grab input. If multiple scenes overlaps the scene on top will grab the input as expected.
To implement a different policy either:
hasFocus()
Scene object; or,disableAutoFocus()
and implement your own focus policy at the
sketch space.
Note that for this policy to work you should call display()
instead
of the papplet image() function on the pg()
.
public void toggleAutoFocus()
public void disableAutoFocus()
public void enableAutoFocus()
public void enableAutoFocus(boolean flag)
flag
.
The hasAutoFocus()
property for off-screen scenes is true
by
default.
public void dispose()
saveConfig()
.
Should be called automatically by P5, but it is currently broken. See: https://github.com/processing/processing/issues/4445
saveConfig()
,
saveConfig(String)
,
loadConfig()
,
loadConfig(String)
public void saveConfig()
saveConfig("data/config.json")
.
Note that off-screen scenes require saveConfig(String)
instead.
saveConfig(String)
,
loadConfig()
,
loadConfig(String)
public void saveConfig(String fileName)
AbstractScene.eye()
, the AbstractScene.radius()
, the AbstractScene.visualHints()
, the
Camera.type()
and the
Eye.keyFrameInterpolatorArray()
into
fileName
.saveConfig()
,
loadConfig()
,
loadConfig(String)
public void loadConfig()
loadConfig("data/config.json")
.
Note that off-screen scenes require loadConfig(String)
instead.
loadConfig(String)
,
saveConfig()
,
saveConfig(String)
public void loadConfig(String fileName)
AbstractScene.eye()
, the AbstractScene.radius()
, the AbstractScene.visualHints()
, the
Camera.type()
and the
Eye.keyFrameInterpolatorArray()
from
fileName
.saveConfig()
,
saveConfig(String)
,
loadConfig()
public ArrayList<InteractiveFrame> frames()
Note that iterating through the scene frames is not as efficient as simply calling
drawFrames()
.
public ArrayList<InteractiveFrame> branch(GenericFrame frame)
frame
and all its descendant frames. When eyeframes
is
true
eye-frames will also be collected. Note that for a frame to be collected
it must be reachable.public void drawFrames()
frames()
into the pg()
buffer. A similar (but
slightly less efficient) effect may be achieved with
for (InteractiveFrame frame : frames()) frame.draw(pg());
.
Note that drawFrames()
is typically called from within your sketch
pApplet()
draw() loop.
This method is implementing by simply calling
AbstractScene.traverseTree()
.
Attention: this method should be called after AbstractScene.bindMatrices()
(i.e.,
eye update which happens at preDraw()
) and before any other transformation
of the modelview takes place.
public void drawFrames(PGraphics pgraphics)
frames()
into the given pgraphics. No
pgraphics.beginDraw()/endDraw()
calls take place. This method allows shader
chaining.
Note that drawFrames(pickingBuffer())
(which enables 'picking' of the frames
using a 'ray-picking'
technique is called by AbstractScene.postDraw()
.
Attention: this method should be called after bindMatrices(PGraphics)
(i.e., manual eye update) and before any other transformation of the modelview takes
place.
pgraphics
- frames()
,
drawFrames()
,
InteractiveFrame.draw(PGraphics)
public MatrixHelper matrixHelper(PGraphics pgraphics)
pgraphics
. Rarely needed.
Note that the current scene matrix helper may be retrieved by AbstractScene.matrixHelper()
.
public void bindMatrices(PGraphics pgraphics)
matrixHelper(pgraphics).bind(false)
. Set the pgraphics
matrices by calling
MatrixHelper.loadProjection(boolean)
and
MatrixHelper.loadModelView(boolean)
(only makes sense
when pg()
is different than pgraphics
).
This method doesn't perform any computation, but simple retrieve the current matrices
whose actual computation has been updated in preDraw()
.
public static void applyTransformation(PGraphics pgraphics, Frame frame)
frame
on the given
pgraphics
. This method doesn't call bindMatrices(PGraphics)
which
should be called manually (only makes sense when pg()
is different than
pgraphics
). Needed by applyWorldTransformation(PGraphics, Frame)
.public static void applyWorldTransformation(PGraphics pgraphics, Frame frame)
frame
on the given
pgraphics
. This method doesn't call bindMatrices(PGraphics)
which
should be called manually (only makes sense when pg()
is different than
pgraphics
). Needed by
InteractiveFrame.draw(PGraphics)
public void beginScreenDrawing()
beginScreenDrawing
in class AbstractScene
MatrixHelper.beginScreenDrawing()
public void beginScreenDrawing(PGraphics p)
AbstractScene.eye()
parameters. Don't forget to call endScreenDrawing(PGraphics)
after screen
drawing ends.endScreenDrawing(PGraphics)
,
beginScreenDrawing()
public void endScreenDrawing()
endScreenDrawing
in class AbstractScene
MatrixHelper.endScreenDrawing()
public void endScreenDrawing(PGraphics p)
AbstractScene.eye()
parameters. The screen drawing should happen between
beginScreenDrawing(PGraphics)
and this method.beginScreenDrawing(PGraphics)
,
endScreenDrawing()
public void drawCylinder(float w, float h)
AbstractScene
w
and height h
, along the positive
z
axis.drawCylinder
in class AbstractScene
public void drawCylinder(PGraphics pg)
drawCylinder(pg, radius()/6, radius()/3)
.
Note that this method is useful for
InteractiveFrame.setShape(String)
.
public static void drawCylinder(PGraphics pg, float w, float h)
drawCylinder(float, float)
.
Calls drawCylinder(float, float)
on pg
.
public void drawHollowCylinder(int detail, float w, float h, Vec m, Vec n)
AbstractScene
m
and
n
), along the Camera positive z
axis.drawHollowCylinder
in class AbstractScene
w
- radius of the cylinder and h is its heighth
- height of the cylinderm
- normal of the plane that intersects the cylinder at z=0n
- normal of the plane that intersects the cylinder at z=hAbstractScene.drawCylinder(float, float)
public static void drawHollowCylinder(PGraphics pg, int detail, float w, float h, Vec m, Vec n)
drawHollowCylinder(int, float, float, Vec, Vec)
.
Calls drawHollowCylinder(int, float, float, Vec, Vec)
on pg
.
public void drawCone(int detail, float x, float y, float r, float h)
AbstractScene
z
axis, with its base centered at
(x,y)
, height h
, and radius r
.drawCone
in class AbstractScene
AbstractScene.drawCone(int, float, float, float, float, float)
public static void drawCone(PGraphics pg, int det, float r, float h)
cone(pg, det, 0, 0, r, h);
public static void drawCone(PGraphics pg, float r, float h)
cone(pg, 12, 0, 0, r, h);
public void drawCone(PGraphics pg)
drawCone(pg, 12, 0, 0, radius()/4, sqrt(3) * radius()/4)
.
Note that this method is useful for
InteractiveFrame.setShape(String)
.
public static void drawCone(PGraphics pg, int detail, float x, float y, float r, float h)
drawCone(int, float, float, float, float)
.
Calls drawCone(int, float, float, float, float)
on pg
.
public static void drawCone(PGraphics pg, int det, float r1, float r2, float h)
cone(pg, det, 0, 0, r1, r2, h)
public static void drawCone(PGraphics pg, float r1, float r2, float h)
cone(pg, 18, 0, 0, r1, r2, h);
public void drawCone(int detail, float x, float y, float r1, float r2, float h)
AbstractScene
z
axis, with its base centered at
(x,y)
, height h
, and radii r1
and r2
(basis and
height respectively).drawCone
in class AbstractScene
AbstractScene.drawCone(int, float, float, float, float)
public static void drawCone(PGraphics pg, int detail, float x, float y, float r1, float r2, float h)
drawCone(int, float, float, float, float, float)
.
Calls drawCone(int, float, float, float, float, float)
on pg
.
public void drawAxes(float length)
AbstractScene
length
which origin correspond to the world coordinate
system origin.drawAxes
in class AbstractScene
AbstractScene.drawGrid(float, int)
public void drawAxes(PGraphics pg)
drawAxes(pg, radius()/5)
.
Note that this method is useful for
InteractiveFrame.setShape(String)
.
public void drawAxes(PGraphics pg, float length)
drawAxes(float)
.
Calls drawAxes(float)
on pg
.
public void drawGrid(float size, int nbSubdivisions)
AbstractScene
size
and nbSubdivisions
define its geometry.
drawGrid
in class AbstractScene
AbstractScene.drawAxes(float)
public void drawGrid(float size)
drawGrid(size, 10)
.drawGrid
in class AbstractScene
AbstractScene.drawGrid(float, int)
public void drawGrid(PGraphics pg)
drawGrid(pg, radius()/4, 10)
.
Note that this method is useful for
InteractiveFrame.setShape(String)
.
public void drawGrid(PGraphics pg, float size, int nbSubdivisions)
drawGrid(float)
.
Calls drawGrid(float)
on pg
.
public void drawDottedGrid(float size, int nbSubdivisions)
AbstractScene
size
and nbSubdivisions
define its geometry.
drawDottedGrid
in class AbstractScene
AbstractScene.drawAxes(float)
public void drawDottedGrid(PGraphics pg)
drawDottedGrid(pg, radius()/4, 10)
.
Note that this method is useful for
InteractiveFrame.setShape(String)
.
public void drawDottedGrid(PGraphics pg, float size, int nbSubdivisions)
drawDottedGrid(float, int)
.
Calls drawDottedGrid(float, int)
on pg
.
public void drawEye(Eye eye)
AbstractScene
eye
in the scene.
The near and far planes are drawn as quads, the frustum is drawn using lines and the camera up vector is represented by an arrow to disambiguate the drawing.
Note: The drawing of a Scene's own Scene.camera() should not be visible, but may create artifacts due to numerical imprecisions.
drawEye
in class AbstractScene
public void drawEye(Eye eye, boolean texture)
eye.frame()
transformation and then calls
drawEye(PGraphics, Eye, boolean)
on the scene pg()
. If
texture
draws the projected scene on the near plane.public void drawEye(PGraphics pg, Eye eye)
drawEye(pg, eye, false)
.drawEye(PGraphics, Eye, boolean)
public void drawEye(PGraphics pg, Eye eye, boolean texture)
drawEye(Eye)
. If texture
draws the projected scene
on the near plane.
Warning: texture only works with opengl renderers.
Note that if eye.scene()).pg() == pg
this method has not effect at all.
public void drawEyeNearPlane(Eye eye)
public void drawEyeNearPlane(Eye eye, boolean texture)
eye.frame()
transformation and then calls
drawEye(PGraphics, Eye, boolean)
on the scene pg()
. If
texture
draws the projected scene on the near plane.public void drawEyeNearPlane(PGraphics pg, Eye eye)
drawEyeNearPlane(pg, eye, false)
.public void drawEyeNearPlane(PGraphics pg, Eye eye, boolean texture)
texture
draws the projected scene on the plane.
Warning: texture only works with opengl renderers.
Note that if eye.scene()).pg() == pg
this method has not effect at all.
public void drawProjector(Eye eye, Vec src)
drawProjector(PGraphics, Eye, Vec)
on the scene pg()
.
Since this method uses the eye origin and zNear plane to draw the other end of the
projector it should be used in conjunction with drawEye(PGraphics, Eye)
.
public void drawProjector(PGraphics pg, Eye eye, Vec src)
src
(given in the world
coordinate system) onto the near plane.
Since this method uses the eye origin and zNear plane to draw the other end of the
projector it should be used in conjunction with
drawEye(PGraphics, Eye, boolean)
.
Note that if eye.scene()).pg() == pg
this method has not effect at all.
public void drawProjectors(Eye eye, List<Vec> src)
drawProjectors(PGraphics, Eye, List)
on the scene pg()
.
Since this method uses the eye origin and zNear plane to draw the other end of the
projector it should be used in conjunction with drawEye(PGraphics, Eye)
.
public void drawProjectors(PGraphics pg, Eye eye, List<Vec> src)
src
(all of
which should be given in the world coordinate system) onto the near plane.
Since this method uses the eye origin and zNear plane to draw the other end of the
projector it should be used in conjunction with
drawEye(PGraphics, Eye, boolean)
.
Note that if eye.scene()).pg() == pg
this method has not effect at all.
public void drawPath(KeyFrameInterpolator kfi, int mask, int nbFrames, float scale)
AbstractScene
KeyFrameInterpolator.frame()
mask
controls what is drawn: If ( (mask & 1) != 0 ), the position path is
drawn. If ( (mask & 2) != 0 ), a camera representation is regularly drawn and if
( (mask & 4) != 0 ), oriented axes are regularly drawn. Examples:
drawPath(); // Simply draws the interpolation path
drawPath(3); // Draws path and cameras
drawPath(5); // Draws path and axes
In the case where camera or axes are drawn, nbFrames
controls the number of
objects (axes or camera) drawn between two successive keyFrames. When
nbFrames = 1
, only the path KeyFrames are drawn. nbFrames = 2
also
draws the intermediate orientation, etc. The maximum value is 30. nbFrames
should divide 30 so that an object is drawn for each KeyFrame. Default value is 6.
scale
controls the scaling of the camera and axes drawing. A value of
AbstractScene.radius()
should give good results.
drawPath
in class AbstractScene
public void drawCross(float px, float py, float size)
AbstractScene
(px, py)
, and edge of size
size
.drawCross
in class AbstractScene
AbstractScene.drawAnchorHint()
public void drawCross(PGraphics pg, float px, float py, float size)
public void drawFilledCircle(int subdivisions, Vec center, float radius)
AbstractScene
drawFilledCircle
in class AbstractScene
subdivisions
- Number of triangles approximating the circle.center
- Circle screen center.radius
- Circle screen radius.public void drawFilledCircle(PGraphics pg, int subdivisions, Vec center, float radius)
public void drawFilledSquare(Vec center, float edge)
AbstractScene
drawFilledSquare
in class AbstractScene
center
- Square screen center.edge
- Square edge length.public void drawShooterTarget(Vec center, float length)
AbstractScene
drawShooterTarget
in class AbstractScene
center
- Center of the target on the screenlength
- Length of the target in pixelspublic void drawPickingTarget(GenericFrame iFrame)
AbstractScene
GenericFrame.grabsInputThreshold()
pixels size.
Attention: the target is drawn either if the iFrame is part of camera path and
keyFrame is true
, or if the iFrame is not part of camera path and keyFrame is
false
.
drawPickingTarget
in class AbstractScene
public void drawTorusSolenoid(int faces, int detail, float insideRadius, float outsideRadius)
drawTorusSolenoid
in class AbstractScene
public static void drawTorusSolenoid(PGraphics pg)
drawTorusSolenoid(pg, 6)
.public static void drawTorusSolenoid(PGraphics pg, float insideRadius)
drawTorusSolenoid(pg, 6, insideRadius)
.public static void drawTorusSolenoid(PGraphics pg, int faces, float insideRadius)
drawTorusSolenoid(pg, faces, 100, insideRadius, insideRadius * 1.3f)
.public static void drawTorusSolenoid(PGraphics pg, int faces, int detail, float insideRadius, float outsideRadius)
public void performInteraction(BogusEvent event)
profile.handle(event)
.performInteraction
in interface Grabber
performInteraction
in class AbstractScene
Profile.handle(BogusEvent)
public void setKeyBinding(int vkey, String methodName)
setBinding(new KeyboardShortcut(vkey), methodName)
.setBinding(Shortcut, String)
public void setKeyBinding(char key, String methodName)
setBinding(new KeyboardShortcut(key), methodName)
.setBinding(Shortcut, String)
public void setKeyBinding(Object object, int vkey, String methodName)
setBinding(object, new KeyboardShortcut(vkey), methodName)
.setBinding(Object, Shortcut, String)
public void setKeyBinding(Object object, char key, String methodName)
setBinding(object, new KeyboardShortcut(key), methodName)
.setBinding(Object, Shortcut, String)
public boolean hasKeyBinding(int vkey)
return hasBinding(new KeyboardShortcut(vkey))
.hasBinding(Shortcut)
public boolean hasKeyBinding(char key)
return hasBinding(new KeyboardShortcut(key))
.hasBinding(Shortcut)
public void removeKeyBinding(int vkey)
removeBinding(new KeyboardShortcut(vkey))
.removeBinding(Shortcut)
public void removeKeyBinding(char key)
removeBinding(new KeyboardShortcut(key))
.removeBinding(Shortcut)
public void setKeyBinding(int mask, int vkey, String methodName)
setBinding(new KeyboardShortcut(mask, vkey), methodName)
.setBinding(Shortcut, String)
public void setKeyBinding(Object object, int mask, int vkey, String methodName)
setBinding(object, new KeyboardShortcut(mask, vkey), methodName)
.setBinding(Object, Shortcut, String)
public boolean hasKeyBinding(int mask, int vkey)
return hasBinding(new KeyboardShortcut(mask, vkey))
.hasBinding(Shortcut)
public void removeKeyBinding(int mask, int vkey)
removeBinding(new KeyboardShortcut(mask, vkey))
.removeBinding(Shortcut)
public void setKeyBinding(int mask, char key, String methodName)
setKeyBinding(mask, keyCode(key), methodName)
.setKeyBinding(int, int, String)
public void setKeyBinding(Object object, int mask, char key, String methodName)
setKeyBinding(object, mask, keyCode(key), methodName)
.setKeyBinding(Object, int, int, String)
public boolean hasKeyBinding(int mask, char key)
return hasKeyBinding(mask, keyCode(key))
.hasKeyBinding(int, int)
public void removeKeyBinding(int mask, char key)
removeKeyBinding(mask, keyCode(key))
.removeKeyBinding(int, int)
public void removeKeyBindings()
removeBindings(KeyboardShortcut.class)
.removeBindings(Class)
public void setDefaultKeyBindings()
removeKeyBindings()
and sets the default frame key bindings which may
be queried with info()
.public void setBinding(Shortcut shortcut, String action)
profile.setBinding(shortcut, action)
.
Low-level profile handling routine. Call this method to set a binding for a custom bogus event, like this:
scene.setBinding(new CustomShortcut(mask, CustomAgent.CUSTOM_ID), "customBehavior")
.
Profile.setBinding(Shortcut, String)
,
BogusEvent
,
Shortcut
public void setBinding(Object object, Shortcut shortcut, String action)
profile.setBinding(object, shortcut, action)
.
Low-level profile handling routine. Call this method to set a binding for a custom bogus event, like this:
scene.setBinding(object, new CustomShortcut(mask, CustomAgent.CUSTOM_ID), "customBehavior")
.
public void setBindings(Scene otherScene)
profile.set(otherScene.profile)
.Profile.set(Profile)
public boolean hasBinding(Shortcut shortcut)
return profile.hasBinding(shortcut)
.
Low-level profile handling routine. Call this method to query for a binding from a custom bogus event, like this:
scene.hasBinding(object, new CustomShortcut(mask, CustomAgent.CUSTOM_ID)
.
Profile.hasBinding(Shortcut)
,
BogusEvent
,
Shortcut
public void removeBinding(Shortcut shortcut)
profile.removeBinding(shortcut)
.
Low-level profile handling routine. Call this method to remove a binding for a custom bogus event, like this:
scene.removeBinding(new CustomShortcut(mask, CustomAgent.CUSTOM_ID)
.
Profile.removeBinding(Shortcut)
,
BogusEvent
,
Shortcut
public void removeBindings()
profile.removeBindings()
.Profile.removeBindings()
public void removeBindings(Class<? extends Shortcut> cls)
profile.removeBindings(cls)
.Profile.removeBindings(Class)
public String info(Class<? extends Shortcut> cls)
profile.info(cls)
.Profile.info(Class)
public String action(Shortcut shortcut)
return profile.action(key)
.Profile.action(Shortcut)
public boolean isActionBound(String action)
return profile.isActionBound(action)
.Profile.isActionBound(String)
Processing Library proscene by Jean Pierre Charalambos. (c) 2014-2017 National University of Colombia