diff --git a/data/largeLambda.patt b/data/largeLambda.patt new file mode 100755 index 0000000..c789354 --- /dev/null +++ b/data/largeLambda.patt @@ -0,0 +1,195 @@ + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 255 0 0 255 255 255 255 0 0 + 0 119 255 255 255 0 0 255 255 0 0 255 255 255 0 0 + 0 119 255 255 0 0 255 255 255 255 0 0 255 255 0 0 + 0 119 254 0 0 255 255 255 255 255 255 0 0 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 254 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 255 0 0 255 255 255 255 0 0 + 0 119 255 255 255 0 0 255 255 0 0 255 255 255 0 0 + 0 119 255 255 0 0 255 255 255 255 0 0 255 255 0 0 + 0 119 254 0 0 255 255 255 255 255 255 0 0 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 254 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 255 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 255 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 0 0 255 255 255 255 255 0 0 + 0 119 255 255 255 255 0 255 0 0 255 255 255 255 0 0 + 0 119 255 255 255 0 0 255 255 0 0 255 255 255 0 0 + 0 119 255 255 0 0 255 255 255 255 0 0 255 255 0 0 + 0 119 254 0 0 255 255 255 255 255 255 0 0 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 254 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 0 0 255 255 255 255 0 + 0 0 255 255 255 255 0 0 0 0 255 255 255 255 255 0 + 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 + 0 0 255 255 255 255 255 255 0 0 0 255 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 255 0 + 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 0 0 255 255 255 255 0 + 0 0 255 255 255 255 0 0 0 0 255 255 255 255 255 0 + 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 + 0 0 255 255 255 255 255 255 0 0 0 255 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 255 0 + 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 0 0 255 255 255 255 0 + 0 0 255 255 255 255 0 0 0 0 255 255 255 255 255 0 + 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 + 0 0 255 255 255 255 255 255 0 0 0 255 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 0 0 255 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 0 0 255 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 0 0 255 0 + 0 0 255 255 255 255 255 255 255 255 255 255 255 0 255 0 + 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 255 0 0 255 255 255 255 255 255 0 0 255 120 0 + 0 0 255 255 0 0 255 255 255 255 0 0 255 255 120 0 + 0 0 255 255 255 0 0 255 255 0 0 255 255 255 120 0 + 0 0 255 255 255 255 0 0 255 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 255 0 0 255 255 255 255 255 255 0 0 255 120 0 + 0 0 255 255 0 0 255 255 255 255 0 0 255 255 120 0 + 0 0 255 255 255 0 0 255 255 0 0 255 255 255 120 0 + 0 0 255 255 255 255 0 0 255 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 255 255 255 255 255 255 255 255 0 0 0 0 + 0 0 255 0 0 255 255 255 255 255 255 0 0 255 120 0 + 0 0 255 255 0 0 255 255 255 255 0 0 255 255 120 0 + 0 0 255 255 255 0 0 255 255 0 0 255 255 255 120 0 + 0 0 255 255 255 255 0 0 255 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 0 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 0 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 255 255 255 255 255 255 0 255 255 255 255 255 120 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 + 0 255 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 + 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 + 0 255 255 255 255 255 0 0 0 0 255 255 255 255 0 0 + 0 255 255 255 255 0 0 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 + 0 255 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 + 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 + 0 255 255 255 255 255 0 0 0 0 255 255 255 255 0 0 + 0 255 255 255 255 0 0 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 120 120 120 120 120 120 120 120 120 120 120 0 0 + 0 255 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 255 255 0 0 0 255 255 255 255 255 255 0 0 + 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 + 0 255 255 255 255 255 0 0 0 0 255 255 255 255 0 0 + 0 255 255 255 255 0 0 255 255 255 255 255 255 255 0 0 + 0 255 255 255 0 0 255 255 255 255 255 255 255 255 0 0 + 0 255 255 0 0 255 255 255 255 255 255 255 255 255 0 0 + 0 255 0 0 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 255 255 255 255 255 255 255 255 255 255 255 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/img/LargeLambda.png b/img/LargeLambda.png new file mode 100644 index 0000000..b3290fd Binary files /dev/null and b/img/LargeLambda.png differ diff --git a/index copy.html b/index copy.html new file mode 100644 index 0000000..6ba76e0 --- /dev/null +++ b/index copy.html @@ -0,0 +1,820 @@ + + + + Configure AR Cube + + + + + + + + + + + + + + + + + + +
+
Large 'Lambda' Maker
+
+ + + +
+ +
+ + + +
+ + +
+ + + +
+
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+ +
+ + +
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ +
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ + +
+ + + +
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ + + +
+ +
+ + + +
+ + + +
+ +
+ + + + + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 8db63e7..a0878fa 100644 --- a/index.html +++ b/index.html @@ -21,7 +21,7 @@
-
'Lambda' Maker
+
Large 'Lambda' Maker
@@ -64,19 +64,19 @@
- - + +
- +
- - + +
- +

