|
|
@ -13,6 +13,29 @@ |
|
|
|
<body> |
|
|
|
<body> |
|
|
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
<script> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//________________________________________________________________ |
|
|
|
|
|
|
|
const endpoint = 'https://192.168.1.6:8443/' // unfortunately not public yet due to API usage on poly.pizza |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getModelFromKeyword(keyword){ |
|
|
|
|
|
|
|
fetch(endpoint+"search?keyword="+keyword) |
|
|
|
|
|
|
|
.then(r=>r.json()) |
|
|
|
|
|
|
|
.then(r=>getPoly(r.results[0].Download.replace('.glb','').replace(/.*\//,''))) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getPoly(hashid){ |
|
|
|
|
|
|
|
fetch(endpoint+'getpoly?id='+hashid) |
|
|
|
|
|
|
|
// assumes it went well |
|
|
|
|
|
|
|
setTimeout( _ => { |
|
|
|
|
|
|
|
let el = document.createElement("a-entity") |
|
|
|
|
|
|
|
el.setAttribute('gltf-model', endpoint+'static/'+hashid+'.glb') |
|
|
|
|
|
|
|
el.setAttribute('position','0 1 -.5') |
|
|
|
|
|
|
|
el.setAttribute('scale','.001 .001 .001') |
|
|
|
|
|
|
|
el.setAttribute('target','true') |
|
|
|
|
|
|
|
AFRAME.scenes[0].appendChild(el) |
|
|
|
|
|
|
|
}, 1000) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//________________________________________________________________ |
|
|
|
// used for keywords like LAST / PREVIOUS / ALL |
|
|
|
// used for keywords like LAST / PREVIOUS / ALL |
|
|
|
let addedContent = [] |
|
|
|
let addedContent = [] |
|
|
|
|
|
|
|
|
|
|
@ -35,7 +58,7 @@ recognizer.continuous = true; |
|
|
|
recognizer.lang = 'en-US'; |
|
|
|
recognizer.lang = 'en-US'; |
|
|
|
|
|
|
|
|
|
|
|
const aframeprimitives = getAllPrimitives() |
|
|
|
const aframeprimitives = getAllPrimitives() |
|
|
|
const speechactions = [ "add", "apply", "delete", "clone" ] |
|
|
|
const speechactions = [ "add", "apply", "delete", "clone", "model" ] |
|
|
|
const speechcustomcomponents = [ "target", "teleporter" ] |
|
|
|
const speechcustomcomponents = [ "target", "teleporter" ] |
|
|
|
|
|
|
|
|
|
|
|
recognizer.onresult = (event) => { |
|
|
|
recognizer.onresult = (event) => { |
|
|
@ -85,6 +108,8 @@ recognizer.onresult = (event) => { |
|
|
|
el.object3D.translateX(1) |
|
|
|
el.object3D.translateX(1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (cmd_words[0] == speechactions[4]) |
|
|
|
|
|
|
|
getModelFromKeyword( cmd_words[1] ) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
recognizer.start(); |
|
|
|
recognizer.start(); |
|
|
|