import '@sdk/modules/core/Scene' import '@sdk/internal/Store' import '@sdk/internal/Resource' import * as PetiteVue from '@sdk/template' import { setup as setupSDK } from '@sdk/modules/sdk' import { setup as setupFetch } from '@sdk/utils/request' import KanKan from '@sdk/internal/core' import { usePlugin } from '@sdk/utils/scripts' import { Emiter } from '@sdk/utils/Emiter' import Deferred from '@sdk/utils/Deferred' import transitions from '@sdk/utils/transitions' import easing from '@sdk/utils/easing' import lerp from '@sdk/utils/lerp' import MathLight from '@sdk/utils/MathLight' import convert from '@sdk/utils/convert' import math from '@sdk/utils/math' import * as editApis from '@sdk/apis/scene-edit.js' import * as viewApis from '@sdk/apis/scene-view.js' import Viewmode from '@sdk/modules/core/enum/Viewmode' export default class extends KanKan { static MITT = { Emiter } static Utils = { math, convert, MathLight } static Animate = { transitions, easing, lerp } static Viewmode = Viewmode static THREE = THREE static Deferred = Deferred constructor(options) { super(options) this.withComponent('store') this.withComponent('resource') this.withComponent('Scene') if (this.config.dom) { this.withDom() } this.remote_editor = editApis this.remote_viewer = viewApis setupSDK(this) setupFetch(this) if (this.config.useStatistics) { window._hmt = window._hmt || [] ;(function () { var hm = document.createElement('script') hm.src = 'https://hm.baidu.com/hm.js?aa59943d9a481ab824cf054f2d463ca2' var s = document.getElementsByTagName('script')[0] s.parentNode.insertBefore(hm, s) })() } // const medici = Medici.init({ // platform: 'web', // appId: '7b5958d5-1ae6-4ad5-8a87-5fc8a4b92999', // // endPoint: 'https://v4-test.4dkankan.com', //服务器 // endPoint: '/track_api', //服务器 // config: { // version: '1', //配置要track当前版本 // }, // }) // KanKan.medici = medici } use(plugin, config) { if (typeof plugin === 'string') { if (this.Plugins[plugin]) { return Promise.resolve(this.Plugins[plugin]) } return usePlugin(plugin, this.config.version + '-' + Date.now()).then(name => { return this.Plugins.add(window[name], config) }) } else if (typeof plugin === 'function') { return this.Plugins.add(plugin, config) } } mount(el) { if (!el) { throw new Error('el must be require') } this.config.dom = el this.withDom() return this } render() { this.core.get('Scene').start() return this } metadata(data) { if (data === void 0) { this.store.set('metadata') return this } return this.store.get('metadata') } } window.PetiteVue = PetiteVue