Class Fox::FXGLViewer

In: | FXGLViewer.rb
Parent: | FXGLCanvas

Canvas, an area drawn by another object

### Events

The following messages are sent by FXGLViewer to its message target:

### FXGLViewer options

`VIEWER_LOCKED`: | Mouse based view manipulation is locked
`VIEWER_LIGHTING`: | Lighting is on
`VIEWER_FOG`: | Fog mode on
`VIEWER_DITHER`: | Dithering

### Projection modes (class constants)

`PARALLEL`: | Parallel projection
`PERSPECTIVE`: | Perspective projection

### Message identifiers

`ID_PERSPECTIVE`: | x
`ID_PARALLEL`: | x
`ID_FRONT`: | x
`ID_BACK`: | x
`ID_LEFT`: | x
`ID_RIGHT`: | x
`ID_TOP`: | x
`ID_BOTTOM`: | x
`ID_RESETVIEW`: | x
`ID_FITVIEW`: | x
`ID_TIPTIMER`: | x
`ID_BACK_COLOR`: | x
`ID_AMBIENT_COLOR`: | x
`ID_LIGHT_AMBIENT`: | x
`ID_LIGHT_DIFFUSE`: | x
`ID_LIGHT_SPECULAR`: | x
`ID_LIGHTING`: | x
`ID_TURBO`: | x
`ID_FOG`: | x
`ID_DITHER`: | x
`ID_SCALE_X`: | x
`ID_SCALE_Y`: | x
`ID_SCALE_Z`: | x
`ID_DIAL_X`: | x
`ID_DIAL_Y`: | x
`ID_DIAL_Z`: | x
`ID_ROLL`: | x
`ID_PITCH`: | x
`ID_YAW`: | x
`ID_FOV`: | x
`ID_ZOOM`: | x
`ID_LOCK`: | x
`ID_CUT_SEL`: | x
`ID_COPY_SEL`: | x
`ID_PASTE_SEL`: | x
`ID_DELETE_SEL`: | x
`ID_PRINT_IMAGE`: | x
`ID_PRINT_VECTOR`: | x
`ID_LASSO_ZOOM`: | x
`ID_LASSO_SELECT`: | x

Methods

doesTurbo? eyeToScreen eyeToWorld fitToBounds getBoreVector lasso locked? new new objectType objectTypeName readFeedback readPixels screenToEye screenToTarget setBounds translate turboMode? worldToEye worldToEyeZ worldVector

Attributes

ambientColor | [RW] | Global ambient light color [FXHVec]
backgroundColor | [RW] | Window background color [FXHVec]
center | [RW] | Object center [FXVec]
distance | [RW] | Target point distance [Float]
eyePosition | [R] | Eye position [FXVec]
eyeVector | [R] | Eyesight vector [FXVec]
fieldOfView | [RW] | Camera field of view angle (in degrees) [Float]
helpText | [RW] | Status line help text [String]
invTransform | [R] | The inverse of the current transformation matrix [FXHMat]
light | [RW] | Light source settings [FXLight]
material | [RW] | Default object material setting [FXMaterial]
maxHits | [RW] | The maximum hits, i.e. the maximum size of the pick buffer [Integer]. When less than or equal to zero, picking is essentially turned off.
modelPix | [R] | Size of pixel in model coordinates [Float]
offset | [RW] | Line offset [Float]
orientation | [RW] | Camera orientation [FXQuat]
projection | [RW] | The projection mode (either +FXGLViewer::PERSPECTIVE+ or +FXGLViewer::PARALLEL+)
scale | [RW] | Current scaling factors [FXVec]
scene | [RW] | The current scene object [FXGLObject]
selection | [RW] | The selection [FXGLObject]
tipText | [RW] | Tool tip text [String]
transform | [R] | The current transformation matrix [FXHMat]
turboMode | [W] | Set turbo mode [Boolean]
viewLock | [W] | Indicates whether the viewer is locked (i.e. mouse-based viewing operations are prevented) [Boolean]
viewport | [R] | The viewport for this viewer [FXViewport]
worldPix | [R] | Size of pixel in world coordinates [Float]
zoom | [RW] | Camera zoom factor [Float]

Public Class methods

objectType()

Returns the FXDragType for FXGLObject

objectTypeName()

Returns the drag type name

new(p, vis, tgt=nil, sel=0, opts=0, x=0, y=0, w=0, h=0) {|theGLViewer| ...}

Construct GL viewer widget

new(p, vis, sharegroup, tgt=nil, sel=0, opts=0, x=0, y=0, w=0, h=0) {|theGLViewer| ...}

Construct GL viewer widget sharing display list with another GL viewer

Public Instance methods

lasso(x1, y1, x2, y2)

Return an array of all objects in the given rectangle

setBounds(box)

Change the model bounding box; this adjusts the viewer

fitToBounds(box)

Fit viewer to the given bounding box

eyeToScreen(e)

Translate eye-coordinate to screen coordinate. Returns a 2-element array [sx, sy] containing the screen coordinate.

screenToEye(sx, sy, eyez=0.0)

Translate screen coordinate to eye coordinate at the given depth.

screenToTarget(sx, sy)

Translate screen coordinate to eye coordinate at the target point depth

worldToEye(w)

Translate world coordinate to eye coordinate

worldToEyeZ(w)

Translate world coordinate to eye coordinate depth

eyeToWorld(e)

Translate eye coordinate to eye coordinate

worldVector(fx, fy, tx, ty)

Calculate world coordinate vector from screen movement

translate(vec)

Translate object center

getBoreVector(sx, sy)

Return boresight vector (an array of two arrays)

locked?()

Returns `true` if the viewer is locked

readPixels(x, y, w, h)

Read the pixels off the screen as R,G,B tuples.

readFeedback(x, y, w, h)

Read the feedback buffer containing the current scene.

doesTurbo?()

When drawing a GL object, if doesTurbo? returns `true`, the object may choose to perform a reduced complexity drawing as the user is interactively manipulating; another update will be done later when the full complexity drawing can be performed again.

turboMode?()

Returns `true` if turbo mode is enabled