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,QAQzB,OANA7T,IAEAgP,EAAS6E,QAAU,CAAC7T,MAAAA,EAAO1C,KAAAA,GAE3B2T,EAAazC,EAAWtU,MAAOsU,EAAWrU,QAEnC,WACLmD,IACI8W,GACFA,EAAWC,YAAYlF,EAAYC,SAAS+E,WAEhD,CACF,GAAG,CACD7F,EACA1S,KAGFqT,EAAAA,EAAAA,YAAU,WAAO,IAADqF,EACG,QAAjBA,EAAA3F,EAAUkF,eAAO,IAAAS,GAAjBA,EAAAxa,KAAA6U,EAAoBH,EAAWtU,MAAOsU,EAAWrU,OACnD,GAAG,CAACqU,EAAWtU,MAAOsU,EAAWrU,UAEjC8U,EAAAA,EAAAA,YAAU,WACU,IAADsF,EAEVC,EAFH1F,EACc,QAAhByF,EAAAvF,EAAS6E,eAAO,IAAAU,GAAhBA,EAAkBvU,QAEF,QAAhBwU,EAAAxF,EAAS6E,eAAO,IAAAW,GAAhBA,EAAkBlX,MAEtB,GAAG,CAACwR,KAGF2F,EAAAA,EAAAA,KAAA,OACElG,UAAWA,EACXmG,IAAKjG,EAELkG,MAAO,CAACza,MAAOsU,EAAWtU,MAAOC,OAAQqU,EAAWrU,SAG1D,C","sources":["core/scubeAPIMethods.ts","core/enums/ApplicationType.ts","shared/typescript/autobind.ts","amy/amyWebGL/sceneEngine.ts","services/amy/amyControlService.ts","amy/amyWebGL/scene3DTypes.ts","amy/amyWebGL/amy3DLazy.tsx"],"sourcesContent":["import scubeContext from './scubeContext';\r\nimport {AES, enc} from 'crypto-js';\r\n\r\nexport type scubeResponseActionType = {\r\n status: string;\r\n errors?: any[];\r\n warnings?: any[];\r\n fieldErrors?: any[];\r\n fieldWarnings?: any[];\r\n ok: boolean;\r\n\r\n sourceIds?: string[];\r\n}\r\n\r\nexport class scubeResponseAction {\r\n status: string;\r\n errors?: any[];\r\n warnings?: any[];\r\n fieldErrors?: any[];\r\n fieldWarnings?: any[];\r\n ok: boolean = false;\r\n sourceIds?: string[];\r\n constructor(status: string, ok: boolean = false) {\r\n this.status = status;\r\n this.ok = ok;\r\n }\r\n}\r\n\r\nexport class scubeResponse extends scubeResponseAction {\r\n data?: T;\r\n hasData: boolean = false;\r\n\r\n constructor(data?: T, ok: boolean = false, status = '200') {\r\n super(status);\r\n this.data = data;\r\n this.hasData = data !== undefined;\r\n }\r\n}\r\n\r\nexport function restGetFetch(curUrl: string, signal?: AbortSignal): Promise> {\r\n return new Promise>((resolve, reject) => {\r\n fetch(curUrl, {\r\n signal: signal,\r\n headers: { Authorization: 'Bearer ' + scubeContext.t2atoken },\r\n })\r\n .then((response) => {\r\n //no content response\r\n if (response.status === 204) {\r\n let result = new scubeResponse(undefined, true);\r\n resolve(result);\r\n return undefined;\r\n }\r\n\r\n if (!response.ok) {\r\n //if (response.status === 204 || response.status === 101 || response.status === 205 || response.status === 304)\r\n //101, 204, 205, or 304\r\n //console.debug(\"[API] GET: Not Ok.\", response.status);\r\n let resData: T = {} as T;\r\n let result = new scubeResponse(resData, false);\r\n resolve(result);\r\n return undefined;\r\n }\r\n return response.json();\r\n })\r\n .then((json) => {\r\n if (json !== undefined) {\r\n //decrypt data only if needed\r\n if (json.isEncrypted) {\r\n let r2 = enc.Utf8.stringify(AES.decrypt(json.content, 'jdjdkstgggshdncbvgdjslsk'));\r\n json = JSON.parse(r2);\r\n }\r\n\r\n if(json.status === 'FeatureConditionNotMatched')\r\n {\r\n console.warn('FeatureConditionNotMatched');\r\n }\r\n\r\n if (json.status) {\r\n resolve(json);\r\n } else {\r\n let resData: T = json as T;\r\n let result = new scubeResponse(resData, true);\r\n //console.debug(\"[API] GET: Result\", result);\r\n resolve(result);\r\n }\r\n } else {\r\n //console.debug(\"[API] GET: Received empty result.\");\r\n }\r\n })\r\n .catch((error) => {\r\n console.error('[API] GET:', error);\r\n //this.handleError(error);\r\n //resolve error\r\n });\r\n });\r\n}\r\n\r\nexport function restCreateFetch(curUrl: string, postData: T, signal?: AbortSignal): Promise {\r\n return new Promise((resolve, reject) => {\r\n fetch(curUrl, {\r\n method: 'POST',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n body: JSON.stringify(postData),\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n if (!response.ok) {\r\n const body = await response.json();\r\n //this.handleResponseError(response);\r\n //resolve error\r\n console.debug('[API] POST: Not Ok', body);\r\n reject(body);\r\n }\r\n //console.debug(\"[API] POST: Response Ok.\");\r\n resolve(new scubeResponseAction('Ok', response.ok));\r\n //return;// response.json();\r\n })\r\n // \t.then(json => {\r\n // \t console.debug(\"[API] POST: Received some items.\");\r\n // \t// let resData: T = json as T;\r\n // \t// let result = new scubeResponse(resData);\r\n // \t console.debug(\"[API] POST: Received items\", result);\r\n // \t //resolve(result);\r\n // })\r\n .catch((error) => {\r\n console.error('[API] POST:', error);\r\n //this.handleError(error);\r\n //resolve error\r\n });\r\n });\r\n}\r\n\r\nexport function restDeleteFetch(curUrl: string, signal?: AbortSignal): Promise {\r\n return new Promise((resolve, reject) => {\r\n fetch(curUrl, {\r\n method: 'DELETE',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n const contentLength = response.headers.get('Content-Length');\r\n if (response.ok && contentLength == '0') {\r\n resolve(new scubeResponseAction('Ok', true));\r\n return undefined;\r\n }\r\n\r\n if (!response.ok) {\r\n const body = await response.json();\r\n console.debug('[API] DELETE: Not Ok', body);\r\n reject(body);\r\n }\r\n return response.json();\r\n //console.debug(\"[API] DELETE: Response Ok.\");\r\n //resolve(new scubeResponseAction('Ok', response.ok));\r\n })\r\n .then((json) => {\r\n if (json && json.status) {\r\n resolve(json);\r\n } else {\r\n // let resData: TResponse = json as TResponse;\r\n // let result = new scubeResponse(resData, true);\r\n // resolve(result);\r\n resolve(new scubeResponseAction('Ok', true));\r\n }\r\n })\r\n .catch((error) => {\r\n console.error('[API] DELETE:', error);\r\n });\r\n });\r\n}\r\n\r\nexport function restDeleteFetchBack(\r\n curUrl: string,\r\n signal?: AbortSignal\r\n): Promise> {\r\n return new Promise>((resolve, reject) => {\r\n fetch(curUrl, {\r\n method: 'DELETE',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n const contentLength = response.headers.get('Content-Length');\r\n\r\n if (response.ok && contentLength == '0') {\r\n let result = new scubeResponse(undefined, true);\r\n resolve(result);\r\n return undefined;\r\n }\r\n\r\n\r\n if (!response.ok) {\r\n const body = await response.json();\r\n console.debug('[API] Delete: Not Ok', body);\r\n reject(body);\r\n }\r\n return response.json();\r\n })\r\n .then((json) => {\r\n if (json && json.status) {\r\n resolve(json);\r\n } else {\r\n let resData: TResponse = json as TResponse;\r\n let result = new scubeResponse(resData, true);\r\n resolve(result);\r\n }\r\n })\r\n .catch((error) => {\r\n console.error('[API] Delete:', error);\r\n });\r\n });\r\n}\r\n\r\nexport function restPostFetch(\r\n curUrl: string,\r\n postData: TRequestion,\r\n signal?: AbortSignal\r\n): Promise> {\r\n return new Promise>((resolve, reject) => {\r\n fetch(curUrl, {\r\n method: 'POST',\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n body: JSON.stringify(postData),\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n const contentLength = response.headers.get('Content-Length');\r\n\r\n if (response.ok && contentLength == '0') {\r\n let result = new scubeResponse(undefined, true);\r\n resolve(result);\r\n return undefined;\r\n }\r\n\r\n if (!response.ok) {\r\n const body = await response.json();\r\n console.debug('[API] POST: Not Ok', body);\r\n reject(body);\r\n }\r\n return response.json();\r\n })\r\n .then((json) => {\r\n if (json !== undefined) {\r\n //decrypt data only if needed\r\n if (json.isEncrypted) {\r\n let r2 = enc.Utf8.stringify(AES.decrypt(json.content, 'jdjdkstgggshdncbvgdjslsk'));\r\n json = JSON.parse(r2);\r\n }\r\n }\r\n\r\n if (json && json.status) {\r\n resolve(json);\r\n } else {\r\n let resData: TResponse = json as TResponse;\r\n let result = new scubeResponse(resData, true);\r\n resolve(result);\r\n }\r\n\r\n })\r\n .catch((error) => {\r\n console.error('[API] POST:', error);\r\n });\r\n });\r\n}\r\n\r\nexport function restRawPostFetch(\r\n curUrl: string,\r\n postData: any,\r\n signal?: AbortSignal\r\n): Promise> {\r\n return new Promise>((resolve, reject) => {\r\n const formData = new FormData();\r\n formData.append('data', postData);\r\n\r\n fetch(curUrl, {\r\n method: 'POST',\r\n headers: {\r\n Accept: 'application/json',\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n body: formData,\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n const contentLength = response.headers.get('Content-Length');\r\n\r\n if (response.ok && contentLength == '0') {\r\n let result = new scubeResponse(undefined, true);\r\n resolve(result);\r\n return undefined;\r\n }\r\n\r\n if (!response.ok) {\r\n const body = await response.json();\r\n console.debug('[API] POST: Not Ok', body);\r\n reject(body);\r\n }\r\n return response.json();\r\n })\r\n .then((json) => {\r\n if (json && json.status) {\r\n resolve(json);\r\n } else {\r\n let resData: TResponse = json as TResponse;\r\n let result = new scubeResponse(resData, true);\r\n resolve(result);\r\n }\r\n })\r\n .catch((error) => {\r\n console.error('[API] POST:', error);\r\n });\r\n });\r\n}\r\n\r\nexport function restUpdateFetch(curUrl: string, postData: T, signal?: AbortSignal): Promise {\r\n return new Promise((resolve, reject) => {\r\n fetch(curUrl, {\r\n method: 'PUT',\r\n\r\n headers: {\r\n Accept: 'application/json',\r\n 'Content-Type': 'application/json',\r\n\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n body: JSON.stringify(postData),\r\n signal: signal,\r\n })\r\n .then(async (response) => {\r\n if (!response.ok) {\r\n const body = await response.json();\r\n //this.handleResponseError(response);\r\n //resolve error\r\n console.debug('[API] PUT: Not Ok - ', body);\r\n reject(body);\r\n }\r\n\r\n //console.debug(\"[API] PUT: Response Ok.\");\r\n resolve(new scubeResponseAction('Ok', response.ok));\r\n //return;// response.json();\r\n })\r\n // \t.then(json => {\r\n // \t console.debug(\"[API] PUT: Received some items.\");\r\n\r\n // \t// let resData: T = json as T;\r\n // \t// let result = new scubeResponse(resData);\r\n\r\n // \t console.debug(\"[API] PUT: Received items\", result);\r\n\r\n // \t //resolve(result);\r\n // })\r\n .catch((error) => {\r\n console.error('[API] PUT:', error);\r\n //this.handleError(error);\r\n //resolve error\r\n });\r\n });\r\n}\r\n\r\nexport const postFile = (url:string, modelName:string, data:any, file:Blob) => {\r\n\r\n const formData = new FormData();\r\n if (file !== null) {\r\n formData.append('ImageFile', file);\r\n } else {\r\n //formData.append('ImageFile', null);\r\n }\r\n\r\n for (const property in data) {\r\n //console.log(`${property}: ${data[property]}`);\r\n\r\n formData.append(`${modelName}.${property}`, data[property]);\r\n }\r\n\r\n return fetch(url, {\r\n method: 'POST',\r\n headers: {\r\n Accept: 'application/json',\r\n 'if-none-match': '',\r\n Authorization: 'Bearer ' + scubeContext.t2atoken,\r\n },\r\n body: formData,\r\n });\r\n};\r\n","enum ApplicationType {\r\n Lite = 'lite',\r\n Guest = 'guest',\r\n FullClient = 'fullClient',\r\n SignUp = 'signUp',\r\n Identity = 'identity',\r\n Support = 'support',\r\n Partner = 'partner',\r\n InvitedAnonymous = 'invitedAnonymous',\r\n Translations = 'translates',\r\n}\r\n\r\nexport const ApplicationTypeDict: {\r\n [id: string]: ApplicationType;\r\n} = {\r\n Lite: ApplicationType.Lite,\r\n Guest: ApplicationType.Guest,\r\n FullClient: ApplicationType.FullClient,\r\n SignUp: ApplicationType.SignUp,\r\n Identity: ApplicationType.Identity,\r\n Support: ApplicationType.Support,\r\n Partner: ApplicationType.Partner,\r\n InvitedAnonymous: ApplicationType.InvitedAnonymous,\r\n Translations: ApplicationType.Translations,\r\n};\r\n\r\nexport default ApplicationType;\r\n","interface IPrototype {\r\n [key: string]: Function;\r\n}\r\n\r\ninterface IReactExcludeMethods {\r\n [key: string]: boolean;\r\n}\r\n\r\nconst CONSTRUCTOR = 'constructor';\r\n\r\nconst REACT_EXCLUDE_METHODS: IReactExcludeMethods = {\r\n render: true,\r\n setState: true,\r\n forceUpdate: true,\r\n UNSAFE_componentWillUpdate: true,\r\n UNSAFE_componentWillMount: true,\r\n getChildContext: true,\r\n componentWillMount: true,\r\n componentDidMount: true,\r\n componentWillReceiveProps: true,\r\n shouldComponentUpdate: true,\r\n componentWillUpdate: true,\r\n componentDidUpdate: true,\r\n componentWillUnmount: true,\r\n componentDidCatch: true,\r\n getSnapshotBeforeUpdate: true,\r\n};\r\n\r\nexport function autobind(instance: unknown): void {\r\n let proto: any = undefined;\r\n\r\n try {\r\n proto = Object.getPrototypeOf(instance);\r\n } catch (error) {\r\n throw new Error(`Cannot get prototype of ${instance}`);\r\n }\r\n\r\n const properties = Object.getOwnPropertyNames(proto);\r\n properties.forEach((name: string) => {\r\n bind(name, instance, proto);\r\n });\r\n\r\n //try proto2\r\n\r\n try {\r\n const proto2 = Object.getPrototypeOf(proto);\r\n\r\n const properties2 = Object.getOwnPropertyNames(proto2);\r\n properties2.forEach((name2: string) => {\r\n bind(name2, instance, proto2);\r\n });\r\n } catch (error) {}\r\n}\r\n\r\nfunction bind(name: string, instance: unknown, proto?: unknown): void {\r\n if (!isPrototype(proto)) {\r\n return;\r\n }\r\n if (!isPrototype(instance)) {\r\n return;\r\n }\r\n if (name === CONSTRUCTOR) {\r\n return;\r\n }\r\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\r\n if (!descriptor) {\r\n return;\r\n }\r\n if (descriptor.get || descriptor.set) {\r\n Object.defineProperty(proto, name, {\r\n ...descriptor,\r\n get: descriptor.get ? descriptor.get.bind(instance) : void 0,\r\n set: descriptor.set ? descriptor.set.bind(instance) : void 0,\r\n });\r\n return;\r\n }\r\n if (isFunction(descriptor.value) && !isExcluded(name)) {\r\n instance[name] = proto[name].bind(instance);\r\n }\r\n}\r\n\r\nfunction isExcluded(key: string): boolean {\r\n return REACT_EXCLUDE_METHODS[key] === true;\r\n}\r\n\r\nfunction isFunction(item: unknown): item is Function {\r\n return typeof item === 'function';\r\n}\r\n\r\nfunction isPrototype(value: unknown): value is T {\r\n return typeof value === 'object';\r\n}\r\n","import {setAmyIsMutedState} from '../../services/amy/amyControlService';\r\nimport scubeContext from '../../core/scubeContext';\r\nimport {AudioContext as safeAudioContext} from 'standardized-audio-context';\r\nimport {sceneEffectType} from './scenes/effects';\r\nimport {sceneCameraType} from './scenes/cameras';\r\nimport {sceneEventType} from './sceneEvents';\r\nimport {amy3DHolderType} from './scene3DTypes';\r\nimport {autobind} from '../../shared/typescript/autobind';\r\n\r\nexport default class sceneContext {\r\n curSequence: sceneSequenceType | undefined = undefined;\r\n currentScene: sceneType | undefined = undefined;\r\n amy3DHolder: amy3DHolderType = undefined as unknown as amy3DHolderType; //web gl scene and models\r\n eventListeners: ((sceneEvent: sceneEventType) => void)[] = [];\r\n\r\n invokeSetSize: ((width: number, height: number) => void) | undefined = undefined;\r\n onAnimationFinished = undefined;\r\n invokeAnimationStart = undefined;\r\n invokeFadeToAnimation: ((animationName: string) => void) | undefined = undefined;\r\n\r\n startSequence(sequence: sceneSequenceType) {\r\n this.curSequence = sequence; //zatial iba jedna sequence v jednom case\r\n //console.log(this);\r\n sequence.onStart(this);\r\n }\r\n fadeToAnimation(animationName: string) {\r\n //console.log(this);\r\n this.invokeFadeToAnimation?.(animationName);\r\n }\r\n startEffect(effect: sceneEffectType) {\r\n effect.onStart(this);\r\n }\r\n startCamera(camera: sceneCameraType) {\r\n camera.onStart(this);\r\n }\r\n animationFinished(animationName: string) {\r\n this.curSequence?.onAnimationFinished(this, animationName);\r\n }\r\n setSize(width: number, height: number) {\r\n this.invokeSetSize?.(width, height);\r\n }\r\n\r\n invokeCameraFinished(camera: sceneCameraType) {\r\n this.curSequence?.onCameraFinished(this, camera);\r\n }\r\n //invoke events\r\n invokeEffectFinished(effect: sceneEffectType) {\r\n this.curSequence?.onEffectFinished(this, effect);\r\n }\r\n //process event in amy webgl\r\n invokeEvent(sceneEvent: sceneEventType) {\r\n if (this.currentScene && this.curSequence) {\r\n this.curSequence.onEvent(this, sceneEvent);\r\n this.currentScene.onEvent(this, sceneEvent);\r\n }\r\n }\r\n //send event outside of amy\r\n pushEvent(sceneEvent: sceneEventType) {\r\n for (let i = 0; i < this.eventListeners.length; i++) {\r\n this.eventListeners[i](sceneEvent);\r\n }\r\n }\r\n}\r\n\r\nlet audioCtx = new safeAudioContext(); //use npm new (window.AudioContext || window.webkitAudioContext)();\r\n//console.log(audioCtx.state);\r\nif (audioCtx.state === 'suspended') {\r\n //console.log('stale suspended');\r\n scubeContext.isAmyAudioSuspended = true;\r\n scubeContext.isAmyMuted = true;\r\n}\r\n\r\naudioCtx.onstatechange = function () {\r\n //console.log('zmena; ' + audioCtx.state);\r\n\r\n if (audioCtx.state === 'suspended') {\r\n scubeContext.isAmyAudioSuspended = true;\r\n scubeContext.isAmyMuted = true;\r\n } else {\r\n scubeContext.isAmyAudioSuspended = false;\r\n }\r\n};\r\n\r\nlet gainNode = audioCtx.createGain();\r\ngainNode.connect(audioCtx.destination);\r\n\r\nlet lastAudioSource: any = undefined;\r\nlet disableSpeech = false;\r\n\r\nexport type sceneSequenceType = {\r\n onStart: (context: sceneContext | any) => void;\r\n onFinish: (context: sceneContext | any) => void;\r\n onAnimationFinished: (context: sceneContext | any, animationName: string) => void;\r\n onEffectFinished: (context: sceneContext | any, effect: sceneEffectType) => void;\r\n onCameraFinished: (context: sceneContext | any, camera: sceneCameraType) => void;\r\n onEvent: (context: sceneContext | any, sequenceEvent: sceneEventType) => void;\r\n isRecurrent: boolean;\r\n};\r\n\r\nexport type sceneType = {\r\n modelName: string;\r\n id: string;\r\n name: string;\r\n onStart: (context: sceneContext) => void;\r\n onStop: (context: sceneContext) => void;\r\n onFinish: (context: sceneContext) => void;\r\n onSequenceFinished: (sequenceName: string) => void;\r\n onEffectFinished: (effectname: string) => void;\r\n onEvent: (context: sceneContext, sceneEvent: sceneEventType) => void;\r\n sequences: sceneSequenceType[];\r\n amySettings: {\r\n particlesHitArea: boolean;\r\n particlesRandom: number;\r\n particlesDepth: number;\r\n particlesXYMove: boolean;\r\n particlesBW: boolean;\r\n particlesSquare: boolean;\r\n particlesSize: number;\r\n particlesSmooth: number;\r\n particlesShift: number;\r\n matrix: number;\r\n planeRotate: number;\r\n };\r\n};\r\n\r\nexport const sceneEngine = {\r\n curSceneContext: {} as sceneContext,\r\n amy3DHolder: undefined as amy3DHolderType | undefined,\r\n\r\n init(scene: sceneType, amyModel: string) {\r\n scene.modelName = amyModel;\r\n this.curSceneContext = new sceneContext();\r\n this.curSceneContext.currentScene = scene;\r\n },\r\n startScene() {\r\n //console.log('scene started');\r\n this.curSceneContext?.currentScene?.onStart(this.curSceneContext);\r\n },\r\n stopScene() {\r\n this.curSceneContext?.currentScene?.onStop(this.curSceneContext);\r\n },\r\n pushEvent(sceneEvent: sceneEventType) {\r\n if (this.curSceneContext) {\r\n this.curSceneContext.invokeEvent(sceneEvent);\r\n }\r\n },\r\n\r\n animationFinished(animationName: string) {\r\n this.curSceneContext?.animationFinished(animationName);\r\n },\r\n\r\n setSize(width: number, height: number) {\r\n this.curSceneContext?.setSize(width, height);\r\n },\r\n\r\n subscribeListen(eventListener: (sceneEvent: sceneEventType) => void) {\r\n this.curSceneContext?.eventListeners.push(eventListener);\r\n },\r\n\r\n unSubscribeListen(eventListener: (sceneEvent: sceneEventType) => void) {\r\n const index = this.curSceneContext?.eventListeners.indexOf(eventListener);\r\n if (index && index > -1) {\r\n this.curSceneContext?.eventListeners.splice(index, 1);\r\n }\r\n },\r\n\r\n stopSpeech() {\r\n if (lastAudioSource) {\r\n try {\r\n lastAudioSource.stop(0);\r\n } catch (e) {}\r\n try {\r\n lastAudioSource.disconnect(gainNode);\r\n } catch (e) {}\r\n lastAudioSource = undefined;\r\n }\r\n },\r\n\r\n disableSpeech() {\r\n disableSpeech = true;\r\n\r\n if (lastAudioSource) {\r\n try {\r\n lastAudioSource.stop(0);\r\n } catch (e) {}\r\n try {\r\n lastAudioSource.disconnect(gainNode);\r\n } catch (e) {}\r\n lastAudioSource = undefined;\r\n }\r\n\r\n this.publishAmySpeechChanged();\r\n },\r\n\r\n enableSpeech() {\r\n disableSpeech = false;\r\n\r\n this.publishAmySpeechChanged();\r\n },\r\n\r\n initMuteValue(isMuted: boolean) {\r\n if (isMuted) gainNode.gain.setValueAtTime(0, audioCtx.currentTime);\r\n else gainNode.gain.setValueAtTime(1, audioCtx.currentTime);\r\n },\r\n unSuspend() {\r\n if (audioCtx.state === 'suspended') {\r\n audioCtx.resume();\r\n scubeContext.isAmyAudioSuspended = false;\r\n scubeContext.isAmyMuted = false; //start speek on resume\r\n }\r\n\r\n //console.log(scubeContext);\r\n },\r\n toggleMute() {\r\n //console.log(scubeContext);\r\n\r\n if (audioCtx.state === 'suspended') {\r\n audioCtx.resume();\r\n scubeContext.isAmyAudioSuspended = false;\r\n scubeContext.isAmyMuted = false; //start speek on resume\r\n } else {\r\n scubeContext.isAmyMuted = !scubeContext.isAmyMuted;\r\n }\r\n\r\n //console.log(scubeContext);\r\n\r\n if (scubeContext.isAmyMuted) {\r\n gainNode.gain.setValueAtTime(0, audioCtx.currentTime);\r\n } else {\r\n gainNode.gain.setValueAtTime(1, audioCtx.currentTime);\r\n }\r\n\r\n setAmyIsMutedState(scubeContext.isAmyMuted);\r\n\r\n this.publishAmySpeechChanged();\r\n\r\n //console.log({ suspended: scubeContext.isAmyAudioSuspended, muted: scubeContext.isAmyMuted });\r\n\r\n return scubeContext.isAmyMuted;\r\n },\r\n handlersAmySpeech: [] as any[],\r\n handlerAmySpeechCounter: 0,\r\n subscribeAmySpeech(handler: (data: any) => void) {\r\n //this.handlers.push(handler);\r\n //nameof(x=>x.forceRender);\r\n const key = this.handlerAmySpeechCounter++;\r\n const keyString = key.toString();\r\n\r\n (this.handlersAmySpeech as any)[keyString] = handler;\r\n return () => this.unsubscribeAmySpeech(keyString, handler);\r\n },\r\n unsubscribeAmySpeech(key: string, handler: (data: any) => void) {\r\n delete (this.handlersAmySpeech as any)[key];\r\n },\r\n publishAmySpeechChanged() {\r\n const values = Object.values(this.handlersAmySpeech);\r\n for (let i = 0; i < values.length; i++) {\r\n (values[i] as any)({});\r\n }\r\n },\r\n\r\n // mute() {\r\n // //console.log('mute');\r\n // gainNode.gain.setValueAtTime(0, audioCtx.currentTime);\r\n // scubeContext.isAmyMuted = true;\r\n // setAmyIsMutedState(true);\r\n // },\r\n //\r\n // unmute() {\r\n // //console.log('unmute');\r\n // if (audioCtx.state === 'suspended') {\r\n // audioCtx.resume();\r\n // scubeContext.isAmyAudioSuspended = false;\r\n // }\r\n // gainNode.gain.setValueAtTime(1, audioCtx.currentTime);\r\n // scubeContext.isAmyMuted = false;\r\n // setAmyIsMutedState(false);\r\n // },\r\n\r\n playSpeech(speechData: string | undefined, onSpeechStarted: () => void, onSpeechFinished: () => void) {\r\n if (!scubeContext.isAmyAudioSuspended && speechData && !disableSpeech) {\r\n //console.log('amy speech');\r\n\r\n fetch(`data:application/octet-stream;base64,${speechData}`)\r\n .then((res) => {\r\n return res.blob();\r\n })\r\n .then((blob) => {\r\n return blob.arrayBuffer();\r\n })\r\n .then((audioData) => {\r\n //console.log(audioData);\r\n\r\n let useDelay = false;\r\n\r\n if (lastAudioSource) {\r\n useDelay = true;\r\n lastAudioSource.stop(0);\r\n lastAudioSource.disconnect(gainNode);\r\n lastAudioSource = undefined;\r\n }\r\n\r\n //console.log('1-' + new Date().valueOf());\r\n audioCtx.decodeAudioData(audioData, function (buffer) {\r\n if (lastAudioSource) {\r\n useDelay = true;\r\n lastAudioSource.stop(0);\r\n lastAudioSource.disconnect(gainNode);\r\n lastAudioSource = undefined;\r\n }\r\n\r\n //console.log(lastAudioSource);\r\n\r\n lastAudioSource = audioCtx.createBufferSource();\r\n //lastAudioSource.loop = true;\r\n //console.log(lastAudioSource);\r\n\r\n lastAudioSource.addEventListener('ended', () => {\r\n scubeContext.isAmySpeaking = false;\r\n if (onSpeechFinished) onSpeechFinished();\r\n });\r\n\r\n lastAudioSource.buffer = buffer;\r\n if (useDelay) {\r\n try {\r\n lastAudioSource.connect(gainNode);\r\n\r\n scubeContext.isAmySpeaking = true;\r\n if (onSpeechStarted) onSpeechStarted();\r\n\r\n lastAudioSource.start(audioCtx.currentTime + 0.8);\r\n } catch (e) {}\r\n } else {\r\n try {\r\n lastAudioSource.connect(gainNode);\r\n\r\n scubeContext.isAmySpeaking = true;\r\n if (onSpeechStarted) onSpeechStarted();\r\n lastAudioSource.start(0);\r\n } catch (e) {}\r\n }\r\n });\r\n });\r\n }\r\n\r\n // let audioCtx = new (window.AudioContext || window.webkitAudioContext)();\r\n //\r\n // let source = audioCtx.createBufferSource();\r\n // // set the buffer in the AudioBufferSourceNode\r\n // source.buffer = myArrayBuffer;\r\n // // connect the AudioBufferSourceNode to the\r\n // // destination so we can hear the sound\r\n // source.connect(audioCtx.destination);\r\n // // start the source playing\r\n // source.start();\r\n },\r\n};\r\n\r\nautobind(sceneEngine);\r\n","import scubeContext from '../../core/scubeContext';\r\nimport {PageVisibilityResourceModel, UserAmySettings} from '../../core/scubeAPI';\r\nimport ApplicationType from '../../core/enums/ApplicationType';\r\n\r\nexport function showAmy(pageKey: string) {\r\n storeAmyVisibilityState(true, pageKey);\r\n}\r\n\r\nexport function hideAmy(pageKey: string) {\r\n storeAmyVisibilityState(false, pageKey);\r\n}\r\n\r\nexport function storeAmyVisibilityState(isVisible: boolean, pageKey: string) {\r\n const tenantType = scubeContext.tenantType;\r\n const field = tenantType + '-' + pageKey;\r\n\r\n if (isVisible) {\r\n scubeContext.amyDisabledPages = scubeContext.amyDisabledPages?.filter((x) => x !== field);\r\n } else {\r\n scubeContext.amyDisabledPages?.push(field);\r\n }\r\n\r\n if (scubeContext.appType === ApplicationType.FullClient) {\r\n const request = new PageVisibilityResourceModel();\r\n request.id = field;\r\n request.isVisible = isVisible;\r\n const service = new UserAmySettings({});\r\n service.changeAmyVisibility(request).then();\r\n } else {\r\n const localStorageData = localStorage.getItem('amyVisibilityState');\r\n if (localStorageData) {\r\n const visibility = JSON.parse(localStorageData);\r\n visibility[field] = isVisible;\r\n localStorage.setItem('amyVisibilityState', JSON.stringify(visibility));\r\n } else {\r\n const data: any = {};\r\n data[field] = isVisible;\r\n localStorage.setItem('amyVisibilityState', JSON.stringify(data));\r\n }\r\n }\r\n}\r\n\r\nexport function getHelpVisibilityState(pageKey: string) {\r\n const tenantType = scubeContext.tenantType;\r\n const field = tenantType + '-' + pageKey;\r\n\r\n if (scubeContext.appType === ApplicationType.FullClient) {\r\n return !scubeContext.amyDisabledPages?.includes(field);\r\n } else {\r\n const localStorageData = localStorage.getItem('amyVisibilityState');\r\n if (localStorageData) {\r\n const visibility = JSON.parse(localStorageData);\r\n const isVisible = visibility[field];\r\n return isVisible === undefined ? true : isVisible;\r\n } else {\r\n return true;\r\n }\r\n }\r\n}\r\n\r\nexport function setAmyIsMutedState(isMutedState: boolean) {\r\n if (scubeContext.appType === ApplicationType.FullClient) {\r\n //scubeContext.isAmyMuted = isMutedState;\r\n // const service = new UserAmySettings({});\r\n // service.changeAmyMute(isMutedState).then();\r\n } else {\r\n //scubeContext.isAmyMuted = isMutedState;\r\n localStorage.setItem('isAmyMutedState', String(isMutedState));\r\n }\r\n}\r\n\r\nexport function getAmyIsMutedState() {\r\n // console.log(scubeContext.isAmyAudioSuspended);\r\n if (scubeContext.isAmyAudioSuspended) {\r\n return true;\r\n }\r\n\r\n if (scubeContext.appType === ApplicationType.FullClient) {\r\n //console.log('ismuted' + scubeContext.isAmyMuted);\r\n return scubeContext.isAmyMuted;\r\n } else {\r\n return scubeContext.isAmyMuted;\r\n // const localStorageData = localStorage.getItem('isAmyMutedState');\r\n // if (localStorageData) {\r\n // scubeContext.isAmyMuted = localStorageData === 'true';\r\n // return localStorageData === 'true';\r\n // } else {\r\n // scubeContext.isAmyMuted = false;\r\n // return false;\r\n // }\r\n }\r\n return scubeContext.isAmyMuted;\r\n}\r\n","import {AnimationAction, AnimationMixer, Clock, Color, PerspectiveCamera, Scene, Vector3, WebGLRenderer} from 'three';\r\nimport {Audio as Three_Audio} from \"three/src/audio/Audio\";\r\n\r\nexport type amy3DHolderType = {\r\n bufferScene: Scene;\r\n bufferCamera: PerspectiveCamera & {\r\n lookAtPosition: Vector3;\r\n };\r\n renderer: WebGLRenderer;\r\n amyClearColor: Color;\r\n matrixClearColor: Color;\r\n\r\n mixer: AnimationMixer;\r\n clock: Clock;\r\n\r\n amySettings: {\r\n particlesHitArea: boolean;\r\n particlesRandom: number;\r\n particlesDepth: number;\r\n particlesXYMove: boolean;\r\n particlesBW: boolean;\r\n particlesSquare: boolean;\r\n particlesSize: number;\r\n particlesSmooth: number;\r\n particlesShift: number;\r\n matrix: number;\r\n planeRotate: number;\r\n };\r\n curAnimationModel: any;\r\n\r\n curAction: AnimationAction;\r\n modelAnimations: AnimationAction[];\r\n modelAnimationsNamed: { [id: string]: AnimationAction };\r\n\r\n morphTarget: (targetName:amyMorphtargets, value:number)=>void;\r\n sound: Three_Audio;\r\n};\r\n\r\nexport enum amyMorphtargets {\r\n browDownLeft = 'browDownLeft',\r\n browDownRight = 'browDownRight',\r\n browInnerUp = 'browInnerUp',\r\n browOuterUpLeft = 'browOuterUpLeft',\r\n browOuterUpRight = 'browOuterUpRight',\r\n cheekPuff = 'cheekPuff',\r\n cheekSquintLeft = 'cheekSquintLeft',\r\n cheekSquintRight = 'cheekSquintRight',\r\n eyeBlinkLeft = 'eyeBlinkLeft',\r\n eyeBlinkRight = 'eyeBlinkRight',\r\n eyeLookDownLeft = 'eyeLookDownLeft',\r\n eyeLookDownRight = 'eyeLookDownRight',\r\n eyeLookInLeft = 'eyeLookInLeft',\r\n eyeLookInRight = 'eyeLookInRight',\r\n eyeLookOutLeft = 'eyeLookOutLeft',\r\n eyeLookOutRight = 'eyeLookOutRight',\r\n eyeLookUpLeft = 'eyeLookUpLeft',\r\n eyeLookUpRight = 'eyeLookUpRight',\r\n eyeSquintLeft = 'eyeSquintLeft',\r\n eyeSquintRight = 'eyeWideLeft',\r\n eyeWideLeft = 'eyeWideLeft',\r\n eyeWideRight = 'eyeWideRight',\r\n eyesClosed = 'eyesClosed',\r\n eyesLookDown = 'eyesLookDown',\r\n eyesLookUp = 'eyesLookUp',\r\n jawForward = 'jawForward',\r\n jawLeft = 'jawLeft',\r\n jawOpen = 'jawOpen',\r\n jawRight = 'jawRight',\r\n mouthClose = 'mouthClose',\r\n mouthDimpleLeft = 'mouthDimpleLeft',\r\n mouthDimpleRight = 'mouthDimpleRight',\r\n mouthFrownLeft = 'mouthFrownLeft',\r\n mouthFrownRight = 'mouthFrownRight',\r\n mouthFunnel = 'mouthFunnel',\r\n mouthLeft = 'mouthLeft',\r\n mouthLowerDownLeft = 'mouthLowerDownLeft',\r\n mouthLowerDownRight = '',\r\n mouthOpen = 'mouthOpen',\r\n mouthPressLeft = 'mouthPressLeft',\r\n mouthPressRight = 'mouthPressRight',\r\n mouthPucker = 'mouthPucker',\r\n mouthRight = 'mouthRight',\r\n mouthRollLower = 'mouthRollLower',\r\n mouthRollUpper = 'mouthRollUpper',\r\n mouthShrugLower = 'mouthShrugLower',\r\n mouthShrugUpper = 'mouthShrugUpper',\r\n mouthSmile = 'mouthSmile',\r\n mouthSmileLeft = 'mouthSmileLeft',\r\n mouthSmileRight = 'mouthSmileRight',\r\n mouthStretchLeft = 'mouthStretchLeft',\r\n mouthStretchRight = 'mouthStretchRight',\r\n mouthUpperUpLeft = 'mouthUpperUpLeft',\r\n mouthUpperUpRight = 'mouthUpperUpRight',\r\n noseSneerLeft = 'noseSneerLeft',\r\n noseSneerRight = 'noseSneerRight',\r\n tongueOut = 'tongueOut',\r\n viseme_CH = 'viseme_CH',\r\n viseme_DD = 'viseme_DD',\r\n viseme_E = 'viseme_E',\r\n viseme_FF = 'viseme_FF',\r\n viseme_I = 'viseme_I',\r\n viseme_O = 'viseme_O',\r\n viseme_PP = 'viseme_PP',\r\n viseme_RR = 'viseme_RR',\r\n viseme_SS = 'viseme_SS',\r\n viseme_TH = 'viseme_TH',\r\n viseme_U = 'viseme_U',\r\n viseme_aa = 'viseme_aa',\r\n viseme_kk = 'viseme_kk',\r\n viseme_nn = 'viseme_nn',\r\n viseme_sil = 'viseme_sil',\r\n}\r\n\r\nexport const amyMorphTargetGroups = {\r\n eyeBlinkLeft: 'EyeLeft',\r\n eyeBlinkRight: 'eyeBlinkRight',\r\n eyeLookDownLeft: 'EyeLeft',\r\n eyeLookDownRight: 'eyeLookDownRight',\r\n eyeLookOutLeft: 'EyeLeft',\r\n eyeLookOutRight: 'eyeLookOutRight',\r\n eyeLookUpLeft: 'EyeLeft',\r\n eyeLookUpRight: 'eyeLookUpRight',\r\n}\r\n","import React, {useEffect, useRef, useState} from 'react';\r\nimport {GLTF, GLTFLoader} from 'three/examples/jsm/loaders/GLTFLoader.js';\r\nimport {sceneEngine, sceneType} from './sceneEngine';\r\nimport {\r\n AdditiveAnimationBlendMode,\r\n AnimationAction, AnimationClip,\r\n AnimationMixer, AudioLoader,\r\n Clock,\r\n Color,\r\n DirectionalLight,\r\n DoubleSide,\r\n HemisphereLight, InterpolateLinear,\r\n LoopPingPong, Mesh,\r\n NumberKeyframeTrack,\r\n PerspectiveCamera,\r\n Scene,\r\n Vector3,\r\n WebGLRenderer,\r\n AudioListener as Three_AudioListener,\r\n Audio as Three_Audio,\r\n AudioLoader as Three_AudioLoader, Quaternion, Euler, SRGBColorSpace\r\n} from 'three';\r\nimport {amy3DHolderType, amyMorphtargets} from './scene3DTypes';\r\nimport {castUndefined} from '@shared/typescript/typescriptExtensions';\r\nimport {FBXLoader} from 'three/examples/jsm/loaders/FBXLoader.js';\r\nimport {Dict} from \"@shared/types/valueTypes\";\r\nimport scubeContext from \"@core/scubeContext\";\r\nimport {LoopOnce} from \"three/src/constants.js\";\r\nimport amy3D from \"@amy/amyWebGL/amy3D\";\r\n\r\n\r\n//https://docs.aws.amazon.com/polly/latest/dg/viseme.html\r\n\r\n//https://docs.aws.amazon.com/polly/latest/dg/ph-table-english-us.html\r\n\r\n//http://www.zxthex.com/Viseme%20Reference%20_%20Oculus%20Developers.html\r\n//https://developer.oculus.com/documentation/unity/audio-ovrlipsync-viseme-reference/\r\n//https://learn.microsoft.com/en-us/azure/ai-services/speech-service/how-to-speech-synthesis-viseme?tabs=visemeid&pivots=programming-language-csharp\r\n\r\n\r\ndeclare global {\r\n interface Window {\r\n mixerHeadTime: number;\r\n mixerHeadFinishedFx: () => void;\r\n amyModelHeadVector: Vector3;\r\n amyModelHeadDirectionQ: Quaternion;\r\n amyModelHeadDirectionEuler: Euler;\r\n lastAudioVolume: number;\r\n delta: number;\r\n }\r\n}\r\n\r\ntype vowelIpaVisemeType = { azVisemeId: string, playerViseme: string }\r\nconst visemesByNumber: Dict = {}\r\n\r\nlet vowelIpaViseme = function (azVisemeId, ipaNameExamplePairsArray, awsVisemes, playerViseme) {\r\n this.azVisemeId = azVisemeId.toString();\r\n this.ipaNameExamplePairsArray = ipaNameExamplePairsArray;\r\n this.awsVisemes = awsVisemes;\r\n this.playerViseme = 'viseme_' + playerViseme;\r\n\r\n visemesByNumber[this.azVisemeId] = this;\r\n}\r\n\r\nlet mapVowelIpaVisemeTable = [\r\n new vowelIpaViseme(0, [], [], 'sil'),\r\n new vowelIpaViseme(1, [['æ', '[a]ctive'], ['ʌ', '[u]ncle'], ['ə', '[a]go'], ['ɚ', 'all[er]gy']], ['a', '@', 'E'], 'aa'),\r\n new vowelIpaViseme(2, [['ɑ', '[o]bstinate'], ['ɑɹ', '[ar]tist']], ['a'], 'aa'),\r\n new vowelIpaViseme(3, [['ɔ', 'c[au]se'], ['ɔɹ', '[or]ange']], ['O'], 'O'),\r\n new vowelIpaViseme(4, [['eɪ', '[a]te'], ['ɛ', '[e]very'], ['ʊ', 'b[oo]k'], ['ɛɹ', '[air]plane'], ['ʊɹ', 'c[ur]e']], ['e', 'E', 'u'], 'E'),\r\n new vowelIpaViseme(5, [['ɝ', '[ear]th']], ['E'], 'aa'),\r\n new vowelIpaViseme(6, [['i', '[ea]t'], ['ɪ', '[i]f'], ['ju', '[Yu]ma'], ['ɪɹ', '[ear]s'], ['j', '[y]ard, f[e]w']], ['i'], 'I'),\r\n new vowelIpaViseme(7, [['u', '[U]ber'], ['ju', '[Yu]ma'], ['w', '[w]ith, s[ue]de']], ['u'], 'U'),\r\n new vowelIpaViseme(8, [['oʊ', '[o]ld']], ['o'], 'O'),\r\n new vowelIpaViseme(9, [['aʊ', '[ou]t'], ['aʊ(ə)ɹ', '[hour]s']], ['a'], 'aa'),\r\n new vowelIpaViseme(10, [['ɔɪ', '[oi]l']], ['O'], 'O'),\r\n new vowelIpaViseme(11, [['aɪ', '[i]ce'], ['aɪ(ə)ɹ', '[Ire]land']], ['a'], 'aa'),\r\n new vowelIpaViseme(12, [['h', '[h]elp']], ['k'], 'kk'),\r\n new vowelIpaViseme(13, [['ɪɹ', '[ear]s'], ['ɛɹ', '[air]plane'], ['ʊɹ', 'c[ur]e'], ['aɪ(ə)ɹ', '[Ire]land'], ['aʊ(ə)ɹ', '[hour]s'],\r\n ['ɔɹ', '[or]ange'], ['ɑɹ', '[ar]tist'], ['ɝ', '[ear]th'], ['ɚ', 'all[er]gy'], ['ɹ', '[r]ed, b[r]ing']], ['r'], 'RR'),\r\n new vowelIpaViseme(14, [['l', '[l]id, g[l]ad']], ['t'], 'DD'),\r\n new vowelIpaViseme(15, [['s', '[s]it'], ['z', '[z]ap']], ['s'], 'SS'),\r\n new vowelIpaViseme(16, [['ʃ', '[sh]e'], ['ʒ', '[J]acques'], ['tʃ', '[ch]in'], ['dʒ', '[j]oy']], ['S'], 'CH'),\r\n new vowelIpaViseme(17, [['θ', '[th]in'], ['ð', '[th]en']], ['T'], 'TH'),\r\n new vowelIpaViseme(18, [['f', '[f]ork'], ['v', '[v]alue']], ['f'], 'FF'),\r\n new vowelIpaViseme(19, [['t', '[t]alk'], ['d', '[d]ig'], ['n', '[n]o, s[n]ow']], ['t'], 'DD'),\r\n new vowelIpaViseme(20, [['k', '[c]ut'], ['g', '[g]o'], ['ŋ', 'li[n]k']], ['k'], 'kk'),\r\n new vowelIpaViseme(21, [['p', '[p]ut'], ['b', '[b]ig'], ['m', '[m]at, s[m]ash']], ['p'], 'PP')\r\n]\r\n\r\n//console.log(visemesByNumber);\r\n\r\nconst initControls = (sceneHolder: amy3DHolderType) => {\r\n};\r\n\r\nconst reloadModel = (result: amy3DHolderType) => {\r\n let self = result;\r\n result.amySettings = castUndefined(sceneEngine.curSceneContext?.currentScene?.amySettings);\r\n\r\n if (self.curAnimationModel) {\r\n self.bufferScene.remove(self.curAnimationModel);\r\n }\r\n\r\n function traverseMaterials(object: any, callback: any) {\r\n object.traverse((node: any) => {\r\n if (!node.isMesh) return;\r\n const materials = Array.isArray(node.material) ? node.material : [node.material];\r\n materials.forEach(callback);\r\n });\r\n }\r\n\r\n const updateTextureEncoding = (curContent: any) => {\r\n //const encoding = sRGBEncoding; //this.state.textureEncoding === 'sRGB' ? sRGBEncoding : LinearEncoding;\r\n traverseMaterials(curContent, (material: any) => {\r\n // if (material.map) material.map.encoding = encoding;\r\n // if (material.emissiveMap) material.emissiveMap.encoding = encoding;\r\n // if (material.map || material.emissiveMap) material.needsUpdate = true;\r\n });\r\n };\r\n\r\n let loader = new GLTFLoader();\r\n //let fbxLoader = new FBXLoader();\r\n //const modelMePath = '/models/a86d4fbe-1443-4fd7-a10e-5d5807dc73f0.glb';\r\n //let modelPath = '/models/' + sceneEngine.curSceneContext?.currentScene?.modelName + '?v=' + window.staticfilesversion;\r\n //let modelPath = '/models/wariorIdleMale.glb';\r\n\r\n async function loadModels() {\r\n function processAnimations(animationName: string, objectAnim: GLTF, objectModel: GLTF) {\r\n for (let i = 0; i < objectAnim.animations.length; i++) {\r\n //var clip2 = AnimationClip.parse(AnimationClip.toJSON(clip));\r\n const curAnim = objectAnim.animations[i];\r\n if (curAnim.duration > 10.0) {\r\n curAnim.duration = 10.0;\r\n if (curAnim.tracks) {\r\n //console.log('skratene');\r\n curAnim.tracks.forEach((track) => track.trim(0, 10.0));\r\n }\r\n }\r\n }\r\n\r\n for (let i = 0; i < objectAnim.animations.length; i++) {\r\n let action = self.mixer.clipAction(objectAnim.animations[i]);\r\n //action.setDuration(1.0);\r\n\r\n //rename animation\r\n (action as any)._clip.name = animationName;\r\n\r\n self.modelAnimations.push(action);\r\n self.modelAnimationsNamed[(action as any)._clip.name] = action;\r\n\r\n //console.log((action as any)._clip.name);\r\n }\r\n }\r\n\r\n let modelPath =\r\n '/models/' + sceneEngine.curSceneContext?.currentScene?.modelName + '?v=' + window.staticfilesversion;\r\n modelPath = modelPath.replace('amy', 'amy20');\r\n\r\n const modelGlb: GLTF = await loader.loadAsync(modelPath);\r\n\r\n //const extName = '.glb';\r\n const extName = '_pack08.glb';\r\n\r\n const animWavingPromise = loader.loadAsync('/models/Waving' + extName);\r\n const animWaving2Promise = loader.loadAsync('/models/Waving2' + extName);\r\n const animBashfulPromise = loader.loadAsync('/models/Bashful' + extName);\r\n const animHandRaisingPromise = loader.loadAsync('/models/HandRaising' + extName);\r\n const animHappyPromise = loader.loadAsync('/models/Happy' + extName);\r\n const animJumpingPromise = loader.loadAsync('/models/Jumping' + extName);\r\n const animLookingPromise = loader.loadAsync('/models/Looking' + extName);\r\n const animLooking2Promise = loader.loadAsync('/models/Looking2' + extName);\r\n const animLookingBehindPromise = loader.loadAsync('/models/LookingBehind' + extName);\r\n const animMacarenaDancePromise = loader.loadAsync('/models/MacarenaDance' + extName);\r\n const animNoPromise = loader.loadAsync('/models/No' + extName);\r\n const animPointingPromise = loader.loadAsync('/models/Pointing' + extName);\r\n const animReactingPromise = loader.loadAsync('/models/Reacting' + extName);\r\n const animRopeClimbPromise = loader.loadAsync('/models/RopeClimb' + extName);\r\n const animRumbaDancingPromise = loader.loadAsync('/models/RumbaDancing' + extName);\r\n const animSalsaDancingPromise = loader.loadAsync('/models/SalsaDancing' + extName);\r\n const animSillyDancingPromise = loader.loadAsync('/models/SillyDancing' + extName);\r\n const animStandingGreetingPromise = loader.loadAsync('/models/StandingGreeting' + extName);\r\n const animStandingUsingTouchscreenTabletPromise = loader.loadAsync(\r\n '/models/StandingUsingTouchscreenTablet' + extName\r\n );\r\n const animTalkingOnPhonePromise = loader.loadAsync('/models/TalkingOnPhone' + extName);\r\n const animTellingASecretPromise = loader.loadAsync('/models/TellingASecret' + extName);\r\n const animThankfulPromise = loader.loadAsync('/models/Thankful' + extName);\r\n const animWalkingPromise = loader.loadAsync('/models/Walking' + extName);\r\n const animYawnPromise = loader.loadAsync('/models/Yawn' + extName);\r\n const animYesPromise = loader.loadAsync('/models/Yes' + extName);\r\n const animStandingIdlePromise = loader.loadAsync('/models/StandingIdle' + extName);\r\n\r\n // const animWavingPromise = fbxLoader.loadAsync('/models/Waving.fbx.glb');\r\n // const animWaving2Promise = fbxLoader.loadAsync('/models/Waving2.fbx.glb');\r\n // const animBashfulPromise = fbxLoader.loadAsync('/models/Bashful.fbx.glb');\r\n // const animHandRaisingPromise = fbxLoader.loadAsync('/models/HandRaising.fbx.glb');\r\n // const animHappyPromise = fbxLoader.loadAsync('/models/Happy.fbx.glb');\r\n // const animJumpingPromise = fbxLoader.loadAsync('/models/Jumping.fbx.glb');\r\n // const animLookingPromise = fbxLoader.loadAsync('/models/Looking.fbx.glb');\r\n // const animLooking2Promise = fbxLoader.loadAsync('/models/Looking2.fbx.glb');\r\n // const animLookingBehindPromise = fbxLoader.loadAsync('/models/LookingBehind.fbx.glb');\r\n // const animMacarenaDancePromise = fbxLoader.loadAsync('/models/MacarenaDance.fbx.glb');\r\n // const animNoPromise = fbxLoader.loadAsync('/models/No.fbx.glb');\r\n // const animPointingPromise = fbxLoader.loadAsync('/models/Pointing.fbx.glb');\r\n // const animReactingPromise = fbxLoader.loadAsync('/models/Reacting.fbx.glb');\r\n // const animRopeClimbPromise = fbxLoader.loadAsync('/models/RopeClimb.fbx.glb');\r\n // const animRumbaDancingPromise = fbxLoader.loadAsync('/models/RumbaDancing.fbx.glb');\r\n // const animSalsaDancingPromise = fbxLoader.loadAsync('/models/SalsaDancing.fbx.glb');\r\n // const animSillyDancingPromise = fbxLoader.loadAsync('/models/SillyDancing.fbx.glb');\r\n // const animStandingGreetingPromise = fbxLoader.loadAsync('/models/StandingGreeting.fbx.glb');\r\n // const animStandingUsingTouchscreenTabletPromise = fbxLoader.loadAsync(\r\n // '/models/StandingUsingTouchscreenTablet.fbx.glb'\r\n // );\r\n // const animTalkingOnPhonePromise = fbxLoader.loadAsync('/models/TalkingOnPhone.fbx.glb');\r\n // const animTellingASecretPromise = fbxLoader.loadAsync('/models/TellingASecret.fbx.glb');\r\n // const animThankfulPromise = fbxLoader.loadAsync('/models/Thankful.fbx.glb');\r\n // const animWalkingPromise = fbxLoader.loadAsync('/models/Walking.fbx.glb');\r\n // const animYawnPromise = fbxLoader.loadAsync('/models/Yawn.fbx.glb');\r\n // const animYesPromise = fbxLoader.loadAsync('/models/Yes.fbx.glb');\r\n // const animStandingIdlePromise = fbxLoader.loadAsync('/models/StandingIdle.fbx.glb');\r\n\r\n const animWaving = await animWavingPromise;\r\n const animWaving2 = await animWaving2Promise;\r\n const animBashful = await animBashfulPromise;\r\n const animHandRaising = await animHandRaisingPromise;\r\n const animHappy = await animHappyPromise;\r\n const animJumping = await animJumpingPromise;\r\n const animLooking = await animLookingPromise;\r\n const animLooking2 = await animLooking2Promise;\r\n const animLookingBehind = await animLookingBehindPromise;\r\n const animMacarenaDance = await animMacarenaDancePromise;\r\n const animNo = await animNoPromise;\r\n const animPointing = await animPointingPromise;\r\n const animReacting = await animReactingPromise;\r\n const animRopeClimb = await animRopeClimbPromise;\r\n const animRumbaDancing = await animRumbaDancingPromise;\r\n const animSalsaDancing = await animSalsaDancingPromise;\r\n const animSillyDancing = await animSillyDancingPromise;\r\n const animStandingGreeting = await animStandingGreetingPromise;\r\n const animStandingUsingTouchscreenTablet = await animStandingUsingTouchscreenTabletPromise;\r\n const animTalkingOnPhone = await animTalkingOnPhonePromise;\r\n const animTellingASecret = await animTellingASecretPromise;\r\n const animThankful = await animThankfulPromise;\r\n const animWalking = await animWalkingPromise;\r\n const animYawn = await animYawnPromise;\r\n const animYes = await animYesPromise;\r\n const animStandingIdle = await animStandingIdlePromise;\r\n\r\n //process model\r\n\r\n //normalize model and materials\r\n updateTextureEncoding(modelGlb.scene);\r\n\r\n modelGlb.scene.scale.set(100, 100, 100); // scale here\r\n self.bufferScene.add(modelGlb.scene);\r\n\r\n self.mixer = new AnimationMixer(modelGlb.scene);\r\n\r\n self.mixer.addEventListener('loop', onLoopFinished);\r\n\r\n function onLoopFinished(event: any) {\r\n //console.log('finished');\r\n sceneEngine.animationFinished(event.action._clip.name);\r\n }\r\n\r\n //var newMaterial = new MeshBasicMaterial({ color: 0xff00ff });\r\n\r\n modelGlb.scene.traverse(function (child) {\r\n child.frustumCulled = false;\r\n });\r\n\r\n modelGlb.scene.traverse(function (child: any) {\r\n if (child.isMesh) {\r\n // TOFIX RoughnessMipmapper seems to be broken with WebGL 2.0\r\n // roughnessMipmapper.generateMipmaps( child.material );\r\n //console.log(child);\r\n //console.log(child.material);\r\n //child.material = newMaterial;\r\n\r\n child.material.side = DoubleSide; //DoubleSide;\r\n //child.material.transparent = true;\r\n //child.material.opacity = 0.1;\r\n }\r\n });\r\n\r\n //find bones\r\n const boneWorldPos = new Vector3();\r\n (self as any).headBone = modelGlb.scene.getObjectByName('HeadTop_End');\r\n (self as any).headBone.getWorldPosition(boneWorldPos);\r\n console.log(boneWorldPos);\r\n\r\n\r\n self.modelAnimations = [];\r\n self.modelAnimationsNamed = {};\r\n\r\n processAnimations('Waving', animWaving, modelGlb);\r\n processAnimations('Waving2', animWaving2, modelGlb);\r\n processAnimations('Bashful', animBashful, modelGlb);\r\n processAnimations('HandRising', animHandRaising, modelGlb);\r\n processAnimations('Happy', animHappy, modelGlb);\r\n processAnimations('Jump', animJumping, modelGlb);\r\n processAnimations('Looking', animLooking, modelGlb);\r\n processAnimations('Looking2', animLooking2, modelGlb);\r\n processAnimations('LookingBehind', animLookingBehind, modelGlb);\r\n processAnimations('Macarena', animMacarenaDance, modelGlb);\r\n processAnimations('No', animNo, modelGlb);\r\n processAnimations('Pointing', animPointing, modelGlb);\r\n processAnimations('Reacting', animReacting, modelGlb);\r\n processAnimations('Climbing', animRopeClimb, modelGlb);\r\n processAnimations('RumbaDancing', animRumbaDancing, modelGlb);\r\n processAnimations('Salsa', animSalsaDancing, modelGlb);\r\n processAnimations('SillyDancing', animSillyDancing, modelGlb);\r\n processAnimations('Greeting', animStandingGreeting, modelGlb);\r\n processAnimations('Tablet', animStandingUsingTouchscreenTablet, modelGlb);\r\n processAnimations('*', animTalkingOnPhone, modelGlb);\r\n processAnimations('Secret', animTellingASecret, modelGlb);\r\n processAnimations('Thankful', animThankful, modelGlb);\r\n processAnimations('Walking', animWalking, modelGlb);\r\n processAnimations('Yawn', animYawn, modelGlb);\r\n processAnimations('Yes', animYes, modelGlb);\r\n processAnimations('Idle', animStandingIdle, modelGlb);\r\n\r\n\r\n //amy head and visemes\r\n //console.log(modelGlb as any);\r\n const visemeMesh = modelGlb.scene.getObjectByName('Wolf3D_Head');\r\n const visemeMeshTeeth = modelGlb.scene.getObjectByName('Wolf3D_Teeth');\r\n const visemeMeshEyeLeft = modelGlb.scene.getObjectByName('EyeLeft');\r\n //const visemeMeshEyeRight = modelGlb.scene.getObjectByName('EyeRight');\r\n\r\n //console.log(visemeMesh);\r\n //const meshAmy = visemeMesh as any;\r\n\r\n //draco\r\n const meshAmy = visemeMesh.children[0] as Mesh;\r\n const meshAmyTeeth = visemeMeshTeeth.children[0] as Mesh;\r\n const meshAmyEyeLeft = visemeMeshEyeLeft.children[0] as Mesh;\r\n //const meshAmyEyeRight = visemeMeshEyeRight.children[0] as Mesh;\r\n\r\n //non draco original\r\n // const meshAmy = visemeMesh as Mesh;\r\n // const meshAmyTeeth = visemeMeshTeeth as Mesh;\r\n // const meshAmyEyeLeft = visemeMeshEyeLeft as Mesh;\r\n // const meshAmyEyeRight = visemeMeshEyeRight as Mesh;\r\n\r\n\r\n const mixerHead = new AnimationMixer(meshAmy);\r\n (self as any).mixerHead = mixerHead;\r\n const mixerTeeth = new AnimationMixer(meshAmyTeeth);\r\n (self as any).mixerTeeth = mixerTeeth;\r\n\r\n const mixerEyeLeft = new AnimationMixer(meshAmy);\r\n (self as any).mixerEyeLeft = mixerEyeLeft;\r\n\r\n function onHeadFinished2(event: any) {\r\n if (window.mixerHeadFinishedFx) {\r\n window.mixerHeadFinishedFx();\r\n }\r\n }\r\n\r\n (self as any).mixerHead.addEventListener('finished', onHeadFinished2);\r\n\r\n\r\n // const viseme_PP_sil = meshAmy.morphTargetDictionary['viseme_sil'];\r\n // const viseme_PP_Pos = meshAmy.morphTargetDictionary['viseme_PP'];\r\n // const viseme_FF_Pos = meshAmy.morphTargetDictionary['viseme_FF'];\r\n // const viseme_TH_Pos = meshAmy.morphTargetDictionary['viseme_TH'];\r\n // const viseme_DD_Pos = meshAmy.morphTargetDictionary['viseme_DD'];\r\n // const viseme_kk_Pos = meshAmy.morphTargetDictionary['viseme_kk'];\r\n // const viseme_CH_Pos = meshAmy.morphTargetDictionary['viseme_CH'];\r\n // const viseme_SS_Pos = meshAmy.morphTargetDictionary['viseme_SS'];\r\n // const viseme_nn_Pos = meshAmy.morphTargetDictionary['viseme_nn'];//--\r\n // const viseme_RR_Pos = meshAmy.morphTargetDictionary['viseme_RR'];\r\n // const viseme_aa_Pos = meshAmy.morphTargetDictionary['viseme_aa'];\r\n // const viseme_E_Pos = meshAmy.morphTargetDictionary['viseme_E'];//--d\r\n // const viseme_I_Pos = meshAmy.morphTargetDictionary['viseme_I'];\r\n // const viseme_O_Pos = meshAmy.morphTargetDictionary['viseme_O'];\r\n // const viseme_U_Pos = meshAmy.morphTargetDictionary['viseme_U'];\r\n\r\n\r\n // create an AudioListener and add it to the camera\r\n const listener = new Three_AudioListener();\r\n self.bufferCamera.add(listener);\r\n\r\n const sound = new Three_Audio(listener);\r\n\r\n self.sound = sound;\r\n\r\n scubeContext.toggleMuteUserAudioFx = (mute: boolean) =>{\r\n if(mute)\r\n {\r\n window.lastAudioVolume = sound.getVolume();\r\n sound.setVolume(0.0);\r\n }else{\r\n sound.setVolume(window.lastAudioVolume);\r\n }\r\n };\r\n\r\n scubeContext.userActionPauseToggleAudioFx = (mute: boolean) =>{\r\n //const sound = new Three_Audio(listener);\r\n if(mute)\r\n {\r\n sound.pause();\r\n\r\n (self as any).mixerHead.activeClip.paused = true;\r\n (self as any).mixerTeeth.activeClip.paused = true;\r\n }else{\r\n sound.play();\r\n\r\n (self as any).mixerHead.activeClip.paused = false;\r\n (self as any).mixerTeeth.activeClip.paused = false;\r\n }\r\n };\r\n\r\n// create a global audio source\r\n\r\n\r\n scubeContext.userActionPlayAudioFx = (data: any) => {\r\n// load a sound and set it as the Audio object's buffer\r\n const audioLoader = new Three_AudioLoader();\r\n\r\n //prepare animation clips\r\n // console.log(testVisemeAmyScenarioJson.block_0.visemes.length);\r\n\r\n const totalBlockSec = data.block.TotalSeconds;\r\n\r\n const allTracks = [];\r\n\r\n let lastOffset = 0;\r\n //for (let i = 0; i < testVisemeAmyScenarioJson.Hello.visemes.length; i++) {\r\n for (let i = 0; i < data.visemeBlock.visemes.length; i++) {\r\n const curViseme = data.visemeBlock.visemes[i];\r\n const curVisemeDef = visemesByNumber[curViseme.v];\r\n\r\n const visemeTimeSec = (curViseme.o - lastOffset) / 1000;\r\n\r\n const curOffset = curViseme.o / 1000;\r\n\r\n const minVisemeBlendTime = Math.min(0.15, visemeTimeSec);\r\n\r\n //\r\n // console.log(curVisemeDef.playerViseme);\r\n // console.log(visemeTimeSec);\r\n // console.log([0.0 + curOffset, minVisemeBlendTime + curOffset, visemeTimeSec + curOffset + 0.15]);\r\n\r\n //console.log([0.0 + curOffset, minVisemeBlendTime + curOffset, totalBlockSec]);\r\n //check last item\r\n if (i == data.visemeBlock.visemes.length - 1) {\r\n\r\n\r\n const curStep = new NumberKeyframeTrack(\r\n '.morphTargetInfluences[' + curVisemeDef.playerViseme + ']',\r\n [0.0 + curOffset, minVisemeBlendTime + curOffset, totalBlockSec],//set to end\r\n [0.0, 0.45, 0.0],\r\n InterpolateLinear\r\n );\r\n\r\n allTracks.push(curStep);\r\n } else {\r\n const curStep = new NumberKeyframeTrack(\r\n '.morphTargetInfluences[' + curVisemeDef.playerViseme + ']',\r\n [0.0 + curOffset, minVisemeBlendTime + curOffset, visemeTimeSec + curOffset + 0.15],\r\n [0.0, 0.45, 0.0],\r\n InterpolateLinear\r\n );\r\n\r\n allTracks.push(curStep);\r\n }\r\n\r\n\r\n lastOffset = curViseme.o;\r\n }\r\n //\r\n const fullClip2 = new AnimationClip('myclip' + data.block.BlockId, undefined, allTracks, AdditiveAnimationBlendMode);\r\n\r\n\r\n console.log({duration: lastOffset / 1000});\r\n\r\n\r\n (self as any).mixerHead.stopAllAction();\r\n (self as any).mixerTeeth.stopAllAction();\r\n // // //const fullClip = new AnimationClip('myclip', undefined, [fullV_I]);\r\n const fullClipActionHead = (self as any).mixerHead.clipAction(fullClip2).setDuration(totalBlockSec).setLoop(LoopOnce, 0);//.play();//lastOffset / 1000\r\n const fullClipActionTeeth = (self as any).mixerTeeth.clipAction(fullClip2).setDuration(totalBlockSec).setLoop(LoopOnce, 0);//.play();//lastOffset / 1000\r\n // fullClipAction2.play();\r\n fullClipActionHead.loop = LoopOnce;\r\n fullClipActionTeeth.loop = LoopOnce;\r\n\r\n console.log(data.uriAudio);\r\n\r\n //\"/api/v1/t/\" + scubeContext.TenantUriName + \"/c/\" + this.props.client + \"/client-amyScenario/get-voice-file?scenarioTemplate=\" + scenarioTemplate + \"&voiceFileName=\" + voiceFileName + \"\"\r\n //const uriAudio = \"/api/v1/t/\" + scubeContext.TenantUriName + \"/c/\" + this.props.client + \"/client-amyScenario/get-voice-file?scenarioTemplate=\" + scenarioTemplate + \"&voiceFileName=\" + voiceFileName + \"\"\r\n //audioLoader.load('/dapi/v1/Debug/getDebugAmyScenarioAudio?blockName=' + data.block.BlockId + '&n=' + new Date().getUTCMilliseconds(), function (buffer) {\r\n audioLoader.load(data.uriAudio + '&v=' + window.staticfilesversion, function (buffer) {\r\n if (sound.isPlaying) {\r\n sound.stop();\r\n }\r\n\r\n sound.setBuffer(buffer);\r\n sound.setLoop(false);\r\n //sound.setVolume(0.5);\r\n //sound.play();\r\n //scubeContext.userAudioSource = sound;\r\n sound.onEnded = () => {\r\n console.log(\"onEnded\")\r\n sound.isPlaying = false\r\n }\r\n\r\n //console.log(sound.offset);\r\n //console.log(sound.context.currentTime);//sa meni po pauze\r\n //console.log(sound._progress);\r\n //console.log(sound._startedAt);\r\n\r\n (sound as any)._progress = 0;\r\n (sound as any)._startedAt = 0;\r\n\r\n sound.play(0);\r\n\r\n (self as any).mixerHead.activeClip = fullClipActionHead;\r\n (self as any).mixerTeeth.activeClip = fullClipActionTeeth;\r\n\r\n\r\n fullClipActionHead.play();\r\n fullClipActionTeeth.play();\r\n\r\n //console.log((self as any).mixerHead.activeClip);\r\n\r\n console.log('audio loaded');\r\n });\r\n\r\n };\r\n\r\n\r\n\r\n //console.log(meshAmy.morphTargetDictionary);\r\n\r\n // const eyeLookInLeftPos = meshAmy.morphTargetDictionary['eyeLookInLeft'];\r\n // const eyeLookOutLeftPos = meshAmy.morphTargetDictionary['eyeLookOutLeft'];\r\n // meshAmyEyeLeft.morphTargetInfluences[eyeLookInLeftPos] = 0.75;\r\n\r\n\r\n self.morphTarget = (targetName:amyMorphtargets, value:number)=>{\r\n const curMorphTarget = meshAmy.morphTargetDictionary[targetName];\r\n //console.log(targetName);\r\n if(curMorphTarget)\r\n {\r\n meshAmy.morphTargetInfluences[curMorphTarget] = value;\r\n meshAmyTeeth.morphTargetInfluences[curMorphTarget] = value;\r\n meshAmyEyeLeft.morphTargetInfluences[curMorphTarget] = value;\r\n }\r\n };\r\n\r\n const eyeTimes = [0, 0.1, 0.3, 4.0, 4.1, 4.3, 11, 11.1, 11.3, 18];\r\n const eyeValues = [0.1, 2.0, 0.3, 0.1, 2.0, 0.1, 0.3, 2.0, 0.1, 0.3];\r\n\r\n const eyeBlinkLeftTarget = meshAmyEyeLeft.morphTargetDictionary['eyeBlinkLeft'];\r\n const eyeBlinkRightTarget = meshAmyEyeLeft.morphTargetDictionary['eyeBlinkRight'];\r\n //animate eyes blinking\r\n const fullLeftEyeBlonk = new NumberKeyframeTrack(\r\n '.morphTargetInfluences[' + eyeBlinkLeftTarget + ']',\r\n eyeTimes,\r\n eyeValues,\r\n InterpolateLinear\r\n );\r\n const fullRightEyeBlonk = new NumberKeyframeTrack(\r\n '.morphTargetInfluences[' + eyeBlinkRightTarget + ']',\r\n eyeTimes,\r\n eyeValues,\r\n InterpolateLinear\r\n );\r\n\r\n const fullEyeClip = new AnimationClip('myEyeClip', undefined, [fullLeftEyeBlonk, fullRightEyeBlonk]);\r\n const fullEyeClipAction2 = (self as any).mixerEyeLeft.clipAction(fullEyeClip).setDuration(18).play();\r\n fullEyeClipAction2.play();\r\n\r\n\r\n\r\n\r\n //pozor vonkajsi animacny event\r\n sceneEngine.curSceneContext.invokeFadeToAnimation = (newAnimationName) => {\r\n\r\n if (!self.modelAnimationsNamed[newAnimationName]) {\r\n console.log('missing animation : ' + newAnimationName);\r\n return;\r\n }\r\n\r\n const newAction = self.modelAnimationsNamed[newAnimationName];\r\n\r\n // zakomentovane animacie\r\n if ((newAction as any)._clip.name != 'Walking') {\r\n newAction.loop = LoopPingPong;\r\n }\r\n // zakomentovane animacie\r\n setWeight(newAction, 1);\r\n newAction.time = 0;\r\n\r\n if (self.curAction != null) {\r\n if ((self.curAction as any)._clip.name != (newAction as any)._clip.name)\r\n // iba ak su rozne\r\n self.curAction.crossFadeTo(newAction, 0.75, true);\r\n }\r\n\r\n self.curAction = newAction;\r\n ////newAction.halt(1.0);\r\n newAction.play();\r\n };\r\n\r\n sceneEngine.startScene();\r\n }\r\n\r\n loadModels();\r\n};\r\n\r\nconst CreateScene = (width: number, height: number) => {\r\n let result = {\r\n } as amy3DHolderType;\r\n\r\n sceneEngine.curSceneContext.amy3DHolder = result;\r\n\r\n // renderer\r\n result.renderer = new WebGLRenderer({antialias: true, alpha: true}); //, alpha: true - transparency\r\n\r\n //sceneHolder.renderer.setClearColor(sceneHolder.matrixClearColor, 0);\r\n\r\n result.amyClearColor = new Color(0x010000);\r\n result.matrixClearColor = new Color(0x010000);\r\n result.renderer.setClearColor(0xffffff, 0);\r\n //result.renderer.setClearAlpha(0.0);\r\n //result.renderer.outputEncoding = sRGBEncoding;\r\n result.renderer.outputColorSpace = SRGBColorSpace;\r\n //result.renderer.toneMapping = ACESFilmicToneMapping;//martin\r\n\r\n //result.bufferCamera.aspect = 1.0;\r\n\r\n // Create a different scene to hold our buffer objects\r\n result.bufferScene = new Scene();\r\n\r\n result.bufferCamera = new PerspectiveCamera(20, width / height, 0.1, 2000) as any;\r\n\r\n //result.bufferCamera = new OrthographicCamera(-100,100, 100,-100,1,1000);\r\n\r\n result.bufferCamera.position.set(0, 170, 400.0);\r\n result.bufferCamera.lookAtPosition = new Vector3(0, 120, 0);\r\n\r\n result.bufferCamera.lookAt(result.bufferCamera.lookAtPosition);\r\n\r\n result.bufferCamera.updateProjectionMatrix();\r\n\r\n const hemisphereLight = new HemisphereLight(0xe6ffff, 0x555555, 3.0);\r\n\r\n hemisphereLight.position.set(0, 500, 0);\r\n result.bufferScene.add(hemisphereLight);\r\n\r\n const dlight = new DirectionalLight(0xffffff, 2.0);\r\n dlight.position.set(-300, 200, 400);\r\n dlight.castShadow = true;\r\n dlight.shadow.camera.top = 50;\r\n dlight.shadow.camera.bottom = -50;\r\n dlight.shadow.camera.left = -50;\r\n dlight.shadow.camera.right = 50;\r\n result.bufferScene.add(dlight);\r\n\r\n //result.bufferScene.add(new DirectionalLightHelper(dlight, 5));\r\n\r\n reloadModel(result);\r\n //init particles\r\n initControls(result);\r\n\r\n // clock\r\n result.clock = new Clock(true);\r\n\r\n return result;\r\n};\r\n\r\nfunction setWeight(action: AnimationAction, weight: number) {\r\n action.enabled = true;\r\n action.setEffectiveTimeScale(1);\r\n action.setEffectiveWeight(weight);\r\n}\r\n\r\nconst Amy3DLazy = ({\r\n amyScene,\r\n amyModel,\r\n className,\r\n dimensions,\r\n }: {\r\n amyScene: sceneType;\r\n amyModel: string;\r\n className?: string;\r\n dimensions: { width: number; height: number; };\r\n}) => {\r\n const mount = useRef(null);\r\n const resizeRef = useRef<(width: number, height: number)=>void>(null);\r\n const [isAnimating] = useState(true);\r\n const controls = useRef<{ start: () => void; stop: () => void } | null>(null);\r\n\r\n useEffect(() => {\r\n //console.log('init amy webgl');\r\n\r\n let width = dimensions.width;\r\n let height = dimensions.height;\r\n let frameId: number | null;\r\n\r\n sceneEngine.init(amyScene, amyModel);\r\n const sceneHolder = CreateScene(width, height);\r\n\r\n //init resize\r\n if (sceneEngine.curSceneContext) {\r\n sceneEngine.curSceneContext.invokeSetSize = (width, height) => {\r\n handleResize(width, height);\r\n };\r\n }\r\n\r\n const calculateEyes = (quaternion: Quaternion, globalTime: number, amy3DHolder: amy3DHolderType) => {\r\n// Create a rotation matrix from the Quaternion\r\n //const rotationMatrix = new Matrix4();\r\n //rotationMatrix.makeRotationFromQuaternion(quaternion);\r\n // const element8 = rotationMatrix.elements[8];\r\n // const element6 = rotationMatrix.elements[6];\r\n\r\n const element8_2 = 2 * quaternion.x * quaternion.z + 2 * quaternion.y * quaternion.w;\r\n const element6_2 = 2 * quaternion.y * quaternion.z + 2 * quaternion.x * quaternion.w;//https://threejs.org/docs/#api/en/math/Matrix4\r\n\r\n //console.log({e6: element6, e8: element8, e6_1: element6_2, e8_2: element8_2});\r\n\r\n const angleHorizontal = (Math.asin(Math.abs(element8_2)) + 0.2) * 2. / Math.PI;\r\n const angleVertical = (Math.asin(Math.abs(element6_2)) + 0.1) * 2. / Math.PI;\r\n\r\n //console.log({h: angleHorizontal, v: angleVertical});\r\n\r\n //console.log({hor:angleHorizontal});\r\n //casovac\r\n\r\n const eyeCorrection = 0.2;\r\n const horizontalShift = 0.03 * Math.sin(globalTime / 2.) * Math.min(Math.exp(-globalTime * globalTime / 4 * Math.cos(globalTime)), 10.);\r\n const verticalShift = 0.02 * Math.cos(globalTime / 2.) * Math.min(Math.exp(-globalTime * globalTime / 4 * Math.cos(globalTime)), 10.);\r\n\r\n const leftEyeAngle = angleHorizontal + horizontalShift;\r\n const rightEyeAngle = angleHorizontal + horizontalShift + eyeCorrection;\r\n\r\n if (leftEyeAngle >= 0) {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookInLeft, Math.max(Math.min(leftEyeAngle, 1.), 0.) / 1.5);\r\n } else {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookOutLeft, Math.max(Math.min(Math.abs(leftEyeAngle), 1.), 0.));\r\n }\r\n\r\n if (rightEyeAngle >= 0) {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookOutRight, Math.max(Math.min(rightEyeAngle, 1.), 0.));\r\n } else {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookInRight, Math.max(Math.min(Math.abs(rightEyeAngle), 1.), 0.) / 1.5);\r\n }\r\n\r\n if ((angleVertical + verticalShift) >= 0) {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookDownLeft, Math.max(Math.min(angleVertical + verticalShift, 1.), 0.));\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookDownRight, Math.max(Math.min(angleVertical + verticalShift, 1.), 0.));\r\n } else {\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookUpLeft, Math.max(Math.min(Math.abs(angleVertical + verticalShift), 1.), 0.));\r\n amy3DHolder.morphTarget(amyMorphtargets.eyeLookUpRight, Math.max(Math.min(Math.abs(angleVertical + verticalShift), 1.), 0.));\r\n }\r\n }\r\n\r\n\r\n\r\n let renderCounter = 0;\r\n const renderScene = () => {\r\n renderCounter++;\r\n\r\n //if (renderCounter % 5 !== 0) return;//spomali render a setri mobil\r\n\r\n const delta = sceneHolder.clock.getDelta();\r\n const globalTime = sceneHolder.clock.getElapsedTime();\r\n \r\n window.delta = globalTime;\r\n\r\n //update scene parts\r\n if (sceneHolder.mixer) sceneHolder.mixer.update(delta);\r\n if ((sceneHolder as any).mixerHead) {\r\n (sceneHolder as any).mixerHead.update(delta);\r\n\r\n if ((sceneHolder as any).mixerHead.activeClip) {\r\n window.mixerHeadTime = (sceneHolder as any).mixerHead.activeClip.time;\r\n }\r\n }\r\n if ((sceneHolder as any).mixerTeeth) (sceneHolder as any).mixerTeeth.update(delta);\r\n if ((sceneHolder as any).mixerEyeLeft) (sceneHolder as any).mixerEyeLeft.update(delta);\r\n if ((sceneHolder as any).mixerEyeRight) (sceneHolder as any).mixerEyeRight.update(delta);\r\n\r\n\r\n //head bones positions\r\n if((sceneHolder as any).headBone) {\r\n //const boneWorldPos = new Vector3();\r\n //const boneWorldDirectornPos = new Vector3(0,0,1);\r\n const boneWorldDirectornPosQ = new Quaternion();\r\n //(sceneHolder as any).headBone.getWorldPosition(boneWorldPos);\r\n //(sceneHolder as any).headBone.getWorldDirection(boneWorldDirectornPos);\r\n (sceneHolder as any).headBone.getWorldQuaternion(boneWorldDirectornPosQ);\r\n //window.amyModelHeadVector = boneWorldPos;\r\n\r\n //console.log((sceneHolder as any).headBone.rotation);//rotation is not updated and recalculated, gpu\r\n\r\n //const e1 = new Euler( 0, 0, 0, 'XYZ' );\r\n //e1.setFromQuaternion(boneWorldDirectornPosQ);\r\n\r\n //window.amyModelHeadDirectionEuler = e1;\r\n window.amyModelHeadDirectionQ = boneWorldDirectornPosQ;\r\n\r\n // console.log(boneWorldDirectornPos);\r\n // console.log(boneWorldDirectornPosQ);\r\n //console.log(e1);\r\n\r\n calculateEyes(boneWorldDirectornPosQ, globalTime, sceneHolder);\r\n }\r\n\r\n //precalculate eyes\r\n\r\n\r\n\r\n\r\n //sceneHolder.renderer.setClearColor(sceneHolder.amyClearColor, 1);\r\n sceneHolder.renderer.render(sceneHolder.bufferScene, sceneHolder.bufferCamera);\r\n };\r\n\r\n const handleResize = (width: number, height: number) => {\r\n //console.log('amy webgl handleResize');\r\n\r\n sceneHolder.renderer.setSize(width, height);\r\n sceneHolder.bufferCamera.aspect = width / height;\r\n sceneHolder.bufferCamera.updateProjectionMatrix();\r\n\r\n renderScene();\r\n };\r\n\r\n resizeRef.current = handleResize;\r\n\r\n const animate = () => {\r\n renderScene();\r\n frameId = window.requestAnimationFrame(animate);\r\n };\r\n\r\n const start = () => {\r\n if (!frameId) {\r\n frameId = requestAnimationFrame(animate);\r\n }\r\n };\r\n\r\n const stop = () => {\r\n if (frameId) {\r\n cancelAnimationFrame(frameId);\r\n }\r\n frameId = null;\r\n\r\n if(sceneHolder.sound) {\r\n try {\r\n sceneHolder.sound.stop();\r\n }catch{\r\n //skip not played audio\r\n }\r\n }\r\n };\r\n\r\n mount.current.appendChild(sceneHolder.renderer.domElement);\r\n\r\n const localMount = mount.current;\r\n\r\n start();\r\n\r\n controls.current = {start, stop};\r\n\r\n handleResize(dimensions.width, dimensions.height);\r\n\r\n return () => {\r\n stop();\r\n if (localMount) {\r\n localMount.removeChild(sceneHolder.renderer.domElement);\r\n }\r\n };\r\n }, [\r\n amyScene,\r\n amyModel,\r\n ]);\r\n\r\n useEffect(() => {\r\n resizeRef.current?.(dimensions.width, dimensions.height);\r\n }, [dimensions.width, dimensions.height]);\r\n\r\n useEffect(() => {\r\n if (isAnimating) {\r\n controls.current?.start();\r\n } else {\r\n controls.current?.stop();\r\n }\r\n }, [isAnimating]);\r\n\r\n return (\r\n setAnimating(!isAnimating)}\r\n style={{width: dimensions.width, height: dimensions.height}}\r\n />\r\n );\r\n};\r\n\r\nexport default Amy3DLazy;\r\n"],"names":["ApplicationType","Lite","Guest","FullClient","SignUp","Identity","Support","Partner","InvitedAnonymous","Translations","CONSTRUCTOR","REACT_EXCLUDE_METHODS","render","setState","forceUpdate","UNSAFE_componentWillUpdate","UNSAFE_componentWillMount","getChildContext","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","componentWillUpdate","componentDidUpdate","componentWillUnmount","componentDidCatch","getSnapshotBeforeUpdate","bind","name","instance","proto","isPrototype","descriptor","Object","getOwnPropertyDescriptor","get","set","defineProperty","_objectSpread","value","sceneContext","_classCallCheck","curSequence","undefined","currentScene","amy3DHolder","eventListeners","invokeSetSize","onAnimationFinished","invokeAnimationStart","invokeFadeToAnimation","_createClass","key","sequence","this","onStart","animationName","_this$invokeFadeToAni","call","effect","camera","_this$curSequence","width","height","_this$invokeSetSize","_this$curSequence2","onCameraFinished","_this$curSequence3","onEffectFinished","sceneEvent","onEvent","i","length","audioCtx","safeAudioContext","state","scubeContext","onstatechange","gainNode","createGain","connect","destination","lastAudioSource","disableSpeech","sceneEngine","curSceneContext","init","scene","amyModel","modelName","startScene","_this$curSceneContext","_this$curSceneContext2","stopScene","_this$curSceneContext3","_this$curSceneContext4","onStop","pushEvent","invokeEvent","animationFinished","_this$curSceneContext5","setSize","_this$curSceneContext6","subscribeListen","eventListener","_this$curSceneContext7","push","unSubscribeListen","_this$curSceneContext8","_this$curSceneContext9","index","indexOf","splice","stopSpeech","stop","e","disconnect","publishAmySpeechChanged","enableSpeech","initMuteValue","isMuted","gain","setValueAtTime","currentTime","unSuspend","resume","toggleMute","isMutedState","localStorage","setItem","String","handlersAmySpeech","handlerAmySpeechCounter","subscribeAmySpeech","handler","_this","keyString","toString","unsubscribeAmySpeech","values","playSpeech","speechData","onSpeechStarted","onSpeechFinished","fetch","concat","then","res","blob","arrayBuffer","audioData","useDelay","decodeAudioData","buffer","createBufferSource","addEventListener","start","getPrototypeOf","error","Error","getOwnPropertyNames","forEach","proto2","name2","autobind","amyMorphtargets","visemesByNumber","vowelIpaViseme","azVisemeId","ipaNameExamplePairsArray","awsVisemes","playerViseme","reloadModel","result","_sceneEngine$curScene","_sceneEngine$curScene2","self","amySettings","curAnimationModel","bufferScene","remove","updateTextureEncoding","curContent","callback","material","traverse","node","isMesh","Array","isArray","loader","GLTFLoader","_loadModels","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_sceneEngine$curScene3","_sceneEngine$curScene4","processAnimations","modelPath","modelGlb","extName","animWavingPromise","animWaving2Promise","animBashfulPromise","animHandRaisingPromise","animHappyPromise","animJumpingPromise","animLookingPromise","animLooking2Promise","animLookingBehindPromise","animMacarenaDancePromise","animNoPromise","animPointingPromise","animReactingPromise","animRopeClimbPromise","animRumbaDancingPromise","animSalsaDancingPromise","animSillyDancingPromise","animStandingGreetingPromise","animStandingUsingTouchscreenTabletPromise","animTalkingOnPhonePromise","animTellingASecretPromise","animThankfulPromise","animWalkingPromise","animYawnPromise","animYesPromise","animStandingIdlePromise","animWaving","animWaving2","animBashful","animHandRaising","animHappy","animJumping","animLooking","animLooking2","animLookingBehind","animMacarenaDance","animNo","animPointing","animReacting","animRopeClimb","animRumbaDancing","animSalsaDancing","animSillyDancing","animStandingGreeting","animStandingUsingTouchscreenTablet","animTalkingOnPhone","animTellingASecret","animThankful","animWalking","animYawn","animYes","animStandingIdle","onLoopFinished","boneWorldPos","visemeMesh","visemeMeshTeeth","visemeMeshEyeLeft","meshAmy","meshAmyTeeth","meshAmyEyeLeft","mixerHead","mixerTeeth","mixerEyeLeft","onHeadFinished2","listener","sound","eyeTimes","eyeValues","eyeBlinkLeftTarget","eyeBlinkRightTarget","fullLeftEyeBlonk","fullRightEyeBlonk","fullEyeClip","wrap","_context","prev","next","event","window","mixerHeadFinishedFx","action","_clip","objectAnim","objectModel","animations","curAnim","duration","tracks","track","trim","mixer","clipAction","modelAnimations","modelAnimationsNamed","staticfilesversion","replace","loadAsync","sent","scale","add","AnimationMixer","child","frustumCulled","side","DoubleSide","Vector3","headBone","getObjectByName","getWorldPosition","console","log","children","Three_AudioListener","bufferCamera","Three_Audio","mute","lastAudioVolume","getVolume","setVolume","pause","activeClip","paused","play","data","audioLoader","Three_AudioLoader","totalBlockSec","block","TotalSeconds","allTracks","lastOffset","visemeBlock","visemes","curViseme","curVisemeDef","v","visemeTimeSec","o","curOffset","minVisemeBlendTime","Math","min","curStep","NumberKeyframeTrack","InterpolateLinear","fullClip2","AnimationClip","BlockId","AdditiveAnimationBlendMode","stopAllAction","fullClipActionHead","setDuration","setLoop","LoopOnce","fullClipActionTeeth","loop","uriAudio","load","isPlaying","setBuffer","onEnded","_progress","_startedAt","morphTarget","targetName","curMorphTarget","morphTargetDictionary","morphTargetInfluences","newAnimationName","newAction","LoopPingPong","setWeight","time","curAction","crossFadeTo","apply","arguments","loadModels","weight","enabled","setEffectiveTimeScale","setEffectiveWeight","_ref","amyScene","className","dimensions","mount","useRef","resizeRef","_useState","useState","isAnimating","_slicedToArray","controls","useEffect","frameId","sceneHolder","renderer","WebGLRenderer","antialias","alpha","amyClearColor","Color","matrixClearColor","setClearColor","outputColorSpace","SRGBColorSpace","Scene","PerspectiveCamera","position","lookAtPosition","lookAt","updateProjectionMatrix","hemisphereLight","HemisphereLight","dlight","DirectionalLight","castShadow","shadow","top","bottom","left","right","clock","Clock","CreateScene","handleResize","renderScene","renderCounter","delta","getDelta","globalTime","getElapsedTime","update","mixerHeadTime","mixerEyeRight","boneWorldDirectornPosQ","Quaternion","getWorldQuaternion","amyModelHeadDirectionQ","quaternion","element8_2","x","z","y","w","element6_2","angleHorizontal","asin","abs","PI","angleVertical","horizontalShift","sin","exp","cos","verticalShift","leftEyeAngle","rightEyeAngle","eyeLookInLeft","max","eyeLookOutLeft","eyeLookOutRight","eyeLookInRight","eyeLookDownLeft","eyeLookDownRight","eyeLookUpLeft","eyeLookUpRight","calculateEyes","aspect","current","animate","requestAnimationFrame","cancelAnimationFrame","_unused","appendChild","domElement","localMount","removeChild","_resizeRef$current","_controls$current","_controls$current2","_jsx","ref","style"],"sourceRoot":""}