Public Member Functions | Properties

CC3DeviceCameraOverlayUIViewController Class Reference

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

#import <CC3UIViewController.h>

Inheritance diagram for CC3DeviceCameraOverlayUIViewController:
Inheritance graph
[legend]
Collaboration diagram for CC3DeviceCameraOverlayUIViewController:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(void) - didChangeIsOverlayingDeviceCamera
(UIImagePickerController *) - newDeviceCameraPicker
(void) - willChangeIsOverlayingDeviceCamera

Properties

BOOL isDeviceCameraAvailable
BOOL isOverlayingDeviceCamera: 1
UIImagePickerController * picker

Detailed Description

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


Member Function Documentation

- (void) didChangeIsOverlayingDeviceCamera

Invoked automatically just after the isOverlayingDeviceCamera property has been changed, and after the picker has been modally presented or dismissed.

The isOverlayingDeviceCamera property has the new value when this call is made. Default does nothing. Subclasses can override

- (UIImagePickerController*) newDeviceCameraPicker

If the device supports a camera, returns a newly allocated and initialized UIImagePickerController, suitable for use in overlaying the EAGLView underlying the CCNode on top of the device camera image.

Returns nil if the device does not suport a camera. It is the responsibility of the caller to manage the releasing of the returned picker.

This method is automatically called when the picker property is first accessed. It should not be called directly otherwise. Subclasses can override this method to modify the characteristics of the returned picker.

- (void) willChangeIsOverlayingDeviceCamera

Invoked automatically just before the isOverlayingDeviceCamera property is about to be changed, and before the picker has been modally presented or dismissed.

The isOverlayingDeviceCamera property still has the old value when this call is made. Default does nothing. Subclasses can override


Property Documentation

- (BOOL) isDeviceCameraAvailable [read, assign]

Indicates whether this device supports a camera.

- (BOOL) isOverlayingDeviceCamera [read, write, assign]

Controls whether the controlled CCNode is overlaying the view of the device camera.

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 the underlying UIView to combine the 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. Typically, the frame rate while overlaying the camera (more precisely, while the underlying UIView has a clear background color) will typically be capped at about 40 fps.

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 the CCNode is currently running, it is sent an onExit message to cause it to stop running, clean up any active actions, and reset its touch event handling. CCNode subclasses can also override onExit to perform other activities associated with cleaning up prior to the overlay changing.
  • This controller is sent a willChangeIsOverlayingDeviceCamera message.
  • The isOverlayingDeviceCamera property of this controller is changed.
  • If the isOverlayingDeviceCamera property is being set to YES, the picker UIImagePickerController is presented modally. If the isOverlayingDeviceCamera property is being set to NO, the modal picker UIImagePickerController is dismissed.
  • This controller is sent a didChangeIsOverlayingDeviceCamera message.
  • If the CCNode 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. CCNode subclasses can also override onEnter to perform other activities associated with adjusting their world following the overlay changing (such as hiding or showing child CCNodes based on whether or not the device camera is now overlayed.

The value of this property is initially set to NO.

- (UIImagePickerController *) picker [read, assign]

The UIImagePickerController instance that this controller uses to overlay the CCNode on the device camera image.

This property will always return nil if the device does not support a camera.


The documentation for this class was generated from the following file: