@@ -29,13 +29,18 @@ ARjs.Context = THREEx.ArToolkitContext = function (parameters) {
2929 // the patternRatio inside the artoolkit marker - artoolkit only
3030 patternRatio : 0.5 ,
3131
32+ // Labeling mode for markers - ['black_region', 'white_region']
33+ // black_region: Black bordered markers on a white background, white_region: White bordered markers on a black background
34+ labelingMode : 'black_region' ,
35+
3236 // enable image smoothing or not for canvas copy - default to true
3337 // https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/imageSmoothingEnabled
3438 imageSmoothingEnabled : false ,
3539 }
3640 // parameters sanity check
3741 console . assert ( [ 'artoolkit' ] . indexOf ( this . parameters . trackingBackend ) !== - 1 , 'invalid parameter trackingBackend' , this . parameters . trackingBackend )
3842 console . assert ( [ 'color' , 'color_and_matrix' , 'mono' , 'mono_and_matrix' ] . indexOf ( this . parameters . detectionMode ) !== - 1 , 'invalid parameter detectionMode' , this . parameters . detectionMode )
43+ console . assert ( [ "black_region" , "white_region" ] . indexOf ( this . parameters . labelingMode ) !== - 1 , "invalid parameter labelingMode" , this . parameters . labelingMode ) ;
3944
4045 this . arController = null ;
4146
@@ -247,6 +252,15 @@ ARjs.Context.prototype._initArtoolkit = function (onCompleted) {
247252 // set the patternRatio for artoolkit
248253 arController . setPattRatio ( _this . parameters . patternRatio ) ;
249254
255+ // set the labelingMode for artoolkit
256+ var labelingModeTypes = {
257+ "black_region" : artoolkit . AR_LABELING_BLACK_REGION ,
258+ "white_region" : artoolkit . AR_LABELING_WHITE_REGION
259+ }
260+ var labelingModeType = labelingModeTypes [ _this . parameters . labelingMode ] ;
261+ console . assert ( labelingModeType !== undefined ) ;
262+ arController . setLabelingMode ( labelingModeType ) ;
263+
250264 // set thresholding in artoolkit
251265 // this seems to be the default
252266 // arController.setThresholdMode(artoolkit.AR_LABELING_THRESH_MODE_MANUAL)
0 commit comments