@@ -89,50 +89,50 @@
- - + +
- - + +

- - + +
- - + +
- - + +
- - + +
- - + +
- +
@@ -178,22 +178,22 @@ RotationY: 0, RotationZ: 0, - cubeSizeX: 1.25, - cubeSizeY: 1.25, - cubeSizeZ: 1.25, - + cubeSizeX: 17.3,//17.053,//1.25, + cubeSizeY: 17.3,//17.053,//1.25, + cubeSizeZ: 17.3,//17.053,//1.25, + cubePositionX: 0, - cubePositionY: 0, - cubePositionZ: 0, + cubePositionY: -10, + cubePositionZ: -8.5, //active smoothing: - lerpPositionAmount: 0.8, - lerpQuaternionAmount: 0.8, - lerpScaleAmount: 1, + lerpPositionAmount: 0.1, + lerpQuaternionAmount: 0.5, + lerpScaleAmount: .5, //Passive Smoothing: smoothCountAmount: 5, - smoothToleranceAmount: 0.01, - smoothThresholdAmount: 2, + smoothToleranceAmount: 0.75, + smoothThresholdAmount: 3, getLerpPositionAmount: function () { return Number(this.lerpPositionAmount); @@ -482,7 +482,7 @@ //let markerControls1 = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, { let markerControls1 = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, { type: 'pattern', - patternUrl: "data/kanji.patt", + patternUrl: "data/LargeLambda.patt", smooth: true, // number of matrices to smooth tracking over, more = smoother but slower follow smoothCount: userInputs.getSmoothCountAmount(), //5, diff --git a/markers/LargeLambda.png b/markers/LargeLambda.png new file mode 100644 index 0000000..b6eaebf Binary files /dev/null and b/markers/LargeLambda.png differ diff --git a/old-index.html b/old-index.html index 6af1bf3..8db63e7 100644 --- a/old-index.html +++ b/old-index.html @@ -12,6 +12,8 @@ + + @@ -19,21 +21,21 @@
-
'Hiro' Maker
-
+
'Lambda' Maker
+
-
+
-
+
@@ -96,6 +98,45 @@
+
+ + +
+ + + +
+
+ + + +
+ +
+ + + +
+ +
+ + + +
+
+ + + +
+ +
+ + + +
+ + +
@@ -123,6 +164,7 @@ var arToolkitSource, arToolkitContext; var markerRoot1, markerRoot2; +//var smoothedRoot, makerRoot2; var cube; @@ -136,13 +178,65 @@ RotationY: 0, RotationZ: 0, - cubeSizeX: 1, - cubeSizeY: 1, - cubeSizeZ: 1, + cubeSizeX: 1.25, + cubeSizeY: 1.25, + cubeSizeZ: 1.25, cubePositionX: 0, cubePositionY: 0, cubePositionZ: 0, + //active smoothing: + lerpPositionAmount: 0.8, + lerpQuaternionAmount: 0.8, + lerpScaleAmount: 1, + + //Passive Smoothing: + smoothCountAmount: 5, + smoothToleranceAmount: 0.01, + smoothThresholdAmount: 2, + + getLerpPositionAmount: function () { + return Number(this.lerpPositionAmount); + }, + setLerpPositionAmount: function (input) { + this.lerpPositionAmount = Number(input); + }, + + getLerpQuaternionAmount: function () { + return Number(this.lerpQuaternionAmount); + }, + setLerpQuaternionAmount: function (input) { + this.lerpQuaternionAmount = Number(input); + }, + + getLerpScaleAmount: function () { + return Number(this.lerpScaleAmount); + }, + setLerpScaleAmount: function (input) { + this.lerpScaleAmount = Number(input); + }, + +//passive smoothing + getSmoothCountAmount: function () { + return Number(this.lerpSmoothCountAmount); + }, + setSmoothCountAmount: function (input) { + this.smoothCountAmount = Number(input); + }, + + getSmoothToleranceAmount: function () { + return Number(this.smoothToleranceAmount); + }, + setSmoothToleranceAmount: function (input) { + this.smoothToleranceAmount = Number(input); + }, + + getSmoothThresholdAmount: function () { + return Number(this.smoothThresholdAmount); + }, + setSmoothThresholdAmount: function (input) { + this.smoothThresholdAmount = Number(input); + }, getRotationspeedX: function () { return Number(this.RotationspeedX); @@ -191,21 +285,30 @@ return this.cubeSizeX; }, setCubeSizeX: function (input) { - this.cubeSizeX = input; + //The printed marker takes up 80% of the total printed size + //This means if you print a 10 inch marker, it only displays as 8 inches + //To correct this, increase the size by 25% + this.cubeSizeX = input * 1.25; }, getCubeSizeY: function () { return this.cubeSizeY; }, setCubeSizeY: function (input) { - this.cubeSizeY = input; + //The printed marker takes up 80% of the total printed size + //This means if you print a 10 inch marker, it only displays as 8 inches + //To correct this, increase the size by 25% + this.cubeSizeY = input * 1.25; }, getCubeSizeZ: function () { return this.cubeSizeZ; }, setCubeSizeZ: function (input) { - this.cubeSizeZ = input; + //The printed marker takes up 80% of the total printed size + //This means if you print a 10 inch marker, it only displays as 8 inches + //To correct this, increase the size by 25% + this.cubeSizeZ = input * 1.25; }, getCubePositionX: function () { @@ -267,7 +370,28 @@ var rotationSpeedSliderY = document.querySelector ('#rotationSpeedUpdateY'); var rotationSpeedSliderZ = document.querySelector ('#rotationSpeedUpdateZ'); -initialize(); + //Lerp Smoothing + var monitorLerpPositionAmount = document.querySelector ('#lerpPositionAmount'); + var monitorLerpPositionAmountSlider = document.querySelector ('#lerpPositionAmountSlider'); + + var monitorLerpQuaternionAmount = document.querySelector ('#lerpQuaternionAmount'); + var monitorLerpQuaternionAmountSlider = document.querySelector ('#lerpQuaternionAmountSlider'); + + var monitorLerpScaleAmount = document.querySelector ('#lerpScaleAmount'); + var monitorLerpScaleAmountSlider = document.querySelector ('#lerpScaleAmountSlider'); + + //Passive Smoothing + var monitorSmoothCountAmount = document.querySelector ('#smoothCountAmount'); + var monitorSmoothCountAmountSlider = document.querySelector ('#smoothCountAmountSlider'); + + var monitorSmoothToleranceAmount = document.querySelector ('#smoothToleranceAmount'); + var monitorSmoothToleranceAmountSlider = document.querySelector ('#smoothToleranceAmountSlider'); + + var monitorSmoothThresholdAmount = document.querySelector ('#smoothThresholdAmount'); + var monitorSmoothThresholdAmountSlider = document.querySelector ('#smoothThresholdAmountSlider'); + + + initialize(); animate(); function initialize() @@ -343,35 +467,81 @@ //////////////////////////////////////////////////////////// // setup markerRoots //////////////////////////////////////////////////////////// - - // build markerControls - markerRoot1 = new THREE.Group(); - scene.add(markerRoot1); - let markerControls1 = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, { - type: 'pattern', patternUrl: "data/hiro.patt", + + // build markerControls + markerRoot1 = new THREE.Group(); + scene.add(markerRoot1); + + //Build a soothed marker root + let smoothedRoot = new THREE.Group(); + + //markerRoot1 = new THREE.Group(); + //scene.add(markerRoot1); + + scene.add(smoothedRoot); + //let markerControls1 = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, { + let markerControls1 = new THREEx.ArMarkerControls(arToolkitContext, markerRoot1, { + type: 'pattern', + patternUrl: "data/kanji.patt", + smooth: true, + // number of matrices to smooth tracking over, more = smoother but slower follow + smoothCount: userInputs.getSmoothCountAmount(), //5, + // distance tolerance for smoothing, if smoothThreshold # of matrices are under tolerance, tracking will stay still + smoothTolerance: userInputs.getSmoothToleranceAmount(),//0.01, + // threshold for smoothing, will keep still unless enough matrices are over tolerance + smoothThreshold: userInputs.getSmoothThresholdAmount()//2, }) - let geometry1 = new THREE.CubeGeometry(1,1,1); + let geometry1 = new THREE.CubeGeometry(1,1,1); - let material1 = new THREE.MeshNormalMaterial({ + let material1 = new THREE.MeshNormalMaterial({ transparent: true, opacity: 0.5, side: THREE.DoubleSide }); + let textureOpacity = 0.75; + + var cubeMaterial = [ new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }), //RIGHT SIDE + new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }), //LEFT SIDE + new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }), //TOP SIDE + new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }), //BOTTOM SIDE + new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }), //FRONT SIDE + new THREE.MeshBasicMaterial({ map: new THREE.TextureLoader().load('img/CarbonTexture_01.png'), transparent: true, opacity: textureOpacity, side: THREE.DoubleSide }) //BACK SIDE + ]; + + var material2 = new THREE.MeshFaceMaterial( cubeMaterial ); - cube = new THREE.Mesh( geometry1, material1 ); + //cube = new THREE.Mesh( geometry1, material1 ); + cube = new THREE.Mesh( geometry1, material2 ); //Imported Texture + //cube.position.y = 1; //cube.rotation.x = -0.45; - markerRoot1.add( cube ); + //stablizing cube + smoothedControls = new THREEx.ArSmoothedControls(smoothedRoot, { + lerpPosition: userInputs.getLerpPositionAmount(), + lerpQuaternion: userInputs.getLerpQuaternionAmount(), + lerpScale: userInputs.getLerpScaleAmount(), + // minVisibleDelay: 1, + // minUnvisibleDelay: 1, + }); + + //markerRoot1.add( cube ); + smoothedRoot.add( cube ); + } function update() { // update artoolkit on every frame - if ( arToolkitSource.ready !== false ) + if ( arToolkitSource.ready !== false ){ arToolkitContext.update( arToolkitSource.domElement ); + } + + // additional code for smoothed controls + smoothedControls.update(markerRoot1); + } @@ -490,8 +660,80 @@ monitorcubePositionZ.value = passedValue; }; + //Lerp contols + + var outputUpdateLerpPositionAmount = function(passedValue){ + userInputs.setLerpPositionAmount(passedValue); + monitorLerpPositionAmount.value = passedValue; + }; + + var outputUpdateLerpQuaternionAmount = function(passedValue){ + userInputs.setLerpQuaternionAmount(passedValue); + monitorLerpQuaternionAmount.value = passedValue; + }; + + var outputUpdateLerpScaleAmount = function(passedValue){ + userInputs.setLerpScaleAmount(passedValue); + monitorLerpScaleAmount.value = passedValue; + }; + + //Passive Smoothing + var outputUpdateSmoothCountAmount = function(passedValue){ + userInputs.setSmoothCountAmount(passedValue); + monitorSmoothCountAmount.value = passedValue; + }; + + var outputUpdateSmoothThresholdAmount = function(passedValue){ + userInputs.setSmoothThresholdAmount(passedValue); + monitorSmoothThresholdAmount.value = passedValue; + }; + + var outputUpdateSmoothToleranceAmount = function(passedValue){ + userInputs.setSmoothToleranceAmount(passedValue); + monitorSmoothToleranceAmount.value = passedValue; + }; + + //Dom interface + //Lerp Listeners for the input boxes + monitorLerpPositionAmount.addEventListener('input', function(){ + userInputs.setLerpPositionAmount(monitorLerpPositionAmount.value); + LerpPositionAmountSlider.value = monitorLerpPositionAmount.value; + console.log("setting userInputs to: " + monitorLerpPositionAmount.value) + }, false); + + monitorLerpQuaternionAmount.addEventListener('input', function(){ + userInputs.setLerpQuaternionAmount(monitorLerpQuaternionAmount.value); + LerpQuaternionAmountSlider.value = monitorLerpQuaternionAmount.value; + console.log("setting userInputs to: " + monitorLerpQuaternionAmount.value) + }, false); + + monitorLerpScaleAmount.addEventListener('input', function(){ + userInputs.setLerpScaleAmount(monitorLerpScaleAmount.value); + LerpScaleAmountSlider.value = monitorLerpScaleAmount.value; + console.log("setting userInputs to: " + monitorLerpScaleAmount.value) + }, false); + + //Listeners for passive smoothing + monitorSmoothToleranceAmount.addEventListener('input', function(){ + userInputs.setSmoothTolerance(monitorSmoothToleranceAmount.value); + SmoothToleranceSlider.value = monitorSmoothToleranceAmount.value; + console.log("setting userInputs to: " + monitorSmoothToleranceAmount.value) + }, false); + + monitorSmoothCountAmount.addEventListener('input', function(){ + userInputs.setSmoothCount(monitorSmoothCountAmount.value); + SmoothCountSlider.value = monitorSmoothCountAmount.value; + console.log("setting userInputs to: " + monitorSmoothCountAmount.value) + }, false); + + monitorSmoothThresholdAmount.addEventListener('input', function(){ + userInputs.setSmoothThreshold(monitorSmoothThresholdAmount.value); + SmoothThresholdSlider.value = monitorSmoothThresholdAmount.value; + console.log("setting userInputs to: " + monitorSmoothThresholdAmount.value) + }, false); + //listeners for the input boxes monitorRotationspeedX.addEventListener('input', function(){ userInputs.setRotationspeedX(monitorRotationspeedX.value);