Augmenter Class

Header: #include "easyar/augmenter.hpp"

Inherits: RefBase

Description

An Augmenter is a renderer that gets a frame from trackers and render the camera image as background in AR scenes. It is generally used in the rendering thread.

Public Types

enum API{kAugmenterAPIDefault, kAugmenterAPINONE, kAugmenterAPIGLES2, kAugmenterAPIGL, kAugmenterAPID3D9, kAugmenterAPID3D11}

Public Functions

Augmenter()
virtual ~Augmenter()
void chooseAPI(API api = kAugmenterAPIDefault, void* device = 0)
Frame newFrame(const ImageTracker& obj) (until 1.2.1)
Frame newFrame(const BarCodeScanner& obj) (until 1.2.1)
Frame newFrame() (since 1.3.0)
virtual bool attachCamera(const CameraDevice& obj) (since 1.3.0)
virtual bool detachCamera(const CameraDevice& obj) (since 1.3.0)
void setViewPort(const Vec4I& viewport)
Vec4I viewPort() const
bool drawVideoBackground()
Vec2I videoBackgroundTextureSize()
PixelFormat videoBackgroundTextureFormat()
void setVideoBackgroundTextureID(int id)
void setVideoBackgroundTextureID(void* id)
int id() const

enum Augmenter::API

Constant

Value

Description

kAugmenterAPIDefault

0

The default API.

kAugmenterAPINONE

1

The empty API.

kAugmenterAPIGLES2

2

OpenGL ES 2.

kAugmenterAPIGL

3

Desktop OpenGL.

kAugmenterAPID3D9

4

Direct3D9.

kAugmenterAPID3D11

5

Direct3D11.

Augmenter()

Creates a Augmenter object.

virtual ~Augmenter()

Destroys the Augmenter object.

void chooseAPI(API api = kAugmenterAPIDefault, void* device = 0)

Choose graphics API. Generally there is no need to call this function manually.

Frame newFrame(const ImageTracker& obj) (until 1.2.1)

Gets a new frame from ImageTracker.

Frame newFrame(const BarCodeScanner& obj) (until 1.2.1)

Gets a new frame from BarCodeScanner.

Frame newFrame() (since 1.3.0)

Gets a new frame. An CameraDevice must be attached before getting a valid frame.

virtual bool attachCamera(const CameraDevice& obj) (since 1.3.0)

Attach CameraDevice to the Augmenter. Frame from newFrame will be empty if no CameraDevice has been attached.

virtual bool detachCamera(const CameraDevice& obj) (since 1.3.0)

Detach CameraDevice from the Augmenter.

void setViewPort(const Vec4I& viewport)

Sets the viewport of camera image draw. A view port is a Vec4I data like the four input parameters in glViewPort {left, top, width, height}.

When a texture is set via setVideoBackgroundTextureID, the max viewport size that contains image data can be retrived by videoBackgroundTextureSize and the max size will be used if viewport size is zero.

Vec4I viewPort() const

Gets current viewport.

bool drawVideoBackground()

Draws current camera image as background. It will draw the image to the current context when no texture is set. After a texture is set via setVideoBackgroundTextureID, it will draw to the texture. This function should be called in each frame if a camera background is needed.

Vec2I videoBackgroundTextureSize()

Gets current background camera image size. This size may change if CameraDevice size changed. If current frame is not available, {0, 0} will be returned.

PixelFormat videoBackgroundTextureFormat()

Gets current background camera image format. If current frame is not available, kPixelFormatUnknown will be returned.

void setVideoBackgroundTextureID(int id)

Sets texture id. If a valid id is set, the texture will be updated after a drawVideoBackground call. If id equals 0, it will clear previously set value and drawVideoBackground will draw based on the current context settings and not draw to texture.

void setVideoBackgroundTextureID(void* id)

Sets texture id, id is used by value. If a valid id is set, the texture will be updated after a drawVideoBackground call. If id equals 0, it will clear previously set value and drawVideoBackground will draw based on the current context settings and not draw to texture.

int id() const

Returns the Augmenter id.