-
Notifications
You must be signed in to change notification settings - Fork 26
Camera
extends SceneNode wraps http://omegalib.googlecode.com/svn/refdocs/trunk/html/classomega_1_1_camera.html[Camera]
Last revision: ver. 8.0.2 - 6 August 2015
Controls the applications camera (accessed through getDefaultCamera()
or additional cameras in the application.
|=====================
|Method(s)| Description
|setEnabled(bool enabled)
bool isEnabled()
|
When set to disabled, the camera will not draw new frames.
|setPitchYawRoll(Vector3 value)
|
Sets the camera orientation as yaw, pitch roll in radians. value
is a
Vector3. For example, to rotate 45 degrees around the global Y axis:
camera.setPitchYawRoll(Vector3(0, radians(45), 0))
|Vector3 getHeadOffset()
, setHeadOffset(Vector3 value)
|
Gets or sets the relative offset of the observer head, relative to the camera
position. The head offset in conjunction with the head orientation and eye
separation to compute the camera projection frustum. The head offset is a Vector3.
|setEyeSeparation(float value)
, float getEyeSeparation()
|
Gets or sets the eye separation for stereo rendering.
|setHeadOrientation(Quaternion value)
, Quaternion getHeadOrientation()
|
Gets or sets the head orientation relative to the camera orientation. The
orientation value is a Quaternion.
|focusOn(SceneNode node)
|
Moves and orients the camera to center the specified SceneNode in the field
of view.
|int getCameraId()
|
Gets the unique id of this camera.
|float getNearZ()
float getFarZ()
setNearFarZ(float near, float far)
|
Gets or sets the near and far Z clipping planes for this camera.
|Tracking and Navigation |
|bool isTrackingEnabled()
, setTrackingEnabled(bool value)
|
|int getTrackerSourceId()
, setTrackerSourceId(int value)
|
|setControllerEnabled(bool value)
, bool isControllerEnabled()
|
|CameraController getController()
|
Gets the CameraController used to handle this camera navigation.
|View Management |
|DisplayTileConfig getCustomTileConfig()
|
Gets the custom rendering configuration for this camera (see DisplayTileConfig).
Cameras usually render using the tile configuration of the physical tile they
are rendering to. Setting this display tile configuration to enabled will cause
the camera to render using these custom settings instead.
|Vector2 getViewPosition()
setViewPosition(float x, float y)
|
experimental
|Vector2 getViewSize()
setViewSize(float x, float y)
|
experimental
| bool isSceneEnabled()
setSceneEnabled(bool enabled)
|
When set to true, will draw all 3D scene render passes for this camera. Set to
true by default.
| bool isOverlayEnabled()
setOverlayEnabled(bool enabled)
|
When set to true, will draw all 2D overlay render passes for this camera. Set to
true by default.
|(v8.0.2) bool isCullingEnabled()
, setCullingEnabled(bool enabled)
|
When set to false, disables all culling for this camera. All drawables will
attempt drawing, even the ones that are outside of this camera frustum. This
is useful to force drawing of all objects when we want to use vertex shaders
with custom projections. By default, culling is enabled.
|(5.2) CameraOutput getOutput([int contextId])
|
Returns the camera output (see CameraOutput), optionally specifying the
output context when rendering on multiple contexts.
|Clear Color / Depth (6.0) |
|setBackgroundColor(Color c)
, Color getBackgroundColor()
|
Gets or sets the background color used to clear the frame buffer (see Color)
|clearColor(bool enabled)
, bool isClearColorEnabled()
|
Enables or checks the state of color buffer clearing (using the color specified
in setBackgroundColor
)
|clearDepth(bool enabled)
, bool isClearDepthEnabled()
|
Enables or checks the state of depth buffer clearing
|=====================
These global functions are used to manage cameras.
Returns the main omegalib camera instance
Finds a camera by name
Finds a camera by id. Each camera created by an application has a unique id. When a camera gets destroyed its id will not get recycled.
Finds a camera by name, or creates it if no camera with the specified name exists.
NOTE: For new cameras, overlay rendering will be disabled by default, since this is typically the desired behavior. To control scene and/or overlay rendering for the camera, use the camera setOverlayEnabled
and setSceneEnabled
methods.
Deletes a secondary camera. NOTE: The default camera cannot be deleted.
Sets the camera attached to the specified tile (by name). The tile names can be obtained using the getTiles()
function. If a camera with the specified name does not exist, it will be created.
Sets the near and far clip planes for the default camera
Gets the near clip plane for the default camera
Gets the far clip plane for the default camera
NOTE: This example makes use of the cyclops module. Make sure you have it installed to use this.
box = BoxShape.create(0.8, 0.8, 0.8)
box.setPosition(Vector3(0, 2, -3))
# Apply an emissive textured effect (no lighting)
box.setEffect("textured -v emissive -d cyclops/test/omega-transparent.png")
# Spin the box!
def onUpdate(frame, t, dt):
box.pitch(dt)
box.yaw(dt / 3)
setUpdateFunction(onUpdate)
def createSecondaryCameraWindow(id, windowName, width, height, x, y):
# create second camera
cam = getOrCreateCamera(id)
cam.setHeadOffset(Vector3(0, 2, 0))
coutput = PixelData.create(width,height,PixelFormat.FormatRgba)
cam.getOutput(0).setReadbackTarget(coutput)
cam.getOutput(0).setEnabled(True)
# create a movable window displaying the output of the second camera.
uim = UiModule.createAndInitialize()
container = Container.create(ContainerLayout.LayoutVertical, uim.getUi())
container.setStyleValue('fill', 'black')
container.setPosition(Vector2(x, y))
container.setAlpha(1)
titleBar = Label.create(container)
titleBar.setText(windowName)
titleBar.setPinned(True)
titleBar.setDraggable(True)
titleBar.setVisible(True)
titleBar.setAutosize(False)
titleBar.setStyleValue('fill', '#000000ff')
titleBar.setHeight(24)
img = Image.create(container)
img.setData(coutput)
return cam
# create two secondary camera windows
createSecondaryCameraWindow('c1', 'Camera 1', 250, 250, 5, 25)
createSecondaryCameraWindow('c2', 'Camera 2 (custom render)', 250, 250, 270, 25)