Class: Skarf

SKARF. Skarf

new Skarf(options)

Class which handles different augmented reality libraries
Parameters:
Name Type Description
options object Options
Properties
Name Type Argument Default Description
arLibType string ArLib type: 'jsartoolkit, 'jsaruco'
trackingElem video | img | canvas DOM element used for tracking, such as a video, img or canvas
markerSize number Size of marker in mm, determines scale of scene
verticalFov number <optional>
Vertical field-of-view of web cam (you will have to estimate this). For JSARToolKit,, if this is not defined, it will use a generic vertical field-of-view which seems to work well for general web cams.
threshold number <optional>
128 Threshold value for turning tracking stream into a binary image. Ranges from 0 to 255. Used only for JSARToolKit.
debug boolean <optional>
false Whether to turn on debug view/mode
canvasContainerElem canvas <optional>
Div DOM element to append a newly-created tracking canvas to. If not specified, the newly-created canvas will just be appended to the body DOM element.
rendererType string Renderer type: 'threejs'
renderer THREE.WebGLRenderer Three.js renderer
scene THREE.Scene Three.js scene
camera THREE.Camera Three.js camera
markersJsonFile string Path to a JSON file that specifies markers and models to load
Source:

Methods

addCallback(type, callbackFn)

Adds a callback function that will be called during specific events
Parameters:
Name Type Description
type string Type of callback: 'render' (only choice available now)
callbackFn function Callback function to call
Source:

getArLib() → {SKARF.ArLib}

Returns the AR lib associated with this instance
Source:
Returns:
AR lib
Type
SKARF.ArLib

getRenderer() → {SKARF.Renderer}

Returns the renderer associated with this instance
Source:
Returns:
Renderer
Type
SKARF.Renderer

initCameraProjMatrix()

Inits camera projection matrix, used only for JSARToolKit. This is called automatically during initialization. Call this function only if you need to re-initialize the camera projection matrix again.
Source:

mainMarkerDetected() → {bool}

Returns true if the designated main marker has been detected
Source:
Returns:
True if the designated main marker has been detected
Type
bool

update(dt)

Draws tracking data to canvas, and then updates both the AR lib and renderer
Parameters:
Name Type Description
dt number Elapsed time since previous frame
Source: