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>
Public Member Functions | |
(void) | - didChangeIsOverlayingDeviceCamera |
(UIImagePickerController *) | - newDeviceCameraPicker |
(void) | - willChangeIsOverlayingDeviceCamera |
Properties | |
BOOL | isDeviceCameraAvailable |
BOOL | isOverlayingDeviceCamera: 1 |
UIImagePickerController * | picker |
CC3AugmentedRealityUIViewController is a CC3UIViewController that adds the ability to display the 3D scene as an overlay on a background generated by the device camera.
- (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
- (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:
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.