Inherits from CC3COUIVC_SUPERCLASS
Declared in CC3DeviceCameraOverlayUIViewController.h

Overview

A CC3UIViewController that adds the ability to display the 3D scene as an overlay on a background generated by the device camera.

Properties

deviceCameraView

Returns the view being used to display the device camera behind the 3D scene, lazily creating if if necessary, or returns nil if the device does not support a camera.

@property (nonatomic, retain, readonly) CC3AVCameraView *deviceCameraView

Declared In

CC3DeviceCameraOverlayUIViewController.h

isDeviceCameraAvailable

Indicates whether this device supports a camera.

@property (nonatomic, readonly) BOOL isDeviceCameraAvailable

Declared In

CC3DeviceCameraOverlayUIViewController.h

isOverlayingDeviceCamera

Controls whether the OpenGL scene is overlaying the view of the device camera.

@property (nonatomic, assign, readwrite) BOOL isOverlayingDeviceCamera

Discussion

This property can only be set to YES if a camera is actually available on the device.

If the device supports a camera, setting this property to YES will cause the controller to immediately open a view of the device camera and overlay the CCNode view on top of the device camera view.

Setting this property to NO will cause the controller to close the device camera (if it was open) and display the CCNode without the camera background.

This property should only be set once the view has been added to the window and the window has been keyed and made visible.

Displaying the scene overlaying the device camera requires combining two graphic scenes. This is not without a performance cost, and you should expect to see a drop in animation frame rate as a result.

Converting back and forth between the device camera overlay and a normal view is not a trivial activity. The simple act of changing this property causes the following sequence of actions:

  • If a scene is running, it is sent an onExit message to cause it to stop running, clean up any active actions, and reset its touch event handling.

  • This controller is sent a willChangeIsOverlayingDeviceCamera message.

  • The isOverlayingDeviceCamera property of this controller is changed.

  • If this property is being set to YES, the CC3AVCameraView instance in the deviceCameraView property is added to the window behind the view of this controller. If this property is being set to NO, the CC3AVCameraView instance is removed from the window.

  • This controller is sent a didChangeIsOverlayingDeviceCamera message.

  • If a scene was running, it is sent an onEnter message to cause it to restart, be ready for actions, and, in the case of CCLayers, re-register for touch events.

The value of this property is initially set to NO.

Declared In

CC3DeviceCameraOverlayUIViewController.h

Instance Methods

didChangeIsOverlayingDeviceCamera

Invoked automatically just after the isOverlayingDeviceCamera property has been changed, and after the deviceCameraView has been added to or removed from the window. The isOverlayingDeviceCamera property has the new value when this call is made. Default does nothing. Subclasses can override

- (void)didChangeIsOverlayingDeviceCamera

Declared In

CC3DeviceCameraOverlayUIViewController.h

willChangeIsOverlayingDeviceCamera

Invoked automatically just before the isOverlayingDeviceCamera property is about to be changed, and before the deviceCameraView has been added to or removed from the window. The isOverlayingDeviceCamera property still has the old value when this call is made. Default does nothing. Subclasses can override

- (void)willChangeIsOverlayingDeviceCamera

Declared In

CC3DeviceCameraOverlayUIViewController.h