diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..723ef36 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4d3daa2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: +- '4.4' diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6f918f6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2016 Matthew Rayner + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index a5a9d4e..75ca660 100644 --- a/README.md +++ b/README.md @@ -1 +1,34 @@ -# Cordova Vuforia SDK Plugin +# ![Cordova-Plugin-Vuforia-SDK][logo] +Cordova Vuforia SDK plugin is designed to inject the Vuforia SDK into any Cordova project. It was specifically created to be used with [Cordova-Plugin-Vuforia][cordova-plugin-vuforia]. + +[![NPM Version][shield-npm]][info-npm] +[![Build Status][shield-travis]][info-travis] +[![License][shield-license]][info-license] + +## Note +This 'plugin' simply a way of injecting the Vuforia SDK code into a Cordova project. It offers no JavaScript interface or additional functionality. + +## Contributing +If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review. + +1. Clone it +2. Create your feature branch (git checkout -b my-new-feature) +3. Commit your changes (git commit -am 'Add some feature') +4. Push to the branch (git push origin my-new-feature) +5. Create a new Pull Request + +## License +Cordova-Plugin-Vuforia-SDK is licensed under the [MIT License][info-license]. + + +[logo]: https://cdn.rawgit.com/mattrayner/cordova-plugin-vuforia-sdk/cf3e9a58f18e2eabf2a6b9a91c75fadd1cf0a118/docs/logo.svg + +[info-npm]: https://www.npmjs.com/package/cordova-plugin-vuforia-sdk +[info-travis]: https://travis-ci.org/mattrayner/cordova-plugin-vuforia-sdk +[info-license]: LICENSE + +[shield-npm]: https://img.shields.io/npm/v/cordova-plugin-vuforia-sdk.svg +[shield-travis]: https://img.shields.io/travis/mattrayner/cordova-plugin-vuforia-sdk.svg +[shield-license]: https://img.shields.io/badge/license-MIT-blue.svg + +[cordova-plugin-vuforia]: https://github.com/mattrayner/cordova-plugin-vuforia \ No newline at end of file diff --git a/hooks/AfterPluginInstall.js b/hooks/AfterPluginInstall.js new file mode 100644 index 0000000..9c7c11a --- /dev/null +++ b/hooks/AfterPluginInstall.js @@ -0,0 +1,73 @@ +#!/usr/bin/env node +'use strict'; + +module.exports = function(context) { + + let cwd = process.cwd(); + let fs = require('fs'); + let path = require('path'); + let hookData = require('./hook_data.json'); + + // Modify the xcconfig build path and pass the resulting file path to the addHeaderSearchPaths function. + const modifyBuildConfig = function() { + let xcConfigBuildFilePath = path.join(cwd, 'platforms', 'ios', 'cordova', 'build.xcconfig'); + + try { + let xcConfigBuildFileExists = fs.accessSync(xcConfigBuildFilePath); + } + catch(e) { + console.log('Could not locate build.xcconfig, you will need to set HEADER_SEARCH_PATHS manually'); + return; + } + + console.log(`xcConfigBuildFilePath: ${xcConfigBuildFilePath}`); + + addHeaderSearchPaths(xcConfigBuildFilePath); + }; + + // Read the build config, add the correct Header Search Paths to the config before calling modifyAppDelegate. + const addHeaderSearchPaths = function(xcConfigBuildFilePath) { + let lines = fs.readFileSync(xcConfigBuildFilePath, 'utf8').split('\n'); + let paths = hookData.headerPaths; + + let headerSearchPathLineNumber; + + lines.forEach((l, i) => { + if (l.indexOf('HEADER_SEARCH_PATHS') > -1) { + headerSearchPathLineNumber = i; + } + }); + + if (headerSearchPathLineNumber) { + for(let actualPath of paths) { + if (lines[headerSearchPathLineNumber].indexOf(actualPath) == -1) { + lines[headerSearchPathLineNumber] += ` ${actualPath}`; + console.log(`${actualPath} was added to the search paths`); + } + else { + console.log(`${actualPath} was already setup in build.xcconfig`); + } + } + } + else { + lines[lines.length - 1] = 'HEADER_SEARCH_PATHS = '; + for(let actualPath of paths) { + lines[lines.length - 1] += actualPath; + } + } + + let newConfig = lines.join('\n'); + + fs.writeFile(xcConfigBuildFilePath, newConfig, function (err) { + if (err) { + console.log(`Error updating build.xcconfig: ${err}`); + return; + } + console.log('Successfully updated HEADER_SEARCH_PATHS in build.xcconfig'); + }); + + }; + + + modifyBuildConfig(); +}; \ No newline at end of file diff --git a/hooks/BeforePluginUninstall.js b/hooks/BeforePluginUninstall.js new file mode 100644 index 0000000..6579f8f --- /dev/null +++ b/hooks/BeforePluginUninstall.js @@ -0,0 +1,60 @@ +#!/usr/bin/env node +'use strict'; + +module.exports = function(context) { + let cwd = process.cwd(); + let fs = require('fs'); + let path = require('path'); + let hookData = require('./hook_data.json'); + + let xcConfigBuildFilePath = path.join(cwd, 'platforms', 'ios', 'cordova', 'build.xcconfig'); + + console.log('Vuforia BeforePluginUninstall.js, attempting to modify build.xcconfig'); + + try { + let xcConfigBuildFileExists = fs.accessSync(xcConfigBuildFilePath); + } + catch(e) { + console.log('Could not locate build.xcconfig.'); + return; + } + + console.log('xcConfigBuildFilePath: ', xcConfigBuildFilePath); + + let lines = fs.readFileSync(xcConfigBuildFilePath, 'utf8').split('\n'); + + let headerSearchPathLineNumber; + lines.forEach((l, i) => { + if (l.indexOf('HEADER_SEARCH_PATHS') > -1) { + headerSearchPathLineNumber = i; + } + }); + + if (!headerSearchPathLineNumber) { + console.log('build.xcconfig does not have HEADER_SEARCH_PATHS'); + return; + } + + + let paths = hookData.headerPaths; + + for(let actualPath of paths){ + if (lines[headerSearchPathLineNumber].indexOf(actualPath) === -1) { + console.log('build.xcconfig does not have header path for Instagram Assets Picker'); + continue; + } + let line = lines[headerSearchPathLineNumber]; + lines[headerSearchPathLineNumber] = line.replace(' '+actualPath, ''); + } + let newConfig = lines.join('\n'); + + fs.writeFile(xcConfigBuildFilePath, newConfig, function (err) { + if (err) { + console.log('error updating build.xcconfig, err: ', err); + return; + } + console.log('successfully updated HEADER_SEARCH_PATHS in build.xcconfig'); + }); + + +}; \ No newline at end of file diff --git a/hooks/hook_data.json b/hooks/hook_data.json new file mode 100644 index 0000000..86340eb --- /dev/null +++ b/hooks/hook_data.json @@ -0,0 +1,6 @@ +{ + "headerPaths": [ + "\"../../plugins/cordova-plugin-vuforia-sdk/src/vuforia/include\"", + "\"$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include\"" + ] +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..5650782 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "cordova-plugin-vuforia-sdk", + "version": "0.0.1", + "description": "A Cordova wrapper for the Vuforia SDK", + "repository": { + "type": "git", + "url": "git+https://github.com/mattrayner/cordova-plugin-vuforia-sdk.git" + }, + "cordova": { + "id": "cordova-plugin-vuforia-sdk", + "platforms": [ + "android", + "ios" + ] + }, + "keywords": [ + "cordova", + "vuforia", + "ecosystem:cordova", + "cordova-android", + "cordova-ios" + ], + "author": "Matt Rayner", + "license": "MIT", + "bugs": { + "url": "https://github.com/mattrayner/cordova-plugin-vuforia-sdk/issues" + }, + "homepage": "https://github.com/mattrayner/cordova-plugin-vuforia-sdk#readme" +} diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..7921576 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,64 @@ + + + + Vuforia SDK + Cordova Vuforia SDK Plugin + MIT + cordova,vuforia,sdk + git@github.com:mattrayner/cordova-plugin-vuforia-sdk.git + https://github.com/mattrayner/cordova-plugin-vuforia-sdk/issues + + Matthew Rayner + + + Cordova Vuforia SDK Plugin version 0.0.2, Copyright (C) 2016 Matthew Rayner + Cordova Vuforia SDK Plugin comes with ABSOLUTELY NO WARRANTY; see the + LICENSE file for more information. + This is free software, and you are welcome to redistribute it + under certain conditions; see the LICENSE file for more information. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/vuforia/Vuforia.jar b/src/vuforia/Vuforia.jar new file mode 100755 index 0000000..a76c574 Binary files /dev/null and b/src/vuforia/Vuforia.jar differ diff --git a/src/vuforia/include/QCAR/Area.h b/src/vuforia/include/QCAR/Area.h new file mode 100755 index 0000000..c3aed09 --- /dev/null +++ b/src/vuforia/include/QCAR/Area.h @@ -0,0 +1,43 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Area.h + +@brief + Header file for Area class. +===============================================================================*/ + +#ifndef _QCAR_AREA_H_ +#define _QCAR_AREA_H_ + +#include + +namespace QCAR +{ + +/// Area is the base class for 2D shapes used in Vuforia +class QCAR_API Area +{ +public: + enum TYPE { + RECTANGLE, + RECTANGLE_INT, + INVALID + }; + + virtual TYPE getType() const = 0; + + virtual ~Area(); + +private: + Area& operator=(const Area& other); +}; + +} // namespace QCAR + + +#endif // _QCAR_AREA_H_ diff --git a/src/vuforia/include/QCAR/Box3D.h b/src/vuforia/include/QCAR/Box3D.h new file mode 100755 index 0000000..a472b55 --- /dev/null +++ b/src/vuforia/include/QCAR/Box3D.h @@ -0,0 +1,53 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Box3D.h + +@brief + Header file for Box3D class. +===============================================================================*/ +#ifndef _QCAR_BOX3D_H_ +#define _QCAR_BOX3D_H_ + +#include +#include + +namespace QCAR +{ + +/// A Box3D represents an axis-aligned 3D box +class QCAR_API Box3D +{ +public: + + /// Constructor. + Box3D(); + + /// Copy constructor. + Box3D(const Box3D& other); + + /// Define a box by its minimum and maximum position. + Box3D(const Vec3F& nMinPos, const Vec3F& nMaxPos); + + /// Returns the minimum position of the box. + virtual const Vec3F& getMinimumPosition() const; + + /// Returns the maximum position of the box. + virtual const Vec3F& getMaximumPosition() const; + + virtual ~Box3D(); + +protected: + Vec3F minimumPosition; + Vec3F maximumPosition; +}; + + +} // namespace QCAR + + +#endif // _QCAR_BOX3D_H_ diff --git a/src/vuforia/include/QCAR/CameraCalibration.h b/src/vuforia/include/QCAR/CameraCalibration.h new file mode 100755 index 0000000..fce3fa2 --- /dev/null +++ b/src/vuforia/include/QCAR/CameraCalibration.h @@ -0,0 +1,46 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + CameraCalibration.h + +@brief + Header file for CameraCalibration class. +===============================================================================*/ +#ifndef _QCAR_CAMERACALIBRATION_H_ +#define _QCAR_CAMERACALIBRATION_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Holds intrinsic camera parameters +class QCAR_API CameraCalibration : private NonCopyable +{ +public: + /// Returns the resolution of the camera as 2D vector. + virtual Vec2F getSize() const = 0; + + /// Returns the focal length in x- and y-direction as 2D vector. + virtual Vec2F getFocalLength() const = 0; + + /// Returns the principal point as 2D vector. + virtual Vec2F getPrincipalPoint() const = 0; + + /// Returns the radial distortion as 4D vector. + virtual Vec4F getDistortionParameters() const = 0; + +protected: + + virtual ~CameraCalibration() {} +}; + +} // namespace QCAR + +#endif // _QCAR_CAMERACALIBRATION_H_ diff --git a/src/vuforia/include/QCAR/CameraDevice.h b/src/vuforia/include/QCAR/CameraDevice.h new file mode 100755 index 0000000..8a004ee --- /dev/null +++ b/src/vuforia/include/QCAR/CameraDevice.h @@ -0,0 +1,123 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + CameraDevice.h + +@brief + Header file for CameraDevice class. +===============================================================================*/ +#ifndef _QCAR_CAMERADEVICE_H_ +#define _QCAR_CAMERADEVICE_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +/// Implements access to the phone's built-in camera +class QCAR_API CameraDevice : private NonCopyable +{ +public: + enum MODE + { + MODE_DEFAULT = -1, ///< Default camera mode + MODE_OPTIMIZE_SPEED = -2, ///< Fast camera mode + MODE_OPTIMIZE_QUALITY = -3, ///< High-quality camera mode + }; + + enum FOCUS_MODE + { + FOCUS_MODE_NORMAL, ///< Default focus mode + FOCUS_MODE_TRIGGERAUTO, ///< Triggers a single autofocus operation + FOCUS_MODE_CONTINUOUSAUTO, ///< Continuous autofocus mode + FOCUS_MODE_INFINITY, ///< Focus set to infinity + FOCUS_MODE_MACRO ///< Macro mode for close-up focus + }; + + enum CAMERA + { + CAMERA_DEFAULT, ///< Default camera device. Usually BACK + CAMERA_BACK, ///< Rear facing camera + CAMERA_FRONT ///< Front facing camera + }; + + /// Returns the CameraDevice singleton instance. + static CameraDevice& getInstance(); + + /// Initializes the camera. + virtual bool init(CAMERA camera = CAMERA_DEFAULT) = 0; + + /// Deinitializes the camera. + /** + * Any resources created or used so far are released. Note that this + * function should not be called during the execution of the + * UpdateCallback and if so will return false. + */ + virtual bool deinit() = 0; + + /// Starts the camera. Frames are being delivered. + /** + * Depending on the type of the camera it may be necessary to perform + * configuration tasks before it can be started. + */ + virtual bool start() = 0; + + /// Stops the camera if video feed is not required (e.g. in non-AR mode + /// of an application). + virtual bool stop() = 0; + + /// Returns the number of available video modes. + /** + * This is device specific and can differ between mobile devices or operating + * system versions. + */ + virtual int getNumVideoModes() = 0; + + /// Returns the video mode currently selected. + /** + * If no video mode is set then Vuforia chooses a video mode. + */ + virtual VideoMode getVideoMode(int nIndex) = 0; + + /// Chooses a video mode out of the list of modes + /* + * This function can be only called after the camera device has been + * initialized but not started yet. Once you have started the camera and + * you need the select another video mode, you need to stop(), deinit(), + * then init() the camera before calling selectVideoMode() again. + */ + virtual bool selectVideoMode(int index) = 0; + + /// Provides read-only access to camera calibration data. + virtual const CameraCalibration& getCameraCalibration() const = 0; + + /// Enable/disable torch mode if the device supports it. + /** + * Returns true if the requested operation was successful, False + * otherwise. + */ + virtual bool setFlashTorchMode(bool on) = 0; + + /// Set the requested focus mode if the device supports it. + /** + * The allowed values are FOCUS_MODE_NORMAL, FOCUS_MODE_TRIGGERAUTO, + * FOCUS_MODE_CONTINUOUSAUTO, FOCUS_MODE_INFINITY, FOCUS_MODE_MACRO, + * though not all modes are supported on all devices. Returns true if + * the requested operation was successful, False otherwise. + * Also note that triggering a single autofocus event using + * FOCUS_MODE_TRIGGERAUTO may stop continuous autofocus if that focus + * mode was set earlier. + */ + virtual bool setFocusMode(int focusMode) = 0; +}; + +} // namespace QCAR + +#endif // _QCAR_CAMERADEVICE_H_ diff --git a/src/vuforia/include/QCAR/CylinderTarget.h b/src/vuforia/include/QCAR/CylinderTarget.h new file mode 100755 index 0000000..b5e121a --- /dev/null +++ b/src/vuforia/include/QCAR/CylinderTarget.h @@ -0,0 +1,68 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + CylinderTarget.h + +@brief + Header file for CylinderTarget class. +===============================================================================*/ +#ifndef _QCAR_CYLINDERTARGET_H_ +#define _QCAR_CYLINDERTARGET_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// A 3D trackable object of cylindrical or conical shape. +/** + * The CylinderTarget class exposes convenience functionality for setting the + * scene size of the object via any of its three defining geometric parameters: + * side length, top diameter and bottom diameter. + * The object is always scaled uniformly, so changing any of its parameters + * affects all others. + */ +class QCAR_API CylinderTarget : public ObjectTarget +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the side length of the cylinder target (in 3D scene units). + virtual float getSideLength() const = 0; + + /// Sets the side length of the cylinder target (in 3D scene units). + /** + * Note that the top and bottom diameter will be scaled accordingly. + */ + virtual bool setSideLength(float sideLength) = 0; + + /// Returns the top diameter of the cylinder target (in 3D scene units). + virtual float getTopDiameter() const = 0; + + /// Sets the top diameter of the cylinder target (in 3D scene units). + /** + * Note that the height and bottom diameter will be scaled accordingly. + */ + virtual bool setTopDiameter(float topDiameter) = 0; + + /// Returns the bottom diameter of the cylinder target (in 3D scene units). + virtual float getBottomDiameter() const = 0; + + /// Sets the bottom diameter of the cylinder target (in 3D scene units). + /** + * Note that the height and top diameter will be scaled accordingly. + */ + virtual bool setBottomDiameter(float bottomDiameter) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_CYLINDERTARGET_H_ diff --git a/src/vuforia/include/QCAR/CylinderTargetResult.h b/src/vuforia/include/QCAR/CylinderTargetResult.h new file mode 100755 index 0000000..a84ff44 --- /dev/null +++ b/src/vuforia/include/QCAR/CylinderTargetResult.h @@ -0,0 +1,37 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + CylinderTargetResult.h + +@brief + Header file for CylinderTargetResult class. +===============================================================================*/ +#ifndef _QCAR_CYLINDERTARGETRESULT_H_ +#define _QCAR_CYLINDERTARGETRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result for a CylinderTarget. +class QCAR_API CylinderTargetResult : public ObjectTargetResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const CylinderTarget& getTrackable() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_CYLINDERTARGETRESULT_H_ diff --git a/src/vuforia/include/QCAR/DataSet.h b/src/vuforia/include/QCAR/DataSet.h new file mode 100755 index 0000000..e5f4f3f --- /dev/null +++ b/src/vuforia/include/QCAR/DataSet.h @@ -0,0 +1,162 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + DataSet.h + +@brief + Header file for DataSet class. +===============================================================================*/ +#ifndef _QCAR_DATASET_H_ +#define _QCAR_DATASET_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +// Forward declarations: +class Trackable; +class MultiTarget; +class TrackableSource; + +/// A container of one or more trackables. +/** + * A dataset may contain multiple ImageTargets and MultiTargets. + * An empty DataSet instance is created using the DataSet factory function + * provided by the ObjectTracker class. The dataset is then loaded given a + * dataset XML and corresponding dataset DAT file. The dataset may be loaded + * from the storage locations defined below. Note that the root filename of the + * dataset DAT file and XML file must be the same. Once loaded the dataset can + * be activated using ObjectTracker::activateDataSet(). + * Methods to modify a DataSet must not be called while it is active. The + * DataSet must be deactivated first before reconfiguring it. + */ +class QCAR_API DataSet : private NonCopyable +{ +public: + + /// Deprecated enum, use QCAR::STORAGE_TYPE instead. + /// Types of storage locations for datasets + enum STORAGE_TYPE { + STORAGE_APP, ///< Storage private to the application + STORAGE_APPRESOURCE, ///< Storage for assets bundled with the + ///< application + STORAGE_ABSOLUTE ///< Helper type for specifying an absolute path + }; + + + /// Checks if the dataset exists at the specified path and storage location + /** + * Returns true if both the dataset XML and DAT file exist at the + * given storage location. The relative path to the dataset XML must be + * passed to this function for all storage locations other than + * STORAGE_ABSOLUTE. + */ + static bool exists(const char* path, QCAR::STORAGE_TYPE storageType); + + /// Checks if the dataset exists at the specified path and storage location + /** + * Returns true if both the dataset XML and DAT file exist at the + * given storage location. The relative path to the dataset XML must be + * passed to this function for all storage locations other than + * STORAGE_ABSOLUTE. + * + * This version is now deprecated, please use QCAR::STORAGE_TYPE based + * method instead. + */ + static bool exists(const char* path, STORAGE_TYPE storageType); + + /// Loads the dataset at the specified path and storage location + /** + * Returns true if the dataset was loaded successfully. After loading, + * individual Trackables can be accessed using getNumTrackables() and + * getTrackable(). The relative path to the dataset XML must be passed to + * this function for all storage locations other than STORAGE_ABSOLUTE. + * Note that loading a dataset may take significant time and therefore + * it is recommended to load datasets in the background. + * + * This version is now deprecated, please use QCAR::STORAGE_TYPE based + * method instead. + */ + virtual bool load(const char* path, STORAGE_TYPE storageType) = 0; + + /// Loads the dataset at the specified path and storage location + /** + * Returns true if the dataset was loaded successfully. After loading, + * individual Trackables can be accessed using getNumTrackables() and + * getTrackable(). The relative path to the dataset XML must be passed to + * this function for all storage locations other than STORAGE_ABSOLUTE. + * Note that loading a dataset may take significant time and therefore + * it is recommended to load datasets in the background. + */ + virtual bool load(const char* path, QCAR::STORAGE_TYPE storageType) = 0; + + /// Returns the overall number of 3D trackable objects in this data set. + /** + * Trackables that are part of other trackables (e.g. an ImageTarget that + * is part of a MultiTarget) is not counted here and not delivered + * by DataSet::getTrackable(). + */ + virtual int getNumTrackables() const = 0; + + /// Returns a pointer to a trackable object. + /** + * Trackables that are part of other trackables (e.g. an ImageTarget that + * is part of a MultiTarget) is not delivered by this method. + * Such trackables can be accesses via the trackable they are part of. + * E.g. use MultiTarget::getPart() to access the respective ImageTargets. + */ + virtual Trackable* getTrackable(int idx) = 0; + + /// Creates a new Trackable from the given TrackableSource and registers + /// it with the dataset + /** + * Use DataSet::destroy() to destroy the returned Trackable + * if it is no longer required. + * This method must not be called while the dataset is active or it will + * return NULL. + */ + virtual Trackable* createTrackable(const TrackableSource* source) = 0; + + /// Creates a new MultiTarget and registers it with the dataset + /** + * Use DataSet::destroy() to destroy the returned MultiTarget + * if it is no longer required. + * This method must not be called while the dataset is active or it will + * return NULL. + */ + virtual MultiTarget* createMultiTarget(const char* name) = 0; + + /// Destroys a Trackable + /** + * This method must not be called while the dataset is active or it will + * return false. + */ + virtual bool destroy(Trackable* trackable) = 0; + + /// Checks if this DataSet's Trackable capacity is reached. + /** + * Returns true if the number of Trackables created in this DataSet + * has reached the maximum capacity, false otherwise. + */ + virtual bool hasReachedTrackableLimit() = 0; + + /// Checks if this dataset is active + /** + * Returns true if the dataset is active + */ + virtual bool isActive() const = 0; + + virtual ~DataSet() {} +}; + +} // namespace QCAR + +#endif //_QCAR_DATASET_H_ diff --git a/src/vuforia/include/QCAR/Frame.h b/src/vuforia/include/QCAR/Frame.h new file mode 100755 index 0000000..0df5097 --- /dev/null +++ b/src/vuforia/include/QCAR/Frame.h @@ -0,0 +1,74 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Frame.h + +@brief + Header file for Frame class. +===============================================================================*/ +#ifndef _QCAR_FRAME_H_ +#define _QCAR_FRAME_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward declarations +class Image; +class FrameData; + +/// Frame is a collection of different representations of a single +/// camerasnapshot +/** + * A Frame object can include an arbitrary number of image representations in + * different formats or resolutions together with a time stamp and frame index. + * Frame implements the RAII pattern: A newly created frame holds + * new image data whereas copies of the share this data. The image data held by + * Frame exists as long as one or more Frame objects referencing this image + * data exist. + */ +class QCAR_API Frame +{ +public: + /// Creates a new frame + Frame(); + + /// Creates a reference to an existing frame + Frame(const Frame& other); + + /// Destructor + ~Frame(); + + /// Thread save assignment operator + Frame& operator=(const Frame& other); + + /// A time stamp that defines when the original camera image was shot + /** + * Value in seconds representing the offset to application startup time. + * Independent from image creation the time stamp always refers to the time + * the camera image was shot. + */ + double getTimeStamp() const; + + /// Index of the frame + int getIndex() const; + + /// Number of images in the images-array + int getNumImages() const; + + /// Read-only access to an image + const Image* getImage(int idx) const; + +protected: + FrameData* mData; +}; + +} // namespace QCAR + +#endif // _QCAR_FRAME_H_ diff --git a/src/vuforia/include/QCAR/Image.h b/src/vuforia/include/QCAR/Image.h new file mode 100755 index 0000000..e2ac5b1 --- /dev/null +++ b/src/vuforia/include/QCAR/Image.h @@ -0,0 +1,90 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Image.h + +@brief + Header file for Image class. +===============================================================================*/ +#ifndef _QCAR_IMAGE_H_ +#define _QCAR_IMAGE_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// An image as e.g. returned by the CameraDevice object +/** + * The image's pixel buffer can have a different size than the + * getWidth() and getHeight() methods report. This is e.g. the + * case when an image is used for rendering as a texture without + * non-power-of-two support. + * The real size of the image's pixel buffer can be queried using + * getBufferWidth() and getBufferHeight(). + */ +class QCAR_API Image : private NonCopyable +{ +public: + /// Returns the width of the image in pixels + /** + * getWidth() returns the number of pixels in the pixel buffer that make up + * the used image area. The pixel buffer can be wider than this. Use + * getBufferWidth() to find out the real width of the pixel buffer. + */ + virtual int getWidth() const = 0; + + /// Returns the height of the image in pixels + /** + * getHeight() returns the number of pixel rows in the pixel buffer that + * make up the used image area. The pixel buffer can have more rows than + * that. Use getBufferHeight() to find out the real number of rows that fit + * into the buffer. + */ + virtual int getHeight() const = 0; + + /// Returns the number bytes from one row of pixels to the next row + /** + * Per default the stride is number-of-pixels times bytes-per-pixel. + * However, in some cases there can be additional padding bytes at + * the end of a row (e.g. to support power-of-two textures). + */ + virtual int getStride() const = 0; + + /// Returns the number of pixel columns that fit into the pixel buffer + /** + * Per default the number of columns that fit into the pixel buffer + * is identical to the width of the image. + * However, in some cases there can be additional padding columns at + * the right side of an image (e.g. to support power-of-two textures). + */ + virtual int getBufferWidth() const = 0; + + /// Returns the number of rows that fit into the pixel buffer + /** + * Per default the number of rows that fit into the pixel buffer + * is identical to the height of the image. + * However, in some cases there can be additional padding rows at + * the bottom of an image (e.g. to support power-of-two textures). + */ + virtual int getBufferHeight() const = 0; + + /// Returns the pixel format of the image + virtual PIXEL_FORMAT getFormat() const = 0; + + /// Provides read-only access to pixel data + virtual const void* getPixels() const = 0; + +protected: + virtual ~Image() {} +}; + +} // namespace QCAR + +#endif //_QCAR_IMAGE_H_ diff --git a/src/vuforia/include/QCAR/ImageTarget.h b/src/vuforia/include/QCAR/ImageTarget.h new file mode 100755 index 0000000..bd8d840 --- /dev/null +++ b/src/vuforia/include/QCAR/ImageTarget.h @@ -0,0 +1,84 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ImageTarget.h + +@brief + Header file for ImageTarget class. +===============================================================================*/ +#ifndef _QCAR_IMAGETARGET_H_ +#define _QCAR_IMAGETARGET_H_ + +// Include files +#include +#include +#include + + +namespace QCAR +{ + +// Forward declarations +class Area; +class VirtualButton; + +/// A flat natural feature target +/** + * Methods to modify an ImageTarget must not be called while the + * corresponding DataSet is active. The dataset must be deactivated first + * before reconfiguring an ImageTarget. + */ +class QCAR_API ImageTarget : public ObjectTarget +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the number of virtual buttons defined for this ImageTarget. + virtual int getNumVirtualButtons() const = 0; + + /// Provides write access to a specific virtual button. + virtual VirtualButton* getVirtualButton(int idx) = 0; + + /// Provides read-only access to a specific virtual button. + virtual const VirtualButton* getVirtualButton(int idx) const = 0; + + /// Returns a virtual button by its name + /** + * Returns NULL if no virtual button with that name + * exists in this ImageTarget + */ + virtual VirtualButton* getVirtualButton(const char* name) = 0; + + /// Returns a virtual button by its name + /** + * Returns NULL if no virtual button with that name + * exists in this ImageTarget + */ + virtual const VirtualButton* getVirtualButton(const char* name) const = 0; + + /// Creates a new virtual button and adds it to the ImageTarget + /** + * Returns NULL if the corresponding DataSet is currently active. + */ + virtual VirtualButton* createVirtualButton(const char* name, const Area& area) = 0; + + /// Removes and destroys one of the ImageTarget's virtual buttons + /** + * Returns false if the corresponding DataSet is currently active. + */ + virtual bool destroyVirtualButton(VirtualButton* button) = 0; + + /// Returns the meta data string for this ImageTarget. + virtual const char* getMetaData() const = 0; + +}; + +} // namespace QCAR + +#endif //_QCAR_IMAGETARGET_H_ diff --git a/src/vuforia/include/QCAR/ImageTargetBuilder.h b/src/vuforia/include/QCAR/ImageTargetBuilder.h new file mode 100755 index 0000000..45c9039 --- /dev/null +++ b/src/vuforia/include/QCAR/ImageTargetBuilder.h @@ -0,0 +1,94 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ImageTargetBuilder.h + +@brief + Header file for ImageTargetBuilder class. +===============================================================================*/ +#ifndef _QCAR_IMAGE_TARGET_BUILDER_H_ +#define _QCAR_IMAGE_TARGET_BUILDER_H_ + +// Include files +#include + +namespace QCAR +{ + +class TrackableSource; + +/// ImageTargetBuilder +class QCAR_API ImageTargetBuilder +{ +public: + + enum FRAME_QUALITY { + FRAME_QUALITY_NONE = -1, ///< getFrameQualty was called oustside of scanning mode + FRAME_QUALITY_LOW = 0, ///< Poor number of features for tracking + FRAME_QUALITY_MEDIUM, ///< Sufficient number features for tracking + FRAME_QUALITY_HIGH, ///< Ideal number of features for tracking + }; + + + /// Build an Image Target Trackable source from the next available camera frame + /** + * Build an Image Target Trackable Source from the next available camera frame. + * This is an asynchronous process, the result of which will be available from + * getTrackableSource(). + * + * Note, the ImageTargetBuilder class must be in scan mode for a successful + * target to be built. This allows you to provide feedback to the end user + * as to what the quality of the current frame is before creating a target. + * + * This method will return true if the build was successfully started, and false + * if an invalid name or sceenSizeWidth is provided. + */ + virtual bool build(const char* name, float sceneSizeWidth) = 0; + + + /// Start the scanning mode, allowing calls to getFrameQuality() + /** + * Starts the internal frame scanning process, allowing calls to getFrameQuality() + */ + virtual void startScan() = 0; + + + /// Stop the scanning mode + /** + * Stop the scanning mode, getFrameQuality will return FRAME_QUALITY_NONE until + * startScan is called again. Stopping scan mode will reduce the overall system + * utilization when not building ImageTargets. + */ + virtual void stopScan() = 0; + + + /// Get frame quality, available after startScan is called. + /** + * Will return the frame quality for the last available camera frame, a value + * of FRAME_QUALITY_NONE will be returned if the scanning mode was not enabled. + * via the startScan() method. + */ + virtual FRAME_QUALITY getFrameQuality() = 0; + + + /// Returns a trackable source object to be used in adding a new target to a dataset + /** + * This method will return a TrackableSource to be provided to the DataSet. This + * API will return NULL until a trackable source is available. This trackable + * source will be provided via this api until build() is called again, at which + * point it will return NULL again until a successful build step has occured. + */ + virtual TrackableSource* getTrackableSource() = 0; + +protected: + virtual ~ImageTargetBuilder() {} + +}; + +} // namespace QCAR + +#endif //_QCAR_IMAGE_TARGET_BUILDER_H_ diff --git a/src/vuforia/include/QCAR/ImageTargetResult.h b/src/vuforia/include/QCAR/ImageTargetResult.h new file mode 100755 index 0000000..4f55f5b --- /dev/null +++ b/src/vuforia/include/QCAR/ImageTargetResult.h @@ -0,0 +1,49 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ImageTargetResult.h + +@brief + Header file for ImageTargetResult class. +===============================================================================*/ +#ifndef _QCAR_IMAGETARGETRESULT_H_ +#define _QCAR_IMAGETARGETRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +// Forward declarations: +class VirtualButtonResult; + +/// Result for an ImageTarget. +class QCAR_API ImageTargetResult : public ObjectTargetResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const ImageTarget& getTrackable() const = 0; + + /// Returns the number of VirtualButtons defined for this ImageTarget + virtual int getNumVirtualButtons() const = 0; + + /// Returns the VirtualButtonResult for a specific VirtualButton + virtual const VirtualButtonResult* getVirtualButtonResult(int idx) const = 0; + + /// Returns the VirtualButtonResult for a specific VirtualButton + virtual const VirtualButtonResult* getVirtualButtonResult(const char* name) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_IMAGETARGETRESULT_H_ diff --git a/src/vuforia/include/QCAR/Marker.h b/src/vuforia/include/QCAR/Marker.h new file mode 100755 index 0000000..3975cba --- /dev/null +++ b/src/vuforia/include/QCAR/Marker.h @@ -0,0 +1,56 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Marker.h + +@brief + Header file for Marker class. +===============================================================================*/ +#ifndef _QCAR_MARKER_H_ +#define _QCAR_MARKER_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +/// A rectangular marker +class QCAR_API Marker : public Trackable +{ +public: + /// Type of markers + enum MARKER_TYPE + { + INVALID, ///< Invalid marker type + ID_FRAME ///< An id-encoded marker that stores the id + ///< in the frame + }; + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the size of the marker in 3D scene units. + virtual Vec2F getSize() const = 0; + + /// Sets a new size (in 3D scene units) for the marker. + virtual bool setSize(const Vec2F& size) = 0; + + /// Returns the marker ID (as opposed to the trackable's id, which can be + /// queried using getId()) + virtual int getMarkerId() const = 0; + + /// Returns the marker type (as opposed to the trackable's type, which can + /// be queried using getType()) + virtual MARKER_TYPE getMarkerType() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MARKER_H_ diff --git a/src/vuforia/include/QCAR/MarkerResult.h b/src/vuforia/include/QCAR/MarkerResult.h new file mode 100755 index 0000000..0c09b3e --- /dev/null +++ b/src/vuforia/include/QCAR/MarkerResult.h @@ -0,0 +1,37 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + MarkerResult.h + +@brief + Header file for MarkerResult class. +===============================================================================*/ +#ifndef _QCAR_MARKERRESULT_H_ +#define _QCAR_MARKERRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result for a Marker. +class QCAR_API MarkerResult : public TrackableResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const Marker& getTrackable() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MARKERRESULT_H_ diff --git a/src/vuforia/include/QCAR/MarkerTracker.h b/src/vuforia/include/QCAR/MarkerTracker.h new file mode 100755 index 0000000..fd72a64 --- /dev/null +++ b/src/vuforia/include/QCAR/MarkerTracker.h @@ -0,0 +1,65 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + MarkerTracker.h + +@brief + Header file for MarkerTracker class. +===============================================================================*/ +#ifndef _QCAR_MARKER_TRACKER_H_ +#define _QCAR_MARKER_TRACKER_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +// Forward Declaration +class Marker; + +/// MarkerTracker class. +/** + * The MarkerTracker tracks rectangular markers and provides methods for + * creating and destroying these dynamically. + * Note that the methods for creating and destroying markers should not be + * called while the MarkerTracker is working at the same time. Doing so will + * make these methods block and wait until the MarkerTracker has finished. + * The suggested way of doing this is during the execution of UpdateCallback, + * which guarantees that the MarkerTracker is not working concurrently. + * Alternatively the MarkerTracker can be stopped explicitly. + */ +class QCAR_API MarkerTracker : public Tracker +{ +public: + + /// Returns the Tracker class' type + static Type getClassType(); + + /// Creates a new Marker + /** + * Creates a new marker of the given name, size and id. Returns the new + * instance on success, NULL otherwise. Use MarkerTracker::destroyMarker + * to destroy the returned Marker when it is no longer needed. + */ + virtual Marker* createFrameMarker(int markerId, const char* name, + const QCAR::Vec2F& size) = 0; + + /// Destroys a Marker + virtual bool destroyMarker(Marker* marker) = 0; + + /// Returns the total number of Markers that have been created. + virtual int getNumMarkers() const = 0; + + /// Returns a pointer to a Marker object + virtual Marker* getMarker(int idx) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MARKER_TRACKER_H_ diff --git a/src/vuforia/include/QCAR/Matrices.h b/src/vuforia/include/QCAR/Matrices.h new file mode 100755 index 0000000..3751fc9 --- /dev/null +++ b/src/vuforia/include/QCAR/Matrices.h @@ -0,0 +1,32 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Matrices.h + +@brief + Header file for Matrix34F and Matrix44F structs. +===============================================================================*/ +#ifndef _QCAR_MATRIX_H_ +#define _QCAR_MATRIX_H_ + +namespace QCAR +{ + +/// Matrix with 3 rows and 4 columns of float items +struct Matrix34F { + float data[3*4]; ///< Array of matrix items +}; + + +/// Matrix with 4 rows and 4 columns of float items +struct Matrix44F { + float data[4*4]; ///< Array of matrix items +}; + +} // namespace QCAR + +#endif //_QCAR_MATRIX_H_ diff --git a/src/vuforia/include/QCAR/Mesh.h b/src/vuforia/include/QCAR/Mesh.h new file mode 100755 index 0000000..eb39f35 --- /dev/null +++ b/src/vuforia/include/QCAR/Mesh.h @@ -0,0 +1,67 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Mesh.h + +@brief + Header file for Mesh class. +===============================================================================*/ +#ifndef _QCAR_MESH_H_ +#define _QCAR_MESH_H_ + +#include +#include + + +namespace QCAR +{ + +/// A triangle mesh contains positions and optionally normals +class QCAR_API Mesh +{ +public: + + /// Returns the number of vertices, i.e. positions and normals + virtual int getNumVertices() const = 0; + + /// Returns true if the mesh contains positions + virtual bool hasPositions() const = 0; + + /// Provides access to the array of positions + virtual const Vec3F* getPositions() const = 0; + + /// Provides access to the array of positions + virtual const float* getPositionCoordinates() const = 0; + + /// Returns true if the mesh contains surface normals + virtual bool hasNormals() const = 0; + + /// Provides access to the array of surface normals + virtual const Vec3F* getNormals() const = 0; + + /// Provides access to the array of surface normals + virtual const float* getNormalCoordinates() const = 0; + + /// Returns true if the mesh contains texture coordinates + virtual bool hasUVs() const = 0; + + /// Provides access to the array of texture coordinates + virtual const Vec2F* getUVs() const = 0; + + /// Provides access to the array of texture coordinates + virtual const float* getUVCoordinates() const = 0; + + /// Returns the number of triangles + virtual int getNumTriangles() const = 0; + + /// Provides access to the array triangle indices + virtual const unsigned short* getTriangles() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MESH_H_ diff --git a/src/vuforia/include/QCAR/MultiTarget.h b/src/vuforia/include/QCAR/MultiTarget.h new file mode 100755 index 0000000..402925d --- /dev/null +++ b/src/vuforia/include/QCAR/MultiTarget.h @@ -0,0 +1,107 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + MultiTarget.h + +@brief + Header file for MultiTarget class. +===============================================================================*/ +#ifndef _QCAR_MULTITARGET_H_ +#define _QCAR_MULTITARGET_H_ + +// Include files +#include +#include +#include +#include + +namespace QCAR +{ + +// Forward declarations +struct Matrix34F; + +/// A set of multiple targets with a fixed spatial relation +/** + * Methods to modify a MultiTarget must not be called while the + * corresponding DataSet is active. The dataset must be deactivated first + * before reconfiguring a MultiTarget. + */ +class QCAR_API MultiTarget : public ObjectTarget +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the number of Trackables that form the MultiTarget. + virtual int getNumParts() const = 0; + + /// Provides write access to a specific Trackable. + /** + * Returns NULL if the index is invalid. + */ + virtual Trackable* getPart(int idx) = 0; + + /// Provides read-only access to a specific Trackable. + /** + * Returns NULL if the index is invalid. + */ + virtual const Trackable* getPart(int idx) const = 0; + + /// Provides write access to a specific Trackable. + /** + * Returns NULL if no Trackable with the given name exists + * in the MultiTarget. + */ + virtual Trackable* getPart(const char* name) = 0; + + /// Provides read-only access to a specific Trackable. + /** + * Returns NULL if no Trackable with the given name exists + * in the MultiTarget. + */ + virtual const Trackable* getPart(const char* name) const = 0; + + /// Adds a Trackable to the MultiTarget. + /** + * Returns the index of the new part on success. + * Returns -1 in case of error, e.g. when adding a Part that is already + * added or if the corresponding DataSet is currently active. Use the + * returned index to set the Part's pose via setPartPose(). + */ + virtual int addPart(Trackable* trackable) = 0; + + /// Removes a Trackable from the MultiTarget. + /** + * Returns true on success. + * Returns false if the index is invalid or if the corresponding DataSet + * is currently active. + */ + virtual bool removePart(int idx) = 0; + + /// Defines a Part's spatial offset to the MultiTarget center + /** + * Per default a new Part has zero offset (no translation, no rotation). + * In this case the pose of the Part is identical with the pose of the + * MultiTarget. If there is more than one Part in a MultiTarget + * then at least one must have an offset, or the Parts are co-located. + * Returns false if the index is invalid or if the corresponding DataSet + * is currently active. + */ + virtual bool setPartOffset(int idx, const Matrix34F& offset) = 0; + + /// Retrieves the spatial offset of a Part to the MultiTarget center + /** + * Returns false if the Part's index is invalid. + */ + virtual bool getPartOffset(int idx, Matrix34F& offset) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MULTITARGET_H_ diff --git a/src/vuforia/include/QCAR/MultiTargetResult.h b/src/vuforia/include/QCAR/MultiTargetResult.h new file mode 100755 index 0000000..4ec427c --- /dev/null +++ b/src/vuforia/include/QCAR/MultiTargetResult.h @@ -0,0 +1,46 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + MultiTargetResult.h + +@brief + Header file for MultiTargetResult class. +===============================================================================*/ +#ifndef _QCAR_MULTITARGETRESULT_H_ +#define _QCAR_MULTITARGETRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result for a MultiTarget. +class QCAR_API MultiTargetResult : public ObjectTargetResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const MultiTarget& getTrackable() const = 0; + + /// Returns the number of Trackables that form this MultiTarget + virtual int getNumPartResults() const = 0; + + // Provides access to the TrackableResult for a specific part + virtual const TrackableResult* getPartResult(int idx) const = 0; + + // Provides access to the TrackableResult for a specific part + virtual const TrackableResult* getPartResult(const char* name) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_MULTITARGETRESULT_H_ diff --git a/src/vuforia/include/QCAR/NonCopyable.h b/src/vuforia/include/QCAR/NonCopyable.h new file mode 100755 index 0000000..4c0e66e --- /dev/null +++ b/src/vuforia/include/QCAR/NonCopyable.h @@ -0,0 +1,36 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + NonCopyable.h + +@brief + Header file for NonCopyable class. +===============================================================================*/ +#ifndef _QCAR_NONCOPYABLE_H_ +#define _QCAR_NONCOPYABLE_H_ + +// Include files +#include + +namespace QCAR +{ + +/// Base class for objects that can not be copied +class QCAR_API NonCopyable +{ +protected: + NonCopyable() {} ///< Standard constructor + ~NonCopyable() {} ///< Standard destructor + +private: + NonCopyable(const NonCopyable &); ///< Hidden copy constructor + NonCopyable& operator= (const NonCopyable &); ///< Hidden assignment operator +}; + +} // namespace QCAR + +#endif //_QCAR_NONCOPYABLE_H_ diff --git a/src/vuforia/include/QCAR/Obb2D.h b/src/vuforia/include/QCAR/Obb2D.h new file mode 100755 index 0000000..1fe0c00 --- /dev/null +++ b/src/vuforia/include/QCAR/Obb2D.h @@ -0,0 +1,59 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Obb2d.h + +@brief + Header file for Obb2d class. +===============================================================================*/ +#ifndef _QCAR_OBB2D_H_ +#define _QCAR_OBB2D_H_ + +#include +#include + +namespace QCAR +{ + +/// An Obb2D represents a 2D oriented bounding box +class QCAR_API Obb2D +{ +public: + + /// Constructor. + Obb2D(); + + /// Copy constructor. + Obb2D(const Obb2D& other); + + /// Construct from center, half extents and rotation. + Obb2D(const Vec2F& nCenter, const Vec2F& nHalfExtents, + float nRotation); + + /// Returns the center of the bounding box. + virtual const Vec2F& getCenter() const; + + /// Returns the half width and half height of the bounding box. + virtual const Vec2F& getHalfExtents() const; + + /// Returns the counter-clock-wise rotation angle (in radians) + /// of the bounding box with respect to the X axis. + virtual float getRotation() const; + + virtual ~Obb2D(); + +protected: + Vec2F center; + Vec2F halfExtents; + float rotation; +}; + + +} // namespace QCAR + + +#endif // _QCAR_OBB2D_H_ diff --git a/src/vuforia/include/QCAR/Obb3D.h b/src/vuforia/include/QCAR/Obb3D.h new file mode 100755 index 0000000..6b248d3 --- /dev/null +++ b/src/vuforia/include/QCAR/Obb3D.h @@ -0,0 +1,62 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Obb2d.h + +@brief + Header file for Obb3d class. +===============================================================================*/ +#ifndef _QCAR_OBB3D_H_ +#define _QCAR_OBB3D_H_ + + +#include +#include + + +namespace QCAR +{ + + +/// An Obb3D represents a 3D bounding box oriented along z-direction +class QCAR_API Obb3D +{ +public: + + /// Constructor. + Obb3D(); + + /// Copy constructor. + Obb3D(const Obb3D& other); + + /// Construct from center, half extents and rotation. + Obb3D(const Vec3F& nCenter, const Vec3F& nHalfExtents, + float nRotationZ); + + /// Returns the center of the bounding box. + virtual const Vec3F& getCenter() const; + + /// Returns the half width, depth, and height of the bounding box. + virtual const Vec3F& getHalfExtents() const; + + /// Returns the counter-clock-wise rotation angle (in radians) + /// of the bounding box with respect to the Z axis. + virtual float getRotationZ() const; + + virtual ~Obb3D(); + +protected: + Vec3F center; + Vec3F halfExtents; + float rotation; +}; + + +} // namespace QCAR + + +#endif // _QCAR_OBB3D_H_ diff --git a/src/vuforia/include/QCAR/ObjectTarget.h b/src/vuforia/include/QCAR/ObjectTarget.h new file mode 100755 index 0000000..3245d6b --- /dev/null +++ b/src/vuforia/include/QCAR/ObjectTarget.h @@ -0,0 +1,59 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ObjectTarget.h + +@brief + Header file for the ObjectTarget Trackable type. +===============================================================================*/ +#ifndef _QCAR_OBJECTTARGET_H_ +#define _QCAR_OBJECTTARGET_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// A target for tracking rigid three-dimensional bodies. +class QCAR_API ObjectTarget : public Trackable +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the system-wide unique id of the target. + /** + * The target id uniquely identifies an ObjectTarget across multiple + * Vuforia sessions. The system wide unique id may be generated off-line. + * This is opposed to the function getId() which is a dynamically + * generated id and which uniquely identifies a Trackable within one run + * of Vuforia only. + */ + virtual const char* getUniqueTargetId() const = 0; + + /// Returns the size (width, height, depth) of the target (in 3D scene units). + virtual Vec3F getSize() const = 0; + + /// Set the size (width, height, depth) of the target (in 3D scene units). + /** + * The dataset this target belongs to should not be active when calling + * this function, otherwise it will fail. + * We expect the scale factor to be uniform, and if the given size + * corresponds to non-uniform scaling based on the original size, + * we return false. + * Returns true if the size was set successfully, false otherwise. + */ + virtual bool setSize(const Vec3F& size) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_OBJECTTARGET_H_ + diff --git a/src/vuforia/include/QCAR/ObjectTargetResult.h b/src/vuforia/include/QCAR/ObjectTargetResult.h new file mode 100755 index 0000000..0fc025b --- /dev/null +++ b/src/vuforia/include/QCAR/ObjectTargetResult.h @@ -0,0 +1,41 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ObjectTarget.h + +@brief + Header file for the ObjectTargetResult class. Exposes the result of + detecting and tracking a three dimensional rigid body. +===============================================================================*/ + +#ifndef _QCAR_OBJECTTARGETRESULT_H_ +#define _QCAR_OBJECTTARGETRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result from detecting and tracking a rigid three dimensional body. +class QCAR_API ObjectTargetResult : public TrackableResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const ObjectTarget& getTrackable() const = 0; + +}; + +} // namespace QCAR + +#endif //_QCAR_OBJECTTARGETRESULT_H_ + diff --git a/src/vuforia/include/QCAR/ObjectTracker.h b/src/vuforia/include/QCAR/ObjectTracker.h new file mode 100755 index 0000000..f4ab145 --- /dev/null +++ b/src/vuforia/include/QCAR/ObjectTracker.h @@ -0,0 +1,119 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ObjectTracker.h + +@brief + Header file for ObjectTracker class. +===============================================================================*/ +#ifndef _QCAR_OBJECT_TRACKER_H_ +#define _QCAR_OBJECT_TRACKER_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward Declaration +class Trackable; +class DataSet; +class ImageTargetBuilder; +class TargetFinder; + +/// ObjectTracker class. +/** + * The ObjectTracker tracks ObjectTargets, ImageTargets, CylinderTargets + * or MultiTargets contained in a DataSet. + * The ObjectTracker class provides methods for creating, activating and + * deactivating datasets. Note that methods for activating and deactivating + * datasets should not be called while the ObjectTracker is working at the + * same time. Doing so will make these methods block and wait until the + * tracker has finished. + * The suggested way of swapping datasets is during the execution of + * UpdateCallback, which guarantees that the ObjectTracker is not working + * concurrently. Alternatively the ObjectTracker can be stopped explicitly. + * However, this is a very expensive operation. + */ +class QCAR_API ObjectTracker : public Tracker +{ +public: + + /// Returns the Tracker class' type + static Type getClassType(); + + /// Factory function for creating an empty dataset. + /** + * Returns the new instance on success, NULL otherwise. Use + * DataSet::destroyDataSet() to destroy a DataSet that is no longer needed. + */ + virtual DataSet* createDataSet() = 0; + + /// Destroys the given dataset and releases allocated resources. + /// Returns false if the given dataset is currently active. + virtual bool destroyDataSet(DataSet* dataset) = 0; + + /// Activates the given dataset. + /** + * This function will return true if the DataSet was successfully + * activated and false otherwise. + * The recommended way to activate datasets is during the execution of the + * UpdateCallback, which guarantees that the ObjectTracker is not working + * concurrently. + */ + virtual bool activateDataSet(DataSet* dataset) = 0; + + /// Deactivates the given dataset. + /** + * This function will return true if the DataSet was successfully + * deactivated and false otherwise (E.g. because this dataset is not + * currently active). + * The recommended way to deactivate datasets is during the execution of + * the UpdateCallback, which guarantees that the ObjectTracker is not + * working concurrently. + */ + virtual bool deactivateDataSet(DataSet* dataset) = 0; + + /// Returns the idx-th active dataset. Returns NULL if no DataSet has + /// been activated or if idx is out of range. + virtual DataSet* getActiveDataSet(const int idx = 0) = 0; + + /// Returns the number of currently activated dataset. + virtual int getActiveDataSetCount() const = 0; + + /// Returns instance of ImageTargetBuilder to be used for generated + /// target image from current scene. + virtual ImageTargetBuilder* getImageTargetBuilder() = 0; + + /// Returns instance of TargetFinder to be used for retrieving + /// targets by cloud-based recognition. + virtual TargetFinder* getTargetFinder() = 0; + + /// Persist/Reset Extended Tracking + /** + * In persistent Extended Tracking mode, the environment map will only + * ever be reset when the developer calls resetExtendedTracking(). + * This function will return true if persistent Extended Tracking + * was set successfully (or was already set to the specified value) + * and false otherwise. + */ + virtual bool persistExtendedTracking(bool on) = 0; + + /// Resets environment map for Extended Tracking + /** + * Environment map can only be reset by the developer if persistent + * extended tracking is enabled. + * This function will return true if environment map was reset + * successfully and false otherwise. + */ + virtual bool resetExtendedTracking() = 0; + +}; + +} // namespace QCAR + +#endif //_QCAR_OBJECT_TRACKER_H_ diff --git a/src/vuforia/include/QCAR/Prop.h b/src/vuforia/include/QCAR/Prop.h new file mode 100755 index 0000000..cbfe13b --- /dev/null +++ b/src/vuforia/include/QCAR/Prop.h @@ -0,0 +1,53 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Prop.h + +@brief + Header file for Prop class. +===============================================================================*/ +#ifndef _QCAR_PROP_H_ +#define _QCAR_PROP_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +// Forward declarations: +class Obb3D; +class Mesh; + +/// A trackable that refers to an unknown object on a smart terrain Surface +/** + * The Prop class provides access to all data of a reconstructed object, + * including the mesh and the bounding box. It inherits from + * SmartTerrainTrackable where the Mesh represents the overall extents of + * the ground plane. + */ +class QCAR_API Prop : public SmartTerrainTrackable +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Get the axis-aligned bounding box of the Prop. + /** + * The bounding box will change over time. + */ + virtual const Obb3D& getBoundingBox() const = 0; + + /// Get the local 2D position relative to the parent SmartTerrainTrackable + virtual const Vec2F& getLocalPosition() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_PROP_H_ diff --git a/src/vuforia/include/QCAR/PropResult.h b/src/vuforia/include/QCAR/PropResult.h new file mode 100755 index 0000000..3768edf --- /dev/null +++ b/src/vuforia/include/QCAR/PropResult.h @@ -0,0 +1,37 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + PropResult.h + +@brief + Header file for PropResult class. +===============================================================================*/ +#ifndef _QCAR_PROPRESULT_H_ +#define _QCAR_PROPRESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result for a Prop generated by the SmartTerrainTracker. +class QCAR_API PropResult : public TrackableResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const Prop& getTrackable() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_PROPRESULT_H_ diff --git a/src/vuforia/include/QCAR/QCAR.h b/src/vuforia/include/QCAR/QCAR.h new file mode 100755 index 0000000..1cb7a8c --- /dev/null +++ b/src/vuforia/include/QCAR/QCAR.h @@ -0,0 +1,179 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + QCAR.h + +@brief + Header file for global QCAR methods. +===============================================================================*/ +#ifndef _QCAR_QCAR_H_ +#define _QCAR_QCAR_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward declarations +class UpdateCallback; +class VideoSource; + +/// Initialization flags +/** + * Use when calling init() + */ +enum INIT_FLAGS { + GL_11 = 1, ///< Enables OpenGL ES 1.1 rendering + GL_20 = 2 ///< Enables OpenGL ES 2.0 rendering +}; + +/// Return codes for init() function +enum { + INIT_ERROR = -1, ///< Error during initialization + INIT_DEVICE_NOT_SUPPORTED = -2, ///< The device is not supported + INIT_NO_CAMERA_ACCESS = -3, ///< Cannot access the camera + INIT_LICENSE_ERROR_MISSING_KEY = -4, ///< License key is missing + INIT_LICENSE_ERROR_INVALID_KEY = -5, ///< Invalid license key passed to SDK + INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT = -6, ///< Unable to verify license key due to network (Permanent error) + INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT = -7, ///< Unable to verify license key due to network (Transient error) + INIT_LICENSE_ERROR_CANCELED_KEY = -8, ///< Provided key is no longer valid + INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH = -9, ///< Provided key is not valid for this product + INIT_EXTERNAL_DEVICE_NOT_DETECTED = -10 ///< Dependent external device not detected/plugged in +}; + + +/// Pixel encoding types +enum PIXEL_FORMAT { + UNKNOWN_FORMAT = 0, ///< Unknown format - default pixel type for + ///< undefined images + RGB565 = 1, ///< A color pixel stored in 2 bytes using 5 + ///< bits for red, 6 bits for green and 5 bits + ///< for blue + RGB888 = 2, ///< A color pixel stored in 3 bytes using + ///< 8 bits each + GRAYSCALE = 4, ///< A grayscale pixel stored in one byte + YUV = 8, ///< A color pixel stored in 12 or more bits + ///< using Y, U and V planes + RGBA8888 = 16, ///< A color pixel stored in 32 bits using 8 bits + ///< each and an alpha channel. + INDEXED = 32, ///< One byte per pixel where the value maps to + ///< a domain-specific range. +}; + + +/// Use when calling setHint() +enum HINT { + /// How many image targets to detect and track at the same time + /** + * This hint tells the tracker how many image shall be processed + * at most at the same time. E.g. if an app will never require + * tracking more than two targets, this value should be set to 2. + * Default is: 1. + */ + HINT_MAX_SIMULTANEOUS_IMAGE_TARGETS = 0, + + /// How many object targets to detect and track at the same time + /** + * This hint tells the tracker how many 3D objects shall be processed + * at most at the same time. E.g. if an app will never require + * tracking more than 1 target, this value should be set to 1. + * Default is: 1. + */ + HINT_MAX_SIMULTANEOUS_OBJECT_TARGETS = 1, + + /// Force delayed loading for object target Dataset + /** + * This hint tells the tracker to enable/disable delayed loading + * of object target datasets upon first detection. + * Loading time of large object dataset will be reduced + * but the initial detection time of targets will increase. + * Please note that the hint should be set before loading + * any object target dataset to be effective. + * To enable delayed loading set the hint value to 1. + * To disable delayed loading set the hint value to 0. + * Default is: 0. + */ + HINT_DELAYED_LOADING_OBJECT_DATASETS = 2, +}; + +/// Types of storage locations for datasets +enum STORAGE_TYPE { + STORAGE_APP, ///< Storage private to the application + STORAGE_APPRESOURCE, ///< Storage for assets bundled with the + ///< application + STORAGE_ABSOLUTE ///< Helper type for specifying an absolute path +}; + + +/// Deinitializes Vuforia +void QCAR_API deinit(); + + +/// Sets a hint for the Vuforia SDK +/** + * Hints help the SDK to understand the developer's needs. + * However, depending on the device or SDK version the hints + * might not be taken into consideration. + * Returns false if the hint is unknown or deprecated. + * For a boolean value 1 means true and 0 means false. + */ +bool QCAR_API setHint(unsigned int hint, int value); + + +/// Registers an object to be called when new tracking data is available +void QCAR_API registerCallback(UpdateCallback* object); + + +/// Enables the delivery of certain pixel formats via the State object +/** + * Per default the state object will only contain images in formats + * that are required for internal processing, such as gray scale for + * tracking. setFrameFormat() can be used to enforce the creation of + * images with certain pixel formats. Notice that this might include + * additional overhead. + */ +bool QCAR_API setFrameFormat(PIXEL_FORMAT format, bool enabled); + + +/// Returns the number of bits used to store a single pixel of a given format +/** + * Returns 0 if the format is unknown. + */ +int QCAR_API getBitsPerPixel(PIXEL_FORMAT format); + + +/// Indicates whether the rendering surface needs to support an alpha channel +/// for transparency +bool QCAR_API requiresAlpha(); + + +/// Returns the number of bytes for a buffer with a given size and format +/** + * Returns 0 if the format is unknown. + */ +int QCAR_API getBufferSize(int width, int height, PIXEL_FORMAT format); + + +/// Executes AR-specific tasks upon the onResume activity event +void QCAR_API onResume(); + + +/// Executes AR-specific tasks upon the onResume activity event +void QCAR_API onPause(); + + +/// Executes AR-specific tasks upon the onSurfaceCreated render surface event +void QCAR_API onSurfaceCreated(); + + +/// Executes AR-specific tasks upon the onSurfaceChanged render surface event +void QCAR_API onSurfaceChanged(int width, int height); + +} // namespace QCAR + +#endif //_QCAR_QCAR_H_ diff --git a/src/vuforia/include/QCAR/QCAR_iOS.h b/src/vuforia/include/QCAR/QCAR_iOS.h new file mode 100755 index 0000000..6151d90 --- /dev/null +++ b/src/vuforia/include/QCAR/QCAR_iOS.h @@ -0,0 +1,58 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + QCAR_iOS.h + +@brief + Header file for global QCAR methods that are specific to the iOS version. +===============================================================================*/ +#ifndef _QCAR_QCAR_IOS_H_ +#define _QCAR_QCAR_IOS_H_ + +namespace QCAR +{ + +// iOS specific initialisation flags +enum IOS_INIT_FLAGS { + ROTATE_IOS_90 = 4, ///< iOS: Rotates rendering 90 degrees + ROTATE_IOS_180 = 8, ///< iOS: Rotates rendering 180 degrees + ROTATE_IOS_270 = 16, ///< iOS: Rotates rendering 270 degrees + ROTATE_IOS_0 = 32 ///< iOS: Rotates rendering 0 degrees +}; + + +/// Sets QCAR initialization parameters +/** + iOS: Called to set the QCAR initialization parameters prior to calling QCAR::init(). + Refer to the enumeration QCAR::INIT_FLAGS and QCAR::IOS_INIT_FLAGS for + applicable flags. + Returns an integer (0 on success). + */ +int QCAR_API setInitParameters(int flags, const char* licenseKey); + + +/// Sets the current rotation to be applied to the projection and background +/** + iOS: Called to set any rotation on the QCAR rendered video background and + projection matrix applied to an augmentation after an auto rotation. This is + used for integration of QCAR with Unity on iOS. + See sample apps for how to handle auto-rotation on non-Unity apps. + */ +void QCAR_API setRotation(int rotation); + +/// Initializes QCAR +/** + iOS: Called to initialize QCAR. Initialization is progressive, so this function + should be called repeatedly until it returns 100 or a negative value. + Returns an integer representing the percentage complete (negative on error). + */ +int QCAR_API init(); + +} // namespace QCAR + +#endif //_QCAR_QCAR_IOS_H_ + diff --git a/src/vuforia/include/QCAR/Reconstruction.h b/src/vuforia/include/QCAR/Reconstruction.h new file mode 100755 index 0000000..ac91b5b --- /dev/null +++ b/src/vuforia/include/QCAR/Reconstruction.h @@ -0,0 +1,82 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Reconstruction.h + +@brief + Header file for Reconstruction class. +===============================================================================*/ +#ifndef _QCAR_RECONSTRUCTION_H_ +#define _QCAR_RECONSTRUCTION_H_ + +#include +#include +#include +#include + +namespace QCAR +{ + +/// Base interface for reconstructions with SmartTerrainBuilder in the Vuforia system. +class QCAR_API Reconstruction : private NonCopyable +{ +public: + + /// Returns the reconstruction class' type + static Type getClassType(); + + /// Returns the instance's type + virtual Type getType() const = 0; + + /// Set the maximum extent of the smart terrain in scene units + /** + * The ground plane will not expand outside of this rectangle. + * Objects are only created inside the rectangle. Objects on the boundary + * of the rectangle will be cut off. + */ + virtual bool setMaximumArea(const Rectangle& rect) = 0; + + /// Get the maximum extent of the smart terrain in scene units. + /** + * Returns false if no maximum extent has been defined. + */ + virtual bool getMaximumArea(Rectangle& rect) const = 0; + + /// Define how much the SmartTerrain ground plane mesh is diminished. + /** + * Padding must be greater than or equal to 0. + */ + virtual void setNavMeshPadding(float padding) = 0; + + /// Smart terrain reconstruction is started or continued if it was + /// previously stopped. + virtual bool start() = 0; + + /// Smart terrain reconstruction is stopped, existing trackables are + /// still tracked. + virtual bool stop() = 0; + + /// Resets the reconstruction, clearing out existing trackables. + /** + * The ground plane and all objects are cleared. + * The scene has to be scanned completely again. + */ + virtual bool reset() = 0; + + /// Returns true if the terrain and objects are being updated + virtual bool isReconstructing() const = 0; + +protected: + /// Destructor. + virtual ~Reconstruction() {} +}; + + +} // namespace QCAR + + +#endif // _QCAR_RECONSTRUCTION_H_ diff --git a/src/vuforia/include/QCAR/ReconstructionFromTarget.h b/src/vuforia/include/QCAR/ReconstructionFromTarget.h new file mode 100755 index 0000000..64c067b --- /dev/null +++ b/src/vuforia/include/QCAR/ReconstructionFromTarget.h @@ -0,0 +1,69 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + ReconstructionFromTarget.h + +@brief + Header file for ReconstructionFromTarget class. +===============================================================================*/ +#ifndef _QCAR_RECONSTRUCTIONFROMTARGET_H_ +#define _QCAR_RECONSTRUCTIONFROMTARGET_H_ + +#include +#include +#include +#include +#include +#include + +namespace QCAR +{ + + +/// A reconstruction of a plane with object(s) on top using an initialization +/// target. +class QCAR_API ReconstructionFromTarget : public Reconstruction +{ +public: + /// Returns the reconstruction class' type + static Type getClassType(); + + /// Define the trackable which is used for starting smart terrain. + /** + * The occluderVolume is an axis-aligned box, which defines the area + * where the table is occluded by the target and its surrounding object. + */ + virtual bool setInitializationTarget(const Trackable* trackable, + const Box3D& occluderVolume) = 0; + + /// Define trackable which is used for starting smart terrain. + /** + * The occluderVolume is an axis-aligned box, which defines the area + * where the table is occluded by the target and its surrounding object. + * offsetToOccluderPose is a pose matrix that allows to define a + * translational offset and rotation of the occluder volume with respect + * to the initialization target. + */ + virtual bool setInitializationTarget(const Trackable* trackable, + const Box3D& occluderVolume, + const Matrix34F& offsetToOccluderPose) = 0; + + /// Returns the trackable used for initialization. + /** + * Returns null if no initialization target has been defined. + */ + virtual const Trackable* getInitializationTarget() const = 0; + +protected: + virtual ~ReconstructionFromTarget() {} +}; + + +} // namespace QCAR + + +#endif // _QCAR_RECONSTRUCTIONFROMTARGET_H_ diff --git a/src/vuforia/include/QCAR/Rectangle.h b/src/vuforia/include/QCAR/Rectangle.h new file mode 100755 index 0000000..a472b00 --- /dev/null +++ b/src/vuforia/include/QCAR/Rectangle.h @@ -0,0 +1,96 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Rectangle.h + +@brief + Header file for Rectangle class. +===============================================================================*/ +#ifndef _QCAR_RECTANGLE_H_ +#define _QCAR_RECTANGLE_H_ + +#include + +namespace QCAR +{ + +/// Rectangle defines a 2D rectangular area +class QCAR_API Rectangle : public Area +{ +public: + Rectangle(); + + Rectangle(const Rectangle& other); + + Rectangle(float leftTopX, float leftTopY, + float rightBottomX, float rightBottomY); + + virtual ~Rectangle(); + + Rectangle& operator=(const Rectangle& other); + + float getLeftTopX() const; + + float getLeftTopY() const; + + float getRightBottomX() const; + + float getRightBottomY() const; + + float getWidth() const; + + float getHeight() const; + + float getAreaSize() const; + + virtual TYPE getType() const; + +protected: + float left,top,right,bottom; +}; + + +// Integer version of the Rectangle class +class QCAR_API RectangleInt : public Area +{ +public: + RectangleInt(); + + RectangleInt(const RectangleInt& other); + + RectangleInt(int leftTopX, int leftTopY, + int rightBottomX, int rightBottomY); + + virtual ~RectangleInt(); + + RectangleInt& operator=(const RectangleInt& other); + + int getLeftTopX() const; + + int getLeftTopY() const; + + int getRightBottomX() const; + + int getRightBottomY() const; + + int getWidth() const; + + int getHeight() const; + + int getAreaSize() const; + + virtual TYPE getType() const; + +protected: + int left,top,right,bottom; +}; + +} // namespace QCAR + + + +#endif // _QCAR_RECTANGLE_H_ diff --git a/src/vuforia/include/QCAR/Renderer.h b/src/vuforia/include/QCAR/Renderer.h new file mode 100755 index 0000000..50272b3 --- /dev/null +++ b/src/vuforia/include/QCAR/Renderer.h @@ -0,0 +1,85 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Renderer.h + +@brief + Header file for Renderer class. +===============================================================================*/ +#ifndef _QCAR_RENDERER_H_ +#define _QCAR_RENDERER_H_ + +// Include files +#include +#include +#include +#include +#include + +namespace QCAR +{ + +// Forward declarations +class State; +struct VideoBackgroundConfig; +struct VideoBackgroundTextureInfo; + +/// Renderer class +/** + * The Renderer class provides methods to fulfill typical AR related tasks + * such as rendering the video background and 3D objects with up to date + * pose data. Methods of the Renderer class must only be called from the render + * thread. + */ +class QCAR_API Renderer : private NonCopyable +{ +public: + /// Returns the Renderer singleton instance. + static Renderer& getInstance(); + + /// Marks the beginning of rendering for the current frame and returns the + /// State object. + virtual State begin() = 0; + + /// Marks the beginning of rendering for the given frame. Use this to draw a + /// specific camera frame, rather than the latest available one. + virtual void begin(State state) = 0; + + /// Draws the video background + /// This should only be called between a begin() and end() calls + virtual bool drawVideoBackground() = 0; + + /// Marks the end of rendering for the current frame. + virtual void end() = 0; + + /// Binds the video background texture to a given texture unit + /// This should only be called between a begin() and end() calls + virtual bool bindVideoBackground(int unit) = 0; + + /// Configures the layout of the video background (location on the screen + /// and size). + virtual void setVideoBackgroundConfig(const VideoBackgroundConfig& cfg) = 0; + + /// Retrieves the current layout configuration of the video background. + virtual const VideoBackgroundConfig& getVideoBackgroundConfig() const = 0; + + /// Returns the texture info associated with the current video background + virtual const VideoBackgroundTextureInfo& + getVideoBackgroundTextureInfo() = 0; + + /// Tells Vuforia where the texture id to use for updating video + /// background data + virtual bool setVideoBackgroundTextureID(int textureID) = 0; + + /// Tool method to calculate a perspective projection matrix for AR + /// rendering and apply it to OpenGL + virtual void setARProjection(float nearPlane, float farPlane) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_RENDERER_H_ diff --git a/src/vuforia/include/QCAR/SmartTerrainBuilder.h b/src/vuforia/include/QCAR/SmartTerrainBuilder.h new file mode 100755 index 0000000..e35dc69 --- /dev/null +++ b/src/vuforia/include/QCAR/SmartTerrainBuilder.h @@ -0,0 +1,79 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + SmartTerrainBuilder.h + +@brief + Header file for SmartTerrainBuilder class. +===============================================================================*/ +#ifndef _QCAR_SMARTTERRAIN_BUILDER_H_ +#define _QCAR_SMARTTERRAIN_BUILDER_H_ + +// Include files +#include +#include +#include +#include + + +namespace QCAR +{ + +/// SmartTerrainBuilder class +/** + * The SmartTerrainBuilder controls the smart terrain generation system of Vuforia. + * If the SmartTerrainTracker is enabled and the builder is initialized. + * SmartTerrainTrackables (Surface, Prop) will be generated once an appropriate + * Reconstruction object is registered. + */ +class QCAR_API SmartTerrainBuilder : private NonCopyable +{ +public: + + /// Returns the Tracker class' type + static Type getClassType(); + + /// Returns the Trackable instance's type + virtual Type getType() const = 0; + + /// Checks whether the builder instance's type equals or has been + /// derived from a give type + virtual bool isOfType(Type type) const = 0; + + // Factory method for creating an instance of a reconstruction + /* + * Valid types are ReconstructionFromEnvironment and ReconstructionFromTarget. + * Passing in any other type will cause NULL to be returned. + */ + virtual Reconstruction* createReconstruction(Type type) = 0; + + /// Method for cleaning up a previously created reconstruction object + virtual bool destroyReconstruction(Reconstruction* reco) = 0; + + /// Returns the number of reconstructions registered with the builder. + virtual unsigned int getNumReconstructions() const = 0; + + /// Adds a reconstruction to the builder and starts it. + virtual bool addReconstruction(Reconstruction* obj) = 0; + + /// Removes a reconstruction from the builder and cleans up any generated + /// trackables as well. + virtual bool removeReconstruction(unsigned int index) = 0; + + /// Gets the reconstruction at the given index. + virtual Reconstruction* getReconstruction(unsigned int index) const = 0; + + /// Initializes the builder, returning true if able to. + virtual bool init() = 0; + + /// Deinitializes the builder, return true if able to do so. + virtual bool deinit() = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_SMARTTERRAIN_BUILDER_H_ diff --git a/src/vuforia/include/QCAR/SmartTerrainTrackable.h b/src/vuforia/include/QCAR/SmartTerrainTrackable.h new file mode 100755 index 0000000..be08ad1 --- /dev/null +++ b/src/vuforia/include/QCAR/SmartTerrainTrackable.h @@ -0,0 +1,73 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + SmartTerrainTrackable.h + +@brief + Header file for SmartTerrainSmartTerrainTrackable class. +===============================================================================*/ +#ifndef _QCAR_SMARTTERRAINTRACKABLE_H_ +#define _QCAR_SMARTTERRAINTRACKABLE_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward declarations: +class Rectangle; +class Mesh; + +/// The base class of all SmartTerrain trackables +/** + * The SmartTerrainTrackable class represents any trackable that is + * reconstructed and tracked by the SmartTerrainTracker. It provides access + * to all common properties. SmartTerrainTrackables are reconstructed in an + * object graph. Elements of this hierarchy are the derived classes + * Surface and Prop. A Surface represents navigable ground plane and may + * have multiple Prop child objects that represent objects on this plane. + */ +class QCAR_API SmartTerrainTrackable : public Trackable +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the mesh that represents this SmartTerrainTrackable + /** + * The mesh represents either a ground Surface or a Prop on top of the + * Surface depending on the derived class. The mesh will change over time. + */ + virtual const Mesh* getMesh() const = 0; + + /// Returns the mesh revision, which is increased on every geometry update + virtual int getRevision() const = 0; + + /// Get the local pose relative to the parent SmartTerrainTrackable + virtual const Matrix34F& getLocalPose() const = 0; + + /// Returns the parent SmartTerrainTrackable + /** + * Returns NULL if this is the root object + */ + virtual const SmartTerrainTrackable* getParent() const = 0; + + /// Returns the number of SmartTerrainTrackable child objects + virtual unsigned int getChildrenCount() const = 0; + + /// Returns the SmartTerrainTrackable child object at at the given index + /** + * Returns NULL if the index is invalid. + */ + virtual const SmartTerrainTrackable* getChild(unsigned int idx) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_SMARTTERRAINTRACKABLE_H_ diff --git a/src/vuforia/include/QCAR/SmartTerrainTracker.h b/src/vuforia/include/QCAR/SmartTerrainTracker.h new file mode 100755 index 0000000..c4e8c1b --- /dev/null +++ b/src/vuforia/include/QCAR/SmartTerrainTracker.h @@ -0,0 +1,53 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + SmartTerrainTracker.h + +@brief + Header file for SmartTerrainTracker class. +===============================================================================*/ +#ifndef _QCAR_SMARTTERRAINTRACKER_H_ +#define _QCAR_SMARTTERRAINTRACKER_H_ + +#include +#include +#include +#include +#include + +namespace QCAR +{ + +/// +class QCAR_API SmartTerrainTracker : public Tracker +{ +public: + + /// Returns the tracker class' type + static Type getClassType(); + + /// Set the scaling factor for SmartTerrain trackables from millimeters + /// into scene units. + /* + * The default scaling factor is 1.0. + * Returns false if the tracker is not in the stopped state, true if the + * scale is non-zero and we are able to set the scale factor. + */ + virtual bool setScaleToMillimeter(float scaleFactor) =0; + + /// Gets the scaling factor from millimeters to scene units. + virtual float getScaleToMillimeter() const = 0; + + /// Gets a reference to the SmartTerrainBuilder. + virtual SmartTerrainBuilder& getSmartTerrainBuilder() = 0; +}; + + +} // namespace QCAR + + +#endif // _QCAR_SMARTTERRAINTRACKER_H_ diff --git a/src/vuforia/include/QCAR/State.h b/src/vuforia/include/QCAR/State.h new file mode 100755 index 0000000..c758fb5 --- /dev/null +++ b/src/vuforia/include/QCAR/State.h @@ -0,0 +1,88 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + State.h + +@brief + Header file for State class. +===============================================================================*/ +#ifndef _QCAR_STATE_H_ +#define _QCAR_STATE_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +class Trackable; +class TrackableResult; +class StateData; + + +/// AR State +/** + * A consistent view on the augmented reality state + * including a camera frame and all trackables. + * Similar to Frame, State is a light weight object that + * shares its data among multiple instances. Copies are + * therefore cheap and suggested over usage of references. + * Notice: Trackables queried by the state can not be + * compared by pointer to Trackables queried by the tracker + * (even though they might reference the same tracked object). + * Trackables queried by the state represent a temporary and + * consistent view on the Augmented Reality state and can + * therefore not be modified. objects must be queried from + * the Tracker in order to modify them. + */ +class QCAR_API State +{ +public: + /// Default constructor. + State(); + + /// Copy constructor. + State(const State& other); + + /// Destructor + ~State(); + + /// Thread safe assignment operator + State& operator=(const State& other); + + /// Returns the Frame object that is stored in the State + Frame getFrame() const; + + /// Returns the number of Trackable objects currently known to the SDK + int getNumTrackables() const; + + /// Provides access to a specific Trackable + /** + * The returned object is only valid as long as the State + * object is valid. Do not keep a copy of the pointer! + */ + const Trackable* getTrackable(int idx) const; + + /// Returns the number of Trackable objects currently being tracked + int getNumTrackableResults() const; + + /// Provides access to a specific TrackableResult object. + /** + * The returned object is only valid as long as the State + * object is valid. Do not keep a copy of the pointer! + */ + const TrackableResult* getTrackableResult(int idx) const; + +protected: + StateData* mData; + +}; + +} // namespace QCAR + +#endif //_QCAR_STATE_H_ diff --git a/src/vuforia/include/QCAR/Surface.h b/src/vuforia/include/QCAR/Surface.h new file mode 100755 index 0000000..c02de7d --- /dev/null +++ b/src/vuforia/include/QCAR/Surface.h @@ -0,0 +1,72 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Surface.h + +@brief + Header file for Surface class. +===============================================================================*/ +#ifndef _QCAR_SURFACE_H_ +#define _QCAR_SURFACE_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward declarations: +class Rectangle; +class Mesh; + +/// A trackable representing a dynamically expanding terrain with objects on top. +/** + * The Surface class provides access to all data of the reconstructed ground + * plane. It inherits from SmartTerrainTrackable where the Mesh represents the + * overall extents of the ground plane. In addition a NavMesh represents the + * navigable portion of that mesh with objects cut out. + */ +class QCAR_API Surface : public SmartTerrainTrackable +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the navigation mesh where the mesh boundary has been padded + /** + * The mesh will change over time. + */ + virtual const Mesh* getNavMesh() const = 0; + + /// Returns the axis-aligned bounding box of the ground mesh + /** + * The bounding box will change over time. + */ + virtual const Rectangle& getBoundingBox() const = 0; + + /// Returns the number of indices for ground mesh boundaries + /** + * Each consecutive pair of indices defines a line segment. As a whole this + * defines a polygon that represents the outer extents of the Surface mesh. + * The mesh boundaries will change over time. + */ + virtual int getNumMeshBoundaries() const = 0; + + /// Returns the line list that represents all boundaries. + /** + * Each consecutive pair of indices defines a line segment. As a whole this + * defines a polygon that represents the outer extents of the Surface mesh. + * The indices refer to points in the mesh. + */ + virtual const unsigned short* getMeshBoundaries() const = 0; + +}; + +} // namespace QCAR + +#endif //_QCAR_SURFACE_H_ diff --git a/src/vuforia/include/QCAR/SurfaceResult.h b/src/vuforia/include/QCAR/SurfaceResult.h new file mode 100755 index 0000000..3ce12d7 --- /dev/null +++ b/src/vuforia/include/QCAR/SurfaceResult.h @@ -0,0 +1,38 @@ +/*=============================================================================== +Copyright (c) 2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Surface.h + +@brief + Header file for Surface class. +===============================================================================*/ +#ifndef _QCAR_SURFACERESULT_H_ +#define _QCAR_SURFACERESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Result for a Surface generated by the SmartTerrainTracker. +class QCAR_API SurfaceResult : public TrackableResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents + virtual const Surface& getTrackable() const = 0; + +}; + +} // namespace QCAR + +#endif //_QCAR_SURFACERESULT_H_ diff --git a/src/vuforia/include/QCAR/System.h b/src/vuforia/include/QCAR/System.h new file mode 100755 index 0000000..e0b7f17 --- /dev/null +++ b/src/vuforia/include/QCAR/System.h @@ -0,0 +1,66 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + System.h + +@brief + System specific definitions. +===============================================================================*/ +#ifndef _QCAR_SYSTEM_H_ +#define _QCAR_SYSTEM_H_ + +// Include files +#if defined(_WIN32_WCE) || defined(WIN32) +# define QCAR_IS_WINDOWS +#endif + + +// Define exporting/importing of methods from module +// +#ifdef QCAR_IS_WINDOWS + +# ifdef QCAR_EXPORTS +# define QCAR_API __declspec(dllexport) +# elif defined(QCAR_STATIC) +# define QCAR_API +# else +# define QCAR_API __declspec(dllimport) +# endif + +#else // !QCAR_IS_WINDOWS + +# ifdef QCAR_EXPORTS +# define QCAR_API __attribute__((visibility("default"))) +# elif defined(QCAR_STATIC) +# define QCAR_API +# else +# define QCAR_API __attribute__((visibility("default"))) +# endif + +#endif + + +// Platform defines +#ifdef QCAR_IS_WINDOWS + +namespace QCAR +{ + typedef unsigned __int16 UInt16; +} + +#else // !QCAR_IS_WINDOWS + +#include + +namespace QCAR +{ + typedef __uint16_t UInt16; +} + +#endif + +#endif // _QCAR_SYSTEM_H_ diff --git a/src/vuforia/include/QCAR/TargetFinder.h b/src/vuforia/include/QCAR/TargetFinder.h new file mode 100755 index 0000000..8693c29 --- /dev/null +++ b/src/vuforia/include/QCAR/TargetFinder.h @@ -0,0 +1,180 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TargetFinder.h + +@brief + Header file for TargetFinder class. +===============================================================================*/ +#ifndef _QCAR_TARGET_FINDER_H_ +#define _QCAR_TARGET_FINDER_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +// Forward Declaration +class DataSet; +class ImageTarget; + +/// A service that retrieves Targets using cloud-based recognition +class QCAR_API TargetFinder : private NonCopyable +{ +public: + + /// Status codes returned by the init() function + enum + { + INIT_DEFAULT = 0, ///< Initialization has not started + INIT_RUNNING = 1, ///< Initialization is running + INIT_SUCCESS = 2, ///< Initialization completed successfully + INIT_ERROR_NO_NETWORK_CONNECTION = -1, ///< No network connection + INIT_ERROR_SERVICE_NOT_AVAILABLE = -2 ///< Service is not available + }; + + /// Status codes returned by the updateSearchResults() function + enum + { + UPDATE_NO_MATCH = 0, ///< No matches since the last update + UPDATE_NO_REQUEST = 1, ///< No recognition request since the last update + UPDATE_RESULTS_AVAILABLE = 2, ///< New search results have been found + UPDATE_ERROR_AUTHORIZATION_FAILED = -1, ///< Credentials are wrong or outdated + UPDATE_ERROR_PROJECT_SUSPENDED = -2, ///< The specified project was suspended. + UPDATE_ERROR_NO_NETWORK_CONNECTION = -3, ///< Device has no network connection + UPDATE_ERROR_SERVICE_NOT_AVAILABLE = -4, ///< Server not found, down or overloaded. + UPDATE_ERROR_BAD_FRAME_QUALITY = -5, ///< Low frame quality has been continuously observed + UPDATE_ERROR_UPDATE_SDK = -6, ///< SDK Version outdated. + UPDATE_ERROR_TIMESTAMP_OUT_OF_RANGE = -7,///< Client/Server clocks too far away. + UPDATE_ERROR_REQUEST_TIMEOUT = -8 ///< No response to network request after timeout. + }; + + + /// Starts initialization of the cloud-based recognition system. + /** + * Initialization of the cloud-based recognition system may take significant + * time and is thus handled in a background process. Use getInitState() to + * query the initialization progress and result. Pass in the user/password + * for authenticating with the visual search server. + */ + virtual bool startInit(const char* userAuth, const char* secretAuth) = 0; + + /// Returns the current state of the initialization process + /** + * Returns INIT_SUCCESS if the cloud-based recognition system was + * initialized successfully. Initialization requires a network connection + * to be available on the device, otherwise INIT_ERROR_NO_NETWORK_CONNECTION + * is returned. If the cloud-based recognition service is not available this + * function will return INIT_ERROR_SERVICE_NOT_AVAILABLE. Returns + * INIT_DEFAULT if initialization has not been started. Returns INIT_RUNNING + * if the initialization process has not completed. + */ + virtual int getInitState() = 0; + + /// Wait for the the cloud-based recognition system initialization to complete. + /** + * This functions blocks execution until initialization is complete. + */ + virtual void waitUntilInitFinished() = 0; + + /// Deinitializes the cloud-based recognition system + virtual bool deinit() = 0; + + + /// Starts visual recognition + /** + * Starts continuous recognition of Targets from the cloud. + * Use updateSearchResults() and getResult() to retrieve search matches. + */ + virtual bool startRecognition() = 0; + + /// Stops visual recognition + virtual bool stop() = 0; + + + + /// Returns true if the TargetFinder is in 'requesting' mode + /** + * When in 'requesting' mode the TargetFinder has issued a search + * query to the recognition server and is waiting for the results. + */ + virtual bool isRequesting() = 0; + + + + /// Update visual search results + /** + * Clears and rebuilds the list of TargetSearchResults with results found + * since the last call to updateSearchResults(). Returns the status code + * UPDATE_RESULTS_AVAILABLE if new search results have been found. + * Targets that are already enabled for tracking are not included + * in the list of TargetSearchResults unless the target or its associated + * meta data has been updated since they were last enabled for tracking. + */ + virtual int updateSearchResults() = 0; + + /// Get the number of visual search results + virtual int getResultCount() const = 0; + + /// Returns a pointer to a search result instance + /** + * Search results are owned by the TargetFinder. Each call to + * updateSearchResults() destroys and rebuilds the list of + * TargetSearchResult search. + */ + virtual const TargetSearchResult* getResult(int idx) = 0; + + + + /// Enable this search result for tracking + /** + * Creates an ImageTarget for local detection and tracking of this target. + * The pose of this target will be reported in the Vuforia State. Note that + * this call may result in an earlier ImageTarget that was enabled for + * tracking to be destroyed. Thus it is not advised to hold a pointer to an + * earlier created ImageTarget after calling enableTracking again. Returns + * NULL if the target failed to be enabled for tracking. + */ + virtual ImageTarget* enableTracking(const TargetSearchResult& result) = 0; + + /// Clears all targets enabled for tracking + /** + * Destroy all ImageTargets that have been created via enableTracking(). + */ + virtual void clearTrackables() = 0; + + /// Returns the number targets currently enabled for tracking. + virtual int getNumImageTargets() const = 0; + + /// Returns a pointer to an ImageTarget object. + virtual ImageTarget* getImageTarget(int idx) = 0; + + + + /// Sets the base color of the scanline in the scanning UI + /** + * The parameters allow you to set the Red, Green and Blue colors + * for the Scanline. They should be normalized values between 0 and 1. + */ + virtual void setUIScanlineColor(float r, float g, float b) = 0; + + /// Sets the base color of the points in the scanning UI + /** + * The parameters allow you to set the Red, Green and Blue colors + * for the Points. They should be normalized values between 0 and 1. + * Note that this call triggers the keypoint texture to be recreated and + * it should thus be avoided to called this every frame. + */ + virtual void setUIPointColor(float r, float g, float b) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_TARGET_FINDER_H_ diff --git a/src/vuforia/include/QCAR/TargetSearchResult.h b/src/vuforia/include/QCAR/TargetSearchResult.h new file mode 100755 index 0000000..bdf73e0 --- /dev/null +++ b/src/vuforia/include/QCAR/TargetSearchResult.h @@ -0,0 +1,50 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TargetSearchResult.h + +@brief + Header file for TargetSearchResult class. +===============================================================================*/ +#ifndef _QCAR_TARGET_SEARCH_RESULT_H_ +#define _QCAR_TARGET_SEARCH_RESULT_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// A search result of a found target returned by the TargetFinder +class TargetSearchResult : private NonCopyable +{ +public: + /// Returns the name of the target + virtual const char* getTargetName() const = 0; + + /// Returns the system-wide unique id of the target. + virtual const char* getUniqueTargetId() const = 0; + + /// Returns the width of the target (in 3D scene units) + virtual const float getTargetSize() const = 0; + + /// Returns the metadata associated with this target + virtual const char* getMetaData() const = 0; + + /// Returns the tracking rating for this target + /** + * The tracking rating represents a 5-star rating describing the + * suitability of this target for tracking on a scale from 0 to 5. A low + * tracking rating may result in poor tracking or unstable augmentation. + */ + virtual unsigned char getTrackingRating() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_TARGET_SEARCH_RESULT_H_ diff --git a/src/vuforia/include/QCAR/TextTracker.h b/src/vuforia/include/QCAR/TextTracker.h new file mode 100755 index 0000000..9fd8b02 --- /dev/null +++ b/src/vuforia/include/QCAR/TextTracker.h @@ -0,0 +1,98 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TextTracker.h + +@brief + Header file for TextTracker class. +===============================================================================*/ +#ifndef _QCAR_TEXT_TRACKER_H_ +#define _QCAR_TEXT_TRACKER_H_ + +// Include files +#include +#include +#include +#include + +namespace QCAR +{ + +/// The TextTracker controls the text recognition and tracking sub-system +/// of Vuforia. +/** + * The TextTracker detects and tracks a single or multiple words in six + * degrees of freedom (6DOF). + */ +class QCAR_API TextTracker : public Tracker +{ +public: + + enum UP_DIRECTION + { + REGIONOFINTEREST_UP_IS_0_HRS = 1, + REGIONOFINTEREST_UP_IS_3_HRS = 2, + REGIONOFINTEREST_UP_IS_6_HRS = 3, + REGIONOFINTEREST_UP_IS_9_HRS = 4 + }; + + /// Returns the Tracker class' type + static Type getClassType(); + + /// Defines the area of the image where text can be detected and tracked. + /** + * Allows to define rectangular regions that represent the + * area where text can be detected and tracked respectively. + * For optimal performance the detection window should be kept small. + * Larger detection windows will result in longer detection times and may + * affect the user experience on some devices. A recommended detection + * window size is shown in the sample application. + * There is no performance impact to tracking text across the full camera + * image, but it may make sense to limit the tracking area if only parts + * of the camera image are visible to the user. + * The regions are defined in pixel units in the space defined by + * the input camera image. Please query the VideoMode from the + * CameraDevice to query the resolution of the input camera image. + * Note that the detection window must be fully contained in the tracking + * window for this operation to succeed. + */ + virtual bool setRegionOfInterest(const RectangleInt& detectionROI, + const RectangleInt& trackingROI, + const UP_DIRECTION upDirection) = 0; + + /// Returns the area of the input camera image where text can be detected. + /** + * If no region of interest has been set using setRegionOfInterest, then + * the TextTracker will use a default sub-region of the full camera image. + * In this case this function will only return valid values + * after the first camera frame has been processed. + */ + virtual void getRegionOfInterest(RectangleInt& detectionROI, + RectangleInt& trackingROI, + UP_DIRECTION& upDirection) const = 0; + + /// Returns the area of the input camera image where text can be detected. + /** + * Please note that getRegionOfInterest(RectangleInt&, RectangleInt&, + * unsigned int&) is deprecated. Use getRegionOfInterest(RectangleInt&, + * RectangleInt&, UP_DIRECTION&) instead. + * If no region of interest has been set using setRegionOfInterest, then + * the TextTracker will use a default sub-region of the full camera image. + * In this case this function will only return valid values + * after the first camera frame has been processed. + */ + virtual void getRegionOfInterest(RectangleInt& detectionROI, + RectangleInt& trackingROI, + unsigned int& upDirection) const = 0; + + /// Returns the WordList associated to this tracker. + virtual WordList* getWordList() = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_TEXT_TRACKER_H_ diff --git a/src/vuforia/include/QCAR/Tool.h b/src/vuforia/include/QCAR/Tool.h new file mode 100755 index 0000000..05fd54a --- /dev/null +++ b/src/vuforia/include/QCAR/Tool.h @@ -0,0 +1,105 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Tool.h + +@brief + Header file for global Tool functions. +===============================================================================*/ +#ifndef _QCAR_TOOL_H_ +#define _QCAR_TOOL_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +// Forward declarations +class CameraCalibration; + +/// Tool functions +namespace Tool +{ + /// Returns a 4x4 col-major OpenGL model-view matrix from a 3x4 Vuforia pose + /// matrix. + /** + * Vuforia uses 3x4 row-major matrices for pose data. convertPose2GLMatrix() + * takes such a pose matrix and returns an OpenGL compatible model-view + * matrix. + */ + QCAR_API Matrix44F convertPose2GLMatrix(const Matrix34F& pose); + + /// Returns an OpenGL style projection matrix. + QCAR_API Matrix44F getProjectionGL(const CameraCalibration& calib, + float nearPlane, float farPlane); + + /// Projects a 3D scene point into the camera image(device coordinates) + /// given a pose in form of a 3x4 matrix. + /** + * The projectPoint() function takes a 3D point in scene coordinates and + * transforms it using the given pose matrix. It then projects it into the + * camera image (pixel coordinates) using the given camera calibration. + * Note that camera coordinates are usually different from screen + * coordinates, since screen and camera resolution can be different. + * Transforming from camera to screen coordinates requires another + * transformation using the settings applied to the Renderer via the + * VideoBackgroundConfig structure. + */ + QCAR_API Vec2F projectPoint(const CameraCalibration& calib, + const Matrix34F& pose, const Vec3F& point); + + /// Project a camera coordinate down to a plane aligned on the x-y plane with + /// the given pose. Returns the offset along the plane from its origin. + QCAR_API Vec2F projectPointToPlaneXY(const CameraCalibration& calib, + const Matrix34F& pose, + const Vec2F& screenPoint); + + /// Multiplies two Vuforia pose matrices + /** + * In order to apply a transformation A on top of a transformation B, + * perform: multiply(B,A). + */ + QCAR_API Matrix34F multiply(const Matrix34F& matLeft, + const Matrix34F& matRight); + + /// Multiplies two Vuforia-style 4x4-matrices (row-major order) + QCAR_API Matrix44F multiply(const Matrix44F& matLeft, + const Matrix44F& matRight); + + /// Multiplies 1 vector and 1 Vuforia-style 4x4-matrix (row-major order) + QCAR_API Vec4F multiply(const Vec4F& vec, + const Matrix44F& mat); + + /// Multiplies 1 Vuforia-style 4x4-matrices (row-major order) and 1 vector + QCAR_API Vec4F multiply(const Matrix44F& mat, + const Vec4F& vec); + + /// Multiplies two GL-style matrices (col-major order) + QCAR_API Matrix44F multiplyGL(const Matrix44F& matLeft, + const Matrix44F& matRight); + + /// Sets the translation part of a 3x4 pose matrix + QCAR_API void setTranslation(Matrix34F& pose, + const Vec3F& translation); + + /// Sets the rotation part of a 3x4 pose matrix using axis-angle as input + /** + * The axis parameter defines the 3D axis around which the pose rotates. + * The angle parameter defines the angle in degrees for the rotation + * around that axis. + */ + QCAR_API void setRotation(Matrix34F& pose, + const Vec3F& axis, float angle); + +} // namespace Tool + +} // namespace QCAR + +#endif //_QCAR_TOOL_H_ diff --git a/src/vuforia/include/QCAR/Trackable.h b/src/vuforia/include/QCAR/Trackable.h new file mode 100755 index 0000000..0b4c4ee --- /dev/null +++ b/src/vuforia/include/QCAR/Trackable.h @@ -0,0 +1,69 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Trackable.h + +@brief + Header file for Trackable class. +===============================================================================*/ +#ifndef _QCAR_TRACKABLE_H_ +#define _QCAR_TRACKABLE_H_ + +// Include files +#include +#include +#include +#include + +namespace QCAR +{ + +/// Base class for all objects that can be tracked. +/** + * Every Trackable has a name, an id and a type. + */ +class QCAR_API Trackable : private NonCopyable +{ +public: + + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the Trackable instance's type + virtual Type getType() const = 0; + + /// Checks whether the Trackable instance's type equals or has been + /// derived from a give type + virtual bool isOfType(Type type) const = 0; + + /// Returns a unique id for all 3D trackable objects + virtual int getId() const = 0; + + /// Returns the Trackable's name + virtual const char* getName() const = 0; + + /// Sets the given user data for this Trackable. Returns true if successful + virtual bool setUserData(void* userData) = 0; + + /// Returns the pointer previously set by setUserData() + virtual void* getUserData() const = 0; + + /// Starts extended tracking for this Trackable. Returns true if successful + virtual bool startExtendedTracking() = 0; + + /// Stops extended tracking for this Trackable. Returns true if successful + virtual bool stopExtendedTracking() = 0; + + /// Returns true if extended tracking has been enabled, false otherwise. + virtual bool isExtendedTrackingStarted() const = 0; + + virtual ~Trackable() {} +}; + +} // namespace QCAR + +#endif //_QCAR_TRACKABLE_H_ diff --git a/src/vuforia/include/QCAR/TrackableResult.h b/src/vuforia/include/QCAR/TrackableResult.h new file mode 100755 index 0000000..e541e26 --- /dev/null +++ b/src/vuforia/include/QCAR/TrackableResult.h @@ -0,0 +1,69 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TrackableResult.h + +@brief + Header file for TrackableResult class. +===============================================================================*/ +#ifndef _QCAR_TRACKABLERESULT_H_ +#define _QCAR_TRACKABLERESULT_H_ + +// Include files +#include +#include +#include +#include + +namespace QCAR +{ + +/// Base class for all result objects. +/** + * A TrackableResult is an object that represents the state of a Trackable + * which was found in a given frame. Every TrackableResult has a corresponding + * Trackable, a type, a 6DOF pose and a status (e.g. tracked). + */ +class QCAR_API TrackableResult : private NonCopyable +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the TrackableResult instance's type + virtual Type getType() const = 0; + + /// Checks whether the TrackableResult instance's type equals or has been + /// derived from a give type + virtual bool isOfType(Type type) const = 0; + + /// Status of a TrackableResults + enum STATUS { + UNKNOWN, ///< The state of the TrackableResult is unknown + UNDEFINED, ///< The state of the TrackableResult is not defined + ///< (this TrackableResult does not have a state) + DETECTED, ///< The TrackableResult was detected + TRACKED, ///< The TrackableResult was tracked + EXTENDED_TRACKED ///< The Trackable Result was extended tracked + }; + + /// Returns the tracking status + virtual STATUS getStatus() const = 0; + + /// Returns the corresponding Trackable that this result represents + virtual const Trackable& getTrackable() const = 0; + + /// Returns the current pose matrix in row-major order + virtual const Matrix34F& getPose() const = 0; + + virtual ~TrackableResult() {} +}; + +} // namespace QCAR + +#endif //_QCAR_TRACKABLERESULT_H_ diff --git a/src/vuforia/include/QCAR/TrackableSource.h b/src/vuforia/include/QCAR/TrackableSource.h new file mode 100755 index 0000000..72072ba --- /dev/null +++ b/src/vuforia/include/QCAR/TrackableSource.h @@ -0,0 +1,34 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TrackableSource.h + +@brief + Header file for TrackableSource class. +===============================================================================*/ +#ifndef _QCAR_TRACKABLESOURCE_H_ +#define _QCAR_TRACKABLESOURCE_H_ + +// Include files: +#include +#include + +namespace QCAR +{ + +/// TrackableSource +/** + * An opaque handle for creating a new Trackable in a DataSet. + */ +class QCAR_API TrackableSource : private NonCopyable +{ + +}; + +} // namespace QCAR + +#endif // _QCAR_TRACKABLESOURCE_H_ diff --git a/src/vuforia/include/QCAR/Tracker.h b/src/vuforia/include/QCAR/Tracker.h new file mode 100755 index 0000000..d279011 --- /dev/null +++ b/src/vuforia/include/QCAR/Tracker.h @@ -0,0 +1,53 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Tracker.h + +@brief + Header file for Tracker class. +===============================================================================*/ +#ifndef _QCAR_TRACKER_H_ +#define _QCAR_TRACKER_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Base class for all tracker types. +/** + * The class exposes generic functionality for starting and stopping a + * given Tracker as well as querying the tracker type. + */ +class QCAR_API Tracker : private NonCopyable +{ +public: + + /// Returns the Tracker class' type + static Type getClassType(); + + /// Returns the Tracker instance's type + virtual Type getType() const = 0; + + /// Checks whether the Tracker instance's type equals or has been + /// derived from a give type + virtual bool isOfType(Type type) const = 0; + + /// Starts the Tracker + virtual bool start() = 0; + + /// Stops the Tracker + virtual void stop() = 0; + + virtual ~Tracker() {} +}; + +} // namespace QCAR + +#endif //_QCAR_TRACKER_H_ diff --git a/src/vuforia/include/QCAR/TrackerManager.h b/src/vuforia/include/QCAR/TrackerManager.h new file mode 100755 index 0000000..3647058 --- /dev/null +++ b/src/vuforia/include/QCAR/TrackerManager.h @@ -0,0 +1,67 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + TrackerManager.h + +@brief + Header file for TrackerManager class. +===============================================================================*/ +#ifndef _QCAR_TRACKER_MANAGER_H_ +#define _QCAR_TRACKER_MANAGER_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// TrackerManager class. +/** + * The TrackerManager singleton provides methods for accessing the trackers + * available in Vuforia as well as initializing specific trackers required by the + * application. See the Tracker base class for a list of available tracker + * types. + */ +class QCAR_API TrackerManager : private NonCopyable +{ +public: + /// Returns the TrackerManager singleton instance. + static TrackerManager& getInstance(); + + /// Initializes the tracker of the given type + /** + * Initializing a tracker must not be done when the CameraDevice + * is initialized or started. This function will return NULL if the + * tracker of the given type has already been initialized or if the + * CameraDevice is currently initialized. + */ + virtual Tracker* initTracker(Type type) = 0; + + /// Returns the instance of the given tracker type + /** + * See the Tracker base class for a list of available tracker classes. + * This function will return NULL if the tracker of the given type has + * not been initialized. + */ + virtual Tracker* getTracker(Type type) = 0; + + /// Deinitializes the tracker of the given type + /** + * Deinitializes the tracker of the given type and frees any resources + * used by the tracker. + * Deinitializing a tracker must not be done when the CameraDevice + * is initialized or started. This function will return false if the + * tracker of the given type has not been initialized or if the + * CameraDevice is currently initialized. + */ + virtual bool deinitTracker(Type type) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_TRACKER_MANAGER_H_ diff --git a/src/vuforia/include/QCAR/Type.h b/src/vuforia/include/QCAR/Type.h new file mode 100755 index 0000000..091ec01 --- /dev/null +++ b/src/vuforia/include/QCAR/Type.h @@ -0,0 +1,48 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Type.h + +@brief + Header file for Type class. +===============================================================================*/ +#ifndef _QCAR_TYPE_H_ +#define _QCAR_TYPE_H_ + +// Include files +#include + +namespace QCAR +{ + +/// Class supporting a Vuforia-internal type system +/** + * The size of a Type class instance is only 16 bits, therefore + * it should be passed around by value for efficiency reasons. + */ +class QCAR_API Type +{ +public: + + Type(); + Type(UInt16 data); + + UInt16 getData() const; + + /// Checks whether the type is an exact match with + /// or has been derived from another type: + bool isOfType(const Type type) const; + +private: + /// Internal type data: + UInt16 mData; +}; + +} // namespace QCAR + + +#endif // _QCAR_TYPE_H_ diff --git a/src/vuforia/include/QCAR/UIGLViewProtocol.h b/src/vuforia/include/QCAR/UIGLViewProtocol.h new file mode 100755 index 0000000..289049a --- /dev/null +++ b/src/vuforia/include/QCAR/UIGLViewProtocol.h @@ -0,0 +1,33 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + UIGLViewProtocol.h + +@brief + iOS: Header file for the iOS-specific UIGLViewProtocol protocol. +===============================================================================*/ +#ifndef _UIGLVIEWPROTOCOL_H_ +#define _UIGLVIEWPROTOCOL_H_ + +/** + iOS: This protocol applies only to the iOS platform.
+
+ UIGLViewProtocol protocol. The apps's UIView-derived class may conform to + UIGLViewProtocol to allow QCAR to call the renderFrameQCAR method when it + wishes to render the current frame. This is an informal protocol. The + view hierarchy is traversed asking each node whether it respondsToSelector + renderFrameQCAR. Note: if more than one view in the hierarchy responds to this + selector then only one will be chosen, and it is undefined which that will be. + If no view that responds to renderFrameQCAR is found, then the application + is responsible for scheduling its own rendering. + */ +@protocol UIGLViewProtocol +/// iOS: Called by QCAR to render the current frame +- (void)renderFrameQCAR; +@end + +#endif // _UIGLVIEWPROTOCOL_H_ diff --git a/src/vuforia/include/QCAR/UpdateCallback.h b/src/vuforia/include/QCAR/UpdateCallback.h new file mode 100755 index 0000000..2747c83 --- /dev/null +++ b/src/vuforia/include/QCAR/UpdateCallback.h @@ -0,0 +1,35 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + UpdateCallback.h + +@brief + Header file for UpdateCallback class. +===============================================================================*/ +#ifndef _QCAR_UPDATECALLBACK_H_ +#define _QCAR_UPDATECALLBACK_H_ + +// Include files +#include + +namespace QCAR +{ + +// Forward declarations +class State; + +/// UpdateCallback interface +class QCAR_API UpdateCallback +{ +public: + /// Called by the SDK right after tracking finishes + virtual void QCAR_onUpdate(State& state) = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_UPDATECALLBACK_H_ diff --git a/src/vuforia/include/QCAR/Vectors.h b/src/vuforia/include/QCAR/Vectors.h new file mode 100755 index 0000000..3948521 --- /dev/null +++ b/src/vuforia/include/QCAR/Vectors.h @@ -0,0 +1,134 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Vectors.h + +@brief + Header file for vector structs. +===============================================================================*/ +#ifndef _QCAR_VECTOR_H_ +#define _QCAR_VECTOR_H_ + +namespace QCAR +{ + +/// 2D vector of float items +struct Vec2F +{ + Vec2F() {} + + Vec2F(const float* v) + { + for(int i=0; i<2; i++) + data[i]= v[i]; + } + + Vec2F(float v0, float v1) + { + data[0] = v0; + data[1] = v1; + } + + float data[2]; +}; + + +/// 3D vector of float items +struct Vec3F +{ + Vec3F() {} + + Vec3F(const float* v) + { + for(int i=0; i<3; i++) + data[i]= v[i]; + } + + Vec3F(float v0, float v1, float v2) + { + data[0] = v0; + data[1] = v1; + data[2] = v2; + } + + float data[3]; +}; + + +/// 4D vector of float items +struct Vec4F +{ + Vec4F() {} + + Vec4F(const float* v) + { + for(int i=0; i<4; i++) + data[i]= v[i]; + } + + Vec4F(float v0, float v1, float v2, float v3) + { + data[0] = v0; + data[1] = v1; + data[2] = v2; + data[3] = v3; + } + + float data[4]; +}; + + +/// 2D vector of int items +struct Vec2I +{ + Vec2I() {} + Vec2I(const int* v) + { + for(int i=0; i<2; i++) + data[i]= v[i]; + } + + Vec2I(int v0, int v1) + { + data[0] = v0; + data[1] = v1; + } + + int data[2]; +}; + + +/// 3D vector of int items +struct Vec3I +{ + Vec3I() {} + Vec3I(const int* v) + { + for(int i=0; i<3; i++) + data[i]= v[i]; + } + + int data[3]; +}; + + +/// 4D vector of int items +struct Vec4I +{ + Vec4I() {} + Vec4I(const int* v) + { + for(int i=0; i<4; i++) + data[i]= v[i]; + } + + int data[4]; +}; + +} // namespace QCAR + +#endif //_QCAR_VECTOR_H_ diff --git a/src/vuforia/include/QCAR/VideoBackgroundConfig.h b/src/vuforia/include/QCAR/VideoBackgroundConfig.h new file mode 100755 index 0000000..9fe48dd --- /dev/null +++ b/src/vuforia/include/QCAR/VideoBackgroundConfig.h @@ -0,0 +1,95 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + VideoBackgroundConfig.h + +@brief + Header file for VideoBackgroundConfig struct. +===============================================================================*/ +#ifndef _QCAR_VIDEOBACKGROUNDCONFIG_H_ +#define _QCAR_VIDEOBACKGROUNDCONFIG_H_ + +// Include files +#include + +namespace QCAR +{ + +enum VIDEO_BACKGROUND_REFLECTION +{ + VIDEO_BACKGROUND_REFLECTION_DEFAULT, ///< Allows the SDK to set the recommended reflection settings for the current camera + VIDEO_BACKGROUND_REFLECTION_ON, ///< Overrides the SDK recommendation to force a reflection + VIDEO_BACKGROUND_REFLECTION_OFF ///< Overrides the SDK recommendation to disable reflection +}; + +/// Video background configuration +struct VideoBackgroundConfig +{ + /// Constructor to provide basic initalization. + VideoBackgroundConfig() + { + mEnabled = true; + mSynchronous = true; + mPosition.data[0] = 0; + mPosition.data[1] = 0; + mSize.data[0] = 0; + mSize.data[1] = 0; + mReflection = VIDEO_BACKGROUND_REFLECTION_DEFAULT; + } + + /// Enables/disables rendering of the video background. + bool mEnabled; + + /// Enables/disables synchronization of render and camera frame rate. + /** + * If synchronization is enabled the SDK will attempt to match the + * rendering frame rate with the camera frame rate. This may result + * in a performance gain as potentially redundant render calls are + * avoided. Enabling this is not recommended if your augmented content + * needs to be animated at a rate higher than the rate at which the + * camera delivers frames. + */ + bool mSynchronous; + + /// Relative position of the video background in the render target in + /// pixels. + /** + * Describes the offset of the center of video background to the + * center of the screen (viewport) in pixels. A value of (0,0) centers the + * video background, whereas a value of (-10,15) moves the video background + * 10 pixels to the left and 15 pixels upwards. + */ + Vec2I mPosition; + + /// Width and height of the video background in pixels + /** + * Using the device's screen size for this parameter scales the image to + * fullscreen. Notice that if the camera's aspect ratio is different than + * the screen's aspect ratio this will create a non-uniform stretched + * image. + */ + Vec2I mSize; + + /// Reflection parameter to control how the video background is rendered + /** + * By setting this to VIDEO_BACKGROUND_REFLECTION_DEFAULT, the SDK will + * update the projection matrix and video background automatically to provide + * the best AR mode possible for the given camera on your specific device. + * For the BACK camera, this will generally result in no reflection at all. + * For the FRONT camera, this will generally result in a reflection to provide + * an "AR Mirror" effect. + * + * This can also be overridden by selecting VIDEO_BACKGROUND_REFLECTION_ON or + * VIDEO_BACKGROUND_REFLECTION_OFF. This may be desirable in advanced use + * cases. + */ + VIDEO_BACKGROUND_REFLECTION mReflection; +}; + +} // namespace QCAR + +#endif //_QCAR_RENDERER_H_ diff --git a/src/vuforia/include/QCAR/VideoBackgroundTextureInfo.h b/src/vuforia/include/QCAR/VideoBackgroundTextureInfo.h new file mode 100755 index 0000000..355a8f0 --- /dev/null +++ b/src/vuforia/include/QCAR/VideoBackgroundTextureInfo.h @@ -0,0 +1,51 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + VideoBackgroundConfig.h + +@brief + Header file for VideoBackgroundConfig struct. +===============================================================================*/ +#ifndef _QCAR_VIDEOBACKGROUNDTEXTUREINFO_H_ +#define _QCAR_VIDEOBACKGROUNDTEXTUREINFO_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +/// Video background configuration +struct VideoBackgroundTextureInfo +{ + /// Width and height of the video background texture in pixels + /** + * Describes the size of the texture in the graphics unit + * depending on the particular hardware it will be a power of two + * value immediately after the image size + */ + Vec2I mTextureSize; + + /// Width and height of the video background image in pixels + /** + * Describe the size of the image inside the texture. This corresponds + * to the size of the image delivered by the camera + */ + Vec2I mImageSize; + + /// Format of the video background image + /** + * Describe the pixel format of the camera image. + */ + PIXEL_FORMAT mPixelFormat; + +}; + +} // namespace QCAR + +#endif //_QCAR_VIDEOBACKGROUNDTEXTUREINFO_H_ diff --git a/src/vuforia/include/QCAR/VideoMode.h b/src/vuforia/include/QCAR/VideoMode.h new file mode 100755 index 0000000..2934bc7 --- /dev/null +++ b/src/vuforia/include/QCAR/VideoMode.h @@ -0,0 +1,32 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + VideoMode.h + +@brief + Header file for VideoMode struct. +===============================================================================*/ +#ifndef _QCAR_VIDEOMODE_H_ +#define _QCAR_VIDEOMODE_H_ + +namespace QCAR +{ + +/// Implements access to the phone's built-in camera +struct VideoMode +{ + + VideoMode() : mWidth(0), mHeight(0), mFramerate(0.f) {} + + int mWidth; ///< Video frame width + int mHeight; ///< Video frame height + float mFramerate; ///< Video frame rate +}; + +} // namespace QCAR + +#endif // _QCAR_VIDEOMODE_H_ diff --git a/src/vuforia/include/QCAR/VirtualButton.h b/src/vuforia/include/QCAR/VirtualButton.h new file mode 100755 index 0000000..e00243b --- /dev/null +++ b/src/vuforia/include/QCAR/VirtualButton.h @@ -0,0 +1,83 @@ +/*=============================================================================== +Copyright (c) 2010-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + VirtualButton.h + +@brief + Header file for VirtualButton class. +===============================================================================*/ +#ifndef _QCAR_VIRTUALBUTTON_H_ +#define _QCAR_VIRTUALBUTTON_H_ + +// Include files +#include +#include + +namespace QCAR +{ + +class Area; + + +/// A virtual button on a trackable +/** + * Methods to modify a VirtualButton must not be called while the + * corresponding DataSet is active. The dataset must be deactivated first + * before reconfiguring a VirtualButton. + */ +class QCAR_API VirtualButton : private NonCopyable +{ +public: + /// Sensitivity of press detection + enum SENSITIVITY { + HIGH, ///< Fast detection + MEDIUM, ///< Balananced between fast and robust + LOW ///< Robust detection + }; + + /// Defines a new area for the button area in 3D scene units (the + /// coordinate system is local to the ImageTarget). + /** + * This method must not be called while the corresponding DataSet is + * active or it will return false. + */ + virtual bool setArea(const Area& area) = 0; + + /// Returns the currently set Area + virtual const Area& getArea() const = 0; + + /// Sets the sensitivity of the virtual button + /** + * Sensitivity allows deciding between fast and robust button press + * measurements. This method must not be called while the corresponding + * DataSet is active or it will return false. + */ + virtual bool setSensitivity(SENSITIVITY sensitivity) = 0; + + /// Enables or disables a virtual button + /** + * This method must not be called while the corresponding DataSet is + * active or it will return false. + */ + virtual bool setEnabled(bool enabled) = 0; + + /// Returns true if the virtual button is active (updates while tracking). + virtual bool isEnabled() const = 0; + + /// Returns the name of the button as ASCII string. + virtual const char* getName() const = 0; + + /// Returns a unique id for this virtual button. + virtual int getID() const = 0; + +protected: + virtual ~VirtualButton() {} +}; + +} // namespace QCAR + +#endif //_QCAR_VIRTUALBUTTON_H_ diff --git a/src/vuforia/include/QCAR/VirtualButtonResult.h b/src/vuforia/include/QCAR/VirtualButtonResult.h new file mode 100755 index 0000000..d568d4b --- /dev/null +++ b/src/vuforia/include/QCAR/VirtualButtonResult.h @@ -0,0 +1,41 @@ +/*=============================================================================== +Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + VirtualButtonResult.h + +@brief + Header file for VirtualButtonResult class. +===============================================================================*/ +#ifndef _QCAR_VIRTUALBUTTONRESULT_H_ +#define _QCAR_VIRTUALBUTTONRESULT_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +/// Tracking result for a VirtualButton. +class QCAR_API VirtualButtonResult : private NonCopyable +{ +public: + + /// Returns the corresponding VirtualButton that this result represents + virtual const VirtualButton& getVirtualButton() const = 0; + + /// Returns true if the virtual button is pressed. + virtual bool isPressed() const = 0; + +protected: + virtual ~VirtualButtonResult() {} +}; + +} // namespace QCAR + +#endif //_QCAR_VIRTUALBUTTONRESULT_H_ diff --git a/src/vuforia/include/QCAR/Word.h b/src/vuforia/include/QCAR/Word.h new file mode 100755 index 0000000..790035e --- /dev/null +++ b/src/vuforia/include/QCAR/Word.h @@ -0,0 +1,64 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + Word.h + +@brief + Header file for Word class. +===============================================================================*/ +#ifndef _QCAR_WORD_H_ +#define _QCAR_WORD_H_ + +// Include files +#include +#include +#include +#include +#include + +namespace QCAR +{ + +/// A Word represents a single element of writing. +class QCAR_API Word : public Trackable +{ +public: + /// Returns the Trackable class' type + static Type getClassType(); + + /// Returns the Unicode character string for this word. + virtual const UInt16* getStringU() const = 0; + + /// Returns the number of characters in the string excluding the null + /// terminator. + virtual int getLength() const = 0; + + /// Returns the number of code units in the Unicode string. + virtual int getNumCodeUnits() const = 0; + + /// Returns the size (width and height) of the word bounding box + ///(in 3D scene units). + virtual Vec2F getSize() const = 0; + + /// Returns an image representing the bit mask of the letters in the word. + /** + * Each pixel in the image is represented by a byte (8-bit value). + * A value of 255 represents an empty area, i.e. a pixel not covered + * by any letter of the word. + * If a pixel is covered by a letter, then the pixel value represents + * the position of that letter in the word, i.e. 0 for the first character, + * 1 for the second, 2 for the third, and so on. + */ + virtual const Image* getMask() const = 0; + + /// Returns the bounding box of the letter at the given index. + virtual const Rectangle* getLetterBoundingBox(int idx) const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_WORD_H_ diff --git a/src/vuforia/include/QCAR/WordList.h b/src/vuforia/include/QCAR/WordList.h new file mode 100755 index 0000000..4ccd369 --- /dev/null +++ b/src/vuforia/include/QCAR/WordList.h @@ -0,0 +1,192 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + WordList.h + +@brief + Header file for WordList class. +===============================================================================*/ +#ifndef _QCAR_WORD_LIST_H_ +#define _QCAR_WORD_LIST_H_ + +#include +#include +#include + +namespace QCAR +{ + +/// A list of words that the TextTracker can detect and track +/** + * The WordList represents the set of detectable Words. This list is + * loaded from a binary data file using loadWordList. + * By default a WordList for the English language is provided with the SDK. + * The application may choose to add a small set of additional custom words to + * the WordList using the APIs below. + * The filter list allows an application to specify a subset of Words + * from the WordList that will be detected and tracked. + * Due to the large number of words in the WordList it is not possible to + * query the contents of the WordList at run-time. + * Note that the TextTracker needs to be stopped prior to making modifications + * to the WordList. + */ +class QCAR_API WordList : public NonCopyable +{ +public: + + /// Deprecated enum. Use QCAR::STORAGE_TYPE instead. + /// Types of storage locations + enum STORAGE_TYPE { + STORAGE_APP, ///< Storage private to the application + STORAGE_APPRESOURCE, ///< Storage for assets bundled with the + ///< application + STORAGE_ABSOLUTE ///< Helper type for specifying an absolute path + }; + + /// Types of filter modes + enum FILTER_MODE { + FILTER_MODE_NONE, ///< Word filtering is disabled + FILTER_MODE_BLACK_LIST, ///< Prevent specific words from being detected + FILTER_MODE_WHITE_LIST ///< Enable selected words only to be detected + }; + + /// Loads the word list from a binary file at the specified path + /// and storage location. + /** + * Loads the word list from the given input file. + * Returns false if the path is NULL. + */ + virtual bool loadWordList(const char* path, QCAR::STORAGE_TYPE storageType) = 0; + + /// Loads the word list from a binary file at the specified path + /// and storage location. + /** + * Loads the word list from the given input file. + * Returns false if the path is NULL. + * + * This version is now deprecated, please use QCAR::STORAGE_TYPE based + * method instead. + */ + virtual bool loadWordList(const char* path, STORAGE_TYPE storageType) = 0; + + /// Loads a set of custom words from a plain text file + /** + * The word list is extended with the custom words in the plain text file. + * Each word must be between 2-45 characters in length. Returns the + * number of loaded custom words. The text file shall be encoded in UTF-8. + * If path is NULL the return value is -1. + */ + virtual int addWordsFromFile(const char* path, QCAR::STORAGE_TYPE storageType) = 0; + + /// Loads a set of custom words from a plain text file + /** + * The word list is extended with the custom words in the plain text file. + * Each word must be between 2-45 characters in length. Returns the + * number of loaded custom words. The text file shall be encoded in UTF-8. + * If path is NULL the return value is -1. + * + * This version is now deprecated, please use QCAR::STORAGE_TYPE based + * method instead. + */ + virtual int addWordsFromFile(const char* path, STORAGE_TYPE storageType) = 0; + + /// Add a single custom word to the word list (Unicode) + /** + * Use containsWord to check if the word is already in the word list prior + * calling this. + * Returns false if word is NULL; + */ + virtual bool addWordU(const UInt16* word) = 0; + + /// Remove a custom word from the word list (Unicode) + virtual bool removeWordU(const UInt16* word) = 0; + + /// Returns true if the given word is present in the WordList (Unicode) + /** + * This function can be used to check if a word already exists in the + * WordList prior to adding it as a custom word. + * Returns false if word is NULL; + */ + virtual bool containsWordU(const UInt16* word) = 0; + + /// Clears the word list as well as the filter list. + /** + * Call this to reset the word list and release all acquired system + * resources. + * Return false if word is NULL; + */ + virtual bool unloadAllLists() = 0; + + /// Sets the mode for the filter list + /** + * The filter list allows an application to specify a subset of Words + * from the word list that will be detected and tracked. It can do this + * in two modes of operation. In black list mode, any word in the filter + * list will be prevented from being detected. In the white list mode, + * only words in the the filter list can be detected. + * By default the filter mode is FILTER_MODE_NONE where no words are + * filtered. + */ + virtual bool setFilterMode(FILTER_MODE mode) = 0; + + /// Returns the filter mode. + virtual FILTER_MODE getFilterMode() const = 0; + + /// Add a single word to the filter list (Unicode) + /** + * Adds a word to the filter list. + * Returns true if successful, false if unsuccessful or if word + * is NULL. + */ + virtual bool addWordToFilterListU(const UInt16* word) = 0; + + /// Remove a word from the filter list (Unicode) + /** + * Remove a word from the filter list + * Returns true if successful, false if unsuccessful or if word + * is NULL. + */ + virtual bool removeWordFromFilterListU(const UInt16* word) = 0; + + /// Clear the filter list. + virtual bool clearFilterList() = 0; + + /// Loads the filter list from a plain text file. + /** + * The text file shall be encoded in UTF-8. + * Returns false if the filter list cannot be loaded. Note + * some words may have been added to the filter list so it + * may be necessary to call getFilterListWordCount to find + * out what, if any, words have been loaded by this routine + * if it fails. + * + * This version is now deprecated, please use QCAR::STORAGE_TYPE based + * method instead. + */ + virtual bool loadFilterList(const char* path, STORAGE_TYPE storageType) = 0; + + /// Loads the filter list from a plain text file. + /** + * The text file shall be encoded in UTF-8. + * Returns false if the filter list cannot be loaded. Note + * some words may have been added to the filter list so it + * may be necessary to call getFilterListWordCount to find + * out what, if any, words have been loaded by this routine + * if it fails. + */ + virtual bool loadFilterList(const char* path, QCAR::STORAGE_TYPE storageType) = 0; + + /// Query the number of words in the filter list. + virtual int getFilterListWordCount() = 0; + + /// Return the ith element in the filter list (Unicode) + virtual const UInt16* getFilterListWordU(int i) = 0; + +}; +} // namespace QCAR + +#endif /* _QCAR_WORD_LIST_H_ */ diff --git a/src/vuforia/include/QCAR/WordResult.h b/src/vuforia/include/QCAR/WordResult.h new file mode 100755 index 0000000..b5764f9 --- /dev/null +++ b/src/vuforia/include/QCAR/WordResult.h @@ -0,0 +1,41 @@ +/*=============================================================================== +Copyright (c) 2013-2014 Qualcomm Connected Experiences, Inc. All Rights Reserved. + +Vuforia is a trademark of QUALCOMM Incorporated, registered in the United States +and other countries. Trademarks of QUALCOMM Incorporated are used with permission. + +@file + WordResult.h + +@brief + Header file for WordResult class. +===============================================================================*/ +#ifndef _QCAR_WORDRESULT_H_ +#define _QCAR_WORDRESULT_H_ + +// Include files +#include +#include +#include + +namespace QCAR +{ + +/// Trackable result for a Word. +class QCAR_API WordResult : public TrackableResult +{ +public: + + /// Returns the TrackableResult class' type + static Type getClassType(); + + /// Returns the corresponding Trackable that this result represents. + virtual const Word& getTrackable() const = 0; + + /// Returns the oriented bounding box in image space of the word. + virtual const Obb2D& getObb() const = 0; +}; + +} // namespace QCAR + +#endif //_QCAR_WORDRESULT_H_ diff --git a/src/vuforia/jniLibs/armeabi/libVuforia.so b/src/vuforia/jniLibs/armeabi/libVuforia.so new file mode 100755 index 0000000..9d0976c Binary files /dev/null and b/src/vuforia/jniLibs/armeabi/libVuforia.so differ diff --git a/src/vuforia/lib/arm/libVuforia.a b/src/vuforia/lib/arm/libVuforia.a new file mode 100755 index 0000000..3801703 Binary files /dev/null and b/src/vuforia/lib/arm/libVuforia.a differ