diff --git a/.eslintignore b/.eslintignore index 26d6131f..d736e136 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,10 @@ /vendor /node_modules +/cloudfunctions/ARDemo/cloud-functions-tools/test/svrkit-utils/example +/cloudfunctions/ARDemo/wx-server-sdk-wxg-service/index.js +/miniprogram/packageSkylineExamples +/miniprogram/_commons/0.js +/miniprogram/packageAPI/pages/ar/3dmarker-ar/protobuf +/miniprogram/packageAPI/components/tdesign-miniprogram +/miniprogram/packageAPI/pages/ar/gaussian-splatting/util/gl-matrix-min.js +/miniprogram/packageChatTool/components/tdesign-miniprogram \ No newline at end of file diff --git a/.eslintrc.js b/.eslintrc.js index 141fa110..9c06dd31 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,32 +1,32 @@ module.exports = { - 'extends': [ + extends: [ 'airbnb-base', 'plugin:promise/recommended' ], - 'parserOptions': { - 'ecmaVersion': 9, - 'ecmaFeatures': { - 'jsx': false + parserOptions: { + ecmaVersion: 9, + ecmaFeatures: { + jsx: false }, - 'sourceType': 'module' + sourceType: 'module' }, - 'env': { - 'es6': true, - 'node': true, - 'jest': true + env: { + es6: true, + node: true, + jest: true }, - 'plugins': [ + plugins: [ 'import', 'node', 'promise' ], - 'rules': { + rules: { 'arrow-parens': 'off', 'comma-dangle': [ 'error', 'only-multiline' ], - 'complexity': ['error', 10], + complexity: ['error', 10], 'func-names': 'off', 'global-require': 'off', 'handle-callback-err': [ @@ -36,9 +36,9 @@ module.exports = { 'import/no-unresolved': [ 'error', { - 'caseSensitive': true, - 'commonjs': true, - 'ignore': ['^[^.]'] + caseSensitive: true, + commonjs: true, + ignore: ['^[^.]'] } ], 'import/prefer-default-export': 'off', @@ -58,13 +58,13 @@ module.exports = { 'node/process-exit-as-throw': 'error', 'object-curly-spacing': [ 'error', - 'never' + 'always' ], 'operator-linebreak': [ 'error', 'after', { - 'overrides': { + overrides: { ':': 'before', '?': 'before' } @@ -77,23 +77,23 @@ module.exports = { 1, 'as-needed', { - 'unnecessary': true + unnecessary: true } ], - 'semi': [ + semi: [ 'error', 'never' ] }, - 'globals': { - 'window': true, - 'document': true, - 'App': true, - 'Page': true, - 'Component': true, - 'Behavior': true, - 'wx': true, - 'worker': true, - 'getApp': true + globals: { + window: true, + document: true, + App: true, + Page: true, + Component: true, + Behavior: true, + wx: true, + worker: true, + getApp: true } } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..49f1f81b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,19 @@ +name: WeChat MiniProgram Demo CI/CD + +on: + push: + branches: + - master + pull_request: + branches: + - master +jobs: + upload: + runs-on: ubuntu-latest + steps: + - name: Upload MiniProgram + env: + WX_PRIVATE_KEY: ${{ secrets.WX_PRIVATE_KEY }} + run: | + echo "$WX_PRIVATE_KEY" > ./build/key + node ./build/ci.js diff --git a/build/ci.js b/build/ci.js new file mode 100644 index 00000000..9b78edc9 --- /dev/null +++ b/build/ci.js @@ -0,0 +1,47 @@ +const path = require('path') +const ci = require('miniprogram-ci') +const fs = require('fs') +const packageJson = require('../package.json') + +const privateKeyContent = process.env.WX_PRIVATE_KEY +if (!privateKeyContent) { + throw new Error('未找到私钥内容,请确保已正确配置 GitHub Secrets') +} + +const privateKeyPath = path.resolve(__dirname, './private.key') +fs.writeFileSync(privateKeyPath, privateKeyContent) + +const project = new ci.Project({ + appid: 'wxe5f52902cf4de896', + type: 'miniProgram', + projectPath: path.resolve(__dirname, '../'), + privateKeyPath: path.resolve(__dirname, './key'), + ignores: [path.resolve(__dirname, '../miniprogram/node_modules/**/*')] +}) +const robotNumber = 2 +const params = { + onProgressUpdate: console.log, + robot: robotNumber, + version: packageJson.version, + desc: packageJson.bundleDescription, + setting: { + es7: true, + minifyJS: true, + minifyWXML: true, + minifyWXSS: true, + codeProtect: false, + autoPrefixWXSS: true + }, +} +ci.upload({ + project, + ...params +}).then(res => { + console.debug('>>>>upload res', res) +}).catch(err => { + console.error('>>>>upload error', err) + throw err +}).finally(() => { + // 删除临时私钥文件 + fs.unlinkSync(privateKeyPath) +}) diff --git a/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils-template.js b/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils-template.js index 21a4a144..d1c3ae70 100644 --- a/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils-template.js +++ b/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils-template.js @@ -1,4 +1,3 @@ - function generate(options) { if (!options) { throw new Error('options must be provided') @@ -6,7 +5,7 @@ function generate(options) { const { serviceName, funcName, data } = options - const serviceConfig = config.find(c => c.serviceName === serviceName) + const serviceConfig = config.find(c => c.serviceName === serviceName) if (!serviceConfig) { throw new Error('service not found') } @@ -38,7 +37,7 @@ function generate(options) { if (!reqProtoJSON.fields[key]) { throw new Error(`'${key}' doesn't exist in '${reqProtoName}' proto, valid keys are ${Object.keys(reqProtoJSON.fields)}`) } - } + } } else { throw new Error('data must be object') } @@ -91,7 +90,7 @@ function generateV2(options) { if (!reqProtoJSON.fields[key]) { throw new Error(`'${key}' doesn't exist in '${reqProtoName}' proto, valid keys are ${Object.keys(reqProtoJSON.fields)}`) } - } + } } else { throw new Error('data must be object') } diff --git a/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils.js b/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils.js index a1f33a6a..79ed1198 100644 --- a/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils.js +++ b/cloudfunctions/ARDemo/cloud-functions-tools/cli/svrkit-utils.js @@ -3,7 +3,7 @@ const path = require('path') const yargs = require('yargs') const chalk = require('chalk') const debug = require('debug')('cli') -const pbjs = require("protobufjs/cli/pbjs") +const pbjs = require('protobufjs/cli/pbjs') const log = (...msg) => { console.log(chalk.blue('svrkit-utils'), ...msg) @@ -50,7 +50,7 @@ function main() { throw err } - let staticModuleContent = fs.readFileSync(staticModuleFilePath, 'utf8') + const staticModuleContent = fs.readFileSync(staticModuleFilePath, 'utf8') fs.writeFileSync(staticModuleFilePath, `// #lizard forgives ${staticModuleContent}`, 'utf8') @@ -95,4 +95,3 @@ ${protoUtils} module.exports = { main, } - diff --git a/cloudfunctions/ARDemo/index.js b/cloudfunctions/ARDemo/index.js index a1c41299..e1acb1df 100644 --- a/cloudfunctions/ARDemo/index.js +++ b/cloudfunctions/ARDemo/index.js @@ -11,13 +11,13 @@ exports.main = async (event, context) => { const wxContext = cloud.getWXContext() const bizuin = wxContext.APPUIN switch (event.type) { - case "GenerateARModel": + case 'GenerateARModel': return await cloud.callWXSvrkit({ pbInstance: svrkitUtils.generate({ - serviceName: "Mmbizwxaintpar", - funcName: "GenerateARModel", + serviceName: 'Mmbizwxaintpar', + funcName: 'GenerateARModel', data: { - bizuin: bizuin, + bizuin, name: event.name, url: event.url, algoType: event.algoType, @@ -26,14 +26,14 @@ exports.main = async (event, context) => { }, }), timeout: 30000, - }); - case "GetARModel": + }) + case 'GetARModel': return await cloud.callWXSvrkit({ pbInstance: svrkitUtils.generate({ - serviceName: "Mmbizwxaintpar", - funcName: "GetARModel", + serviceName: 'Mmbizwxaintpar', + funcName: 'GetARModel', data: { - bizuin: bizuin, + bizuin, cosid: event.cosid, modelType: event.modelType, needData: event.needData, @@ -42,7 +42,7 @@ exports.main = async (event, context) => { }, }), timeout: 30000, - }); + }) // GetARModelList 废弃,完全依赖本地缓存 // case "GetARModelList": // return await cloud.callWXSvrkit({ @@ -58,5 +58,4 @@ exports.main = async (event, context) => { // timeout: 30000, // }); } - -} \ No newline at end of file +} diff --git a/cloudfunctions/ARDemo/svrkit-utils.js b/cloudfunctions/ARDemo/svrkit-utils.js index 941b9848..d50911b6 100644 --- a/cloudfunctions/ARDemo/svrkit-utils.js +++ b/cloudfunctions/ARDemo/svrkit-utils.js @@ -1,23 +1,23 @@ - const config = require('./svrkit.config.js') const proto = require('./svrkit-utils.static.js') const protoJSON = require('./svrkit-utils.static.json') + function getProto(proto, serviceName, protoName) { if (proto[protoName]) { - return proto[protoName]; + return proto[protoName] } if (proto[serviceName] && proto[serviceName][protoName]) { - return proto[serviceName][protoName]; + return proto[serviceName][protoName] } - /** 处理 mmpayolcirclemodel.QueryActivityReq 的形式*/ + /** 处理 mmpayolcirclemodel.QueryActivityReq 的形式 */ const [realServiceName, realProtoName] = protoName.split('.') if (proto[realServiceName]) { return proto[realServiceName][realProtoName] } - return undefined; + return undefined } function generate(options) { @@ -37,14 +37,14 @@ function generate(options) { } const reqProtoName = serviceConfig.functions[funcName].req - const reqProto = getProto(proto, serviceName, reqProtoName); + const reqProto = getProto(proto, serviceName, reqProtoName) if (!reqProto) { throw new Error('request proto not found') } const resProtoName = serviceConfig.functions[funcName].res - const resProto = resProtoName && getProto(proto, serviceName, resProtoName); + const resProto = resProtoName && getProto(proto, serviceName, resProtoName) const reqProtoVerifyErr = reqProto.verify(data) if (reqProtoVerifyErr) { @@ -133,4 +133,3 @@ module.exports = { generate, generateV2, } - diff --git a/cloudfunctions/ARDemo/svrkit.config.js b/cloudfunctions/ARDemo/svrkit.config.js index 962f5499..87aa4070 100644 --- a/cloudfunctions/ARDemo/svrkit.config.js +++ b/cloudfunctions/ARDemo/svrkit.config.js @@ -31,4 +31,4 @@ module.exports = [ } } } -] \ No newline at end of file +] diff --git a/gulpfile.js b/gulpfile.js index ccd846f6..6c41caac 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,74 +13,75 @@ gulp.task('transform-css-vars', () => { cssvars({ preserve: false, variables: { - "--weui-BTN-DISABLED-FONT-COLOR": "rgba(0, 0, 0, .2)", - "--weui-BTN-DEFAULT-BG": "#f2f2f2", - "--weui-BTN-DEFAULT-COLOR": "#06ae56", - "--weui-BTN-DEFAULT-ACTIVE-BG": "#e6e6e6", - "--weui-DIALOG-LINE-COLOR": "rgba(0, 0, 0, .1)", - "--weui-BG-0": "#ededed", - "--weui-BG-1": "#f7f7f7", - "--weui-BG-2": "#fff", - "--weui-BG-3": "#f7f7f7", - "--weui-BG-4": "#4c4c4c", - "--weui-BG-5": "#fff", - "--weui-FG-0": "rgba(0, 0, 0, .9)", - "--weui-FG-HALF": "rgba(0, 0, 0, .9)", - "--weui-FG-1": "rgba(0, 0, 0, .5)", - "--weui-FG-2": "rgba(0, 0, 0, .3)", - "--weui-FG-3": "rgba(0, 0, 0, .1)", - "--weui-RED": "#fa5151", - "--weui-ORANGE": "#fa9d3b", - "--weui-YELLOW": "#ffc300", - "--weui-GREEN": "#91d300", - "--weui-LIGHTGREEN": "#95ec69", - "--weui-BRAND": "#07c160", - "--weui-BLUE": "#10aeff", - "--weui-INDIGO": "#1485ee", - "--weui-PURPLE": "#6467f0", - "--weui-WHITE": "#fff", - "--weui-LINK": "#576b95", - "--weui-TEXTGREEN": "#06ae56", - "--weui-FG": "#000", - "--weui-BG": "#fff", - "--weui-TAG-TEXT-ORANGE": "#fa9d3b", - "--weui-TAG-BACKGROUND-ORANGE": "rgba(250, 157, 59, .1)", - "--weui-TAG-TEXT-GREEN": "#06ae56", - "--weui-TAG-BACKGROUND-GREEN": "rgba(6, 174, 86, .1)", - "--weui-TAG-TEXT-BLUE": "#10aeff", - "--weui-TAG-BACKGROUND-BLUE": "rgba(16, 174, 255, .1)", - "--weui-TAG-TEXT-BLACK": "rgba(0, 0, 0, .5)", - "--weui-TAG-BACKGROUND-BLACK": "rgba(0, 0, 0, .05)", - "--weui-BG-COLOR-ACTIVE": "#ececec", - "--height": "44px", - "--right": "95px", + '--weui-BTN-DISABLED-FONT-COLOR': 'rgba(0, 0, 0, .2)', + '--weui-BTN-DEFAULT-BG': '#f2f2f2', + '--weui-BTN-DEFAULT-COLOR': '#06ae56', + '--weui-BTN-DEFAULT-ACTIVE-BG': '#e6e6e6', + '--weui-DIALOG-LINE-COLOR': 'rgba(0, 0, 0, .1)', + '--weui-BG-0': '#ededed', + '--weui-BG-1': '#f7f7f7', + '--weui-BG-2': '#fff', + '--weui-BG-3': '#f7f7f7', + '--weui-BG-4': '#4c4c4c', + '--weui-BG-5': '#fff', + '--weui-FG-0': 'rgba(0, 0, 0, .9)', + '--weui-FG-HALF': 'rgba(0, 0, 0, .9)', + '--weui-FG-1': 'rgba(0, 0, 0, .5)', + '--weui-FG-2': 'rgba(0, 0, 0, .3)', + '--weui-FG-3': 'rgba(0, 0, 0, .1)', + '--weui-RED': '#fa5151', + '--weui-ORANGE': '#fa9d3b', + '--weui-YELLOW': '#ffc300', + '--weui-GREEN': '#91d300', + '--weui-LIGHTGREEN': '#95ec69', + '--weui-BRAND': '#07c160', + '--weui-BLUE': '#10aeff', + '--weui-INDIGO': '#1485ee', + '--weui-PURPLE': '#6467f0', + '--weui-WHITE': '#fff', + '--weui-LINK': '#576b95', + '--weui-TEXTGREEN': '#06ae56', + '--weui-FG': '#000', + '--weui-BG': '#fff', + '--weui-TAG-TEXT-ORANGE': '#fa9d3b', + '--weui-TAG-BACKGROUND-ORANGE': 'rgba(250, 157, 59, .1)', + '--weui-TAG-TEXT-GREEN': '#06ae56', + '--weui-TAG-BACKGROUND-GREEN': 'rgba(6, 174, 86, .1)', + '--weui-TAG-TEXT-BLUE': '#10aeff', + '--weui-TAG-BACKGROUND-BLUE': 'rgba(16, 174, 255, .1)', + '--weui-TAG-TEXT-BLACK': 'rgba(0, 0, 0, .5)', + '--weui-TAG-BACKGROUND-BLACK': 'rgba(0, 0, 0, .05)', + '--weui-BG-COLOR-ACTIVE': '#ececec', + '--height': '44px', + '--right': '95px', }, preserveInjectedVariables: false, }) ] return gulp.src([ - './miniprogram/app.wxss', - './miniprogram/common/common.wxss', - './miniprogram/page/common/common.wxss', - './miniprogram/page/common/index.wxss', - './miniprogram/page/component/index.wxss', - './miniprogram/page/cloud/index.wxss', - './miniprogram/page/API/index.wxss', - './miniprogram/page/extend/index.wxss', - './miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.wxss', - ]) - .pipe(gulpIgnore.exclude( - file => { - try { - fs.accessSync(file.path.replace(/\.wxss$/, '-skyline.wxss')) - } catch(e) { - return false - } - return true - })) - .pipe(postcss(plugins)) - .pipe(replace(/\:root ?{}\n/g, '')) - .pipe(gulpIf(file => file.path.includes('miniprogram/page/common'), rename({suffix: '-skyline'}))) - .pipe(gulpIf(file => file.path.includes('miniprogram/common'), rename({suffix: '-skyline'}))) - .pipe(gulp.dest(file => file.base)) + './miniprogram/app.wxss', + './miniprogram/common/common.wxss', + './miniprogram/page/common/common.wxss', + './miniprogram/page/common/index.wxss', + './miniprogram/page/component/index.wxss', + './miniprogram/page/cloud/index.wxss', + './miniprogram/page/API/index.wxss', + './miniprogram/page/extend/index.wxss', + './miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.wxss', + ]) + .pipe(gulpIgnore.exclude( + file => { + try { + fs.accessSync(file.path.replace(/\.wxss$/, '-skyline.wxss')) + } catch (e) { + return false + } + return true + } + )) + .pipe(postcss(plugins)) + .pipe(replace(/\:root ?{}\n/g, '')) + .pipe(gulpIf(file => file.path.includes('miniprogram/page/common'), rename({ suffix: '-skyline' }))) + .pipe(gulpIf(file => file.path.includes('miniprogram/common'), rename({ suffix: '-skyline' }))) + .pipe(gulp.dest(file => file.base)) }) diff --git a/miniprogram/app-bar/index.js b/miniprogram/app-bar/index.js index 9ee282fd..2000ecc7 100644 --- a/miniprogram/app-bar/index.js +++ b/miniprogram/app-bar/index.js @@ -7,4 +7,4 @@ Component({ data: { showAppbar: false } -}) \ No newline at end of file +}) diff --git a/miniprogram/app.js b/miniprogram/app.js index d9599608..3262bf86 100644 --- a/miniprogram/app.js +++ b/miniprogram/app.js @@ -45,20 +45,28 @@ App({ traceUser: true, }) } - // skyline - const systemInfo = wx.getSystemInfoSync() - console.log('@@@ systemInfo ', systemInfo) - Object.assign(this.globalData, systemInfo) + const getSystemInfo = [ + 'getSystemSetting', + 'getAppAuthorizeSetting', + 'getDeviceInfo', + 'getAppBaseInfo', + 'getWindowInfo' + ] + + getSystemInfo.forEach(apiName => { + if (wx[apiName]) { + Object.assign(this.globalData, wx[apiName]()) + } + }) // eslint-disable-next-line promise/always-return require.async('./packageSkyline/common/custom-route/index.js').then(utils => { console.log('--------begin installRouteBuilder') utils.installRouteBuilder() // 'common' - }).catch(({mod, errMsg}) => { + }).catch(({ mod, errMsg }) => { console.error(`installRouteBuilder path: ${mod}, ${errMsg}`) }) }, - onShow(opts) { console.log('App Show', opts) console.log('USER_DATA_PATH', wx.env.USER_DATA_PATH) @@ -67,7 +75,7 @@ App({ onHide() { console.log('App Hide') }, - onThemeChange({theme}) { + onThemeChange({ theme }) { this.globalData.theme = theme themeListeners.forEach((listener) => { listener(theme) @@ -85,7 +93,7 @@ App({ } }, globalData: { - theme: wx.getSystemInfoSync().theme, + theme: wx.getAppBaseInfo().theme, hasLogin: false, openid: null, iconTabbar: '/page/extend/images/icon_tabbar.png', diff --git a/miniprogram/component/navigation-bar/navigation-bar.js b/miniprogram/component/navigation-bar/navigation-bar.js index 4335baa6..2408512f 100644 --- a/miniprogram/component/navigation-bar/navigation-bar.js +++ b/miniprogram/component/navigation-bar/navigation-bar.js @@ -1,85 +1,80 @@ +const app = getApp().globalData Component({ options: { - multipleSlots: true // 在组件定义时的选项中启用多slot支持 + styleIsolation: 'apply-shared', // 表示页面 wxss 样式将影响到自定义组件,但自定义组件 wxss 中指定的样式不会影响页面 + multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, /** * 组件的属性列表 */ properties: { - extClass: { - type: String, - value: '' - }, - title: { - type: String, - value: '' - }, - background: { - type: String, - value: '' - }, - color: { - type: String, - value: '' - }, - back: { - type: Boolean, - value: true - }, - loading: { - type: Boolean, - value: false - }, - animated: { - // 显示隐藏的时候opacity动画效果 - type: Boolean, - value: true - }, - show: { - // 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在 - type: Boolean, - value: true, - observer: '_showChange' - }, - // back为true的时候,返回的页面深度 - delta: { - type: Number, - value: 1 - } + extClass: { + type: String, + value: '' + }, + title: { + type: String, + value: '' + }, + background: { + type: String, + value: '' + }, + color: { + type: String, + value: '' + }, + back: { + type: Boolean, + value: true + }, + loading: { + type: Boolean, + value: false + }, + animated: { + // 显示隐藏的时候opacity动画效果 + type: Boolean, + value: true + }, + show: { + // 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在 + type: Boolean, + value: true, + observer: '_showChange' + }, + // back为true的时候,返回的页面深度 + delta: { + type: Number, + value: 1 + } }, /** - * 组件的初始数据 - */ + * 组件的初始数据 + */ data: { - displayStyle: '' + displayStyle: '' }, attached() { const isSupport = !!wx.getMenuButtonBoundingClientRect const rect = wx.getMenuButtonBoundingClientRect - ? wx.getMenuButtonBoundingClientRect() - : null - const isSkyline = this.renderer ==='skyline' - wx.getSystemInfo({ - success: (res) => { - const ios = !!(res.system.toLowerCase().search('ios') + 1) - this.setData({ - ios, - statusBarHeight: res.statusBarHeight, - // skyline defaultContentBox:true ; webview border-box - navBarHeight: rect.bottom - rect.top + 10 + ( isSkyline ? 0 : res.statusBarHeight), - innerWidth: isSupport ? `width:${rect.left}px` : '', - innerPaddingRight: isSupport - ? `padding-right:${res.windowWidth - rect.left}px` - : '', - leftWidth: isSupport ? `width:${res.windowWidth - rect.left}px` : '', - theme: res.theme || 'light', - }) - } + ? wx.getMenuButtonBoundingClientRect() + : null + const isSkyline = this.renderer === 'skyline' + this.setData({ + ios: !!(app.system.toLowerCase().search('ios') + 1), + theme: app.theme || 'light', + statusBarHeight: app.statusBarHeight, + navBarHeight: rect.bottom - rect.top + 10 + (isSkyline ? 0 : app.statusBarHeight), + innerWidth: isSupport ? `width:${rect.left}px` : '', + innerPaddingRight: isSupport + ? `padding-right:${app.windowWidth - rect.left}px` + : '', + leftWidth: isSupport ? `width:${app.windowWidth - rect.left}px` : '', }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, @@ -89,42 +84,39 @@ Component({ } }, /** - * 组件的方法列表 - */ + * 组件的方法列表 + */ methods: { - _showChange(show) { - const animated = this.data.animated - let displayStyle = '' - if (animated) { - displayStyle = `opacity: ${ - show ? '1' : '0' - };-webkit-transition:opacity 0.5s;transition:opacity 0.5s;` - } else { - displayStyle = `display: ${show ? '' : 'none'}` - } - this.setData({ - displayStyle - }) - }, - back() { - const data = this.data - console.log('---------222',getCurrentPages().length) - if (data.delta) { - wx.navigateBack({ - delta: data.delta - }) - } - // 如果是直接打开的,就默认回首页 - if (getCurrentPages().length == 1) { - console.log('---------333') - wx.switchTab({ - url: '/page/component/index', - complete: (res) => { - console.log(res) - } - }) + _showChange(show) { + const animated = this.data.animated + let displayStyle = '' + if (animated) { + displayStyle = `opacity: ${show ? '1' : '0' + };-webkit-transition:opacity 0.5s;transition:opacity 0.5s;` + } else { + displayStyle = `display: ${show ? '' : 'none'}` + } + this.setData({ + displayStyle + }) + }, + back() { + const data = this.data + if (data.delta) { + wx.navigateBack({ + delta: data.delta + }) + } + // 如果是直接打开的,就默认回首页 + if (getCurrentPages().length == 1) { + wx.switchTab({ + url: '/page/component/index', + complete: (res) => { + console.log(res) } - this.triggerEvent('back', { delta: data.delta }, {}) + }) } + this.triggerEvent('back', { delta: data.delta }, {}) + } } }) diff --git a/miniprogram/component/navigation-bar/navigation-bar.json b/miniprogram/component/navigation-bar/navigation-bar.json index 23109a50..6245cfa7 100644 --- a/miniprogram/component/navigation-bar/navigation-bar.json +++ b/miniprogram/component/navigation-bar/navigation-bar.json @@ -2,6 +2,5 @@ "component": true, "usingComponents": {}, "componentFramework": "glass-easel", - "renderer": "skyline", - "styleIsolation": "apply-shared" + "renderer": "skyline" } diff --git a/miniprogram/component/navigation-bar/navigation-bar.wxml b/miniprogram/component/navigation-bar/navigation-bar.wxml index 69976661..b52e7382 100644 --- a/miniprogram/component/navigation-bar/navigation-bar.wxml +++ b/miniprogram/component/navigation-bar/navigation-bar.wxml @@ -36,7 +36,7 @@ - + diff --git a/miniprogram/components/navigation-bar/index.js b/miniprogram/components/navigation-bar/index.js index 1b86cafe..34aad82b 100644 --- a/miniprogram/components/navigation-bar/index.js +++ b/miniprogram/components/navigation-bar/index.js @@ -1,3 +1,4 @@ +const app = getApp().globalData Component({ options: { multipleSlots: true, // 在组件定义时的选项中启用多slot支持 @@ -38,33 +39,28 @@ Component({ }, attached() { - const isSupport = !!wx.getMenuButtonBoundingClientRect; - const rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null; - wx.getSystemInfo({ - success: (res) => { - const ios = !!(res.system.toLowerCase().search('ios') + 1); - const sideWidth = isSupport ? res.windowWidth - rect.left : 0; + const isSupport = !!wx.getMenuButtonBoundingClientRect + const rect = wx.getMenuButtonBoundingClientRect ? wx.getMenuButtonBoundingClientRect() : null + const sideWidth = isSupport ? app.windowWidth - rect.left : 0 - this.setData({ - ios, - sideWidth: this.data.sideWidth || sideWidth, - statusBarHeight: res.statusBarHeight, - }); - }, - }); + this.setData({ + ios: !!(app.system.toLowerCase().search('ios') + 1), + sideWidth: this.data.sideWidth || sideWidth, + statusBarHeight: app.statusBarHeight, + }) }, /** * 组件的方法列表 */ methods: { back() { - const { data } = this; + const { data } = this if (data.delta) { wx.navigateBack({ delta: data.delta, - }); + }) } - this.triggerEvent('back', { delta: data.delta }, {}); + this.triggerEvent('back', { delta: data.delta }, {}) }, }, -}); +}) diff --git a/miniprogram/components/page-scroll/index.js b/miniprogram/components/page-scroll/index.js index a897a256..5f292cf4 100644 --- a/miniprogram/components/page-scroll/index.js +++ b/miniprogram/components/page-scroll/index.js @@ -1,89 +1,86 @@ -var globalThis = this, self = this; +const globalThis = this; const + self = this module.exports = -require("../../_commons/0.js")([ -{ -"ids": [6], -"modules":{ +require('../../_commons/0.js')([ + { + ids: [6], + modules: { -/***/ "./node_modules/@mpflow/webpack-plugin/lib/loaders/page-loader.js?appContext=src&outputPath=components%2Fpage-scroll%2Findex!./src/components/page-scroll/index.ts": -/*!*************************************************************************************************************************************************************************!*\ + /***/ './node_modules/@mpflow/webpack-plugin/lib/loaders/page-loader.js?appContext=src&outputPath=components%2Fpage-scroll%2Findex!./src/components/page-scroll/index.ts': + /*! *************************************************************************************************************************************************************************!*\ !*** ./node_modules/@mpflow/webpack-plugin/lib/loaders/page-loader.js?appContext=src&outputPath=components%2Fpage-scroll%2Findex!./src/components/page-scroll/index.ts ***! - \*************************************************************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { + \************************************************************************************************************************************************************************ */ + /*! no static exports found */ + /***/ (function (module, exports, __webpack_require__) { + module.exports = __webpack_require__(/*! ./index.ts */ './src/components/page-scroll/index.ts') + /***/ }), -module.exports = __webpack_require__(/*! ./index.ts */ "./src/components/page-scroll/index.ts") - -/***/ }), - -/***/ "./src/components/page-scroll/index.ts": -/*!*********************************************!*\ + /***/ './src/components/page-scroll/index.ts': + /*! *********************************************!*\ !*** ./src/components/page-scroll/index.ts ***! - \*********************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { + \******************************************** */ + /*! no static exports found */ + /***/ (function (module, exports) { + Component({ + options: { + virtualHost: true + }, + properties: { + refresherEnabled: { + type: Boolean, + value: false + }, + refresherThreshold: { + type: Number, + value: 45 + }, + refresherDefaultStyle: { + type: String, + value: 'black' + }, + refresherBackground: { + type: String, + value: '#FFF' + }, + refresherTriggered: { + type: Boolean, + value: false + }, + lowerThreshold: { + type: Number, + value: 50 + }, + scrollIntoView: { + type: String, + value: '' + } + }, + methods: { + onScroll: function onScroll(e) { + this.triggerEvent('scroll', e.detail) + }, + onScrollToLower: function onScrollToLower(e) { + this.triggerEvent('scrollToLower', e.detail) + }, + onPulling: function onPulling(e) { + this.triggerEvent('pulling', e.detail) + }, + onRefresh: function onRefresh(e) { + this.triggerEvent('refresh', e.detail) + }, + onRestore: function onRestore(e) { + this.triggerEvent('restore', e.detail) + }, + onAbort: function onAbort(e) { + this.triggerEvent('abort', e.detail) + } + } + }) + /***/ }) -Component({ - options: { - virtualHost: true - }, - properties: { - refresherEnabled: { - type: Boolean, - value: false - }, - refresherThreshold: { - type: Number, - value: 45 - }, - refresherDefaultStyle: { - type: String, - value: 'black' - }, - refresherBackground: { - type: String, - value: '#FFF' - }, - refresherTriggered: { - type: Boolean, - value: false - }, - lowerThreshold: { - type: Number, - value: 50 }, - scrollIntoView: { - type: String, - value: '' - } + entries: [['./node_modules/@mpflow/webpack-plugin/lib/loaders/page-loader.js?appContext=src&outputPath=components%2Fpage-scroll%2Findex!./src/components/page-scroll/index.ts', 0]] }, - methods: { - onScroll: function onScroll(e) { - this.triggerEvent('scroll', e.detail); - }, - onScrollToLower: function onScrollToLower(e) { - this.triggerEvent('scrollToLower', e.detail); - }, - onPulling: function onPulling(e) { - this.triggerEvent('pulling', e.detail); - }, - onRefresh: function onRefresh(e) { - this.triggerEvent('refresh', e.detail); - }, - onRestore: function onRestore(e) { - this.triggerEvent('restore', e.detail); - }, - onAbort: function onAbort(e) { - this.triggerEvent('abort', e.detail); - } - } -}); - -/***/ }) - -}, -"entries": [["./node_modules/@mpflow/webpack-plugin/lib/loaders/page-loader.js?appContext=src&outputPath=components%2Fpage-scroll%2Findex!./src/components/page-scroll/index.ts",0]] -}, -]); +]) -// # sourceMappingURL=index.js.map \ No newline at end of file +// # sourceMappingURL=index.js.map diff --git a/miniprogram/components/popup/index.js b/miniprogram/components/popup/index.js index 0c30ad2f..f333b411 100644 --- a/miniprogram/components/popup/index.js +++ b/miniprogram/components/popup/index.js @@ -25,14 +25,14 @@ Component({ }, methods: { close() { - const { data } = this; + const { data } = this console.log('@@@ close', data.maskClosable) - if (!data.maskClosable) return; + if (!data.maskClosable) return this.setData({ enable: !this.data.enable - }); - this.triggerEvent('close', {}, {}); + }) + this.triggerEvent('close', {}, {}) }, // stopEvent() {}, }, -}); +}) diff --git a/miniprogram/packageAPI/pages/ai/mobilenet/index.js b/miniprogram/packageAPI/pages/ai/mobilenet/index.js index 89ef3291..e06c7ff3 100644 --- a/miniprogram/packageAPI/pages/ai/mobilenet/index.js +++ b/miniprogram/packageAPI/pages/ai/mobilenet/index.js @@ -4,23 +4,23 @@ import { Classifier } from './classify' import { FpsHelper } from '../../../../util/fps_helper' -const { appWidth, appHeight, benchmarkLevel } = getApp().globalData; +const { appWidth, appHeight, benchmarkLevel } = getApp().globalData Page({ classifier: null, ctx: null, - fpsHelper:null, + fpsHelper: null, predicting: false, // For Speed Test - constBuffer : null, + constBuffer: null, /** * 页面的初始数据 */ data: { - predClass: "None", + predClass: 'None', classifier: null, enableSpeedTest: false, avgTime: 110.0, @@ -31,8 +31,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad() { - if (this.data.enableSpeedTest) - { + if (this.data.enableSpeedTest) { this.constBuffer = new Float32Array(3 * 224 * 224) } }, @@ -40,46 +39,45 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady() { - this.ctx = wx.createCanvasContext('ssd1'); - const context = wx.createCameraContext(this); - this.initClassifier(); - this.fpsHelper = new FpsHelper(); + onReady() { + this.ctx = wx.createCanvasContext('ssd1') + const context = wx.createCameraContext(this) + this.initClassifier() + this.fpsHelper = new FpsHelper() const listener = context.onCameraFrame(frame => { + const fps = this.fpsHelper.getAverageFps() + console.log(`fps=${fps}`) - const fps = this.fpsHelper.getAverageFps(); - console.log(`fps=${fps}`); - - if (this.classifier && this.classifier.isReady() && !this.predicting) { - this.executeClassify(frame); - } - }); - listener.start(); - this.fpsHelper.reset(); + if (this.classifier && this.classifier.isReady() && !this.predicting) { + this.executeClassify(frame) + } + }) + listener.start() + this.fpsHelper.reset() }, /** * 初始化 SSD models */ initClassifier() { - wx.showLoading({ title: '模型正在加载...' }); - this.classifier = new Classifier({ width: appWidth, height: appHeight }); + wx.showLoading({ title: '模型正在加载...' }) + this.classifier = new Classifier({ width: appWidth, height: appHeight }) this.classifier.load().then(() => { - wx.hideLoading(); + wx.hideLoading() }).catch(err => { - console.log('模型加载报错:', err); + console.log('模型加载报错:', err) }) }, - /** + /** * 构建模型 */ -async executeClassify (frame) { - this.predicting = true; + async executeClassify(frame) { + this.predicting = true if (this.classifier && this.classifier.isReady()) { - this.fpsHelper.updateFPS(); + this.fpsHelper.updateFPS() this.setData({ predClass: this.classifier.predClass(), @@ -92,82 +90,75 @@ async executeClassify (frame) { }) }).catch((err) => { console.log(err) - }) + }) - if (this.data.enableSpeedTest) - { - await this.inferSpeedTest(); + if (this.data.enableSpeedTest) { + await this.inferSpeedTest() } } - this.predicting = false; + this.predicting = false }, - async inferSpeedTest() - { - console.log("runInferenceSession speed test start run===============================") + async inferSpeedTest() { + console.log('runInferenceSession speed test start run===============================') - const xinput = { - shape: [1, 3, 224, 224], - data: this.constBuffer.buffer, - type: 'float32', - }; - - this.data.classifier = this.classifier; + const xinput = { + shape: [1, 3, 224, 224], + data: this.constBuffer.buffer, + type: 'float32', + } - // warm up - for (let index = 0; index < 20; index++) { + this.data.classifier = this.classifier - await this.inferOnce(xinput, this.data); - } + // warm up + for (let index = 0; index < 20; index++) { + await this.inferOnce(xinput, this.data) + } - for (var l = 0; l < 5; ++l) - { - var beMs = new Date().getTime() + for (let l = 0; l < 5; ++l) { + const beMs = new Date().getTime() - for (let index = 0; index < 100; index++) { + for (let index = 0; index < 100; index++) { + await this.inferOnce(xinput, this.data) + } - await this.inferOnce(xinput, this.data); - } + const afMs = new Date().getTime() - var afMs = new Date().getTime() - - var avgTime = (afMs - beMs) / 100.0; + const avgTime = (afMs - beMs) / 100.0 - var overall = 0.0; - var minTime = 1000000.0; + let overall = 0.0 + let minTime = 1000000.0 - for (let index = 0; index < 100; index++) { - var beMsTmp = new Date().getTime() - await this.inferOnce(xinput, this.data); - var afMsTmp = new Date().getTime() - var tmpTime = (afMsTmp - beMsTmp) - if (minTime > tmpTime) - { - minTime = tmpTime; - } - overall += (afMsTmp - beMsTmp) - } + for (let index = 0; index < 100; index++) { + const beMsTmp = new Date().getTime() + await this.inferOnce(xinput, this.data) + const afMsTmp = new Date().getTime() + const tmpTime = (afMsTmp - beMsTmp) + if (minTime > tmpTime) { + minTime = tmpTime + } + overall += (afMsTmp - beMsTmp) + } - console.log("Inference min time: ", minTime) - console.log("Inference avg time: ", avgTime) + console.log('Inference min time: ', minTime) + console.log('Inference avg time: ', avgTime) - this.setData({ - predClass: this.classifier.predClass(), - minTime : minTime, - avgTime : avgTime, - }) - } + this.setData({ + predClass: this.classifier.predClass(), + minTime, + avgTime, + }) + } }, inferOnce(xinput, data) { return new Promise(function (resolve, reject) { data.classifier.session.run({ - "input": xinput, + input: xinput, }).then(async function (res) { resolve() }) - }) }, @@ -190,7 +181,7 @@ async executeClassify (frame) { */ onUnload() { if (this.classifier && this.classifier.isReady()) { - this.classifier.dispose(); + this.classifier.dispose() } }, @@ -217,4 +208,4 @@ async executeClassify (frame) { path: 'packageAPI/pages/ai/mobilenet/index', } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ai/mobilenet_int8/index.js b/miniprogram/packageAPI/pages/ai/mobilenet_int8/index.js index a403af68..4fcf22a2 100644 --- a/miniprogram/packageAPI/pages/ai/mobilenet_int8/index.js +++ b/miniprogram/packageAPI/pages/ai/mobilenet_int8/index.js @@ -4,23 +4,23 @@ import { Classifier } from './classify' import { FpsHelper } from '../../../../util/fps_helper' -const { appWidth, appHeight, benchmarkLevel } = getApp().globalData; +const { appWidth, appHeight, benchmarkLevel } = getApp().globalData Page({ classifier: null, ctx: null, - fpsHelper:null, + fpsHelper: null, predicting: false, // For Speed Test - constBuffer : null, + constBuffer: null, /** * 页面的初始数据 */ data: { - predClass: "None", + predClass: 'None', classifier: null, enableSpeedTest: false, avgTime: 110.0, @@ -31,8 +31,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad() { - if (this.data.enableSpeedTest) - { + if (this.data.enableSpeedTest) { this.constBuffer = new Float32Array(3 * 224 * 224) } }, @@ -40,46 +39,45 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady() { - this.ctx = wx.createCanvasContext('ssd'); - const context = wx.createCameraContext(this); - this.initClassifier(); - this.fpsHelper = new FpsHelper(); + onReady() { + this.ctx = wx.createCanvasContext('ssd') + const context = wx.createCameraContext(this) + this.initClassifier() + this.fpsHelper = new FpsHelper() const listener = context.onCameraFrame(frame => { + const fps = this.fpsHelper.getAverageFps() + console.log(`fps=${fps}`) - const fps = this.fpsHelper.getAverageFps(); - console.log(`fps=${fps}`); - - if (this.classifier && this.classifier.isReady() && !this.predicting) { - this.executeClassify(frame); - } - }); - listener.start(); - this.fpsHelper.reset(); + if (this.classifier && this.classifier.isReady() && !this.predicting) { + this.executeClassify(frame) + } + }) + listener.start() + this.fpsHelper.reset() }, /** * 初始化 SSD models */ initClassifier() { - wx.showLoading({ title: '模型正在加载...' }); - this.classifier = new Classifier({ width: appWidth, height: appHeight }); + wx.showLoading({ title: '模型正在加载...' }) + this.classifier = new Classifier({ width: appWidth, height: appHeight }) this.classifier.load().then(() => { - wx.hideLoading(); + wx.hideLoading() }).catch(err => { - console.log('模型加载报错:', err); + console.log('模型加载报错:', err) }) }, - /** + /** * 构建模型 */ -async executeClassify (frame) { - this.predicting = true; + async executeClassify(frame) { + this.predicting = true if (this.classifier && this.classifier.isReady()) { - this.fpsHelper.updateFPS(); + this.fpsHelper.updateFPS() this.setData({ predClass: this.classifier.predClass(), @@ -92,81 +90,75 @@ async executeClassify (frame) { }) }).catch((err) => { console.log(err) - }) + }) - if (this.data.enableSpeedTest) - { - await this.inferSpeedTest(); + if (this.data.enableSpeedTest) { + await this.inferSpeedTest() } } - this.predicting = false; + this.predicting = false }, - async inferSpeedTest() - { - console.log("runInferenceSession speed test start run===============================") - - const xinput = { - shape: [1, 3, 224, 224], - data: this.constBuffer.buffer, - type: 'float32', - }; - - this.data.classifier = this.classifier; - - // warm up - for (let index = 0; index < 20; index++) { - await this.inferOnce(xinput, this.data); - } + async inferSpeedTest() { + console.log('runInferenceSession speed test start run===============================') - for (var l = 0; l < 5; ++l) - { - var beMs = new Date().getTime() + const xinput = { + shape: [1, 3, 224, 224], + data: this.constBuffer.buffer, + type: 'float32', + } - for (let index = 0; index < 100; index++) { + this.data.classifier = this.classifier - await this.inferOnce(xinput, this.data); - } + // warm up + for (let index = 0; index < 20; index++) { + await this.inferOnce(xinput, this.data) + } + + for (let l = 0; l < 5; ++l) { + const beMs = new Date().getTime() - var afMs = new Date().getTime() - - var avgTime = (afMs - beMs) / 100.0; + for (let index = 0; index < 100; index++) { + await this.inferOnce(xinput, this.data) + } - var overall = 0.0; - var minTime = 1000000.0; + const afMs = new Date().getTime() - for (let index = 0; index < 100; index++) { - var beMsTmp = new Date().getTime() - await this.inferOnce(xinput, this.data); - var afMsTmp = new Date().getTime() - var tmpTime = (afMsTmp - beMsTmp) - if (minTime > tmpTime) - { - minTime = tmpTime; - } - overall += (afMsTmp - beMsTmp) - } + const avgTime = (afMs - beMs) / 100.0 - console.log("Inference min time: ", minTime) - console.log("Inference avg time: ", avgTime) + let overall = 0.0 + let minTime = 1000000.0 - this.setData({ - predClass: this.classifier.predClass(), - minTime : minTime, - avgTime : avgTime, - }) + for (let index = 0; index < 100; index++) { + const beMsTmp = new Date().getTime() + await this.inferOnce(xinput, this.data) + const afMsTmp = new Date().getTime() + const tmpTime = (afMsTmp - beMsTmp) + if (minTime > tmpTime) { + minTime = tmpTime + } + overall += (afMsTmp - beMsTmp) } + + console.log('Inference min time: ', minTime) + console.log('Inference avg time: ', avgTime) + + this.setData({ + predClass: this.classifier.predClass(), + minTime, + avgTime, + }) + } }, inferOnce(xinput, data) { return new Promise(function (resolve, reject) { data.classifier.session.run({ - "onnx::QuantizeLinear_0": xinput, + 'onnx::QuantizeLinear_0': xinput, }).then(async function (res) { resolve() }) - }) }, @@ -189,7 +181,7 @@ async executeClassify (frame) { */ onUnload() { if (this.classifier && this.classifier.isReady()) { - this.classifier.dispose(); + this.classifier.dispose() } }, @@ -216,4 +208,4 @@ async executeClassify (frame) { path: 'packageAPI/pages/ai/mobilenet_int8/index', } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ai/style-trans/index.js b/miniprogram/packageAPI/pages/ai/style-trans/index.js index b1bafefc..f896ec13 100644 --- a/miniprogram/packageAPI/pages/ai/style-trans/index.js +++ b/miniprogram/packageAPI/pages/ai/style-trans/index.js @@ -1,4 +1,3 @@ - // pages/stype-trans/index.js.ts Page({ session: null, @@ -8,10 +7,10 @@ Page({ * 页面的初始数据 */ data: { - src : '', - imageWidth : 224, - imageHeight : 224, - imageChannel : 3, + src: '', + imageWidth: 224, + imageHeight: 224, + imageChannel: 3, }, /** @@ -70,7 +69,7 @@ Page({ }, - takePhoto() { + takePhoto() { const camera = wx.createCameraContext() camera.takePhoto({ quality: 'normal', @@ -79,7 +78,7 @@ Page({ src: res.tempImagePath }) - const canvas = wx.createOffscreenCanvas({type: '2d', width: this.data.imageWidth, height: this.data.imageHeight}) + const canvas = wx.createOffscreenCanvas({ type: '2d', width: this.data.imageWidth, height: this.data.imageHeight }) const ctx = canvas.getContext('2d') @@ -105,58 +104,53 @@ Page({ }) } }) - }, - InitSession() - { + InitSession() { return new Promise((resolve, reject) => { - const modelPath = `${wx.env.USER_DATA_PATH}/mosaic-8.onnx`; + const modelPath = `${wx.env.USER_DATA_PATH}/mosaic-8.onnx` // 判断之前是否已经下载过onnx模型 wx.getFileSystemManager().access({ - path: modelPath, - success: (res) => - { - console.log("file already exist at: " + modelPath) - this.createInferenceSession(modelPath).then(() => - { - resolve(); - }) - }, - fail: (res) => { - console.error(res) + path: modelPath, + success: (res) => { + console.log('file already exist at: ' + modelPath) + this.createInferenceSession(modelPath).then(() => { + resolve() + }) + }, + fail: (res) => { + console.error(res) - wx.cloud.init(); - console.log("begin download model"); + wx.cloud.init() + console.log('begin download model') - const cloudPath = 'cloud://containertest-0gmw3ulnd8d9bc7b.636f-containertest-0gmw3ulnd8d9bc7b-1258211818/mosaic-8.onnx' + const cloudPath = 'cloud://containertest-0gmw3ulnd8d9bc7b.636f-containertest-0gmw3ulnd8d9bc7b-1258211818/mosaic-8.onnx' - this.downloadFile(cloudPath, function(r) { - console.log(`下载进度:${r.progress}%,已下载${r.totalBytesWritten}B,共${r.totalBytesExpectedToWrite}B`) - }).then(result => { + this.downloadFile(cloudPath, function (r) { + console.log(`下载进度:${r.progress}%,已下载${r.totalBytesWritten}B,共${r.totalBytesExpectedToWrite}B`) + }).then(result => { wx.getFileSystemManager().saveFile({ - tempFilePath:result.tempFilePath, + tempFilePath: result.tempFilePath, filePath: modelPath, success: (res) => { // 注册回调函数 console.log(res) - - const modelPath = res.savedFilePath; - console.log("save onnx model at path: " + modelPath) + + const modelPath = res.savedFilePath + console.log('save onnx model at path: ' + modelPath) this.createInferenceSession(modelPath).then(() => { - resolve(); + resolve() }) }, fail(res) { console.error(res) - return } }) - }); + }) } }) - }) + }) }, createInferenceSession(modelPath) { @@ -171,23 +165,23 @@ Page({ Higher precision always require longer time to run session */ - precisionLevel : 4, - allowNPU : false, // wheather use NPU for inference, only useful for IOS + precisionLevel: 4, + allowNPU: false, // wheather use NPU for inference, only useful for IOS allowQuantize: false, // wheather generate quantize model - }); + }) // 监听error事件 this.session.onError((error) => { - console.error(error); - reject(error); - }); + console.error(error) + reject(error) + }) this.session.onLoad(() => { - resolve(); - }); + resolve() + }) }) }, -downloadFile(fileID, onCall = () => {}) { + downloadFile(fileID, onCall = () => {}) { return new Promise((resolve, reject) => { const task = wx.cloud.downloadFile({ fileID, @@ -209,83 +203,76 @@ downloadFile(fileID, onCall = () => {}) { }) }, - detect(imgData) - { - return new Promise((resolve, reject) => - { + detect(imgData) { + return new Promise((resolve, reject) => { const uint8Data = new Uint8Array(imgData.data) - var floatData = new Float32Array(this.data.imageChannel * this.data.imageHeight * this.data.imageWidth); + const floatData = new Float32Array(this.data.imageChannel * this.data.imageHeight * this.data.imageWidth) // nhwc uint8 data to nchw float32 data, and ignore the alpha channel const modelChannel = this.data.imageChannel - - const imageWH = this.data.imageHeight * this.data.imageWidth; - - var idx = 0; - for (var c = 0; c < modelChannel; ++c) - { - for (var wh = 0; wh < imageWH; ++wh) - { - var inputIdx = wh * 4 + c; - floatData[idx] = uint8Data[inputIdx]; - idx++; + + const imageWH = this.data.imageHeight * this.data.imageWidth + + let idx = 0 + for (let c = 0; c < modelChannel; ++c) { + for (let wh = 0; wh < imageWH; ++wh) { + const inputIdx = wh * 4 + c + floatData[idx] = uint8Data[inputIdx] + idx++ } - } + } const xinput = { - shape: [1, 3, 224, 224], // Input data shape in NCHW + shape: [1, 3, 224, 224], // Input data shape in NCHW data: floatData.buffer, - type: 'float32', // Input data type - }; + type: 'float32', // Input data type + } this.session.run({ - // Here string "input1" Should be the same with the input name in onnx file - "input1" : xinput, + // Here string "input1" Should be the same with the input name in onnx file + input1: xinput, }).then((res) => { - // Here use res.outputname.data, outputname + // Here use res.outputname.data, outputname // Should be the same with the output name in onnx file - let output = new Float32Array(res.output1.data) + const output = new Float32Array(res.output1.data) - const hwSize = imgData.height * imgData.width; + const hwSize = imgData.height * imgData.width - var finalout = new Uint8ClampedArray(4 * hwSize); + const finalout = new Uint8ClampedArray(4 * hwSize) // fill the alpha channel - finalout.fill(255); + finalout.fill(255) // convert from nchw to nhwc - idx = 0; - for (var c = 0; c < modelChannel; ++c) - { - for (var hw = 0; hw < hwSize; ++hw) - { - var dstIdx = hw * 4 + c; - finalout[dstIdx] = Math.max(0, Math.min(Math.round(output[idx]), 255)); - idx++; + idx = 0 + for (let c = 0; c < modelChannel; ++c) { + for (let hw = 0; hw < hwSize; ++hw) { + const dstIdx = hw * 4 + c + finalout[dstIdx] = Math.max(0, Math.min(Math.round(output[idx]), 255)) + idx++ } } this.canvasCtx = wx.createCanvasContext('trans') - wx.canvasPutImageData - ({ + wx.canvasPutImageData({ canvasId: 'trans', data: finalout, height: 224, width: 224, x: 0, y: 0, - }).then((res) =>{ + }).then((res) => { console.log(res) }) }) - resolve(); + resolve() }) }, error(e) { console.log(e.detail) } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/api/choose-address/choose-address.js b/miniprogram/packageAPI/pages/api/choose-address/choose-address.js index c7e67c1d..8234545f 100644 --- a/miniprogram/packageAPI/pages/api/choose-address/choose-address.js +++ b/miniprogram/packageAPI/pages/api/choose-address/choose-address.js @@ -29,12 +29,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/choose-invoice-title/choose-invoice-title.js b/miniprogram/packageAPI/pages/api/choose-invoice-title/choose-invoice-title.js index ba976ab0..5878845a 100644 --- a/miniprogram/packageAPI/pages/api/choose-invoice-title/choose-invoice-title.js +++ b/miniprogram/packageAPI/pages/api/choose-invoice-title/choose-invoice-title.js @@ -41,12 +41,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/custom-message/custom-message.js b/miniprogram/packageAPI/pages/api/custom-message/custom-message.js index d4e307ac..b5361819 100644 --- a/miniprogram/packageAPI/pages/api/custom-message/custom-message.js +++ b/miniprogram/packageAPI/pages/api/custom-message/custom-message.js @@ -5,7 +5,7 @@ Page({ path: 'packageAPI/pages/api/custom-message/custom-message' } }, - handleContact (e) { + handleContact(e) { console.log(e.detail.path) console.log(e.detail.query) }, @@ -16,12 +16,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/get-user-info/get-user-info.js b/miniprogram/packageAPI/pages/api/get-user-info/get-user-info.js index 272ea109..aade5ce3 100644 --- a/miniprogram/packageAPI/pages/api/get-user-info/get-user-info.js +++ b/miniprogram/packageAPI/pages/api/get-user-info/get-user-info.js @@ -45,12 +45,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (wx.getUserProfile) { diff --git a/miniprogram/packageAPI/pages/api/jump/jump.js b/miniprogram/packageAPI/pages/api/jump/jump.js index 70c62018..3da1fbde 100644 --- a/miniprogram/packageAPI/pages/api/jump/jump.js +++ b/miniprogram/packageAPI/pages/api/jump/jump.js @@ -10,49 +10,49 @@ Page({ theme: 'light', setting: {} }, - //打开半屏小程序 - openhalfscreenminiprogram(){ + // 打开半屏小程序 + openhalfscreenminiprogram() { wx.openEmbeddedMiniProgram({ - appId: 'wxfdcee92a299bcaf1', // 腾讯公益 - extraData: { - foo: 'bar' - }, - // envVersion: 'develop', - success(res) { - // 打开成功 - } + appId: 'wxfdcee92a299bcaf1', // 腾讯公益 + extraData: { + foo: 'bar' + }, + // envVersion: 'develop', + success(res) { + // 打开成功 + } }) }, - //打开另一个小程序 - openanotherminiprogram(){ + // 打开另一个小程序 + openanotherminiprogram() { wx.navigateToMiniProgram({ - appId: 'wxfdcee92a299bcaf1', // 腾讯公益 - // extraData: { - // foo: 'bar' - // }, - // envVersion: 'develop', - success(res) { - // 打开成功 - } + appId: 'wxfdcee92a299bcaf1', // 腾讯公益 + // extraData: { + // foo: 'bar' + // }, + // envVersion: 'develop', + success(res) { + // 打开成功 + } }) }, - //退出当前小程序 - exitminiprogram(){ + // 退出当前小程序 + exitminiprogram() { wx.exitMiniProgram({ - success(){ - wx.showToast({ - title: '退出成功', - icon: 'none', - duration: 2000 - }) - }, - fail(){ - wx.showToast({ - title: '退出失败', - icon: 'none', - duration: 2000 - }) - } + success() { + wx.showToast({ + title: '退出成功', + icon: 'none', + duration: 2000 + }) + }, + fail() { + wx.showToast({ + title: '退出失败', + icon: 'none', + duration: 2000 + }) + } }) }, onUnload() { @@ -62,12 +62,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/login/login.js b/miniprogram/packageAPI/pages/api/login/login.js index 3baeb750..16c2b4a8 100644 --- a/miniprogram/packageAPI/pages/api/login/login.js +++ b/miniprogram/packageAPI/pages/api/login/login.js @@ -14,20 +14,19 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ hasLogin: app.globalData.hasLogin }) }, - data: { - theme: 'light',}, + data: { theme: 'light' }, login() { const that = this wx.login({ diff --git a/miniprogram/packageAPI/pages/api/request-payment/request-payment.js b/miniprogram/packageAPI/pages/api/request-payment/request-payment.js index aed144fe..5620a80d 100644 --- a/miniprogram/packageAPI/pages/api/request-payment/request-payment.js +++ b/miniprogram/packageAPI/pages/api/request-payment/request-payment.js @@ -1,4 +1,3 @@ - const app = getApp() Page({ @@ -16,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, @@ -40,7 +39,7 @@ Page({ wx.cloud.callFunction({ name: 'pay', data: { - theme: 'light', + theme: 'light', action: 'unifiedorder', userInfo: { openId: openid @@ -57,7 +56,7 @@ Page({ signType: 'MD5', paySign: data.sign, success: () => { - wx.showToast({title: '支付成功'}) + wx.showToast({ title: '支付成功' }) }, fail(err) { self.setData({ diff --git a/miniprogram/packageAPI/pages/api/setting/setting.js b/miniprogram/packageAPI/pages/api/setting/setting.js index 7fdff7b9..fa17cefa 100644 --- a/miniprogram/packageAPI/pages/api/setting/setting.js +++ b/miniprogram/packageAPI/pages/api/setting/setting.js @@ -15,7 +15,7 @@ Page({ wx.getSetting({ success: (res) => { console.log(res) - this.setData({setting: res.authSetting}) + this.setData({ setting: res.authSetting }) } }) }, @@ -26,12 +26,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/share-button/share-button.js b/miniprogram/packageAPI/pages/api/share-button/share-button.js index 7d8a20eb..66b69160 100644 --- a/miniprogram/packageAPI/pages/api/share-button/share-button.js +++ b/miniprogram/packageAPI/pages/api/share-button/share-button.js @@ -21,12 +21,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/share/share.js b/miniprogram/packageAPI/pages/api/share/share.js index b70870d7..6d50d1d6 100644 --- a/miniprogram/packageAPI/pages/api/share/share.js +++ b/miniprogram/packageAPI/pages/api/share/share.js @@ -2,7 +2,7 @@ Page({ data: { theme: 'light', sharedata: { - theme: 'light', + theme: 'light', title: '自定义转发标题', desc: '自定义转发描述', path: 'packageAPI/pages/api/share/share' @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageAPI/pages/api/soter-authentication/soter-authentication.js b/miniprogram/packageAPI/pages/api/soter-authentication/soter-authentication.js index 23d91313..5ab8d8be 100644 --- a/miniprogram/packageAPI/pages/api/soter-authentication/soter-authentication.js +++ b/miniprogram/packageAPI/pages/api/soter-authentication/soter-authentication.js @@ -1,4 +1,3 @@ - Page({ onShareAppMessage() { return { @@ -83,12 +82,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/api/subscribe-message/subscribe-message.js b/miniprogram/packageAPI/pages/api/subscribe-message/subscribe-message.js index 52a4fac3..2e10e175 100644 --- a/miniprogram/packageAPI/pages/api/subscribe-message/subscribe-message.js +++ b/miniprogram/packageAPI/pages/api/subscribe-message/subscribe-message.js @@ -30,7 +30,7 @@ Page({ wx.cloud.callFunction({ name: 'openapi', data: { - theme: 'light', + theme: 'light', action: 'sendSubscribeMessage' }, success: res => { @@ -54,22 +54,16 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onUnload() { - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } - }, /** @@ -97,7 +91,9 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload() { - + if (wx.offThemeChange) { + wx.offThemeChange() + } }, /** diff --git a/miniprogram/packageAPI/pages/ar/2dmarker-ar/2dmarker-ar.js b/miniprogram/packageAPI/pages/ar/2dmarker-ar/2dmarker-ar.js index fac3559d..632d3f4c 100644 --- a/miniprogram/packageAPI/pages/ar/2dmarker-ar/2dmarker-ar.js +++ b/miniprogram/packageAPI/pages/ar/2dmarker-ar/2dmarker-ar.js @@ -9,36 +9,36 @@ Component({ behaviors: [arBehavior, threeBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.6, // canvas高度缩放值 - markerImgList: [], // 使用的 marker 列表 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.6, // canvas高度缩放值 + markerImgList: [], // 使用的 marker 列表 chooseImgList: [], // 使用的 图片 列表 - hintBoxList: [], // 显示提示盒子列表 + hintBoxList: [], // 显示提示盒子列表 }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { @@ -52,12 +52,12 @@ Component({ // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() - this.markerIndex = 0; + this.markerIndex = 0 // 添加 识别包围盒子 - this.add3DBox(); + this.add3DBox() }, initVK() { // VKSession 配置 @@ -70,7 +70,7 @@ Component({ }, version: 'v1', gl: this.gl - }); + }) session.start(err => { if (err) return console.error('VK error: ', err) @@ -79,55 +79,53 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { // console.log("addAnchor", anchors); - this.left.visible = true; - this.right.visible = true; - this.top.visible = true; - this.bottom.visible = true; + this.left.visible = true + this.right.visible = true + this.top.visible = true + this.bottom.visible = true }) // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // marker 模式下,目前仅有一个识别目标,可以直接取 - const anchor = anchors[0]; - const markerId = anchor.id; - const size = anchor.size; + const anchor = anchors[0] + const markerId = anchor.id + const size = anchor.size this.hintInfo = { - markerId: markerId, - size: size + markerId, + size } }) - + // VKSession removeAnchors // 识别目标丢失时,会触发一次 session.on('removeAnchors', anchors => { - this.left.visible = false; - this.right.visible = false; - this.top.visible = false; - this.bottom.visible = false; + this.left.visible = false + this.right.visible = false + this.top.visible = false + this.bottom.visible = false if (this.data.hintBoxList && this.data.hintBoxList.length > 0) { // 清理信息 - this.hintInfo = undefined; + this.hintInfo = undefined // 存在列表的情况,去除remove this.setData({ hintBoxList: [] - }); + }) } - }); - + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - + this.initLoop() + }) }, loop() { // console.log('loop') @@ -136,7 +134,7 @@ Component({ const frame = this.session.getVKFrame(this.canvas.width, this.canvas.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 this.renderYUV(frame) @@ -150,8 +148,8 @@ Component({ this.camera.matrixAutoUpdate = false // 视图矩阵 - this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix); - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse); + this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) // 投影矩阵 const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR) @@ -162,28 +160,28 @@ Component({ // 绘制而为提示框的逻辑 if (this.hintInfo) { // 存在提示信息,则更新 - const THREE = this.THREE; + const THREE = this.THREE // 原点偏移矩阵,VK情况下,marker 点对应就是 0 0 0,世界矩阵可以认为是一个单位矩阵 // marker 右侧点可以理解是 0.5 0 0 - const center = new THREE.Vector3(); - const right = new THREE.Vector3(0.5, 0, 0); + const center = new THREE.Vector3() + const right = new THREE.Vector3(0.5, 0, 0) // 获取设备空间坐标 - const devicePos = center.clone().project(this.camera); + const devicePos = center.clone().project(this.camera) // 转换坐标系,从 (-1, 1) 转到 (0, 100),同时移到左上角 0 0,右下角 1 1 - const screenPos = new THREE.Vector3(0, 0, 0); - screenPos.x = devicePos.x * 50 + 50; - screenPos.y = 50 - devicePos.y * 50; + const screenPos = new THREE.Vector3(0, 0, 0) + screenPos.x = devicePos.x * 50 + 50 + screenPos.y = 50 - devicePos.y * 50 // 获取右侧点信息 - const deviceRightPos = right.clone().project(this.camera); - const screenRightPos = new THREE.Vector3(0, 0, 0); - screenRightPos.x = deviceRightPos.x * 50 + 50; + const deviceRightPos = right.clone().project(this.camera) + const screenRightPos = new THREE.Vector3(0, 0, 0) + screenRightPos.x = deviceRightPos.x * 50 + 50 + + const markerHalfWidth = screenRightPos.x - screenPos.x - const markerHalfWidth = screenRightPos.x - screenPos.x; - this.setData({ hintBoxList: [ { @@ -194,7 +192,7 @@ Component({ height: markerHalfWidth * this.data.domWidth * 2 / 100, } ] - }); + }) } this.renderer.autoClearColor = false @@ -205,53 +203,53 @@ Component({ add3DBox() { // 添加marker需要的 三维包围框 - const THREE = this.THREE; - const scene = this.scene; + const THREE = this.THREE + const scene = this.scene - const material = new THREE.MeshPhysicalMaterial( { + const material = new THREE.MeshPhysicalMaterial({ metalness: 0.0, roughness: 0.1, color: 0x64f573, - } ); - const geometry = new THREE.BoxGeometry( 1, 1, 1 ); - - const borderSize = 0.1; - - const left = new THREE.Mesh( geometry, material ); - left.position.set(-0.5, 0, 0 ); - left.rotation.set(-Math.PI / 2, 0, 0 ) - left.scale.set(borderSize, 1.1, borderSize); - scene.add( left ); - left.visible = false; - this.left = left; - - const right = new THREE.Mesh( geometry, material ); - right.position.set(0.5, 0, 0 ); - right.rotation.set(-Math.PI / 2, 0, 0 ) - right.scale.set(borderSize, 1.1, borderSize); - scene.add( right ); - right.visible = false; - this.right = right; - - const top = new THREE.Mesh( geometry, material ); - top.position.set(0, 0, 0.5 ); - top.rotation.set(0, 0, 0 ) - top.scale.set(1.1, borderSize, borderSize); - scene.add( top ); - top.visible = false; - this.top = top; - - const bottom = new THREE.Mesh( geometry, material ); - bottom.position.set(0, 0, -0.5 ); - bottom.rotation.set(0, 0, 0 ) - bottom.scale.set(1.1, borderSize, borderSize); - scene.add( bottom ); - bottom.visible = false; - this.bottom = bottom; + }) + const geometry = new THREE.BoxGeometry(1, 1, 1) + + const borderSize = 0.1 + + const left = new THREE.Mesh(geometry, material) + left.position.set(-0.5, 0, 0) + left.rotation.set(-Math.PI / 2, 0, 0) + left.scale.set(borderSize, 1.1, borderSize) + scene.add(left) + left.visible = false + this.left = left + + const right = new THREE.Mesh(geometry, material) + right.position.set(0.5, 0, 0) + right.rotation.set(-Math.PI / 2, 0, 0) + right.scale.set(borderSize, 1.1, borderSize) + scene.add(right) + right.visible = false + this.right = right + + const top = new THREE.Mesh(geometry, material) + top.position.set(0, 0, 0.5) + top.rotation.set(0, 0, 0) + top.scale.set(1.1, borderSize, borderSize) + scene.add(top) + top.visible = false + this.top = top + + const bottom = new THREE.Mesh(geometry, material) + bottom.position.set(0, 0, -0.5) + bottom.rotation.set(0, 0, 0) + bottom.scale.set(1.1, borderSize, borderSize) + scene.add(bottom) + bottom.visible = false + this.bottom = bottom console.log('add3DBox is finish') }, - chooseMedia() { + chooseMedia() { // marker图片上传逻辑 wx.chooseMedia({ count: 9, @@ -260,10 +258,10 @@ Component({ success: res => { console.log('chooseMedia res', res) - const chooseImgListRes = []; + const chooseImgListRes = [] for (let i = 0; i < res.tempFiles.length; i++) { - const imgUrl = res.tempFiles[i].tempFilePath; - chooseImgListRes.push(imgUrl); + const imgUrl = res.tempFiles[i].tempFilePath + chooseImgListRes.push(imgUrl) } console.log('set chooseImgList', chooseImgListRes) @@ -279,88 +277,87 @@ Component({ async addMarker() { console.log('addMarker') const fs = wx.getFileSystemManager() - - const markerImgListRes = this.data.markerImgList.concat([]); - const preMarkerIndex = this.markerIndex; - console.log('pre markerImgList', preMarkerIndex, markerImgListRes); - + const markerImgListRes = this.data.markerImgList.concat([]) + const preMarkerIndex = this.markerIndex + + console.log('pre markerImgList', preMarkerIndex, markerImgListRes) + // 检查与添加 marker 函数 - const chooseImgCount = this.data.chooseImgList.length; - let handledCount = 0; + const chooseImgCount = this.data.chooseImgList.length + let handledCount = 0 const checkMarkerAdded = () => { if (handledCount === chooseImgCount) { - this.markerIndex = markerImgListRes.length; + this.markerIndex = markerImgListRes.length - console.log('markerImgList set', markerImgListRes, this.markerIndex); + console.log('markerImgList set', markerImgListRes, this.markerIndex) this.setData({ chooseImgList: [], markerImgList: markerImgListRes - }); + }) } } - + // 准备进行choose的图片保存到fs for (let i = 0; i < chooseImgCount; i++) { - const chooseImgUrl = this.data.chooseImgList[i]; - const fileEnd = chooseImgUrl.split('.').slice(-1)[0]; - const fileIndex = preMarkerIndex + i; + const chooseImgUrl = this.data.chooseImgList[i] + const fileEnd = chooseImgUrl.split('.').slice(-1)[0] + const fileIndex = preMarkerIndex + i // 算法侧目前只认 map png jpg jpeg 后缀文件 - const filePath = `${wx.env.USER_DATA_PATH}/marker-ar-${fileIndex}.${fileEnd}`; + const filePath = `${wx.env.USER_DATA_PATH}/marker-ar-${fileIndex}.${fileEnd}` const saveAndAddMarker = () => { - console.log('saveFileSync start', filePath, chooseImgUrl); + console.log('saveFileSync start', filePath, chooseImgUrl) // 存入文件系统,并添加到marker fs.saveFile({ filePath, tempFilePath: chooseImgUrl, - success: ()=> { + success: () => { console.log('[addMarker] --> ', filePath) const markerId = this.session.addMarker(filePath) markerImgListRes.push({ - markerId: markerId, - filePath: filePath + markerId, + filePath }) - handledCount++; - checkMarkerAdded(); + handledCount++ + checkMarkerAdded() }, fail: res => { console.error(res) - console.log('文件保存失败', filePath); - handledCount++; - checkMarkerAdded(); + console.log('文件保存失败', filePath) + handledCount++ + checkMarkerAdded() } }) } - console.log('uploadFile Path', filePath); + console.log('uploadFile Path', filePath) // 确定文件,存在即删除 fs.stat({ path: filePath, success: (res) => { if (res.stats.isFile()) { - fs.unlinkSync(filePath); - console.log('fs unlinkSync', filePath); + fs.unlinkSync(filePath) + console.log('fs unlinkSync', filePath) } - saveAndAddMarker(); + saveAndAddMarker() }, fail: (res) => { console.error(res) - console.log('fs中不存在,直接写入', filePath); + console.log('fs中不存在,直接写入', filePath) - saveAndAddMarker(); + saveAndAddMarker() } }) } - }, removeMarker() { if (this.data.markerImgList) { for (let i = 0; i < this.data.markerImgList.length; i++) { - const markerImg = this.data.markerImgList[i]; - this.session.removeMarker(markerImg.markerId); + const markerImg = this.data.markerImgList[i] + this.session.removeMarker(markerImg.markerId) } - this.markerIndex = 0; + this.markerIndex = 0 this.setData({ markerImgList: [], }) @@ -370,4 +367,4 @@ Component({ console.log(this.session.getAllMarker()) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/3dmarker-ar/3dmarker-ar.js b/miniprogram/packageAPI/pages/ar/3dmarker-ar/3dmarker-ar.js index 3826bbf8..e38bbf35 100644 --- a/miniprogram/packageAPI/pages/ar/3dmarker-ar/3dmarker-ar.js +++ b/miniprogram/packageAPI/pages/ar/3dmarker-ar/3dmarker-ar.js @@ -1,70 +1,70 @@ import arBehavior from '../behavior/behavior-ar' import xrFrameBehavior from '../behavior/behavior-xrframe' - // protobuf 相关逻辑 -let protobuf = require("./protobuf/protobuf.js"); -let json = require("./proto/arModelProto.js"); -let root = protobuf.Root.fromJSON(json) -let message = root.lookupType("ARModelData"); +const protobuf = require('./protobuf/protobuf.js') +const json = require('./proto/arModelProto.js') + +const root = protobuf.Root.fromJSON(json) +const message = root.lookupType('ARModelData') -let gltfIndex = 0; +let gltfIndex = 0 // VK 投影矩阵参数定义 const NEAR = 0.01 const FAR = 1000 // 针对 vk 生成模型的矫正 -const modelScale = 0.16; +const modelScale = 0.16 Component({ behaviors: [arBehavior, xrFrameBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.6, // canvas高度缩放值 - hintBoxList: [], // 显示提示盒子列表 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.6, // canvas高度缩放值 + hintBoxList: [], // 显示提示盒子列表 usingMarkerId: false, // 使用中的markerId haveMap: false, // 存在map haveGLTF: false, // 存在gltf }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 selectCosid: 0, // 选中的cosid - selectResp: undefined, // 选中的回调信息 + selectResp: undefined, // 选中的回调信息 parsedMapUrl: undefined, // 使用中的mapUrl - parsedGlbUrl: undefined,// 使用中的glbUrl + parsedGlbUrl: undefined, // 使用中的glbUrl lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { // 对应案例的初始化逻辑,由统一的 behavior 触发 init() { - this.markerIndex = 0; + this.markerIndex = 0 // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 @@ -77,7 +77,7 @@ Component({ }, version: 'v1', gl: this.gl - }); + }) session.start(err => { if (err) return console.error('VK error: ', err) @@ -86,212 +86,208 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { - console.log("addAnchor", anchors); + console.log('addAnchor', anchors) }) // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // marker 模式下,目前仅有一个识别目标,可以直接取 - const anchor = anchors[0]; - const markerId = anchor.id; - const size = anchor.size; + const anchor = anchors[0] + const markerId = anchor.id + const size = anchor.size this.hintInfo = { - markerId: markerId, - size: size + markerId, + size } console.log('update a') if (!this.modelShow) { if (this.modelTrs) { - this.modelTrs.scale.x = modelScale; - this.modelTrs.scale.y = modelScale; - this.modelTrs.scale.z = modelScale; + this.modelTrs.scale.x = modelScale + this.modelTrs.scale.y = modelScale + this.modelTrs.scale.z = modelScale } - this.xAxis.visible = true; - this.yAxis.visible = true; - this.zAxis.visible = true; + this.xAxis.visible = true + this.yAxis.visible = true + this.zAxis.visible = true - this.modelShow = true; + this.modelShow = true } }) - + // VKSession removeAnchors // 识别目标丢失时,会触发一次 session.on('removeAnchors', anchors => { console.log('remove a') if (this.modelShow) { - if (this.modelTrs) { - this.modelTrs.scale.x = 0; - this.modelTrs.scale.y = 0; - this.modelTrs.scale.z = 0; + this.modelTrs.scale.x = 0 + this.modelTrs.scale.y = 0 + this.modelTrs.scale.z = 0 } - this.xAxis.visible = false; - this.yAxis.visible = false; - this.zAxis.visible = false; + this.xAxis.visible = false + this.yAxis.visible = false + this.zAxis.visible = false - this.modelShow = false; + this.modelShow = false } - }); - + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - + this.initLoop() + }) }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; - + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // 添加marker 提示用的 三个轴 - const geometryCube = scene.assets.getAsset('geometry', 'cube'); - const effectCube = scene.assets.getAsset('effect', 'standard'); - const axisScale = 1.0; - const lineScale = 0.05; + const geometryCube = scene.assets.getAsset('geometry', 'cube') + const effectCube = scene.assets.getAsset('effect', 'standard') + const axisScale = 1.0 + const lineScale = 0.05 const elX = scene.createElement(xrFrameSystem.XRNode, { position: `${axisScale / 2} 0 0`, scale: `${axisScale} ${lineScale} ${lineScale}`, - }); - const elXTrs = elX.getComponent(xrFrameSystem.Transform); - const matX = scene.createMaterial(effectCube); - matX.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 0.2, 0.2, 1.0)); + }) + const elXTrs = elX.getComponent(xrFrameSystem.Transform) + const matX = scene.createMaterial(effectCube) + matX.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 0.2, 0.2, 1.0)) const meshX = elX.addComponent(xrFrameSystem.Mesh, { geometry: geometryCube, material: matX, - }); - this.xAxis = elXTrs; - rootShadow.addChild(elX); - this.xAxis.visible = false; + }) + this.xAxis = elXTrs + rootShadow.addChild(elX) + this.xAxis.visible = false const elY = scene.createElement(xrFrameSystem.XRNode, { position: `0 ${axisScale / 2} 0`, scale: `${lineScale} ${axisScale} ${lineScale}`, - }); - const elYTrs = elY.getComponent(xrFrameSystem.Transform); - const matY = scene.createMaterial(effectCube); - matY.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(0.2, 1, 0.2, 1.0)); + }) + const elYTrs = elY.getComponent(xrFrameSystem.Transform) + const matY = scene.createMaterial(effectCube) + matY.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(0.2, 1, 0.2, 1.0)) const meshY = elY.addComponent(xrFrameSystem.Mesh, { geometry: geometryCube, material: matY, - }); - this.yAxis = elYTrs; - rootShadow.addChild(elY); - this.yAxis.visible = false; + }) + this.yAxis = elYTrs + rootShadow.addChild(elY) + this.yAxis.visible = false const elZ = scene.createElement(xrFrameSystem.XRNode, { position: `0 0 ${axisScale / 2}`, scale: `${lineScale} ${lineScale} ${axisScale}`, - }); - const elZTrs = elZ.getComponent(xrFrameSystem.Transform); - const matZ = scene.createMaterial(effectCube); - matZ.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(0.2, 0.2, 1, 1.0)); + }) + const elZTrs = elZ.getComponent(xrFrameSystem.Transform) + const matZ = scene.createMaterial(effectCube) + matZ.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(0.2, 0.2, 1, 1.0)) const meshZ = elZ.addComponent(xrFrameSystem.Mesh, { geometry: geometryCube, material: matZ, - }); - this.zAxis = elZTrs; - rootShadow.addChild(elZ); - this.zAxis.visible = false; + }) + this.zAxis = elZTrs + rootShadow.addChild(elZ) + this.zAxis.visible = false console.log('add3DAxis is finish') - }, loop() { // 获取 VKFrame const frame = this.session.getVKFrame(this.data.domWidth, this.data.domHeight) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) }, async parseAddMarker() { // 目前未选中cosid 跳过 if (!this.selectCosid) { - console.log("目前未选中cosid,请选中后重试"); - return; + console.log('目前未选中cosid,请选中后重试') + return } // 存在marker的情况下,无法继续添加marker if (this.data.usingMarkerId) { - console.log("已添加 marker,请删除后重试"); - return; + console.log('已添加 marker,请删除后重试') + return } - if (!!this.parseAddMarkerLoading) { - console.log("加载中,请稍后重试"); - return; + if (this.parseAddMarkerLoading) { + console.log('加载中,请稍后重试') + return } - const resp = this.selectResp; - console.log("开始添加 marker"); - console.log("获取的模型的cosID为", this.selectCosid); - console.log(this.selectResp); - var filePath = wx.env.USER_DATA_PATH + '/temp' - console.log('请求地址'); + const resp = this.selectResp + console.log('开始添加 marker') + console.log('获取的模型的cosID为', this.selectCosid) + console.log(this.selectResp) + const filePath = wx.env.USER_DATA_PATH + '/temp' + console.log('请求地址') console.log(resp.result.respBody.url) // 简单的加载锁 - this.parseAddMarkerLoading = true; + this.parseAddMarkerLoading = true // 开始下载文件 wx.downloadFile({ - filePath: filePath, + filePath, url: resp.result.respBody.url, success: (res) => { - console.log("下载回调", res); + console.log('下载回调', res) const fs = wx.getFileSystemManager() fs.readFile({ filePath: res.filePath, position: 0, success: async (res) => { - console.log("读文件回调,结果返回为", res) - wx.hideLoading(); + console.log('读文件回调,结果返回为', res) + wx.hideLoading() // 开始解析具体信息 protobuf - try{ + try { console.log('开始解析回调') - var data = message.decode(res.data); - console.log("反序列化完成"); - console.log(data); - } catch(e){ - wx.hideLoading(); - console.log("模型数据解析有误") + var data = message.decode(res.data) + console.log('反序列化完成') + console.log(data) + } catch (e) { + wx.hideLoading() + console.log('模型数据解析有误') console.log(e) - if(e instanceof protobuf.util.ProtocolError){ + if (e instanceof protobuf.util.ProtocolError) { // missing required field console.log('missing required field') - }else{ + } else { // wire format is invalid console.log('wire format is invalid') } - throw e; + throw e } - let mapSuccess = true; - let gltfSuccess = true; - + let mapSuccess = true + let gltfSuccess = true + // map文件 - if (data.meshModel && data.meshModel.byteLength !== 0) { + if (data.meshModel && data.meshModel.byteLength !== 0) { // map文件成功 this.setData({ haveMap: true, @@ -302,23 +298,22 @@ Component({ const byteOffset = data.meshModel.byteOffset const byteLength = data.meshModel.byteLength const mapContent = data.meshModel.buffer.slice(byteOffset, byteOffset + byteLength) - console.log("byteOffset:", byteOffset) - console.log("byteLength:", byteLength) - + console.log('byteOffset:', byteOffset) + console.log('byteLength:', byteLength) // 写入文件后的地址 - const mapUrl = this.saveLocalFile(mapContent, 'model.map'); - console.log("map文件的本地路径", mapUrl) - this.parsedMapUrl = mapUrl; + const mapUrl = this.saveLocalFile(mapContent, 'model.map') + console.log('map文件的本地路径', mapUrl) + this.parsedMapUrl = mapUrl // 添加marker - const markerId = this.session.addMarker(mapUrl); + const markerId = this.session.addMarker(mapUrl) console.log('add Marker', markerId, mapUrl) this.setData({ usingMarkerId: markerId - }); + }) } else { - mapSuccess = false; + mapSuccess = false } // glb文件 @@ -327,38 +322,38 @@ Component({ const glbByteOffset = data.meshBlob.byteOffset const glbByteLength = data.meshBlob.byteLength const glbContent = data.meshBlob.buffer.slice(glbByteOffset, glbByteOffset + glbByteLength) - console.log('glbContent', glbContent); - const glbUrl = this.saveLocalFile(glbContent, 'result.glb'); - console.log("glb文件的本地路径", glbUrl) - this.parsedGlbUrl = glbUrl; + console.log('glbContent', glbContent) + const glbUrl = this.saveLocalFile(glbContent, 'result.glb') + console.log('glb文件的本地路径', glbUrl) + this.parsedGlbUrl = glbUrl // @optional - // 后续为添加渲染产物模型的逻辑 + // 后续为添加渲染产物模型的逻辑 // xrFrame 加载模型相关 // 加载生成模型 - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene // gltf索引更新 - gltfIndex++; + gltfIndex++ const resultModel = await scene.assets.loadAsset({ type: 'gltf', assetId: `gltf-result-${gltfIndex}`, src: `${wx.env.USER_DATA_PATH}/result.glb`, }) - console.log('resultModel', resultModel.value); + console.log('resultModel', resultModel.value) const el = scene.createElement(xrFrameSystem.XRGLTF, { model: `gltf-result-${gltfIndex}`, position: `0 -${modelScale} -${modelScale}`, rotation: '90 0 0', - scale: `0 0 0`, // 默认先不显示 - }); - this.model = el; - this.modelTrs = el.getComponent(xrFrameSystem.Transform); - this.modelShow = false; - this.xrScene.rootShadow.addChild(el); + scale: '0 0 0', // 默认先不显示 + }) + this.model = el + this.modelTrs = el.getComponent(xrFrameSystem.Transform) + this.modelShow = false + this.xrScene.rootShadow.addChild(el) // Three 场景相关 // const THREE = this.THREE; @@ -384,9 +379,9 @@ Component({ // this.modelWrap.add(this.model); // }); } else { - gltfSuccess = false; + gltfSuccess = false } - + // 更新产物状态 this.setData({ haveMap: mapSuccess, @@ -395,8 +390,8 @@ Component({ if (!mapSuccess || !gltfSuccess) { // 文件生成失败提示 - let mapWord = !mapSuccess ? 'map文件' : ''; - let gltfWord = !gltfSuccess ? 'glTF文件' : ''; + const mapWord = !mapSuccess ? 'map文件' : '' + const gltfWord = !gltfSuccess ? 'glTF文件' : '' wx.showToast({ title: `${mapWord} ${gltfWord} 生成失败`, @@ -405,35 +400,34 @@ Component({ }) } - this.parseAddMarkerLoading = false; + this.parseAddMarkerLoading = false }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', duration: 2000 }) - this.parseAddMarkerLoading = false; + this.parseAddMarkerLoading = false } }) }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', duration: 2000 }) console.error(res) - this.parseAddMarkerLoading = false; + this.parseAddMarkerLoading = false } }) - }, saveLocalFile(bufferContent, name) { - var url = `${wx.env.USER_DATA_PATH}/${name}` + const url = `${wx.env.USER_DATA_PATH}/${name}` const fs = wx.getFileSystemManager() try { @@ -443,8 +437,8 @@ Component({ 'utf8' ) console.log(res) - } catch(e) { - console.error(e); + } catch (e) { + console.error(e) } return url @@ -457,78 +451,77 @@ Component({ }) // 释放xrframe资源 if (this.model) { - const scene = this.xrScene; - scene.assets.releaseAsset('gltf',`gltf-result-${gltfIndex}`); - scene.rootShadow.removeChild(this.model); - this.model = undefined; + const scene = this.xrScene + scene.assets.releaseAsset('gltf', `gltf-result-${gltfIndex}`) + scene.rootShadow.removeChild(this.model) + this.model = undefined } }, getAllMarker() { console.log(this.session.getAllMarker()) }, changeSelect(e) { - console.log('触发选择更改'); - console.log(e.detail); + console.log('触发选择更改') + console.log(e.detail) - this.selectCosid = e.detail.cosid; - this.selectResp = e.detail.modelResp; + this.selectCosid = e.detail.cosid + this.selectResp = e.detail.modelResp }, - saveMap(){ + saveMap() { if (!this.parsedMapUrl) { console.log('不存在使用中的map地址') - return; + return } wx.shareFileMessage({ filePath: this.parsedMapUrl, - }); + }) }, saveGlTF() { if (!this.parsedGlbUrl) { console.log('不存在使用中的glb地址') - return; + return } wx.shareFileMessage({ filePath: this.parsedGlbUrl, - }); + }) }, useDefaultMarker() { // 简单的加载锁 - if (!!this.parseAddMarkerLoading) { - console.log("加载中,请稍后重试"); - return; + if (this.parseAddMarkerLoading) { + console.log('加载中,请稍后重试') + return } - this.parseAddMarkerLoading = true; - + this.parseAddMarkerLoading = true // 开始下载文件 - const filePath = wx.env.USER_DATA_PATH + '/default.map'; + const filePath = wx.env.USER_DATA_PATH + '/default.map' wx.downloadFile({ - filePath: filePath, + filePath, url: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/default.map', success: (res) => { - console.log("下载回调", res); + console.log('下载回调', res) // 添加marker - const markerId = this.session.addMarker(res.filePath); + const markerId = this.session.addMarker(res.filePath) console.log('add Default Marker', markerId) - this.modelShow = false; + this.modelShow = false this.setData({ usingMarkerId: markerId - }); + }) - this.parseAddMarkerLoading = false; + this.parseAddMarkerLoading = false }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', duration: 2000 }) console.error(res) - this.parseAddMarkerLoading = false; + this.parseAddMarkerLoading = false } }) } }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/3dmarker-ar/Components/arModelComponent.js b/miniprogram/packageAPI/pages/ar/3dmarker-ar/Components/arModelComponent.js index 1a90c417..25e4e29d 100644 --- a/miniprogram/packageAPI/pages/ar/3dmarker-ar/Components/arModelComponent.js +++ b/miniprogram/packageAPI/pages/ar/3dmarker-ar/Components/arModelComponent.js @@ -1,7 +1,7 @@ Component({ behaviors: ['wx://component-export'], - export(){ - return {getARModelList: this.getARModelList.bind(this)} + export() { + return { getARModelList: this.getARModelList.bind(this) } }, data: { chooseMapFile: null, @@ -16,28 +16,28 @@ Component({ }, modelRespMap: {}, lifetimes: { - ready: function () { + ready() { if (!wx.cloud) { - console.error('请使用 2.2.3 或以上的基础库以使用云能力'); + console.error('请使用 2.2.3 或以上的基础库以使用云能力') } else { wx.cloud.init({ traceUser: true, - }); - console.log("初始化云函数成功") + }) + console.log('初始化云函数成功') } // 缓存resp map - this.modelRespMap = {}; + this.modelRespMap = {} - const keyNumber = (new Date()).getTime() * 10 + Math.floor(Math.random() * 10); + const keyNumber = (new Date()).getTime() * 10 + Math.floor(Math.random() * 10) this.setData({ modelName: 'arDemo' + keyNumber }) - console.log('当前上传模型名称为 ' + 'arDemo' + keyNumber); + console.log('当前上传模型名称为 ' + 'arDemo' + keyNumber) // 获取已有数据 - this.getARModelList(); + this.getARModelList() } }, @@ -46,18 +46,18 @@ Component({ uploadARModel() { const callback = this.generateARModel.bind(this) const cloudUpload = this.cloudUploadARModel.bind(this) - const timeNow = Date.now() / 1000 | 0; - const modelInfos = wx.getStorageSync('modelsInfo'); - console.log("modelInfos的值为:") + const timeNow = Date.now() / 1000 | 0 + const modelInfos = wx.getStorageSync('modelsInfo') + console.log('modelInfos的值为:') console.log(modelInfos) - if(modelInfos && modelInfos.length != 0){ - if(timeNow - modelInfos[0].timeStamp < 100){ + if (modelInfos && modelInfos.length != 0) { + if (timeNow - modelInfos[0].timeStamp < 100) { wx.showToast({ - title: "每15分钟允许上传一次视频", + title: '每15分钟允许上传一次视频', icon: 'none', duration: 2000 }) - return; + return } } // 上传视频 @@ -69,23 +69,23 @@ Component({ maxDuration: 60, camera: 'back', success: (res) => { - console.log("录制成功,结果为") + console.log('录制成功,结果为') console.log(res) const tempFileInfo = res.tempFiles[0] // 保证视频时长在 10-30秒 之间 if (tempFileInfo.duration >= 10 && tempFileInfo.duration <= 30) { - const rate = tempFileInfo.width / tempFileInfo.height; + const rate = tempFileInfo.width / tempFileInfo.height - let min = tempFileInfo.width; - let max = tempFileInfo.height; + let min = tempFileInfo.width + let max = tempFileInfo.height if (rate > 1) { - min = tempFileInfo.height; - max = tempFileInfo.width; + min = tempFileInfo.height + max = tempFileInfo.width } // 保证长边在 720 以上 if (max > 720) { // 不接受比例在 3:1 以上的视频 - if(rate < 1 / 3 || rate > 3){ + if (rate < 1 / 3 || rate > 3) { wx.showModal({ content: '长宽比尽量为16:9或4:3,不接受比例大于3:1的视频', confirmText: '继续上传', @@ -97,10 +97,10 @@ Component({ } } }) - }else{ + } else { cloudUpload(res, callback) } - }else{ + } else { wx.showModal({ content: '建议长边在720以上', confirmText: '继续上传', @@ -113,7 +113,7 @@ Component({ } }) } - }else{ + } else { wx.showToast({ title: '请录制10~30秒内的视频', icon: 'none', @@ -125,21 +125,21 @@ Component({ }, // 生成具体模型 generateARModel(url) { - console.log("当前地址为:", url) + console.log('当前地址为:', url) wx.showLoading({ title: '生成模型中……', - }); + }) - const reqData = { + const reqData = { type: 'GenerateARModel', name: this.data.modelName, - url: url, + url, algoType: 2, getMesh: true, getTexture: true } - console.log("调用参数为:",reqData) + console.log('调用参数为:', reqData) wx.cloud.callFunction({ name: 'ARDemo', @@ -148,35 +148,35 @@ Component({ }, data: reqData }).then((resp) => { - console.log("生成模型成功") + console.log('生成模型成功') console.log(resp) wx.showToast({ - title: "生成模型成功", + title: '生成模型成功', icon: 'none', duration: 2000 }) - wx.hideLoading(); + wx.hideLoading() let modelInfos = wx.getStorageSync('modelsInfo') - if (modelInfos == undefined || modelInfos.length == 0 ) { + if (modelInfos == undefined || modelInfos.length == 0) { modelInfos = [] } console.log('原有的缓存列表', modelInfos) - const returnCosid = resp.result.respBody.cosid; + const returnCosid = resp.result.respBody.cosid // 5分钟内上传相同文件,会返回相同的cosid,需要过滤掉 - let matched = false; - for( let j = modelInfos.length - 1; j >= 0; j-- ) { + let matched = false + for (let j = modelInfos.length - 1; j >= 0; j--) { if (modelInfos[j].cosid === returnCosid) { - matched = true; - break; + matched = true + break } } if (!matched) { - console.log("缓存对cosid进行push") - console.log("当前生成模型的cosid为:", returnCosid) + console.log('缓存对cosid进行push') + console.log('当前生成模型的cosid为:', returnCosid) console.log() modelInfos.push({ @@ -185,95 +185,94 @@ Component({ timeStamp: Date.now() / 1000 | 0, modelStatus: 0, restTime: 0, - statusMsg: "准备中" + statusMsg: '准备中' }) } - + modelInfos.sort(function (a, b) { - if(a.uploadTime > b.uploadTime){ - return -1; - }else if(a.uploadTime < b.uploadTime){ - return 1; + if (a.uploadTime > b.uploadTime) { + return -1 + } else if (a.uploadTime < b.uploadTime) { + return 1 } - return 0; - }) + return 0 + }) wx.setStorage({ - key: "modelsInfo", + key: 'modelsInfo', data: modelInfos, success() { - console.log("存储cosID集合为:", modelInfos) + console.log('存储cosID集合为:', modelInfos) } }) this.setData({ models: modelInfos - }); - + }) }).catch((e) => { console.log(e) wx.showToast({ title: e.errMsg, icon: 'none', duration: 2000 - }) + }) this.setData({ showUploadTip: true - }); - wx.hideLoading(); - }); + }) + wx.hideLoading() + }) }, // 获取现有模型列表 getARModelList() { // 获取本地缓存 - var modelInfos = wx.getStorageSync('modelsInfo') - if (modelInfos == undefined || modelInfos.length == 0 ) { + const modelInfos = wx.getStorageSync('modelsInfo') + if (modelInfos == undefined || modelInfos.length == 0) { // 无缓存,跳过 - return; + return } - const countModelInfo = modelInfos.length; - let countLoaded = 0; + const countModelInfo = modelInfos.length + let countLoaded = 0 - const modelInfosNew = []; + const modelInfosNew = [] // 统一的获取处理回调 const handleLoadModelInfo = () => { if (countLoaded === countModelInfo) { // 加载完毕 console.log('基于本地缓存请求列表结束', modelInfosNew) - + // 新列表,基于创建时间排序 modelInfosNew.sort(function (a, b) { - if(a.uploadTime > b.uploadTime){ - return -1; - }else if(a.uploadTime < b.uploadTime){ - return 1; + if (a.uploadTime > b.uploadTime) { + return -1 + } else if (a.uploadTime < b.uploadTime) { + return 1 } - return 0; + return 0 }) - + // 写入缓存 wx.setStorage({ - key: "modelsInfo", + key: 'modelsInfo', data: modelInfosNew, success() { - console.log("存储cosID集合为:", modelInfosNew) + console.log('存储cosID集合为:', modelInfosNew) wx.hideLoading() } }) - + // 更新显示列表 this.setData({ models: modelInfosNew, - }); + }) } } // 基于缓存列表请求 for (let i = 0; i < countModelInfo; i++) { - const modelInfo = modelInfos[i]; - const cosid = modelInfo.cosid + const modelInfo = modelInfos[i] + const cosid = modelInfo.cosid wx.cloud.callFunction({ name: 'ARDemo', config: { @@ -281,79 +280,75 @@ Component({ }, data: { type: 'GetARModel', - cosid: cosid, + cosid, modelType: 3, needData: 0, useIntranet: 0, expireTime: 1200 } }).then(resp => { - countLoaded++; + countLoaded++ - const modelStatus = resp.result.respBody.status; + const modelStatus = resp.result.respBody.status - console.log("获取的模型的cosID为", cosid) + console.log('获取的模型的cosID为', cosid) console.log(resp) - console.log('status', modelStatus); + console.log('status', modelStatus) // 根据返回信息,更新模型信息 const modelInfoNew = { - cosid: cosid, + cosid, uploadTime: modelInfo.uploadTime, timeStamp: modelInfo.timeStamp, - modelStatus: modelStatus, // 0 生成中 1 生成成功 2 过期 3 生成失败 + modelStatus, // 0 生成中 1 生成成功 2 过期 3 生成失败 restTime: 0, statusMsg: '准备中', - }; + } // 回调写入缓存map,方便读取 - this.modelRespMap[cosid] = resp; + this.modelRespMap[cosid] = resp // 根据状态设置描述 if (modelStatus === 1) { // 生成成功 - modelInfoNew.statusMsg = '已完成'; + modelInfoNew.statusMsg = '已完成' // 运算过期时间 - const expireTime = resp.result.respBody.expireTime; - const nowTime = Date.now() / 1000 | 0; - const restTime = Math.floor((expireTime - nowTime) / 60 / 60 / 24); - modelInfoNew.restTime = restTime; + const expireTime = resp.result.respBody.expireTime + const nowTime = Date.now() / 1000 | 0 + const restTime = Math.floor((expireTime - nowTime) / 60 / 60 / 24) + modelInfoNew.restTime = restTime } else if (modelStatus === 2) { // 资源过期 - modelInfoNew.statusMsg = '资源过期'; - + modelInfoNew.statusMsg = '资源过期' } else if (modelStatus === 3) { // 生成失败 - const errMsg = resp.result.respBody.errMsg; - console.log('errMsg', errMsg); + const errMsg = resp.result.respBody.errMsg + console.log('errMsg', errMsg) - modelInfoNew.statusMsg = '生成失败'; + modelInfoNew.statusMsg = '生成失败' if (errMsg) { - modelInfoNew.errMsg = errMsg; + modelInfoNew.errMsg = errMsg } } + modelInfosNew.push(modelInfoNew) - modelInfosNew.push(modelInfoNew); - - handleLoadModelInfo(); + handleLoadModelInfo() }).catch((e) => { - countLoaded++; + countLoaded++ console.log(e) - - }); + }) } - }, - cloudUploadARModel(res, callback){ + cloudUploadARModel(res, callback) { wx.showLoading({ title: '文件上传中……', - }); + }) + + const second = (new Date()).getSeconds() - const second = (new Date()).getSeconds(); - // 组成规则 第一位随机数(1 / 2)第二位是秒的个位 - const id = Math.ceil(Math.random() * 2) * 10 + second % 10; + const id = Math.ceil(Math.random() * 2) * 10 + second % 10 wx.cloud.uploadFile({ cloudPath: `3dmarker/arVideo${id}.mp4`, @@ -365,9 +360,9 @@ Component({ success(res) { wx.hideLoading() const data = res.data - console.log("上传文件success:", res) + console.log('上传文件success:', res) wx.showToast({ - title: "上传文件成功", + title: '上传文件成功', icon: 'none', duration: 2000 }) @@ -375,10 +370,10 @@ Component({ fileList: [res.fileID], success: res => { callback(res.fileList[0].tempFileURL) - console.log("生成模型中……") + console.log('生成模型中……') }, fail: err => { - console.log("发生错误:", err) + console.log('发生错误:', err) wx.showToast({ title: err.errMsg, icon: 'none', @@ -389,7 +384,7 @@ Component({ }, fail: err => { wx.hideLoading() - console.log("上传文件error:", err) + console.log('上传文件error:', err) wx.showToast({ title: err.errMsg, icon: 'none', @@ -400,45 +395,43 @@ Component({ }, // 工具函数 转换时间戳 convertToTime(timestamp) { - var now = new Date(timestamp * 1000) - var y = now.getFullYear() - var m = now.getMonth() + 1 - var d = now.getDate() - var x = y + "-" + (m < 10 ? "0" + m : m) + "-" + (d < 10 ? "0" + d : d) + " \n" + now.toTimeString().substr(0, 8); + const now = new Date(timestamp * 1000) + const y = now.getFullYear() + const m = now.getMonth() + 1 + const d = now.getDate() + const x = y + '-' + (m < 10 ? '0' + m : m) + '-' + (d < 10 ? '0' + d : d) + ' \n' + now.toTimeString().substr(0, 8) return x }, // 选择模型 chooseARModel(event) { // 被选中cosid - const selectCosid = event.currentTarget.dataset.cosid; + const selectCosid = event.currentTarget.dataset.cosid // 已选中cosid - const targetCosId = this.data.targetCosId; + const targetCosId = this.data.targetCosId // 不同的情况下,更新选中目标 if (selectCosid !== targetCosId) { + const modelResp = this.modelRespMap[selectCosid] - const modelResp = this.modelRespMap[selectCosid]; - - const modelStatus = modelResp.result.respBody.status; + const modelStatus = modelResp.result.respBody.status // 成功才允许点击 if (modelStatus === 1) { this.setData({ targetCosId: selectCosid - }); - + }) + // 选择的时候,通知上层 this.triggerEvent('selectEvent', { - cosid: selectCosid, - modelResp: modelResp, - } - ); + cosid: selectCosid, + modelResp, + }) } } }, // 删除模型本地缓存 deleteARModel(event) { // 被选中cosid - const selectCosid = event.currentTarget.dataset.cosid; + const selectCosid = event.currentTarget.dataset.cosid wx.showModal({ content: `是否删除当前缓存模型(删除后不可恢复),模型id ${selectCosid}`, @@ -446,39 +439,38 @@ Component({ cancelText: '取消', success: (res) => { if (res.confirm) { - console.log('确定删除'); + console.log('确定删除') // 获取本地缓存 - var modelInfos = wx.getStorageSync('modelsInfo') - if (modelInfos == undefined || modelInfos.length == 0 ) { + const modelInfos = wx.getStorageSync('modelsInfo') + if (modelInfos == undefined || modelInfos.length == 0) { // 无缓存,跳过 - return; + return } // 新列表,过滤掉删除的cosid - const modelInfosNew = modelInfos.filter( + const modelInfosNew = modelInfos.filter( (modelInfo) => modelInfo.cosid !== selectCosid - ); - + ) + // 写入缓存 wx.setStorage({ - key: "modelsInfo", + key: 'modelsInfo', data: modelInfosNew, success() { - console.log("存储cosID集合为:", modelInfosNew) + console.log('存储cosID集合为:', modelInfosNew) wx.hideLoading() } }) - + // 更新显示列表 this.setData({ models: modelInfosNew, - }); + }) } else if (res.cancel) { console.log('取消') } } }) - }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/3dmarker-ar/proto/arModelProto.js b/miniprogram/packageAPI/pages/ar/3dmarker-ar/proto/arModelProto.js index 62649773..081ac742 100644 --- a/miniprogram/packageAPI/pages/ar/3dmarker-ar/proto/arModelProto.js +++ b/miniprogram/packageAPI/pages/ar/3dmarker-ar/proto/arModelProto.js @@ -1,28 +1,28 @@ module.exports = { - "nested": { - "ARModelData": { - "fields": { - "meshModel": { - "type": "bytes", - "id": 1 - }, - "textureModel": { - "type": "bytes", - "id": 2 - }, - "preview": { - "type": "bytes", - "id": 3 - }, - "meshBlob": { - "type": "bytes", - "id": 4 - }, - "textureBlob": { - "type": "bytes", - "id": 5 - } + nested: { + ARModelData: { + fields: { + meshModel: { + type: 'bytes', + id: 1 + }, + textureModel: { + type: 'bytes', + id: 2 + }, + preview: { + type: 'bytes', + id: 3 + }, + meshBlob: { + type: 'bytes', + id: 4 + }, + textureBlob: { + type: 'bytes', + id: 5 } } } - } \ No newline at end of file + } +} diff --git a/miniprogram/packageAPI/pages/ar/behavior/behavior-ar.js b/miniprogram/packageAPI/pages/ar/behavior/behavior-ar.js index 6f4a89aa..c6b3453d 100644 --- a/miniprogram/packageAPI/pages/ar/behavior/behavior-ar.js +++ b/miniprogram/packageAPI/pages/ar/behavior/behavior-ar.js @@ -1,102 +1,102 @@ module.exports = Behavior({ - // 全局变量 - session: undefined, // 全局的VKsession对象 - canvas: undefined, // canvas - // XRFrame相关变量 - xrScene: undefined, // xr-frame 的场景 - xrCamera: undefined, // xr-frame 的相机 - xrFrameReady: undefined, // xr-frame初始化完毕 - // WebGL相关 - camera: undefined, // 主要相机 - // ThreeJs 相关变量 - gl: undefined, // 全局gl对象 - THREE: undefined, // THREE 对象 - // 全局 data - data: { - domWidth: 0, - domHeight: 0, - width: 0, // canvas大小 - height: 0, // canvas大小 - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.8, // canvas高度缩放值 - cameraPosition: 0, // 相机朝向,默认后置摄像头 - }, - methods: { - onReady() { - // 获取canvas - wx.createSelectorQuery() - .select('#canvas') - .node() - .exec(res => { - this.canvas = res[0].node + // 全局变量 + session: undefined, // 全局的VKsession对象 + canvas: undefined, // canvas + // XRFrame相关变量 + xrScene: undefined, // xr-frame 的场景 + xrCamera: undefined, // xr-frame 的相机 + xrFrameReady: undefined, // xr-frame初始化完毕 + // WebGL相关 + camera: undefined, // 主要相机 + // ThreeJs 相关变量 + gl: undefined, // 全局gl对象 + THREE: undefined, // THREE 对象 + // 全局 data + data: { + domWidth: 0, + domHeight: 0, + width: 0, // canvas大小 + height: 0, // canvas大小 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.8, // canvas高度缩放值 + cameraPosition: 0, // 相机朝向,默认后置摄像头 + }, + methods: { + onReady() { + // 获取canvas + wx.createSelectorQuery() + .select('#canvas') + .node() + .exec(res => { + this.canvas = res[0].node - // 运算画布大小 - this.calcCanvasSize() + // 运算画布大小 + this.calcCanvasSize() - // 页面自定义初始化 - if (this.init) this.init() - }) - }, - calcCanvasSize () { - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio; - const width = info.windowWidth * this.data.widthScale * pixelRatio; - const height = info.windowHeight * this.data.heightScale * pixelRatio; - // 存在 webgl Canvas的情况下,写入大小 - if (this.canvas) { - this.canvas.width = width; - this.canvas.height = height; - } - console.log(`canvas size: width = ${width} , height = ${height}`) - this.setData({ - width: width, - height: height, - domWidth: info.windowWidth * this.data.widthScale, - domHeight: info.windowHeight * this.data.heightScale, - }); - }, - // 前后摄像头 - switchCamera(){ - if(this.session.config){ - const config = this.session.config - let cameraPosNext; - if (this.data.cameraPosition === 0) { - cameraPosNext = 1; - } else { - cameraPosNext = 0; - } - config.cameraPosition = cameraPosNext - this.session.config = config - this.setData({ - cameraPosition: cameraPosNext - }) - } - }, - // 限帧逻辑 - initLoop() { - // 限制调用帧率,暂时去掉 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() + // 页面自定义初始化 + if (this.init) this.init() + }) + }, + calcCanvasSize() { + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const width = info.windowWidth * this.data.widthScale * pixelRatio + const height = info.windowHeight * this.data.heightScale * pixelRatio + // 存在 webgl Canvas的情况下,写入大小 + if (this.canvas) { + this.canvas.width = width + this.canvas.height = height + } + console.log(`canvas size: width = ${width} , height = ${height}`) + this.setData({ + width, + height, + domWidth: info.windowWidth * this.data.widthScale, + domHeight: info.windowHeight * this.data.heightScale, + }) + }, + // 前后摄像头 + switchCamera() { + if (this.session.config) { + const config = this.session.config + let cameraPosNext + if (this.data.cameraPosition === 0) { + cameraPosNext = 1 + } else { + cameraPosNext = 0 + } + config.cameraPosition = cameraPosNext + this.session.config = config + this.setData({ + cameraPosition: cameraPosNext + }) + } + }, + // 限帧逻辑 + initLoop() { + // 限制调用帧率,暂时去掉 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() - const session = this.session; + const session = this.session - // 逐帧渲染 - const onFrame = timestamp => { - try { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - this.loop(); - } - } catch(e) { - console.error(e); - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }, + // 逐帧渲染 + const onFrame = timestamp => { + try { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + this.loop() + } + } catch (e) { + console.error(e) + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) }, -}); \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/behavior/behavior-three-shoe.js b/miniprogram/packageAPI/pages/ar/behavior/behavior-three-shoe.js index 28234cf1..0557bf90 100644 --- a/miniprogram/packageAPI/pages/ar/behavior/behavior-three-shoe.js +++ b/miniprogram/packageAPI/pages/ar/behavior/behavior-three-shoe.js @@ -1,136 +1,146 @@ const threeBehavior = Behavior({ - methods: { - updateThreeMatrix() { - // 同步 VKCamera 矩阵信息到 Three Camera - if (VKCamera) { - // VK接管相机矩阵 - this.camera.matrixAutoUpdate = false - - // VK ViewMatrix 返回列主序 - this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - - const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR) - - // projectionMatrix[0] = projectionMatrix[0] / 2; - // projectionMatrix[5] = projectionMatrix[5] / 2; - - // VK 返回列主序 - // 设置 投影矩阵 - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } - - - // 存在model,更新矩阵 - if (this.modelWrap && this.points3d && this.shoeTransform) { - // console.log('toUpdate') - const THREE = this.THREE; - - // 顶点偏移矩阵 - const positionMat = new THREE.Matrix4(); - // 认为点 0 0 0 - positionMat.setPosition(0, 0, 0); - - // Anchor返回矩阵,实际上就是完整的 modelView matrix - const anchorMatrix = new THREE.Matrix4(); - // 目前返回的是行主序矩阵 - anchorMatrix.set( - this.shoeTransform[0], this.shoeTransform[1], this.shoeTransform[2], this.shoeTransform[3], - this.shoeTransform[4], this.shoeTransform[5], this.shoeTransform[6], this.shoeTransform[7], - this.shoeTransform[8], this.shoeTransform[9], this.shoeTransform[10], this.shoeTransform[11], - this.shoeTransform[12], this.shoeTransform[13], this.shoeTransform[14], this.shoeTransform[15], - ); - // 两者叠加 - // const modelWorld = positionMat.multiply(anchorMatrix); - - const modelWorld = anchorMatrix; - - const pos = new THREE.Vector3(); - const quaternion = new THREE.Quaternion(); - const scale = new THREE.Vector3(); - - // 解析出 实际的 信息 - modelWorld.decompose(pos, quaternion, scale ); - console.log(pos, quaternion, scale); - - // 设置到容器节点上 - this.modelWrap.position.set(pos.x, pos.y, pos.z); - this.modelWrap.quaternion.set(quaternion.x, quaternion.y, quaternion.z, quaternion.w); - this.modelWrap.scale.set(scale.x, scale.y, scale.z); - - if (this.model) { - // 先把模型放置在脚踝 - // this.model.position.set(this.points3d[0].x, this.points3d[0].y, this.points3d[0].z); - } - - if (this.hintBoxList && this.hintBoxList.length > 0) { - // console.log('ready to set', this.hintBoxList); - // 存在提示列表,则更新点信息 - for (let i = 0; i < this.hintBoxList.length; i++) { - const hintBox = this.hintBoxList[i]; - hintBox.position.set(this.points3d[i].x, this.points3d[i].y, this.points3d[i].z); - } - // console.log('seted', this.hintBoxList); - } - - - // debug 用信息 - if (!loggerOnce) { - // console.log('positionMat', positionMat); - // console.log('anchorMat', anchorMat); - // console.log('modelWorld', modelWorld); - - // console.log('projectionMatrix', this.camera.projectionMatrix); - - // console.log('this.modelWrap.position', this.modelWrap.position); - // console.log('this.modelWrap.quaternion', this.modelWrap.quaternion); - // console.log('this.modelWrap.scale', this.modelWrap.scale); - - // console.log('domSize', this.data.domWidth, this.data.domHeight) - // VK 直接数值 - console.log('joints', Array.from(this.points3d)) - console.log('viewMatrix', Array.from(VKCamera.viewMatrix)) - console.log('projectionMatrix', Array.from(VKCamera.getProjectionMatrix(NEAR, FAR))) - console.log('anchorTransform', Array.from(this.shoeTransform)); - - loggerOnce = true; - } - } - - // 渲染 Three 场景 - this.renderer.autoClearColor = false - this.renderer.state.setCullFace(this.THREE.CullFaceBack) - this.renderer.render(this.scene, this.camera); - // 为什么去掉这句话会画不出来,我感觉大概率是YUV的面朝向错了 - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, - addShoeHintBox() { - const THREE = this.THREE; - - const wrap = this.modelWrap; - - const geometry = new THREE.BoxGeometry( 1, 1, 1 ); - const boxScale = 0.3; - - const hintBoxList = []; - for (let i = 0; i < 8; i++) { - const colorHex = (i * 2).toString(16); - const material = new THREE.MeshPhysicalMaterial( { - metalness: 0.0, - roughness: 0.5, - color: parseInt(`${colorHex}${colorHex}${colorHex}${colorHex}${colorHex}${colorHex}`, 16), - }); - const mesh = new THREE.Mesh( geometry, material ); - mesh.position.set(0, 0, 0); - mesh.scale.set(boxScale, boxScale, boxScale); - wrap.add( mesh ); - hintBoxList.push(mesh); - } - - this.hintBoxList = hintBoxList; - }, + methods: { + updateThreeMatrix() { + // 同步 VKCamera 矩阵信息到 Three Camera + if (VKCamera) { + // VK接管相机矩阵 + this.camera.matrixAutoUpdate = false + + // VK ViewMatrix 返回列主序 + this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + + const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR) + + // projectionMatrix[0] = projectionMatrix[0] / 2; + // projectionMatrix[5] = projectionMatrix[5] / 2; + + // VK 返回列主序 + // 设置 投影矩阵 + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } + + // 存在model,更新矩阵 + if (this.modelWrap && this.points3d && this.shoeTransform) { + // console.log('toUpdate') + const THREE = this.THREE + + // 顶点偏移矩阵 + const positionMat = new THREE.Matrix4() + // 认为点 0 0 0 + positionMat.setPosition(0, 0, 0) + + // Anchor返回矩阵,实际上就是完整的 modelView matrix + const anchorMatrix = new THREE.Matrix4() + // 目前返回的是行主序矩阵 + anchorMatrix.set( + this.shoeTransform[0], + this.shoeTransform[1], + this.shoeTransform[2], + this.shoeTransform[3], + this.shoeTransform[4], + this.shoeTransform[5], + this.shoeTransform[6], + this.shoeTransform[7], + this.shoeTransform[8], + this.shoeTransform[9], + this.shoeTransform[10], + this.shoeTransform[11], + this.shoeTransform[12], + this.shoeTransform[13], + this.shoeTransform[14], + this.shoeTransform[15], + ) + // 两者叠加 + // const modelWorld = positionMat.multiply(anchorMatrix); + + const modelWorld = anchorMatrix + + const pos = new THREE.Vector3() + const quaternion = new THREE.Quaternion() + const scale = new THREE.Vector3() + + // 解析出 实际的 信息 + modelWorld.decompose(pos, quaternion, scale) + console.log(pos, quaternion, scale) + + // 设置到容器节点上 + this.modelWrap.position.set(pos.x, pos.y, pos.z) + this.modelWrap.quaternion.set(quaternion.x, quaternion.y, quaternion.z, quaternion.w) + this.modelWrap.scale.set(scale.x, scale.y, scale.z) + + if (this.model) { + // 先把模型放置在脚踝 + // this.model.position.set(this.points3d[0].x, this.points3d[0].y, this.points3d[0].z); + } + + if (this.hintBoxList && this.hintBoxList.length > 0) { + // console.log('ready to set', this.hintBoxList); + // 存在提示列表,则更新点信息 + for (let i = 0; i < this.hintBoxList.length; i++) { + const hintBox = this.hintBoxList[i] + hintBox.position.set(this.points3d[i].x, this.points3d[i].y, this.points3d[i].z) + } + // console.log('seted', this.hintBoxList); + } + + // debug 用信息 + if (!loggerOnce) { + // console.log('positionMat', positionMat); + // console.log('anchorMat', anchorMat); + // console.log('modelWorld', modelWorld); + + // console.log('projectionMatrix', this.camera.projectionMatrix); + + // console.log('this.modelWrap.position', this.modelWrap.position); + // console.log('this.modelWrap.quaternion', this.modelWrap.quaternion); + // console.log('this.modelWrap.scale', this.modelWrap.scale); + + // console.log('domSize', this.data.domWidth, this.data.domHeight) + // VK 直接数值 + console.log('joints', Array.from(this.points3d)) + console.log('viewMatrix', Array.from(VKCamera.viewMatrix)) + console.log('projectionMatrix', Array.from(VKCamera.getProjectionMatrix(NEAR, FAR))) + console.log('anchorTransform', Array.from(this.shoeTransform)) + + loggerOnce = true + } + } + + // 渲染 Three 场景 + this.renderer.autoClearColor = false + this.renderer.state.setCullFace(this.THREE.CullFaceBack) + this.renderer.render(this.scene, this.camera) + // 为什么去掉这句话会画不出来,我感觉大概率是YUV的面朝向错了 + this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, + addShoeHintBox() { + const THREE = this.THREE + + const wrap = this.modelWrap + + const geometry = new THREE.BoxGeometry(1, 1, 1) + const boxScale = 0.3 + + const hintBoxList = [] + for (let i = 0; i < 8; i++) { + const colorHex = (i * 2).toString(16) + const material = new THREE.MeshPhysicalMaterial({ + metalness: 0.0, + roughness: 0.5, + color: parseInt(`${colorHex}${colorHex}${colorHex}${colorHex}${colorHex}${colorHex}`, 16), + }) + const mesh = new THREE.Mesh(geometry, material) + mesh.position.set(0, 0, 0) + mesh.scale.set(boxScale, boxScale, boxScale) + wrap.add(mesh) + hintBoxList.push(mesh) + } + + this.hintBoxList = hintBoxList + }, + }, }) -export default threeBehavior; \ No newline at end of file +export default threeBehavior diff --git a/miniprogram/packageAPI/pages/ar/behavior/behavior-three.js b/miniprogram/packageAPI/pages/ar/behavior/behavior-three.js index c09697b4..8d8482b9 100644 --- a/miniprogram/packageAPI/pages/ar/behavior/behavior-three.js +++ b/miniprogram/packageAPI/pages/ar/behavior/behavior-three.js @@ -2,47 +2,47 @@ import { createScopedThreejs } from 'threejs-miniprogram' import { registerGLTFLoader } from '../loaders/gltf-loader' const threeBehavior = Behavior({ - methods: { - // 针对 threejs 的初始化逻辑 - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // glTF loader - this.loader = new this.THREE.GLTFLoader() - - // 相机 - this.camera = new THREE.PerspectiveCamera(50, 0.7, 0.1, 1000); - - // 场景 - const scene = this.scene = new THREE.Scene() - const sceneCull = this.sceneCull = new THREE.Scene() - - // 光源 - const ambientLight = new THREE.AmbientLight( 0x555555 ); // 氛围光 - scene.add( ambientLight ); - const dirLight = new THREE.DirectionalLight(0xffffff, 1) // 平行光 - dirLight.position.set(1, 1, 1); - scene.add(dirLight) - - const ambientLightCull = new THREE.AmbientLight( 0x555555 ); // 氛围光 - sceneCull.add( ambientLightCull ); - const dirLightCull = new THREE.DirectionalLight(0xffffff, 1) // 平行光 - dirLightCull.position.set(1, 1, 1); - sceneCull.add(dirLightCull) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - initYUVShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + // 针对 threejs 的初始化逻辑 + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // glTF loader + this.loader = new this.THREE.GLTFLoader() + + // 相机 + this.camera = new THREE.PerspectiveCamera(50, 0.7, 0.1, 1000) + + // 场景 + const scene = this.scene = new THREE.Scene() + const sceneCull = this.sceneCull = new THREE.Scene() + + // 光源 + const ambientLight = new THREE.AmbientLight(0x555555) // 氛围光 + scene.add(ambientLight) + const dirLight = new THREE.DirectionalLight(0xffffff, 1) // 平行光 + dirLight.position.set(1, 1, 1) + scene.add(dirLight) + + const ambientLightCull = new THREE.AmbientLight(0x555555) // 氛围光 + sceneCull.add(ambientLightCull) + const dirLightCull = new THREE.DirectionalLight(0xffffff, 1) // 平行光 + dirLightCull.position.set(1, 1, 1) + sceneCull.add(dirLightCull) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + initYUVShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -53,7 +53,7 @@ const threeBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -76,109 +76,108 @@ const threeBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO(program) { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - return vao; - }, - initYUV() { - this.initYUVShader() - this._vao = this.initVAO(this._program); - }, - renderYUV(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, - initDepthShaderHint() { - const gl = this.gl = this.renderer.getContext() - const ext = gl.getExtension("OES_texture_float"); - if (!ext) - console.warn('OES_texture_float not support'); - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) + }, + initVAO(program) { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + return vao + }, + initYUV() { + this.initYUVShader() + this._vao = this.initVAO(this._program) + }, + renderYUV(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + initDepthShaderHint() { + const gl = this.gl = this.renderer.getContext() + const ext = gl.getExtension('OES_texture_float') + if (!ext) console.warn('OES_texture_float not support') + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` precision highp float; attribute vec2 a_position; attribute vec2 a_texCoord; @@ -190,7 +189,7 @@ const threeBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D depth_texture; varying vec2 v_texCoord; @@ -199,64 +198,64 @@ const threeBehavior = Behavior({ gl_FragColor = vec4(depth_color.rgb, 1.0); } ` - - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._depthProgram = gl.createProgram() - this._depthProgram.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformTexture = gl.getUniformLocation(program, 'depth_texture') - gl.uniform1i(uniformTexture, 5) - - this._depthDt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initDepthVAOHint() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._depthProgram, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.3, 0.3, 1, 0.3, 0.3, 1, 1, 1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._depthProgram, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._depthVao = vao - }, - initDepthShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - - const dvs = `#version 300 es + + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._depthProgram = gl.createProgram() + this._depthProgram.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformTexture = gl.getUniformLocation(program, 'depth_texture') + gl.uniform1i(uniformTexture, 5) + + this._depthDt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) + }, + initDepthVAOHint() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._depthProgram, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0.3, 0.3, 1, 0.3, 0.3, 1, 1, 1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._depthProgram, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([0, 0, 1, 0, 0, 1, 1, 1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._depthVao = vao + }, + initDepthShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + + const dvs = `#version 300 es precision highp float; in vec2 a_position; in vec2 a_texCoord; @@ -271,8 +270,8 @@ const threeBehavior = Behavior({ gl_Position = vec4(p.x, p.y, p.z, 1); } ` - - const dfs = `#version 300 es + + const dfs = `#version 300 es precision highp float; uniform sampler2D depth_texture; out vec4 FragColor; @@ -284,179 +283,176 @@ const threeBehavior = Behavior({ // FragColor = vec4(depth_color.rgb, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, dvs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, dfs) - gl.compileShader(fragShader) - - const program = this._depthOutputProgram = gl.createProgram() - this._depthOutputProgram.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformDepthTexture = gl.getUniformLocation(this._depthOutputProgram, 'depth_texture') - gl.uniform1i(uniformDepthTexture, 5) - gl.getUniformLocation(this._depthOutputProgram, 'displayTransform') - - gl.useProgram(currentProgram) - }, - initDepthGL(){ - // 初始化提示 - this.initDepthShaderHint() - this.initDepthVAOHint() - // 初始化深度纹理相关 - this.initDepthShader(); - this._vaoDepth = this.initVAO(this._depthOutputProgram); - }, - renderDepthGLHint(frame) { - const gl = this.renderer.getContext(); - const displayTransform = frame.getDisplayTransform() - - // DepthBuffer - const depthBufferRes = frame.getDepthBuffer(); - const depthBuffer = new Float32Array(depthBufferRes.DepthAddress); - - // console.log('depthBuffer', depthBuffer[0], depthBuffer[16], depthBuffer[16 * 16], depthBuffer[56 * 56]); - - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - - const width = depthBufferRes.width; - const height = depthBufferRes.height; - - // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 - const data = new Uint8Array(width * height * 4); - for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i] = num; - } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._depthProgram) - this.ext.bindVertexArrayOES(this._depthVao) - - gl.uniformMatrix3fv(this._depthDt, false, displayTransform) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, texture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - }, - renderDepthGL(frame) { - const gl = this.renderer.getContext() - const displayTransform = frame.getDisplayTransform() - - // DepthBuffer - const depthBufferRes = frame.getDepthBuffer(); - const depthBuffer = new Float32Array(depthBufferRes.DepthAddress); - - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - - const width = depthBufferRes.width; - const height = depthBufferRes.height; - - // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 - const data = new Uint8Array(width * height * 4); - for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i] = num; - } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - - // console.log('gl depth texture end') - - // 绘制左下角提示 - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const bindingTexture = gl.getParameter(gl.TEXTURE_BINDING_2D) - - gl.useProgram(this._depthProgram) - this.ext.bindVertexArrayOES(this._depthVao) - - gl.uniformMatrix3fv(this._depthDt, false, displayTransform) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, texture) + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, dvs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, dfs) + gl.compileShader(fragShader) + + const program = this._depthOutputProgram = gl.createProgram() + this._depthOutputProgram.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformDepthTexture = gl.getUniformLocation(this._depthOutputProgram, 'depth_texture') + gl.uniform1i(uniformDepthTexture, 5) + gl.getUniformLocation(this._depthOutputProgram, 'displayTransform') + + gl.useProgram(currentProgram) + }, + initDepthGL() { + // 初始化提示 + this.initDepthShaderHint() + this.initDepthVAOHint() + // 初始化深度纹理相关 + this.initDepthShader() + this._vaoDepth = this.initVAO(this._depthOutputProgram) + }, + renderDepthGLHint(frame) { + const gl = this.renderer.getContext() + const displayTransform = frame.getDisplayTransform() + + // DepthBuffer + const depthBufferRes = frame.getDepthBuffer() + const depthBuffer = new Float32Array(depthBufferRes.DepthAddress) + + // console.log('depthBuffer', depthBuffer[0], depthBuffer[16], depthBuffer[16 * 16], depthBuffer[56 * 56]); + + const texture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + + const width = depthBufferRes.width + const height = depthBufferRes.height + + // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 + const data = new Uint8Array(width * height * 4) + for (let i = 0; i < depthBuffer.length; i++) { + const num = parseInt(depthBuffer[i] * 255) + data[i] = num + } + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) + + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._depthProgram) + this.ext.bindVertexArrayOES(this._depthVao) + + gl.uniformMatrix3fv(this._depthDt, false, displayTransform) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, texture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + }, + renderDepthGL(frame) { + const gl = this.renderer.getContext() + const displayTransform = frame.getDisplayTransform() + + // DepthBuffer + const depthBufferRes = frame.getDepthBuffer() + const depthBuffer = new Float32Array(depthBufferRes.DepthAddress) + + const texture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + + const width = depthBufferRes.width + const height = depthBufferRes.height + + // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 + const data = new Uint8Array(width * height * 4) + for (let i = 0; i < depthBuffer.length; i++) { + const num = parseInt(depthBuffer[i] * 255) + data[i] = num + } + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) + + // console.log('gl depth texture end') + + // 绘制左下角提示 + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const bindingTexture = gl.getParameter(gl.TEXTURE_BINDING_2D) + + gl.useProgram(this._depthProgram) + this.ext.bindVertexArrayOES(this._depthVao) - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + gl.uniformMatrix3fv(this._depthDt, false, displayTransform) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, texture) - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - // console.log('gl hint end') + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - // 写入深度遮挡纹理到深度值 + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) - gl.enable(gl.DEPTH_TEST) - gl.depthMask(true) - gl.depthFunc(gl.ALWAYS) - - this.ext.bindVertexArrayOES(this._vaoDepth) - gl.useProgram(this._depthOutputProgram) + // console.log('gl hint end') - gl.uniformMatrix3fv(this._depthDt, false, displayTransform) + // 写入深度遮挡纹理到深度值 - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5Depth = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.enable(gl.DEPTH_TEST) + gl.depthMask(true) + gl.depthFunc(gl.ALWAYS) - gl.bindTexture(gl.TEXTURE_2D, texture) + this.ext.bindVertexArrayOES(this._vaoDepth) + gl.useProgram(this._depthOutputProgram) - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + gl.uniformMatrix3fv(this._depthDt, false, displayTransform) - gl.activeTexture(gl.TEXTURE0 + 5) + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5Depth = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5Depth) + gl.bindTexture(gl.TEXTURE_2D, texture) - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - this.ext.bindVertexArrayOES(currentVAO) + gl.activeTexture(gl.TEXTURE0 + 5) - gl.depthMask(false) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5Depth) - gl.depthFunc(gl.LESS) + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture) - // console.log('gl depth draw end') + this.ext.bindVertexArrayOES(currentVAO) + gl.depthMask(false) + gl.depthFunc(gl.LESS) - }, + // console.log('gl depth draw end') }, + }, }) -export default threeBehavior; \ No newline at end of file +export default threeBehavior diff --git a/miniprogram/packageAPI/pages/ar/behavior/behavior-xrframe.js b/miniprogram/packageAPI/pages/ar/behavior/behavior-xrframe.js index ac9457b6..f9b88e6f 100644 --- a/miniprogram/packageAPI/pages/ar/behavior/behavior-xrframe.js +++ b/miniprogram/packageAPI/pages/ar/behavior/behavior-xrframe.js @@ -1,67 +1,67 @@ const xrFrameBehavior = Behavior({ - yuvMat: undefined, // yuv纹理 - yuvMatInit: undefined, // yuv纹理是否已经初始化 - DT: undefined, // 缓存displayMatrix - methods: { - // xrScene Ready 事件回调 - handleXRSceneReady(detail) { - console.log('handleXRSceneReady', detail); - const xrFrameSystem = wx.getXrFrameSystem(); - - this.xrCamera = detail.detail.camera; - this.xrCameraTrs = this.xrCamera.el.getComponent(xrFrameSystem.Transform); - this.xrScene = detail.detail.scene; - this.xrFrameReady = true; - if (this.initXRFrame) { - this.initXRFrame(); - } - }, - // 绑定自定义 YUV effect - registerYUVEffect() { - const xrFrameSystem = wx.getXrFrameSystem(); - xrFrameSystem.registerEffect('ar-yuv-self', scene => scene.createEffect({ -properties: [ -{ - "key": 'u_displayMatrix', - "type": 6, - "default": [ - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 - ] -} -], -images: [ - { - key: 'u_yTexture', - default: 'black', - macro: 'WX_AR_CAMERA_READY' - }, - { - key: 'u_uvTexture', - default: 'white' - }, - { - key: 'u_depthTexture', - default: 'white', - macro: 'WX_AR_CAMERA_DEPTH' - } -], - defaultRenderQueue: 2000, - passes: [{ - renderStates: { - cullOn: false, - blendOn: false, - depthWrite: false + yuvMat: undefined, // yuv纹理 + yuvMatInit: undefined, // yuv纹理是否已经初始化 + DT: undefined, // 缓存displayMatrix + methods: { + // xrScene Ready 事件回调 + handleXRSceneReady(detail) { + console.log('handleXRSceneReady', detail) + const xrFrameSystem = wx.getXrFrameSystem() + + this.xrCamera = detail.detail.camera + this.xrCameraTrs = this.xrCamera.el.getComponent(xrFrameSystem.Transform) + this.xrScene = detail.detail.scene + this.xrFrameReady = true + if (this.initXRFrame) { + this.initXRFrame() + } }, - lightMode: 'ForwardBase', - useMaterialRenderStates: true, - shaders: [0, 1] - }], - shaders: + // 绑定自定义 YUV effect + registerYUVEffect() { + const xrFrameSystem = wx.getXrFrameSystem() + xrFrameSystem.registerEffect('ar-yuv-self', scene => scene.createEffect({ + properties: [ + { + key: 'u_displayMatrix', + type: 6, + default: [ + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1 + ] + } + ], + images: [ + { + key: 'u_yTexture', + default: 'black', + macro: 'WX_AR_CAMERA_READY' + }, + { + key: 'u_uvTexture', + default: 'white' + }, + { + key: 'u_depthTexture', + default: 'white', + macro: 'WX_AR_CAMERA_DEPTH' + } + ], + defaultRenderQueue: 2000, + passes: [{ + renderStates: { + cullOn: false, + blendOn: false, + depthWrite: false + }, + lightMode: 'ForwardBase', + useMaterialRenderStates: true, + shaders: [0, 1] + }], + shaders: [ -`#version 100 + `#version 100 attribute vec3 a_position; attribute vec2 a_texCoord; @@ -85,7 +85,7 @@ void main() { gl_Position = pos; } `, -`#version 100 + `#version 100 precision mediump float; precision highp int; @@ -122,107 +122,108 @@ void main() } ` ] - })) - }, - // 初始化 xr-frame 相机 YUV 数据绘制流程节点 - initXRYUVCamera() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {assets, rootShadow} = scene; - - const el = scene.createElement(xrFrameSystem.XRNode, { - layer: 1 - }); - - let yuvGeometry = assets.getAsset('geometry', `ar-camera-plane`); - let yuvEffect = assets.getAsset('effect', 'ar-yuv-self'); - - if (!yuvEffect) { - this.registerYUVEffect(); - yuvEffect = assets.getAsset('effect', 'ar-yuv-self'); - } - - const yuvMat = scene.createMaterial(yuvEffect); - yuvMat.renderQueue = 1; // 第一个绘制 - const mesh = el.addComponent(xrFrameSystem.Mesh, { - geometry: yuvGeometry, - material: yuvMat - }); - - // 相机yuv纹理 - this.yuvMat = yuvMat; - this.yuvMatInit = false; - - // 不进入正常的剔除 - rootShadow.addChild(el); - - console.log('initXRYUVCamera end') - }, - updataXRYUV(frame) { - // console.log('update yuv') - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const yuv = frame.getCameraRawTextureData(); - // 未创建相机贴图缓存,先创建 - if (!this.cameraTexures) { - this.cameraTexures = { - y: scene.createTexture({ - width: yuv.width, height: yuv.height, - source: [yuv.yAddress], - pixelFormat: xrFrameSystem.ETextureFormat.R8 - }), - uv: scene.createTexture({ - width: yuv.width / 2, height: yuv.height / 2, - source: [yuv.uvAddress], - pixelFormat: xrFrameSystem.ETextureFormat.RGBA4 - }) - } - } - const {y, uv, depth} = this.cameraTexures; - - const cameraYUVMat = this.yuvMat; - // 未绑定贴图的情况下,绑定贴图 - if (!this.yuvMatInit) { - cameraYUVMat.setTexture('u_yTexture', y); - cameraYUVMat.setTexture('u_uvTexture', uv); - // depth && cameraYUVMat.setTexture('u_depthTexture', depth); - this.yuvMatInit = true; - } - - // 更新displayMat - const dt = frame.getDisplayTransform(); - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - this.DT.setArray([ - dt[0], dt[1], dt[2], 0, - dt[3], dt[4], dt[5], 0, - dt[6], dt[7], dt[8], 0, - 0, 0, 0, 1 - ]); - cameraYUVMat.setMatrix('u_displayMatrix', this.DT); - - // YUV纹理更新 - y.update({buffer: yuv.yAddress}); - uv.update({buffer: yuv.uvAddress}); - - // console.log('update yuv end') - }, - updataXRCameraMatrix(VKCamera, near, far) { - // 同步 VKCamera 矩阵信息到 xrFrame Camera - if (VKCamera) { - const viewMat = VKCamera.viewMatrix; - const projMat = VKCamera.getProjectionMatrix(near, far); - - // 更新 viewMatrix - this.xrCamera.changeViewMatrix(true, viewMat); - - // 更新 projectMatrix - const halfFov = Math.atan(1 / projMat[5]) * 180 / Math.PI; - this.xrCamera.setData({ near: near, far: far, fov: 2 * halfFov }); - this.xrCamera.changeProjectMatrix(true, projMat); - - } - }, + })) + }, + // 初始化 xr-frame 相机 YUV 数据绘制流程节点 + initXRYUVCamera() { + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { assets, rootShadow } = scene + + const el = scene.createElement(xrFrameSystem.XRNode, { + layer: 1 + }) + + const yuvGeometry = assets.getAsset('geometry', 'ar-camera-plane') + let yuvEffect = assets.getAsset('effect', 'ar-yuv-self') + + if (!yuvEffect) { + this.registerYUVEffect() + yuvEffect = assets.getAsset('effect', 'ar-yuv-self') + } + + const yuvMat = scene.createMaterial(yuvEffect) + yuvMat.renderQueue = 1 // 第一个绘制 + const mesh = el.addComponent(xrFrameSystem.Mesh, { + geometry: yuvGeometry, + material: yuvMat + }) + + // 相机yuv纹理 + this.yuvMat = yuvMat + this.yuvMatInit = false + + // 不进入正常的剔除 + rootShadow.addChild(el) + + console.log('initXRYUVCamera end') + }, + updataXRYUV(frame) { + // console.log('update yuv') + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const yuv = frame.getCameraRawTextureData() + // 未创建相机贴图缓存,先创建 + if (!this.cameraTexures) { + this.cameraTexures = { + y: scene.createTexture({ + width: yuv.width, + height: yuv.height, + source: [yuv.yAddress], + pixelFormat: xrFrameSystem.ETextureFormat.R8 + }), + uv: scene.createTexture({ + width: yuv.width / 2, + height: yuv.height / 2, + source: [yuv.uvAddress], + pixelFormat: xrFrameSystem.ETextureFormat.RGBA4 + }) + } + } + const { y, uv, depth } = this.cameraTexures + + const cameraYUVMat = this.yuvMat + // 未绑定贴图的情况下,绑定贴图 + if (!this.yuvMatInit) { + cameraYUVMat.setTexture('u_yTexture', y) + cameraYUVMat.setTexture('u_uvTexture', uv) + // depth && cameraYUVMat.setTexture('u_depthTexture', depth); + this.yuvMatInit = true + } + + // 更新displayMat + const dt = frame.getDisplayTransform() + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + this.DT.setArray([ + dt[0], dt[1], dt[2], 0, + dt[3], dt[4], dt[5], 0, + dt[6], dt[7], dt[8], 0, + 0, 0, 0, 1 + ]) + cameraYUVMat.setMatrix('u_displayMatrix', this.DT) + + // YUV纹理更新 + y.update({ buffer: yuv.yAddress }) + uv.update({ buffer: yuv.uvAddress }) + + // console.log('update yuv end') + }, + updataXRCameraMatrix(VKCamera, near, far) { + // 同步 VKCamera 矩阵信息到 xrFrame Camera + if (VKCamera) { + const viewMat = VKCamera.viewMatrix + const projMat = VKCamera.getProjectionMatrix(near, far) + + // 更新 viewMatrix + this.xrCamera.changeViewMatrix(true, viewMat) + + // 更新 projectMatrix + const halfFov = Math.atan(1 / projMat[5]) * 180 / Math.PI + this.xrCamera.setData({ near, far, fov: 2 * halfFov }) + this.xrCamera.changeProjectMatrix(true, projMat) + } }, + }, }) -export default xrFrameBehavior; \ No newline at end of file +export default xrFrameBehavior diff --git a/miniprogram/packageAPI/pages/ar/body-detect-3d/body-detect-3d.js b/miniprogram/packageAPI/pages/ar/body-detect-3d/body-detect-3d.js index 782c2ba5..964f1c32 100644 --- a/miniprogram/packageAPI/pages/ar/body-detect-3d/body-detect-3d.js +++ b/miniprogram/packageAPI/pages/ar/body-detect-3d/body-detect-3d.js @@ -5,40 +5,40 @@ import xrFrameBehavior from '../behavior/behavior-xrframe' const NEAR = 0.01 const FAR = 1000 -let loggerOnce = false; +const loggerOnce = false Component({ behaviors: [arBehavior, xrFrameBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.85, // canvas高度缩放值 - hintBoxList: [], // 显示提示盒子列表 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.85, // canvas高度缩放值 + hintBoxList: [], // 显示提示盒子列表 }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + } + }, }, methods: { @@ -46,7 +46,7 @@ Component({ init() { // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 @@ -58,7 +58,7 @@ Component({ }, version: 'v1', gl: this.gl - }); + }) try { session.start(err => { @@ -68,22 +68,22 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // 开启躯体三维识别 - session.update3DMode({open3d: true}) + session.update3DMode({ open3d: true }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { - console.log("addAnchor", anchors) + console.log('addAnchor', anchors) }) // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // console.log("updateAnchors", anchors); - const anchor = anchors[0]; + const anchor = anchors[0] // 目前只处理一个返回的躯体 if (anchor) { // console.log('id', anchor.id); @@ -94,58 +94,51 @@ Component({ // console.log('size', anchor.size); // console.log('detectId', anchor.detectId); // console.log('confidence', anchor.confidence); - // console.log('points3d', anchor.points3d); + // console.log('points3d', anchor.points3d); - this.bodyTransform = anchor.transform; - this.bodyPosition3D = anchor.points3d; - - this.updateHintBoxVisble(this.hintBoxList, true); + this.bodyTransform = anchor.transform + this.bodyPosition3D = anchor.points3d + this.updateHintBoxVisble(this.hintBoxList, true) } }) - + // VKSession removeAnchors // 识别目标丢失时不断触发 session.on('removeAnchors', anchors => { // console.log("removeAnchors"); - this.updateHintBoxVisble(this.hintBoxList, false); - - }); - + this.updateHintBoxVisble(this.hintBoxList, false) + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - - } catch(e) { - console.error(e); + this.initLoop() + }) + } catch (e) { + console.error(e) } - }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene // 缓存主相机 this.xrCameraMain = this.xrCamera - this.xrCameraMainTrs = this.xrCameraTrs; - + this.xrCameraMainTrs = this.xrCameraTrs + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // === 初始躯体挂载点 === - this.bodyWrap = scene.createElement(xrFrameSystem.XRNode); - this.bodyWrapTrs = this.bodyWrap.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( this.bodyWrap ); + this.bodyWrap = scene.createElement(xrFrameSystem.XRNode) + this.bodyWrapTrs = this.bodyWrap.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(this.bodyWrap) // 加载提示点 - this.hintBoxList = this.getHintBox(xrFrameSystem, scene, this.bodyWrap); - - + this.hintBoxList = this.getHintBox(xrFrameSystem, scene, this.bodyWrap) }, loop() { // console.log('loop') @@ -154,75 +147,74 @@ Component({ const frame = this.session.getVKFrame(this.data.width, this.data.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) // 存在bodyWrao,执行信息同步逻辑 if (this.bodyWrap && this.bodyTransform) { - const xrFrameSystem = wx.getXrFrameSystem(); - - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + const xrFrameSystem = wx.getXrFrameSystem() + + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(this.bodyTransform); - this.DT.transpose(this.DT2); - this.bodyWrapTrs.setLocalMatrix(this.DT2); + this.DT.setArray(this.bodyTransform) + this.DT.transpose(this.DT2) + this.bodyWrapTrs.setLocalMatrix(this.DT2) // 更新提示点位置 - this.updateHintBoxPosition(this.hintBoxList, this.bodyPosition3D); - + this.updateHintBoxPosition(this.hintBoxList, this.bodyPosition3D) } }, getHintBox(xrFrameSystem, scene, wrap) { // 初始化提示点 - const geometryHint = scene.assets.getAsset('geometry', 'sphere'); - const effectCube = scene.assets.getAsset('effect', 'standard'); - const boxScale = 0.03; - const hintBoxList = []; + const geometryHint = scene.assets.getAsset('geometry', 'sphere') + const effectCube = scene.assets.getAsset('effect', 'standard') + const boxScale = 0.03 + const hintBoxList = [] for (let i = 0; i < 24; i++) { - const colorFloat = i / 24; + const colorFloat = i / 24 const el = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", + position: '0 0 0', scale: `${boxScale} ${boxScale} ${boxScale}`, - }); - const elTrs = el.getComponent(xrFrameSystem.Transform); - const mat = scene.createMaterial(effectCube); - - const colorR = 1.0 - colorFloat; - mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)); + }) + const elTrs = el.getComponent(xrFrameSystem.Transform) + const mat = scene.createMaterial(effectCube) + + const colorR = 1.0 - colorFloat + mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)) const mesh = el.addComponent(xrFrameSystem.Mesh, { geometry: geometryHint, material: mat, - }); + }) - wrap.addChild( el ); + wrap.addChild(el) // elTrs.visible = false; - - hintBoxList.push( elTrs ); + + hintBoxList.push(elTrs) } - return hintBoxList; + return hintBoxList }, updateHintBoxPosition(hintBoxList, points3d) { if (hintBoxList && hintBoxList.length > 0) { // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; - hintBox.position.x = points3d[i].x; - hintBox.position.y = points3d[i].y; - hintBox.position.z = points3d[i].z; + const hintBox = hintBoxList[i] + hintBox.position.x = points3d[i].x + hintBox.position.y = points3d[i].y + hintBox.position.z = points3d[i].z } } }, @@ -231,12 +223,12 @@ Component({ // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; + const hintBox = hintBoxList[i] if (hintBox.visible !== visible) { - hintBox.visible = visible; + hintBox.visible = visible } } } } }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/body-detect/behavior.js b/miniprogram/packageAPI/pages/ar/body-detect/behavior.js index e1d09e9e..edcb2695 100644 --- a/miniprogram/packageAPI/pages/ar/body-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/body-detect/behavior.js @@ -141,26 +141,25 @@ export default function getBehavior() { size: anchor.size }))) - console.log("显示data") + console.log('显示data') console.log(this.data) }) session.on('removeAnchors', anchors => { this.data.anchor2DList = [] }) - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() // 逐帧渲染 const onFrame = timestamp => { - let now = Date.now() + const now = Date.now() const mill = now - last // 经过了足够的时间 if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 + last = now - (mill % fpsInterval) // 校正当前时间 const frame = session.getVKFrame(canvas.width, canvas.height) if (frame) { this.render(frame) @@ -199,4 +198,4 @@ export default function getBehavior() { }, }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/body-detect/body-detect.js b/miniprogram/packageAPI/pages/ar/body-detect/body-detect.js index 55cccf2a..a1671252 100644 --- a/miniprogram/packageAPI/pages/ar/body-detect/body-detect.js +++ b/miniprogram/packageAPI/pages/ar/body-detect/body-detect.js @@ -4,70 +4,69 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -//顶点着色器 -var VSHADER_SOURCE = '' + - 'attribute vec4 a_Position;\n' + //声明attribute变量a_Position,用来存放顶点位置信息 +// 顶点着色器 +const VSHADER_SOURCE = '' + + 'attribute vec4 a_Position;\n' + // 声明attribute变量a_Position,用来存放顶点位置信息 'void main(){\n' + - ' gl_Position = a_Position;\n' + //将顶点坐标赋值给顶点着色器内置变量gl_Position - ' gl_PointSize = 4.0;\n' + //设置顶点大小 + ' gl_Position = a_Position;\n' + // 将顶点坐标赋值给顶点着色器内置变量gl_Position + ' gl_PointSize = 4.0;\n' + // 设置顶点大小 '}\n' -//片元着色器 -var FSHADER_SOURCE = '' + +// 片元着色器 +const FSHADER_SOURCE = '' + '#ifdef GL_ES\n' + ' precision mediump float;\n' + // 设置精度 '#endif\n' + - 'varying vec4 v_Color;\n' + //声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 + 'varying vec4 v_Color;\n' + // 声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 'void main(){\n' + - ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + //计算像素距离中心点的距离 - ' if(d < 0.5) {\n' + //距离大于0.5放弃片元,小于0.5保留片元 + ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + // 计算像素距离中心点的距离 + ' if(d < 0.5) {\n' + // 距离大于0.5放弃片元,小于0.5保留片元 ' gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n' + ' } else { discard; }\n' + '}\n' - -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false function initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) { - //创建顶点着色器对象 - var vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) - //创建片元着色器对象 - var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) + // 创建顶点着色器对象 + const vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) + // 创建片元着色器对象 + const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) if (!vertexShader || !fragmentShader) { return null } - //创建程序对象program - var program = gl.createProgram() + // 创建程序对象program + const program = gl.createProgram() if (!gl.createProgram()) { return null } - //分配顶点着色器和片元着色器到program + // 分配顶点着色器和片元着色器到program gl.attachShader(program, vertexShader) gl.attachShader(program, fragmentShader) - //链接program + // 链接program gl.linkProgram(program) - //检查程序对象是否连接成功 - var linked = gl.getProgramParameter(program, gl.LINK_STATUS) + // 检查程序对象是否连接成功 + const linked = gl.getProgramParameter(program, gl.LINK_STATUS) if (!linked) { - var error = gl.getProgramInfoLog(program) + const error = gl.getProgramInfoLog(program) console.log('程序对象连接失败: ' + error) gl.deleteProgram(program) gl.deleteShader(fragmentShader) gl.deleteShader(vertexShader) return null } - //返回程序program对象 + // 返回程序program对象 initShadersDone = true return program } function loadShader(gl, type, source) { // 创建顶点着色器对象 - var shader = gl.createShader(type) + const shader = gl.createShader(type) if (shader == null) { console.log('创建着色器失败') return null @@ -80,9 +79,9 @@ function loadShader(gl, type, source) { gl.compileShader(shader) // 检查顶是否编译成功 - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) if (!compiled) { - var error = gl.getShaderInfoLog(shader) + const error = gl.getShaderInfoLog(shader) console.log('编译着色器失败: ' + error) gl.deleteShader(shader) return null @@ -91,9 +90,8 @@ function loadShader(gl, type, source) { return shader } -//初始化顶点坐标和顶点颜色 +// 初始化顶点坐标和顶点颜色 function initVertexBuffers(gl, anchor2DList) { - const flattenPoints = [] anchor2DList.forEach(anchor => { anchor.points.forEach(point => { @@ -105,23 +103,23 @@ function initVertexBuffers(gl, anchor2DList) { }) }) - var vertices = new Float32Array(flattenPoints) - var n = flattenPoints.length / 2 + const vertices = new Float32Array(flattenPoints) + const n = flattenPoints.length / 2 - //创建缓冲区对象 - var buffer = gl.createBuffer() - //将顶点坐标和顶点颜色信息写入缓冲区对象 + // 创建缓冲区对象 + const buffer = gl.createBuffer() + // 将顶点坐标和顶点颜色信息写入缓冲区对象 gl.bindBuffer(gl.ARRAY_BUFFER, buffer) gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW) - //获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 - var a_Position = gl.getAttribLocation(gl.program, 'a_Position') + // 获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 + const a_Position = gl.getAttribLocation(gl.program, 'a_Position') gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 0, 0) gl.enableVertexAttribArray(a_Position) return n } -var EDGE_VSHADER_SOURCE = +const EDGE_VSHADER_SOURCE = ` attribute vec2 aPosition; varying vec2 posJudge; @@ -132,7 +130,7 @@ var EDGE_VSHADER_SOURCE = } ` -var EDGE_FSHADER_SOURCE = +const EDGE_FSHADER_SOURCE = ` precision highp float; uniform vec2 rightTopPoint; @@ -162,48 +160,47 @@ var EDGE_FSHADER_SOURCE = ` function initRectEdgeBuffer(gl, x, y, width, height) { - let shaderProgram = gl.program; - let centerX = x * 2 - 1 + width; - let centerY = -1 * (y * 2 - 1) - height; - let right = width; - let top = height; - var vertices = [ + const shaderProgram = gl.program + const centerX = x * 2 - 1 + width + const centerY = -1 * (y * 2 - 1) - height + const right = width + const top = height + const vertices = [ -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0 - ]; + ] - var vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); - var aPosition = gl.getAttribLocation(shaderProgram, 'aPosition'); - gl.enableVertexAttribArray(aPosition); - gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0); + const vertexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW) + const aPosition = gl.getAttribLocation(shaderProgram, 'aPosition') + gl.enableVertexAttribArray(aPosition) + gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0) - - var rightTop = [ + const rightTop = [ right, top - ]; - var rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint'); - gl.uniform2fv(rightTopLoc, rightTop); + ] + const rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint') + gl.uniform2fv(rightTopLoc, rightTop) - var centerPoint = [ + const centerPoint = [ centerX, centerY - ]; - var centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint'); - gl.uniform2fv(centerPointLoc, centerPoint); + ] + const centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint') + gl.uniform2fv(centerPointLoc, centerPoint) - var length = vertices.length / 2; + const length = vertices.length / 2 - return length; + return length } function onDrawRectEdge(gl, x, y, width, height) { width = Math.round(width * 100) / 100 height = Math.round(height * 100) / 100 - var n = initRectEdgeBuffer(gl, x, y, width, height); - gl.drawArrays(gl.TRIANGLE_STRIP, 0, n); + const n = initRectEdgeBuffer(gl, x, y, width, height) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, n) } Component({ @@ -217,15 +214,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -243,19 +240,19 @@ Component({ init() { this.initGL() }, - switchCamera(event){ - if(this.session.config){ + switchCamera(event) { + if (this.session.config) { const config = this.session.config - let pos = Number(event.currentTarget.dataset.value) + const pos = Number(event.currentTarget.dataset.value) config.cameraPosition = pos this.session.config = config this.setData({ - cameraPosition:event.currentTarget.dataset.value + cameraPosition: event.currentTarget.dataset.value }) } }, render(frame) { - var gl = this.gl + const gl = this.gl this.renderGL(frame) @@ -279,7 +276,7 @@ Component({ const anchor2DList = this.data.anchor2DList if (!anchor2DList || anchor2DList.length <= 0) { - return + } else { if (!initShadersDone) { this.vertexProgram = initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) @@ -293,19 +290,19 @@ Component({ gl.useProgram(this.vertexProgram) gl.program = this.vertexProgram - //初始化顶点坐标和顶点颜色 - var n = initVertexBuffers(gl, anchor2DList) + // 初始化顶点坐标和顶点颜色 + const n = initVertexBuffers(gl, anchor2DList) - //绘制点 + // 绘制点 gl.drawArrays(gl.POINTS, 0, n) gl.useProgram(this.rectEdgeProgram) gl.program = this.rectEdgeProgram - for (var i = 0; i < anchor2DList.length; i++) { + for (let i = 0; i < anchor2DList.length; i++) { onDrawRectEdge(gl, anchor2DList[i].origin.x, anchor2DList[i].origin.y, anchor2DList[i].size.width, anchor2DList[i].size.height) } } }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/body-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/body-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/body-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/body-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/behavior.js b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/behavior.js index 470142f8..ca548e4d 100644 --- a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/behavior.js @@ -1,168 +1,167 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - cameraPosition: 0, - gl: this.gl, - version: 'v1' - }) - - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - this.setData({ - buttonDisable:false - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + cameraPosition: 0, + gl: this.gl, + version: 'v1' + }) + + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + this.setData({ + buttonDisable: false + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBuffer-detect.js b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBuffer-detect.js index a8991296..5820d49f 100644 --- a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBuffer-detect.js +++ b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBuffer-detect.js @@ -5,7 +5,7 @@ import cameraBufferBehavior from './cameraBufferBehavior' const NEAR = 0.001 const FAR = 1000 -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false Component({ @@ -21,15 +21,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -51,14 +51,12 @@ Component({ initShadersDone = true }, render(frame) { - if(!initShadersDone) - return; - var gl = this.gl + if (!initShadersDone) return + const gl = this.gl this.renderGL(frame) this.renderCameraBufferGL(frame) - const camera = frame.camera // 相机 @@ -77,4 +75,4 @@ Component({ this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBufferBehavior.js b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBufferBehavior.js index 712bf7a3..278c4f5d 100644 --- a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBufferBehavior.js +++ b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/cameraBufferBehavior.js @@ -2,9 +2,8 @@ const cameraBufferBehavior = Behavior({ methods: { initCameraBufferShader() { const gl = this.gl = this.renderer.getContext() - const ext = gl.getExtension("OES_texture_float"); - if (!ext) - console.warn('OES_texture_float not support'); + const ext = gl.getExtension('OES_texture_float') + if (!ext) console.warn('OES_texture_float not support') const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const vs = ` precision highp float; @@ -60,9 +59,8 @@ const cameraBufferBehavior = Behavior({ ext.bindVertexArrayOES(vao) - - const width = Math.floor(this.canvas.width / 16) * 16; - const height = this.canvas.height; + const width = Math.floor(this.canvas.width / 16) * 16 + const height = this.canvas.height const posAttr = gl.getAttribLocation(this._cameraBufferProgram, 'a_position') const pos = gl.createBuffer() @@ -94,35 +92,30 @@ const cameraBufferBehavior = Behavior({ gl.disable(gl.DEPTH_TEST) const displayTransform = frame.getDisplayTransform() - const width = Math.floor(this.canvas.width / 16) * 16; - const height = this.canvas.height; + const width = Math.floor(this.canvas.width / 16) * 16 + const height = this.canvas.height - const cameraBufferRes = frame.getCameraBuffer(width, height); + const cameraBufferRes = frame.getCameraBuffer(width, height) - const texture = gl.createTexture(); + const texture = gl.createTexture() if (cameraBufferRes) { + const cameraBuffer = new Uint8Array(cameraBufferRes) - let cameraBuffer = new Uint8Array(cameraBufferRes); - - const data = new Uint8Array(width * height * 4); - for (let i = 0; i < cameraBuffer.length; i++) { - let num = parseInt(cameraBuffer[i] * 255); - data[i] = num; - } - - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + const data = new Uint8Array(width * height * 4) + for (let i = 0; i < cameraBuffer.length; i++) { + const num = parseInt(cameraBuffer[i] * 255) + data[i] = num + } + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) } - - - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) @@ -144,9 +137,8 @@ const cameraBufferBehavior = Behavior({ gl.useProgram(currentProgram) gl.activeTexture(currentActiveTexture) this.ext.bindVertexArrayOES(currentVAO) - }, }, }) -export default cameraBufferBehavior \ No newline at end of file +export default cameraBufferBehavior diff --git a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/yuvBehavior.js index 5b63e876..147d1f65 100644 --- a/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/cameraBuffer-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/cameraBuffer-jpg/cameraBuffer-jpg.js b/miniprogram/packageAPI/pages/ar/cameraBuffer-jpg/cameraBuffer-jpg.js index 5d667532..fd192560 100644 --- a/miniprogram/packageAPI/pages/ar/cameraBuffer-jpg/cameraBuffer-jpg.js +++ b/miniprogram/packageAPI/pages/ar/cameraBuffer-jpg/cameraBuffer-jpg.js @@ -9,34 +9,34 @@ Component({ behaviors: [arBehavior, threeBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.57, // canvas高度缩放值 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.57, // canvas高度缩放值 jpgUrl: '', }, useLoopLog: false, // 是否开启循环log imgIndex: 0, lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { @@ -50,11 +50,11 @@ Component({ // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() - this.useLoopLog = false; - this.imgIndex = 0; - }, + this.useLoopLog = false + this.imgIndex = 0 + }, initVK() { // VKSession 配置 const session = this.session = wx.createVKSession({ @@ -65,7 +65,7 @@ Component({ }, version: 'v2', gl: this.gl - }); + }) session.start(err => { if (err) return console.error('VK error: ', err) @@ -74,7 +74,7 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // VKSession EVENT addAnchors @@ -83,32 +83,29 @@ Component({ // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { - + }) - + // VKSession removeAnchors // 识别目标丢失时,会触发一次 session.on('removeAnchors', anchors => { // console.log('removeAnchors', anchors) - }); - + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - + this.initLoop() + // 绘制双面,以及去掉清屏,用于显示yuv this.renderer.state.setCullFace(this.THREE.CullFaceNone) - - }); + }) }, loop() { - // 获取 VKFrame const frame = this.session.getVKFrame(this.canvas.width, this.canvas.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 this.renderYUV(frame) @@ -122,61 +119,56 @@ Component({ // transformStr += VKCamera.transform[i] + ' '; // console.log('VKCamera.transform', transformStr); - console.log('timeStamp', frame.timestamp); - + console.log('timeStamp', frame.timestamp) - let viewMatrixStr = ''; - for (let i = 0; i < 16; i++) - viewMatrixStr += VKCamera.viewMatrix[i] + ' '; + let viewMatrixStr = '' + for (let i = 0; i < 16; i++) viewMatrixStr += VKCamera.viewMatrix[i] + ' ' // console.log('VKCamera.viewMatrix', viewMatrixStr); if (this.preTimestamp && this.preTimestamp === frame.timestamp) { if (this.preViewMatrixStr && this.preViewMatrixStr !== viewMatrixStr) { console.log('preViewMatrixStr', this.preViewMatrixStr) console.log('viewMatrixStr', viewMatrixStr) - console.log('Timestamp is same. But viewMatrix is not same'); + console.log('Timestamp is same. But viewMatrix is not same') } } - this.preTimestamp = frame.timestamp; - this.preViewMatrixStr = viewMatrixStr; + this.preTimestamp = frame.timestamp + this.preViewMatrixStr = viewMatrixStr } - }, getJpgImg() { - console.log('Function getJpgImg'); + console.log('Function getJpgImg') // 按需写入获取 jpg 的 大小 和质量 - const width = 640; - const height = 480; - const quality = 90; + const width = 640 + const height = 480 + const quality = 90 // 获取 VKFrame const frame = this.session.getVKFrame(width, height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } console.log('getCameraJpgBuffer: ', width, height, quality) const t1 = new Date().getTime() - const jpgBuffer = frame.getCameraJpgBuffer(width, height, quality); + const jpgBuffer = frame.getCameraJpgBuffer(width, height, quality) const t2 = new Date().getTime() console.log(`getCameraJpgBuffer cost ${t2 - t1}ms`) // console.log('jpgBuffer', jpgBuffer); - const jpgUrl = this.saveLocalJPG(jpgBuffer, 'cameraJPG'); + const jpgUrl = this.saveLocalJPG(jpgBuffer, 'cameraJPG') console.log('jpgUrl', jpgUrl) this.setData({ - 'jpgUrl': jpgUrl + jpgUrl }) - - }, saveLocalJPG(bufferContent, name) { - var url = `${wx.env.USER_DATA_PATH}/${name + this.imgIndex + '.jpg'}` + const url = `${wx.env.USER_DATA_PATH}/${name + this.imgIndex + '.jpg'}` const fs = wx.getFileSystemManager() try { @@ -184,8 +176,8 @@ Component({ const unlinkRes = fs.unlinkSync(url) // console.log('unlinkSync', unlinkRes) - this.imgIndex++; - const newUrl = `${wx.env.USER_DATA_PATH}/${name + this.imgIndex + '.jpg'}`; + this.imgIndex++ + const newUrl = `${wx.env.USER_DATA_PATH}/${name + this.imgIndex + '.jpg'}` // console.log('write newUrl', newUrl) // 写入,新图片 @@ -196,8 +188,7 @@ Component({ ) return newUrl - - } catch(e) { + } catch (e) { // 利用catch实现,此时,为新写入 try { // console.log('write url', url) @@ -208,18 +199,18 @@ Component({ bufferContent, 'utf8' ) - }catch(e) { - console.error(e); + } catch (e) { + console.error(e) } } return url }, getLog() { - console.log('Function getLog'); + console.log('Function getLog') - this.useLoopLog = !this.useLoopLog; + this.useLoopLog = !this.useLoopLog }, - + }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/components/xr-frame-render/index.js b/miniprogram/packageAPI/pages/ar/components/xr-frame-render/index.js index eec16962..79e843e8 100644 --- a/miniprogram/packageAPI/pages/ar/components/xr-frame-render/index.js +++ b/miniprogram/packageAPI/pages/ar/components/xr-frame-render/index.js @@ -9,14 +9,14 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) - const camera = this.scene.getElementById("camera").getComponent("camera"); + const camera = this.scene.getElementById('camera').getComponent('camera') // 暴露scene对象到外部进行定制 - this.triggerEvent('sceneReady', {scene: xrScene, camera: camera}); + this.triggerEvent('sceneReady', { scene: xrScene, camera }) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/components/xr-frame/index.js b/miniprogram/packageAPI/pages/ar/components/xr-frame/index.js index 9d4f20b8..1d224043 100644 --- a/miniprogram/packageAPI/pages/ar/components/xr-frame/index.js +++ b/miniprogram/packageAPI/pages/ar/components/xr-frame/index.js @@ -9,23 +9,23 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) // 获取屏幕比例,用作后处理rt比例 const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio; + const pixelRatio = info.pixelRatio this.setData({ pixelRatioReady: true, renderTargetWidth: info.windowWidth * pixelRatio, renderTargetHeight: info.windowHeight * pixelRatio, - }); + }) - const camera = this.scene.getElementById("camera").getComponent("camera"); + const camera = this.scene.getElementById('camera').getComponent('camera') // 暴露scene对象到外部进行定制 - this.triggerEvent('sceneReady', {scene: xrScene, camera: camera}); + this.triggerEvent('sceneReady', { scene: xrScene, camera }) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/depth-detect/behavior.js b/miniprogram/packageAPI/pages/ar/depth-detect/behavior.js index 4a24a696..18600958 100644 --- a/miniprogram/packageAPI/pages/ar/depth-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/depth-detect/behavior.js @@ -1,173 +1,172 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - depth: { - mode: 1 - } - }, - cameraPosition: 0, - gl: this.gl, - version: 'v1' - }) - - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - this.setData({ - buttonDisable:false - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + depth: { + mode: 1 + } + }, + cameraPosition: 0, + gl: this.gl, + version: 'v1' + }) + + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + this.setData({ + buttonDisable: false + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/depth-detect/depth-detect.js b/miniprogram/packageAPI/pages/ar/depth-detect/depth-detect.js index d4294063..002a5cf0 100644 --- a/miniprogram/packageAPI/pages/ar/depth-detect/depth-detect.js +++ b/miniprogram/packageAPI/pages/ar/depth-detect/depth-detect.js @@ -5,7 +5,7 @@ import depthBehavior from './depthBehavior' const NEAR = 0.001 const FAR = 1000 -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false Component({ @@ -21,15 +21,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -50,9 +50,8 @@ Component({ initShadersDone = true }, render(frame) { - if(!initShadersDone) - return; - var gl = this.gl + if (!initShadersDone) return + const gl = this.gl this.renderGL(frame) this.renderDepthGL(frame) @@ -75,4 +74,4 @@ Component({ this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/depth-detect/depthBehavior.js b/miniprogram/packageAPI/pages/ar/depth-detect/depthBehavior.js index ec5c2ef3..0bde2dbb 100644 --- a/miniprogram/packageAPI/pages/ar/depth-detect/depthBehavior.js +++ b/miniprogram/packageAPI/pages/ar/depth-detect/depthBehavior.js @@ -2,9 +2,8 @@ const depthBehavior = Behavior({ methods: { initDepthShader() { const gl = this.gl = this.renderer.getContext() - const ext = gl.getExtension("OES_texture_float"); - if (!ext) - console.warn('OES_texture_float not support'); + const ext = gl.getExtension('OES_texture_float') + if (!ext) console.warn('OES_texture_float not support') const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const vs = ` precision highp float; @@ -116,34 +115,31 @@ const depthBehavior = Behavior({ // } // DepthBuffer - const depthBufferRes = frame.getDepthBuffer(); - const depthBuffer = new Float32Array(depthBufferRes.DepthAddress); + const depthBufferRes = frame.getDepthBuffer() + const depthBuffer = new Float32Array(depthBufferRes.DepthAddress) - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + const texture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - const width = depthBufferRes.width; - const height = depthBufferRes.height; + const width = depthBufferRes.width + const height = depthBufferRes.height - const ext = gl.getExtension("OES_texture_float"); + const ext = gl.getExtension('OES_texture_float') if (ext) { - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, depthBuffer); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, depthBuffer) } else { - const data = new Uint8Array(width * height * 4); + const data = new Uint8Array(width * height * 4) for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i] = num; + const num = parseInt(depthBuffer[i] * 255) + data[i] = num } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) } - - - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) @@ -165,9 +161,8 @@ const depthBehavior = Behavior({ gl.useProgram(currentProgram) gl.activeTexture(currentActiveTexture) this.ext.bindVertexArrayOES(currentVAO) - }, }, }) -export default depthBehavior \ No newline at end of file +export default depthBehavior diff --git a/miniprogram/packageAPI/pages/ar/depth-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/depth-detect/yuvBehavior.js index 5b63e876..147d1f65 100644 --- a/miniprogram/packageAPI/pages/ar/depth-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/depth-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/face-detect-3d-glasses/face-detect-3d-glasses.js b/miniprogram/packageAPI/pages/ar/face-detect-3d-glasses/face-detect-3d-glasses.js index 1246f100..48ac5ed3 100644 --- a/miniprogram/packageAPI/pages/ar/face-detect-3d-glasses/face-detect-3d-glasses.js +++ b/miniprogram/packageAPI/pages/ar/face-detect-3d-glasses/face-detect-3d-glasses.js @@ -5,41 +5,41 @@ import xrFrameBehavior from '../behavior/behavior-xrframe' const NEAR = 0.01 const FAR = 1000 -let loggerOnce = false; +const loggerOnce = false Component({ behaviors: [arBehavior, xrFrameBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.8, // canvas高度缩放值 - hintBoxList: [], // 显示提示盒子列表, + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.8, // canvas高度缩放值 + hintBoxList: [], // 显示提示盒子列表, cameraPosition: 1 // 默认前置 }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { @@ -47,7 +47,7 @@ Component({ init() { // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 @@ -60,7 +60,7 @@ Component({ cameraPosition: 1, version: 'v1', gl: this.gl - }); + }) try { session.start(err => { @@ -70,119 +70,113 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // 开启三维识别 - session.update3DMode({open3d: true}) + session.update3DMode({ open3d: true }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { - console.log("addAnchor", anchors) + console.log('addAnchor', anchors) }) // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // console.log("updateAnchors", anchors); - const anchor = anchors[0]; + const anchor = anchors[0] // 目前只处理一个返回的结果 if (anchor) { - - this.wrapTransform = anchor.transform; - this.position3D = anchor.points3d; + this.wrapTransform = anchor.transform + this.position3D = anchor.points3d if (this.faceGLTFTrs && this.faceGLTFTrs.visible !== true) { - this.faceGLTFTrs.visible = true; + this.faceGLTFTrs.visible = true } if (this.glassesGLTFTrs && this.glassesGLTFTrs.visible !== true) { - this.glassesGLTFTrs.visible = true; + this.glassesGLTFTrs.visible = true } } }) - + // VKSession removeAnchors // 识别目标丢失时不断触发 session.on('removeAnchors', anchors => { // console.log("removeAnchors"); if (this.faceGLTFTrs && this.faceGLTFTrs.visible !== false) { - this.faceGLTFTrs.visible = false; + this.faceGLTFTrs.visible = false } if (this.glassesGLTFTrs && this.glassesGLTFTrs.visible !== false) { - this.glassesGLTFTrs.visible = false; + this.glassesGLTFTrs.visible = false } - - }); - + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - - } catch(e) { - console.error(e); + this.initLoop() + }) + } catch (e) { + console.error(e) } - }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene // 缓存主相机 this.xrCameraMain = this.xrCamera - this.xrCameraMainTrs = this.xrCameraTrs; - + this.xrCameraMainTrs = this.xrCameraTrs + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // === 初始挂载点 === - this.faceWrap = scene.createElement(xrFrameSystem.XRNode); - this.faceWrapTrs = this.faceWrap.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( this.faceWrap ); + this.faceWrap = scene.createElement(xrFrameSystem.XRNode) + this.faceWrapTrs = this.faceWrap.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(this.faceWrap) // 加载脸模 const face = await scene.assets.loadAsset({ type: 'gltf', - assetId: `gltf-face`, + assetId: 'gltf-face', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/face.glb', }) const faceElem = scene.createElement(xrFrameSystem.XRGLTF, { - model: "gltf-face", - position: `0 0 0`, - scale: `1 1 1`, - }); - const faceGLTF = faceElem.getComponent(xrFrameSystem.GLTF); - this.faceElem = faceElem; - this.faceGLTFTrs = faceElem.getComponent(xrFrameSystem.Transform); - this.faceWrap.addChild(faceElem); - - for(const mesh of faceGLTF.meshes) { + model: 'gltf-face', + position: '0 0 0', + scale: '1 1 1', + }) + const faceGLTF = faceElem.getComponent(xrFrameSystem.GLTF) + this.faceElem = faceElem + this.faceGLTFTrs = faceElem.getComponent(xrFrameSystem.Transform) + this.faceWrap.addChild(faceElem) + + for (const mesh of faceGLTF.meshes) { // 通过alphaMode 的 Setter 设置,或者写入renderState,但需要手动控制宏 - mesh.material.alphaMode = "BLEND"; - mesh.material.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 1, 1, 0.0)); + mesh.material.alphaMode = 'BLEND' + mesh.material.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 1, 1, 0.0)) } // 加载眼镜 const glasses = await scene.assets.loadAsset({ type: 'gltf', - assetId: `gltf-glasses`, + assetId: 'gltf-glasses', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/glasses.glb', }) const glassesElem = scene.createElement(xrFrameSystem.XRGLTF, { - model: "gltf-glasses", - position: `0 0 0`, - scale: `1 1 1`, - }); - const glassesGLTF = glassesElem.getComponent(xrFrameSystem.GLTF); - this.glassesElem = glassesElem; - this.glassesGLTFTrs = glassesElem.getComponent(xrFrameSystem.Transform); - this.faceWrap.addChild(glassesElem); - + model: 'gltf-glasses', + position: '0 0 0', + scale: '1 1 1', + }) + const glassesGLTF = glassesElem.getComponent(xrFrameSystem.GLTF) + this.glassesElem = glassesElem + this.glassesGLTFTrs = glassesElem.getComponent(xrFrameSystem.Transform) + this.faceWrap.addChild(glassesElem) }, loop() { // console.log('loop') @@ -191,31 +185,30 @@ Component({ const frame = this.session.getVKFrame(this.data.width, this.data.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) // 存在faceWrap,执行信息同步逻辑 if (this.faceWrap && this.wrapTransform) { - const xrFrameSystem = wx.getXrFrameSystem(); - - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + const xrFrameSystem = wx.getXrFrameSystem() + + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(this.wrapTransform); - this.DT.transpose(this.DT2); - this.faceWrapTrs.setLocalMatrix(this.DT2); - + this.DT.setArray(this.wrapTransform) + this.DT.transpose(this.DT2) + this.faceWrapTrs.setLocalMatrix(this.DT2) } } }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/face-detect-3d/face-detect-3d.js b/miniprogram/packageAPI/pages/ar/face-detect-3d/face-detect-3d.js index fbfa0d47..83f3c2e4 100644 --- a/miniprogram/packageAPI/pages/ar/face-detect-3d/face-detect-3d.js +++ b/miniprogram/packageAPI/pages/ar/face-detect-3d/face-detect-3d.js @@ -5,40 +5,40 @@ import xrFrameBehavior from '../behavior/behavior-xrframe' const NEAR = 0.01 const FAR = 1000 -let loggerOnce = false; +const loggerOnce = false Component({ behaviors: [arBehavior, xrFrameBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.8, // canvas高度缩放值 - hintBoxList: [], // 显示提示盒子列表, + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.8, // canvas高度缩放值 + hintBoxList: [], // 显示提示盒子列表, }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { @@ -46,7 +46,7 @@ Component({ init() { // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 @@ -58,7 +58,7 @@ Component({ }, version: 'v1', gl: this.gl - }); + }) try { session.start(err => { @@ -68,164 +68,158 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // 开启三维识别 - session.update3DMode({open3d: true}) + session.update3DMode({ open3d: true }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { - console.log("addAnchor", anchors) + console.log('addAnchor', anchors) }) - let preAnchorNumber = 0; + let preAnchorNumber = 0 // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // console.log("updateAnchors", anchors); // 遍历不同的识别目标 - for (let i = 0; i < anchors.length; i++ ) { - const anchor = anchors[i]; + for (let i = 0; i < anchors.length; i++) { + const anchor = anchors[i] - let faceWrap = this.faceWrapMap[i]; + let faceWrap = this.faceWrapMap[i] if (!faceWrap) { - this.initBindingNode(i); + this.initBindingNode(i) - faceWrap = this.faceWrapMap[i]; + faceWrap = this.faceWrapMap[i] } - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() // 更新显示状态 - this.updateHintBoxVisble(faceWrap.hintBoxList, true); + this.updateHintBoxVisble(faceWrap.hintBoxList, true) if (faceWrap.faceGLTFTrs.visible !== true) { - faceWrap.faceGLTFTrs.visible = true; + faceWrap.faceGLTFTrs.visible = true } // 执行信息同步逻辑 - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(anchor.transform); - this.DT.transpose(this.DT2); - faceWrap.wrapTrs.setLocalMatrix(this.DT2); + this.DT.setArray(anchor.transform) + this.DT.transpose(this.DT2) + faceWrap.wrapTrs.setLocalMatrix(this.DT2) // 更新提示点位置 - this.updateHintBoxPosition(faceWrap.hintBoxList, anchor.points3d); + this.updateHintBoxPosition(faceWrap.hintBoxList, anchor.points3d) } // 由于目前,减少识别目标不会触发remove事件,所以先通过数量判断处理隐藏 if (preAnchorNumber > anchors.length) { // 遍历被隐藏的目标 - for (let i = preAnchorNumber - 1; i >= anchors.length; i-- ) { - let faceWrap = this.faceWrapMap[i]; + for (let i = preAnchorNumber - 1; i >= anchors.length; i--) { + const faceWrap = this.faceWrapMap[i] if (faceWrap) { - this.updateHintBoxVisble(faceWrap.hintBoxList, false); + this.updateHintBoxVisble(faceWrap.hintBoxList, false) if (faceWrap.faceGLTFTrs.visible !== false) { - faceWrap.faceGLTFTrs.visible = false; + faceWrap.faceGLTFTrs.visible = false } } } } - preAnchorNumber = anchors.length; + preAnchorNumber = anchors.length }) - // VKSession removeAnchors // 识别目标丢失时不断触发 session.on('removeAnchors', anchors => { // console.log("removeAnchors"); - + if (preAnchorNumber !== 0) { - for (let i = 0; i < preAnchorNumber; i++ ) { - let faceWrap = this.faceWrapMap[i]; - if (faceWrap) { - this.updateHintBoxVisble(faceWrap.hintBoxList, false); - if (faceWrap.faceGLTFTrs.visible !== false) { - faceWrap.faceGLTFTrs.visible = false; - } + for (let i = 0; i < preAnchorNumber; i++) { + const faceWrap = this.faceWrapMap[i] + if (faceWrap) { + this.updateHintBoxVisble(faceWrap.hintBoxList, false) + if (faceWrap.faceGLTFTrs.visible !== false) { + faceWrap.faceGLTFTrs.visible = false } + } } } - preAnchorNumber = 0; - - }); - + preAnchorNumber = 0 + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - - } catch(e) { - console.error(e); + this.initLoop() + }) + } catch (e) { + console.error(e) } - }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const scene = this.xrScene; + const scene = this.xrScene // 缓存主相机 this.xrCameraMain = this.xrCamera - this.xrCameraMainTrs = this.xrCameraTrs; - + this.xrCameraMainTrs = this.xrCameraTrs + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // 加载脸模 this.faceGLTF = await scene.assets.loadAsset({ type: 'gltf', - assetId: `gltf-face`, + assetId: 'gltf-face', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/face.glb', }) // 初始化识别挂载点容器 - this.faceWrapMap = {}; - + this.faceWrapMap = {} }, initBindingNode(index) { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene // 用于管理每一个挂载元素 - const wrapInfo = {}; + const wrapInfo = {} // === 初始挂载点 === - const faceWrap = scene.createElement(xrFrameSystem.XRNode); - const faceWrapTrs = faceWrap.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( faceWrap ); + const faceWrap = scene.createElement(xrFrameSystem.XRNode) + const faceWrapTrs = faceWrap.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(faceWrap) - wrapInfo.wrapElem = faceWrap; - wrapInfo.wrapTrs = faceWrapTrs; + wrapInfo.wrapElem = faceWrap + wrapInfo.wrapTrs = faceWrapTrs const faceElem = scene.createElement(xrFrameSystem.XRGLTF, { - model: "gltf-face", - position: `0 0 0`, - scale: `1 1 1`, - }); - const faceGLTF = faceElem.getComponent(xrFrameSystem.GLTF); - const faceGLTFTrs = faceElem.getComponent(xrFrameSystem.Transform); - faceWrap.addChild(faceElem); + model: 'gltf-face', + position: '0 0 0', + scale: '1 1 1', + }) + const faceGLTF = faceElem.getComponent(xrFrameSystem.GLTF) + const faceGLTFTrs = faceElem.getComponent(xrFrameSystem.Transform) + faceWrap.addChild(faceElem) - wrapInfo.faceGLTFTrs = faceGLTFTrs; + wrapInfo.faceGLTFTrs = faceGLTFTrs - for(const mesh of faceGLTF.meshes) { + for (const mesh of faceGLTF.meshes) { // 通过alphaMode 的 Setter 设置,或者写入renderState,但需要手动控制宏 - mesh.material.alphaMode = "BLEND"; - mesh.material.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 1, 1, 0.4)); + mesh.material.alphaMode = 'BLEND' + mesh.material.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1, 1, 1, 0.4)) } // 加载提示点 - wrapInfo.hintBoxList = this.getHintBox(xrFrameSystem, scene, faceWrap); + wrapInfo.hintBoxList = this.getHintBox(xrFrameSystem, scene, faceWrap) - this.faceWrapMap[index] = wrapInfo; + this.faceWrapMap[index] = wrapInfo }, loop() { // console.log('loop') @@ -234,58 +228,57 @@ Component({ const frame = this.session.getVKFrame(this.data.width, this.data.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); - + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) }, getHintBox(xrFrameSystem, scene, wrap) { // 初始化提示点 - const geometryHint = scene.assets.getAsset('geometry', 'sphere'); - const effectCube = scene.assets.getAsset('effect', 'standard'); - const boxScale = 0.03; - const hintBoxList = []; + const geometryHint = scene.assets.getAsset('geometry', 'sphere') + const effectCube = scene.assets.getAsset('effect', 'standard') + const boxScale = 0.03 + const hintBoxList = [] for (let i = 0; i < 106; i++) { - const colorFloat = i / 106; + const colorFloat = i / 106 const el = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", + position: '0 0 0', scale: `${boxScale} ${boxScale} ${boxScale}`, - }); - const elTrs = el.getComponent(xrFrameSystem.Transform); - const mat = scene.createMaterial(effectCube); - - const colorR = 1.0 - colorFloat; - mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)); + }) + const elTrs = el.getComponent(xrFrameSystem.Transform) + const mat = scene.createMaterial(effectCube) + + const colorR = 1.0 - colorFloat + mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)) const mesh = el.addComponent(xrFrameSystem.Mesh, { geometry: geometryHint, material: mat, - }); + }) - wrap.addChild( el ); + wrap.addChild(el) // elTrs.visible = false; - - hintBoxList.push( elTrs ); + + hintBoxList.push(elTrs) } - return hintBoxList; + return hintBoxList }, updateHintBoxPosition(hintBoxList, points3d) { if (hintBoxList && hintBoxList.length > 0) { // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; - hintBox.position.x = points3d[i].x; - hintBox.position.y = points3d[i].y; - hintBox.position.z = points3d[i].z; + const hintBox = hintBoxList[i] + hintBox.position.x = points3d[i].x + hintBox.position.y = points3d[i].y + hintBox.position.z = points3d[i].z } } }, @@ -294,12 +287,12 @@ Component({ // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; + const hintBox = hintBoxList[i] if (hintBox.visible !== visible) { - hintBox.visible = visible; + hintBox.visible = visible } } } } }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/face-detect/behavior.js b/miniprogram/packageAPI/pages/ar/face-detect/behavior.js index 8b66a6cb..071f621e 100644 --- a/miniprogram/packageAPI/pages/ar/face-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/face-detect/behavior.js @@ -1,202 +1,201 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - cameraPosition: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - face: { - mode: 1 - } - }, - cameraPosition: 1, - version: 'v1', - gl: this.gl - }) - - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - this.data.anchor2DList = anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })) - }) - session.on('updateAnchors', anchors => { - this.data.anchor2DList = [] - // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 - this.data.anchor2DList = this.data.anchor2DList.concat(anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - }))) - }) - session.on('removeAnchors', anchors => { - this.data.anchor2DList = [] - }) - - this.setData({ - buttonDisable:false - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + cameraPosition: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + face: { + mode: 1 + } + }, + cameraPosition: 1, + version: 'v1', + gl: this.gl + }) + + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + this.data.anchor2DList = anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })) + }) + session.on('updateAnchors', anchors => { + this.data.anchor2DList = [] + // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 + this.data.anchor2DList = this.data.anchor2DList.concat(anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + }))) + }) + session.on('removeAnchors', anchors => { + this.data.anchor2DList = [] + }) + + this.setData({ + buttonDisable: false + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/face-detect/face-detect.js b/miniprogram/packageAPI/pages/ar/face-detect/face-detect.js index 4c11bedd..ebcd9a0f 100644 --- a/miniprogram/packageAPI/pages/ar/face-detect/face-detect.js +++ b/miniprogram/packageAPI/pages/ar/face-detect/face-detect.js @@ -4,70 +4,69 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -//顶点着色器 -var VSHADER_SOURCE = '' + - 'attribute vec4 a_Position;\n' + //声明attribute变量a_Position,用来存放顶点位置信息 +// 顶点着色器 +const VSHADER_SOURCE = '' + + 'attribute vec4 a_Position;\n' + // 声明attribute变量a_Position,用来存放顶点位置信息 'void main(){\n' + - ' gl_Position = a_Position;\n' + //将顶点坐标赋值给顶点着色器内置变量gl_Position - ' gl_PointSize = 4.0;\n' + //设置顶点大小 + ' gl_Position = a_Position;\n' + // 将顶点坐标赋值给顶点着色器内置变量gl_Position + ' gl_PointSize = 4.0;\n' + // 设置顶点大小 '}\n' -//片元着色器 -var FSHADER_SOURCE = '' + +// 片元着色器 +const FSHADER_SOURCE = '' + '#ifdef GL_ES\n' + ' precision mediump float;\n' + // 设置精度 '#endif\n' + - 'varying vec4 v_Color;\n' + //声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 + 'varying vec4 v_Color;\n' + // 声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 'void main(){\n' + - ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + //计算像素距离中心点的距离 - ' if(d < 0.5) {\n' + //距离大于0.5放弃片元,小于0.5保留片元 + ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + // 计算像素距离中心点的距离 + ' if(d < 0.5) {\n' + // 距离大于0.5放弃片元,小于0.5保留片元 ' gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n' + ' } else { discard; }\n' + '}\n' - -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false function initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) { - //创建顶点着色器对象 - var vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) - //创建片元着色器对象 - var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) + // 创建顶点着色器对象 + const vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) + // 创建片元着色器对象 + const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) if (!vertexShader || !fragmentShader) { return null } - //创建程序对象program - var program = gl.createProgram() + // 创建程序对象program + const program = gl.createProgram() if (!gl.createProgram()) { return null } - //分配顶点着色器和片元着色器到program + // 分配顶点着色器和片元着色器到program gl.attachShader(program, vertexShader) gl.attachShader(program, fragmentShader) - //链接program + // 链接program gl.linkProgram(program) - //检查程序对象是否连接成功 - var linked = gl.getProgramParameter(program, gl.LINK_STATUS) + // 检查程序对象是否连接成功 + const linked = gl.getProgramParameter(program, gl.LINK_STATUS) if (!linked) { - var error = gl.getProgramInfoLog(program) + const error = gl.getProgramInfoLog(program) console.log('程序对象连接失败: ' + error) gl.deleteProgram(program) gl.deleteShader(fragmentShader) gl.deleteShader(vertexShader) return null } - //返回程序program对象 + // 返回程序program对象 initShadersDone = true return program } function loadShader(gl, type, source) { // 创建顶点着色器对象 - var shader = gl.createShader(type) + const shader = gl.createShader(type) if (shader == null) { console.log('创建着色器失败') return null @@ -80,9 +79,9 @@ function loadShader(gl, type, source) { gl.compileShader(shader) // 检查顶是否编译成功 - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) if (!compiled) { - var error = gl.getShaderInfoLog(shader) + const error = gl.getShaderInfoLog(shader) console.log('编译着色器失败: ' + error) gl.deleteShader(shader) return null @@ -91,9 +90,8 @@ function loadShader(gl, type, source) { return shader } -//初始化顶点坐标和顶点颜色 +// 初始化顶点坐标和顶点颜色 function initVertexBuffers(gl, anchor2DList) { - const flattenPoints = [] anchor2DList.forEach(anchor => { anchor.points.forEach(point => { @@ -105,23 +103,23 @@ function initVertexBuffers(gl, anchor2DList) { }) }) - var vertices = new Float32Array(flattenPoints) - var n = flattenPoints.length / 2 + const vertices = new Float32Array(flattenPoints) + const n = flattenPoints.length / 2 - //创建缓冲区对象 - var buffer = gl.createBuffer() - //将顶点坐标和顶点颜色信息写入缓冲区对象 + // 创建缓冲区对象 + const buffer = gl.createBuffer() + // 将顶点坐标和顶点颜色信息写入缓冲区对象 gl.bindBuffer(gl.ARRAY_BUFFER, buffer) gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW) - //获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 - var a_Position = gl.getAttribLocation(gl.program, 'a_Position') + // 获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 + const a_Position = gl.getAttribLocation(gl.program, 'a_Position') gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 0, 0) gl.enableVertexAttribArray(a_Position) return n } -var EDGE_VSHADER_SOURCE = +const EDGE_VSHADER_SOURCE = ` attribute vec2 aPosition; varying vec2 posJudge; @@ -132,7 +130,7 @@ var EDGE_VSHADER_SOURCE = } ` -var EDGE_FSHADER_SOURCE = +const EDGE_FSHADER_SOURCE = ` precision highp float; uniform vec2 rightTopPoint; @@ -162,48 +160,47 @@ var EDGE_FSHADER_SOURCE = ` function initRectEdgeBuffer(gl, x, y, width, height) { - let shaderProgram = gl.program; - let centerX = x * 2 - 1 + width; - let centerY = -1 * (y * 2 - 1) - height; - let right = width; - let top = height; - var vertices = [ + const shaderProgram = gl.program + const centerX = x * 2 - 1 + width + const centerY = -1 * (y * 2 - 1) - height + const right = width + const top = height + const vertices = [ -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0 - ]; + ] - var vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); - var aPosition = gl.getAttribLocation(shaderProgram, 'aPosition'); - gl.enableVertexAttribArray(aPosition); - gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0); + const vertexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW) + const aPosition = gl.getAttribLocation(shaderProgram, 'aPosition') + gl.enableVertexAttribArray(aPosition) + gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0) - - var rightTop = [ + const rightTop = [ right, top - ]; - var rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint'); - gl.uniform2fv(rightTopLoc, rightTop); + ] + const rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint') + gl.uniform2fv(rightTopLoc, rightTop) - var centerPoint = [ + const centerPoint = [ centerX, centerY - ]; - var centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint'); - gl.uniform2fv(centerPointLoc, centerPoint); + ] + const centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint') + gl.uniform2fv(centerPointLoc, centerPoint) - var length = vertices.length / 2; + const length = vertices.length / 2 - return length; + return length } function onDrawRectEdge(gl, x, y, width, height) { width = Math.round(width * 100) / 100 height = Math.round(height * 100) / 100 - var n = initRectEdgeBuffer(gl, x, y, width, height); - gl.drawArrays(gl.TRIANGLE_STRIP, 0, n); + const n = initRectEdgeBuffer(gl, x, y, width, height) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, n) } Component({ @@ -219,15 +216,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -245,19 +242,19 @@ Component({ init() { this.initGL() }, - switchCamera(event){ - if(this.session.config){ + switchCamera(event) { + if (this.session.config) { const config = this.session.config - let pos = Number(event.currentTarget.dataset.value) + const pos = Number(event.currentTarget.dataset.value) config.cameraPosition = pos this.session.config = config this.setData({ - cameraPosition:event.currentTarget.dataset.value + cameraPosition: event.currentTarget.dataset.value }) } }, render(frame) { - var gl = this.gl + const gl = this.gl this.renderGL(frame) @@ -281,7 +278,7 @@ Component({ const anchor2DList = this.data.anchor2DList if (!anchor2DList || anchor2DList.length <= 0) { - return + } else { if (!initShadersDone) { this.vertexProgram = initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) @@ -295,19 +292,19 @@ Component({ gl.useProgram(this.vertexProgram) gl.program = this.vertexProgram - //初始化顶点坐标和顶点颜色 - var n = initVertexBuffers(gl, anchor2DList) + // 初始化顶点坐标和顶点颜色 + const n = initVertexBuffers(gl, anchor2DList) - //绘制点 + // 绘制点 gl.drawArrays(gl.POINTS, 0, n) gl.useProgram(this.rectEdgeProgram) gl.program = this.rectEdgeProgram - for (var i = 0; i < anchor2DList.length; i++) { + for (let i = 0; i < anchor2DList.length; i++) { onDrawRectEdge(gl, anchor2DList[i].origin.x, anchor2DList[i].origin.y, anchor2DList[i].size.width, anchor2DList[i].size.height) } } }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/face-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/face-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/face-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/face-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting-ar.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting-ar.js index e30f7bf0..f5ac2062 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting-ar.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting-ar.js @@ -2,24 +2,25 @@ import { loadPly } from './loaders/ply/ply-loader' import { loadSplat } from './loaders/splat/splat-loader' import CameraWebGL from './webgl2/camera-webGL' import CubeInstanceWebGL from './webgl2/cubeInstance-webGL' -import SplatWebGL, { SplatRenderTexture} from './webgl2/splat-webGL' +import SplatWebGL, { SplatRenderTexture } from './webgl2/splat-webGL' import YUVRenderWebGL from './webgl2/yuv-webGL' import * as glMatrix from './util/gl-matrix-min' + const { mat4 } = glMatrix // VK 投影矩阵参数定义 const NEAR = 0.01 const FAR = 1000 -const renderScale = 1; +const renderScale = 1 Component({ behaviors: [], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 1, // canvas高度缩放值 + widthScale: 1, // canvas宽度缩放值 + heightScale: 1, // canvas高度缩放值 renderByXRFrame: false, // 是否使用 xr-frame渲染 renderByWebGL2: true, // 是否使用WebGL2渲染 workerOn: true, @@ -30,51 +31,50 @@ Component({ * 生命周期函数--监听页面加载 */ attached() { - console.log("页面attached") + console.log('页面attached') console.log('[worker] 排序 worker 的创建') - this.worker = wx.createWorker('workers/gaussianSplatting/index.js'); - console.log('[worker] 具体 worker', this.worker); - + this.worker = wx.createWorker('workers/gaussianSplatting/index.js') + console.log('[worker] 具体 worker', this.worker) }, detached() { - console.log("页面detached") + console.log('页面detached') if (this.worker) this.worker.terminate() }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') }, }, methods: { onReady() { // 获取canvas wx.createSelectorQuery() - .select('#canvas') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio; - const width = info.windowWidth * this.data.widthScale * pixelRatio * renderScale; - const height = info.windowHeight * this.data.heightScale * pixelRatio * renderScale; - // 存在 webgl Canvas的情况下,写入大小 - if (this.canvas) { - this.canvas.width = width; - this.canvas.height = height; - } - console.log(`canvas size: width = ${width} , height = ${height}`) - console.log(`window size: width = ${info.windowWidth} , height = ${info.windowHeight}`) - - this.setData({ - width: width, - height: height, - }); - - // 页面自定义初始化 - if (this.init) this.init() + .select('#canvas') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const width = info.windowWidth * this.data.widthScale * pixelRatio * renderScale + const height = info.windowHeight * this.data.heightScale * pixelRatio * renderScale + // 存在 webgl Canvas的情况下,写入大小 + if (this.canvas) { + this.canvas.width = width + this.canvas.height = height + } + console.log(`canvas size: width = ${width} , height = ${height}`) + console.log(`window size: width = ${info.windowWidth} , height = ${info.windowHeight}`) + + this.setData({ + width, + height, }) + + // 页面自定义初始化 + if (this.init) this.init() + }) }, // 对应案例的初始化逻辑,由统一的 arBehavior 触发 init() { @@ -82,12 +82,12 @@ Component({ // 注册 各类渲染器 if (this.data.renderByWebGL2) { - this.initWebGL2(); + this.initWebGL2() } else if (this.data.renderByXRFrame) { - this.initXRFrame(); + this.initXRFrame() } - - this.initVK(); + + this.initVK() }, initVK() { // VKSession 配置 @@ -99,7 +99,7 @@ Component({ }, version: 'v2', gl: this.gl - }); + }) session.start(err => { if (err) return console.error('VK error: ', err) @@ -116,54 +116,54 @@ Component({ // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { }) - + // VKSession removeAnchors session.on('removeAnchors', anchors => { // console.log('removeAnchors', anchors) - }); + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); + this.initLoop() + }) }, initLoop() { // 限制调用帧率,暂时去掉 - let fps = 30 - let fpsInterval = 1000 / fps + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() - const session = this.session; + const session = this.session // 逐帧渲染 const onFrame = timestamp => { - try { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - this.requestRender(); - } - } catch(e) { - console.error(e); + try { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + this.requestRender() } - session.requestAnimationFrame(onFrame) + } catch (e) { + console.error(e) + } + session.requestAnimationFrame(onFrame) } session.requestAnimationFrame(onFrame) }, - initPLY(id){ + initPLY(id) { console.log('== PLY Init start ==') - const host = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo'; + const host = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo' // const host = 'http://127.0.0.1:8030' // const host = 'http://10.9.169.133:8030' - let type; + let type // 加载 splat - type = 'splat'; - const pcSrc = `${host}/splat/${id}.splat`; + type = 'splat' + const pcSrc = `${host}/splat/${id}.splat` console.log('splat src', pcSrc) @@ -171,66 +171,66 @@ Component({ url: pcSrc, timeout: 200000, success: (res) => { - console.log("downloadFile 下载回调", res); + console.log('downloadFile 下载回调', res) - const filePath = res.tempFilePath; + const filePath = res.tempFilePath const fs = wx.getFileSystemManager() /** * 因为微信读文件,最大只能读100MB的,所以需要分块读取。 */ - const fd = fs.openSync({ filePath: filePath }) - const stats = fs.fstatSync({fd: fd}) - console.log('fd stats', stats); - let size = stats.size; + const fd = fs.openSync({ filePath }) + const stats = fs.fstatSync({ fd }) + console.log('fd stats', stats) + let size = stats.size if (size > 0) { - const buffer = new ArrayBuffer(size); - const viewU8 = new Uint8Array(buffer); - let offset = 0; - let uindex = 0; + const buffer = new ArrayBuffer(size) + const viewU8 = new Uint8Array(buffer) + let offset = 0 + let uindex = 0 while (size > 0) { - const chunkSize = Math.min(size, 100 * 1024 * 1024/* 100MB */); + const chunkSize = Math.min(size, 100 * 1024 * 1024/* 100MB */) - const res = fs.readFileSync( + const res = fs.readFileSync( filePath, undefined, offset, chunkSize, - ); - const resU8 = new Uint8Array(res); - viewU8.set(new Uint8Array(res), uindex); - uindex += resU8.length; + ) + const resU8 = new Uint8Array(res) + viewU8.set(new Uint8Array(res), uindex) + uindex += resU8.length // console.log('res', res) // console.log('uindex', uindex); // console.log('offset', offset); // console.log('chunkSize', chunkSize) - offset += chunkSize; - size -= chunkSize; + offset += chunkSize + size -= chunkSize } - fs.close({ fd }); + fs.close({ fd }) // console.log('buffer', buffer) - let info; + let info - const maxGaussians = this.data.maxGaussians; + const maxGaussians = this.data.maxGaussians switch (type) { case 'ply': - info = loadPly(buffer, maxGaussians); - console.log("plyLoader return", info); - break; + info = loadPly(buffer, maxGaussians) + console.log('plyLoader return', info) + break case 'splat': - info = loadSplat(buffer, maxGaussians); - console.log("splatLoader return", info); - break; + info = loadSplat(buffer, maxGaussians) + console.log('splatLoader return', info) + break } // 提供渲染的高斯球数 - const renderCount = this.renderCount = info.count; + const renderCount = this.renderCount = info.count // 全部用 f32 存储 // this.sabPositions = wx.createSharedArrayBuffer(renderCount * 4 * 3) @@ -248,10 +248,9 @@ Component({ // sabCov3Da: this.sabCov3Da, // sabCov3Db: this.sabCov3Db, // sabcolors: this.sabcolors, - }); - + }) } else { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', @@ -261,7 +260,7 @@ Component({ } }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', @@ -269,7 +268,7 @@ Component({ }) console.error(res) } - }); + }) }, initWorker(plyInfo, config) { console.log('== Worker Init start ==') @@ -280,15 +279,13 @@ Component({ // worker 初始化 回调 console.log('[Worker callback] gaussianSplatting init callBack', res) - this.camera.isWorkerInit = true; - this.camera.updateByVK(); - - + this.camera.isWorkerInit = true + this.camera.updateByVK() } else if (res.type === 'execFunc_sort') { // worker 排序 回调 // console.log(res) - this.camera.isWorkerSorting = false; + this.camera.isWorkerSorting = false const data = res.result.data @@ -306,13 +303,12 @@ Component({ // const cov3Da = new Float32Array(this.sabCov3Da.buffer); // const cov3Db = new Float32Array(this.sabCov3Db.buffer); // const colors = new Float32Array(this.sabcolors.buffer); - - const positions = new Float32Array(data.positions); - const opacities = new Float32Array(data.opacities); - const cov3Da = new Float32Array(data.cov3Da); - const cov3Db = new Float32Array(data.cov3Db); - const colors = new Float32Array(data.colors); + const positions = new Float32Array(data.positions) + const opacities = new Float32Array(data.opacities) + const cov3Da = new Float32Array(data.cov3Da) + const cov3Db = new Float32Array(data.cov3Db) + const colors = new Float32Array(data.colors) updateBuffer(this.splat.buffers.center, positions) updateBuffer(this.splat.buffers.opacity, opacities) @@ -321,7 +317,7 @@ Component({ updateBuffer(this.splat.buffers.color, colors) // 设定绘制的高斯球数量 - this.gaussiansCount = data.gaussiansCount; + this.gaussiansCount = data.gaussiansCount const end = new Date().getTime() // const sortTime = `${((end - start)/1000).toFixed(3)}s` @@ -342,14 +338,14 @@ Component({ // 后续为 webGL2 相关,为了方便开发,先放在一起 initWebGL2() { console.log('== InitWebGL2 start ==') - const gl = this.gl = this.canvas.getContext('webgl2'); - console.log('webgl2 context', gl); + const gl = this.gl = this.canvas.getContext('webgl2') + console.log('webgl2 context', gl) // Setup Camera const cameraParameters = { up: [0, 1.0, 0.0], target: [0, 0, 0], - camera: [Math.PI/2, Math.PI/2, 10], // theta phi radius + camera: [Math.PI / 2, Math.PI / 2, 10], // theta phi radius } this.camera = new CameraWebGL(gl, this.worker, cameraParameters) @@ -357,44 +353,43 @@ Component({ this.cubeInstance = new CubeInstanceWebGL(gl) // Setup Splat - this.initSplat(gl); + this.initSplat(gl) // Setup YUV - this.initYUV(gl); - + this.initYUV(gl) }, // Gaussian Splat数据 initSplat(gl) { // 初始化 splat 绘制到的 renderTexture - this.splatRT = new SplatRenderTexture(gl); + this.splatRT = new SplatRenderTexture(gl) // 初始化 splat 渲染器 - this.splat = new SplatWebGL(gl); + this.splat = new SplatWebGL(gl) }, // VK 摄像机数据渲染 - initYUV(gl){ - this.YUVRender = new YUVRenderWebGL(gl); + initYUV(gl) { + this.YUVRender = new YUVRenderWebGL(gl) }, requestRender() { // console.log('request render') // 限帧 - let now = Date.now() - const last = this.lastRenderTime || 0; + const now = Date.now() + const last = this.lastRenderTime || 0 const mill = now - last if (mill < 30) { return } this.lastRenderTime = now - - const gl = this.gl; + + const gl = this.gl // Clear State gl.viewport(0, 0, gl.canvas.width, gl.canvas.height) - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.clearColor(0.8, 0.8, 0.8, 1.0); + gl.bindFramebuffer(gl.FRAMEBUFFER, null) + gl.clearColor(0.8, 0.8, 0.8, 1.0) // Clear - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) // 先关掉深度测试 gl.disable(gl.DEPTH_TEST) @@ -403,47 +398,47 @@ Component({ const frame = this.session.getVKFrame(this.canvas.width, this.canvas.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 获取 VKCamera const VKCamera = frame.camera // 相机 if (VKCamera) { - const viewMatrix = VKCamera.viewMatrix; - const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR); + const viewMatrix = VKCamera.viewMatrix + const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR) // 视图矩阵 - this.camera.viewMatrix = viewMatrix; + this.camera.viewMatrix = viewMatrix // 投影矩阵 - this.camera.projMatrix = projectionMatrix; - this.camera.updateByVK(); + this.camera.projMatrix = projectionMatrix + this.camera.updateByVK() } // Draw YUV - this.drawYUV(gl, frame); + this.drawYUV(gl, frame) // Draw Splat - this.drawSplat(gl); + this.drawSplat(gl) // 恢复渲染状态 // cullFace // gl.enable(gl.CULL_FACE); // gl.cullFace(gl.BACK); - gl.disable(gl.CULL_FACE); + gl.disable(gl.CULL_FACE) // gl.cullFace(gl.BACK); // 深度测试 gl.enable(gl.DEPTH_TEST) // drawCubeMesh - const projMatrix = this.camera.projMatrix; - const viewMatrix = this.camera.viewMatrix; - let modelMatrix = mat4.create(); + const projMatrix = this.camera.projMatrix + const viewMatrix = this.camera.viewMatrix + let modelMatrix = mat4.create() // hintTest Info if (!this.isPlaced) { const hitTestRes = this.session.hitTest(0.5, 0.5) if (hitTestRes.length) { // hitTestRes 返回 transform 为列主序矩阵 - const hintScale = 0.01; + const hintScale = 0.01 mat4.scale(modelMatrix, hitTestRes[0].transform, [hintScale * 3, hintScale, hintScale * 3]) } else { // 放在很远,相当于移除屏幕 @@ -455,11 +450,10 @@ Component({ ] } } else { - modelMatrix = this.hintModelMatrix; + modelMatrix = this.hintModelMatrix } this.drawCubeMesh(gl, projMatrix, viewMatrix, modelMatrix) - }, drawYUV(gl, frame) { // 获取 VKFrame 信息 @@ -470,42 +464,41 @@ Component({ const displayTransform = frame.getDisplayTransform() if (!yTexture || !uvTexture) { - return; + return } // 进行 YUV 准备 const yuvRender = this.YUVRender - + // YUV 需要绘制背面 - gl.disable(gl.CULL_FACE); + gl.disable(gl.CULL_FACE) // 先将YUV绘制到主屏 - gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null) - gl.useProgram(yuvRender.programInfo.program); + gl.useProgram(yuvRender.programInfo.program) // VAO - gl.bindVertexArray(yuvRender.vao); + gl.bindVertexArray(yuvRender.vao) // position - gl.bindBuffer(gl.ARRAY_BUFFER, yuvRender.buffers.position); - gl.vertexAttribPointer(yuvRender.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(yuvRender.programInfo.attribLocations.vertexPosition); + gl.bindBuffer(gl.ARRAY_BUFFER, yuvRender.buffers.position) + gl.vertexAttribPointer(yuvRender.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(yuvRender.programInfo.attribLocations.vertexPosition) // texCoord - gl.bindBuffer(gl.ARRAY_BUFFER, yuvRender.buffers.texCoord); - gl.vertexAttribPointer(yuvRender.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(yuvRender.programInfo.attribLocations.vertexTexcoord); + gl.bindBuffer(gl.ARRAY_BUFFER, yuvRender.buffers.texCoord) + gl.vertexAttribPointer(yuvRender.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(yuvRender.programInfo.attribLocations.vertexTexcoord) // indices - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, yuvRender.buffers.indices); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, yuvRender.buffers.indices) // displayTransform gl.uniformMatrix3fv(yuvRender.programInfo.uniformLocations.displayTransform, false, displayTransform) - - // 设置使用的纹理单元 - gl.uniform1i(yuvRender.programInfo.uniformLocations.yTexture, 1); // 纹理单元 1 - gl.uniform1i(yuvRender.programInfo.uniformLocations.uvTexture, 2); // 纹理单元 2 + // 设置使用的纹理单元 + gl.uniform1i(yuvRender.programInfo.uniformLocations.yTexture, 1) // 纹理单元 1 + gl.uniform1i(yuvRender.programInfo.uniformLocations.uvTexture, 2) // 纹理单元 2 // UNPACK_FLIP_Y_WEBGL - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true); + gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true) // 设定 Y、UV 纹理到纹理单元 gl.activeTexture(gl.TEXTURE1) @@ -514,56 +507,54 @@ Component({ gl.bindTexture(gl.TEXTURE_2D, uvTexture) // draw RenderTexture - gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0); + gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0) // 恢复 Cull_face - gl.enable(gl.CULL_FACE); - + gl.enable(gl.CULL_FACE) }, drawCubeMesh(gl, projMatrix, viewMatrix, modelMatrix) { // mesh const meshCube = this.cubeInstance // Tell WebGL to use our program when drawing - gl.useProgram(meshCube.programInfo.program); + gl.useProgram(meshCube.programInfo.program) // VAO - gl.bindVertexArray(meshCube.vao); + gl.bindVertexArray(meshCube.vao) // mesh position - gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.positionBuffer); - gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexPosition); + gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.positionBuffer) + gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexPosition) // mesh color - gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.colorBuffer); - gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexColor, 4, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexColor); + gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.colorBuffer) + gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexColor, 4, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexColor) // Tell WebGL which indices to use to index the vertices - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, meshCube.indices); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, meshCube.indices) // Set the shader uniforms gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.projectionMatrix, false, projMatrix - ); + ) gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.viewMatrix, false, viewMatrix - ); + ) gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.modelMatrix, false, modelMatrix - ); + ) // draw - const vertexCount = 36; - const type = gl.UNSIGNED_SHORT; - const offset = 0; - gl.drawElements(gl.TRIANGLES, vertexCount, type, offset); + const vertexCount = 36 + const type = gl.UNSIGNED_SHORT + const offset = 0 + gl.drawElements(gl.TRIANGLES, vertexCount, type, offset) }, drawSplat(gl) { - // 通用准备 const cam = this.camera @@ -572,10 +563,10 @@ Component({ const splatRTFrameBuffer = this.splatRT.frameBuffer - gl.bindFramebuffer(gl.FRAMEBUFFER, splatRTFrameBuffer); + gl.bindFramebuffer(gl.FRAMEBUFFER, splatRTFrameBuffer) - gl.clearColor(0, 0, 0, 0.0); - gl.clear(gl.COLOR_BUFFER_BIT); + gl.clearColor(0, 0, 0, 0.0) + gl.clear(gl.COLOR_BUFFER_BIT) // Set Splat state gl.disable(gl.DEPTH_TEST) @@ -586,11 +577,11 @@ Component({ // 开启 Splat 绘制流程 const splat = this.splat - const program = splat.program; + const program = splat.program // Use Program - gl.useProgram(program); + gl.useProgram(program) // VAO - gl.bindVertexArray(splat.vao); + gl.bindVertexArray(splat.vao) // Original implementation parameters const canvasWidth = gl.canvas.width @@ -611,24 +602,24 @@ Component({ gl.uniformMatrix4fv(gl.getUniformLocation(program, 'modelViewProjectMatrix'), false, cam.mvpm) // Draw Splat - gl.drawArraysInstanced(gl.TRIANGLE_STRIP, 0, 4, this.gaussiansCount); + gl.drawArraysInstanced(gl.TRIANGLE_STRIP, 0, 4, this.gaussiansCount) // 最后将RT绘制 到 主屏 - gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null) - gl.useProgram(splatRT.programInfo.program); + gl.useProgram(splatRT.programInfo.program) // VAO - gl.bindVertexArray(splatRT.vao); + gl.bindVertexArray(splatRT.vao) // position - gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.position); - gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexPosition); + gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.position) + gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexPosition) // texCoord - gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.texCoord); - gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexTexcoord); + gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.texCoord) + gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexTexcoord) // indices - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, splatRT.buffers.indices); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, splatRT.buffers.indices) gl.uniform1i(splatRT.programInfo.attribLocations.uSplat, 0) // 纹理单元0 @@ -641,13 +632,12 @@ Component({ gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) // draw RenderTexture - gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0); - + gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0) }, onTapControl(e) { - const dataSet = e.target.dataset; - - const id = dataSet.id; + const dataSet = e.target.dataset + + const id = dataSet.id // hintTest Info const hitTestRes = this.session.hitTest(0.5, 0.5) @@ -655,81 +645,81 @@ Component({ // 命中才进行后续的具体加载 // hitTestRes 返回 transform 为列主序矩阵 - let splatModelMatrix = mat4.create(); - let modelMatrixLocal = mat4.create(); - let modelMatrixT = mat4.create(); - let modelMatrixR = mat4.create(); - let modelMatrixS = mat4.create(); - let splatScale = 0.2; - let splatRotationAngle = 0; - let splatRotationFlag = [0, 1, 0]; - let splatTranslate = [0, 0, 0]; + const splatModelMatrix = mat4.create() + const modelMatrixLocal = mat4.create() + const modelMatrixT = mat4.create() + const modelMatrixR = mat4.create() + const modelMatrixS = mat4.create() + let splatScale = 0.2 + let splatRotationAngle = 0 + let splatRotationFlag = [0, 1, 0] + let splatTranslate = [0, 0, 0] // 针对不同场景设置不同的 世界矩阵 - switch(id) { + switch (id) { case 'room': - splatScale = 0.6; - splatTranslate = [0, -1, 0]; - splatRotationAngle = - Math.PI / 180 * 26; - splatRotationFlag = [1, 0, 0]; - break; + splatScale = 0.6 + splatTranslate = [0, -1, 0] + splatRotationAngle = -Math.PI / 180 * 26 + splatRotationFlag = [1, 0, 0] + break case 'garden': - splatScale = 0.6; - splatTranslate = [0, -2, 0]; - splatRotationAngle = - Math.PI / 180 * 20; - splatRotationFlag = [1, 0, 0]; - break; + splatScale = 0.6 + splatTranslate = [0, -2, 0] + splatRotationAngle = -Math.PI / 180 * 20 + splatRotationFlag = [1, 0, 0] + break case 'stump': - splatScale = 0.6; - splatTranslate = [0, 0, 0]; - break; + splatScale = 0.6 + splatTranslate = [0, 0, 0] + break case 'oneflower': - splatScale = 0.2; - splatTranslate = [-0.5, -2, -4]; - splatRotationAngle = - Math.PI / 180 * 40; - splatRotationFlag = [1, 0, 0]; - break; + splatScale = 0.2 + splatTranslate = [-0.5, -2, -4] + splatRotationAngle = -Math.PI / 180 * 40 + splatRotationFlag = [1, 0, 0] + break case 'usj': - splatTranslate = [0, 1, 0]; - break; + splatTranslate = [0, 1, 0] + break case 'sakura': - splatTranslate = [-1.6, 0, -1]; - break; + splatTranslate = [-1.6, 0, -1] + break case '0517cruch': - splatScale = 0.5; - splatTranslate = [0, 0, 0]; - break; + splatScale = 0.5 + splatTranslate = [0, 0, 0] + break default: - break; + break } mat4.scale(modelMatrixS, mat4.create(), [splatScale, splatScale, splatScale]) mat4.rotate(modelMatrixR, modelMatrixS, splatRotationAngle, splatRotationFlag) mat4.translate(modelMatrixT, modelMatrixR, splatTranslate) - mat4.copy(modelMatrixLocal, modelMatrixT); + mat4.copy(modelMatrixLocal, modelMatrixT) // Y轴反转矩阵 - const fixMatrix = mat4.create(); + const fixMatrix = mat4.create() mat4.rotate(fixMatrix, mat4.create(), Math.PI, [0, 0, 1]) // 本地矩阵 - const modelMatrixLocalFix = mat4.create(); - mat4.multiply(modelMatrixLocalFix, fixMatrix, modelMatrixLocal); + const modelMatrixLocalFix = mat4.create() + mat4.multiply(modelMatrixLocalFix, fixMatrix, modelMatrixLocal) // 世界矩阵 - mat4.multiply(splatModelMatrix, hitTestRes[0].transform, modelMatrixLocalFix); + mat4.multiply(splatModelMatrix, hitTestRes[0].transform, modelMatrixLocalFix) - this.camera.modelMatrix = splatModelMatrix; + this.camera.modelMatrix = splatModelMatrix // locak Hint - const hintModelMatrix = mat4.create(); - const hintScale = 0.01; + const hintModelMatrix = mat4.create() + const hintScale = 0.01 mat4.scale(hintModelMatrix, hitTestRes[0].transform, [hintScale * 3, hintScale, hintScale * 3]) - this.hintModelMatrix = hintModelMatrix; - this.isPlaced = true; + this.hintModelMatrix = hintModelMatrix + this.isPlaced = true // 开始处理 ply 资源 - this.initPLY(id); + this.initPLY(id) } }, changeMaxGaussianCount(e) { @@ -737,18 +727,16 @@ Component({ maxGaussians: e.detail.value }) - console.log('slider maxGaussians:', this.data.maxGaussians); + console.log('slider maxGaussians:', this.data.maxGaussians) }, switchWorker(e) { this.setData({ workerOn: e.detail.value }) - this.camera.setWorkerOn(this.data.workerOn); + this.camera.setWorkerOn(this.data.workerOn) - console.log('switch WorkerOn:', this.data.workerOn); + console.log('switch WorkerOn:', this.data.workerOn) } }, }) - - diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting.js index 7e8ed754..3d5a1e31 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/gaussian-splatting.js @@ -2,21 +2,22 @@ import { loadPly } from './loaders/ply/ply-loader' import { loadSplat } from './loaders/splat/splat-loader' import CameraWebGL from './webgl2/camera-webGL' import CubeInstanceWebGL from './webgl2/cubeInstance-webGL' -import SplatWebGL, { SplatRenderTexture} from './webgl2/splat-webGL' +import SplatWebGL, { SplatRenderTexture } from './webgl2/splat-webGL' import * as glMatrix from './util/gl-matrix-min' + const { mat4 } = glMatrix -const renderScale = 1; +const renderScale = 1 -const baseMatrix = mat4.create(); +const baseMatrix = mat4.create() Component({ behaviors: [], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 1, // canvas高度缩放值 + widthScale: 1, // canvas宽度缩放值 + heightScale: 1, // canvas高度缩放值 renderByXRFrame: false, // 是否使用 xr-frame渲染 renderByWebGL2: true, // 是否使用WebGL2渲染 workerOn: true, @@ -27,51 +28,50 @@ Component({ * 生命周期函数--监听页面加载 */ attached() { - console.log("页面attached") + console.log('页面attached') console.log('[worker] 排序 worker 的创建') - this.worker = wx.createWorker('workers/gaussianSplatting/index.js'); - console.log('[worker] 具体 worker', this.worker); - + this.worker = wx.createWorker('workers/gaussianSplatting/index.js') + console.log('[worker] 具体 worker', this.worker) }, detached() { - console.log("页面detached") + console.log('页面detached') if (this.worker) this.worker.terminate() }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') }, }, methods: { onReady() { // 获取canvas wx.createSelectorQuery() - .select('#canvas') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio; - const width = info.windowWidth * this.data.widthScale * pixelRatio * renderScale; - const height = info.windowHeight * this.data.heightScale * pixelRatio * renderScale; - // 存在 webgl Canvas的情况下,写入大小 - if (this.canvas) { - this.canvas.width = width; - this.canvas.height = height; - } - console.log(`canvas size: width = ${width} , height = ${height}`) - console.log(`window size: width = ${info.windowWidth} , height = ${info.windowHeight}`) - - this.setData({ - width: width, - height: height, - }); - - // 页面自定义初始化 - if (this.init) this.init() + .select('#canvas') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const width = info.windowWidth * this.data.widthScale * pixelRatio * renderScale + const height = info.windowHeight * this.data.heightScale * pixelRatio * renderScale + // 存在 webgl Canvas的情况下,写入大小 + if (this.canvas) { + this.canvas.width = width + this.canvas.height = height + } + console.log(`canvas size: width = ${width} , height = ${height}`) + console.log(`window size: width = ${info.windowWidth} , height = ${info.windowHeight}`) + + this.setData({ + width, + height, }) + + // 页面自定义初始化 + if (this.init) this.init() + }) }, // 对应案例的初始化逻辑,由统一的 arBehavior 触发 init() { @@ -79,20 +79,19 @@ Component({ // 注册 各类渲染器 if (this.data.renderByWebGL2) { - this.initWebGL2(); + this.initWebGL2() } else if (this.data.renderByXRFrame) { - this.initXRFrame(); + this.initXRFrame() } - }, - initPLY(id){ + initPLY(id) { console.log('== PLY Init start ==') - const host = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo'; + const host = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo' // const host = 'http://127.0.0.1:8030' // const host = 'http://10.9.169.149:8030' - let type; + let type // 加载 ply // type = 'ply'; @@ -106,57 +105,57 @@ Component({ // const pcSrc = `${host}/ply/sakura.compressed.ply`; // 加载 splat - type = 'splat'; - const pcSrc = `${host}/splat/${id}.splat`; - - let splatModelMatrix = mat4.create(); - let modelMatrixLocal = mat4.create(); - let modelMatrixT = mat4.create(); - let modelMatrixR = mat4.create(); - let modelMatrixS = mat4.create(); - let splatScale = 1; - let splatRotationAngle = 0; - let splatRotationFlag = [0, 1, 0]; - let splatTranslate = [0, 0, 0]; + type = 'splat' + const pcSrc = `${host}/splat/${id}.splat` + + const splatModelMatrix = mat4.create() + const modelMatrixLocal = mat4.create() + const modelMatrixT = mat4.create() + const modelMatrixR = mat4.create() + const modelMatrixS = mat4.create() + let splatScale = 1 + let splatRotationAngle = 0 + let splatRotationFlag = [0, 1, 0] + let splatTranslate = [0, 0, 0] // 针对不同场景设置不同的 本地矩阵 // Setup Camera - switch(id) { + switch (id) { case 'room': - splatScale = 0.6; - splatTranslate = [0, -3, 0]; - splatRotationAngle = - Math.PI / 180 * 26; - splatRotationFlag = [1, 0, 0]; + splatScale = 0.6 + splatTranslate = [0, -3, 0] + splatRotationAngle = -Math.PI / 180 * 26 + splatRotationFlag = [1, 0, 0] this.camera.updateCameraInfo( // target [0, 0, 0], // theta - -Math.PI/2, + -Math.PI / 2, // phi - Math.PI/2, + Math.PI / 2, // raidus 1 ) - break; + break case 'garden': - splatScale = 0.6; - splatTranslate = [0, -2, 0]; - splatRotationAngle = - Math.PI / 180 * 20; - splatRotationFlag = [1, 0, 0]; + splatScale = 0.6 + splatTranslate = [0, -2, 0] + splatRotationAngle = -Math.PI / 180 * 20 + splatRotationFlag = [1, 0, 0] this.camera.updateCameraInfo( // target [0, 0, 0], // theta - -Math.PI/2, + -Math.PI / 2, // phi - Math.PI/2, + Math.PI / 2, // raidus 2 ) - break; + break case 'stump': - splatScale = 0.5; - splatTranslate = [0, 0, 0]; + splatScale = 0.5 + splatTranslate = [0, 0, 0] this.camera.updateCameraInfo( // target [0, 0, 0], @@ -167,25 +166,25 @@ Component({ // raidus 2 ) - break; + break case 'oneflower': - splatScale = 0.1; - splatTranslate = [-0.5, -2, -4]; - splatRotationAngle = - Math.PI / 180 * 40; - splatRotationFlag = [1, 0, 0]; + splatScale = 0.1 + splatTranslate = [-0.5, -2, -4] + splatRotationAngle = -Math.PI / 180 * 40 + splatRotationFlag = [1, 0, 0] this.camera.updateCameraInfo( // target [0, 0, 0], // theta 0, // phi - Math.PI/2, + Math.PI / 2, // raidus 1 ) - break; + break case 'usj': - splatTranslate = [0, 1, 0]; + splatTranslate = [0, 1, 0] this.camera.updateCameraInfo( // target [0, 0, 0], @@ -196,9 +195,9 @@ Component({ // raidus 1 ) - break; + break case 'sakura': - splatTranslate = [-1.6, 0, -1]; + splatTranslate = [-1.6, 0, -1] this.camera.updateCameraInfo( // target [0, 0, 0], @@ -209,40 +208,40 @@ Component({ // raidus 1 ) - break; - case '0517cruch': - splatTranslate = [0, 0, 0]; + break + case '0517cruch': + splatTranslate = [0, 0, 0] this.camera.updateCameraInfo( // target [0, 0, 0], // theta -Math.PI / 2, // phi - Math.PI/2, + Math.PI / 2, // raidus 1 ) - break; + break } mat4.scale(modelMatrixS, mat4.create(), [splatScale, splatScale, splatScale]) mat4.rotate(modelMatrixR, modelMatrixS, splatRotationAngle, splatRotationFlag) mat4.translate(modelMatrixT, modelMatrixR, splatTranslate) - mat4.copy(modelMatrixLocal, modelMatrixT); + mat4.copy(modelMatrixLocal, modelMatrixT) // Y轴反转矩阵 - const fixMatrix = mat4.create(); + const fixMatrix = mat4.create() mat4.rotate(fixMatrix, mat4.create(), Math.PI, [0, 0, 1]) // 本地矩阵 - const modelMatrixLocalFix = mat4.create(); - mat4.multiply(modelMatrixLocalFix, fixMatrix, modelMatrixLocal); + const modelMatrixLocalFix = mat4.create() + mat4.multiply(modelMatrixLocalFix, fixMatrix, modelMatrixLocal) // 世界矩阵 - const modelWorld = mat4.create(); + const modelWorld = mat4.create() // mat4.translate(modelWorld, mat4.create(), [0, 1, 0]) - mat4.multiply(splatModelMatrix, modelWorld, modelMatrixLocalFix); - this.camera.modelMatrix = splatModelMatrix; + mat4.multiply(splatModelMatrix, modelWorld, modelMatrixLocalFix) + this.camera.modelMatrix = splatModelMatrix console.log('splat src', pcSrc) @@ -250,66 +249,66 @@ Component({ url: pcSrc, timeout: 200000, success: (res) => { - console.log("downloadFile 下载回调", res); + console.log('downloadFile 下载回调', res) - const filePath = res.tempFilePath; + const filePath = res.tempFilePath const fs = wx.getFileSystemManager() /** * 因为微信读文件,最大只能读100MB的,所以需要分块读取。 */ - const fd = fs.openSync({ filePath: filePath }) - const stats = fs.fstatSync({fd: fd}) - console.log('fd stats', stats); - let size = stats.size; + const fd = fs.openSync({ filePath }) + const stats = fs.fstatSync({ fd }) + console.log('fd stats', stats) + let size = stats.size if (size > 0) { - const buffer = new ArrayBuffer(size); - const viewU8 = new Uint8Array(buffer); - let offset = 0; - let uindex = 0; + const buffer = new ArrayBuffer(size) + const viewU8 = new Uint8Array(buffer) + let offset = 0 + let uindex = 0 while (size > 0) { - const chunkSize = Math.min(size, 100 * 1024 * 1024 /* 100MB */); + const chunkSize = Math.min(size, 100 * 1024 * 1024 /* 100MB */) - const res = fs.readFileSync( + const res = fs.readFileSync( filePath, undefined, offset, chunkSize, - ); - const resU8 = new Uint8Array(res); - viewU8.set(new Uint8Array(res), uindex); - uindex += resU8.length; + ) + const resU8 = new Uint8Array(res) + viewU8.set(new Uint8Array(res), uindex) + uindex += resU8.length // console.log('res', res) // console.log('uindex', uindex); // console.log('offset', offset); // console.log('chunkSize', chunkSize) - offset += chunkSize; - size -= chunkSize; + offset += chunkSize + size -= chunkSize } - fs.close({ fd }); + fs.close({ fd }) // console.log('buffer', buffer) - let info; + let info - const maxGaussians = this.data.maxGaussians; + const maxGaussians = this.data.maxGaussians switch (type) { case 'ply': - info = loadPly(buffer, maxGaussians); - console.log("plyLoader return", info); - break; + info = loadPly(buffer, maxGaussians) + console.log('plyLoader return', info) + break case 'splat': - info = loadSplat(buffer, maxGaussians); - console.log("splatLoader return", info); - break; + info = loadSplat(buffer, maxGaussians) + console.log('splatLoader return', info) + break } // 提供渲染的高斯球数 - const renderCount = this.renderCount = info.count; + const renderCount = this.renderCount = info.count // 全部用 f32 存储 // this.sabPositions = wx.createSharedArrayBuffer(renderCount * 4 * 3) @@ -327,10 +326,9 @@ Component({ // sabCov3Da: this.sabCov3Da, // sabCov3Db: this.sabCov3Db, // sabcolors: this.sabcolors, - }); - + }) } else { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', @@ -340,7 +338,7 @@ Component({ } }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', @@ -348,7 +346,7 @@ Component({ }) console.error(res) } - }); + }) }, initWorker(plyInfo, config) { @@ -360,15 +358,13 @@ Component({ // worker 初始化 回调 console.log('[Worker callback] gaussianSplatting init callBack', res) - this.camera.isWorkerInit = true; - this.camera.update(); - - + this.camera.isWorkerInit = true + this.camera.update() } else if (res.type === 'execFunc_sort') { // worker 排序 回调 // console.log(res) - this.camera.isWorkerSorting = false; + this.camera.isWorkerSorting = false const data = res.result.data @@ -381,11 +377,11 @@ Component({ gl.bufferData(gl.ARRAY_BUFFER, data, gl.DYNAMIC_DRAW) } - const positions = new Float32Array(data.positions); - const opacities = new Float32Array(data.opacities); - const cov3Da = new Float32Array(data.cov3Da); - const cov3Db = new Float32Array(data.cov3Db); - const colors = new Float32Array(data.colors); + const positions = new Float32Array(data.positions) + const opacities = new Float32Array(data.opacities) + const cov3Da = new Float32Array(data.cov3Da) + const cov3Db = new Float32Array(data.cov3Db) + const colors = new Float32Array(data.colors) // const positions = new Float32Array(this.sabPositions.buffer); // const opacities = new Float32Array(this.sabOpacities.buffer); @@ -400,13 +396,13 @@ Component({ updateBuffer(this.splat.buffers.color, colors) // 设定绘制的高斯球数量 - this.gaussiansCount = data.gaussiansCount; + this.gaussiansCount = data.gaussiansCount const end = new Date().getTime() // const sortTime = `${((end - start)/1000).toFixed(3)}s` // console.log(`updateBuffer ${sortTime}`) - this.canvas.requestAnimationFrame(this.requestRender.bind(this)); + this.canvas.requestAnimationFrame(this.requestRender.bind(this)) // console.log('execFunc_sort end') } @@ -421,14 +417,14 @@ Component({ // 后续为 webGL2 相关,为了方便开发,先放在一起 initWebGL2() { console.log('== InitWebGL2 start ==') - const gl = this.gl = this.canvas.getContext('webgl2'); - console.log('webgl2 context', gl); + const gl = this.gl = this.canvas.getContext('webgl2') + console.log('webgl2 context', gl) // Setup Camera const cameraParameters = { up: [0, 1.0, 0.0], target: [0, 0, 0], - camera: [Math.PI/2, Math.PI/2, 1], // theta phi radius + camera: [Math.PI / 2, Math.PI / 2, 1], // theta phi radius } this.camera = new CameraWebGL(gl, this.worker, cameraParameters) @@ -436,102 +432,98 @@ Component({ this.cubeInstance = new CubeInstanceWebGL(gl) // Setup Splat - this.initSplat(gl); - - + this.initSplat(gl) }, initSplat(gl) { // 初始化 splat 绘制到的 renderTexture - this.splatRT = new SplatRenderTexture(gl); + this.splatRT = new SplatRenderTexture(gl) // 初始化 splat 渲染器 - this.splat = new SplatWebGL(gl); + this.splat = new SplatWebGL(gl) }, requestRender() { // console.log('requestRender') // 限帧 - let now = Date.now() - const last = this.lastRenderTime || 0; + const now = Date.now() + const last = this.lastRenderTime || 0 const mill = now - last if (mill < 30) { return } this.lastRenderTime = now - - const gl = this.gl; + + const gl = this.gl // Clear State gl.viewport(0, 0, gl.canvas.width, gl.canvas.height) - gl.bindFramebuffer(gl.FRAMEBUFFER, null); - gl.clearColor(0.8, 0.8, 0.8, 1.0); + gl.bindFramebuffer(gl.FRAMEBUFFER, null) + gl.clearColor(0.8, 0.8, 0.8, 1.0) // clear - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); + gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT) // 先关掉深度测试 gl.disable(gl.DEPTH_TEST) - this.drawSplat(gl); + this.drawSplat(gl) // resetState - gl.disable(gl.CULL_FACE); + gl.disable(gl.CULL_FACE) // 深度测试 gl.enable(gl.DEPTH_TEST) // drawCubeMesh - const projMatrix = this.camera.projMatrix; - const viewMatrix = this.camera.viewMatrix; - let modelMatrix = mat4.create(); - const cubeScale = 0.02; + const projMatrix = this.camera.projMatrix + const viewMatrix = this.camera.viewMatrix + const modelMatrix = mat4.create() + const cubeScale = 0.02 mat4.scale(modelMatrix, mat4.create(), [cubeScale, cubeScale, cubeScale]) this.drawCubeMesh(gl, projMatrix, viewMatrix, modelMatrix) - }, drawCubeMesh(gl, projMatrix, viewMatrix, modelMatrix) { // mesh const meshCube = this.cubeInstance // Tell WebGL to use our program when drawing - gl.useProgram(meshCube.programInfo.program); + gl.useProgram(meshCube.programInfo.program) // VAO - gl.bindVertexArray(meshCube.vao); + gl.bindVertexArray(meshCube.vao) // mesh position - gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.positionBuffer); - gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexPosition); + gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.positionBuffer) + gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexPosition) // mesh color - gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.colorBuffer); - gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexColor, 4, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexColor); + gl.bindBuffer(gl.ARRAY_BUFFER, meshCube.colorBuffer) + gl.vertexAttribPointer(meshCube.programInfo.attribLocations.vertexColor, 4, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(meshCube.programInfo.attribLocations.vertexColor) // Tell WebGL which indices to use to index the vertices - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, meshCube.indices); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, meshCube.indices) // Set the shader uniforms gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.projectionMatrix, false, projMatrix - ); + ) gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.viewMatrix, false, viewMatrix - ); + ) gl.uniformMatrix4fv( meshCube.programInfo.uniformLocations.modelMatrix, false, modelMatrix - ); + ) // draw - const vertexCount = 36; - const type = gl.UNSIGNED_SHORT; - const offset = 0; - gl.drawElements(gl.TRIANGLES, vertexCount, type, offset); + const vertexCount = 36 + const type = gl.UNSIGNED_SHORT + const offset = 0 + gl.drawElements(gl.TRIANGLES, vertexCount, type, offset) }, drawSplat(gl) { - // 通用准备 const cam = this.camera @@ -541,10 +533,10 @@ Component({ const splatRTFrameBuffer = this.splatRT.frameBuffer gl.viewport(0, 0, gl.canvas.width, gl.canvas.height) - gl.bindFramebuffer(gl.FRAMEBUFFER, splatRTFrameBuffer); + gl.bindFramebuffer(gl.FRAMEBUFFER, splatRTFrameBuffer) - gl.clearColor(0, 0, 0, 0.0); - gl.clear(gl.COLOR_BUFFER_BIT); + gl.clearColor(0, 0, 0, 0.0) + gl.clear(gl.COLOR_BUFFER_BIT) // Set Splat state gl.disable(gl.DEPTH_TEST) @@ -556,11 +548,11 @@ Component({ // 开启 Splat 绘制流程 const splat = this.splat - const program = splat.program; + const program = splat.program // Use Program - gl.useProgram(program); + gl.useProgram(program) // VAO - gl.bindVertexArray(splat.vao); + gl.bindVertexArray(splat.vao) // Original implementation parameters const canvasWidth = gl.canvas.width @@ -583,32 +575,31 @@ Component({ // gl.uniformMatrix4fv(gl.getUniformLocation(program, 'viewmatrix'), false, cam.vm) // Draw Splat - gl.drawArraysInstanced(gl.TRIANGLE_STRIP, 0, 4, this.gaussiansCount); + gl.drawArraysInstanced(gl.TRIANGLE_STRIP, 0, 4, this.gaussiansCount) // resetState gl.enable(gl.BLEND) gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) // 最后将RT绘制 到 主屏 - gl.bindFramebuffer(gl.FRAMEBUFFER, null); + gl.bindFramebuffer(gl.FRAMEBUFFER, null) - gl.useProgram(splatRT.programInfo.program); + gl.useProgram(splatRT.programInfo.program) // VAO - gl.bindVertexArray(splatRT.vao); + gl.bindVertexArray(splatRT.vao) // position - gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.position); - gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexPosition); + gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.position) + gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexPosition, 3, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexPosition) // texCoord - gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.texCoord); - gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0); - gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexTexcoord); + gl.bindBuffer(gl.ARRAY_BUFFER, splatRT.buffers.texCoord) + gl.vertexAttribPointer(splatRT.programInfo.attribLocations.vertexTexcoord, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(splatRT.programInfo.attribLocations.vertexTexcoord) // indices - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, splatRT.buffers.indices); + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, splatRT.buffers.indices) // draw RenderTexture - gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0); - + gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0) }, // webGL触摸相关逻辑 onTouchStartWebGL(e) { @@ -617,31 +608,30 @@ Component({ if (e.touches.length === 1) { this.camera.lastTouch.x1 = e.touches[0].clientX this.camera.lastTouch.y1 = e.touches[0].clientY - this.camera.lastTouch.x2 = null; - this.camera.lastTouch.y2 = null; - this.camera.lastTouch.distance = 0; + this.camera.lastTouch.x2 = null + this.camera.lastTouch.y2 = null + this.camera.lastTouch.distance = 0 } else if (e.touches.length === 2) { - const touch1 = e.touches[0]; - const touch2 = e.touches[1]; + const touch1 = e.touches[0] + const touch2 = e.touches[1] this.camera.lastTouch.x1 = touch1.clientX this.camera.lastTouch.y1 = touch1.clientY this.camera.lastTouch.x2 = touch2.clientX this.camera.lastTouch.y2 = touch2.clientY - const distanceX = touch1.clientX - touch2.clientX; - const distanceY = touch1.clientY - touch2.clientY; - this.camera.lastTouch.distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY); + const distanceX = touch1.clientX - touch2.clientX + const distanceY = touch1.clientY - touch2.clientY + this.camera.lastTouch.distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY) } - }, onTouchMoveWebGL(e) { // console.log(e); - const moveScale = 1; + const moveScale = 1 if (e.touches.length === 1) { - const touch = e.touches[0]; + const touch = e.touches[0] // 单指移动镜头 const movementX = touch.clientX - this.camera.lastTouch.x1 const movementY = touch.clientY - this.camera.lastTouch.y1 @@ -650,18 +640,17 @@ Component({ if (Math.abs(movementX) < 50 && Math.abs(movementY) < 50) { // 只处理小移动 - this.camera.theta += movementX * 0.01 * .3 * moveScale - this.camera.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.camera.phi - movementY * 0.01 * moveScale)) + this.camera.theta += movementX * 0.01 * 0.3 * moveScale + this.camera.phi = Math.max(1e-6, Math.min(Math.PI - 1e-6, this.camera.phi - movementY * 0.01 * moveScale)) } - } else if (e.touches.length === 2) { // 支持单指变双指,兼容双指操作但是两根手指触屏时间不一致的情况 - const touch1 = e.touches[0]; - const touch2 = e.touches[1]; + const touch1 = e.touches[0] + const touch2 = e.touches[1] - const distanceX = touch1.clientX - touch2.clientX; - const distanceY = touch1.clientY - touch2.clientY; - const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY); + const distanceX = touch1.clientX - touch2.clientX + const distanceY = touch1.clientY - touch2.clientY + const distance = Math.sqrt(distanceX * distanceX + distanceY * distanceY) if (this.camera.lastTouch.x2 === null && this.camera.lastTouch.y2 === null) { this.camera.lastTouch.x1 = touch1.clientX @@ -669,52 +658,50 @@ Component({ this.camera.lastTouch.x2 = touch2.clientX this.camera.lastTouch.y2 = touch2.clientY - this.camera.lastTouch.distance = distance; + this.camera.lastTouch.distance = distance } else { // 双指开始滑动 - let deltaScale = distance - this.camera.lastTouch.distance; - this.camera.lastTouch.distance = distance; + let deltaScale = distance - this.camera.lastTouch.distance + this.camera.lastTouch.distance = distance if (deltaScale < -2) { - deltaScale = -2; + deltaScale = -2 } else if (deltaScale > 2) { - deltaScale = 2; + deltaScale = 2 } - const newRaidus = this.camera.radius - deltaScale * 0.2; - this.camera.radius = newRaidus > 0 ? newRaidus: this.camera.radius; + const newRaidus = this.camera.radius - deltaScale * 0.2 + this.camera.radius = newRaidus > 0 ? newRaidus : this.camera.radius } - } - - this.camera.update(); - this.canvas.requestAnimationFrame(this.requestRender.bind(this)); + this.camera.update() + + this.canvas.requestAnimationFrame(this.requestRender.bind(this)) }, onTapControl(e) { - const dataSet = e.target.dataset; - - const id = dataSet.id; - + const dataSet = e.target.dataset + + const id = dataSet.id + // 开始处理 ply 资源 - this.initPLY(id); + this.initPLY(id) }, changeMaxGaussianCount(e) { this.setData({ maxGaussians: e.detail.value }) - console.log('slider maxGaussians:', this.data.maxGaussians); + console.log('slider maxGaussians:', this.data.maxGaussians) }, switchWorker(e) { this.setData({ workerOn: e.detail.value }) - this.camera.setWorkerOn(this.data.workerOn); + this.camera.setWorkerOn(this.data.workerOn) - console.log('switch WorkerOn:', this.data.workerOn); + console.log('switch WorkerOn:', this.data.workerOn) } }, }) - diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/ply/ply-loader.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/ply/ply-loader.js index fa0cee0e..7668bd31 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/ply/ply-loader.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/ply/ply-loader.js @@ -2,119 +2,122 @@ import { wxDecodeAdapter, computeCov3D } from '../util-loader.js' // implementation from https://github.com/kishimisu/Gaussian-Splatting-WebGL export function loadPly(content, maxGaussians) { - // Read header - console.log('loadPly', content) - const contentStart = wxDecodeAdapter(content.slice(0, 2000), true); - // const contentStart = new TextDecoder('utf-8').decode(content.slice(0, 2000)) - const headerEnd = contentStart.indexOf('end_header') + 'end_header'.length + 1 - const [ header ] = contentStart.split('end_header') + // Read header + console.log('loadPly', content) + const contentStart = wxDecodeAdapter(content.slice(0, 2000), true) + // const contentStart = new TextDecoder('utf-8').decode(content.slice(0, 2000)) + const headerEnd = contentStart.indexOf('end_header') + 'end_header'.length + 1 + const [header] = contentStart.split('end_header') - console.log('header', header) + console.log('header', header) - // Get number of gaussians - const regex = /element vertex (\d+)/ - const match = header.match(regex) - let gaussianCount = parseInt(match[1]) + // Get number of gaussians + const regex = /element vertex (\d+)/ + const match = header.match(regex) + let gaussianCount = parseInt(match[1]) - console.log(`load splatCount: ${gaussianCount}`) + console.log(`load splatCount: ${gaussianCount}`) - gaussianCount = Math.min(gaussianCount, maxGaussians); + gaussianCount = Math.min(gaussianCount, maxGaussians) - // Create arrays for gaussian properties - const positions = [] - const opacities = [] - const colors = [] - const cov3Ds = [] + // Create arrays for gaussian properties + const positions = [] + const opacities = [] + const colors = [] + const cov3Ds = [] - // Helpers - const sigmoid = (m1) => 1 / (1 + Math.exp(-m1)) - const NUM_PROPS = 62 + // Helpers + const sigmoid = (m1) => 1 / (1 + Math.exp(-m1)) + const NUM_PROPS = 62 - // Create a dataview to access the buffer's content on a byte levele - const view = new DataView(content) + // Create a dataview to access the buffer's content on a byte levele + const view = new DataView(content) - // Get a slice of the dataview relative to a splat index - const fromDataView = (splatID, start, end) => { - const startOffset = headerEnd + splatID * NUM_PROPS * 4 + start * 4 + // Get a slice of the dataview relative to a splat index + const fromDataView = (splatID, start, end) => { + const startOffset = headerEnd + splatID * NUM_PROPS * 4 + start * 4 - if (end == null) - return view.getFloat32(startOffset, true) + if (end == null) return view.getFloat32(startOffset, true) - return new Float32Array(end - start).map((_, i) => view.getFloat32(startOffset + i * 4, true)) - } + return new Float32Array(end - start).map((_, i) => view.getFloat32(startOffset + i * 4, true)) + } - // Extract all properties for a gaussian splat using the dataview - const extractSplatData = (splatID) => { - const position = fromDataView(splatID, 0, 3) - // const n = fromDataView(splatID, 3, 6) // Not used - const harmonic = fromDataView(splatID, 6, 9) - - const H_END = 6 + 48 // Offset of the last harmonic coefficient - const opacity = fromDataView(splatID, H_END) - const scale = fromDataView(splatID, H_END + 1, H_END + 4) - const rotation = fromDataView(splatID, H_END + 4, H_END + 8) - - return { position, harmonic, opacity, scale, rotation } - } + // Extract all properties for a gaussian splat using the dataview + const extractSplatData = (splatID) => { + const position = fromDataView(splatID, 0, 3) + // const n = fromDataView(splatID, 3, 6) // Not used + const harmonic = fromDataView(splatID, 6, 9) - // gaussianCount = 10; - - for (let i = 0; i < gaussianCount; i++) { - // Extract data for current gaussian - let { position, harmonic, opacity, scale, rotation } = extractSplatData(i) - - // Normalize quaternion - let length2 = 0 - - for (let j = 0; j < 4; j++) - length2 += rotation[j] * rotation[j] - - const length = Math.sqrt(length2) - - // console.log('scale', scale[0], scale[1], scale[2]); - // console.log('rotation', rotation[0], rotation[1], rotation[2], rotation[3]); - - rotation = rotation.map(v => v / length) - - // Exponentiate scale - scale = scale.map(v => Math.exp(v)) - - // console.log('scalee', scale[0], scale[1], scale[2]); - // console.log('rotatione', rotation[0], rotation[1], rotation[2], rotation[3]); - - // Activate alpha - opacity = sigmoid(opacity) - opacities.push(opacity) - - // (Webgl-specific) Equivalent to computeColorFromSH() with degree 0: - // Use the first spherical harmonic to pre-compute the color. - // This allow to avoid sending harmonics to the web worker or GPU, - // but removes view-dependent lighting effects like reflections. - // If we were to use a degree > 0, we would need to recompute the color - // each time the camera moves, and send many more harmonics to the worker: - // Degree 1: 4 harmonics needed (12 floats) per gaussian - // Degree 2: 9 harmonics needed (27 floats) per gaussian - // Degree 3: 16 harmonics needed (48 floats) per gaussian - const SH_C0 = 0.28209479177387814 - const color = [ - 0.5 + SH_C0 * harmonic[0], - 0.5 + SH_C0 * harmonic[1], - 0.5 + SH_C0 * harmonic[2] - ] - colors.push(...color) - // harmonics.push(...harmonic) - - // (Webgl-specific) Pre-compute the 3D covariance matrix from - // the rotation and scale in order to avoid recomputing it at each frame. - // This also allow to avoid sending rotations and scales to the web worker or GPU. - const cov3D = computeCov3D(scale, 1, rotation) - cov3Ds.push(...cov3D) - // rotations.push(...rotation) - // scales.push(...scale) - - positions.push(...position) - } + const H_END = 6 + 48 // Offset of the last harmonic coefficient + const opacity = fromDataView(splatID, H_END) + const scale = fromDataView(splatID, H_END + 1, H_END + 4) + const rotation = fromDataView(splatID, H_END + 4, H_END + 8) - - return { positions, opacities, colors, cov3Ds, count: gaussianCount } -} \ No newline at end of file + return { + position, harmonic, opacity, scale, rotation + } + } + + // gaussianCount = 10; + + for (let i = 0; i < gaussianCount; i++) { + // Extract data for current gaussian + let { + position, harmonic, opacity, scale, rotation + } = extractSplatData(i) + + // Normalize quaternion + let length2 = 0 + + for (let j = 0; j < 4; j++) length2 += rotation[j] * rotation[j] + + const length = Math.sqrt(length2) + + // console.log('scale', scale[0], scale[1], scale[2]); + // console.log('rotation', rotation[0], rotation[1], rotation[2], rotation[3]); + + rotation = rotation.map(v => v / length) + + // Exponentiate scale + scale = scale.map(v => Math.exp(v)) + + // console.log('scalee', scale[0], scale[1], scale[2]); + // console.log('rotatione', rotation[0], rotation[1], rotation[2], rotation[3]); + + // Activate alpha + opacity = sigmoid(opacity) + opacities.push(opacity) + + // (Webgl-specific) Equivalent to computeColorFromSH() with degree 0: + // Use the first spherical harmonic to pre-compute the color. + // This allow to avoid sending harmonics to the web worker or GPU, + // but removes view-dependent lighting effects like reflections. + // If we were to use a degree > 0, we would need to recompute the color + // each time the camera moves, and send many more harmonics to the worker: + // Degree 1: 4 harmonics needed (12 floats) per gaussian + // Degree 2: 9 harmonics needed (27 floats) per gaussian + // Degree 3: 16 harmonics needed (48 floats) per gaussian + const SH_C0 = 0.28209479177387814 + const color = [ + 0.5 + SH_C0 * harmonic[0], + 0.5 + SH_C0 * harmonic[1], + 0.5 + SH_C0 * harmonic[2] + ] + colors.push(...color) + // harmonics.push(...harmonic) + + // (Webgl-specific) Pre-compute the 3D covariance matrix from + // the rotation and scale in order to avoid recomputing it at each frame. + // This also allow to avoid sending rotations and scales to the web worker or GPU. + const cov3D = computeCov3D(scale, 1, rotation) + cov3Ds.push(...cov3D) + // rotations.push(...rotation) + // scales.push(...scale) + + positions.push(...position) + } + + return { + positions, opacities, colors, cov3Ds, count: gaussianCount + } +} diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/splat/splat-loader.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/splat/splat-loader.js index ec4e87de..22fb9747 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/splat/splat-loader.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/splat/splat-loader.js @@ -1,15 +1,15 @@ import { wxDecodeAdapter, computeCov3D } from '../util-loader.js' -const RowSizeBytes = 32; -const CenterSizeBytes = 12; -const ScaleSizeBytes = 12; -const RotationSizeBytes = 4; -const ColorSizeBytes = 4; +const RowSizeBytes = 32 +const CenterSizeBytes = 12 +const ScaleSizeBytes = 12 +const RotationSizeBytes = 4 +const ColorSizeBytes = 4 -const perPI = Math.PI / 180; +const perPI = Math.PI / 180 export function loadSplat(content, maxGaussians) { - console.log('loadSplat', content); + console.log('loadSplat', content) const start = new Date().getTime() @@ -19,12 +19,12 @@ export function loadSplat(content, maxGaussians) { const colors = [] const cov3Ds = [] - const inBuffer = content; + const inBuffer = content - let splatCount = inBuffer.byteLength / RowSizeBytes; + let splatCount = inBuffer.byteLength / RowSizeBytes console.log(`load splatCount: ${splatCount}`) - splatCount = Math.min(splatCount, maxGaussians); + splatCount = Math.min(splatCount, maxGaussians) // splatCount = 10; @@ -34,32 +34,30 @@ export function loadSplat(content, maxGaussians) { // XYZ - Scale (Float32) // RGBA - colors (uint8) // IJKL - quaternion/rot (uint8) - const inBase = i * RowSizeBytes; + const inBase = i * RowSizeBytes - const inCenter = new Float32Array(inBuffer, inBase, 3); - const inScale = new Float32Array(inBuffer, inBase + CenterSizeBytes, 3); - const inColor = new Uint8Array(inBuffer, inBase + CenterSizeBytes + ScaleSizeBytes, 4); - let inRotation = new Uint8Array(inBuffer, inBase + CenterSizeBytes + - ScaleSizeBytes + ColorSizeBytes, 4); + const inCenter = new Float32Array(inBuffer, inBase, 3) + const inScale = new Float32Array(inBuffer, inBase + CenterSizeBytes, 3) + const inColor = new Uint8Array(inBuffer, inBase + CenterSizeBytes + ScaleSizeBytes, 4) + const inRotation = new Uint8Array(inBuffer, inBase + CenterSizeBytes + + ScaleSizeBytes + ColorSizeBytes, 4) - let rotation = [(inRotation[0] - 128) / 128, (inRotation[1] - 128) / 128, (inRotation[2] - 128) / 128, (inRotation[3] - 128) / 128]; + let rotation = [(inRotation[0] - 128) / 128, (inRotation[1] - 128) / 128, (inRotation[2] - 128) / 128, (inRotation[3] - 128) / 128] // Normalize quaternion let length2 = 0 - for (let j = 0; j < 4; j++) - length2 += rotation[j] * rotation[j] + for (let j = 0; j < 4; j++) length2 += rotation[j] * rotation[j] const length = Math.sqrt(length2) - rotation = rotation.map(v => v / length) + rotation = rotation.map(v => v / length) // console.log('scale', inScale[0], inScale[1], inScale[2]); // console.log('rotation', rotation[0], rotation[1], rotation[2], rotation[3]); - // Activate alpha const opacity = inColor[3] / 255 - opacities.push(opacity); - colors.push(inColor[0] / 255, inColor[1]/ 255, inColor[2] / 255); + opacities.push(opacity) + colors.push(inColor[0] / 255, inColor[1] / 255, inColor[2] / 255) const cov3D = computeCov3D(inScale, 1, rotation) cov3Ds.push(...cov3D) @@ -67,11 +65,12 @@ export function loadSplat(content, maxGaussians) { positions.push(...inCenter) } - const end = new Date().getTime(); + const end = new Date().getTime() - const sortTime = `${((end - start)/1000).toFixed(3)}s` + const sortTime = `${((end - start) / 1000).toFixed(3)}s` console.log(`parse ${splatCount} gaussians in ${sortTime}.`) - return { positions, opacities, colors, cov3Ds, count: splatCount }; - -} \ No newline at end of file + return { + positions, opacities, colors, cov3Ds, count: splatCount + } +} diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/util-loader.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/util-loader.js index be44e540..e92726ab 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/util-loader.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/loaders/util-loader.js @@ -8,57 +8,70 @@ const M = mat3.create() const Sigma = mat3.create() function computeCov3D(scale, mod, rot) { - // Create scaling matrix - mat3.set(S, - mod * scale[0], 0, 0, - 0, mod * scale[1], 0, - 0, 0, mod * scale[2] - ) + // Create scaling matrix + mat3.set( + S, + mod * scale[0], + 0, + 0, + 0, + mod * scale[1], + 0, + 0, + 0, + mod * scale[2] + ) - const r = rot[0] - const x = rot[1] - const y = rot[2] - const z = rot[3] + const r = rot[0] + const x = rot[1] + const y = rot[2] + const z = rot[3] - // Compute rotation matrix from quaternion - mat3.set(R, - 1. - 2. * (y * y + z * z), 2. * (x * y - r * z), 2. * (x * z + r * y), - 2. * (x * y + r * z), 1. - 2. * (x * x + z * z), 2. * (y * z - r * x), - 2. * (x * z - r * y), 2. * (y * z + r * x), 1. - 2. * (x * x + y * y) - ) + // Compute rotation matrix from quaternion + mat3.set( + R, + 1.0 - 2.0 * (y * y + z * z), + 2.0 * (x * y - r * z), + 2.0 * (x * z + r * y), + 2.0 * (x * y + r * z), + 1.0 - 2.0 * (x * x + z * z), + 2.0 * (y * z - r * x), + 2.0 * (x * z - r * y), + 2.0 * (y * z + r * x), + 1.0 - 2.0 * (x * x + y * y) + ) - mat3.multiply(M, S, R) // M = S * R + mat3.multiply(M, S, R) // M = S * R - // Compute 3D world covariance matrix Sigma - mat3.multiply(Sigma, mat3.transpose(tmp, M), M) // Sigma = transpose(M) * M + // Compute 3D world covariance matrix Sigma + mat3.multiply(Sigma, mat3.transpose(tmp, M), M) // Sigma = transpose(M) * M - // Covariance is symmetric, only store upper right - const cov3D = [ - Sigma[0], Sigma[1], Sigma[2], - Sigma[4], Sigma[5], Sigma[8] - ] - return cov3D + // Covariance is symmetric, only store upper right + const cov3D = [ + Sigma[0], Sigma[1], Sigma[2], + Sigma[4], Sigma[5], Sigma[8] + ] + return cov3D } function wxDecodeAdapter(buffer, isUTF8) { - const array = new Uint8Array(buffer); - let str = ''; + const array = new Uint8Array(buffer) + let str = '' for (let i = 0; i < array.length; i++) { - str += String.fromCharCode(array[i]); + str += String.fromCharCode(array[i]) } if (isUTF8) { // utf8 str fix // https://developer.mozilla.org/zh-CN/docs/Web/API/WindowBase64/btoa - str = decodeURIComponent(encodeURIComponent(str)); + str = decodeURIComponent(encodeURIComponent(str)) } - return str; + return str } - export { - wxDecodeAdapter, - computeCov3D -} \ No newline at end of file + wxDecodeAdapter, + computeCov3D +} diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/util/render-xrframe.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/util/render-xrframe.js index 2c0a88c9..1567db70 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/util/render-xrframe.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/util/render-xrframe.js @@ -1,52 +1,40 @@ -import splat_vs from "./shader/splat_xrframe_vs.glsl"; -import splat_fs from "./shader/splat_xrframe_fs.glsl"; +import splat_vs from './shader/splat_xrframe_vs.glsl' +import splat_fs from './shader/splat_xrframe_fs.glsl' const xrFrameRender = { - // 对应案例的初始化逻辑,由统一的 behavior 触发 - init() { - console.log('start init ply'); - - const plySrc = 'http://10.9.233.66:8000/ply/point_cloud.ply'; - - const filePath = wx.env.USER_DATA_PATH + '/point.ply'; - wx.downloadFile({ - filePath: filePath, - url: plySrc, - success: (res) => { - console.log("下载回调", res); - const fs = wx.getFileSystemManager() - fs.readFile({ - filePath: res.filePath, - position: 0, - success: async (res) => { - console.log("读文件回调,结果返回为", res) - - // const plyInfo = plyLoader.parsePLYBuffer(res.data); - - const plyInfo = loadPly(res.data); - - console.log("plyLoader return", plyInfo); - - // 初始化 worker 相关 - this._worker.postMessage({ - type: 'execFunc_init', - params: [plyInfo] - }) - - }, - fail(res) { - wx.hideLoading(); - wx.showToast({ - title: res.errMsg, - icon: 'none', - duration: 2000 - }) - console.error(res) - } - }); + // 对应案例的初始化逻辑,由统一的 behavior 触发 + init() { + console.log('start init ply') + + const plySrc = 'http://10.9.233.66:8000/ply/point_cloud.ply' + + const filePath = wx.env.USER_DATA_PATH + '/point.ply' + wx.downloadFile({ + filePath, + url: plySrc, + success: (res) => { + console.log('下载回调', res) + const fs = wx.getFileSystemManager() + fs.readFile({ + filePath: res.filePath, + position: 0, + success: async (res) => { + console.log('读文件回调,结果返回为', res) + + // const plyInfo = plyLoader.parsePLYBuffer(res.data); + + const plyInfo = loadPly(res.data) + + console.log('plyLoader return', plyInfo) + + // 初始化 worker 相关 + this._worker.postMessage({ + type: 'execFunc_init', + params: [plyInfo] + }) }, fail(res) { - wx.hideLoading(); + wx.hideLoading() wx.showToast({ title: res.errMsg, icon: 'none', @@ -54,259 +42,255 @@ const xrFrameRender = { }) console.error(res) } - }); - - - // 监听worker回调 - this._worker.onMessage((res) => { - if (res.type === 'execFunc_init') { - // 初始化 worker 回调 - console.log('gaussianSplatting init callBack') - console.log('res', res); - - this.initGSGeometry(res.result.count, res.result.vertexSize); - - } else if (res.type === 'execFunc_sort') { - // worker 排序 回调 - // console.log('gaussianSplatting sort callBack', res.result) - - // const vb = getVertexBuffer(this.vertexData); - - this.geometryGeo.uploadVertexBuffer(0, res.result.vertexBuffer); - - // console.log('sort callback', this.geometryGeo, res.result.vertexBuffer) - } }) - - }, - initGSGeometry(gaussianCount, vertexSize){ - console.log('initGSGeometry start'); - - const xrFrameSystem = wx.getXrFrameSystem() - const createGSEffect = (scene) => { - return scene.createEffect({ - name: 'gaussianSplatting', - defaultRenderQueue: 3000, - properties: [ - { - key: 'screen_width', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - }, - { - key: 'screen_height', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - }, - { - key: 'focal_x', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - }, - { - key: 'focal_y', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - }, - { - key: 'tan_fovx', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - }, - { - key: 'tan_fovy', - type: xrFrameSystem.EUniformType.FLOAT, - default: 0 - } - ,{ - key: 'scale_modifier', - type: xrFrameSystem.EUniformType.FLOAT, - default: 1 - }, - ], - images: [], - passes: [ - { - renderStates: { - blendOn: true, - depthWrite: false, - cullOn: false, - }, - lightMode: 'ForwardBase', - useMaterialRenderStates: true, - shaders: [0, 1] - } - ], - shaders: [ - // Vertex Shader - splat_vs, - // Fragement Shader - splat_fs - ], - }); - } - - this.geometryRoot = this.xrScene.getElementById('geometryRoot'); - - console.log('geometryRoot', this.geometryRoot); - - - // 注册 Geometry 信息 - xrFrameSystem.registerGeometry('gaussian-splatting', scene => { - console.log('registerGeometry') - const vl = scene.createVertexLayout({ - attributes: [ - { - name: "a_center", - format: xrFrameSystem.EVertexFormat.FLOAT3, - offset: 0, - }, - { - name: "a_opacity", - format: xrFrameSystem.EVertexFormat.FLOAT, - offset: 12, - }, - { - name: "a_cov3Da", - format: xrFrameSystem.EVertexFormat.FLOAT3, - offset: 16, - }, - { - name: "a_cov3Db", - format: xrFrameSystem.EVertexFormat.FLOAT3, - offset: 28, - }, - { - name: "a_color", - format: xrFrameSystem.EVertexFormat.FLOAT3, - offset: 40, - }, - { - name: "a_corner", - format: xrFrameSystem.EVertexFormat.FLOAT2, - offset: 52, - }, - ], - stride: 60 - }); - - console.log('createVertexLayout'); - - const indices = []; - const verticesPerInstance = 4; - const instanceCount = gaussianCount / verticesPerInstance; - for (let i = 0; i < instanceCount; i++) { - // 对于每个实例,添加6个索引以形成2个三角形 - const base = i * 4; // 每个实例的基础顶点索引 - // 第一个三角形 - indices.push(base, base + 1, base + 2); - // 第二个三角形 - indices.push(base + 2, base + 1, base + 3); - } - - console.log('indices', indices); - - // VertexBuffer IndexBuffer 不能动态更改长度,需要一开始设定较大的长度。 - const vb = new Float32Array(gaussianCount * vertexSize); - const ib = new Uint16Array(indices); - - console.log('vb', vb); - console.log('ib', ib); - - const geo = scene.createGeometry(vl, vb, ib); - - geo.setBoundBall(new xrFrameSystem.Vector3(), 1); - geo.addSubMesh(ib.length, 0, 0); - - return geo; - }); - - - console.log('gaussianSplatting geo'); - - xrFrameSystem.registerEffect('gaussianSplatting', createGSEffect); - - console.log('gaussianSplatting effect'); - - - this.geoElem = this.xrScene.createElement(xrFrameSystem.XRMesh, { - geometry: "gaussian-splatting", - position: "0 0 0", - scale: "0.2 0.2 0.2" - }); - this.geometryRoot.addChild(this.geoElem); - - - console.log('init geo end'); - - - // 延时保证挂载与初始化完毕 - setTimeout(()=>{ - this.meshGeo = this.geoElem.getComponent(xrFrameSystem.Mesh); - this.geometryGeo = this.meshGeo.geometry; - - this.matGeo = this.meshGeo.material; - - const gsMaterial = this.xrScene.createMaterial( - // 使用定制的效果 - this.xrScene.assets.getAsset('effect', 'gaussianSplatting') - ); - console.log('gsMaterial', gsMaterial) - - // 设定 绘制双面 - // gsMaterial.setRenderState("cullOn", false); - - const frameWidth = this.xrScene.frameWidth; - const frameHeight = this.xrScene.frameHeight; - const tan_fovy = Math.tan(60 / 180 * Math.PI * 0.5) - const tan_fovx = tan_fovy * frameWidth / frameHeight - const focal_y = frameHeight / (2 * tan_fovy) - const focal_x = frameWidth / (2 * tan_fovx) - - console.log('gsMaterial', gsMaterial); - - console.log('frameWidth', frameWidth); - console.log('frameHeight', frameHeight); - console.log('tan_fovy', tan_fovy); - console.log('tan_fovx', tan_fovx); - console.log('focal_y', focal_y); - console.log('focal_x', focal_x); - - // 设定屏幕相关uniform - gsMaterial.setFloat('screen_width', frameWidth); - gsMaterial.setFloat('screen_height', frameHeight); - gsMaterial.setFloat('tan_fovy', tan_fovy); - gsMaterial.setFloat('tan_fovx', tan_fovx); - gsMaterial.setFloat('focal_y', focal_y); - gsMaterial.setFloat('focal_x', focal_x); - - - this.meshGeo.material = gsMaterial; - - console.log('meshGeo'); - - // 初始化循环 - console.log('initRenderLoop'); - this.initRenderLoop(); - - }, 200); - }, - initRenderLoop() { - // this.loopTimer = setInterval(this.loop.bind(this), 2000); - this.loopTimer = setTimeout(this.loop.bind(this), 2000); - - }, - loop() { - // console.log(this.xrCamera._viewMatrix) - this._worker.postMessage({ - type: 'execFunc_sort', - params: [ - { - viewMatrix: this.xrCamera._viewMatrix - } - ] + fail(res) { + wx.hideLoading() + wx.showToast({ + title: res.errMsg, + icon: 'none', + duration: 2000 }) - + console.error(res) + } + }) + + // 监听worker回调 + this._worker.onMessage((res) => { + if (res.type === 'execFunc_init') { + // 初始化 worker 回调 + console.log('gaussianSplatting init callBack') + console.log('res', res) + + this.initGSGeometry(res.result.count, res.result.vertexSize) + } else if (res.type === 'execFunc_sort') { + // worker 排序 回调 + // console.log('gaussianSplatting sort callBack', res.result) + + // const vb = getVertexBuffer(this.vertexData); + + this.geometryGeo.uploadVertexBuffer(0, res.result.vertexBuffer) + + // console.log('sort callback', this.geometryGeo, res.result.vertexBuffer) + } + }) + }, + initGSGeometry(gaussianCount, vertexSize) { + console.log('initGSGeometry start') + + const xrFrameSystem = wx.getXrFrameSystem() + const createGSEffect = (scene) => scene.createEffect({ + name: 'gaussianSplatting', + defaultRenderQueue: 3000, + properties: [ + { + key: 'screen_width', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'screen_height', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'focal_x', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'focal_y', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'tan_fovx', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'tan_fovy', + type: xrFrameSystem.EUniformType.FLOAT, + default: 0 + }, + { + key: 'scale_modifier', + type: xrFrameSystem.EUniformType.FLOAT, + default: 1 + }, + ], + images: [], + passes: [ + { + renderStates: { + blendOn: true, + depthWrite: false, + cullOn: false, + }, + lightMode: 'ForwardBase', + useMaterialRenderStates: true, + shaders: [0, 1] + } + ], + shaders: [ + // Vertex Shader + splat_vs, + // Fragement Shader + splat_fs + ], + }) + + this.geometryRoot = this.xrScene.getElementById('geometryRoot') + + console.log('geometryRoot', this.geometryRoot) + + // 注册 Geometry 信息 + xrFrameSystem.registerGeometry('gaussian-splatting', scene => { + console.log('registerGeometry') + const vl = scene.createVertexLayout({ + attributes: [ + { + name: 'a_center', + format: xrFrameSystem.EVertexFormat.FLOAT3, + offset: 0, + }, + { + name: 'a_opacity', + format: xrFrameSystem.EVertexFormat.FLOAT, + offset: 12, + }, + { + name: 'a_cov3Da', + format: xrFrameSystem.EVertexFormat.FLOAT3, + offset: 16, + }, + { + name: 'a_cov3Db', + format: xrFrameSystem.EVertexFormat.FLOAT3, + offset: 28, + }, + { + name: 'a_color', + format: xrFrameSystem.EVertexFormat.FLOAT3, + offset: 40, + }, + { + name: 'a_corner', + format: xrFrameSystem.EVertexFormat.FLOAT2, + offset: 52, + }, + ], + stride: 60 + }) + + console.log('createVertexLayout') + + const indices = [] + const verticesPerInstance = 4 + const instanceCount = gaussianCount / verticesPerInstance + for (let i = 0; i < instanceCount; i++) { + // 对于每个实例,添加6个索引以形成2个三角形 + const base = i * 4 // 每个实例的基础顶点索引 + // 第一个三角形 + indices.push(base, base + 1, base + 2) + // 第二个三角形 + indices.push(base + 2, base + 1, base + 3) } -} \ No newline at end of file + + console.log('indices', indices) + + // VertexBuffer IndexBuffer 不能动态更改长度,需要一开始设定较大的长度。 + const vb = new Float32Array(gaussianCount * vertexSize) + const ib = new Uint16Array(indices) + + console.log('vb', vb) + console.log('ib', ib) + + const geo = scene.createGeometry(vl, vb, ib) + + geo.setBoundBall(new xrFrameSystem.Vector3(), 1) + geo.addSubMesh(ib.length, 0, 0) + + return geo + }) + + console.log('gaussianSplatting geo') + + xrFrameSystem.registerEffect('gaussianSplatting', createGSEffect) + + console.log('gaussianSplatting effect') + + this.geoElem = this.xrScene.createElement(xrFrameSystem.XRMesh, { + geometry: 'gaussian-splatting', + position: '0 0 0', + scale: '0.2 0.2 0.2' + }) + this.geometryRoot.addChild(this.geoElem) + + console.log('init geo end') + + // 延时保证挂载与初始化完毕 + setTimeout(() => { + this.meshGeo = this.geoElem.getComponent(xrFrameSystem.Mesh) + this.geometryGeo = this.meshGeo.geometry + + this.matGeo = this.meshGeo.material + + const gsMaterial = this.xrScene.createMaterial( + // 使用定制的效果 + this.xrScene.assets.getAsset('effect', 'gaussianSplatting') + ) + console.log('gsMaterial', gsMaterial) + + // 设定 绘制双面 + // gsMaterial.setRenderState("cullOn", false); + + const frameWidth = this.xrScene.frameWidth + const frameHeight = this.xrScene.frameHeight + const tan_fovy = Math.tan(60 / 180 * Math.PI * 0.5) + const tan_fovx = tan_fovy * frameWidth / frameHeight + const focal_y = frameHeight / (2 * tan_fovy) + const focal_x = frameWidth / (2 * tan_fovx) + + console.log('gsMaterial', gsMaterial) + + console.log('frameWidth', frameWidth) + console.log('frameHeight', frameHeight) + console.log('tan_fovy', tan_fovy) + console.log('tan_fovx', tan_fovx) + console.log('focal_y', focal_y) + console.log('focal_x', focal_x) + + // 设定屏幕相关uniform + gsMaterial.setFloat('screen_width', frameWidth) + gsMaterial.setFloat('screen_height', frameHeight) + gsMaterial.setFloat('tan_fovy', tan_fovy) + gsMaterial.setFloat('tan_fovx', tan_fovx) + gsMaterial.setFloat('focal_y', focal_y) + gsMaterial.setFloat('focal_x', focal_x) + + this.meshGeo.material = gsMaterial + + console.log('meshGeo') + + // 初始化循环 + console.log('initRenderLoop') + this.initRenderLoop() + }, 200) + }, + initRenderLoop() { + // this.loopTimer = setInterval(this.loop.bind(this), 2000); + this.loopTimer = setTimeout(this.loop.bind(this), 2000) + }, + loop() { + // console.log(this.xrCamera._viewMatrix) + this._worker.postMessage({ + type: 'execFunc_sort', + params: [ + { + viewMatrix: this.xrCamera._viewMatrix + } + ] + }) + } +} diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/cubeInstance-webGL.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/cubeInstance-webGL.js index e6dc34d0..56aa5d0a 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/cubeInstance-webGL.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/cubeInstance-webGL.js @@ -1,5 +1,4 @@ - -const cubeVertexShader = +const cubeVertexShader = ` attribute vec4 aVertexPosition; attribute vec4 aVertexColor; @@ -15,225 +14,221 @@ void main(void) { vColor = aVertexColor; } -`; +` -const cubeFragmentShader = +const cubeFragmentShader = ` varying lowp vec4 vColor; void main(void) { gl_FragColor = vColor; } -`; - +` class CubeInstanceWebGL { - - constructor(gl) { - - // -- Init Program - const shaderProgram = initShaderProgram(gl, cubeVertexShader, cubeFragmentShader) - - this.vao = gl.createVertexArray(); - gl.bindVertexArray(this.vao); - this.positionBuffer = this.initVertexBuffer(gl); - this.colorBuffer = this.initColorBuffer(gl); - this.indices = this.initIndexBuffer(gl); - - this.programInfo = { - program: shaderProgram, - attribLocations: { - vertexPosition: gl.getAttribLocation(shaderProgram, "aVertexPosition"), - vertexColor: gl.getAttribLocation(shaderProgram, "aVertexColor"), - }, - uniformLocations: { - projectionMatrix: gl.getUniformLocation( shaderProgram, "uProjectionMatrix"), - viewMatrix: gl.getUniformLocation(shaderProgram, "uViewMatrix"), - modelMatrix: gl.getUniformLocation(shaderProgram, "uModelMatrix"), - }, - }; - - // console.log('aVertexPosition', gl.getAttribLocation(shaderProgram, "aVertexPosition")) - // console.log('aVertexColor', gl.getAttribLocation(shaderProgram, "aVertexColor")) + constructor(gl) { + // -- Init Program + const shaderProgram = initShaderProgram(gl, cubeVertexShader, cubeFragmentShader) + + this.vao = gl.createVertexArray() + gl.bindVertexArray(this.vao) + this.positionBuffer = this.initVertexBuffer(gl) + this.colorBuffer = this.initColorBuffer(gl) + this.indices = this.initIndexBuffer(gl) + + this.programInfo = { + program: shaderProgram, + attribLocations: { + vertexPosition: gl.getAttribLocation(shaderProgram, 'aVertexPosition'), + vertexColor: gl.getAttribLocation(shaderProgram, 'aVertexColor'), + }, + uniformLocations: { + projectionMatrix: gl.getUniformLocation(shaderProgram, 'uProjectionMatrix'), + viewMatrix: gl.getUniformLocation(shaderProgram, 'uViewMatrix'), + modelMatrix: gl.getUniformLocation(shaderProgram, 'uModelMatrix'), + }, } - initVertexBuffer(gl) { - // Create a buffer for the square's positions. - const positionBuffer = gl.createBuffer(); + // console.log('aVertexPosition', gl.getAttribLocation(shaderProgram, "aVertexPosition")) + // console.log('aVertexColor', gl.getAttribLocation(shaderProgram, "aVertexColor")) + } + + initVertexBuffer(gl) { + // Create a buffer for the square's positions. + const positionBuffer = gl.createBuffer() - // Select the positionBuffer as the one to apply buffer - // operations to from here out. - gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); + // Select the positionBuffer as the one to apply buffer + // operations to from here out. + gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer) - const positions = [ - // Front face - -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, + const positions = [ + // Front face + -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, - // Back face - -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, + // Back face + -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, -1.0, - // Top face - -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, + // Top face + -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, - // Bottom face - -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, + // Bottom face + -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, - // Right face - 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, + // Right face + 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, - // Left face - -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, - ]; + // Left face + -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0, + ] - // Now pass the list of positions into WebGL to build the - // shape. We do this by creating a Float32Array from the - // JavaScript array, then use it to fill the current buffer. - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); + // Now pass the list of positions into WebGL to build the + // shape. We do this by creating a Float32Array from the + // JavaScript array, then use it to fill the current buffer. + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW) - return positionBuffer; - } + return positionBuffer + } - initColorBuffer(gl) { - const faceColors = [ - [1.0, 1.0, 1.0, 1.0], // Front face: white - [1.0, 0.0, 0.0, 1.0], // Back face: red - [0.0, 1.0, 0.0, 1.0], // Top face: green - [0.0, 0.0, 1.0, 1.0], // Bottom face: blue - [1.0, 1.0, 0.0, 1.0], // Right face: yellow - [1.0, 0.0, 1.0, 1.0], // Left face: purple - ]; - - // Convert the array of colors into a table for all the vertices. - - var colors = []; - - for (var j = 0; j < faceColors.length; ++j) { - const c = faceColors[j]; - // Repeat each color four times for the four vertices of the face - colors = colors.concat(c, c, c, c); - } - - const colorBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW); - - return colorBuffer; - } + initColorBuffer(gl) { + const faceColors = [ + [1.0, 1.0, 1.0, 1.0], // Front face: white + [1.0, 0.0, 0.0, 1.0], // Back face: red + [0.0, 1.0, 0.0, 1.0], // Top face: green + [0.0, 0.0, 1.0, 1.0], // Bottom face: blue + [1.0, 1.0, 0.0, 1.0], // Right face: yellow + [1.0, 0.0, 1.0, 1.0], // Left face: purple + ] + + // Convert the array of colors into a table for all the vertices. + + let colors = [] - initIndexBuffer(gl) { - const indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - - // This array defines each face as two triangles, using the - // indices into the vertex array to specify each triangle's - // position. - - const indices = [ - 0, - 1, - 2, - 0, - 2, - 3, // front - 4, - 5, - 6, - 4, - 6, - 7, // back - 8, - 9, - 10, - 8, - 10, - 11, // top - 12, - 13, - 14, - 12, - 14, - 15, // bottom - 16, - 17, - 18, - 16, - 18, - 19, // right - 20, - 21, - 22, - 20, - 22, - 23, // left - ]; - - // Now send the element array to GL - - gl.bufferData( - gl.ELEMENT_ARRAY_BUFFER, - new Uint16Array(indices), - gl.STATIC_DRAW - ); - - return indexBuffer; + for (let j = 0; j < faceColors.length; ++j) { + const c = faceColors[j] + // Repeat each color four times for the four vertices of the face + colors = colors.concat(c, c, c, c) } + const colorBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, colorBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(colors), gl.STATIC_DRAW) + + return colorBuffer + } + + initIndexBuffer(gl) { + const indexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer) + + // This array defines each face as two triangles, using the + // indices into the vertex array to specify each triangle's + // position. + + const indices = [ + 0, + 1, + 2, + 0, + 2, + 3, // front + 4, + 5, + 6, + 4, + 6, + 7, // back + 8, + 9, + 10, + 8, + 10, + 11, // top + 12, + 13, + 14, + 12, + 14, + 15, // bottom + 16, + 17, + 18, + 16, + 18, + 19, // right + 20, + 21, + 22, + 20, + 22, + 23, // left + ] + + // Now send the element array to GL + + gl.bufferData( + gl.ELEMENT_ARRAY_BUFFER, + new Uint16Array(indices), + gl.STATIC_DRAW + ) + + return indexBuffer + } } // // Initialize a shader program, so WebGL knows how to draw our data // function initShaderProgram(gl, vsSource, fsSource) { - const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource); - const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource); - - // Create the shader program - - const shaderProgram = gl.createProgram(); - gl.attachShader(shaderProgram, vertexShader); - gl.attachShader(shaderProgram, fragmentShader); - gl.linkProgram(shaderProgram); - - // If creating the shader program failed, alert - - if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { - console.error( - `Unable to initialize the shader program: ${gl.getProgramInfoLog( - shaderProgram - )}` - ); - return null; - } - - return shaderProgram; + const vertexShader = loadShader(gl, gl.VERTEX_SHADER, vsSource) + const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, fsSource) + + // Create the shader program + + const shaderProgram = gl.createProgram() + gl.attachShader(shaderProgram, vertexShader) + gl.attachShader(shaderProgram, fragmentShader) + gl.linkProgram(shaderProgram) + + // If creating the shader program failed, alert + + if (!gl.getProgramParameter(shaderProgram, gl.LINK_STATUS)) { + console.error( + `Unable to initialize the shader program: ${gl.getProgramInfoLog( + shaderProgram + )}` + ) + return null } + return shaderProgram +} + // // creates a shader of the given type, uploads the source and // compiles it. // function loadShader(gl, type, source) { - const shader = gl.createShader(type); + const shader = gl.createShader(type) // Send the source to the shader object - gl.shaderSource(shader, source); + gl.shaderSource(shader, source) // Compile the shader program - gl.compileShader(shader); + gl.compileShader(shader) // See if it compiled successfully if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) { console.error( `An error occurred compiling the shaders: ${gl.getShaderInfoLog(shader)}` - ); - gl.deleteShader(shader); - return null; + ) + gl.deleteShader(shader) + return null } - return shader; + return shader } -export default CubeInstanceWebGL; \ No newline at end of file +export default CubeInstanceWebGL diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_fragment.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_fragment.glsl.js index 8dbadcc6..d121649d 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_fragment.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_fragment.glsl.js @@ -1,4 +1,4 @@ -export const splatFragmentShader = +export const splatFragmentShader = /* glsl */ `#version 300 es precision mediump float; @@ -46,4 +46,4 @@ void main() { // fragColor = vec4(0.0, 0.0, 1.0, 1.0); } -`; +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_fragment.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_fragment.glsl.js index 7082d9b7..167dde76 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_fragment.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_fragment.glsl.js @@ -1,4 +1,4 @@ -export const splatRTFragmentShader = +export const splatRTFragmentShader = /* glsl */ `#version 300 es precision mediump float; @@ -12,4 +12,4 @@ out vec4 fragColor; void main(void) { fragColor = texture(u_splat, v_uv); } -`; +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_vertex.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_vertex.glsl.js index d1617eab..f811b35e 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_vertex.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_rt_vertex.glsl.js @@ -1,5 +1,4 @@ - -export const splatRTVertexShader = +export const splatRTVertexShader = /* glsl */ `#version 300 es in vec3 a_pos; @@ -12,4 +11,4 @@ void main(void) { v_uv = a_texCoord; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_vertex.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_vertex.glsl.js index f4d2d373..78ea5cda 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_vertex.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/splat_vertex.glsl.js @@ -1,5 +1,4 @@ - -export const splatVertexShader = +export const splatVertexShader = /* glsl */ `#version 300 es in vec3 a_center; @@ -140,4 +139,4 @@ void main() { } -`; \ No newline at end of file +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_fragment.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_fragment.glsl.js index 2388db30..81c00605 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_fragment.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_fragment.glsl.js @@ -1,4 +1,4 @@ -export const YUVFragmentShader = +export const YUVFragmentShader = /* glsl */ `#version 300 es precision mediump float; @@ -26,4 +26,4 @@ void main(void) { fragColor = vec4(R, G, B, 1.0); } -`; +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_vertex.glsl.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_vertex.glsl.js index 73dc3bdb..04778b98 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_vertex.glsl.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/shaders/yuv_vertex.glsl.js @@ -1,5 +1,4 @@ - -export const YUVVertexShader = +export const YUVVertexShader = /* glsl */ `#version 300 es in vec3 a_pos; @@ -16,4 +15,4 @@ void main(void) { v_uv = a_texCoord; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/splat-webGL.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/splat-webGL.js index 40b5b666..7bda6a5b 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/splat-webGL.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/splat-webGL.js @@ -1,184 +1,188 @@ -import { splatVertexShader } from './shaders/splat_vertex.glsl'; -import { splatFragmentShader } from './shaders/splat_fragment.glsl'; -import { splatRTVertexShader } from './shaders/splat_rt_vertex.glsl'; -import { splatRTFragmentShader } from './shaders/splat_rt_fragment.glsl'; +import { splatVertexShader } from './shaders/splat_vertex.glsl' +import { splatFragmentShader } from './shaders/splat_fragment.glsl' +import { splatRTVertexShader } from './shaders/splat_rt_vertex.glsl' +import { splatRTFragmentShader } from './shaders/splat_rt_fragment.glsl' class SplatWebGL { + constructor(gl) { + // Create shader program + const program = createProgram(gl, splatVertexShader, splatFragmentShader) + + this.vao = gl.createVertexArray() + gl.bindVertexArray(this.vao) + + const setupAttributeBuffer = (name, components) => { + const location = gl.getAttribLocation(program, name) + const buffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, buffer) + gl.enableVertexAttribArray(location) + gl.vertexAttribPointer(location, components, gl.FLOAT, false, 0, 0) + gl.vertexAttribDivisor(location, 1) + return buffer + } - constructor(gl) { - - // Create shader program - const program = createProgram(gl, splatVertexShader, splatFragmentShader) - - this.vao = gl.createVertexArray(); - gl.bindVertexArray(this.vao); - - const setupAttributeBuffer = (name, components) => { - const location = gl.getAttribLocation(program, name) - const buffer = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, buffer) - gl.enableVertexAttribArray(location) - gl.vertexAttribPointer(location, components, gl.FLOAT, false, 0, 0) - gl.vertexAttribDivisor(location, 1) - return buffer - } - - // Create attribute buffers - const buffers = { - color: setupAttributeBuffer('a_col', 3), - center: setupAttributeBuffer('a_center', 3), - opacity: setupAttributeBuffer('a_opacity', 1), - covA: setupAttributeBuffer('a_covA', 3), - covB: setupAttributeBuffer('a_covB', 3), - } - - this.program = program; - this.buffers = buffers; + // Create attribute buffers + const buffers = { + color: setupAttributeBuffer('a_col', 3), + center: setupAttributeBuffer('a_center', 3), + opacity: setupAttributeBuffer('a_opacity', 1), + covA: setupAttributeBuffer('a_covA', 3), + covB: setupAttributeBuffer('a_covB', 3), } + + this.program = program + this.buffers = buffers + } } export class SplatRenderTexture { - - constructor(gl) { - // 准备 RenderTexutre - this.initRenderTexture(gl); - - // Create shader program - const shaderProgram = createProgram(gl, splatRTVertexShader, splatRTFragmentShader); - - this.programInfo = { - program: shaderProgram, - attribLocations: { - vertexPosition: gl.getAttribLocation(shaderProgram, "a_pos"), - vertexTexcoord: gl.getAttribLocation(shaderProgram, "a_texCoord"), - }, - uniformLocations: { - uSplat: gl.getAttribLocation(shaderProgram, "u_splat"), - }, - }; - - // init VAO - this.initVAO(gl); + constructor(gl) { + // 准备 RenderTexutre + this.initRenderTexture(gl) + + // Create shader program + const shaderProgram = createProgram(gl, splatRTVertexShader, splatRTFragmentShader) + + this.programInfo = { + program: shaderProgram, + attribLocations: { + vertexPosition: gl.getAttribLocation(shaderProgram, 'a_pos'), + vertexTexcoord: gl.getAttribLocation(shaderProgram, 'a_texCoord'), + }, + uniformLocations: { + uSplat: gl.getAttribLocation(shaderProgram, 'u_splat'), + }, } - initRenderTexture(gl) { - const targetTextureWidth = gl.canvas.width; - const targetTextureHeight = gl.canvas.height; - const targetTexture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, targetTexture); - - this.renderTexture = targetTexture; - - // 定义0级的大小和格式 - const level = 0; - const internalFormat = gl.RGBA; - const border = 0; - const format = gl.RGBA; - const type = gl.UNSIGNED_BYTE; - const data = null; - gl.texImage2D(gl.TEXTURE_2D, level, internalFormat, - targetTextureWidth, targetTextureHeight, border, - format, type, data); - - // 设置过滤,这样我们就不需要 mips - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - - // 创建并绑定帧缓冲区 - const fb = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, fb); - - // 将纹理附加为第一个颜色附件 - const attachmentPoint = gl.COLOR_ATTACHMENT0; - gl.framebufferTexture2D( - gl.FRAMEBUFFER, attachmentPoint, gl.TEXTURE_2D, targetTexture, level); - - this.frameBuffer = fb; - this.rt = targetTexture; + // init VAO + this.initVAO(gl) + } + + initRenderTexture(gl) { + const targetTextureWidth = gl.canvas.width + const targetTextureHeight = gl.canvas.height + const targetTexture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, targetTexture) + + this.renderTexture = targetTexture + + // 定义0级的大小和格式 + const level = 0 + const internalFormat = gl.RGBA + const border = 0 + const format = gl.RGBA + const type = gl.UNSIGNED_BYTE + const data = null + gl.texImage2D( + gl.TEXTURE_2D, + level, + internalFormat, + targetTextureWidth, + targetTextureHeight, + border, + format, + type, + data + ) + + // 设置过滤,这样我们就不需要 mips + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + + // 创建并绑定帧缓冲区 + const fb = gl.createFramebuffer() + gl.bindFramebuffer(gl.FRAMEBUFFER, fb) + + // 将纹理附加为第一个颜色附件 + const attachmentPoint = gl.COLOR_ATTACHMENT0 + gl.framebufferTexture2D(gl.FRAMEBUFFER, attachmentPoint, gl.TEXTURE_2D, targetTexture, level) + + this.frameBuffer = fb + this.rt = targetTexture + } + + initVAO(gl) { + this.vao = gl.createVertexArray() + gl.bindVertexArray(this.vao) + + // positionBuffer + const positionBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer) + const positions = [ + -1.0, -1.0, 0.0, + 1.0, -1.0, 0.0, + 1.0, 1.0, 0.0, + -1.0, 1.0, 0.0, + ] + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW) + + // texCoordBuffer + const texCoordBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer) + // filpY + const texCoord = [ + 0, 0, + 1, 0, + 1, 1, + 0, 1 + ] + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(texCoord), gl.STATIC_DRAW) + + // indexBuffer + const indexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer) + const indices = [ + 0, + 1, + 2, + 0, + 2, + 3 + ] + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW) + + // Create attribute buffers + const buffers = { + position: positionBuffer, + texCoord: texCoordBuffer, + indices: indexBuffer } - initVAO(gl) { - this.vao = gl.createVertexArray(); - gl.bindVertexArray(this.vao); - - // positionBuffer - const positionBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); - const positions = [ - -1.0, -1.0, 0.0, - 1.0, -1.0, 0.0, - 1.0, 1.0, 0.0, - -1.0, 1.0, 0.0, - ]; - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); - - // texCoordBuffer - const texCoordBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); - // filpY - const texCoord = [ - 0, 0, - 1, 0, - 1, 1, - 0, 1 - ]; - gl.bufferData( gl.ARRAY_BUFFER, new Float32Array(texCoord), gl.STATIC_DRAW ); - - // indexBuffer - const indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - const indices = [ - 0, - 1, - 2, - 0, - 2, - 3 - ]; - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW ); - - // Create attribute buffers - const buffers = { - position: positionBuffer, - texCoord: texCoordBuffer, - indices: indexBuffer - } - - this.buffers = buffers; - } + this.buffers = buffers + } } // Create a program from a vertex and fragment shader function createProgram(gl, vertexShaderSource, fragmentShaderSource) { - const program = gl.createProgram() + const program = gl.createProgram() - const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource) - const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource) - gl.attachShader(program, vertexShader) - gl.attachShader(program, fragmentShader) - gl.linkProgram(program) + const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource) + const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource) + gl.attachShader(program, vertexShader) + gl.attachShader(program, fragmentShader) + gl.linkProgram(program) - const success = gl.getProgramParameter(program, gl.LINK_STATUS) - if (success) return program + const success = gl.getProgramParameter(program, gl.LINK_STATUS) + if (success) return program - console.log(gl.getProgramInfoLog(program)) - gl.deleteProgram(program) + console.log(gl.getProgramInfoLog(program)) + gl.deleteProgram(program) } // Create and compile a shader from source function createShader(gl, type, source) { - const shader = gl.createShader(type) - gl.shaderSource(shader, source) - gl.compileShader(shader) + const shader = gl.createShader(type) + gl.shaderSource(shader, source) + gl.compileShader(shader) - const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS) - if (success) return shader + if (success) return shader - console.log(gl.getShaderInfoLog(shader)) - gl.deleteShader(shader) + console.log(gl.getShaderInfoLog(shader)) + gl.deleteShader(shader) } -export default SplatWebGL; \ No newline at end of file +export default SplatWebGL diff --git a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/yuv-webGL.js b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/yuv-webGL.js index 9e356752..0475df34 100644 --- a/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/yuv-webGL.js +++ b/miniprogram/packageAPI/pages/ar/gaussian-splatting/webgl2/yuv-webGL.js @@ -1,112 +1,108 @@ - -import { YUVVertexShader } from './shaders/yuv_vertex.glsl'; -import { YUVFragmentShader } from './shaders/yuv_fragment.glsl'; - +import { YUVVertexShader } from './shaders/yuv_vertex.glsl' +import { YUVFragmentShader } from './shaders/yuv_fragment.glsl' export class YUVRenderWebGL { - - constructor(gl) { - - // Create shader program - const shaderProgram = createProgram(gl, YUVVertexShader, YUVFragmentShader); - - this.programInfo = { - program: shaderProgram, - attribLocations: { - vertexPosition: gl.getAttribLocation(shaderProgram, "a_pos"), - vertexTexcoord: gl.getAttribLocation(shaderProgram, "a_texCoord"), - }, - uniformLocations: { - displayTransform: gl.getUniformLocation(shaderProgram, "u_displayTransform"), - yTexture: gl.getUniformLocation(shaderProgram, "u_y_texture"), - uvTexture: gl.getUniformLocation(shaderProgram, "u_uv_texture"), - }, - }; - - // init VAO - this.initVAO(gl); + constructor(gl) { + // Create shader program + const shaderProgram = createProgram(gl, YUVVertexShader, YUVFragmentShader) + + this.programInfo = { + program: shaderProgram, + attribLocations: { + vertexPosition: gl.getAttribLocation(shaderProgram, 'a_pos'), + vertexTexcoord: gl.getAttribLocation(shaderProgram, 'a_texCoord'), + }, + uniformLocations: { + displayTransform: gl.getUniformLocation(shaderProgram, 'u_displayTransform'), + yTexture: gl.getUniformLocation(shaderProgram, 'u_y_texture'), + uvTexture: gl.getUniformLocation(shaderProgram, 'u_uv_texture'), + }, } - initVAO(gl) { - this.vao = gl.createVertexArray(); - gl.bindVertexArray(this.vao); - - // positionBuffer - const positionBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer); - const positions = [ - -1.0, -1.0, 0.0, - 1.0, -1.0, 0.0, - 1.0, 1.0, 0.0, - -1.0, 1.0, 0.0, - ]; - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW); - - // texCoordBuffer - const texCoordBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer); - // filpY - const texCoord = [ - 0, 0, - 1, 0, - 1, 1, - 0, 1 - ]; - gl.bufferData( gl.ARRAY_BUFFER, new Float32Array(texCoord), gl.STATIC_DRAW ); - - // indexBuffer - const indexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer); - const indices = [ - 0, - 1, - 2, - 0, - 2, - 3 - ]; - gl.bufferData( gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW ); - - // Create attribute buffers - const buffers = { - position: positionBuffer, - texCoord: texCoordBuffer, - indices: indexBuffer - } - - this.buffers = buffers; + // init VAO + this.initVAO(gl) + } + + initVAO(gl) { + this.vao = gl.createVertexArray() + gl.bindVertexArray(this.vao) + + // positionBuffer + const positionBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, positionBuffer) + const positions = [ + -1.0, -1.0, 0.0, + 1.0, -1.0, 0.0, + 1.0, 1.0, 0.0, + -1.0, 1.0, 0.0, + ] + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(positions), gl.STATIC_DRAW) + + // texCoordBuffer + const texCoordBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texCoordBuffer) + // filpY + const texCoord = [ + 0, 0, + 1, 0, + 1, 1, + 0, 1 + ] + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(texCoord), gl.STATIC_DRAW) + + // indexBuffer + const indexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, indexBuffer) + const indices = [ + 0, + 1, + 2, + 0, + 2, + 3 + ] + gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(indices), gl.STATIC_DRAW) + + // Create attribute buffers + const buffers = { + position: positionBuffer, + texCoord: texCoordBuffer, + indices: indexBuffer } + + this.buffers = buffers + } } // Create a program from a vertex and fragment shader function createProgram(gl, vertexShaderSource, fragmentShaderSource) { - const program = gl.createProgram() + const program = gl.createProgram() - const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource) - const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource) - gl.attachShader(program, vertexShader) - gl.attachShader(program, fragmentShader) - gl.linkProgram(program) + const vertexShader = createShader(gl, gl.VERTEX_SHADER, vertexShaderSource) + const fragmentShader = createShader(gl, gl.FRAGMENT_SHADER, fragmentShaderSource) + gl.attachShader(program, vertexShader) + gl.attachShader(program, fragmentShader) + gl.linkProgram(program) - const success = gl.getProgramParameter(program, gl.LINK_STATUS) - if (success) return program + const success = gl.getProgramParameter(program, gl.LINK_STATUS) + if (success) return program - console.log(gl.getProgramInfoLog(program)) - gl.deleteProgram(program) + console.log(gl.getProgramInfoLog(program)) + gl.deleteProgram(program) } // Create and compile a shader from source function createShader(gl, type, source) { - const shader = gl.createShader(type) - gl.shaderSource(shader, source) - gl.compileShader(shader) + const shader = gl.createShader(type) + gl.shaderSource(shader, source) + gl.compileShader(shader) - const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const success = gl.getShaderParameter(shader, gl.COMPILE_STATUS) - if (success) return shader + if (success) return shader - console.log(gl.getShaderInfoLog(shader)) - gl.deleteShader(shader) + console.log(gl.getShaderInfoLog(shader)) + gl.deleteShader(shader) } -export default YUVRenderWebGL; \ No newline at end of file +export default YUVRenderWebGL diff --git a/miniprogram/packageAPI/pages/ar/hand-detect-3d/hand-detect-3d.js b/miniprogram/packageAPI/pages/ar/hand-detect-3d/hand-detect-3d.js index c1162f5c..a3ef4110 100644 --- a/miniprogram/packageAPI/pages/ar/hand-detect-3d/hand-detect-3d.js +++ b/miniprogram/packageAPI/pages/ar/hand-detect-3d/hand-detect-3d.js @@ -5,40 +5,40 @@ import xrFrameBehavior from '../behavior/behavior-xrframe' const NEAR = 0.01 const FAR = 1000 -let loggerOnce = false; +const loggerOnce = false Component({ behaviors: [arBehavior, xrFrameBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.8, // canvas高度缩放值 - hintBoxList: [], // 显示提示盒子列表 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.8, // canvas高度缩放值 + hintBoxList: [], // 显示提示盒子列表 }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 hintInfo: undefined, // 提示框信息 lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + } + }, }, methods: { @@ -46,7 +46,7 @@ Component({ init() { // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 @@ -58,7 +58,7 @@ Component({ }, version: 'v1', gl: this.gl - }); + }) try { session.start(err => { @@ -68,22 +68,22 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // 开启三维识别 - session.update3DMode({open3d: true}) + session.update3DMode({ open3d: true }) // VKSession EVENT addAnchors session.on('addAnchors', anchors => { - console.log("addAnchor", anchors) + console.log('addAnchor', anchors) }) // VKSession EVENT updateAnchors session.on('updateAnchors', anchors => { // console.log("updateAnchors", anchors); - const anchor = anchors[0]; + const anchor = anchors[0] // 目前只处理一个返回的手 if (anchor) { // console.log('id', anchor.id); @@ -94,56 +94,51 @@ Component({ // console.log('size', anchor.size); // console.log('detectId', anchor.detectId); // console.log('confidence', anchor.confidence); - // console.log('points3d', anchor.points3d); + // console.log('points3d', anchor.points3d); - this.wrapTransform = anchor.transform; - this.position3D = anchor.points3d; - - this.updateHintBoxVisble(this.hintBoxList, true); + this.wrapTransform = anchor.transform + this.position3D = anchor.points3d + this.updateHintBoxVisble(this.hintBoxList, true) } }) - + // VKSession removeAnchors // 识别目标丢失时不断触发 session.on('removeAnchors', anchors => { // console.log("removeAnchors"); - this.updateHintBoxVisble(this.hintBoxList, false); - }); - + this.updateHintBoxVisble(this.hintBoxList, false) + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - - } catch(e) { - console.error(e); + this.initLoop() + }) + } catch (e) { + console.error(e) } - }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene // 缓存主相机 this.xrCameraMain = this.xrCamera - this.xrCameraMainTrs = this.xrCameraTrs; - + this.xrCameraMainTrs = this.xrCameraTrs + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // === 初始s手挂载点 === - this.handWrap = scene.createElement(xrFrameSystem.XRNode); - this.handWrapTrs = this.handWrap.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( this.handWrap ); + this.handWrap = scene.createElement(xrFrameSystem.XRNode) + this.handWrapTrs = this.handWrap.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(this.handWrap) // 加载提示点 - this.hintBoxList = this.getHintBox(xrFrameSystem, scene, this.handWrap); - + this.hintBoxList = this.getHintBox(xrFrameSystem, scene, this.handWrap) }, loop() { // console.log('loop') @@ -152,75 +147,74 @@ Component({ const frame = this.session.getVKFrame(this.data.width, this.data.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) // 存在handWrap,执行信息同步逻辑 if (this.handWrap && this.wrapTransform) { - const xrFrameSystem = wx.getXrFrameSystem(); - - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + const xrFrameSystem = wx.getXrFrameSystem() + + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(this.wrapTransform); - this.DT.transpose(this.DT2); - this.handWrapTrs.setLocalMatrix(this.DT2); + this.DT.setArray(this.wrapTransform) + this.DT.transpose(this.DT2) + this.handWrapTrs.setLocalMatrix(this.DT2) // 更新提示点位置 - this.updateHintBoxPosition(this.hintBoxList, this.position3D); - + this.updateHintBoxPosition(this.hintBoxList, this.position3D) } }, getHintBox(xrFrameSystem, scene, wrap) { // 初始化提示点 - const geometryHint = scene.assets.getAsset('geometry', 'sphere'); - const effectCube = scene.assets.getAsset('effect', 'standard'); - const boxScale = 0.006; - const hintBoxList = []; + const geometryHint = scene.assets.getAsset('geometry', 'sphere') + const effectCube = scene.assets.getAsset('effect', 'standard') + const boxScale = 0.006 + const hintBoxList = [] for (let i = 0; i < 16; i++) { - const colorFloat = i / 16; + const colorFloat = i / 16 const el = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", + position: '0 0 0', scale: `${boxScale} ${boxScale} ${boxScale}`, - }); - const elTrs = el.getComponent(xrFrameSystem.Transform); - const mat = scene.createMaterial(effectCube); - - const colorR = 1.0 - colorFloat; - mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)); + }) + const elTrs = el.getComponent(xrFrameSystem.Transform) + const mat = scene.createMaterial(effectCube) + + const colorR = 1.0 - colorFloat + mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, colorR, colorR, 1.0)) const mesh = el.addComponent(xrFrameSystem.Mesh, { geometry: geometryHint, material: mat, - }); + }) + + wrap.addChild(el) + elTrs.visible = false - wrap.addChild( el ); - elTrs.visible = false; - - hintBoxList.push( elTrs ); + hintBoxList.push(elTrs) } - return hintBoxList; + return hintBoxList }, updateHintBoxPosition(hintBoxList, points3d) { if (hintBoxList && hintBoxList.length > 0) { // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; - hintBox.position.x = points3d[i].x; - hintBox.position.y = points3d[i].y; - hintBox.position.z = points3d[i].z; + const hintBox = hintBoxList[i] + hintBox.position.x = points3d[i].x + hintBox.position.y = points3d[i].y + hintBox.position.z = points3d[i].z } } }, @@ -229,13 +223,13 @@ Component({ // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; + const hintBox = hintBoxList[i] if (hintBox.visible !== visible) { - hintBox.visible = visible; + hintBox.visible = visible } } } } }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/hand-detect/behavior.js b/miniprogram/packageAPI/pages/ar/hand-detect/behavior.js index d5601218..b24d6cf5 100644 --- a/miniprogram/packageAPI/pages/ar/hand-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/hand-detect/behavior.js @@ -1,202 +1,201 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - cameraPosition: 0 - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + cameraPosition: 0 + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - hand: { - mode: 1 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - this.data.anchor2DList = anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })) - }) - - session.on('updateAnchors', anchors => { - this.data.anchor2DList = [] - // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 - this.data.anchor2DList = this.data.anchor2DList.concat(anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - }))) - }) - - session.on('removeAnchors', anchors => { - this.data.anchor2DList = [] - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + hand: { + mode: 1 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + this.data.anchor2DList = anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })) + }) + + session.on('updateAnchors', anchors => { + this.data.anchor2DList = [] + // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 + this.data.anchor2DList = this.data.anchor2DList.concat(anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + }))) + }) + + session.on('removeAnchors', anchors => { + this.data.anchor2DList = [] + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/hand-detect/hand-detect.js b/miniprogram/packageAPI/pages/ar/hand-detect/hand-detect.js index 55cccf2a..a1671252 100644 --- a/miniprogram/packageAPI/pages/ar/hand-detect/hand-detect.js +++ b/miniprogram/packageAPI/pages/ar/hand-detect/hand-detect.js @@ -4,70 +4,69 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -//顶点着色器 -var VSHADER_SOURCE = '' + - 'attribute vec4 a_Position;\n' + //声明attribute变量a_Position,用来存放顶点位置信息 +// 顶点着色器 +const VSHADER_SOURCE = '' + + 'attribute vec4 a_Position;\n' + // 声明attribute变量a_Position,用来存放顶点位置信息 'void main(){\n' + - ' gl_Position = a_Position;\n' + //将顶点坐标赋值给顶点着色器内置变量gl_Position - ' gl_PointSize = 4.0;\n' + //设置顶点大小 + ' gl_Position = a_Position;\n' + // 将顶点坐标赋值给顶点着色器内置变量gl_Position + ' gl_PointSize = 4.0;\n' + // 设置顶点大小 '}\n' -//片元着色器 -var FSHADER_SOURCE = '' + +// 片元着色器 +const FSHADER_SOURCE = '' + '#ifdef GL_ES\n' + ' precision mediump float;\n' + // 设置精度 '#endif\n' + - 'varying vec4 v_Color;\n' + //声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 + 'varying vec4 v_Color;\n' + // 声明varying变量v_Color,用来接收顶点着色器传送的片元颜色信息 'void main(){\n' + - ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + //计算像素距离中心点的距离 - ' if(d < 0.5) {\n' + //距离大于0.5放弃片元,小于0.5保留片元 + ' float d = distance(gl_PointCoord, vec2(0.5, 0.5));\n' + // 计算像素距离中心点的距离 + ' if(d < 0.5) {\n' + // 距离大于0.5放弃片元,小于0.5保留片元 ' gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0);\n' + ' } else { discard; }\n' + '}\n' - -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false function initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) { - //创建顶点着色器对象 - var vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) - //创建片元着色器对象 - var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) + // 创建顶点着色器对象 + const vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) + // 创建片元着色器对象 + const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) if (!vertexShader || !fragmentShader) { return null } - //创建程序对象program - var program = gl.createProgram() + // 创建程序对象program + const program = gl.createProgram() if (!gl.createProgram()) { return null } - //分配顶点着色器和片元着色器到program + // 分配顶点着色器和片元着色器到program gl.attachShader(program, vertexShader) gl.attachShader(program, fragmentShader) - //链接program + // 链接program gl.linkProgram(program) - //检查程序对象是否连接成功 - var linked = gl.getProgramParameter(program, gl.LINK_STATUS) + // 检查程序对象是否连接成功 + const linked = gl.getProgramParameter(program, gl.LINK_STATUS) if (!linked) { - var error = gl.getProgramInfoLog(program) + const error = gl.getProgramInfoLog(program) console.log('程序对象连接失败: ' + error) gl.deleteProgram(program) gl.deleteShader(fragmentShader) gl.deleteShader(vertexShader) return null } - //返回程序program对象 + // 返回程序program对象 initShadersDone = true return program } function loadShader(gl, type, source) { // 创建顶点着色器对象 - var shader = gl.createShader(type) + const shader = gl.createShader(type) if (shader == null) { console.log('创建着色器失败') return null @@ -80,9 +79,9 @@ function loadShader(gl, type, source) { gl.compileShader(shader) // 检查顶是否编译成功 - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) if (!compiled) { - var error = gl.getShaderInfoLog(shader) + const error = gl.getShaderInfoLog(shader) console.log('编译着色器失败: ' + error) gl.deleteShader(shader) return null @@ -91,9 +90,8 @@ function loadShader(gl, type, source) { return shader } -//初始化顶点坐标和顶点颜色 +// 初始化顶点坐标和顶点颜色 function initVertexBuffers(gl, anchor2DList) { - const flattenPoints = [] anchor2DList.forEach(anchor => { anchor.points.forEach(point => { @@ -105,23 +103,23 @@ function initVertexBuffers(gl, anchor2DList) { }) }) - var vertices = new Float32Array(flattenPoints) - var n = flattenPoints.length / 2 + const vertices = new Float32Array(flattenPoints) + const n = flattenPoints.length / 2 - //创建缓冲区对象 - var buffer = gl.createBuffer() - //将顶点坐标和顶点颜色信息写入缓冲区对象 + // 创建缓冲区对象 + const buffer = gl.createBuffer() + // 将顶点坐标和顶点颜色信息写入缓冲区对象 gl.bindBuffer(gl.ARRAY_BUFFER, buffer) gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW) - //获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 - var a_Position = gl.getAttribLocation(gl.program, 'a_Position') + // 获取顶点着色器attribute变量a_Position存储地址, 分配缓存并开启 + const a_Position = gl.getAttribLocation(gl.program, 'a_Position') gl.vertexAttribPointer(a_Position, 2, gl.FLOAT, false, 0, 0) gl.enableVertexAttribArray(a_Position) return n } -var EDGE_VSHADER_SOURCE = +const EDGE_VSHADER_SOURCE = ` attribute vec2 aPosition; varying vec2 posJudge; @@ -132,7 +130,7 @@ var EDGE_VSHADER_SOURCE = } ` -var EDGE_FSHADER_SOURCE = +const EDGE_FSHADER_SOURCE = ` precision highp float; uniform vec2 rightTopPoint; @@ -162,48 +160,47 @@ var EDGE_FSHADER_SOURCE = ` function initRectEdgeBuffer(gl, x, y, width, height) { - let shaderProgram = gl.program; - let centerX = x * 2 - 1 + width; - let centerY = -1 * (y * 2 - 1) - height; - let right = width; - let top = height; - var vertices = [ + const shaderProgram = gl.program + const centerX = x * 2 - 1 + width + const centerY = -1 * (y * 2 - 1) - height + const right = width + const top = height + const vertices = [ -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, 1.0, -1.0 - ]; + ] - var vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); - var aPosition = gl.getAttribLocation(shaderProgram, 'aPosition'); - gl.enableVertexAttribArray(aPosition); - gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0); + const vertexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW) + const aPosition = gl.getAttribLocation(shaderProgram, 'aPosition') + gl.enableVertexAttribArray(aPosition) + gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, 0, 0) - - var rightTop = [ + const rightTop = [ right, top - ]; - var rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint'); - gl.uniform2fv(rightTopLoc, rightTop); + ] + const rightTopLoc = gl.getUniformLocation(shaderProgram, 'rightTopPoint') + gl.uniform2fv(rightTopLoc, rightTop) - var centerPoint = [ + const centerPoint = [ centerX, centerY - ]; - var centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint'); - gl.uniform2fv(centerPointLoc, centerPoint); + ] + const centerPointLoc = gl.getUniformLocation(shaderProgram, 'centerPoint') + gl.uniform2fv(centerPointLoc, centerPoint) - var length = vertices.length / 2; + const length = vertices.length / 2 - return length; + return length } function onDrawRectEdge(gl, x, y, width, height) { width = Math.round(width * 100) / 100 height = Math.round(height * 100) / 100 - var n = initRectEdgeBuffer(gl, x, y, width, height); - gl.drawArrays(gl.TRIANGLE_STRIP, 0, n); + const n = initRectEdgeBuffer(gl, x, y, width, height) + gl.drawArrays(gl.TRIANGLE_STRIP, 0, n) } Component({ @@ -217,15 +214,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -243,19 +240,19 @@ Component({ init() { this.initGL() }, - switchCamera(event){ - if(this.session.config){ + switchCamera(event) { + if (this.session.config) { const config = this.session.config - let pos = Number(event.currentTarget.dataset.value) + const pos = Number(event.currentTarget.dataset.value) config.cameraPosition = pos this.session.config = config this.setData({ - cameraPosition:event.currentTarget.dataset.value + cameraPosition: event.currentTarget.dataset.value }) } }, render(frame) { - var gl = this.gl + const gl = this.gl this.renderGL(frame) @@ -279,7 +276,7 @@ Component({ const anchor2DList = this.data.anchor2DList if (!anchor2DList || anchor2DList.length <= 0) { - return + } else { if (!initShadersDone) { this.vertexProgram = initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) @@ -293,19 +290,19 @@ Component({ gl.useProgram(this.vertexProgram) gl.program = this.vertexProgram - //初始化顶点坐标和顶点颜色 - var n = initVertexBuffers(gl, anchor2DList) + // 初始化顶点坐标和顶点颜色 + const n = initVertexBuffers(gl, anchor2DList) - //绘制点 + // 绘制点 gl.drawArrays(gl.POINTS, 0, n) gl.useProgram(this.rectEdgeProgram) gl.program = this.rectEdgeProgram - for (var i = 0; i < anchor2DList.length; i++) { + for (let i = 0; i < anchor2DList.length; i++) { onDrawRectEdge(gl, anchor2DList[i].origin.x, anchor2DList[i].origin.y, anchor2DList[i].size.width, anchor2DList[i].size.height) } } }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/hand-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/hand-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/hand-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/hand-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/loaders/gltf-clone.js b/miniprogram/packageAPI/pages/ar/loaders/gltf-clone.js index f4964653..01b135e0 100644 --- a/miniprogram/packageAPI/pages/ar/loaders/gltf-clone.js +++ b/miniprogram/packageAPI/pages/ar/loaders/gltf-clone.js @@ -1,4 +1,4 @@ -export default function(gltf, THREE) { +export default function (gltf, THREE) { const clone = { animations: gltf.animations, scene: gltf.scene.clone(true) @@ -25,7 +25,7 @@ export default function(gltf, THREE) { } }) - for (let name in skinnedMeshes) { + for (const name in skinnedMeshes) { const skinnedMesh = skinnedMeshes[name] const skeleton = skinnedMesh.skeleton const cloneSkinnedMesh = cloneSkinnedMeshes[name] diff --git a/miniprogram/packageAPI/pages/ar/loaders/gltf-loader.js b/miniprogram/packageAPI/pages/ar/loaders/gltf-loader.js index aff17d89..a8b9d75b 100644 --- a/miniprogram/packageAPI/pages/ar/loaders/gltf-loader.js +++ b/miniprogram/packageAPI/pages/ar/loaders/gltf-loader.js @@ -1,16 +1,16 @@ export function registerGLTFLoader(THREE) { - THREE.GLTFLoader = (function() { + THREE.GLTFLoader = (function () { function GLTFLoader() { - this.manager = THREE.DefaultLoadingManager; - this.dracoLoader = null; + this.manager = THREE.DefaultLoadingManager + this.dracoLoader = null this.ddsLoader = null } GLTFLoader.prototype = { constructor: GLTFLoader, crossOrigin: 'anonymous', - load: function(url, onLoad) { - var scope = this; - var resourcePath; + load(url, onLoad) { + const scope = this + let resourcePath if (this.resourcePath !== undefined) { resourcePath = this.resourcePath } else if (this.path !== undefined) { @@ -18,42 +18,48 @@ export function registerGLTFLoader(THREE) { } else { resourcePath = THREE.LoaderUtils.extractUrlBase(url) } - scope.manager.itemStart(url); - var _onError = function(e) { - console.error(e); - scope.manager.itemError(url); + scope.manager.itemStart(url) + const _onError = function (e) { + console.error(e) + scope.manager.itemError(url) scope.manager.itemEnd(url) - }; - var loader = new THREE.FileLoader(scope.manager); - loader.setPath(this.path); - loader.setResponseType('arraybuffer'); - loader.load(url, - function(data) { - try { - scope.parse(data, resourcePath, - function(gltf) { - onLoad(gltf); - scope.manager.itemEnd(url) - }, - _onError) - } catch(e) { - _onError(e) - } - }, - null, _onError) + } + const loader = new THREE.FileLoader(scope.manager) + loader.setPath(this.path) + loader.setResponseType('arraybuffer') + loader.load( + url, + function (data) { + try { + scope.parse( + data, + resourcePath, + function (gltf) { + onLoad(gltf) + scope.manager.itemEnd(url) + }, + _onError + ) + } catch (e) { + _onError(e) + } + }, + null, + _onError + ) }, - parse: function(data, path, onLoad, onError) { - var content; - var extensions = {}; + parse(data, path, onLoad, onError) { + let content + const extensions = {} if (typeof data === 'string') { content = data } else { - var magic = THREE.LoaderUtils.decodeText(new Uint8Array(data, 0, 4)); + const magic = THREE.LoaderUtils.decodeText(new Uint8Array(data, 0, 4)) if (magic === BINARY_EXTENSION_HEADER_MAGIC) { try { extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data) - } catch(error) { - if (onError) onError(error); + } catch (error) { + if (onError) onError(error) return } content = extensions[EXTENSIONS.KHR_BINARY_GLTF].content @@ -61,62 +67,62 @@ export function registerGLTFLoader(THREE) { content = THREE.LoaderUtils.decodeText(new Uint8Array(data)) } } - var json = JSON.parse(content); + const json = JSON.parse(content) if (json.asset === undefined || json.asset.version[0] < 2) { - if (onError) onError(new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead.')); + if (onError) onError(new Error('THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported. Use LegacyGLTFLoader instead.')) return } if (json.extensionsUsed) { - for (var i = 0; i < json.extensionsUsed.length; ++i) { - var extensionName = json.extensionsUsed[i]; - var extensionsRequired = json.extensionsRequired || []; + for (let i = 0; i < json.extensionsUsed.length; ++i) { + const extensionName = json.extensionsUsed[i] + const extensionsRequired = json.extensionsRequired || [] switch (extensionName) { - case EXTENSIONS.KHR_LIGHTS_PUNCTUAL: - extensions[extensionName] = new GLTFLightsExtension(json); - break; - case EXTENSIONS.KHR_MATERIALS_UNLIT: - extensions[extensionName] = new GLTFMaterialsUnlitExtension(); - break; - case EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: - extensions[extensionName] = new GLTFMaterialsPbrSpecularGlossinessExtension(); - break; - case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION: - extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader); - break; - case EXTENSIONS.MSFT_TEXTURE_DDS: - extensions[EXTENSIONS.MSFT_TEXTURE_DDS] = new GLTFTextureDDSExtension(this.ddsLoader); - break; - case EXTENSIONS.KHR_TEXTURE_TRANSFORM: - extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] = new GLTFTextureTransformExtension(); - break; - default: - if (extensionsRequired.indexOf(extensionName) >= 0) { - console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".') - } + case EXTENSIONS.KHR_LIGHTS_PUNCTUAL: + extensions[extensionName] = new GLTFLightsExtension(json) + break + case EXTENSIONS.KHR_MATERIALS_UNLIT: + extensions[extensionName] = new GLTFMaterialsUnlitExtension() + break + case EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS: + extensions[extensionName] = new GLTFMaterialsPbrSpecularGlossinessExtension() + break + case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION: + extensions[extensionName] = new GLTFDracoMeshCompressionExtension(json, this.dracoLoader) + break + case EXTENSIONS.MSFT_TEXTURE_DDS: + extensions[EXTENSIONS.MSFT_TEXTURE_DDS] = new GLTFTextureDDSExtension(this.ddsLoader) + break + case EXTENSIONS.KHR_TEXTURE_TRANSFORM: + extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] = new GLTFTextureTransformExtension() + break + default: + if (extensionsRequired.indexOf(extensionName) >= 0) { + console.warn('THREE.GLTFLoader: Unknown extension "' + extensionName + '".') + } } } } - var parser = new GLTFParser(json, extensions, { + const parser = new GLTFParser(json, extensions, { path: path || this.resourcePath || '', crossOrigin: this.crossOrigin, manager: this.manager - }); + }) parser.parse(onLoad, onError) } - }; + } function GLTFRegistry() { - var objects = {}; + let objects = {} return { - get: function(key) { + get(key) { return objects[key] }, - add: function(key, object) { + add(key, object) { objects[key] = object }, - remove: function(key) { + remove(key) { delete objects[key] }, - removeAll: function() { + removeAll() { objects = {} } } @@ -129,70 +135,70 @@ export function registerGLTFLoader(THREE) { KHR_MATERIALS_UNLIT: 'KHR_materials_unlit', KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform', MSFT_TEXTURE_DDS: 'MSFT_texture_dds' - }; + } function GLTFTextureDDSExtension(ddsLoader) { if (!ddsLoader) { - throw new Error('THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader'); + throw new Error('THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader') } - this.name = EXTENSIONS.MSFT_TEXTURE_DDS; + this.name = EXTENSIONS.MSFT_TEXTURE_DDS this.ddsLoader = ddsLoader } function GLTFLightsExtension(json) { - this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL; - var extension = (json.extensions && json.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL]) || {}; + this.name = EXTENSIONS.KHR_LIGHTS_PUNCTUAL + const extension = (json.extensions && json.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL]) || {} this.lightDefs = extension.lights || [] } - GLTFLightsExtension.prototype.loadLight = function(lightIndex) { - var lightDef = this.lightDefs[lightIndex]; - var lightNode; - var color = new THREE.Color(0xffffff); - if (lightDef.color !== undefined) color.fromArray(lightDef.color); - var range = lightDef.range !== undefined ? lightDef.range: 0; + GLTFLightsExtension.prototype.loadLight = function (lightIndex) { + const lightDef = this.lightDefs[lightIndex] + let lightNode + const color = new THREE.Color(0xffffff) + if (lightDef.color !== undefined) color.fromArray(lightDef.color) + const range = lightDef.range !== undefined ? lightDef.range : 0 switch (lightDef.type) { - case 'directional': - lightNode = new THREE.DirectionalLight(color); - lightNode.target.position.set(0, 0, -1); - lightNode.add(lightNode.target); - break; - case 'point': - lightNode = new THREE.PointLight(color); - lightNode.distance = range; - break; - case 'spot': - lightNode = new THREE.SpotLight(color); - lightNode.distance = range; - lightDef.spot = lightDef.spot || {}; - lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle: 0; - lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle: Math.PI / 4.0; - lightNode.angle = lightDef.spot.outerConeAngle; - lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle; - lightNode.target.position.set(0, 0, -1); - lightNode.add(lightNode.target); - break; - default: - throw new Error('THREE.GLTFLoader: Unexpected light type, "' + lightDef.type + '".'); - } - lightNode.position.set(0, 0, 0); - lightNode.decay = 2; - if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity; - lightNode.name = lightDef.name || ('light_' + lightIndex); + case 'directional': + lightNode = new THREE.DirectionalLight(color) + lightNode.target.position.set(0, 0, -1) + lightNode.add(lightNode.target) + break + case 'point': + lightNode = new THREE.PointLight(color) + lightNode.distance = range + break + case 'spot': + lightNode = new THREE.SpotLight(color) + lightNode.distance = range + lightDef.spot = lightDef.spot || {} + lightDef.spot.innerConeAngle = lightDef.spot.innerConeAngle !== undefined ? lightDef.spot.innerConeAngle : 0 + lightDef.spot.outerConeAngle = lightDef.spot.outerConeAngle !== undefined ? lightDef.spot.outerConeAngle : Math.PI / 4.0 + lightNode.angle = lightDef.spot.outerConeAngle + lightNode.penumbra = 1.0 - lightDef.spot.innerConeAngle / lightDef.spot.outerConeAngle + lightNode.target.position.set(0, 0, -1) + lightNode.add(lightNode.target) + break + default: + throw new Error('THREE.GLTFLoader: Unexpected light type, "' + lightDef.type + '".') + } + lightNode.position.set(0, 0, 0) + lightNode.decay = 2 + if (lightDef.intensity !== undefined) lightNode.intensity = lightDef.intensity + lightNode.name = lightDef.name || ('light_' + lightIndex) return Promise.resolve(lightNode) - }; + } function GLTFMaterialsUnlitExtension() { this.name = EXTENSIONS.KHR_MATERIALS_UNLIT } - GLTFMaterialsUnlitExtension.prototype.getMaterialType = function() { + GLTFMaterialsUnlitExtension.prototype.getMaterialType = function () { return THREE.MeshBasicMaterial - }; - GLTFMaterialsUnlitExtension.prototype.extendParams = function(materialParams, materialDef, parser) { - var pending = []; - materialParams.color = new THREE.Color(1.0, 1.0, 1.0); - materialParams.opacity = 1.0; - var metallicRoughness = materialDef.pbrMetallicRoughness; + } + GLTFMaterialsUnlitExtension.prototype.extendParams = function (materialParams, materialDef, parser) { + const pending = [] + materialParams.color = new THREE.Color(1.0, 1.0, 1.0) + materialParams.opacity = 1.0 + const metallicRoughness = materialDef.pbrMetallicRoughness if (metallicRoughness) { if (Array.isArray(metallicRoughness.baseColorFactor)) { - var array = metallicRoughness.baseColorFactor; - materialParams.color.fromArray(array); + const array = metallicRoughness.baseColorFactor + materialParams.color.fromArray(array) materialParams.opacity = array[3] } if (metallicRoughness.baseColorTexture !== undefined) { @@ -200,97 +206,100 @@ export function registerGLTFLoader(THREE) { } } return Promise.all(pending) - }; - var BINARY_EXTENSION_HEADER_MAGIC = 'glTF'; - var BINARY_EXTENSION_HEADER_LENGTH = 12; - var BINARY_EXTENSION_CHUNK_TYPES = { + } + var BINARY_EXTENSION_HEADER_MAGIC = 'glTF' + const BINARY_EXTENSION_HEADER_LENGTH = 12 + const BINARY_EXTENSION_CHUNK_TYPES = { JSON: 0x4E4F534A, BIN: 0x004E4942 - }; + } function GLTFBinaryExtension(data) { - this.name = EXTENSIONS.KHR_BINARY_GLTF; - this.content = null; - this.body = null; - var headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH); + this.name = EXTENSIONS.KHR_BINARY_GLTF + this.content = null + this.body = null + const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH) this.header = { magic: THREE.LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))), version: headerView.getUint32(4, true), length: headerView.getUint32(8, true) - }; + } if (this.header.magic !== BINARY_EXTENSION_HEADER_MAGIC) { - throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.'); + throw new Error('THREE.GLTFLoader: Unsupported glTF-Binary header.') } else if (this.header.version < 2.0) { - throw new Error('THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.'); + throw new Error('THREE.GLTFLoader: Legacy binary file detected. Use LegacyGLTFLoader instead.') } - var chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH); - var chunkIndex = 0; + const chunkView = new DataView(data, BINARY_EXTENSION_HEADER_LENGTH) + let chunkIndex = 0 while (chunkIndex < chunkView.byteLength) { - var chunkLength = chunkView.getUint32(chunkIndex, true); - chunkIndex += 4; - var chunkType = chunkView.getUint32(chunkIndex, true); - chunkIndex += 4; + const chunkLength = chunkView.getUint32(chunkIndex, true) + chunkIndex += 4 + const chunkType = chunkView.getUint32(chunkIndex, true) + chunkIndex += 4 if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) { - var contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength); + const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength) this.content = THREE.LoaderUtils.decodeText(contentArray) } else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) { - var byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex; + const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex this.body = data.slice(byteOffset, byteOffset + chunkLength) } chunkIndex += chunkLength } if (this.content === null) { - throw new Error('THREE.GLTFLoader: JSON content not found.'); + throw new Error('THREE.GLTFLoader: JSON content not found.') } } function GLTFDracoMeshCompressionExtension(json, dracoLoader) { if (!dracoLoader) { - throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.'); + throw new Error('THREE.GLTFLoader: No DRACOLoader instance provided.') } - this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION; - this.json = json; + this.name = EXTENSIONS.KHR_DRACO_MESH_COMPRESSION + this.json = json this.dracoLoader = dracoLoader } - GLTFDracoMeshCompressionExtension.prototype.decodePrimitive = function(primitive, parser) { - var json = this.json; - var dracoLoader = this.dracoLoader; - var bufferViewIndex = primitive.extensions[this.name].bufferView; - var gltfAttributeMap = primitive.extensions[this.name].attributes; - var threeAttributeMap = {}; - var attributeNormalizedMap = {}; - var attributeTypeMap = {}; + GLTFDracoMeshCompressionExtension.prototype.decodePrimitive = function (primitive, parser) { + const json = this.json + const dracoLoader = this.dracoLoader + const bufferViewIndex = primitive.extensions[this.name].bufferView + const gltfAttributeMap = primitive.extensions[this.name].attributes + const threeAttributeMap = {} + const attributeNormalizedMap = {} + const attributeTypeMap = {} for (var attributeName in gltfAttributeMap) { - var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); + var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase() threeAttributeMap[threeAttributeName] = gltfAttributeMap[attributeName] } for (attributeName in primitive.attributes) { - var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase(); + var threeAttributeName = ATTRIBUTES[attributeName] || attributeName.toLowerCase() if (gltfAttributeMap[attributeName] !== undefined) { - var accessorDef = json.accessors[primitive.attributes[attributeName]]; - var componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; - attributeTypeMap[threeAttributeName] = componentType; + const accessorDef = json.accessors[primitive.attributes[attributeName]] + const componentType = WEBGL_COMPONENT_TYPES[accessorDef.componentType] + attributeTypeMap[threeAttributeName] = componentType attributeNormalizedMap[threeAttributeName] = accessorDef.normalized === true } } - return parser.getDependency('bufferView', bufferViewIndex).then(function(bufferView) { - return new Promise(function(resolve) { - dracoLoader.decodeDracoFile(bufferView, - function(geometry) { - for (var attributeName in geometry.attributes) { - var attribute = geometry.attributes[attributeName]; - var normalized = attributeNormalizedMap[attributeName]; - if (normalized !== undefined) attribute.normalized = normalized - } - resolve(geometry) - }, - threeAttributeMap, attributeTypeMap) + return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) { + return new Promise(function (resolve) { + dracoLoader.decodeDracoFile( + bufferView, + function (geometry) { + for (const attributeName in geometry.attributes) { + const attribute = geometry.attributes[attributeName] + const normalized = attributeNormalizedMap[attributeName] + if (normalized !== undefined) attribute.normalized = normalized + } + resolve(geometry) + }, + threeAttributeMap, + attributeTypeMap + ) }) }) - }; + } function GLTFTextureTransformExtension() { this.name = EXTENSIONS.KHR_TEXTURE_TRANSFORM } - GLTFTextureTransformExtension.prototype.extendTexture = function(texture, transform) { - texture = texture.clone(); + GLTFTextureTransformExtension.prototype.extendTexture = function (texture, transform) { + texture = texture.clone() if (transform.offset !== undefined) { texture.offset.fromArray(transform.offset) } @@ -303,74 +312,77 @@ export function registerGLTFLoader(THREE) { if (transform.texCoord !== undefined) { console.warn('THREE.GLTFLoader: Custom UV sets in "' + this.name + '" extension not yet supported.') } - texture.needsUpdate = true; + texture.needsUpdate = true return texture - }; + } function GLTFMaterialsPbrSpecularGlossinessExtension() { return { name: EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS, - specularGlossinessParams: ['color', 'map', 'lightMap', 'lightMapIntensity', 'aoMap', 'aoMapIntensity', 'emissive', 'emissiveIntensity', 'emissiveMap', 'bumpMap', 'bumpScale', 'normalMap', 'displacementMap', 'displacementScale', 'displacementBias', 'specularMap', 'specular', 'glossinessMap', 'glossiness', 'alphaMap', 'envMap', 'envMapIntensity', 'refractionRatio', ], - getMaterialType: function() { + specularGlossinessParams: ['color', 'map', 'lightMap', 'lightMapIntensity', 'aoMap', 'aoMapIntensity', 'emissive', 'emissiveIntensity', 'emissiveMap', 'bumpMap', 'bumpScale', 'normalMap', 'displacementMap', 'displacementScale', 'displacementBias', 'specularMap', 'specular', 'glossinessMap', 'glossiness', 'alphaMap', 'envMap', 'envMapIntensity', 'refractionRatio'], + getMaterialType() { return THREE.ShaderMaterial }, - extendParams: function(materialParams, materialDef, parser) { - var pbrSpecularGlossiness = materialDef.extensions[this.name]; - var shader = THREE.ShaderLib['standard']; - var uniforms = THREE.UniformsUtils.clone(shader.uniforms); - var specularMapParsFragmentChunk = ['#ifdef USE_SPECULARMAP', ' uniform sampler2D specularMap;', '#endif'].join('\n'); - var glossinessMapParsFragmentChunk = ['#ifdef USE_GLOSSINESSMAP', ' uniform sampler2D glossinessMap;', '#endif'].join('\n'); - var specularMapFragmentChunk = ['vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', ' vec4 texelSpecular = texture2D( specularMap, vUv );', ' texelSpecular = sRGBToLinear( texelSpecular );', ' // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', ' specularFactor *= texelSpecular.rgb;', '#endif'].join('\n'); - var glossinessMapFragmentChunk = ['float glossinessFactor = glossiness;', '#ifdef USE_GLOSSINESSMAP', ' vec4 texelGlossiness = texture2D( glossinessMap, vUv );', ' // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture', ' glossinessFactor *= texelGlossiness.a;', '#endif'].join('\n'); - var lightPhysicalFragmentChunk = ['PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb;', 'material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );', 'material.specularColor = specularFactor.rgb;', ].join('\n'); - var fragmentShader = shader.fragmentShader.replace('uniform float roughness;', 'uniform vec3 specular;').replace('uniform float metalness;', 'uniform float glossiness;').replace('#include ', specularMapParsFragmentChunk).replace('#include ', glossinessMapParsFragmentChunk).replace('#include ', specularMapFragmentChunk).replace('#include ', glossinessMapFragmentChunk).replace('#include ', lightPhysicalFragmentChunk); - delete uniforms.roughness; - delete uniforms.metalness; - delete uniforms.roughnessMap; - delete uniforms.metalnessMap; + extendParams(materialParams, materialDef, parser) { + const pbrSpecularGlossiness = materialDef.extensions[this.name] + const shader = THREE.ShaderLib.standard + const uniforms = THREE.UniformsUtils.clone(shader.uniforms) + const specularMapParsFragmentChunk = ['#ifdef USE_SPECULARMAP', ' uniform sampler2D specularMap;', '#endif'].join('\n') + const glossinessMapParsFragmentChunk = ['#ifdef USE_GLOSSINESSMAP', ' uniform sampler2D glossinessMap;', '#endif'].join('\n') + const specularMapFragmentChunk = ['vec3 specularFactor = specular;', '#ifdef USE_SPECULARMAP', ' vec4 texelSpecular = texture2D( specularMap, vUv );', ' texelSpecular = sRGBToLinear( texelSpecular );', ' // reads channel RGB, compatible with a glTF Specular-Glossiness (RGBA) texture', ' specularFactor *= texelSpecular.rgb;', '#endif'].join('\n') + const glossinessMapFragmentChunk = ['float glossinessFactor = glossiness;', '#ifdef USE_GLOSSINESSMAP', ' vec4 texelGlossiness = texture2D( glossinessMap, vUv );', ' // reads channel A, compatible with a glTF Specular-Glossiness (RGBA) texture', ' glossinessFactor *= texelGlossiness.a;', '#endif'].join('\n') + const lightPhysicalFragmentChunk = ['PhysicalMaterial material;', 'material.diffuseColor = diffuseColor.rgb;', 'material.specularRoughness = clamp( 1.0 - glossinessFactor, 0.04, 1.0 );', 'material.specularColor = specularFactor.rgb;'].join('\n') + const fragmentShader = shader.fragmentShader.replace('uniform float roughness;', 'uniform vec3 specular;').replace('uniform float metalness;', 'uniform float glossiness;').replace('#include ', specularMapParsFragmentChunk).replace('#include ', glossinessMapParsFragmentChunk) + .replace('#include ', specularMapFragmentChunk) + .replace('#include ', glossinessMapFragmentChunk) + .replace('#include ', lightPhysicalFragmentChunk) + delete uniforms.roughness + delete uniforms.metalness + delete uniforms.roughnessMap + delete uniforms.metalnessMap uniforms.specular = { value: new THREE.Color().setHex(0x111111) - }; + } uniforms.glossiness = { value: 0.5 - }; + } uniforms.specularMap = { value: null - }; + } uniforms.glossinessMap = { value: null - }; - materialParams.vertexShader = shader.vertexShader; - materialParams.fragmentShader = fragmentShader; - materialParams.uniforms = uniforms; + } + materialParams.vertexShader = shader.vertexShader + materialParams.fragmentShader = fragmentShader + materialParams.uniforms = uniforms materialParams.defines = { - 'STANDARD': '' + STANDARD: '' } - materialParams.color = new THREE.Color(1.0, 1.0, 1.0); - materialParams.opacity = 1.0; - var pending = []; + materialParams.color = new THREE.Color(1.0, 1.0, 1.0) + materialParams.opacity = 1.0 + const pending = [] if (Array.isArray(pbrSpecularGlossiness.diffuseFactor)) { - var array = pbrSpecularGlossiness.diffuseFactor; - materialParams.color.fromArray(array); + const array = pbrSpecularGlossiness.diffuseFactor + materialParams.color.fromArray(array) materialParams.opacity = array[3] } if (pbrSpecularGlossiness.diffuseTexture !== undefined) { pending.push(parser.assignTexture(materialParams, 'map', pbrSpecularGlossiness.diffuseTexture)) } - materialParams.emissive = new THREE.Color(0.0, 0.0, 0.0); - materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor: 1.0; - materialParams.specular = new THREE.Color(1.0, 1.0, 1.0); + materialParams.emissive = new THREE.Color(0.0, 0.0, 0.0) + materialParams.glossiness = pbrSpecularGlossiness.glossinessFactor !== undefined ? pbrSpecularGlossiness.glossinessFactor : 1.0 + materialParams.specular = new THREE.Color(1.0, 1.0, 1.0) if (Array.isArray(pbrSpecularGlossiness.specularFactor)) { materialParams.specular.fromArray(pbrSpecularGlossiness.specularFactor) } if (pbrSpecularGlossiness.specularGlossinessTexture !== undefined) { - var specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture; - pending.push(parser.assignTexture(materialParams, 'glossinessMap', specGlossMapDef)); + const specGlossMapDef = pbrSpecularGlossiness.specularGlossinessTexture + pending.push(parser.assignTexture(materialParams, 'glossinessMap', specGlossMapDef)) pending.push(parser.assignTexture(materialParams, 'specularMap', specGlossMapDef)) } return Promise.all(pending) }, - createMaterial: function(params) { - var material = new THREE.ShaderMaterial({ + createMaterial(params) { + const material = new THREE.ShaderMaterial({ defines: params.defines, vertexShader: params.vertexShader, fragmentShader: params.fragmentShader, @@ -379,63 +391,63 @@ export function registerGLTFLoader(THREE) { lights: true, opacity: params.opacity, transparent: params.transparent - }); - material.isGLTFSpecularGlossinessMaterial = true; - material.color = params.color; - material.map = params.map === undefined ? null: params.map; - material.lightMap = null; - material.lightMapIntensity = 1.0; - material.aoMap = params.aoMap === undefined ? null: params.aoMap; - material.aoMapIntensity = 1.0; - material.emissive = params.emissive; - material.emissiveIntensity = 1.0; - material.emissiveMap = params.emissiveMap === undefined ? null: params.emissiveMap; - material.bumpMap = params.bumpMap === undefined ? null: params.bumpMap; - material.bumpScale = 1; - material.normalMap = params.normalMap === undefined ? null: params.normalMap; - if (params.normalScale) material.normalScale = params.normalScale; - material.displacementMap = null; - material.displacementScale = 1; - material.displacementBias = 0; - material.specularMap = params.specularMap === undefined ? null: params.specularMap; - material.specular = params.specular; - material.glossinessMap = params.glossinessMap === undefined ? null: params.glossinessMap; - material.glossiness = params.glossiness; - material.alphaMap = null; - material.envMap = params.envMap === undefined ? null: params.envMap; - material.envMapIntensity = 1.0; - material.refractionRatio = 0.98; - material.extensions.derivatives = true; + }) + material.isGLTFSpecularGlossinessMaterial = true + material.color = params.color + material.map = params.map === undefined ? null : params.map + material.lightMap = null + material.lightMapIntensity = 1.0 + material.aoMap = params.aoMap === undefined ? null : params.aoMap + material.aoMapIntensity = 1.0 + material.emissive = params.emissive + material.emissiveIntensity = 1.0 + material.emissiveMap = params.emissiveMap === undefined ? null : params.emissiveMap + material.bumpMap = params.bumpMap === undefined ? null : params.bumpMap + material.bumpScale = 1 + material.normalMap = params.normalMap === undefined ? null : params.normalMap + if (params.normalScale) material.normalScale = params.normalScale + material.displacementMap = null + material.displacementScale = 1 + material.displacementBias = 0 + material.specularMap = params.specularMap === undefined ? null : params.specularMap + material.specular = params.specular + material.glossinessMap = params.glossinessMap === undefined ? null : params.glossinessMap + material.glossiness = params.glossiness + material.alphaMap = null + material.envMap = params.envMap === undefined ? null : params.envMap + material.envMapIntensity = 1.0 + material.refractionRatio = 0.98 + material.extensions.derivatives = true return material }, - cloneMaterial: function(source) { - var target = source.clone(); - target.isGLTFSpecularGlossinessMaterial = true; - var params = this.specularGlossinessParams; - for (var i = 0, - il = params.length; i < il; i++) { - var value = source[params[i]]; + cloneMaterial(source) { + const target = source.clone() + target.isGLTFSpecularGlossinessMaterial = true + const params = this.specularGlossinessParams + for (let i = 0, + il = params.length; i < il; i++) { + const value = source[params[i]] target[params[i]] = (value && value.isColor) ? value.clone() : value } return target }, - refreshUniforms: function(renderer, scene, camera, geometry, material) { + refreshUniforms(renderer, scene, camera, geometry, material) { if (material.isGLTFSpecularGlossinessMaterial !== true) { return } - var uniforms = material.uniforms; - var defines = material.defines; - uniforms.opacity.value = material.opacity; - uniforms.diffuse.value.copy(material.color); - uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity); - uniforms.map.value = material.map; - uniforms.specularMap.value = material.specularMap; - uniforms.alphaMap.value = material.alphaMap; - uniforms.lightMap.value = material.lightMap; - uniforms.lightMapIntensity.value = material.lightMapIntensity; - uniforms.aoMap.value = material.aoMap; - uniforms.aoMapIntensity.value = material.aoMapIntensity; - var uvScaleMap; + const uniforms = material.uniforms + const defines = material.defines + uniforms.opacity.value = material.opacity + uniforms.diffuse.value.copy(material.color) + uniforms.emissive.value.copy(material.emissive).multiplyScalar(material.emissiveIntensity) + uniforms.map.value = material.map + uniforms.specularMap.value = material.specularMap + uniforms.alphaMap.value = material.alphaMap + uniforms.lightMap.value = material.lightMap + uniforms.lightMapIntensity.value = material.lightMapIntensity + uniforms.aoMap.value = material.aoMap + uniforms.aoMapIntensity.value = material.aoMapIntensity + let uvScaleMap if (material.map) { uvScaleMap = material.map } else if (material.specularMap) { @@ -463,28 +475,28 @@ export function registerGLTFLoader(THREE) { uniforms.uvTransform.value.copy(uvScaleMap.matrix) } if (material.envMap) { - uniforms.envMap.value = material.envMap; - uniforms.envMapIntensity.value = material.envMapIntensity; - uniforms.flipEnvMap.value = material.envMap.isCubeTexture ? -1 : 1; - uniforms.reflectivity.value = material.reflectivity; - uniforms.refractionRatio.value = material.refractionRatio; + uniforms.envMap.value = material.envMap + uniforms.envMapIntensity.value = material.envMapIntensity + uniforms.flipEnvMap.value = material.envMap.isCubeTexture ? -1 : 1 + uniforms.reflectivity.value = material.reflectivity + uniforms.refractionRatio.value = material.refractionRatio uniforms.maxMipLevel.value = renderer.properties.get(material.envMap).__maxMipLevel } - uniforms.specular.value.copy(material.specular); - uniforms.glossiness.value = material.glossiness; - uniforms.glossinessMap.value = material.glossinessMap; - uniforms.emissiveMap.value = material.emissiveMap; - uniforms.bumpMap.value = material.bumpMap; - uniforms.normalMap.value = material.normalMap; - uniforms.displacementMap.value = material.displacementMap; - uniforms.displacementScale.value = material.displacementScale; - uniforms.displacementBias.value = material.displacementBias; + uniforms.specular.value.copy(material.specular) + uniforms.glossiness.value = material.glossiness + uniforms.glossinessMap.value = material.glossinessMap + uniforms.emissiveMap.value = material.emissiveMap + uniforms.bumpMap.value = material.bumpMap + uniforms.normalMap.value = material.normalMap + uniforms.displacementMap.value = material.displacementMap + uniforms.displacementScale.value = material.displacementScale + uniforms.displacementBias.value = material.displacementBias if (uniforms.glossinessMap.value !== null && defines.USE_GLOSSINESSMAP === undefined) { - defines.USE_GLOSSINESSMAP = ''; + defines.USE_GLOSSINESSMAP = '' defines.USE_ROUGHNESSMAP = '' } if (uniforms.glossinessMap.value === null && defines.USE_GLOSSINESSMAP !== undefined) { - delete defines.USE_GLOSSINESSMAP; + delete defines.USE_GLOSSINESSMAP delete defines.USE_ROUGHNESSMAP } } @@ -493,46 +505,46 @@ export function registerGLTFLoader(THREE) { function GLTFCubicSplineInterpolant(parameterPositions, sampleValues, sampleSize, resultBuffer) { THREE.Interpolant.call(this, parameterPositions, sampleValues, sampleSize, resultBuffer) } - GLTFCubicSplineInterpolant.prototype = Object.create(THREE.Interpolant.prototype); - GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant; - GLTFCubicSplineInterpolant.prototype.copySampleValue_ = function(index) { - var result = this.resultBuffer, - values = this.sampleValues, - valueSize = this.valueSize, - offset = index * valueSize * 3 + valueSize; - for (var i = 0; i !== valueSize; i++) { + GLTFCubicSplineInterpolant.prototype = Object.create(THREE.Interpolant.prototype) + GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant + GLTFCubicSplineInterpolant.prototype.copySampleValue_ = function (index) { + const result = this.resultBuffer + const values = this.sampleValues + const valueSize = this.valueSize + const offset = index * valueSize * 3 + valueSize + for (let i = 0; i !== valueSize; i++) { result[i] = values[offset + i] } return result - }; - GLTFCubicSplineInterpolant.prototype.beforeStart_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_; - GLTFCubicSplineInterpolant.prototype.afterEnd_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_; - GLTFCubicSplineInterpolant.prototype.interpolate_ = function(i1, t0, t, t1) { - var result = this.resultBuffer; - var values = this.sampleValues; - var stride = this.valueSize; - var stride2 = stride * 2; - var stride3 = stride * 3; - var td = t1 - t0; - var p = (t - t0) / td; - var pp = p * p; - var ppp = pp * p; - var offset1 = i1 * stride3; - var offset0 = offset1 - stride3; - var s2 = -2 * ppp + 3 * pp; - var s3 = ppp - pp; - var s0 = 1 - s2; - var s1 = s3 - pp + p; - for (var i = 0; i !== stride; i++) { - var p0 = values[offset0 + i + stride]; - var m0 = values[offset0 + i + stride2] * td; - var p1 = values[offset1 + i + stride]; - var m1 = values[offset1 + i] * td; + } + GLTFCubicSplineInterpolant.prototype.beforeStart_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_ + GLTFCubicSplineInterpolant.prototype.afterEnd_ = GLTFCubicSplineInterpolant.prototype.copySampleValue_ + GLTFCubicSplineInterpolant.prototype.interpolate_ = function (i1, t0, t, t1) { + const result = this.resultBuffer + const values = this.sampleValues + const stride = this.valueSize + const stride2 = stride * 2 + const stride3 = stride * 3 + const td = t1 - t0 + const p = (t - t0) / td + const pp = p * p + const ppp = pp * p + const offset1 = i1 * stride3 + const offset0 = offset1 - stride3 + const s2 = -2 * ppp + 3 * pp + const s3 = ppp - pp + const s0 = 1 - s2 + const s1 = s3 - pp + p + for (let i = 0; i !== stride; i++) { + const p0 = values[offset0 + i + stride] + const m0 = values[offset0 + i + stride2] * td + const p1 = values[offset1 + i + stride] + const m1 = values[offset1 + i] * td result[i] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1 } return result - }; - var WEBGL_CONSTANTS = { + } + const WEBGL_CONSTANTS = { FLOAT: 5126, FLOAT_MAT3: 35675, FLOAT_MAT4: 35676, @@ -551,37 +563,37 @@ export function registerGLTFLoader(THREE) { TRIANGLE_FAN: 6, UNSIGNED_BYTE: 5121, UNSIGNED_SHORT: 5123 - }; + } var WEBGL_COMPONENT_TYPES = { - 5120 : Int8Array, - 5121 : Uint8Array, - 5122 : Int16Array, - 5123 : Uint16Array, - 5125 : Uint32Array, - 5126 : Float32Array - }; - var WEBGL_FILTERS = { - 9728 : THREE.NearestFilter, - 9729 : THREE.LinearFilter, - 9984 : THREE.NearestMipmapNearestFilter, - 9985 : THREE.LinearMipmapNearestFilter, - 9986 : THREE.NearestMipmapLinearFilter, - 9987 : THREE.LinearMipmapLinearFilter - }; - var WEBGL_WRAPPINGS = { - 33071 : THREE.ClampToEdgeWrapping, - 33648 : THREE.MirroredRepeatWrapping, - 10497 : THREE.RepeatWrapping - }; - var WEBGL_TYPE_SIZES = { - 'SCALAR': 1, - 'VEC2': 2, - 'VEC3': 3, - 'VEC4': 4, - 'MAT2': 4, - 'MAT3': 9, - 'MAT4': 16 - }; + 5120: Int8Array, + 5121: Uint8Array, + 5122: Int16Array, + 5123: Uint16Array, + 5125: Uint32Array, + 5126: Float32Array + } + const WEBGL_FILTERS = { + 9728: THREE.NearestFilter, + 9729: THREE.LinearFilter, + 9984: THREE.NearestMipmapNearestFilter, + 9985: THREE.LinearMipmapNearestFilter, + 9986: THREE.NearestMipmapLinearFilter, + 9987: THREE.LinearMipmapLinearFilter + } + const WEBGL_WRAPPINGS = { + 33071: THREE.ClampToEdgeWrapping, + 33648: THREE.MirroredRepeatWrapping, + 10497: THREE.RepeatWrapping + } + const WEBGL_TYPE_SIZES = { + SCALAR: 1, + VEC2: 2, + VEC3: 3, + VEC4: 4, + MAT2: 4, + MAT3: 9, + MAT4: 16 + } var ATTRIBUTES = { POSITION: 'position', NORMAL: 'normal', @@ -591,38 +603,38 @@ export function registerGLTFLoader(THREE) { COLOR_0: 'color', WEIGHTS_0: 'skinWeight', JOINTS_0: 'skinIndex', - }; - var PATH_PROPERTIES = { + } + const PATH_PROPERTIES = { scale: 'scale', translation: 'position', rotation: 'quaternion', weights: 'morphTargetInfluences' - }; - var INTERPOLATION = { + } + const INTERPOLATION = { CUBICSPLINE: undefined, LINEAR: THREE.InterpolateLinear, STEP: THREE.InterpolateDiscrete - }; - var ALPHA_MODES = { + } + const ALPHA_MODES = { OPAQUE: 'OPAQUE', MASK: 'MASK', BLEND: 'BLEND' - }; - var MIME_TYPE_FORMATS = { + } + const MIME_TYPE_FORMATS = { 'image/png': THREE.RGBAFormat, 'image/jpeg': THREE.RGBFormat - }; + } function resolveURL(url, path) { - if (typeof url !== 'string' || url === '') return ''; + if (typeof url !== 'string' || url === '') return '' if (/^https?:\/\//i.test(path) && /^\//.test(url)) { path = path.replace(/(^https?:\/\/[^\/]+).*/i, '$1') } - if (/^(https?:)?\/\//i.test(url)) return url; - if (/^data:.*,.*$/i.test(url)) return url; - if (/^blob:.*$/i.test(url)) return url; + if (/^(https?:)?\/\//i.test(url)) return url + if (/^data:.*,.*$/i.test(url)) return url + if (/^blob:.*$/i.test(url)) return url return path + url } - var defaultMaterial; + let defaultMaterial function createDefaultMaterial() { defaultMaterial = defaultMaterial || new THREE.MeshStandardMaterial({ color: 0xFFFFFF, @@ -632,13 +644,13 @@ export function registerGLTFLoader(THREE) { transparent: false, depthTest: true, side: THREE.FrontSide - }); + }) return defaultMaterial } function addUnknownExtensionsToUserData(knownExtensions, object, objectDef) { - for (var name in objectDef.extensions) { + for (const name in objectDef.extensions) { if (knownExtensions[name] === undefined) { - object.userData.gltfExtensions = object.userData.gltfExtensions || {}; + object.userData.gltfExtensions = object.userData.gltfExtensions || {} object.userData.gltfExtensions[name] = objectDef.extensions[name] } } @@ -653,89 +665,89 @@ export function registerGLTFLoader(THREE) { } } function addMorphTargets(geometry, targets, parser) { - var hasMorphPosition = false; - var hasMorphNormal = false; + let hasMorphPosition = false + let hasMorphNormal = false for (var i = 0, - il = targets.length; i < il; i++) { - var target = targets[i]; - if (target.POSITION !== undefined) hasMorphPosition = true; - if (target.NORMAL !== undefined) hasMorphNormal = true; + il = targets.length; i < il; i++) { + var target = targets[i] + if (target.POSITION !== undefined) hasMorphPosition = true + if (target.NORMAL !== undefined) hasMorphNormal = true if (hasMorphPosition && hasMorphNormal) break } - if (!hasMorphPosition && !hasMorphNormal) return Promise.resolve(geometry); - var pendingPositionAccessors = []; - var pendingNormalAccessors = []; + if (!hasMorphPosition && !hasMorphNormal) return Promise.resolve(geometry) + const pendingPositionAccessors = [] + const pendingNormalAccessors = [] for (var i = 0, - il = targets.length; i < il; i++) { - var target = targets[i]; + il = targets.length; i < il; i++) { + var target = targets[i] if (hasMorphPosition) { - var pendingAccessor = target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position; + var pendingAccessor = target.POSITION !== undefined ? parser.getDependency('accessor', target.POSITION) : geometry.attributes.position pendingPositionAccessors.push(pendingAccessor) } if (hasMorphNormal) { - var pendingAccessor = target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal; + var pendingAccessor = target.NORMAL !== undefined ? parser.getDependency('accessor', target.NORMAL) : geometry.attributes.normal pendingNormalAccessors.push(pendingAccessor) } } - return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors)]).then(function(accessors) { - var morphPositions = accessors[0]; - var morphNormals = accessors[1]; + return Promise.all([Promise.all(pendingPositionAccessors), Promise.all(pendingNormalAccessors)]).then(function (accessors) { + const morphPositions = accessors[0] + const morphNormals = accessors[1] for (var i = 0, - il = morphPositions.length; i < il; i++) { - if (geometry.attributes.position === morphPositions[i]) continue; + il = morphPositions.length; i < il; i++) { + if (geometry.attributes.position === morphPositions[i]) continue morphPositions[i] = cloneBufferAttribute(morphPositions[i]) } for (var i = 0, - il = morphNormals.length; i < il; i++) { - if (geometry.attributes.normal === morphNormals[i]) continue; + il = morphNormals.length; i < il; i++) { + if (geometry.attributes.normal === morphNormals[i]) continue morphNormals[i] = cloneBufferAttribute(morphNormals[i]) } for (var i = 0, - il = targets.length; i < il; i++) { - var target = targets[i]; - var attributeName = 'morphTarget' + i; + il = targets.length; i < il; i++) { + const target = targets[i] + const attributeName = 'morphTarget' + i if (hasMorphPosition) { if (target.POSITION !== undefined) { - var positionAttribute = morphPositions[i]; - positionAttribute.name = attributeName; - var position = geometry.attributes.position; + const positionAttribute = morphPositions[i] + positionAttribute.name = attributeName + const position = geometry.attributes.position for (var j = 0, - jl = positionAttribute.count; j < jl; j++) { + jl = positionAttribute.count; j < jl; j++) { positionAttribute.setXYZ(j, positionAttribute.getX(j) + position.getX(j), positionAttribute.getY(j) + position.getY(j), positionAttribute.getZ(j) + position.getZ(j)) } } } if (hasMorphNormal) { if (target.NORMAL !== undefined) { - var normalAttribute = morphNormals[i]; - normalAttribute.name = attributeName; - var normal = geometry.attributes.normal; + const normalAttribute = morphNormals[i] + normalAttribute.name = attributeName + const normal = geometry.attributes.normal for (var j = 0, - jl = normalAttribute.count; j < jl; j++) { + jl = normalAttribute.count; j < jl; j++) { normalAttribute.setXYZ(j, normalAttribute.getX(j) + normal.getX(j), normalAttribute.getY(j) + normal.getY(j), normalAttribute.getZ(j) + normal.getZ(j)) } } } } - if (hasMorphPosition) geometry.morphAttributes.position = morphPositions; - if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals; + if (hasMorphPosition) geometry.morphAttributes.position = morphPositions + if (hasMorphNormal) geometry.morphAttributes.normal = morphNormals return geometry }) } function updateMorphTargets(mesh, meshDef) { - mesh.updateMorphTargets(); + mesh.updateMorphTargets() if (meshDef.weights !== undefined) { for (var i = 0, - il = meshDef.weights.length; i < il; i++) { + il = meshDef.weights.length; i < il; i++) { mesh.morphTargetInfluences[i] = meshDef.weights[i] } } if (meshDef.extras && Array.isArray(meshDef.extras.targetNames)) { - var targetNames = meshDef.extras.targetNames; + const targetNames = meshDef.extras.targetNames if (mesh.morphTargetInfluences.length === targetNames.length) { - mesh.morphTargetDictionary = {}; + mesh.morphTargetDictionary = {} for (var i = 0, - il = targetNames.length; i < il; i++) { + il = targetNames.length; i < il; i++) { mesh.morphTargetDictionary[targetNames[i]] = i } } else { @@ -744,8 +756,8 @@ export function registerGLTFLoader(THREE) { } } function createPrimitiveKey(primitiveDef) { - var dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]; - var geometryKey; + const dracoExtension = primitiveDef.extensions && primitiveDef.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION] + let geometryKey if (dracoExtension) { geometryKey = 'draco:' + dracoExtension.bufferView + ':' + dracoExtension.indices + ':' + createAttributesKey(dracoExtension.attributes) } else { @@ -754,24 +766,24 @@ export function registerGLTFLoader(THREE) { return geometryKey } function createAttributesKey(attributes) { - var attributesKey = ''; - var keys = Object.keys(attributes).sort(); - for (var i = 0, - il = keys.length; i < il; i++) { + let attributesKey = '' + const keys = Object.keys(attributes).sort() + for (let i = 0, + il = keys.length; i < il; i++) { attributesKey += keys[i] + ':' + attributes[keys[i]] + ';' } return attributesKey } function cloneBufferAttribute(attribute) { if (attribute.isInterleavedBufferAttribute) { - var count = attribute.count; - var itemSize = attribute.itemSize; - var array = attribute.array.slice(0, count * itemSize); - for (var i = 0, - j = 0; i < count; ++i) { - array[j++] = attribute.getX(i); - if (itemSize >= 2) array[j++] = attribute.getY(i); - if (itemSize >= 3) array[j++] = attribute.getZ(i); + const count = attribute.count + const itemSize = attribute.itemSize + const array = attribute.array.slice(0, count * itemSize) + for (let i = 0, + j = 0; i < count; ++i) { + array[j++] = attribute.getX(i) + if (itemSize >= 2) array[j++] = attribute.getY(i) + if (itemSize >= 3) array[j++] = attribute.getZ(i) if (itemSize >= 4) array[j++] = attribute.getW(i) } return new THREE.BufferAttribute(array, itemSize, attribute.normalized) @@ -779,187 +791,192 @@ export function registerGLTFLoader(THREE) { return attribute.clone() } function GLTFParser(json, extensions, options) { - this.json = json || {}; - this.extensions = extensions || {}; - this.options = options || {}; - this.cache = new GLTFRegistry(); - this.primitiveCache = {}; - this.textureLoader = new THREE.TextureLoader(this.options.manager); - this.textureLoader.setCrossOrigin(this.options.crossOrigin); - this.fileLoader = new THREE.FileLoader(this.options.manager); + this.json = json || {} + this.extensions = extensions || {} + this.options = options || {} + this.cache = new GLTFRegistry() + this.primitiveCache = {} + this.textureLoader = new THREE.TextureLoader(this.options.manager) + this.textureLoader.setCrossOrigin(this.options.crossOrigin) + this.fileLoader = new THREE.FileLoader(this.options.manager) this.fileLoader.setResponseType('arraybuffer') } - GLTFParser.prototype.parse = function(onLoad, onError) { - var parser = this; - var json = this.json; - var extensions = this.extensions; - this.cache.removeAll(); - this.markDefs(); - Promise.all([this.getDependencies('scene'), this.getDependencies('animation'), this.getDependencies('camera'), ]).then(function(dependencies) { - var result = { + GLTFParser.prototype.parse = function (onLoad, onError) { + const parser = this + const json = this.json + const extensions = this.extensions + this.cache.removeAll() + this.markDefs() + Promise.all([this.getDependencies('scene'), this.getDependencies('animation'), this.getDependencies('camera')]).then(function (dependencies) { + const result = { scene: dependencies[0][json.scene || 0], scenes: dependencies[0], animations: dependencies[1], cameras: dependencies[2], asset: json.asset, - parser: parser, + parser, userData: {} - }; - addUnknownExtensionsToUserData(extensions, result, json); - assignExtrasToUserData(result, json); + } + addUnknownExtensionsToUserData(extensions, result, json) + assignExtrasToUserData(result, json) onLoad(result) - }). - catch(onError) - }; - GLTFParser.prototype.markDefs = function() { - var nodeDefs = this.json.nodes || []; - var skinDefs = this.json.skins || []; - var meshDefs = this.json.meshes || []; - var meshReferences = {}; - var meshUses = {}; - for (var skinIndex = 0, - skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) { - var joints = skinDefs[skinIndex].joints; - for (var i = 0, - il = joints.length; i < il; i++) { + }) + .catch(onError) + } + GLTFParser.prototype.markDefs = function () { + const nodeDefs = this.json.nodes || [] + const skinDefs = this.json.skins || [] + const meshDefs = this.json.meshes || [] + const meshReferences = {} + const meshUses = {} + for (let skinIndex = 0, + skinLength = skinDefs.length; skinIndex < skinLength; skinIndex++) { + const joints = skinDefs[skinIndex].joints + for (let i = 0, + il = joints.length; i < il; i++) { nodeDefs[joints[i]].isBone = true } } - for (var nodeIndex = 0, - nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { - var nodeDef = nodeDefs[nodeIndex]; + for (let nodeIndex = 0, + nodeLength = nodeDefs.length; nodeIndex < nodeLength; nodeIndex++) { + const nodeDef = nodeDefs[nodeIndex] if (nodeDef.mesh !== undefined) { if (meshReferences[nodeDef.mesh] === undefined) { meshReferences[nodeDef.mesh] = meshUses[nodeDef.mesh] = 0 } - meshReferences[nodeDef.mesh]++; + meshReferences[nodeDef.mesh]++ if (nodeDef.skin !== undefined) { meshDefs[nodeDef.mesh].isSkinnedMesh = true } } } - this.json.meshReferences = meshReferences; + this.json.meshReferences = meshReferences this.json.meshUses = meshUses - }; - GLTFParser.prototype.getDependency = function(type, index) { - var cacheKey = type + ':' + index; - var dependency = this.cache.get(cacheKey); + } + GLTFParser.prototype.getDependency = function (type, index) { + const cacheKey = type + ':' + index + let dependency = this.cache.get(cacheKey) if (!dependency) { switch (type) { - case 'scene': - dependency = this.loadScene(index); - break; - case 'node': - dependency = this.loadNode(index); - break; - case 'mesh': - dependency = this.loadMesh(index); - break; - case 'accessor': - dependency = this.loadAccessor(index); - break; - case 'bufferView': - dependency = this.loadBufferView(index); - break; - case 'buffer': - dependency = this.loadBuffer(index); - break; - case 'material': - dependency = this.loadMaterial(index); - break; - case 'texture': - dependency = this.loadTexture(index); - break; - case 'skin': - dependency = this.loadSkin(index); - break; - case 'animation': - dependency = this.loadAnimation(index); - break; - case 'camera': - dependency = this.loadCamera(index); - break; - case 'light': - dependency = this.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL].loadLight(index); - break; - default: - throw new Error('Unknown type: ' + type); + case 'scene': + dependency = this.loadScene(index) + break + case 'node': + dependency = this.loadNode(index) + break + case 'mesh': + dependency = this.loadMesh(index) + break + case 'accessor': + dependency = this.loadAccessor(index) + break + case 'bufferView': + dependency = this.loadBufferView(index) + break + case 'buffer': + dependency = this.loadBuffer(index) + break + case 'material': + dependency = this.loadMaterial(index) + break + case 'texture': + dependency = this.loadTexture(index) + break + case 'skin': + dependency = this.loadSkin(index) + break + case 'animation': + dependency = this.loadAnimation(index) + break + case 'camera': + dependency = this.loadCamera(index) + break + case 'light': + dependency = this.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL].loadLight(index) + break + default: + throw new Error('Unknown type: ' + type) } this.cache.add(cacheKey, dependency) } return dependency - }; - GLTFParser.prototype.getDependencies = function(type) { - var dependencies = this.cache.get(type); + } + GLTFParser.prototype.getDependencies = function (type) { + let dependencies = this.cache.get(type) if (!dependencies) { - var parser = this; - var defs = this.json[type + (type === 'mesh' ? 'es': 's')] || []; - dependencies = Promise.all(defs.map(function(def, index) { + const parser = this + const defs = this.json[type + (type === 'mesh' ? 'es' : 's')] || [] + dependencies = Promise.all(defs.map(function (def, index) { return parser.getDependency(type, index) - })); + })) this.cache.add(type, dependencies) } return dependencies - }; - GLTFParser.prototype.loadBuffer = function(bufferIndex) { - var bufferDef = this.json.buffers[bufferIndex]; - var loader = this.fileLoader; + } + GLTFParser.prototype.loadBuffer = function (bufferIndex) { + const bufferDef = this.json.buffers[bufferIndex] + const loader = this.fileLoader if (bufferDef.type && bufferDef.type !== 'arraybuffer') { - throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.'); + throw new Error('THREE.GLTFLoader: ' + bufferDef.type + ' buffer type is not supported.') } if (bufferDef.uri === undefined && bufferIndex === 0) { return Promise.resolve(this.extensions[EXTENSIONS.KHR_BINARY_GLTF].body) } - var options = this.options; - return new Promise(function(resolve, reject) { - loader.load(resolveURL(bufferDef.uri, options.path), resolve, undefined, - function() { - reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".')) - }) + const options = this.options + return new Promise(function (resolve, reject) { + loader.load( + resolveURL(bufferDef.uri, options.path), + resolve, + undefined, + function () { + reject(new Error('THREE.GLTFLoader: Failed to load buffer "' + bufferDef.uri + '".')) + } + ) }) - }; - GLTFParser.prototype.loadBufferView = function(bufferViewIndex) { - var bufferViewDef = this.json.bufferViews[bufferViewIndex]; - return this.getDependency('buffer', bufferViewDef.buffer).then(function(buffer) { - var byteLength = bufferViewDef.byteLength || 0; - var byteOffset = bufferViewDef.byteOffset || 0; + } + GLTFParser.prototype.loadBufferView = function (bufferViewIndex) { + const bufferViewDef = this.json.bufferViews[bufferViewIndex] + return this.getDependency('buffer', bufferViewDef.buffer).then(function (buffer) { + const byteLength = bufferViewDef.byteLength || 0 + const byteOffset = bufferViewDef.byteOffset || 0 return buffer.slice(byteOffset, byteOffset + byteLength) }) - }; - GLTFParser.prototype.loadAccessor = function(accessorIndex) { - var parser = this; - var json = this.json; - var accessorDef = this.json.accessors[accessorIndex]; + } + GLTFParser.prototype.loadAccessor = function (accessorIndex) { + const parser = this + const json = this.json + const accessorDef = this.json.accessors[accessorIndex] if (accessorDef.bufferView === undefined && accessorDef.sparse === undefined) { return Promise.resolve(null) } - var pendingBufferViews = []; + const pendingBufferViews = [] if (accessorDef.bufferView !== undefined) { pendingBufferViews.push(this.getDependency('bufferView', accessorDef.bufferView)) } else { pendingBufferViews.push(null) } if (accessorDef.sparse !== undefined) { - pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.indices.bufferView)); + pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.indices.bufferView)) pendingBufferViews.push(this.getDependency('bufferView', accessorDef.sparse.values.bufferView)) } - return Promise.all(pendingBufferViews).then(function(bufferViews) { - var bufferView = bufferViews[0]; - var itemSize = WEBGL_TYPE_SIZES[accessorDef.type]; - var TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType]; - var elementBytes = TypedArray.BYTES_PER_ELEMENT; - var itemBytes = elementBytes * itemSize; - var byteOffset = accessorDef.byteOffset || 0; - var byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride: undefined; - var normalized = accessorDef.normalized === true; - var array, bufferAttribute; + return Promise.all(pendingBufferViews).then(function (bufferViews) { + const bufferView = bufferViews[0] + const itemSize = WEBGL_TYPE_SIZES[accessorDef.type] + const TypedArray = WEBGL_COMPONENT_TYPES[accessorDef.componentType] + const elementBytes = TypedArray.BYTES_PER_ELEMENT + const itemBytes = elementBytes * itemSize + const byteOffset = accessorDef.byteOffset || 0 + const byteStride = accessorDef.bufferView !== undefined ? json.bufferViews[accessorDef.bufferView].byteStride : undefined + const normalized = accessorDef.normalized === true + let array; let + bufferAttribute if (byteStride && byteStride !== itemBytes) { - var ibSlice = Math.floor(byteOffset / byteStride); - var ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count; - var ib = parser.cache.get(ibCacheKey); + const ibSlice = Math.floor(byteOffset / byteStride) + const ibCacheKey = 'InterleavedBuffer:' + accessorDef.bufferView + ':' + accessorDef.componentType + ':' + ibSlice + ':' + accessorDef.count + let ib = parser.cache.get(ibCacheKey) if (!ib) { - array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes); - ib = new THREE.InterleavedBuffer(array, byteStride / elementBytes); + array = new TypedArray(bufferView, ibSlice * byteStride, accessorDef.count * byteStride / elementBytes) + ib = new THREE.InterleavedBuffer(array, byteStride / elementBytes) parser.cache.add(ibCacheKey, ib) } bufferAttribute = new THREE.InterleavedBufferAttribute(ib, itemSize, (byteOffset % byteStride) / elementBytes, normalized) @@ -972,226 +989,226 @@ export function registerGLTFLoader(THREE) { bufferAttribute = new THREE.BufferAttribute(array, itemSize, normalized) } if (accessorDef.sparse !== undefined) { - var itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR; - var TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType]; - var byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0; - var byteOffsetValues = accessorDef.sparse.values.byteOffset || 0; - var sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices); - var sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize); + const itemSizeIndices = WEBGL_TYPE_SIZES.SCALAR + const TypedArrayIndices = WEBGL_COMPONENT_TYPES[accessorDef.sparse.indices.componentType] + const byteOffsetIndices = accessorDef.sparse.indices.byteOffset || 0 + const byteOffsetValues = accessorDef.sparse.values.byteOffset || 0 + const sparseIndices = new TypedArrayIndices(bufferViews[1], byteOffsetIndices, accessorDef.sparse.count * itemSizeIndices) + const sparseValues = new TypedArray(bufferViews[2], byteOffsetValues, accessorDef.sparse.count * itemSize) if (bufferView !== null) { bufferAttribute.setArray(bufferAttribute.array.slice()) } - for (var i = 0, - il = sparseIndices.length; i < il; i++) { - var index = sparseIndices[i]; - bufferAttribute.setX(index, sparseValues[i * itemSize]); - if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]); - if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]); - if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]); - if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.'); + for (let i = 0, + il = sparseIndices.length; i < il; i++) { + const index = sparseIndices[i] + bufferAttribute.setX(index, sparseValues[i * itemSize]) + if (itemSize >= 2) bufferAttribute.setY(index, sparseValues[i * itemSize + 1]) + if (itemSize >= 3) bufferAttribute.setZ(index, sparseValues[i * itemSize + 2]) + if (itemSize >= 4) bufferAttribute.setW(index, sparseValues[i * itemSize + 3]) + if (itemSize >= 5) throw new Error('THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.') } } return bufferAttribute }) - }; - GLTFParser.prototype.loadTexture = function(textureIndex) { - var parser = this; - var json = this.json; - var options = this.options; - var textureLoader = this.textureLoader; + } + GLTFParser.prototype.loadTexture = function (textureIndex) { + const parser = this + const json = this.json + const options = this.options + const textureLoader = this.textureLoader // var URL = global.URL; - var textureDef = json.textures[textureIndex]; - var textureExtensions = textureDef.extensions || {}; - var source; + const textureDef = json.textures[textureIndex] + const textureExtensions = textureDef.extensions || {} + let source if (textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS]) { source = json.images[textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS].source] } else { source = json.images[textureDef.source] } - var sourceURI = source.uri; - var isObjectURL = false; + let sourceURI = source.uri + let isObjectURL = false if (source.bufferView !== undefined) { - sourceURI = parser.getDependency('bufferView', source.bufferView).then(function(bufferView) { - isObjectURL = true; + sourceURI = parser.getDependency('bufferView', source.bufferView).then(function (bufferView) { + isObjectURL = true // 微信小程序不支持 Blob 对象,则使用 base64 编码的字符串来创建 data URI - const base64Str = wx.arrayBufferToBase64(bufferView); - sourceURI = `data:${source.mimeType};base64,${base64Str}`; + const base64Str = wx.arrayBufferToBase64(bufferView) + sourceURI = `data:${source.mimeType};base64,${base64Str}` return sourceURI }) } - return Promise.resolve(sourceURI).then(function(sourceURI) { - var loader = THREE.Loader.Handlers.get(sourceURI); + return Promise.resolve(sourceURI).then(function (sourceURI) { + let loader = THREE.Loader.Handlers.get(sourceURI) if (!loader) { - loader = textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS] ? parser.extensions[EXTENSIONS.MSFT_TEXTURE_DDS].ddsLoader: textureLoader + loader = textureExtensions[EXTENSIONS.MSFT_TEXTURE_DDS] ? parser.extensions[EXTENSIONS.MSFT_TEXTURE_DDS].ddsLoader : textureLoader } - return new Promise(function(resolve, reject) { + return new Promise(function (resolve, reject) { loader.load(resolveURL(sourceURI, options.path), resolve, undefined, reject) }) - }).then(function(texture) { + }).then(function (texture) { if (isObjectURL === true) { // URL.revokeObjectURL(sourceURI) } - texture.flipY = false; - if (textureDef.name !== undefined) texture.name = textureDef.name; + texture.flipY = false + if (textureDef.name !== undefined) texture.name = textureDef.name if (source.mimeType in MIME_TYPE_FORMATS) { texture.format = MIME_TYPE_FORMATS[source.mimeType] } - var samplers = json.samplers || {}; - var sampler = samplers[textureDef.sampler] || {}; - texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || THREE.LinearFilter; - texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || THREE.LinearMipmapLinearFilter; - texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || THREE.RepeatWrapping; - texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || THREE.RepeatWrapping; + const samplers = json.samplers || {} + const sampler = samplers[textureDef.sampler] || {} + texture.magFilter = WEBGL_FILTERS[sampler.magFilter] || THREE.LinearFilter + texture.minFilter = WEBGL_FILTERS[sampler.minFilter] || THREE.LinearMipmapLinearFilter + texture.wrapS = WEBGL_WRAPPINGS[sampler.wrapS] || THREE.RepeatWrapping + texture.wrapT = WEBGL_WRAPPINGS[sampler.wrapT] || THREE.RepeatWrapping return texture }) - }; - GLTFParser.prototype.assignTexture = function(materialParams, mapName, mapDef) { - var parser = this; - return this.getDependency('texture', mapDef.index).then(function(texture) { + } + GLTFParser.prototype.assignTexture = function (materialParams, mapName, mapDef) { + const parser = this + return this.getDependency('texture', mapDef.index).then(function (texture) { if (!texture.isCompressedTexture) { switch (mapName) { - case 'aoMap': - case 'emissiveMap': - case 'metalnessMap': - case 'normalMap': - case 'roughnessMap': - texture.format = THREE.RGBFormat; - break + case 'aoMap': + case 'emissiveMap': + case 'metalnessMap': + case 'normalMap': + case 'roughnessMap': + texture.format = THREE.RGBFormat + break } } if (parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM]) { - var transform = mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined; + const transform = mapDef.extensions !== undefined ? mapDef.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM] : undefined if (transform) { texture = parser.extensions[EXTENSIONS.KHR_TEXTURE_TRANSFORM].extendTexture(texture, transform) } } materialParams[mapName] = texture }) - }; - GLTFParser.prototype.assignFinalMaterial = function(mesh) { - var geometry = mesh.geometry; - var material = mesh.material; - var extensions = this.extensions; - var useVertexTangents = geometry.attributes.tangent !== undefined; - var useVertexColors = geometry.attributes.color !== undefined; - var useFlatShading = geometry.attributes.normal === undefined; - var useSkinning = mesh.isSkinnedMesh === true; - var useMorphTargets = Object.keys(geometry.morphAttributes).length > 0; - var useMorphNormals = useMorphTargets && geometry.morphAttributes.normal !== undefined; + } + GLTFParser.prototype.assignFinalMaterial = function (mesh) { + const geometry = mesh.geometry + let material = mesh.material + const extensions = this.extensions + const useVertexTangents = geometry.attributes.tangent !== undefined + const useVertexColors = geometry.attributes.color !== undefined + const useFlatShading = geometry.attributes.normal === undefined + const useSkinning = mesh.isSkinnedMesh === true + const useMorphTargets = Object.keys(geometry.morphAttributes).length > 0 + const useMorphNormals = useMorphTargets && geometry.morphAttributes.normal !== undefined if (mesh.isPoints) { - var cacheKey = 'PointsMaterial:' + material.uuid; - var pointsMaterial = this.cache.get(cacheKey); + var cacheKey = 'PointsMaterial:' + material.uuid + let pointsMaterial = this.cache.get(cacheKey) if (!pointsMaterial) { - pointsMaterial = new THREE.PointsMaterial(); - THREE.Material.prototype.copy.call(pointsMaterial, material); - pointsMaterial.color.copy(material.color); - pointsMaterial.map = material.map; - pointsMaterial.lights = false; - pointsMaterial.sizeAttenuation = false; + pointsMaterial = new THREE.PointsMaterial() + THREE.Material.prototype.copy.call(pointsMaterial, material) + pointsMaterial.color.copy(material.color) + pointsMaterial.map = material.map + pointsMaterial.lights = false + pointsMaterial.sizeAttenuation = false this.cache.add(cacheKey, pointsMaterial) } material = pointsMaterial } else if (mesh.isLine) { - var cacheKey = 'LineBasicMaterial:' + material.uuid; - var lineMaterial = this.cache.get(cacheKey); + var cacheKey = 'LineBasicMaterial:' + material.uuid + let lineMaterial = this.cache.get(cacheKey) if (!lineMaterial) { - lineMaterial = new THREE.LineBasicMaterial(); - THREE.Material.prototype.copy.call(lineMaterial, material); - lineMaterial.color.copy(material.color); - lineMaterial.lights = false; + lineMaterial = new THREE.LineBasicMaterial() + THREE.Material.prototype.copy.call(lineMaterial, material) + lineMaterial.color.copy(material.color) + lineMaterial.lights = false this.cache.add(cacheKey, lineMaterial) } material = lineMaterial } if (useVertexTangents || useVertexColors || useFlatShading || useSkinning || useMorphTargets) { - var cacheKey = 'ClonedMaterial:' + material.uuid + ':'; - if (material.isGLTFSpecularGlossinessMaterial) cacheKey += 'specular-glossiness:'; - if (useSkinning) cacheKey += 'skinning:'; - if (useVertexTangents) cacheKey += 'vertex-tangents:'; - if (useVertexColors) cacheKey += 'vertex-colors:'; - if (useFlatShading) cacheKey += 'flat-shading:'; - if (useMorphTargets) cacheKey += 'morph-targets:'; - if (useMorphNormals) cacheKey += 'morph-normals:'; - var cachedMaterial = this.cache.get(cacheKey); + var cacheKey = 'ClonedMaterial:' + material.uuid + ':' + if (material.isGLTFSpecularGlossinessMaterial) cacheKey += 'specular-glossiness:' + if (useSkinning) cacheKey += 'skinning:' + if (useVertexTangents) cacheKey += 'vertex-tangents:' + if (useVertexColors) cacheKey += 'vertex-colors:' + if (useFlatShading) cacheKey += 'flat-shading:' + if (useMorphTargets) cacheKey += 'morph-targets:' + if (useMorphNormals) cacheKey += 'morph-normals:' + let cachedMaterial = this.cache.get(cacheKey) if (!cachedMaterial) { - cachedMaterial = material.isGLTFSpecularGlossinessMaterial ? extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(material) : material.clone(); - if (useSkinning) cachedMaterial.skinning = true; - if (useVertexTangents) cachedMaterial.vertexTangents = true; - if (useVertexColors) cachedMaterial.vertexColors = THREE.VertexColors; - if (useFlatShading) cachedMaterial.flatShading = true; - if (useMorphTargets) cachedMaterial.morphTargets = true; - if (useMorphNormals) cachedMaterial.morphNormals = true; + cachedMaterial = material.isGLTFSpecularGlossinessMaterial ? extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].cloneMaterial(material) : material.clone() + if (useSkinning) cachedMaterial.skinning = true + if (useVertexTangents) cachedMaterial.vertexTangents = true + if (useVertexColors) cachedMaterial.vertexColors = THREE.VertexColors + if (useFlatShading) cachedMaterial.flatShading = true + if (useMorphTargets) cachedMaterial.morphTargets = true + if (useMorphNormals) cachedMaterial.morphNormals = true this.cache.add(cacheKey, cachedMaterial) } material = cachedMaterial } if (material.aoMap && geometry.attributes.uv2 === undefined && geometry.attributes.uv !== undefined) { - console.log('THREE.GLTFLoader: Duplicating UVs to support aoMap.'); + console.log('THREE.GLTFLoader: Duplicating UVs to support aoMap.') geometry.addAttribute('uv2', new THREE.BufferAttribute(geometry.attributes.uv.array, 2)) } if (material.isGLTFSpecularGlossinessMaterial) { mesh.onBeforeRender = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].refreshUniforms } mesh.material = material - }; - GLTFParser.prototype.loadMaterial = function(materialIndex) { - var parser = this; - var json = this.json; - var extensions = this.extensions; - var materialDef = json.materials[materialIndex]; - var materialType; - var materialParams = {}; - var materialExtensions = materialDef.extensions || {}; - var pending = []; + } + GLTFParser.prototype.loadMaterial = function (materialIndex) { + const parser = this + const json = this.json + const extensions = this.extensions + const materialDef = json.materials[materialIndex] + let materialType + const materialParams = {} + const materialExtensions = materialDef.extensions || {} + const pending = [] if (materialExtensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]) { - var sgExtension = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS]; - materialType = sgExtension.getMaterialType(); + const sgExtension = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS] + materialType = sgExtension.getMaterialType() pending.push(sgExtension.extendParams(materialParams, materialDef, parser)) } else if (materialExtensions[EXTENSIONS.KHR_MATERIALS_UNLIT]) { - var kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT]; - materialType = kmuExtension.getMaterialType(); + const kmuExtension = extensions[EXTENSIONS.KHR_MATERIALS_UNLIT] + materialType = kmuExtension.getMaterialType() pending.push(kmuExtension.extendParams(materialParams, materialDef, parser)) } else { - materialType = THREE.MeshStandardMaterial; - var metallicRoughness = materialDef.pbrMetallicRoughness || {}; - materialParams.color = new THREE.Color(1.0, 1.0, 1.0); - materialParams.opacity = 1.0; + materialType = THREE.MeshStandardMaterial + const metallicRoughness = materialDef.pbrMetallicRoughness || {} + materialParams.color = new THREE.Color(1.0, 1.0, 1.0) + materialParams.opacity = 1.0 if (Array.isArray(metallicRoughness.baseColorFactor)) { - var array = metallicRoughness.baseColorFactor; - materialParams.color.fromArray(array); + const array = metallicRoughness.baseColorFactor + materialParams.color.fromArray(array) materialParams.opacity = array[3] } if (metallicRoughness.baseColorTexture !== undefined) { pending.push(parser.assignTexture(materialParams, 'map', metallicRoughness.baseColorTexture)) } - materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor: 1.0; - materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor: 1.0; + materialParams.metalness = metallicRoughness.metallicFactor !== undefined ? metallicRoughness.metallicFactor : 1.0 + materialParams.roughness = metallicRoughness.roughnessFactor !== undefined ? metallicRoughness.roughnessFactor : 1.0 if (metallicRoughness.metallicRoughnessTexture !== undefined) { - pending.push(parser.assignTexture(materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture)); + pending.push(parser.assignTexture(materialParams, 'metalnessMap', metallicRoughness.metallicRoughnessTexture)) pending.push(parser.assignTexture(materialParams, 'roughnessMap', metallicRoughness.metallicRoughnessTexture)) } } if (materialDef.doubleSided === true) { materialParams.side = THREE.DoubleSide } - var alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE; + const alphaMode = materialDef.alphaMode || ALPHA_MODES.OPAQUE if (alphaMode === ALPHA_MODES.BLEND) { materialParams.transparent = true } else { - materialParams.transparent = false; + materialParams.transparent = false if (alphaMode === ALPHA_MODES.MASK) { - materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff: 0.5 + materialParams.alphaTest = materialDef.alphaCutoff !== undefined ? materialDef.alphaCutoff : 0.5 } } if (materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { - pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture)); - materialParams.normalScale = new THREE.Vector2(1, 1); + pending.push(parser.assignTexture(materialParams, 'normalMap', materialDef.normalTexture)) + materialParams.normalScale = new THREE.Vector2(1, 1) if (materialDef.normalTexture.scale !== undefined) { materialParams.normalScale.set(materialDef.normalTexture.scale, materialDef.normalTexture.scale) } } if (materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { - pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture)); + pending.push(parser.assignTexture(materialParams, 'aoMap', materialDef.occlusionTexture)) if (materialDef.occlusionTexture.strength !== undefined) { materialParams.aoMapIntensity = materialDef.occlusionTexture.strength } @@ -1202,101 +1219,101 @@ export function registerGLTFLoader(THREE) { if (materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial) { pending.push(parser.assignTexture(materialParams, 'emissiveMap', materialDef.emissiveTexture)) } - return Promise.all(pending).then(function() { - var material; + return Promise.all(pending).then(function () { + let material if (materialType === THREE.ShaderMaterial) { material = extensions[EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS].createMaterial(materialParams) } else { material = new materialType(materialParams) } - if (materialDef.name !== undefined) material.name = materialDef.name; - if (material.map) material.map.encoding = THREE.sRGBEncoding; - if (material.emissiveMap) material.emissiveMap.encoding = THREE.sRGBEncoding; - if (material.specularMap) material.specularMap.encoding = THREE.sRGBEncoding; - assignExtrasToUserData(material, materialDef); - if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef); + if (materialDef.name !== undefined) material.name = materialDef.name + if (material.map) material.map.encoding = THREE.sRGBEncoding + if (material.emissiveMap) material.emissiveMap.encoding = THREE.sRGBEncoding + if (material.specularMap) material.specularMap.encoding = THREE.sRGBEncoding + assignExtrasToUserData(material, materialDef) + if (materialDef.extensions) addUnknownExtensionsToUserData(extensions, material, materialDef) return material }) - }; + } function addPrimitiveAttributes(geometry, primitiveDef, parser) { - var attributes = primitiveDef.attributes; - var pending = []; + const attributes = primitiveDef.attributes + const pending = [] function assignAttributeAccessor(accessorIndex, attributeName) { - return parser.getDependency('accessor', accessorIndex).then(function(accessor) { + return parser.getDependency('accessor', accessorIndex).then(function (accessor) { geometry.addAttribute(attributeName, accessor) }) } - for (var gltfAttributeName in attributes) { - var threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase(); - if (threeAttributeName in geometry.attributes) continue; + for (const gltfAttributeName in attributes) { + const threeAttributeName = ATTRIBUTES[gltfAttributeName] || gltfAttributeName.toLowerCase() + if (threeAttributeName in geometry.attributes) continue pending.push(assignAttributeAccessor(attributes[gltfAttributeName], threeAttributeName)) } if (primitiveDef.indices !== undefined && !geometry.index) { - var accessor = parser.getDependency('accessor', primitiveDef.indices).then(function(accessor) { + const accessor = parser.getDependency('accessor', primitiveDef.indices).then(function (accessor) { geometry.setIndex(accessor) - }); + }) pending.push(accessor) } - assignExtrasToUserData(geometry, primitiveDef); - return Promise.all(pending).then(function() { + assignExtrasToUserData(geometry, primitiveDef) + return Promise.all(pending).then(function () { return primitiveDef.targets !== undefined ? addMorphTargets(geometry, primitiveDef.targets, parser) : geometry }) } - GLTFParser.prototype.loadGeometries = function(primitives) { - var parser = this; - var extensions = this.extensions; - var cache = this.primitiveCache; + GLTFParser.prototype.loadGeometries = function (primitives) { + const parser = this + const extensions = this.extensions + const cache = this.primitiveCache function createDracoPrimitive(primitive) { - return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function(geometry) { + return extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(primitive, parser).then(function (geometry) { return addPrimitiveAttributes(geometry, primitive, parser) }) } - var pending = []; - for (var i = 0, - il = primitives.length; i < il; i++) { - var primitive = primitives[i]; - var cacheKey = createPrimitiveKey(primitive); - var cached = cache[cacheKey]; + const pending = [] + for (let i = 0, + il = primitives.length; i < il; i++) { + const primitive = primitives[i] + const cacheKey = createPrimitiveKey(primitive) + const cached = cache[cacheKey] if (cached) { pending.push(cached.promise) } else { - var geometryPromise; + var geometryPromise if (primitive.extensions && primitive.extensions[EXTENSIONS.KHR_DRACO_MESH_COMPRESSION]) { geometryPromise = createDracoPrimitive(primitive) } else { geometryPromise = addPrimitiveAttributes(new THREE.BufferGeometry(), primitive, parser) } cache[cacheKey] = { - primitive: primitive, + primitive, promise: geometryPromise - }; + } pending.push(geometryPromise) } } return Promise.all(pending) - }; - GLTFParser.prototype.loadMesh = function(meshIndex) { - var parser = this; - var json = this.json; - var meshDef = json.meshes[meshIndex]; - var primitives = meshDef.primitives; - var pending = []; - for (var i = 0, - il = primitives.length; i < il; i++) { - var material = primitives[i].material === undefined ? createDefaultMaterial() : this.getDependency('material', primitives[i].material); + } + GLTFParser.prototype.loadMesh = function (meshIndex) { + const parser = this + const json = this.json + const meshDef = json.meshes[meshIndex] + const primitives = meshDef.primitives + const pending = [] + for (let i = 0, + il = primitives.length; i < il; i++) { + const material = primitives[i].material === undefined ? createDefaultMaterial() : this.getDependency('material', primitives[i].material) pending.push(material) } - return Promise.all(pending).then(function(originalMaterials) { - return parser.loadGeometries(primitives).then(function(geometries) { - var meshes = []; + return Promise.all(pending).then(function (originalMaterials) { + return parser.loadGeometries(primitives).then(function (geometries) { + const meshes = [] for (var i = 0, - il = geometries.length; i < il; i++) { - var geometry = geometries[i]; - var primitive = primitives[i]; - var mesh; - var material = originalMaterials[i]; + il = geometries.length; i < il; i++) { + const geometry = geometries[i] + const primitive = primitives[i] + var mesh + const material = originalMaterials[i] if (primitive.mode === WEBGL_CONSTANTS.TRIANGLES || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP || primitive.mode === WEBGL_CONSTANTS.TRIANGLE_FAN || primitive.mode === undefined) { - mesh = meshDef.isSkinnedMesh === true ? new THREE.SkinnedMesh(geometry, material) : new THREE.Mesh(geometry, material); + mesh = meshDef.isSkinnedMesh === true ? new THREE.SkinnedMesh(geometry, material) : new THREE.Mesh(geometry, material) if (mesh.isSkinnedMesh === true && !mesh.geometry.attributes.skinWeight.normalized) { mesh.normalizeSkinWeights() } @@ -1314,35 +1331,35 @@ export function registerGLTFLoader(THREE) { } else if (primitive.mode === WEBGL_CONSTANTS.POINTS) { mesh = new THREE.Points(geometry, material) } else { - throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode); + throw new Error('THREE.GLTFLoader: Primitive mode unsupported: ' + primitive.mode) } if (Object.keys(mesh.geometry.morphAttributes).length > 0) { updateMorphTargets(mesh, meshDef) } - mesh.name = meshDef.name || ('mesh_' + meshIndex); - if (geometries.length > 1) mesh.name += '_' + i; - assignExtrasToUserData(mesh, meshDef); - parser.assignFinalMaterial(mesh); + mesh.name = meshDef.name || ('mesh_' + meshIndex) + if (geometries.length > 1) mesh.name += '_' + i + assignExtrasToUserData(mesh, meshDef) + parser.assignFinalMaterial(mesh) meshes.push(mesh) } if (meshes.length === 1) { return meshes[0] } - var group = new THREE.Group(); + const group = new THREE.Group() for (var i = 0, - il = meshes.length; i < il; i++) { + il = meshes.length; i < il; i++) { group.add(meshes[i]) } return group }) }) - }; - GLTFParser.prototype.loadCamera = function(cameraIndex) { - var camera; - var cameraDef = this.json.cameras[cameraIndex]; - var params = cameraDef[cameraDef.type]; + } + GLTFParser.prototype.loadCamera = function (cameraIndex) { + let camera + const cameraDef = this.json.cameras[cameraIndex] + const params = cameraDef[cameraDef.type] if (!params) { - console.warn('THREE.GLTFLoader: Missing camera parameters.'); + console.warn('THREE.GLTFLoader: Missing camera parameters.') return } if (cameraDef.type === 'perspective') { @@ -1350,91 +1367,91 @@ export function registerGLTFLoader(THREE) { } else if (cameraDef.type === 'orthographic') { camera = new THREE.OrthographicCamera(params.xmag / -2, params.xmag / 2, params.ymag / 2, params.ymag / -2, params.znear, params.zfar) } - if (cameraDef.name !== undefined) camera.name = cameraDef.name; - assignExtrasToUserData(camera, cameraDef); + if (cameraDef.name !== undefined) camera.name = cameraDef.name + assignExtrasToUserData(camera, cameraDef) return Promise.resolve(camera) - }; - GLTFParser.prototype.loadSkin = function(skinIndex) { - var skinDef = this.json.skins[skinIndex]; - var skinEntry = { + } + GLTFParser.prototype.loadSkin = function (skinIndex) { + const skinDef = this.json.skins[skinIndex] + const skinEntry = { joints: skinDef.joints - }; + } if (skinDef.inverseBindMatrices === undefined) { return Promise.resolve(skinEntry) } - return this.getDependency('accessor', skinDef.inverseBindMatrices).then(function(accessor) { - skinEntry.inverseBindMatrices = accessor; + return this.getDependency('accessor', skinDef.inverseBindMatrices).then(function (accessor) { + skinEntry.inverseBindMatrices = accessor return skinEntry }) - }; - GLTFParser.prototype.loadAnimation = function(animationIndex) { - var json = this.json; - var animationDef = json.animations[animationIndex]; - var pendingNodes = []; - var pendingInputAccessors = []; - var pendingOutputAccessors = []; - var pendingSamplers = []; - var pendingTargets = []; - for (var i = 0, - il = animationDef.channels.length; i < il; i++) { - var channel = animationDef.channels[i]; - var sampler = animationDef.samplers[channel.sampler]; - var target = channel.target; - var name = target.node !== undefined ? target.node: target.id; - var input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input; - var output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output; - pendingNodes.push(this.getDependency('node', name)); - pendingInputAccessors.push(this.getDependency('accessor', input)); - pendingOutputAccessors.push(this.getDependency('accessor', output)); - pendingSamplers.push(sampler); + } + GLTFParser.prototype.loadAnimation = function (animationIndex) { + const json = this.json + const animationDef = json.animations[animationIndex] + const pendingNodes = [] + const pendingInputAccessors = [] + const pendingOutputAccessors = [] + const pendingSamplers = [] + const pendingTargets = [] + for (let i = 0, + il = animationDef.channels.length; i < il; i++) { + const channel = animationDef.channels[i] + const sampler = animationDef.samplers[channel.sampler] + const target = channel.target + const name = target.node !== undefined ? target.node : target.id + const input = animationDef.parameters !== undefined ? animationDef.parameters[sampler.input] : sampler.input + const output = animationDef.parameters !== undefined ? animationDef.parameters[sampler.output] : sampler.output + pendingNodes.push(this.getDependency('node', name)) + pendingInputAccessors.push(this.getDependency('accessor', input)) + pendingOutputAccessors.push(this.getDependency('accessor', output)) + pendingSamplers.push(sampler) pendingTargets.push(target) } - return Promise.all([Promise.all(pendingNodes), Promise.all(pendingInputAccessors), Promise.all(pendingOutputAccessors), Promise.all(pendingSamplers), Promise.all(pendingTargets)]).then(function(dependencies) { - var nodes = dependencies[0]; - var inputAccessors = dependencies[1]; - var outputAccessors = dependencies[2]; - var samplers = dependencies[3]; - var targets = dependencies[4]; - var tracks = []; - for (var i = 0, - il = nodes.length; i < il; i++) { - var node = nodes[i]; - var inputAccessor = inputAccessors[i]; - var outputAccessor = outputAccessors[i]; - var sampler = samplers[i]; - var target = targets[i]; - if (node === undefined) continue; - node.updateMatrix(); - node.matrixAutoUpdate = true; - var TypedKeyframeTrack; + return Promise.all([Promise.all(pendingNodes), Promise.all(pendingInputAccessors), Promise.all(pendingOutputAccessors), Promise.all(pendingSamplers), Promise.all(pendingTargets)]).then(function (dependencies) { + const nodes = dependencies[0] + const inputAccessors = dependencies[1] + const outputAccessors = dependencies[2] + const samplers = dependencies[3] + const targets = dependencies[4] + const tracks = [] + for (let i = 0, + il = nodes.length; i < il; i++) { + const node = nodes[i] + const inputAccessor = inputAccessors[i] + const outputAccessor = outputAccessors[i] + const sampler = samplers[i] + const target = targets[i] + if (node === undefined) continue + node.updateMatrix() + node.matrixAutoUpdate = true + var TypedKeyframeTrack switch (PATH_PROPERTIES[target.path]) { - case PATH_PROPERTIES.weights: - TypedKeyframeTrack = THREE.NumberKeyframeTrack; - break; - case PATH_PROPERTIES.rotation: - TypedKeyframeTrack = THREE.QuaternionKeyframeTrack; - break; - case PATH_PROPERTIES.position: - case PATH_PROPERTIES.scale: - default: - TypedKeyframeTrack = THREE.VectorKeyframeTrack; - break + case PATH_PROPERTIES.weights: + TypedKeyframeTrack = THREE.NumberKeyframeTrack + break + case PATH_PROPERTIES.rotation: + TypedKeyframeTrack = THREE.QuaternionKeyframeTrack + break + case PATH_PROPERTIES.position: + case PATH_PROPERTIES.scale: + default: + TypedKeyframeTrack = THREE.VectorKeyframeTrack + break } - var targetName = node.name ? node.name: node.uuid; - var interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : THREE.InterpolateLinear; - var targetNames = []; + const targetName = node.name ? node.name : node.uuid + const interpolation = sampler.interpolation !== undefined ? INTERPOLATION[sampler.interpolation] : THREE.InterpolateLinear + var targetNames = [] if (PATH_PROPERTIES[target.path] === PATH_PROPERTIES.weights) { - node.traverse(function(object) { + node.traverse(function (object) { if (object.isMesh === true && object.morphTargetInfluences) { - targetNames.push(object.name ? object.name: object.uuid) + targetNames.push(object.name ? object.name : object.uuid) } }) } else { targetNames.push(targetName) } - var outputArray = outputAccessor.array; + let outputArray = outputAccessor.array if (outputAccessor.normalized) { - var scale; + var scale if (outputArray.constructor === Int8Array) { scale = 1 / 127 } else if (outputArray.constructor === Uint8Array) { @@ -1444,61 +1461,61 @@ export function registerGLTFLoader(THREE) { } else if (outputArray.constructor === Uint16Array) { scale = 1 / 65535 } else { - throw new Error('THREE.GLTFLoader: Unsupported output accessor component type.'); + throw new Error('THREE.GLTFLoader: Unsupported output accessor component type.') } - var scaled = new Float32Array(outputArray.length); + const scaled = new Float32Array(outputArray.length) for (var j = 0, - jl = outputArray.length; j < jl; j++) { + jl = outputArray.length; j < jl; j++) { scaled[j] = outputArray[j] * scale } outputArray = scaled } for (var j = 0, - jl = targetNames.length; j < jl; j++) { - var track = new TypedKeyframeTrack(targetNames[j] + '.' + PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation); + jl = targetNames.length; j < jl; j++) { + const track = new TypedKeyframeTrack(targetNames[j] + '.' + PATH_PROPERTIES[target.path], inputAccessor.array, outputArray, interpolation) if (sampler.interpolation === 'CUBICSPLINE') { track.createInterpolant = function InterpolantFactoryMethodGLTFCubicSpline(result) { return new GLTFCubicSplineInterpolant(this.times, this.values, this.getValueSize() / 3, result) - }; + } track.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = true } tracks.push(track) } } - var name = animationDef.name !== undefined ? animationDef.name: 'animation_' + animationIndex; + const name = animationDef.name !== undefined ? animationDef.name : 'animation_' + animationIndex return new THREE.AnimationClip(name, undefined, tracks) }) - }; - GLTFParser.prototype.loadNode = function(nodeIndex) { - var json = this.json; - var extensions = this.extensions; - var parser = this; - var meshReferences = json.meshReferences; - var meshUses = json.meshUses; - var nodeDef = json.nodes[nodeIndex]; - return (function() { - var pending = []; + } + GLTFParser.prototype.loadNode = function (nodeIndex) { + const json = this.json + const extensions = this.extensions + const parser = this + const meshReferences = json.meshReferences + const meshUses = json.meshUses + const nodeDef = json.nodes[nodeIndex] + return (function () { + const pending = [] if (nodeDef.mesh !== undefined) { - pending.push(parser.getDependency('mesh', nodeDef.mesh).then(function(mesh) { - var node; + pending.push(parser.getDependency('mesh', nodeDef.mesh).then(function (mesh) { + let node if (meshReferences[nodeDef.mesh] > 1) { - var instanceNum = meshUses[nodeDef.mesh]++; - node = mesh.clone(); - node.name += '_instance_' + instanceNum; - node.onBeforeRender = mesh.onBeforeRender; - for (var i = 0, - il = node.children.length; i < il; i++) { - node.children[i].name += '_instance_' + instanceNum; + const instanceNum = meshUses[nodeDef.mesh]++ + node = mesh.clone() + node.name += '_instance_' + instanceNum + node.onBeforeRender = mesh.onBeforeRender + for (let i = 0, + il = node.children.length; i < il; i++) { + node.children[i].name += '_instance_' + instanceNum node.children[i].onBeforeRender = mesh.children[i].onBeforeRender } } else { node = mesh } if (nodeDef.weights !== undefined) { - node.traverse(function(o) { - if (!o.isMesh) return; - for (var i = 0, - il = nodeDef.weights.length; i < il; i++) { + node.traverse(function (o) { + if (!o.isMesh) return + for (let i = 0, + il = nodeDef.weights.length; i < il; i++) { o.morphTargetInfluences[i] = nodeDef.weights[i] } }) @@ -1513,8 +1530,8 @@ export function registerGLTFLoader(THREE) { pending.push(parser.getDependency('light', nodeDef.extensions[EXTENSIONS.KHR_LIGHTS_PUNCTUAL].light)) } return Promise.all(pending) - } ()).then(function(objects) { - var node; + }()).then(function (objects) { + let node if (nodeDef.isBone === true) { node = new THREE.Bone() } else if (objects.length > 1) { @@ -1525,20 +1542,20 @@ export function registerGLTFLoader(THREE) { node = new THREE.Object3D() } if (node !== objects[0]) { - for (var i = 0, - il = objects.length; i < il; i++) { + for (let i = 0, + il = objects.length; i < il; i++) { node.add(objects[i]) } } if (nodeDef.name !== undefined) { - node.userData.name = nodeDef.name; + node.userData.name = nodeDef.name node.name = THREE.PropertyBinding.sanitizeNodeName(nodeDef.name) } - assignExtrasToUserData(node, nodeDef); - if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef); + assignExtrasToUserData(node, nodeDef) + if (nodeDef.extensions) addUnknownExtensionsToUserData(extensions, node, nodeDef) if (nodeDef.matrix !== undefined) { - var matrix = new THREE.Matrix4(); - matrix.fromArray(nodeDef.matrix); + const matrix = new THREE.Matrix4() + matrix.fromArray(nodeDef.matrix) node.applyMatrix(matrix) } else { if (nodeDef.translation !== undefined) { @@ -1553,32 +1570,32 @@ export function registerGLTFLoader(THREE) { } return node }) - }; - GLTFParser.prototype.loadScene = function() { + } + GLTFParser.prototype.loadScene = (function () { function buildNodeHierachy(nodeId, parentObject, json, parser) { - var nodeDef = json.nodes[nodeId]; - return parser.getDependency('node', nodeId).then(function(node) { - if (nodeDef.skin === undefined) return node; - var skinEntry; - return parser.getDependency('skin', nodeDef.skin).then(function(skin) { - skinEntry = skin; - var pendingJoints = []; - for (var i = 0, - il = skinEntry.joints.length; i < il; i++) { + const nodeDef = json.nodes[nodeId] + return parser.getDependency('node', nodeId).then(function (node) { + if (nodeDef.skin === undefined) return node + let skinEntry + return parser.getDependency('skin', nodeDef.skin).then(function (skin) { + skinEntry = skin + const pendingJoints = [] + for (let i = 0, + il = skinEntry.joints.length; i < il; i++) { pendingJoints.push(parser.getDependency('node', skinEntry.joints[i])) } return Promise.all(pendingJoints) - }).then(function(jointNodes) { - node.traverse(function(mesh) { - if (!mesh.isMesh) return; - var bones = []; - var boneInverses = []; - for (var j = 0, - jl = jointNodes.length; j < jl; j++) { - var jointNode = jointNodes[j]; + }).then(function (jointNodes) { + node.traverse(function (mesh) { + if (!mesh.isMesh) return + const bones = [] + const boneInverses = [] + for (let j = 0, + jl = jointNodes.length; j < jl; j++) { + const jointNode = jointNodes[j] if (jointNode) { - bones.push(jointNode); - var mat = new THREE.Matrix4(); + bones.push(jointNode) + const mat = new THREE.Matrix4() if (skinEntry.inverseBindMatrices !== undefined) { mat.fromArray(skinEntry.inverseBindMatrices.array, j * 16) } @@ -1588,17 +1605,17 @@ export function registerGLTFLoader(THREE) { } } mesh.bind(new THREE.Skeleton(bones, boneInverses), mesh.matrixWorld) - }); + }) return node }) - }).then(function(node) { - parentObject.add(node); - var pending = []; + }).then(function (node) { + parentObject.add(node) + const pending = [] if (nodeDef.children) { - var children = nodeDef.children; - for (var i = 0, - il = children.length; i < il; i++) { - var child = children[i]; + const children = nodeDef.children + for (let i = 0, + il = children.length; i < il; i++) { + const child = children[i] pending.push(buildNodeHierachy(child, node, json, parser)) } } @@ -1606,25 +1623,25 @@ export function registerGLTFLoader(THREE) { }) } return function loadScene(sceneIndex) { - var json = this.json; - var extensions = this.extensions; - var sceneDef = this.json.scenes[sceneIndex]; - var parser = this; - var scene = new THREE.Scene(); - if (sceneDef.name !== undefined) scene.name = sceneDef.name; - assignExtrasToUserData(scene, sceneDef); - if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef); - var nodeIds = sceneDef.nodes || []; - var pending = []; - for (var i = 0, - il = nodeIds.length; i < il; i++) { + const json = this.json + const extensions = this.extensions + const sceneDef = this.json.scenes[sceneIndex] + const parser = this + const scene = new THREE.Scene() + if (sceneDef.name !== undefined) scene.name = sceneDef.name + assignExtrasToUserData(scene, sceneDef) + if (sceneDef.extensions) addUnknownExtensionsToUserData(extensions, scene, sceneDef) + const nodeIds = sceneDef.nodes || [] + const pending = [] + for (let i = 0, + il = nodeIds.length; i < il; i++) { pending.push(buildNodeHierachy(nodeIds[i], scene, json, parser)) } - return Promise.all(pending).then(function() { + return Promise.all(pending).then(function () { return scene }) } - } (); + }()) return GLTFLoader - })(); -} \ No newline at end of file + }()) +} diff --git a/miniprogram/packageAPI/pages/ar/ocr-detect/behavior.js b/miniprogram/packageAPI/pages/ar/ocr-detect/behavior.js index 08238e25..867744d8 100644 --- a/miniprogram/packageAPI/pages/ar/ocr-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/ocr-detect/behavior.js @@ -1,205 +1,202 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio / 2 - this.canvas.height = height * pixelRatio / 2 - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.textContentList) this.textContentList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - OCR: { - mode: 1 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio / 2 - this.canvas.height = height * pixelRatio / 2 - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - console.log("anchor add") - }) - session.on('updateAnchors', anchors => { - this.data.textContentList = [] - - // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 - this.data.textContentList = this.data.textContentList.concat(anchors.map(anchor => { - return { - text: anchor.text, - subtext: anchor.subtext, - box: anchor.box - }; - })) - - var wholeText = undefined - if(this.data.textContentList.length != 0){ - wholeText = this.data.textContentList[0].text - } - - this.setData({ - textContentList: this.data.textContentList, - wholeText: wholeText - }) - }) - session.on('removeAnchors', anchors => { - console.log("anchor remove") - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio / 2 + this.canvas.height = height * pixelRatio / 2 + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.textContentList) this.textContentList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + OCR: { + mode: 1 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio / 2 + this.canvas.height = height * pixelRatio / 2 + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + console.log('anchor add') + }) + session.on('updateAnchors', anchors => { + this.data.textContentList = [] + + // 摄像头实时检测人脸的时候 updateAnchors 会在每帧触发,所以性能要求更高,用 gl 画 + this.data.textContentList = this.data.textContentList.concat(anchors.map(anchor => ({ + text: anchor.text, + subtext: anchor.subtext, + box: anchor.box + }))) + + let wholeText + if (this.data.textContentList.length != 0) { + wholeText = this.data.textContentList[0].text + } + + this.setData({ + textContentList: this.data.textContentList, + wholeText + }) + }) + session.on('removeAnchors', anchors => { + console.log('anchor remove') + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/ocr-detect/ocr-detect.js b/miniprogram/packageAPI/pages/ar/ocr-detect/ocr-detect.js index 2a925ce0..8b4d313f 100644 --- a/miniprogram/packageAPI/pages/ar/ocr-detect/ocr-detect.js +++ b/miniprogram/packageAPI/pages/ar/ocr-detect/ocr-detect.js @@ -4,48 +4,48 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -//初始化着色器函数 +// 初始化着色器函数 let initShadersDone = false function initShaders(gl, VSHADER_SOURCE, FSHADER_SOURCE) { - //创建顶点着色器对象 - var vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) - //创建片元着色器对象 - var fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) + // 创建顶点着色器对象 + const vertexShader = loadShader(gl, gl.VERTEX_SHADER, VSHADER_SOURCE) + // 创建片元着色器对象 + const fragmentShader = loadShader(gl, gl.FRAGMENT_SHADER, FSHADER_SOURCE) if (!vertexShader || !fragmentShader) { return null } - //创建程序对象program - var program = gl.createProgram() + // 创建程序对象program + const program = gl.createProgram() if (!gl.createProgram()) { return null } - //分配顶点着色器和片元着色器到program + // 分配顶点着色器和片元着色器到program gl.attachShader(program, vertexShader) gl.attachShader(program, fragmentShader) - //链接program + // 链接program gl.linkProgram(program) - //检查程序对象是否连接成功 - var linked = gl.getProgramParameter(program, gl.LINK_STATUS) + // 检查程序对象是否连接成功 + const linked = gl.getProgramParameter(program, gl.LINK_STATUS) if (!linked) { - var error = gl.getProgramInfoLog(program) + const error = gl.getProgramInfoLog(program) console.log('程序对象连接失败: ' + error) gl.deleteProgram(program) gl.deleteShader(fragmentShader) gl.deleteShader(vertexShader) return null } - //返回程序program对象 + // 返回程序program对象 initShadersDone = true return program } function loadShader(gl, type, source) { // 创建顶点着色器对象 - var shader = gl.createShader(type) + const shader = gl.createShader(type) if (shader == null) { console.log('创建着色器失败') return null @@ -58,9 +58,9 @@ function loadShader(gl, type, source) { gl.compileShader(shader) // 检查顶是否编译成功 - var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) + const compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS) if (!compiled) { - var error = gl.getShaderInfoLog(shader) + const error = gl.getShaderInfoLog(shader) console.log('编译着色器失败: ' + error) gl.deleteShader(shader) return null @@ -69,7 +69,7 @@ function loadShader(gl, type, source) { return shader } -var EDGE_VSHADER_SOURCE = +const EDGE_VSHADER_SOURCE = ` attribute vec4 aPosition; void main(void) { @@ -77,7 +77,7 @@ var EDGE_VSHADER_SOURCE = } ` -var EDGE_FSHADER_SOURCE = +const EDGE_FSHADER_SOURCE = ` precision highp float; void main() { @@ -86,33 +86,33 @@ var EDGE_FSHADER_SOURCE = ` function initEdgeBuffer(gl, lt, lr, rb, lb) { - let shaderProgram = gl.program; - var vertices = [ + const shaderProgram = gl.program + const vertices = [ lt.x, lt.y, 0.0, lr.x, lr.y, 0.0, rb.x, rb.y, 0.0, lb.x, lb.y, 0.0, - ]; - - var vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); - var aPosition = gl.getAttribLocation(shaderProgram, 'aPosition'); - gl.enableVertexAttribArray(aPosition); - gl.vertexAttribPointer(aPosition, 3, gl.FLOAT, false, 0, 0); - var length = vertices.length / 3; - return length; + ] + + const vertexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW) + const aPosition = gl.getAttribLocation(shaderProgram, 'aPosition') + gl.enableVertexAttribArray(aPosition) + gl.vertexAttribPointer(aPosition, 3, gl.FLOAT, false, 0, 0) + const length = vertices.length / 3 + return length } function onDrawEdge(gl, lt, lr, rb, lb) { - var n = initEdgeBuffer(gl, lt, lr, rb, lb); - gl.drawArrays(gl.LINE_LOOP, 0, n); + const n = initEdgeBuffer(gl, lt, lr, rb, lb) + gl.drawArrays(gl.LINE_LOOP, 0, n) } -function convert(obj){ - obj.x = obj.x * 2 -1; - obj.y = (1-obj.y)*2-1; - return obj; +function convert(obj) { + obj.x = obj.x * 2 - 1 + obj.y = (1 - obj.y) * 2 - 1 + return obj } Component({ @@ -126,15 +126,15 @@ Component({ */ detached() { initShadersDone = false - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -160,12 +160,10 @@ Component({ // this.canvas.requestAnimationFrame(onFrame1) // } // this.canvas.requestAnimationFrame(onFrame1) - }, - render(frame) { - var gl = this.gl + const gl = this.gl this.renderGL(frame) @@ -190,7 +188,7 @@ Component({ if (!textContentList || textContentList.length <= 0) { return - }else{ + } else { if (!initShadersDone) { this.edgeProgram = initShaders(gl, EDGE_VSHADER_SOURCE, EDGE_FSHADER_SOURCE) if (!this.edgeProgram) { @@ -200,37 +198,35 @@ Component({ console.log('初始化着色器成功') } - if(textContentList[0].box == undefined){ - return; + if (textContentList[0].box == undefined) { + return } - + gl.useProgram(this.edgeProgram) gl.program = this.edgeProgram - var lt,lr,rb,lb; - for (var i = 0; i < textContentList.length; i++) { + let lt; let lr; let rb; let lb + for (let i = 0; i < textContentList.length; i++) { lt = textContentList[i].box[0] lr = textContentList[i].box[1] rb = textContentList[i].box[2] lb = textContentList[i].box[3] - let avgX = (lt.x + lr.x + rb.x + lb.x) / 4; - let avgY = (lt.y + lr.y + rb.y + lb.y) / 4; - textContentList[i].centerX = avgX * this.data.width; - textContentList[i].centerY = avgY * this.data.height; - + const avgX = (lt.x + lr.x + rb.x + lb.x) / 4 + const avgY = (lt.y + lr.y + rb.y + lb.y) / 4 + textContentList[i].centerX = avgX * this.data.width + textContentList[i].centerY = avgY * this.data.height + lt = convert(lt) lr = convert(lr) rb = convert(rb) lb = convert(lb) - onDrawEdge(gl,lt, lr, rb, lb); + onDrawEdge(gl, lt, lr, rb, lb) } } this.setData({ - textContentList: textContentList + textContentList }) - - }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/ocr-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/ocr-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/ocr-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/ocr-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/osd-ar/behavior.js b/miniprogram/packageAPI/pages/ar/osd-ar/behavior.js index a4eeacfc..68c69ff9 100644 --- a/miniprogram/packageAPI/pages/ar/osd-ar/behavior.js +++ b/miniprogram/packageAPI/pages/ar/osd-ar/behavior.js @@ -128,23 +128,22 @@ export default function getBehavior() { this.afterVKSessionCreated() } - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() // 逐帧渲染 const onFrame = timestamp => { - let now = Date.now() + const now = Date.now() const mill = now - last // 经过了足够的时间 if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } } session.requestAnimationFrame(onFrame) } @@ -179,4 +178,4 @@ export default function getBehavior() { }, }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/osd-ar/osd-ar.js b/miniprogram/packageAPI/pages/ar/osd-ar/osd-ar.js index ad9b747f..aea30f80 100644 --- a/miniprogram/packageAPI/pages/ar/osd-ar/osd-ar.js +++ b/miniprogram/packageAPI/pages/ar/osd-ar/osd-ar.js @@ -15,27 +15,27 @@ Component({ frameHeight: 0, }, lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { init() { @@ -95,14 +95,13 @@ Component({ } = res console.log('getImageInfo res', res) this.setData({ - imgUrl: imgUrl, + imgUrl, }) }, fail: res => { console.error(res) } }) - }, fail: res => { console.error(res) @@ -160,17 +159,15 @@ Component({ console.log('[addMarker] --> ', filePath) this.markerId = this.session.addOSDMarker(filePath) this.setData({ - "filePathNow": filePath + filePathNow: filePath }) } - const getFilePathNow = () => { - return this.data.filePathNow; - } + const getFilePathNow = () => this.data.filePathNow fs.stat({ path: filePath, success(res) { - let path = getFilePathNow() + const path = getFilePathNow() if (path != filePath) { if (res.stats.isFile() && path) { fs.unlinkSync(path) @@ -196,4 +193,4 @@ Component({ console.log(this.session.getAllOSDMarker()) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/osd-ar/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/osd-ar/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/osd-ar/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/osd-ar/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-body-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-body-detect/behavior.js index b5dde3e3..3cbc9a57 100644 --- a/miniprogram/packageAPI/pages/ar/photo-body-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-body-detect/behavior.js @@ -1,206 +1,205 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - body: { - mode: 2 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })), - }) - }) - session.on('updateAnchors', anchors => { - this.data.anchor2DList = [] - // 手动传入图像的时候用dom画点和框就行 - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })), - }) - }) - session.on('removeAnchors', anchors => { - this.setData({ - anchor2DList: [], - }) - this.data.anchor2DList = [] - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + body: { + mode: 2 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })), + }) + }) + session.on('updateAnchors', anchors => { + this.data.anchor2DList = [] + // 手动传入图像的时候用dom画点和框就行 + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })), + }) + }) + session.on('removeAnchors', anchors => { + this.setData({ + anchor2DList: [], + }) + this.data.anchor2DList = [] + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/photo-body-detect/photo-body-detect.js b/miniprogram/packageAPI/pages/ar/photo-body-detect/photo-body-detect.js index 9be9e562..3d90861d 100644 --- a/miniprogram/packageAPI/pages/ar/photo-body-detect/photo-body-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-body-detect/photo-body-detect.js @@ -5,129 +5,128 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - bodyImgUrl: '', - bodyImgWidth: 0, - bodyImgHeight: 0, - bodyImgOriginWidth: 0, - bodyImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + bodyImgUrl: '', + bodyImgWidth: 0, + bodyImgHeight: 0, + bodyImgOriginWidth: 0, + bodyImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - bodyImgUrl: imgUrl, - bodyImgWidth: fixWidth, - bodyImgHeight: (fixWidth / width) * height, - bodyImgOriginWidth: width, - bodyImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - this.initGL() + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + bodyImgUrl: imgUrl, + bodyImgWidth: fixWidth, + bodyImgHeight: (fixWidth / width) * height, + bodyImgOriginWidth: width, + bodyImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } + }) }, - render(frame) { - return - this.renderGL(frame) + fail: res => { + console.error(res) + } + }) + }, + init() { + this.initGL() + }, + render(frame) { + return + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullbody(this.THREE.CullbodyNone) - }, - async detectbody() { - if (this.data.bodyImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.bodyImgOriginWidth, - height: this.data.bodyImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.bodyImgUrl - }) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullbody(this.THREE.CullbodyNone) + }, + async detectbody() { + if (this.data.bodyImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.bodyImgOriginWidth, + height: this.data.bodyImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.bodyImgUrl + }) - context.clearRect(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) - context.drawImage(img, 0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) + context.clearRect(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) + context.drawImage(img, 0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.bodyImgOriginWidth, this.data.bodyImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectbody', this.session.detectbody) - console.log('width', this.data.bodyImgOriginWidth) - console.log('height', this.data.bodyImgOriginHeight) - this.session.detectBody({ - frameBuffer: this.imgData.data.buffer, - width: this.data.bodyImgOriginWidth, - height: this.data.bodyImgOriginHeight, - scoreThreshold: 0.5, // 评分阈值 - sourceType: 1 - }) - } - }, + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectbody', this.session.detectbody) + console.log('width', this.data.bodyImgOriginWidth) + console.log('height', this.data.bodyImgOriginHeight) + this.session.detectBody({ + frameBuffer: this.imgData.data.buffer, + width: this.data.bodyImgOriginWidth, + height: this.data.bodyImgOriginHeight, + scoreThreshold: 0.5, // 评分阈值 + sourceType: 1 + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-body-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-body-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/photo-body-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-body-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-depth-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-depth-detect/behavior.js index d5b516cb..f4aa1f91 100644 --- a/miniprogram/packageAPI/pages/ar/photo-depth-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-depth-detect/behavior.js @@ -96,7 +96,7 @@ export default function getBehavior() { depth: { mode: 2 } - }, + }, cameraPosition: 0, version: 'v1', gl: this.gl @@ -126,29 +126,26 @@ export default function getBehavior() { session.on('addAnchors', anchors => { }) session.on('updateAnchors', anchors => { - let depthArray = [] + const depthArray = [] // 手动传入图像的时候用dom画点和框就行 - let anchor2DList = anchors.map(anchor => { - return { - value: anchor.depthArray, - size: anchor.size - }}) - wx.hideLoading() - if (anchor2DList.length > 0) { - let width = 80 - let height = 80 - anchor2DList.forEach(anchor => { - width = anchor.size[0] - height = anchor.size[1] - anchor.value.forEach(item =>{ - depthArray.push(item.value) - }) - this.renderDepthGL(depthArray, width, height) - + const anchor2DList = anchors.map(anchor => ({ + value: anchor.depthArray, + size: anchor.size + })) + wx.hideLoading() + if (anchor2DList.length > 0) { + let width = 80 + let height = 80 + anchor2DList.forEach(anchor => { + width = anchor.size[0] + height = anchor.size[1] + anchor.value.forEach(item => { + depthArray.push(item.value) + }) + this.renderDepthGL(depthArray, width, height) }) - } } - ) + }) session.on('removeAnchors', anchors => { }) }) @@ -181,4 +178,4 @@ export default function getBehavior() { }, }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/photo-depth-detect/depthBehavior.js b/miniprogram/packageAPI/pages/ar/photo-depth-detect/depthBehavior.js index 818b18fa..5836beb6 100644 --- a/miniprogram/packageAPI/pages/ar/photo-depth-detect/depthBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-depth-detect/depthBehavior.js @@ -1,12 +1,11 @@ const depthBehavior = Behavior({ - methods: { - initDepthShader() { - const gl = this.gl = this.renderer.getContext() - const ext = gl.getExtension("OES_texture_float"); - if(!ext) - console.warn('OES_texture_float not support'); - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initDepthShader() { + const gl = this.gl = this.renderer.getContext() + const ext = gl.getExtension('OES_texture_float') + if (!ext) console.warn('OES_texture_float not support') + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` precision highp float; attribute vec2 a_position; attribute vec2 a_texCoord; @@ -16,7 +15,7 @@ const depthBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D depth_texture; varying vec2 v_texCoord; @@ -25,123 +24,122 @@ const depthBehavior = Behavior({ gl_FragColor = vec4(depth_color.rgb , 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._depthProgram = gl.createProgram() - this._depthProgram.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformTexture = gl.getUniformLocation(program, 'depth_texture') - gl.uniform1i(uniformTexture, 5) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initDepthVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._depthProgram, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._depthProgram, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._depthVao = vao - }, - initDepthGL() { - this.initDepthShader() - this.initDepthVAO() - }, - renderDepthGL(depthBuffer, width, height) { - const gl = this.renderer.getContext() - - gl.disable(gl.DEPTH_TEST) //缺少这句安卓端可能绘制不出图像 - - let depthTexture = gl.createTexture() - gl.bindTexture(gl.TEXTURE_2D, depthTexture) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) - - const ext = gl.getExtension("OES_texture_float"); - if(ext){ - const data = new Float32Array(width * height * 4); - for (let i = 0; i < depthBuffer.length; i++) { - data[i * 4] = depthBuffer[i]; - data[i * 4 + 1] = depthBuffer[i]; - data[i * 4 + 2] = depthBuffer[i]; - data[i * 4 + 3] = depthBuffer[i]; - } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, data); - }else{ - const data = new Uint8Array(width * height * 4); - for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i * 4] = num; - data[i * 4 + 1] = num; - data[i * 4 + 2] = num; - data[i * 4 + 3] = num; - } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); - } - - depthTexture._gl = gl - gl.bindTexture(gl.TEXTURE_2D, null) - - if (depthTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - let currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - - gl.useProgram(this._depthProgram) - this.ext.bindVertexArrayOES(this._depthVao) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, depthTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._depthProgram = gl.createProgram() + this._depthProgram.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformTexture = gl.getUniformLocation(program, 'depth_texture') + gl.uniform1i(uniformTexture, 5) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initDepthVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._depthProgram, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._depthProgram, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 0, 0, 0, 1, 1, 0, 1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._depthVao = vao + }, + initDepthGL() { + this.initDepthShader() + this.initDepthVAO() + }, + renderDepthGL(depthBuffer, width, height) { + const gl = this.renderer.getContext() + + gl.disable(gl.DEPTH_TEST) // 缺少这句安卓端可能绘制不出图像 + + const depthTexture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, depthTexture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + + const ext = gl.getExtension('OES_texture_float') + if (ext) { + const data = new Float32Array(width * height * 4) + for (let i = 0; i < depthBuffer.length; i++) { + data[i * 4] = depthBuffer[i] + data[i * 4 + 1] = depthBuffer[i] + data[i * 4 + 2] = depthBuffer[i] + data[i * 4 + 3] = depthBuffer[i] + } + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, data) + } else { + const data = new Uint8Array(width * height * 4) + for (let i = 0; i < depthBuffer.length; i++) { + const num = parseInt(depthBuffer[i] * 255) + data[i * 4] = num + data[i * 4 + 1] = num + data[i * 4 + 2] = num + data[i * 4 + 3] = num + } + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) + } + + depthTexture._gl = gl + gl.bindTexture(gl.TEXTURE_2D, null) + + if (depthTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._depthProgram) + this.ext.bindVertexArrayOES(this._depthVao) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, depthTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default depthBehavior \ No newline at end of file +export default depthBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-depth-detect/photo-depth-detect.js b/miniprogram/packageAPI/pages/ar/photo-depth-detect/photo-depth-detect.js index c9cfaacd..3f533123 100644 --- a/miniprogram/packageAPI/pages/ar/photo-depth-detect/photo-depth-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-depth-detect/photo-depth-detect.js @@ -6,120 +6,118 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior, depthBehavior], - data: { - depthImgUrl: '', - depthImgWidth: 0, - depthImgHeight: 0, - depthImgOriginWidth: 0, - depthImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior, depthBehavior], + data: { + depthImgUrl: '', + depthImgWidth: 0, + depthImgHeight: 0, + depthImgOriginWidth: 0, + depthImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - let depthImgWidth - let depthImgHeight - if(width > height){ - depthImgWidth = fixWidth - depthImgHeight = fixWidth * height / width - }else{ - depthImgWidth = fixWidth * width / height - depthImgHeight = fixWidth - } - this.setData({ - depthImgUrl: imgUrl, - depthImgWidth, - depthImgHeight, - depthImgOriginWidth: width, - depthImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - this.initGL() - this.initDepthGL() - console.log("init finish") + let depthImgWidth + let depthImgHeight + if (width > height) { + depthImgWidth = fixWidth + depthImgHeight = fixWidth * height / width + } else { + depthImgWidth = fixWidth * width / height + depthImgHeight = fixWidth + } + this.setData({ + depthImgUrl: imgUrl, + depthImgWidth, + depthImgHeight, + depthImgOriginWidth: width, + depthImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } + }) }, - async detectDepth() { - if (this.data.depthImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.depthImgOriginWidth, - height: this.data.depthImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.depthImgUrl - }) + fail: res => { + console.error(res) + } + }) + }, + init() { + this.initGL() + this.initDepthGL() + console.log('init finish') + }, + async detectDepth() { + if (this.data.depthImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.depthImgOriginWidth, + height: this.data.depthImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.depthImgUrl + }) - context.clearRect(0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) - context.drawImage(img, 0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) + context.clearRect(0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) + context.drawImage(img, 0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.depthImgOriginWidth, this.data.depthImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectDepth', this.session.detectDepth) - console.log('width', this.data.depthImgOriginWidth) - console.log('height', this.data.depthImgOriginHeight) - wx.showLoading({ title: '深度图生成中...' }); - this.session.detectDepth({ - frameBuffer: this.imgData.data.buffer, - width: this.data.depthImgOriginWidth, - height: this.data.depthImgOriginHeight, - }) - - } - }, + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectDepth', this.session.detectDepth) + console.log('width', this.data.depthImgOriginWidth) + console.log('height', this.data.depthImgOriginHeight) + wx.showLoading({ title: '深度图生成中...' }) + this.session.detectDepth({ + frameBuffer: this.imgData.data.buffer, + width: this.data.depthImgOriginWidth, + height: this.data.depthImgOriginHeight, + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-depth-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-depth-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/photo-depth-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-depth-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-face-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-face-detect/behavior.js index 89569428..a3951281 100644 --- a/miniprogram/packageAPI/pages/ar/photo-face-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-face-detect/behavior.js @@ -1,203 +1,202 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - face: { - mode: 2 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })), - }) - }) - session.on('updateAnchors', anchors => { - this.data.anchor2DList = [] - // 手动传入图像的时候用dom画点和框就行 - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })), - }) - }) - session.on('removeAnchors', anchors => { - this.setData({ - anchor2DList: [], - }) - this.data.anchor2DList = [] - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + face: { + mode: 2 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })), + }) + }) + session.on('updateAnchors', anchors => { + this.data.anchor2DList = [] + // 手动传入图像的时候用dom画点和框就行 + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })), + }) + }) + session.on('removeAnchors', anchors => { + this.setData({ + anchor2DList: [], + }) + this.data.anchor2DList = [] + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/photo-face-detect/photo-face-detect.js b/miniprogram/packageAPI/pages/ar/photo-face-detect/photo-face-detect.js index d3231f8e..d7ab5212 100644 --- a/miniprogram/packageAPI/pages/ar/photo-face-detect/photo-face-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-face-detect/photo-face-detect.js @@ -5,131 +5,130 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - faceImgUrl: '', - faceImgWidth: 0, - faceImgHeight: 0, - faceImgOriginWidth: 0, - faceImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + faceImgUrl: '', + faceImgWidth: 0, + faceImgHeight: 0, + faceImgOriginWidth: 0, + faceImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - faceImgUrl: imgUrl, - faceImgWidth: fixWidth, - faceImgHeight: (fixWidth / width) * height, - faceImgOriginWidth: width, - faceImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - // this.initGL() + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + faceImgUrl: imgUrl, + faceImgWidth: fixWidth, + faceImgHeight: (fixWidth / width) * height, + faceImgOriginWidth: width, + faceImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } + }) }, - render(frame) { - return - this.renderGL(frame) + fail: res => { + console.error(res) + } + }) + }, + init() { + // this.initGL() + }, + render(frame) { + return + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, - async detectFace() { - if (this.data.faceImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.faceImgOriginWidth, - height: this.data.faceImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.faceImgUrl - }) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) + }, + async detectFace() { + if (this.data.faceImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.faceImgOriginWidth, + height: this.data.faceImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.faceImgUrl + }) - context.clearRect(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - context.drawImage(img, 0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + context.clearRect(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + context.drawImage(img, 0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectFace', this.session.detectFace) - console.log('width', this.data.faceImgOriginWidth) - console.log('height', this.data.faceImgOriginHeight) + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectFace', this.session.detectFace) + console.log('width', this.data.faceImgOriginWidth) + console.log('height', this.data.faceImgOriginHeight) - this.session.detectFace({ - frameBuffer: this.imgData.data.buffer, - width: this.data.faceImgOriginWidth, - height: this.data.faceImgOriginHeight, - scoreThreshold: 0.5, // 评分阈值 - sourceType: 1, - modelMode: 1, - }) - } - }, + this.session.detectFace({ + frameBuffer: this.imgData.data.buffer, + width: this.data.faceImgOriginWidth, + height: this.data.faceImgOriginHeight, + scoreThreshold: 0.5, // 评分阈值 + sourceType: 1, + modelMode: 1, + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-face-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-face-detect/yuvBehavior.js index 47a89766..08ffb7fa 100644 --- a/miniprogram/packageAPI/pages/ar/photo-face-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-face-detect/yuvBehavior.js @@ -1,10 +1,10 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - console.log("初始化shader完成") - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + console.log('初始化shader完成') + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -15,7 +15,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -38,103 +38,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-hand-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-hand-detect/behavior.js index a47c0bdf..2334d272 100644 --- a/miniprogram/packageAPI/pages/ar/photo-hand-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-hand-detect/behavior.js @@ -1,210 +1,209 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - hand: { - mode: 2 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size, - gesture: anchor.gesture - })), - }) - }) - - session.on('updateAnchors', anchors => { - this.data.anchor2DList = [] - // 手动传入图像的时候用dom画点和框就行 - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size, - gesture: anchor.gesture - })), - }) - }) - - session.on('removeAnchors', anchors => { - this.setData({ - anchor2DList: [], - }) - this.data.anchor2DList = [] - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + hand: { + mode: 2 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size, + gesture: anchor.gesture + })), + }) + }) + + session.on('updateAnchors', anchors => { + this.data.anchor2DList = [] + // 手动传入图像的时候用dom画点和框就行 + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size, + gesture: anchor.gesture + })), + }) + }) + + session.on('removeAnchors', anchors => { + this.setData({ + anchor2DList: [], + }) + this.data.anchor2DList = [] + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/photo-hand-detect/photo-hand-detect.js b/miniprogram/packageAPI/pages/ar/photo-hand-detect/photo-hand-detect.js index be1f29d4..e543d90f 100644 --- a/miniprogram/packageAPI/pages/ar/photo-hand-detect/photo-hand-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-hand-detect/photo-hand-detect.js @@ -5,129 +5,128 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - handImgUrl: '', - handImgWidth: 0, - handImgHeight: 0, - handImgOriginWidth: 0, - handImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + handImgUrl: '', + handImgWidth: 0, + handImgHeight: 0, + handImgOriginWidth: 0, + handImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - handImgUrl: imgUrl, - handImgWidth: fixWidth, - handImgHeight: (fixWidth / width) * height, - handImgOriginWidth: width, - handImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - this.initGL() + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + handImgUrl: imgUrl, + handImgWidth: fixWidth, + handImgHeight: (fixWidth / width) * height, + handImgOriginWidth: width, + handImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } + }) }, - render(frame) { - return - this.renderGL(frame) + fail: res => { + console.error(res) + } + }) + }, + init() { + this.initGL() + }, + render(frame) { + return + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullhand(this.THREE.CullhandNone) - }, - async detectHand() { - if (this.data.handImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.handImgOriginWidth, - height: this.data.handImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.handImgUrl - }) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullhand(this.THREE.CullhandNone) + }, + async detectHand() { + if (this.data.handImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.handImgOriginWidth, + height: this.data.handImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.handImgUrl + }) - context.clearRect(0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) - context.drawImage(img, 0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) + context.clearRect(0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) + context.drawImage(img, 0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.handImgOriginWidth, this.data.handImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectHand', this.session.detectHand) - console.log('width', this.data.handImgOriginWidth) - console.log('height', this.data.handImgOriginHeight) - this.session.detectHand({ - frameBuffer: this.imgData.data.buffer, - width: this.data.handImgOriginWidth, - height: this.data.handImgOriginHeight, - scoreThreshold: 0.5, // 评分阈值 - algoMode: 2 - }) - } - }, + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectHand', this.session.detectHand) + console.log('width', this.data.handImgOriginWidth) + console.log('height', this.data.handImgOriginHeight) + this.session.detectHand({ + frameBuffer: this.imgData.data.buffer, + width: this.data.handImgOriginWidth, + height: this.data.handImgOriginHeight, + scoreThreshold: 0.5, // 评分阈值 + algoMode: 2 + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-hand-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-hand-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/photo-hand-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-hand-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-idcard-detect/photo-idcard-detect.js b/miniprogram/packageAPI/pages/ar/photo-idcard-detect/photo-idcard-detect.js index 44c06be5..a3a1a0b3 100644 --- a/miniprogram/packageAPI/pages/ar/photo-idcard-detect/photo-idcard-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-idcard-detect/photo-idcard-detect.js @@ -1,226 +1,223 @@ Component({ - behaviors: [], - data: { - // 主题相关逻辑 - theme: 'light', - // 上传识别相关逻辑 - imgUrl: '', - imgWidth: 0, - imgHeight: 0, - imgOriginWidth: 0, - imgOriginHeight: 0, - // 显示身份证识别结果 - detected: false, - detectSuccess: false, - isComplete: false, - label: '', - orientation: 0, - box: [], - cropImg: null, - }, - lifetimes: { - /** + behaviors: [], + data: { + // 主题相关逻辑 + theme: 'light', + // 上传识别相关逻辑 + imgUrl: '', + imgWidth: 0, + imgHeight: 0, + imgOriginWidth: 0, + imgOriginHeight: 0, + // 显示身份证识别结果 + detected: false, + detectSuccess: false, + isComplete: false, + label: '', + orientation: 0, + box: [], + cropImg: null, + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } }, - methods: { - onReady() { - this.initVK(); + }, + methods: { + onReady() { + this.initVK() + }, + // VK 初始化逻辑 + initVK() { + // VKSession 配置 + const session = this.session = wx.createVKSession({ + track: { + IDCard: { + mode: 2 // 照片模式 + } }, - // VK 初始化逻辑 - initVK() { - // VKSession 配置 - const session = this.session = wx.createVKSession({ - track: { - IDCard: { - mode: 2 // 照片模式 - } - }, - version: 'v1', - gl: this.gl - }) - - // VKSession start - session.start(err => { - - session.on('updateAnchors', anchors => { - console.log("updateAnchors") - - // 处理返回的身份证信息 - if (anchors && anchors[0]) { - // 存在数组,证明存在身份证信息 - const anchor = anchors[0]; - - // console.log(anchor.isComplete, anchor.label, anchor.orientation, anchor.box); - - this.setData({ - detected: true, - detectSuccess: true, - isComplete: anchor.isComplete, - label: anchor.label, - orientation: anchor.orientation, - box: anchor.box, - }); - - // 裁剪信息 - const affineImgWidth = anchor.affineImgWidth; - const affineImgHeight = anchor.affineImgHeight; - const affineMat = anchor.affineMat; + version: 'v1', + gl: this.gl + }) - // 存在裁剪信息,进行身份证裁剪处理 - if (affineImgWidth && affineImgHeight && affineMat) { + // VKSession start + session.start(err => { + session.on('updateAnchors', anchors => { + console.log('updateAnchors') - console.log(affineImgWidth, affineImgHeight, affineMat); + // 处理返回的身份证信息 + if (anchors && anchors[0]) { + // 存在数组,证明存在身份证信息 + const anchor = anchors[0] - const cropIDcardImg = this.getCropIDcard(affineImgWidth, affineImgHeight, affineMat); + // console.log(anchor.isComplete, anchor.label, anchor.orientation, anchor.box); - this.setData({ - cropImg: cropIDcardImg - }) - } - } - - }) - session.on('removeAnchors', anchors => { - console.log("anchor remove") + this.setData({ + detected: true, + detectSuccess: true, + isComplete: anchor.isComplete, + label: anchor.label, + orientation: anchor.orientation, + box: anchor.box, + }) - // 图片没有识别到身份证 - this.setData({ - detected: true, - detectSuccess: false, - }); - }) + // 裁剪信息 + const affineImgWidth = anchor.affineImgWidth + const affineImgHeight = anchor.affineImgHeight + const affineMat = anchor.affineMat - }); - }, - // 裁剪身份证图片 - getCropIDcard(affineImgWidth, affineImgHeight, affineMat) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: affineImgWidth, - height: affineImgHeight, - }) - const context = canvas.getContext('2d') + // 存在裁剪信息,进行身份证裁剪处理 + if (affineImgWidth && affineImgHeight && affineMat) { + console.log(affineImgWidth, affineImgHeight, affineMat) + const cropIDcardImg = this.getCropIDcard(affineImgWidth, affineImgHeight, affineMat) - context.clearRect(0, 0, affineImgWidth, affineImgHeight); - /* + this.setData({ + cropImg: cropIDcardImg + }) + } + } + }) + session.on('removeAnchors', anchors => { + console.log('anchor remove') + + // 图片没有识别到身份证 + this.setData({ + detected: true, + detectSuccess: false, + }) + }) + }) + }, + // 裁剪身份证图片 + getCropIDcard(affineImgWidth, affineImgHeight, affineMat) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: affineImgWidth, + height: affineImgHeight, + }) + const context = canvas.getContext('2d') + + context.clearRect(0, 0, affineImgWidth, affineImgHeight) + /* * affineMat 3x3仿射变换矩阵,行主序 * [0 1 2 * 3 4 5 * 6 7 8] */ - /* + /* * canvas 2d setTransform * setTransform(a, b, c, d, e, f) * [a c e * b d f * 0 0 1] */ - context.setTransform( - Number(affineMat[0]), Number(affineMat[3]), Number(affineMat[1]), - Number(affineMat[4]), Number(affineMat[2]), Number(affineMat[5]) - ); - console.log(this.img, this.data.imgOriginWidth, this.data.imgOriginHeight) - context.drawImage(this.img, 0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) - const imgUrl = canvas.toDataURL() - - // console.log(imgUrl); - - return imgUrl; - - }, - // 上传识别图片 - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - imgUrl: imgUrl, - imgWidth: fixWidth, - imgHeight: (fixWidth / width) * height, - imgOriginWidth: width, - imgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) - - }, - fail: res => { - console.error(res) - } - }) - }, - // 识别身份证逻辑 - async detectIDCard() { - console.log('detectIDCard') - if (this.data.imgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.imgOriginWidth, - height: this.data.imgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - // 使用中的 图片对象 - this.img = img; - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.imgUrl - }) - - context.clearRect(0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) - context.drawImage(img, 0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) - - // 使用中的 image ArrayBuffer - this.imgData = context.getImageData(0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) - - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectIDCard', this.session.detectIDCard) - console.log('width', this.data.imgOriginWidth) - console.log('height', this.data.imgOriginHeight) - this.session.detectIDCard({ - // 识别身份证图片的信息 - frameBuffer: this.imgData.data.buffer, - width: this.data.imgOriginWidth, - height: this.data.imgOriginHeight, - // 是否获取裁剪图片信息 - getAffineImg: true, - }) + context.setTransform( + Number(affineMat[0]), + Number(affineMat[3]), + Number(affineMat[1]), + Number(affineMat[4]), + Number(affineMat[2]), + Number(affineMat[5]) + ) + console.log(this.img, this.data.imgOriginWidth, this.data.imgOriginHeight) + context.drawImage(this.img, 0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) + const imgUrl = canvas.toDataURL() + + // console.log(imgUrl); + + return imgUrl + }, + // 上传识别图片 + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + imgUrl, + imgWidth: fixWidth, + imgHeight: (fixWidth / width) * height, + imgOriginWidth: width, + imgOriginHeight: height + }) + }, + fail: res => { + console.error(res) } + }) }, + fail: res => { + console.error(res) + } + }) + }, + // 识别身份证逻辑 + async detectIDCard() { + console.log('detectIDCard') + if (this.data.imgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.imgOriginWidth, + height: this.data.imgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + // 使用中的 图片对象 + this.img = img + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.imgUrl + }) + + context.clearRect(0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) + context.drawImage(img, 0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) + + // 使用中的 image ArrayBuffer + this.imgData = context.getImageData(0, 0, this.data.imgOriginWidth, this.data.imgOriginHeight) + + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectIDCard', this.session.detectIDCard) + console.log('width', this.data.imgOriginWidth) + console.log('height', this.data.imgOriginHeight) + this.session.detectIDCard({ + // 识别身份证图片的信息 + frameBuffer: this.imgData.data.buffer, + width: this.data.imgOriginWidth, + height: this.data.imgOriginHeight, + // 是否获取裁剪图片信息 + getAffineImg: true, + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/behavior.js index 64ab7c3f..a7b5af80 100644 --- a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/behavior.js @@ -1,228 +1,227 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.textContentList) this.textContentList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + OCR: { + mode: 2 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + console.log('anchor add') + }) + session.on('updateAnchors', anchors => { + this.data.textContentList = [] + console.log(anchors) + this.data.textContentList = this.data.textContentList.concat(anchors.map(anchor => { + let result = {} + result = { + text: anchor.text, + subtext: anchor.subtext, + box: anchor.box, + centerX: anchor.centerX, + centerY: anchor.centerY, + } + if (anchor.box) { + const lt = anchor.box[0] + const lr = anchor.box[1] + const rb = anchor.box[2] + const lb = anchor.box[3] + const width = lr.x - lt.x + const height = lb.y - lt.y + const avgX = (lt.x + lr.x + rb.x + lb.x) / 4 + const avgY = (lt.y + lr.y + rb.y + lb.y) / 4 + anchor.centerX = avgX * this.data.faceImgWidth + anchor.centerY = avgY * this.data.faceImgHeight + result.origin = { + x: lt.x, + y: lt.y, } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null + result.size = { + width, + height, } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.textContentList) this.textContentList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - OCR: { - mode: 2 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - console.log("anchor add") - }) - session.on('updateAnchors', anchors => { - this.data.textContentList = [] - console.log(anchors) - this.data.textContentList = this.data.textContentList.concat(anchors.map(anchor => { - let result = {} - result = { - text: anchor.text, - subtext: anchor.subtext, - box: anchor.box, - centerX: anchor.centerX, - centerY: anchor.centerY, - } - if(anchor.box){ - let lt = anchor.box[0] - let lr = anchor.box[1] - let rb = anchor.box[2] - let lb = anchor.box[3] - let width = lr.x - lt.x - let height = lb.y - lt.y - let avgX = (lt.x + lr.x + rb.x + lb.x) / 4; - let avgY = (lt.y + lr.y + rb.y + lb.y) / 4; - anchor.centerX = avgX * this.data.faceImgWidth; - anchor.centerY = avgY * this.data.faceImgHeight; - result.origin = { - x: lt.x, - y: lt.y, - } - result.size = { - width: width, - height: height, - } - } - return result - })) - - var wholeText = undefined - if(this.data.textContentList.length != 0){ - wholeText = this.data.textContentList[0].text - } - - this.setData({ - textContentList: this.data.textContentList, - wholeText: wholeText - }) - }) - session.on('removeAnchors', anchors => { - console.log("anchor remove") - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + } + return result + })) + + let wholeText + if (this.data.textContentList.length != 0) { + wholeText = this.data.textContentList[0].text + } + + this.setData({ + textContentList: this.data.textContentList, + wholeText + }) + }) + session.on('removeAnchors', anchors => { + console.log('anchor remove') + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/photo-ocr-detect.js b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/photo-ocr-detect.js index 8752d63c..568b636f 100644 --- a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/photo-ocr-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/photo-ocr-detect.js @@ -5,127 +5,126 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - faceImgUrl: '', - faceImgWidth: 0, - faceImgHeight: 0, - faceImgOriginWidth: 0, - faceImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + faceImgUrl: '', + faceImgWidth: 0, + faceImgHeight: 0, + faceImgOriginWidth: 0, + faceImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - faceImgUrl: imgUrl, - faceImgWidth: fixWidth, - faceImgHeight: (fixWidth / width) * height, - faceImgOriginWidth: width, - faceImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - this.initGL() + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + faceImgUrl: imgUrl, + faceImgWidth: fixWidth, + faceImgHeight: (fixWidth / width) * height, + faceImgOriginWidth: width, + faceImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } + }) }, - render(frame) { - return - this.renderGL(frame) + fail: res => { + console.error(res) + } + }) + }, + init() { + this.initGL() + }, + render(frame) { + return + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, - async runOCR() { - if (this.data.faceImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.faceImgOriginWidth, - height: this.data.faceImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.faceImgUrl - }) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) + }, + async runOCR() { + if (this.data.faceImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.faceImgOriginWidth, + height: this.data.faceImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.faceImgUrl + }) - context.clearRect(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - context.drawImage(img, 0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + context.clearRect(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + context.drawImage(img, 0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.faceImgOriginWidth, this.data.faceImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.runOCR', this.session.runOCR) - console.log('width', this.data.faceImgOriginWidth) - console.log('height', this.data.faceImgOriginHeight) - this.session.runOCR({ - frameBuffer: this.imgData.data.buffer, - width: this.data.faceImgOriginWidth, - height: this.data.faceImgOriginHeight, - }) - } - }, + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.runOCR', this.session.runOCR) + console.log('width', this.data.faceImgOriginWidth) + console.log('height', this.data.faceImgOriginHeight) + this.session.runOCR({ + frameBuffer: this.imgData.data.buffer, + width: this.data.faceImgOriginWidth, + height: this.data.faceImgOriginHeight, + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/photo-ocr-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-ocr-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/behavior.js b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/behavior.js index 105eeddc..1cdfcde5 100644 --- a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/behavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/behavior.js @@ -1,195 +1,194 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.textContentList) this.textContentList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - shoe: { - mode: 2 - } - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - session.on('addAnchors', anchors => { - console.log("anchor add") - }) - session.on('updateAnchors', anchors => { - console.log(anchors) - this.data.anchor2DList = [] - // 手动传入图像的时候用dom画点和框就行 - this.setData({ - anchor2DList: anchors.map(anchor => ({ - points: anchor.points, - origin: anchor.origin, - size: anchor.size - })), - }) - }) - session.on('removeAnchors', anchors => { - console.log("anchor remove") - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - }, - }) -} \ No newline at end of file + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.textContentList) this.textContentList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + shoe: { + mode: 2 + } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + session.on('addAnchors', anchors => { + console.log('anchor add') + }) + session.on('updateAnchors', anchors => { + console.log(anchors) + this.data.anchor2DList = [] + // 手动传入图像的时候用dom画点和框就行 + this.setData({ + anchor2DList: anchors.map(anchor => ({ + points: anchor.points, + origin: anchor.origin, + size: anchor.size + })), + }) + }) + session.on('removeAnchors', anchors => { + console.log('anchor remove') + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/photo-shoe-detect.js b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/photo-shoe-detect.js index e64687ad..8e7051c5 100644 --- a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/photo-shoe-detect.js +++ b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/photo-shoe-detect.js @@ -5,109 +5,108 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - shoeImgUrl: '', - shoeImgWidth: 0, - shoeImgHeight: 0, - shoeImgOriginWidth: 0, - shoeImgOriginHeight: 0, - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + shoeImgUrl: '', + shoeImgWidth: 0, + shoeImgHeight: 0, + shoeImgOriginWidth: 0, + shoeImgOriginHeight: 0, + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + chooseMedia() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + success: res => { + console.log('chooseMedia res', res) + const imgUrl = res.tempFiles[0].tempFilePath + wx.getImageInfo({ + src: imgUrl, + success: res => { + const fixWidth = 300 + const { + width, + height + } = res + console.log('getImageInfo res', res) + this.setData({ + shoeImgUrl: imgUrl, + shoeImgWidth: fixWidth, + shoeImgHeight: (fixWidth / width) * height, + shoeImgOriginWidth: width, + shoeImgOriginHeight: height + }) + }, + fail: res => { + console.error(res) + } }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } }, + fail: res => { + console.error(res) + } + }) }, - methods: { - chooseMedia() { - wx.chooseMedia({ - count: 1, - mediaType: ['image'], - success: res => { - console.log('chooseMedia res', res) - const imgUrl = res.tempFiles[0].tempFilePath - wx.getImageInfo({ - src: imgUrl, - success: res => { - const fixWidth = 300 - const { - width, - height - } = res - console.log('getImageInfo res', res) - this.setData({ - shoeImgUrl: imgUrl, - shoeImgWidth: fixWidth, - shoeImgHeight: (fixWidth / width) * height, - shoeImgOriginWidth: width, - shoeImgOriginHeight: height - }) - }, - fail: res => { - console.error(res) - } - }) + init() { + this.initGL() + }, + render(frame) { - }, - fail: res => { - console.error(res) - } - }) - }, - init() { - this.initGL() - }, - render(frame) { - return - }, - async detectShoe() { - if (this.data.shoeImgUrl) { - const canvas = wx.createOffscreenCanvas({ - type: '2d', - width: this.data.shoeImgOriginWidth, - height: this.data.shoeImgOriginHeight, - }) - const context = canvas.getContext('2d') - const img = canvas.createImage() - await new Promise(resolve => { - img.onload = resolve - img.src = this.data.shoeImgUrl - }) + }, + async detectShoe() { + if (this.data.shoeImgUrl) { + const canvas = wx.createOffscreenCanvas({ + type: '2d', + width: this.data.shoeImgOriginWidth, + height: this.data.shoeImgOriginHeight, + }) + const context = canvas.getContext('2d') + const img = canvas.createImage() + await new Promise(resolve => { + img.onload = resolve + img.src = this.data.shoeImgUrl + }) - context.clearRect(0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) - context.drawImage(img, 0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) + context.clearRect(0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) + context.drawImage(img, 0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) - this.imgData = context.getImageData(0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) + this.imgData = context.getImageData(0, 0, this.data.shoeImgOriginWidth, this.data.shoeImgOriginHeight) - console.log('[frameBuffer] --> ', this.imgData.data.buffer) - console.log('this.session.detectShoe', this.session.detectShoe) - console.log('width', this.data.shoeImgOriginWidth) - console.log('height', this.data.shoeImgOriginHeight) - this.session.detectShoe({ - frameBuffer: this.imgData.data.buffer, - width: this.data.shoeImgOriginWidth, - height: this.data.shoeImgOriginHeight, - }) - } - }, + console.log('[frameBuffer] --> ', this.imgData.data.buffer) + console.log('this.session.detectShoe', this.session.detectShoe) + console.log('width', this.data.shoeImgOriginWidth) + console.log('height', this.data.shoeImgOriginHeight) + this.session.detectShoe({ + frameBuffer: this.imgData.data.buffer, + width: this.data.shoeImgOriginWidth, + height: this.data.shoeImgOriginHeight, + }) + } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/photo-shoe-detect/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/photo-shoe-detect/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/behavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/behavior.js index ff5d3f1e..74994ab4 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/behavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/behavior.js @@ -1,254 +1,253 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' import cloneGltf from '../loaders/gltf-clone' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - const THREE = this.THREE - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - threeDof: true, - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - const loader = new THREE.GLTFLoader() - loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { - this.model = { - scene: gltf.scene, - animations: gltf.animations, - } - }) - - this.clock = new THREE.Clock() - - loader.load('https://dldir1.qq.com/weixin/miniprogram/reticle_4b6cc19698ca4a08b31fd3c95ce412ec.glb', gltf => { - const reticle = this.reticle = gltf.scene - - reticle.visible = false - this.scene.add(reticle) - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - updateAnimation() { - const dt = this.clock.getDelta() - if (this.mixers) this.mixers.forEach(mixer => mixer.update(dt)) - }, - copyRobot() { - const THREE = this.THREE - const { - scene, - animations - } = cloneGltf(this.model, THREE) - scene.scale.set(0.05, 0.05, 0.05) - - // 动画混合器 - const mixer = new THREE.AnimationMixer(scene) - for (let i = 0; i < animations.length; i++) { - const clip = animations[i] - if (clip.name === 'Dance') { - const action = mixer.clipAction(clip) - action.play() - } - } - - this.mixers = this.mixers || [] - this.mixers.push(mixer) - - scene._mixer = mixer - return scene - }, - getRobot() { - const THREE = this.THREE - - const model = new THREE.Object3D() - model.add(this.copyRobot()) - - this._insertModels = this._insertModels || [] - this._insertModels.push(model) - - if (this._insertModels.length > 5) { - const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) - needRemove.forEach(item => { - if (item._mixer) { - const mixer = item._mixer - this.mixers.splice(this.mixers.indexOf(mixer), 1) - mixer.uncacheRoot(mixer.getRoot()) - } - if (item.parent) item.parent.remove(item) - }) - } - return model + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + const THREE = this.THREE + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onTouchEnd(evt) { - if (this.scene && this.model && this.reticle) { - const model = this.getRobot() - model.position.copy(this.reticle.position) - model.rotation.copy(this.reticle.rotation) - this.scene.add(model) - } + threeDof: true, + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + const loader = new THREE.GLTFLoader() + loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { + this.model = { + scene: gltf.scene, + animations: gltf.animations, + } + }) + + this.clock = new THREE.Clock() + + loader.load('https://dldir1.qq.com/weixin/miniprogram/reticle_4b6cc19698ca4a08b31fd3c95ce412ec.glb', gltf => { + const reticle = this.reticle = gltf.scene + + reticle.visible = false + this.scene.add(reticle) + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + updateAnimation() { + const dt = this.clock.getDelta() + if (this.mixers) this.mixers.forEach(mixer => mixer.update(dt)) + }, + copyRobot() { + const THREE = this.THREE + const { + scene, + animations + } = cloneGltf(this.model, THREE) + scene.scale.set(0.05, 0.05, 0.05) + + // 动画混合器 + const mixer = new THREE.AnimationMixer(scene) + for (let i = 0; i < animations.length; i++) { + const clip = animations[i] + if (clip.name === 'Dance') { + const action = mixer.clipAction(clip) + action.play() + } + } + + this.mixers = this.mixers || [] + this.mixers.push(mixer) + + scene._mixer = mixer + return scene + }, + getRobot() { + const THREE = this.THREE + + const model = new THREE.Object3D() + model.add(this.copyRobot()) + + this._insertModels = this._insertModels || [] + this._insertModels.push(model) + + if (this._insertModels.length > 5) { + const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) + needRemove.forEach(item => { + if (item._mixer) { + const mixer = item._mixer + this.mixers.splice(this.mixers.indexOf(mixer), 1) + mixer.uncacheRoot(mixer.getRoot()) } - }, - }) -} \ No newline at end of file + if (item.parent) item.parent.remove(item) + }) + } + return model + }, + onTouchEnd(evt) { + if (this.scene && this.model && this.reticle) { + const model = this.getRobot() + model.position.copy(this.reticle.position) + model.rotation.copy(this.reticle.rotation) + this.scene.add(model) + } + } + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/plane-ar-3dof.js b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/plane-ar-3dof.js index 8f17665e..baa31187 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/plane-ar-3dof.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/plane-ar-3dof.js @@ -5,73 +5,73 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - this.renderGL(frame) + render(frame) { + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 修改光标位置 - const reticle = this.reticle - if (reticle) { - const hitTestRes = this.session.hitTest(0.5, 0.5) - if (hitTestRes.length) { - reticle.matrixAutoUpdate = false - reticle.matrix.fromArray(hitTestRes[0].transform) - reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) - reticle.visible = true - } else { - reticle.visible = false - } - } + // 修改光标位置 + const reticle = this.reticle + if (reticle) { + const hitTestRes = this.session.hitTest(0.5, 0.5) + if (hitTestRes.length) { + reticle.matrixAutoUpdate = false + reticle.matrix.fromArray(hitTestRes[0].transform) + reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) + reticle.visible = true + } else { + reticle.visible = false + } + } - // 更新动画 - this.updateAnimation() + // 更新动画 + this.updateAnimation() - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-3dof/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-3dof/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/behavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/behavior.js index c61dc394..c3f72e94 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/behavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/behavior.js @@ -19,7 +19,6 @@ export default function getBehavior() { }, methods: { onReady() { - wx.createSelectorQuery() .select('#webgl') .node() @@ -111,12 +110,11 @@ export default function getBehavior() { version: 'v2', gl: this.gl, }) - const session = this.session + const session = this.session session.start(err => { - if (err) { this.setData({ - errMsg:'VK error: ' + err + errMsg: 'VK error: ' + err }) return console.error('VK error: ', err) } @@ -157,7 +155,6 @@ export default function getBehavior() { this.planeBox.add(reticle) }) - // anchor 检测 const createPlane = size => { const geometry = new THREE.PlaneGeometry(size.width, size.height) @@ -185,21 +182,21 @@ export default function getBehavior() { const size = anchor.size let object if (size) { - // object = createPlane(size) - this.planeBox.add(object) + // object = createPlane(size) + this.planeBox.add(object) } else { if (!this.model) { console.warn('this.model 还没加载完成 !!!!!') return } - object = new THREE.Object3D() - const model = this.getRobot() - model.rotateX(-Math.PI / 2) - object.add(model) - this.robotBox.add(object) + object = new THREE.Object3D() + const model = this.getRobot() + model.rotateX(-Math.PI / 2) + object.add(model) + this.robotBox.add(object) } - if(object){ + if (object) { object._id = anchor.id object._size = size updateMatrix(object, anchor.transform) @@ -217,7 +214,7 @@ export default function getBehavior() { const size = anchor.size if (size && object._size && (size.width !== object._size.width || size.height !== object._size.height)) { this.planeBox.remove(object) - // object = createPlane(size) + // object = createPlane(size) this.plane = object this.planeBox.add(object) } @@ -240,29 +237,28 @@ export default function getBehavior() { }) }) - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() // 逐帧渲染 const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - try{ - this.render(frame) - }catch(e){ - console.log(e) - } - - } + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + try { + this.render(frame) + } catch (e) { + console.log(e) + } } - session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) } session.requestAnimationFrame(onFrame) }) @@ -351,11 +347,11 @@ export default function getBehavior() { return model }, onTouchEnd(evt) { - if(this.reticle.visible){ - //0.05 -0.47 -0.14 + if (this.reticle.visible) { + // 0.05 -0.47 -0.14 this.hitPosition = this.reticle.position.clone() console.log(this.hitPosition) - + const model = this.getRobot() model.position.copy(this.hitPosition) model.rotation.copy(this.reticle.rotation) @@ -364,4 +360,4 @@ export default function getBehavior() { } }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/depthBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/depthBehavior.js index 31fcb46d..a18cdcad 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/depthBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/depthBehavior.js @@ -2,9 +2,8 @@ const depthBehavior = Behavior({ methods: { initDepthShader() { const gl = this.gl = this.renderer.getContext() - const ext = gl.getExtension("OES_texture_float"); - if (!ext) - console.warn('OES_texture_float not support'); + const ext = gl.getExtension('OES_texture_float') + if (!ext) console.warn('OES_texture_float not support') const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const vs = ` precision highp float; @@ -27,7 +26,7 @@ const depthBehavior = Behavior({ gl_FragColor = vec4(depth_color.rgb, 1.0); } ` - + const vertShader = gl.createShader(gl.VERTEX_SHADER) gl.shaderSource(vertShader, vs) gl.compileShader(vertShader) @@ -89,32 +88,32 @@ const depthBehavior = Behavior({ const displayTransform = frame.getDisplayTransform() // DepthBuffer - const depthBufferRes = frame.getDepthBuffer(); - const depthBuffer = new Float32Array(depthBufferRes.DepthAddress); + const depthBufferRes = frame.getDepthBuffer() + const depthBuffer = new Float32Array(depthBufferRes.DepthAddress) - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + const texture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - const width = depthBufferRes.width; - const height = depthBufferRes.height; + const width = depthBufferRes.width + const height = depthBufferRes.height // const ext = gl.getExtension("OES_texture_float"); // if (ext) { // gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.FLOAT, depthBuffer); // } else { // } - + // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 - const data = new Uint8Array(width * height * 4); + const data = new Uint8Array(width * height * 4) for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i] = num; + const num = parseInt(depthBuffer[i] * 255) + data[i] = num } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) @@ -137,9 +136,8 @@ const depthBehavior = Behavior({ gl.useProgram(currentProgram) gl.activeTexture(currentActiveTexture) this.ext.bindVertexArrayOES(currentVAO) - }, }, }) -export default depthBehavior \ No newline at end of file +export default depthBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/plane-ar-v2-depth.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/plane-ar-v2-depth.js index daf74576..c28dbb50 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/plane-ar-v2-depth.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/plane-ar-v2-depth.js @@ -5,11 +5,11 @@ import depthBehavior from './depthBehavior' const NEAR = 0.1 const FAR = 100 let cubeVao = null -let countNumber = 20 +const countNumber = 20 let count = 0 let time = 0 -var CUBE_VSHADER_SOURCE = +const CUBE_VSHADER_SOURCE = ` #version 300 es in vec3 aPosition; @@ -23,7 +23,7 @@ var CUBE_VSHADER_SOURCE = } ` -var CUBE_FSHADER_SOURCE = +const CUBE_FSHADER_SOURCE = ` #version 300 es precision highp float; @@ -34,12 +34,12 @@ var CUBE_FSHADER_SOURCE = } ` -function createCubeVAO(gl, program){ - const ext = gl.getExtension("OES_vertex_array_object"); +function createCubeVAO(gl, program) { + const ext = gl.getExtension('OES_vertex_array_object') const vao = ext.createVertexArrayOES() ext.bindVertexArrayOES(vao) - var vertices = [ + const vertices = [ -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, -1.0, 1.0, -1.0, 1.0, 1.0, 1.0, -1.0, @@ -52,42 +52,41 @@ function createCubeVAO(gl, program){ 1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0, 1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, -1.0, 1.0, 1.0, -1.0, 1.0, -1.0 - ]; - var vertexBuffer = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer); - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); - var aPosition = gl.getAttribLocation(program, 'aPosition'); - gl.enableVertexAttribArray(aPosition); - gl.vertexAttribPointer(aPosition, 3, gl.FLOAT, false, 0, 0); + ] + const vertexBuffer = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW) + const aPosition = gl.getAttribLocation(program, 'aPosition') + gl.enableVertexAttribArray(aPosition) + gl.vertexAttribPointer(aPosition, 3, gl.FLOAT, false, 0, 0) vao.posBuffer = vertexBuffer return vao } function onDrawCube(gl, program, hitPosition, vm, pm) { - const ext = gl.getExtension("OES_vertex_array_object"); + const ext = gl.getExtension('OES_vertex_array_object') const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) const bindingTexture = gl.getParameter(gl.TEXTURE_BINDING_2D) - if(!cubeVao){ + if (!cubeVao) { cubeVao = createCubeVAO(gl, program) - }else{ + } else { ext.bindVertexArrayOES(cubeVao) } gl.useProgram(program) - var basePos = gl.getUniformLocation(program, 'basePosition'); - gl.uniform3fv(basePos, [hitPosition.x, hitPosition.y, hitPosition.z]); + const basePos = gl.getUniformLocation(program, 'basePosition') + gl.uniform3fv(basePos, [hitPosition.x, hitPosition.y, hitPosition.z]) - var viewLoc = gl.getUniformLocation(program, 'viewMatrix') + const viewLoc = gl.getUniformLocation(program, 'viewMatrix') gl.uniformMatrix4fv(viewLoc, false, vm) - var projLoc = gl.getUniformLocation(program, 'projMatrix') + const projLoc = gl.getUniformLocation(program, 'projMatrix') gl.uniformMatrix4fv(projLoc, false, pm) - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 36); - + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 36) gl.useProgram(currentProgram) ext.bindVertexArrayOES(currentVAO) @@ -95,9 +94,6 @@ function onDrawCube(gl, program, hitPosition, vm, pm) { gl.bindTexture(gl.TEXTURE_2D, bindingTexture) } - - - Component({ behaviors: [getBehavior(), yuvBehavior, depthBehavior], data: { @@ -108,15 +104,15 @@ Component({ * 生命周期函数--监听页面加载 */ detached() { - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") + console.log('页面准备完全') this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -136,7 +132,6 @@ Component({ this.initDepthGL() }, render(frame) { - this.session.setDepthOccRange(NEAR, FAR) const start = Date.now() @@ -182,7 +177,6 @@ Component({ gl.depthFunc(gl.LESS) this.renderer.render(this.scene, this.camera) - // if (!this.cubeProgram) { // this.cubeProgram = this.compileShader(gl, CUBE_VSHADER_SOURCE, CUBE_FSHADER_SOURCE) // } @@ -204,4 +198,4 @@ Component({ } }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/yuvBehavior.js index a375fc22..4da93380 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-depth/yuvBehavior.js @@ -21,12 +21,11 @@ const yuvBehavior = Behavior({ gl.linkProgram(program) if (!gl.getProgramParameter(program, gl.LINK_STATUS)) { - const info = gl.getProgramInfoLog(program); + const info = gl.getProgramInfoLog(program) console.log(info) - throw new Error(`Could not compile WebGL program. \n\n${info}`); + throw new Error(`Could not compile WebGL program. \n\n${info}`) } - gl.useProgram(program) return program @@ -105,7 +104,7 @@ const yuvBehavior = Behavior({ // FragColor = vec4(depth_color.rgb, 1.0); } ` - + const depthOutputProgram = this._depthOutputProgram = this.compileShader(gl, dvs, dfs) const uniformDepthTexture = gl.getUniformLocation(depthOutputProgram, 'depth_texture') gl.uniform1i(uniformDepthTexture, 5) @@ -114,52 +113,57 @@ const yuvBehavior = Behavior({ gl.useProgram(currentProgram) }, buildPlane( - vertices, indices, - width, height, - widthSegments, heightSegments + vertices, + indices, + width, + height, + widthSegments, + heightSegments ) { - const width_half = width / 2; - const height_half = height / 2; - - const gridX = Math.floor( widthSegments ); - const gridY = Math.floor( heightSegments ); - - const gridX1 = gridX + 1; - const gridY1 = gridY + 1; - - const segment_width = width / gridX; - const segment_height = height / gridY; - - for ( let iy = 0; iy < gridY1; iy ++ ) { - const y = iy * segment_height - height_half; - - for ( let ix = 0; ix < gridX1; ix ++ ) { - const x = ix * segment_width - width_half; - - vertices.push( - // a_position - x, -y, 0, - // a_texCoord - ix / gridX, 1 - ( iy / gridY ) - ); + const width_half = width / 2 + const height_half = height / 2 + + const gridX = Math.floor(widthSegments) + const gridY = Math.floor(heightSegments) + + const gridX1 = gridX + 1 + const gridY1 = gridY + 1 + + const segment_width = width / gridX + const segment_height = height / gridY + + for (let iy = 0; iy < gridY1; iy++) { + const y = iy * segment_height - height_half + + for (let ix = 0; ix < gridX1; ix++) { + const x = ix * segment_width - width_half + + vertices.push( + // a_position + x, + -y, + 0, + // a_texCoord + ix / gridX, + 1 - (iy / gridY) + ) } } - for ( let iy = 0; iy < gridY; iy ++ ) { - for ( let ix = 0; ix < gridX; ix ++ ) { - const a = ix + gridX1 * iy; - const b = ix + gridX1 * ( iy + 1 ); - const c = ( ix + 1 ) + gridX1 * ( iy + 1 ); - const d = ( ix + 1 ) + gridX1 * iy; - indices.push( a, b, d ); - indices.push( b, c, d ); + for (let iy = 0; iy < gridY; iy++) { + for (let ix = 0; ix < gridX; ix++) { + const a = ix + gridX1 * iy + const b = ix + gridX1 * (iy + 1) + const c = (ix + 1) + gridX1 * (iy + 1) + const d = (ix + 1) + gridX1 * iy + indices.push(a, b, d) + indices.push(b, c, d) } } }, initVAO(program) { const gl = this.renderer.getContext() const ext = gl.getExtension('OES_vertex_array_object') - if (!this.ext) - this.ext = ext + if (!this.ext) this.ext = ext const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) const vao = ext.createVertexArrayOES() @@ -189,7 +193,7 @@ const yuvBehavior = Behavior({ const gl = this.renderer.getContext() const ext = gl.getExtension('OES_vertex_array_object') - if (!this.ext){ + if (!this.ext) { this.ext = ext } @@ -201,8 +205,7 @@ const yuvBehavior = Behavior({ const vertices = [] const indices = [] - this.buildPlane(vertices, indices, 1, 1, width, height); - + this.buildPlane(vertices, indices, 1, 1, width, height) const posAttr = gl.getAttribLocation(program, 'a_position') const pos = gl.createBuffer() @@ -232,18 +235,18 @@ const yuvBehavior = Behavior({ const displayTransform = frame.getDisplayTransform() // DepthBuffer - const depthBufferRes = frame.getDepthBuffer(); - const depthBuffer = new Float32Array(depthBufferRes.DepthAddress); + const depthBufferRes = frame.getDepthBuffer() + const depthBuffer = new Float32Array(depthBufferRes.DepthAddress) - const texture = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, texture); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + const texture = gl.createTexture() + gl.bindTexture(gl.TEXTURE_2D, texture) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR) + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR) - const width = depthBufferRes.width; - const height = depthBufferRes.height; + const width = depthBufferRes.width + const height = depthBufferRes.height // const ext = gl.getExtension("OES_texture_float"); // if (ext) { @@ -252,24 +255,23 @@ const yuvBehavior = Behavior({ // } // 先直接采用 uint8 写入深度纹理,使用浮点写入的方法会存在锯齿 - const data = new Uint8Array(width * height * 4); + const data = new Uint8Array(width * height * 4) for (let i = 0; i < depthBuffer.length; i++) { - let num = parseInt(depthBuffer[i] * 255); - data[i] = num; + const num = parseInt(depthBuffer[i] * 255) + data[i] = num } - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data); + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, data) const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) const bindingTexture = gl.getParameter(gl.TEXTURE_BINDING_2D) - - if(!this._vao2){ - // this._vao2 = this.initDepthOutputVAO(this._depthOutputProgram, width, height) - this._vao2 = this.initVAO(this._depthOutputProgram) + if (!this._vao2) { + // this._vao2 = this.initDepthOutputVAO(this._depthOutputProgram, width, height) + this._vao2 = this.initVAO(this._depthOutputProgram) } - + this.ext.bindVertexArrayOES(this._vao2) gl.useProgram(this._depthOutputProgram) @@ -289,7 +291,6 @@ const yuvBehavior = Behavior({ gl.bindTexture(gl.TEXTURE_2D, bindingTexture) this.ext.bindVertexArrayOES(currentVAO) - }, renderGL(frame) { const gl = this.renderer.getContext() @@ -305,7 +306,6 @@ const yuvBehavior = Behavior({ const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) const bindingTexture = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.enable(gl.DEPTH_TEST) gl.depthMask(true) gl.depthFunc(gl.ALWAYS) @@ -333,7 +333,6 @@ const yuvBehavior = Behavior({ gl.activeTexture(gl.TEXTURE0 + 5) gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - gl.useProgram(currentProgram) gl.activeTexture(currentActiveTexture) gl.bindTexture(gl.TEXTURE_2D, bindingTexture) @@ -344,4 +343,4 @@ const yuvBehavior = Behavior({ }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/behavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/behavior.js index 6627b04d..8ab8877a 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/behavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/behavior.js @@ -7,7 +7,7 @@ import { import cloneGltf from '../loaders/gltf-clone' const info = wx.getSystemInfoSync() - // 此处如果为jpeg,则后缀名也需要改成对应后缀 +// 此处如果为jpeg,则后缀名也需要改成对应后缀 // const filePath = `${wx.env.USER_DATA_PATH}/marker-ar1.jpg` // const mapfilePath = `${wx.env.USER_DATA_PATH}/marker-ar.jpg` @@ -43,7 +43,7 @@ export default function getBehavior() { } calcSize(info.windowWidth, info.windowHeight * 0.6) - // this.downloadFile() + // this.downloadFile() this.initVK() }) @@ -112,40 +112,39 @@ export default function getBehavior() { console.error(res) } }) - }, fail: res => { console.error(res) } }) }, - errImg(e){ - console.log("err img",e) + errImg(e) { + console.log('err img', e) }, - loadImg(){ - console.log("load img") + loadImg() { + console.log('load img') }, - add3DMarker(){ + add3DMarker() { const mapfilePath = `${wx.env.USER_DATA_PATH}/marker-ar1.map` console.log('now download....') const fs = wx.getFileSystemManager() - + const download = callback => wx.downloadFile({ - // 此处设置为识别的2d对象的jpg地址 - url: 'http://dldir1.qq.com/weixin/checkresupdate/ncov_7bf1a739c43f4f80b3fb3488b592f355.map', - success(res) { - console.log("downloadFile success:", res) - fs.saveFile({ - mapfilePath, - tempFilePath: res.tempFilePath, - success: callback, - }) - }, - fail(e) { - console.log("downloadFile fail:", e) - } + // 此处设置为识别的2d对象的jpg地址 + url: 'http://dldir1.qq.com/weixin/checkresupdate/ncov_7bf1a739c43f4f80b3fb3488b592f355.map', + success(res) { + console.log('downloadFile success:', res) + fs.saveFile({ + mapfilePath, + tempFilePath: res.tempFilePath, + success: callback, + }) + }, + fail(e) { + console.log('downloadFile fail:', e) + } }) const add = () => { @@ -155,12 +154,12 @@ export default function getBehavior() { path: mapfilePath, success(res) { // 文件存在 - console.log("文件存在") + console.log('文件存在') console.log(res) }, fail(res) { // 文件不存在或其他错误 - console.log("文件不存在") + console.log('文件不存在') console.error(res) } }) @@ -168,27 +167,27 @@ export default function getBehavior() { } download(add) }, - add3DMarker2(){ + add3DMarker2() { const mapfilePath = `${wx.env.USER_DATA_PATH}/marker-ar.map` console.log('now download....') const fs = wx.getFileSystemManager() - + const download = callback => wx.downloadFile({ - // 此处设置为识别的2d对象的jpg地址 - url: 'http://dldir1.qq.com/weixin/checkresupdate/ncov_7bf1a739c43f4f80b3fb3488b592f355.map', - success(res) { - console.log("downloadFile success:", res) - fs.saveFile({ - mapfilePath, - tempFilePath: res.tempFilePath, - success: callback, - }) - }, - fail(e) { - console.log("downloadFile fail:", e) - } + // 此处设置为识别的2d对象的jpg地址 + url: 'http://dldir1.qq.com/weixin/checkresupdate/ncov_7bf1a739c43f4f80b3fb3488b592f355.map', + success(res) { + console.log('downloadFile success:', res) + fs.saveFile({ + mapfilePath, + tempFilePath: res.tempFilePath, + success: callback, + }) + }, + fail(e) { + console.log('downloadFile fail:', e) + } }) const add = () => { @@ -202,8 +201,8 @@ export default function getBehavior() { const fs = wx.getFileSystemManager() // 此处如果为jpeg,则后缀名也需要改成对应后缀 // const filePath = `${wx.env.USER_DATA_PATH}/marker-ar.map` - const filePath = `${wx.env.USER_DATA_PATH}/marker-ar`+this.data.markerId.length+`.jpeg` - + const filePath = `${wx.env.USER_DATA_PATH}/marker-ar` + this.data.markerId.length + '.jpeg' + const download = callback => { fs.saveFile({ filePath, @@ -215,13 +214,13 @@ export default function getBehavior() { }) } const add = () => { - console.log('[addMarker'+this.data.markerId.length+'] --> ', filePath) - var id = this.session.addMarker(filePath) + console.log('[addMarker' + this.data.markerId.length + '] --> ', filePath) + const id = this.session.addMarker(filePath) this.data.markerId.push(id) this.data.imgList.push(filePath) this.setData({ - markerId:this.data.markerId, + markerId: this.data.markerId, imgList: this.data.imgList }) } @@ -229,9 +228,9 @@ export default function getBehavior() { }, removeAllMarker() { - if (this.data.markerId.length!=0) { - for(let i = 0; i { - if (err) { this.setData({ - errMsg:'VK error: ' + err + errMsg: 'VK error: ' + err }) return console.error('VK error: ', err) } @@ -305,7 +302,7 @@ export default function getBehavior() { animations: gltf.animations, } - console.log("model加载完成") + console.log('model加载完成') }) this.clock = new THREE.Clock() @@ -320,7 +317,7 @@ export default function getBehavior() { this.setData({ showTip: true }) - setTimeout(()=>{ + setTimeout(() => { this.setData({ showTip: false }) @@ -346,25 +343,25 @@ export default function getBehavior() { object.matrix.fromArray(m) } session.on('addAnchors', anchors => { - console.log("add anchor") + console.log('add anchor') anchors.forEach(anchor => { - console.log("type: ", anchor.type) + console.log('type: ', anchor.type) const size = anchor.size let object if (anchor.type == 0) { - object = createPlane(size) - this.setData({ - showTip: false - }) + object = createPlane(size) + this.setData({ + showTip: false + }) } else { if (!this.model) { console.warn('this.model 还没加载完成 !!!!!') return } - object = new THREE.Object3D() - const model = this.getRobot() - model.rotateX(-Math.PI / 2) - object.add(model) + object = new THREE.Object3D() + const model = this.getRobot() + model.rotateX(-Math.PI / 2) + object.add(model) } object._id = anchor.id @@ -374,7 +371,7 @@ export default function getBehavior() { }) }) session.on('updateAnchors', anchors => { - console.log("update") + console.log('update') const map = anchors.reduce((temp, item) => { temp[item.id] = item console.log(item.id, item) @@ -397,9 +394,9 @@ export default function getBehavior() { }) }) session.on('removeAnchors', anchors => { - console.log("remove anchor") + console.log('remove anchor') const map = anchors.reduce((temp, item) => { - console.log("type:", item.type) + console.log('type:', item.type) temp[item.id] = item return temp }, {}) @@ -412,32 +409,32 @@ export default function getBehavior() { const planeBox = this.planeBox = new THREE.Object3D() this.scene.add(planeBox) - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() // 逐帧渲染 const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) } - session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) } session.requestAnimationFrame(onFrame) }) }, - removeRobot(){ + removeRobot() { this.planeBox.children.forEach(object => { - this.planeBox.remove(object) - }) + this.planeBox.remove(object) + }) }, initTHREE() { const THREE = this.THREE = createScopedThreejs(this.canvas) @@ -525,4 +522,4 @@ export default function getBehavior() { } }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker.js index cac53daa..0808c873 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/plane-ar-v2-marker.js @@ -4,90 +4,89 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -let time = 0; -let countNumber = 20; -let count = 0; +let time = 0 +const countNumber = 20 +let count = 0 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - let start = Date.now() + render(frame) { + const start = Date.now() - this.renderGL(frame) - const camera = frame.camera + this.renderGL(frame) + const camera = frame.camera - // 修改光标位置 - const reticle = this.reticle - if (reticle) { - const hitTestRes = this.session.hitTest(0.5, 0.5) - if (hitTestRes.length) { - reticle.matrixAutoUpdate = false - reticle.matrix.fromArray(hitTestRes[0].transform) - reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) - if(reticle.position.z !=0 ) - reticle.visible = true - } else { - reticle.visible = false - } - } + // 修改光标位置 + const reticle = this.reticle + if (reticle) { + const hitTestRes = this.session.hitTest(0.5, 0.5) + if (hitTestRes.length) { + reticle.matrixAutoUpdate = false + reticle.matrix.fromArray(hitTestRes[0].transform) + reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) + if (reticle.position.z != 0) reticle.visible = true + } else { + reticle.visible = false + } + } - // 更新动画 - this.updateAnimation() + // 更新动画 + this.updateAnimation() - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) - let end = Date.now() + const end = Date.now() - time += end-start - count++ - // if(count >= countNumber){ - // console.log(`${count}次平均耗时统计为${time/count}ms`) - // count = 0 - // time = 0 - // } - }, + time += end - start + count++ + // if(count >= countNumber){ + // console.log(`${count}次平均耗时统计为${time/count}ms`) + // count = 0 + // time = 0 + // } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-marker/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2-options/plane-ar-v2-options.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2-options/plane-ar-v2-options.js index ba4608c1..92528fe2 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2-options/plane-ar-v2-options.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2-options/plane-ar-v2-options.js @@ -9,37 +9,37 @@ Component({ behaviors: [arBehavior, threeBehavior], data: { theme: 'light', - widthScale: 1, // canvas宽度缩放值 - heightScale: 0.6, // canvas高度缩放值 - markerImgList: [], // 使用的 marker 列表 + widthScale: 1, // canvas宽度缩放值 + heightScale: 0.6, // canvas高度缩放值 + markerImgList: [], // 使用的 marker 列表 chooseImgList: [], // 使用的 图片 列表 }, - markerIndex: 0, // 使用的 marker 索引 + markerIndex: 0, // 使用的 marker 索引 showBoxList: [], // 提示盒子列表, hintCenter: null, // 红色提示点 useDepthBuffer: false, // 开启深度buffer lifetimes: { - /** + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") + detached() { + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, }, methods: { @@ -47,7 +47,7 @@ Component({ init() { // 初始化 Three.js,用于模型相关的渲染 this.initTHREE() - this.initDepthGL(); + this.initDepthGL() this.loader.load('https://dldir1.qq.com/weixin/miniprogram/reticle_4b6cc19698ca4a08b31fd3c95ce412ec.glb', gltf => { const reticle = this.hintCenter = gltf.scene @@ -61,13 +61,11 @@ Component({ // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); - - this.markerIndex = 0; - this.showBoxList = []; - this.useDepthBuffer = false; - + this.initVK() + this.markerIndex = 0 + this.showBoxList = [] + this.useDepthBuffer = false }, initVK() { // VKSession 配置 @@ -80,7 +78,7 @@ Component({ }, version: 'v2', gl: this.gl - }); + }) session.start(err => { if (err) return console.error('VK error: ', err) @@ -89,7 +87,7 @@ Component({ // VKSession EVENT resize session.on('resize', () => { - this.calcCanvasSize(); + this.calcCanvasSize() }) // VKSession EVENT addAnchors @@ -101,34 +99,33 @@ Component({ id: anchor.id, size: anchor.size, transform: anchor.transform - }; - - switch(anchor.type) { + } + + switch (anchor.type) { case 0: // plane Anchor - const boxPlane = this.createBox(0xffffff, anchor.type); - boxPlane.box.scale.set(showBox.size.width, 0.02, showBox.height); - console.log('boxPlane.size', showBox.size); - - showBox.type = 'Plane'; - showBox.wrap = boxPlane.wrap; - showBox.box = boxPlane.box; - break; + const boxPlane = this.createBox(0xffffff, anchor.type) + boxPlane.box.scale.set(showBox.size.width, 0.02, showBox.height) + console.log('boxPlane.size', showBox.size) + + showBox.type = 'Plane' + showBox.wrap = boxPlane.wrap + showBox.box = boxPlane.box + break case 1: // marker Anchor - const boxMarker = this.createBox(0x55cc55, anchor.type); - boxMarker.box.scale.set(1, 0.1, 1); - console.log('boxMarker.size', showBox.size); - - - showBox.type = 'Marker'; - showBox.wrap = boxMarker.wrap; - showBox.box = boxMarker.box; - break; + const boxMarker = this.createBox(0x55cc55, anchor.type) + boxMarker.box.scale.set(1, 0.1, 1) + console.log('boxMarker.size', showBox.size) + + showBox.type = 'Marker' + showBox.wrap = boxMarker.wrap + showBox.box = boxMarker.box + break } - - this.showBoxList.push(showBox); - }); + + this.showBoxList.push(showBox) + }) console.log('this.showBoxList', this.showBoxList) }) @@ -140,26 +137,26 @@ Component({ // 仅更新已经添加的Anchor this.showBoxList.forEach(showBox => { - for(let i = 0; i < anchors.length; i++) { + for (let i = 0; i < anchors.length; i++) { if (showBox.id === anchors[i].id) { // 匹配 if (showBox.size !== anchors[i].size) { - switch(showBox.type) { + switch (showBox.type) { case 'Plane': - showBox.box.scale.set(anchors[i].size.width, 0.02, anchors[i].size.height); - break; + showBox.box.scale.set(anchors[i].size.width, 0.02, anchors[i].size.height) + break case 'Marker': - break; + break } } - showBox.size = anchors[i].size; - showBox.transform = anchors[i].transform; - break; + showBox.size = anchors[i].size + showBox.transform = anchors[i].transform + break } } - }); + }) }) - + // VKSession removeAnchors // 识别目标丢失时,会触发一次 session.on('removeAnchors', anchors => { @@ -168,33 +165,30 @@ Component({ // 存在要删除的 Anchor if (anchors.length > 0) { this.showBoxList = this.showBoxList.filter((showBox) => { - let flag = true; - for(let i = 0; i < anchors.length; i++) { + let flag = true + for (let i = 0; i < anchors.length; i++) { if (showBox.id === anchors[i].id) { console.log('remove', showBox.id) - let scene = this.scene; - if (showBox.type === "Marker") { - scene = this.sceneCull; + let scene = this.scene + if (showBox.type === 'Marker') { + scene = this.sceneCull } // 从three里面去掉 - scene.remove(showBox.wrap); + scene.remove(showBox.wrap) // 标记删除 - flag = false; - break; + flag = false + break } } - return flag; - + return flag }) } - }); - + }) console.log('ready to initloop') // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); - + this.initLoop() + }) }, loop() { // console.log('loop') @@ -203,7 +197,7 @@ Component({ const frame = this.session.getVKFrame(this.canvas.width, this.canvas.height) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新相机 YUV 数据 this.renderYUV(frame) @@ -217,8 +211,8 @@ Component({ this.camera.matrixAutoUpdate = false // 视图矩阵 - this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix); - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse); + this.camera.matrixWorldInverse.fromArray(VKCamera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) // 投影矩阵 const projectionMatrix = VKCamera.getProjectionMatrix(NEAR, FAR) @@ -229,11 +223,11 @@ Component({ // 更新提示盒子 位置 if (this.showBoxList) { this.showBoxList.forEach(showBox => { - showBox.wrap.matrix.fromArray(showBox.transform); - }); + showBox.wrap.matrix.fromArray(showBox.transform) + }) } - const reticle = this.hintCenter; + const reticle = this.hintCenter if (reticle) { const hitTestRes = this.session.hitTest(0.5, 0.5) if (hitTestRes.length) { @@ -257,39 +251,39 @@ Component({ if (this.useDepthBuffer) { // 1. 在左下角绘制深度提示 // 2. 写入深度遮挡纹理到深度值 - this.renderDepthGL(frame); + this.renderDepthGL(frame) } // 绘制进行深度遮挡的物体 this.renderer.render(this.sceneCull, this.camera) this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, createBox(color, type) { - const THREE = this.THREE; - let scene = this.scene; + const THREE = this.THREE + let scene = this.scene - let material; + let material // 根据类型添加不一样的行为 - switch(type) { + switch (type) { case 0: // plane Anchor material = new THREE.MeshBasicMaterial({ metalness: 0.0, roughness: 0.1, - color: color, + color, transparent: true, opacity: 0.8 - } ); - break; + }) + break case 1: // marker Anchor const uniforms = { time: { value: Math.random() * 100 } - }; - + } + material = new THREE.ShaderMaterial({ - uniforms: uniforms, + uniforms, vertexShader: ` varying vec2 vUv; void main() { @@ -327,33 +321,33 @@ Component({ f = ( sin( a * g ) + 1.0 ) / 2.0; gl_FragColor = vec4( vec3( f * i / 1.6, i / 2.0 + d / 13.0, i ) * d * p.x + vec3( i / 1.3 + d / 8.0, i / 2.0 + d / 18.0, i ) * d * ( 1.0 - p.x ), 1.0 ); }`, - }); + }) + + scene = this.sceneCull - scene = this.sceneCull; - - break; + break } - const geometry = new THREE.BoxGeometry( 1, 1, 1 ); + const geometry = new THREE.BoxGeometry(1, 1, 1) - const wrap = new THREE.Object3D(); + const wrap = new THREE.Object3D() // 禁止矩阵自动更新,只能手动写入信息 - wrap.matrixAutoUpdate = false; + wrap.matrixAutoUpdate = false // 绘制区域的box - const box = new THREE.Mesh( geometry, material ); - wrap.add(box); + const box = new THREE.Mesh(geometry, material) + wrap.add(box) - scene.add( wrap ); + scene.add(wrap) - box.visible = true; + box.visible = true return { - wrap: wrap, - box: box, - }; + wrap, + box, + } }, - chooseMedia() { + chooseMedia() { // marker图片上传逻辑 wx.chooseMedia({ count: 9, @@ -362,10 +356,10 @@ Component({ success: res => { console.log('chooseMedia res', res) - const chooseImgListRes = []; + const chooseImgListRes = [] for (let i = 0; i < res.tempFiles.length; i++) { - const imgUrl = res.tempFiles[i].tempFilePath; - chooseImgListRes.push(imgUrl); + const imgUrl = res.tempFiles[i].tempFilePath + chooseImgListRes.push(imgUrl) } console.log('set chooseImgList', chooseImgListRes) @@ -381,88 +375,87 @@ Component({ async addMarker() { console.log('addMarker') const fs = wx.getFileSystemManager() - - const markerImgListRes = this.data.markerImgList.concat([]); - const preMarkerIndex = this.markerIndex; - console.log('pre markerImgList', preMarkerIndex, markerImgListRes); - + const markerImgListRes = this.data.markerImgList.concat([]) + const preMarkerIndex = this.markerIndex + + console.log('pre markerImgList', preMarkerIndex, markerImgListRes) + // 检查与添加 marker 函数 - const chooseImgCount = this.data.chooseImgList.length; - let handledCount = 0; + const chooseImgCount = this.data.chooseImgList.length + let handledCount = 0 const checkMarkerAdded = () => { if (handledCount === chooseImgCount) { - this.markerIndex = markerImgListRes.length; + this.markerIndex = markerImgListRes.length - console.log('markerImgList set', markerImgListRes, this.markerIndex); + console.log('markerImgList set', markerImgListRes, this.markerIndex) this.setData({ chooseImgList: [], markerImgList: markerImgListRes - }); + }) } } - + // 准备进行choose的图片保存到fs for (let i = 0; i < chooseImgCount; i++) { - const chooseImgUrl = this.data.chooseImgList[i]; - const fileEnd = chooseImgUrl.split('.').slice(-1)[0]; - const fileIndex = preMarkerIndex + i; + const chooseImgUrl = this.data.chooseImgList[i] + const fileEnd = chooseImgUrl.split('.').slice(-1)[0] + const fileIndex = preMarkerIndex + i // 算法侧目前只认 map png jpg jpeg 后缀文件 - const filePath = `${wx.env.USER_DATA_PATH}/marker-ar-${fileIndex}.${fileEnd}`; + const filePath = `${wx.env.USER_DATA_PATH}/marker-ar-${fileIndex}.${fileEnd}` const saveAndAddMarker = () => { - console.log('saveFileSync start', filePath, chooseImgUrl); + console.log('saveFileSync start', filePath, chooseImgUrl) // 存入文件系统,并添加到marker fs.saveFile({ filePath, tempFilePath: chooseImgUrl, - success: ()=> { + success: () => { console.log('[addMarker] --> ', filePath) const markerId = this.session.addMarker(filePath) markerImgListRes.push({ - markerId: markerId, - filePath: filePath + markerId, + filePath }) - handledCount++; - checkMarkerAdded(); + handledCount++ + checkMarkerAdded() }, fail: res => { console.error(res) - console.log('文件保存失败', filePath); - handledCount++; - checkMarkerAdded(); + console.log('文件保存失败', filePath) + handledCount++ + checkMarkerAdded() } }) } - console.log('uploadFile Path', filePath); + console.log('uploadFile Path', filePath) // 确定文件,存在即删除 fs.stat({ path: filePath, success: (res) => { if (res.stats.isFile()) { - fs.unlinkSync(filePath); - console.log('fs unlinkSync', filePath); + fs.unlinkSync(filePath) + console.log('fs unlinkSync', filePath) } - saveAndAddMarker(); + saveAndAddMarker() }, fail: (res) => { console.error(res) - console.log('fs中不存在,直接写入', filePath); + console.log('fs中不存在,直接写入', filePath) - saveAndAddMarker(); + saveAndAddMarker() } }) } - }, removeMarker() { if (this.data.markerImgList) { for (let i = 0; i < this.data.markerImgList.length; i++) { - const markerImg = this.data.markerImgList[i]; - this.session.removeMarker(markerImg.markerId); + const markerImg = this.data.markerImgList[i] + this.session.removeMarker(markerImg.markerId) } - this.markerIndex = 0; + this.markerIndex = 0 this.setData({ markerImgList: [], }) @@ -470,42 +463,40 @@ Component({ }, placeItem() { if (this.hintCenter && this.hintCenter.visible) { - const THREE = this.THREE; - const scene = this.sceneCull; + const THREE = this.THREE + const scene = this.sceneCull // 加载模型 this.loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { - const wrap = new THREE.Object3D(); + const wrap = new THREE.Object3D() - wrap.add(gltf.scene); - - scene.add( wrap ); + wrap.add(gltf.scene) - const position = new THREE.Vector3(); - const rotation = new THREE.Quaternion(); - const scale = new THREE.Vector3(); - this.hintCenter.matrix.decompose(position, rotation, scale); - wrap.position.set(position.x, position.y, position.z); - wrap.rotation.set(rotation.x, rotation.y, rotation.z, rotation.w); - wrap.scale.set(0.1, 0.1, 0.1); + scene.add(wrap) - console.log("model加载完成") + const position = new THREE.Vector3() + const rotation = new THREE.Quaternion() + const scale = new THREE.Vector3() + this.hintCenter.matrix.decompose(position, rotation, scale) + wrap.position.set(position.x, position.y, position.z) + wrap.rotation.set(rotation.x, rotation.y, rotation.z, rotation.w) + wrap.scale.set(0.1, 0.1, 0.1) - console.log('position', position.x, position.y, position.z); + console.log('model加载完成') + + console.log('position', position.x, position.y, position.z) // console.log('rotation', rotation.x, rotation.y, rotation.z, rotation.w); // boxPlace.box.matrix.FromMatrix4(this.hintCenter.matrix); }) - - } }, changeDepthFlag() { - const depthNear = 0.1; - const depthFar = 20; + const depthNear = 0.1 + const depthFar = 20 this.session.setDepthOccRange(depthNear, depthFar) - this.useDepthBuffer = !this.useDepthBuffer; - this.session.setDepthSwitch(this.useDepthBuffer); + this.useDepthBuffer = !this.useDepthBuffer + this.session.setDepthSwitch(this.useDepthBuffer) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2/behavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2/behavior.js index 54375034..d28996f6 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2/behavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2/behavior.js @@ -102,12 +102,11 @@ export default function getBehavior() { version: 'v2', gl: this.gl, }) - const session = this.session + const session = this.session session.start(err => { - if (err) { this.setData({ - errMsg:'VK error: ' + err + errMsg: 'VK error: ' + err }) return console.error('VK error: ', err) } @@ -151,7 +150,7 @@ export default function getBehavior() { this.setData({ showTip: true }) - setTimeout(()=>{ + setTimeout(() => { this.setData({ showTip: false }) @@ -181,19 +180,19 @@ export default function getBehavior() { const size = anchor.size let object if (anchor.type == 0) { - object = createPlane(size) - this.setData({ - showTip: false - }) + object = createPlane(size) + this.setData({ + showTip: false + }) } else { if (!this.model) { console.warn('this.model 还没加载完成 !!!!!') return } - object = new THREE.Object3D() - const model = this.getRobot() - model.rotateX(-Math.PI / 2) - object.add(model) + object = new THREE.Object3D() + const model = this.getRobot() + model.rotateX(-Math.PI / 2) + object.add(model) } object._id = anchor.id @@ -207,8 +206,8 @@ export default function getBehavior() { temp[item.id] = item return temp }, {}) - const deletePlaneBoxs = []; - const newPlaneBoxs = []; + const deletePlaneBoxs = [] + const newPlaneBoxs = [] this.planeBox.children.forEach(object => { if (object._id && map[object._id]) { const anchor = map[object._id] @@ -218,13 +217,13 @@ export default function getBehavior() { // object = createPlane(size) // this.planeBox.add(object) // 塞入删除队列 - deletePlaneBoxs.push(object); - const newPlane = createPlane(size); + deletePlaneBoxs.push(object) + const newPlane = createPlane(size) newPlane._id = anchor.id newPlane._size = size updateMatrix(newPlane, anchor.transform) // 塞入添加队列 - newPlaneBoxs.push(newPlane); + newPlaneBoxs.push(newPlane) } else { object._id = anchor.id object._size = size @@ -233,12 +232,12 @@ export default function getBehavior() { } }) // 延后删除 - for(let i = 0; i < deletePlaneBoxs.length; i++) { + for (let i = 0; i < deletePlaneBoxs.length; i++) { this.planeBox.remove(deletePlaneBoxs[i]) } // 延后添加 - for(let i = 0; i < newPlaneBoxs.length; i++) { - this.planeBox.add(newPlaneBoxs[i]); + for (let i = 0; i < newPlaneBoxs.length; i++) { + this.planeBox.add(newPlaneBoxs[i]) } }) session.on('removeAnchors', anchors => { @@ -246,16 +245,16 @@ export default function getBehavior() { temp[item.id] = item return temp }, {}) - const deletePlaneBoxs = []; + const deletePlaneBoxs = [] this.planeBox.children.forEach(object => { if (object._id && map[object._id]) { // this.planeBox.remove(object) // 塞入删除队列 - deletePlaneBoxs.push(object); + deletePlaneBoxs.push(object) } }) // 延后删除 - for(let i = 0; i < deletePlaneBoxs.length; i++) { + for (let i = 0; i < deletePlaneBoxs.length; i++) { this.planeBox.remove(deletePlaneBoxs[i]) } }) @@ -264,24 +263,24 @@ export default function getBehavior() { const planeBox = this.planeBox = new THREE.Object3D() this.scene.add(planeBox) - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps let last = Date.now() // 逐帧渲染 const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) } - session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) } session.requestAnimationFrame(onFrame) }) @@ -312,38 +311,38 @@ export default function getBehavior() { renderer.gammaOutput = true renderer.gammaFactor = 2.2 - const geometry = new THREE.BoxGeometry( 1, 1, 1 ); + const geometry = new THREE.BoxGeometry(1, 1, 1) - const scale = 0.1; - const m1 = new THREE.MeshPhysicalMaterial( { + const scale = 0.1 + const m1 = new THREE.MeshPhysicalMaterial({ metalness: 0.0, roughness: 0.1, color: 0xff0000, - } ); - const x = new THREE.Mesh( geometry, m1 ); - x.position.set(1.5 * scale, 0, 0 ); - x.scale.set(3 * scale, 0.1 * scale, 0.1 * scale); - scene.add( x ); + }) + const x = new THREE.Mesh(geometry, m1) + x.position.set(1.5 * scale, 0, 0) + x.scale.set(3 * scale, 0.1 * scale, 0.1 * scale) + scene.add(x) - const m2 = new THREE.MeshPhysicalMaterial( { + const m2 = new THREE.MeshPhysicalMaterial({ metalness: 0.0, roughness: 0.1, color: 0x00ff00, - } ); - const y = new THREE.Mesh( geometry, m2 ); - y.position.set(0, 1.5 * scale, 0 ); - y.scale.set(0.1 * scale, 3 * scale, 0.1 * scale); - scene.add( y ); + }) + const y = new THREE.Mesh(geometry, m2) + y.position.set(0, 1.5 * scale, 0) + y.scale.set(0.1 * scale, 3 * scale, 0.1 * scale) + scene.add(y) - const m3 = new THREE.MeshPhysicalMaterial( { + const m3 = new THREE.MeshPhysicalMaterial({ metalness: 0.0, roughness: 0.1, color: 0x0000ff, - } ); - const z = new THREE.Mesh( geometry, m3 ); - z.position.set(0, 0, 1.5 * scale ); - z.scale.set(0.1 * scale, 0.1 * scale, 3 * scale); - scene.add( z ); + }) + const z = new THREE.Mesh(geometry, m3) + z.position.set(0, 0, 1.5 * scale) + z.scale.set(0.1 * scale, 0.1 * scale, 3 * scale) + scene.add(z) }, updateAnimation() { const dt = this.clock.getDelta() @@ -405,4 +404,4 @@ export default function getBehavior() { } }, }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2/plane-ar-v2.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2/plane-ar-v2.js index cac53daa..0808c873 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2/plane-ar-v2.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2/plane-ar-v2.js @@ -4,90 +4,89 @@ import yuvBehavior from './yuvBehavior' const NEAR = 0.001 const FAR = 1000 -let time = 0; -let countNumber = 20; -let count = 0; +let time = 0 +const countNumber = 20 +let count = 0 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - let start = Date.now() + render(frame) { + const start = Date.now() - this.renderGL(frame) - const camera = frame.camera + this.renderGL(frame) + const camera = frame.camera - // 修改光标位置 - const reticle = this.reticle - if (reticle) { - const hitTestRes = this.session.hitTest(0.5, 0.5) - if (hitTestRes.length) { - reticle.matrixAutoUpdate = false - reticle.matrix.fromArray(hitTestRes[0].transform) - reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) - if(reticle.position.z !=0 ) - reticle.visible = true - } else { - reticle.visible = false - } - } + // 修改光标位置 + const reticle = this.reticle + if (reticle) { + const hitTestRes = this.session.hitTest(0.5, 0.5) + if (hitTestRes.length) { + reticle.matrixAutoUpdate = false + reticle.matrix.fromArray(hitTestRes[0].transform) + reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) + if (reticle.position.z != 0) reticle.visible = true + } else { + reticle.visible = false + } + } - // 更新动画 - this.updateAnimation() + // 更新动画 + this.updateAnimation() - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) - let end = Date.now() + const end = Date.now() - time += end-start - count++ - // if(count >= countNumber){ - // console.log(`${count}次平均耗时统计为${time/count}ms`) - // count = 0 - // time = 0 - // } - }, + time += end - start + count++ + // if(count >= countNumber){ + // console.log(`${count}次平均耗时统计为${time/count}ms`) + // count = 0 + // time = 0 + // } }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar-v2/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar-v2/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar-v2/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar-v2/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/plane-ar/behavior.js b/miniprogram/packageAPI/pages/ar/plane-ar/behavior.js index 6225f46c..9cabf6a9 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar/behavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar/behavior.js @@ -1,253 +1,252 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' import cloneGltf from '../loaders/gltf-clone' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - const THREE = this.THREE - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - const loader = new THREE.GLTFLoader() - loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { - this.model = { - scene: gltf.scene, - animations: gltf.animations, - } - }) - - this.clock = new THREE.Clock() - - loader.load('https://dldir1.qq.com/weixin/miniprogram/reticle_4b6cc19698ca4a08b31fd3c95ce412ec.glb', gltf => { - const reticle = this.reticle = gltf.scene - - reticle.visible = false - this.scene.add(reticle) - }) - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - updateAnimation() { - const dt = this.clock.getDelta() - if (this.mixers) this.mixers.forEach(mixer => mixer.update(dt)) - }, - copyRobot() { - const THREE = this.THREE - const { - scene, - animations - } = cloneGltf(this.model, THREE) - scene.scale.set(0.05, 0.05, 0.05) - - // 动画混合器 - const mixer = new THREE.AnimationMixer(scene) - for (let i = 0; i < animations.length; i++) { - const clip = animations[i] - if (clip.name === 'Dance') { - const action = mixer.clipAction(clip) - action.play() - } - } - - this.mixers = this.mixers || [] - this.mixers.push(mixer) - - scene._mixer = mixer - return scene - }, - getRobot() { - const THREE = this.THREE - - const model = new THREE.Object3D() - model.add(this.copyRobot()) - - this._insertModels = this._insertModels || [] - this._insertModels.push(model) - - if (this._insertModels.length > 5) { - const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) - needRemove.forEach(item => { - if (item._mixer) { - const mixer = item._mixer - this.mixers.splice(this.mixers.indexOf(mixer), 1) - mixer.uncacheRoot(mixer.getRoot()) - } - if (item.parent) item.parent.remove(item) - }) - } - return model + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + const THREE = this.THREE + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onTouchEnd(evt) { - if (this.scene && this.model && this.reticle) { - const model = this.getRobot() - model.position.copy(this.reticle.position) - model.rotation.copy(this.reticle.rotation) - this.scene.add(model) - } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + const loader = new THREE.GLTFLoader() + loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { + this.model = { + scene: gltf.scene, + animations: gltf.animations, + } + }) + + this.clock = new THREE.Clock() + + loader.load('https://dldir1.qq.com/weixin/miniprogram/reticle_4b6cc19698ca4a08b31fd3c95ce412ec.glb', gltf => { + const reticle = this.reticle = gltf.scene + + reticle.visible = false + this.scene.add(reticle) + }) + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + updateAnimation() { + const dt = this.clock.getDelta() + if (this.mixers) this.mixers.forEach(mixer => mixer.update(dt)) + }, + copyRobot() { + const THREE = this.THREE + const { + scene, + animations + } = cloneGltf(this.model, THREE) + scene.scale.set(0.05, 0.05, 0.05) + + // 动画混合器 + const mixer = new THREE.AnimationMixer(scene) + for (let i = 0; i < animations.length; i++) { + const clip = animations[i] + if (clip.name === 'Dance') { + const action = mixer.clipAction(clip) + action.play() + } + } + + this.mixers = this.mixers || [] + this.mixers.push(mixer) + + scene._mixer = mixer + return scene + }, + getRobot() { + const THREE = this.THREE + + const model = new THREE.Object3D() + model.add(this.copyRobot()) + + this._insertModels = this._insertModels || [] + this._insertModels.push(model) + + if (this._insertModels.length > 5) { + const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) + needRemove.forEach(item => { + if (item._mixer) { + const mixer = item._mixer + this.mixers.splice(this.mixers.indexOf(mixer), 1) + mixer.uncacheRoot(mixer.getRoot()) } - }, - }) -} \ No newline at end of file + if (item.parent) item.parent.remove(item) + }) + } + return model + }, + onTouchEnd(evt) { + if (this.scene && this.model && this.reticle) { + const model = this.getRobot() + model.position.copy(this.reticle.position) + model.rotation.copy(this.reticle.rotation) + this.scene.add(model) + } + } + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/plane-ar/plane-ar.js b/miniprogram/packageAPI/pages/ar/plane-ar/plane-ar.js index 8f17665e..baa31187 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar/plane-ar.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar/plane-ar.js @@ -5,73 +5,73 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - this.renderGL(frame) + render(frame) { + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - // 修改光标位置 - const reticle = this.reticle - if (reticle) { - const hitTestRes = this.session.hitTest(0.5, 0.5) - if (hitTestRes.length) { - reticle.matrixAutoUpdate = false - reticle.matrix.fromArray(hitTestRes[0].transform) - reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) - reticle.visible = true - } else { - reticle.visible = false - } - } + // 修改光标位置 + const reticle = this.reticle + if (reticle) { + const hitTestRes = this.session.hitTest(0.5, 0.5) + if (hitTestRes.length) { + reticle.matrixAutoUpdate = false + reticle.matrix.fromArray(hitTestRes[0].transform) + reticle.matrix.decompose(reticle.position, reticle.quaternion, reticle.scale) + reticle.visible = true + } else { + reticle.visible = false + } + } - // 更新动画 - this.updateAnimation() + // 更新动画 + this.updateAnimation() - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/plane-ar/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/plane-ar/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/plane-ar/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/plane-ar/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/shoe-detect/shoe-detect.js b/miniprogram/packageAPI/pages/ar/shoe-detect/shoe-detect.js index dfecff86..f0586668 100644 --- a/miniprogram/packageAPI/pages/ar/shoe-detect/shoe-detect.js +++ b/miniprogram/packageAPI/pages/ar/shoe-detect/shoe-detect.js @@ -5,7 +5,7 @@ import xrFrameBehavior from '../behavior/behavior-xrframe' const NEAR = 0.01 const FAR = 1000 -let loggerOnce = false; +const loggerOnce = false Component({ behaviors: [arBehavior, xrFrameBehavior], @@ -24,14 +24,14 @@ Component({ * 生命周期函数--监听页面加载 */ detached() { - console.log("页面detached") + console.log('页面detached') if (wx.offThemeChange) { wx.offThemeChange() } }, ready() { - console.log("页面准备完全") - const systemInfo = wx.getSystemInfoSync(); + console.log('页面准备完全') + const systemInfo = wx.getSystemInfoSync() this.setData({ theme: systemInfo.theme || 'light', isIOS: systemInfo.platform === 'ios', @@ -53,295 +53,289 @@ Component({ init() { // 初始化VK // start完毕后,进行更新渲染循环 - this.initVK(); + this.initVK() }, initVK() { // VKSession 配置 const session = this.session = wx.createVKSession({ - track: { - shoe: { - mode: 1 - } - }, - cameraPosition: 0, - version: 'v1', - gl: this.gl + track: { + shoe: { + mode: 1 + } + }, + cameraPosition: 0, + version: 'v1', + gl: this.gl }) - try{ - + try { // VKSession start - session.start(err => { - if (err) return console.error('VK error: ', err) + session.start(err => { + if (err) return console.error('VK error: ', err) - console.log('@@@@@@@@ VKSession.version', session.version) + console.log('@@@@@@@@ VKSession.version', session.version) - if (!this.data.showLegMask) { + if (!this.data.showLegMask) { // 初始化设定 - this.session.updateMaskMode({useMask: false}); - } + this.session.updateMaskMode({ useMask: false }) + } - // VKSession EVENT resize - session.on('resize', () => { - this.calcCanvasSize(); - }) + // VKSession EVENT resize + session.on('resize', () => { + this.calcCanvasSize() + }) - // VKSession EVENT addAnchors - session.on('addAnchors', anchors => { + // VKSession EVENT addAnchors + session.on('addAnchors', anchors => { // console.log("addAnchor", anchors) - }) + }) - // VKSession EVENT updateAnchors - session.on('updateAnchors', anchors => { + // VKSession EVENT updateAnchors + session.on('updateAnchors', anchors => { // console.log("updateAnchors") - if (anchors.length === 1) { + if (anchors.length === 1) { // 只有一双的情况下,可以做一个简单的显示性检测,进行非 remove 事件下的隐藏 - const anchorSingle = anchors[0]; - const shoedirecSingle = anchorSingle.shoedirec; + const anchorSingle = anchors[0] + const shoedirecSingle = anchorSingle.shoedirec - if (shoedirecSingle === 0) { + if (shoedirecSingle === 0) { // 只有左脚,此时尝试隐藏右脚 - if (this.modelShowRight && this.modelTrsRight) { + if (this.modelShowRight && this.modelTrsRight) { // 右脚 - this.scaleTrs(this.modelTrsRight, 0, 0, 0); - this.updateHintBoxVisible(this.hintBoxListRight, false); - this.modelShowRight = false; - } - } else if (shoedirecSingle === 1) { + this.scaleTrs(this.modelTrsRight, 0, 0, 0) + this.updateHintBoxVisible(this.hintBoxListRight, false) + this.modelShowRight = false + } + } else if (shoedirecSingle === 1) { // 只有右脚,此时尝试隐藏左脚 - if (this.modelShowLeft && this.modelTrsLeft) { + if (this.modelShowLeft && this.modelTrsLeft) { // 左脚 - this.scaleTrs(this.modelTrsLeft, 0, 0, 0); - this.updateHintBoxVisible(this.hintBoxListLeft, false); - this.modelShowLeft = false; + this.scaleTrs(this.modelTrsLeft, 0, 0, 0) + this.updateHintBoxVisible(this.hintBoxListLeft, false) + this.modelShowLeft = false + } } } - } - - for (let i = 0; i < anchors.length; i++ ) { - const anchor = anchors[i]; - // console.log('transform', anchor.transform); - // console.log('points3d', anchor.points3d); - let modelScale = 1; + for (let i = 0; i < anchors.length; i++) { + const anchor = anchors[i] + // console.log('transform', anchor.transform); + // console.log('points3d', anchor.points3d); + const modelScale = 1 - if (anchor.shoedirec === 0) { + if (anchor.shoedirec === 0) { // 左脚 - this.shoeTransformLeft = anchor.transform; - this.points3dLeft = anchor.points3d; + this.shoeTransformLeft = anchor.transform + this.points3dLeft = anchor.points3d - if (!this.modelShowLeft && this.modelTrsLeft) { - this.scaleTrs(this.modelTrsLeft, modelScale, modelScale, modelScale); - this.updateHintBoxVisible(this.hintBoxListLeft, true); - this.modelShowLeft = true; - } - } else if (anchor.shoedirec === 1) { + if (!this.modelShowLeft && this.modelTrsLeft) { + this.scaleTrs(this.modelTrsLeft, modelScale, modelScale, modelScale) + this.updateHintBoxVisible(this.hintBoxListLeft, true) + this.modelShowLeft = true + } + } else if (anchor.shoedirec === 1) { // 右脚 - this.shoeTransformRight = anchor.transform; - this.points3dRight = anchor.points3d; + this.shoeTransformRight = anchor.transform + this.points3dRight = anchor.points3d - if (!this.modelShowRight && this.modelTrsRight) { - this.scaleTrs(this.modelTrsRight, modelScale, modelScale, modelScale); - this.updateHintBoxVisible(this.hintBoxListRight, true); - this.modelShowRight = true; + if (!this.modelShowRight && this.modelTrsRight) { + this.scaleTrs(this.modelTrsRight, modelScale, modelScale, modelScale) + this.updateHintBoxVisible(this.hintBoxListRight, true) + this.modelShowRight = true + } } } + }) - } - - }) - - // VKSession removeAnchors - // 识别目标丢失时,会不断触发 - session.on('removeAnchors', anchors => { + // VKSession removeAnchors + // 识别目标丢失时,会不断触发 + session.on('removeAnchors', anchors => { // console.log("removeAnchors") - // Hide - if (this.modelShowLeft && this.modelTrsLeft) { + // Hide + if (this.modelShowLeft && this.modelTrsLeft) { // 左脚 - this.scaleTrs(this.modelTrsLeft, 0); - this.updateHintBoxVisible(this.hintBoxListLeft, false); - this.modelShowLeft = false; - } - if (this.modelShowRight && this.modelTrsRight) { + this.scaleTrs(this.modelTrsLeft, 0) + this.updateHintBoxVisible(this.hintBoxListLeft, false) + this.modelShowLeft = false + } + if (this.modelShowRight && this.modelTrsRight) { // 右脚 - this.scaleTrs(this.modelTrsRight, 0); - this.updateHintBoxVisible(this.hintBoxListRight, false); - this.modelShowRight = false; - } - }) - - console.log('ready to initloop') - // start 初始化完毕后,进行更新渲染循环 - this.initLoop(); - }); + this.scaleTrs(this.modelTrsRight, 0) + this.updateHintBoxVisible(this.hintBoxListRight, false) + this.modelShowRight = false + } + }) - } catch(e) { - console.error(e); + console.log('ready to initloop') + // start 初始化完毕后,进行更新渲染循环 + this.initLoop() + }) + } catch (e) { + console.error(e) } }, // 针对 xr-frame 的初始化逻辑 async initXRFrame() { - const xrFrameSystem = wx.getXrFrameSystem(); - const scene = this.xrScene; - const {rootShadow} = scene; - + const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.xrScene + const { rootShadow } = scene + // 缓存主相机 this.xrCameraMain = this.xrCamera - this.xrCameraMainTrs = this.xrCameraTrs; + this.xrCameraMainTrs = this.xrCameraTrs // 试鞋案例,使用rt相机作为xrCamera - const xrCameraEl = scene.getElementById('rtCamera'); - this.xrCamera = xrCameraEl.getComponent(xrFrameSystem.Camera); - this.xrCameraTrs = xrCameraEl.getComponent(xrFrameSystem.Transform); - + const xrCameraEl = scene.getElementById('rtCamera') + this.xrCamera = xrCameraEl.getComponent(xrFrameSystem.Camera) + this.xrCameraTrs = xrCameraEl.getComponent(xrFrameSystem.Transform) + // 初始化YUV相机配置 - this.initXRYUVCamera(); + this.initXRYUVCamera() // 初始化ShoeMask平面,会用绘制RT中物体 - this.addShoeMaskPlane(); + this.addShoeMaskPlane() // 左右鞋子分别处理 - const shoeFrontFix = 0.2; // 额外前移,适配鞋后 - const shoeBottomFix = -0.4; // 额外下移,适配鞋底 + const shoeFrontFix = 0.2 // 额外前移,适配鞋后 + const shoeBottomFix = -0.4 // 额外下移,适配鞋底 // const shoeFrontFix = 0; // const shoeBottomFix = 0; - const shoeScaleFactorX = 1.1; // 针对窄鞋缩放,优化效果 + const shoeScaleFactorX = 1.1 // 针对窄鞋缩放,优化效果 // 模型缩放 - let modelScale = 220; + let modelScale = 220 // 针对 3.2.1 版本基础库,iOS 试鞋,返回的投影矩阵,进行的兼容修复 if (!this.data.isIOS) { - modelScale *= 1.2; + modelScale *= 1.2 } // 遮挡模型 - const occGeometry = scene.assets.getAsset('geometry', 'cylinder'); - const occEffect = scene.assets.getAsset('effect', 'standard'); + const occGeometry = scene.assets.getAsset('geometry', 'cylinder') + const occEffect = scene.assets.getAsset('effect', 'standard') // === 左边鞋子流程 === // 初始化挂载点 - this.modelWrapLeft = scene.createElement(xrFrameSystem.XRNode); - this.modelWrapTrsLeft = this.modelWrapLeft.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( this.modelWrapLeft ); + this.modelWrapLeft = scene.createElement(xrFrameSystem.XRNode) + this.modelWrapTrsLeft = this.modelWrapLeft.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(this.modelWrapLeft) - console.log('modelWrapLeft ready'); + console.log('modelWrapLeft ready') // 点挂载 const modelPointLeft = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", - scale: "0 0 0", - }); - this.modelTrsLeft = modelPointLeft.getComponent(xrFrameSystem.Transform); - this.modelShowLeft = false; - this.modelWrapLeft.addChild(modelPointLeft); + position: '0 0 0', + scale: '0 0 0', + }) + this.modelTrsLeft = modelPointLeft.getComponent(xrFrameSystem.Transform) + this.modelShowLeft = false + this.modelWrapLeft.addChild(modelPointLeft) // 加载鞋子模型 const shoeModelLeft = await scene.assets.loadAsset({ type: 'gltf', - assetId: `gltf-shoe-left`, + assetId: 'gltf-shoe-left', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/shoe-1-left.glb', }) - console.log('shoeModelLeft', shoeModelLeft.value); + console.log('shoeModelLeft', shoeModelLeft.value) const elLeft = scene.createElement(xrFrameSystem.XRGLTF, { - model: "gltf-shoe-left", + model: 'gltf-shoe-left', position: `0 ${shoeBottomFix} ${shoeFrontFix}`, scale: `${modelScale * shoeScaleFactorX} ${modelScale} ${modelScale}`, layer: 2 - }); - this.modelLeft = elLeft; + }) + this.modelLeft = elLeft // this.modelTrsLeft = elLeft.getComponent(xrFrameSystem.Transform); // this.modelShowLeft = false; // this.modelWrapLeft.addChild(elLeft); - modelPointLeft.addChild(elLeft); + modelPointLeft.addChild(elLeft) // 遮挡模型 const occlusionLeft = scene.createElement(xrFrameSystem.XRNode, { - position: "0.1 3.5 -2.3", - rotation: "-20 0 0", - scale: "1.5 2 1.6", + position: '0.1 3.5 -2.3', + rotation: '-20 0 0', + scale: '1.5 2 1.6', layer: 2 - }); - const occMatLeft = scene.createMaterial(occEffect); + }) + const occMatLeft = scene.createMaterial(occEffect) // 遮挡渲染状态 - occMatLeft.renderQueue = 1; - occMatLeft.alphaMode = 'BLEND'; - occMatLeft.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, 1.0, 1.0, 0.0)); + occMatLeft.renderQueue = 1 + occMatLeft.alphaMode = 'BLEND' + occMatLeft.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, 1.0, 1.0, 0.0)) const occMeshLeft = occlusionLeft.addComponent(xrFrameSystem.Mesh, { geometry: occGeometry, material: occMatLeft, - }); - modelPointLeft.addChild(occlusionLeft); + }) + modelPointLeft.addChild(occlusionLeft) // left done - console.log('this.modelTrsLeft', this.modelTrsLeft); - console.log('shoeModelLeft ready'); + console.log('this.modelTrsLeft', this.modelTrsLeft) + console.log('shoeModelLeft ready') // 加载提示点 - this.hintBoxListLeft = this.getHintBox(xrFrameSystem, scene, this.modelWrapLeft); + this.hintBoxListLeft = this.getHintBox(xrFrameSystem, scene, this.modelWrapLeft) // === 右边鞋子流程 === // 初始化挂载点 - this.modelWrapRight = scene.createElement(xrFrameSystem.XRNode); - this.modelWrapTrsRight = this.modelWrapRight.getComponent(xrFrameSystem.Transform); - rootShadow.addChild( this.modelWrapRight ); + this.modelWrapRight = scene.createElement(xrFrameSystem.XRNode) + this.modelWrapTrsRight = this.modelWrapRight.getComponent(xrFrameSystem.Transform) + rootShadow.addChild(this.modelWrapRight) - console.log('modelWrapRight ready'); + console.log('modelWrapRight ready') // 点挂载 const modelPointRight = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", - scale: "0 0 0", - }); - this.modelTrsRight = modelPointRight.getComponent(xrFrameSystem.Transform); - this.modelShowRight = false; - this.modelWrapRight.addChild(modelPointRight); + position: '0 0 0', + scale: '0 0 0', + }) + this.modelTrsRight = modelPointRight.getComponent(xrFrameSystem.Transform) + this.modelShowRight = false + this.modelWrapRight.addChild(modelPointRight) // 加载鞋子模型 const shoeModelRight = await scene.assets.loadAsset({ type: 'gltf', - assetId: `gltf-shoe-right`, + assetId: 'gltf-shoe-right', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/shoe-1-right.glb', }) - console.log('shoeModelRight', shoeModelRight.value); + console.log('shoeModelRight', shoeModelRight.value) const elRight = scene.createElement(xrFrameSystem.XRGLTF, { - model: "gltf-shoe-right", + model: 'gltf-shoe-right', position: `0 ${shoeBottomFix} ${shoeFrontFix}`, scale: `${modelScale * shoeScaleFactorX} ${modelScale} ${modelScale}`, layer: 2 - }); - this.modelRight = elRight; + }) + this.modelRight = elRight // this.modelTrsRight = elRight.getComponent(xrFrameSystem.Transform); // this.modelShowRight = false; // this.modelWrapRight.addChild(elRight); - modelPointRight.addChild(elRight); + modelPointRight.addChild(elRight) // 遮挡模型 const occlusionRight = scene.createElement(xrFrameSystem.XRNode, { - position: "0.1 3.5 -2.3", - rotation: "-20 0 0", - scale: "1.5 2 1.6", + position: '0.1 3.5 -2.3', + rotation: '-20 0 0', + scale: '1.5 2 1.6', layer: 2 - }); - const occMatRight = scene.createMaterial(occEffect); + }) + const occMatRight = scene.createMaterial(occEffect) // 遮挡渲染状态 - occMatRight.renderQueue = 1; - occMatRight.alphaMode = 'BLEND'; - occMatRight.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, 1.0, 1.0, 0.0)); + occMatRight.renderQueue = 1 + occMatRight.alphaMode = 'BLEND' + occMatRight.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(1.0, 1.0, 1.0, 0.0)) const occMeshRight = occlusionRight.addComponent(xrFrameSystem.Mesh, { geometry: occGeometry, material: occMatRight, - }); - modelPointRight.addChild(occlusionRight); + }) + modelPointRight.addChild(occlusionRight) // right done - console.log('this.modelTrsRight', this.modelTrsRight); - console.log('shoeModelRight ready'); + console.log('this.modelTrsRight', this.modelTrsRight) + console.log('shoeModelRight ready') // 加载提示点 - this.hintBoxListRight = this.getHintBox(xrFrameSystem, scene, this.modelWrapRight); - + this.hintBoxListRight = this.getHintBox(xrFrameSystem, scene, this.modelWrapRight) }, loop() { // console.log('loop') @@ -349,113 +343,111 @@ Component({ const frame = this.session.getVKFrame(this.data.domWidth, this.data.domHeight) // 成功获取 VKFrame 才进行 - if(!frame) { return; } + if (!frame) { return } // 更新腿部分割纹理 if (this.data.showLegMask) { - this.updateShoeMask(frame) + this.updateShoeMask(frame) // console.log(getLegSegmentBuffer); } // 更新相机 YUV 数据 - this.updataXRYUV(frame); + this.updataXRYUV(frame) // 获取 VKCamera const VKCamera = frame.camera // 更新 xrFrame 相机矩阵 - this.updataXRCameraMatrix(VKCamera, NEAR, FAR); - + this.updataXRCameraMatrix(VKCamera, NEAR, FAR) + // 存在model,更新矩阵 // 左边鞋子流程 if (this.modelWrapLeft && this.modelTrsLeft && this.points3dLeft && this.shoeTransformLeft) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(this.shoeTransformLeft); - this.DT.transpose(this.DT2); - this.modelWrapTrsLeft.setLocalMatrix(this.DT2); + this.DT.setArray(this.shoeTransformLeft) + this.DT.transpose(this.DT2) + this.modelWrapTrsLeft.setLocalMatrix(this.DT2) // 放置鞋子 - this.modelTrsLeft.position.x = (this.points3dLeft[3].x + this.points3dLeft[4].x ) / 2; - this.modelTrsLeft.position.y = (this.points3dLeft[3].y + this.points3dLeft[4].y ) / 2; - this.modelTrsLeft.position.z = (this.points3dLeft[0].z + this.points3dLeft[1].z ) / 2; - - - this.updateHintBoxPosition(this.hintBoxListLeft, this.points3dLeft); + this.modelTrsLeft.position.x = (this.points3dLeft[3].x + this.points3dLeft[4].x) / 2 + this.modelTrsLeft.position.y = (this.points3dLeft[3].y + this.points3dLeft[4].y) / 2 + this.modelTrsLeft.position.z = (this.points3dLeft[0].z + this.points3dLeft[1].z) / 2 + this.updateHintBoxPosition(this.hintBoxListLeft, this.points3dLeft) } // 右边鞋子流程 if (this.modelWrapRight && this.modelTrsRight && this.points3dRight && this.shoeTransformRight) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() - if (!this.DT) { this.DT = new xrFrameSystem.Matrix4(); } - if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4(); } + if (!this.DT) { this.DT = new xrFrameSystem.Matrix4() } + if (!this.DT2) { this.DT2 = new xrFrameSystem.Matrix4() } // 目前VK返回的是行主序矩阵 // xrframe 矩阵存储为列主序 - this.DT.setArray(this.shoeTransformRight); - this.DT.transpose(this.DT2); - this.modelWrapTrsRight.setLocalMatrix(this.DT2); + this.DT.setArray(this.shoeTransformRight) + this.DT.transpose(this.DT2) + this.modelWrapTrsRight.setLocalMatrix(this.DT2) // 放置鞋子 - this.modelTrsRight.position.x = (this.points3dRight[3].x + this.points3dRight[4].x ) / 2; - this.modelTrsRight.position.y = (this.points3dRight[3].y + this.points3dRight[4].y ) / 2; - this.modelTrsRight.position.z = (this.points3dRight[0].z + this.points3dRight[1].z ) / 2; + this.modelTrsRight.position.x = (this.points3dRight[3].x + this.points3dRight[4].x) / 2 + this.modelTrsRight.position.y = (this.points3dRight[3].y + this.points3dRight[4].y) / 2 + this.modelTrsRight.position.z = (this.points3dRight[0].z + this.points3dRight[1].z) / 2 - this.updateHintBoxPosition(this.hintBoxListRight, this.points3dRight); + this.updateHintBoxPosition(this.hintBoxListRight, this.points3dRight) } }, // 缩放 xr-frame TRS scaleTrs(trs, scaleX, scaleY, scaleZ) { - trs.scale.x = scaleX; - trs.scale.y = scaleY; - trs.scale.z = scaleZ; + trs.scale.x = scaleX + trs.scale.y = scaleY + trs.scale.z = scaleZ }, getHintBox(xrFrameSystem, scene, wrap) { // 初始化提示点 - const geometryCube = scene.assets.getAsset('geometry', 'cube'); - const effectCube = scene.assets.getAsset('effect', 'standard'); - const boxScale = 0.2; - const hintBoxList = []; + const geometryCube = scene.assets.getAsset('geometry', 'cube') + const effectCube = scene.assets.getAsset('effect', 'standard') + const boxScale = 0.2 + const hintBoxList = [] for (let i = 0; i < 8; i++) { - const colorFloat = i / 16; + const colorFloat = i / 16 const el = scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", + position: '0 0 0', scale: `${boxScale} ${boxScale} ${boxScale}`, layer: 2 - }); - const elTrs = el.getComponent(xrFrameSystem.Transform); - const mat = scene.createMaterial(effectCube); - mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(colorFloat + 0.3, 0.2, 0.2, 1.0)); - mat.renderQueue = 9990; - mat.setRenderState('depthTestOn', false); + }) + const elTrs = el.getComponent(xrFrameSystem.Transform) + const mat = scene.createMaterial(effectCube) + mat.setVector('u_baseColorFactor', xrFrameSystem.Vector4.createFromNumber(colorFloat + 0.3, 0.2, 0.2, 1.0)) + mat.renderQueue = 9990 + mat.setRenderState('depthTestOn', false) const mesh = el.addComponent(xrFrameSystem.Mesh, { geometry: geometryCube, material: mat, - }); + }) + + wrap.addChild(el) + elTrs.visible = false - wrap.addChild( el ); - elTrs.visible = false; - - hintBoxList.push( elTrs ); + hintBoxList.push(elTrs) } - return hintBoxList; + return hintBoxList }, updateHintBoxVisible(hintBoxList, visible) { if (hintBoxList && hintBoxList.length > 0) { // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; - const visibleFlag = this.data.showHintBox && visible; + const hintBox = hintBoxList[i] + const visibleFlag = this.data.showHintBox && visible if (hintBox.visible !== visibleFlag) { - hintBox.visible = visibleFlag; + hintBox.visible = visibleFlag } } } @@ -465,26 +457,25 @@ Component({ // console.log('ready to set', hintBoxList); // 存在提示列表,则更新点信息 for (let i = 0; i < hintBoxList.length; i++) { - const hintBox = hintBoxList[i]; - hintBox.position.x = points3d[i].x; - hintBox.position.y = points3d[i].y; - hintBox.position.z = points3d[i].z; + const hintBox = hintBoxList[i] + hintBox.position.x = points3d[i].x + hintBox.position.y = points3d[i].y + hintBox.position.z = points3d[i].z } } }, addShoeMaskPlane() { - const scene = this.xrScene; - const {rootShadow} = scene; + const scene = this.xrScene + const { rootShadow } = scene - const xrFrameSystem = wx.getXrFrameSystem(); - + const xrFrameSystem = wx.getXrFrameSystem() const el = scene.createElement(xrFrameSystem.XRNode, { layer: 1 - }); + }) - const shoeMaskGeometry = scene.assets.getAsset('geometry', `ar-camera-plane`); - let shoeMaskEffect = scene.assets.getAsset('effect', 'ar-shoe-mask'); + const shoeMaskGeometry = scene.assets.getAsset('geometry', 'ar-camera-plane') + let shoeMaskEffect = scene.assets.getAsset('effect', 'ar-shoe-mask') if (!shoeMaskEffect) { xrFrameSystem.registerEffect('ar-shoe-mask', scene => scene.createEffect({ @@ -492,31 +483,31 @@ Component({ { key: 'u_baseColorFactor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 1, 1, 1] }, ], images: [ - { - key: 'u_shoeMask', - default: 'black', - macro: 'WX_AR_SHOEMASk' - }, - { - key: 'u_renderTexture', - default: 'black', - macro: 'WX_AR_RENDERTEXTURE' + { + key: 'u_shoeMask', + default: 'black', + macro: 'WX_AR_SHOEMASk' + }, + { + key: 'u_renderTexture', + default: 'black', + macro: 'WX_AR_RENDERTEXTURE' }, ], - defaultRenderQueue: 2, - passes: [{ - renderStates: { - blendOn: true, - depthWrite: false, - // Default FrontFace is CW - cullOn: true, - cullFace: xrFrameSystem.ECullMode.BACK, - }, - lightMode: 'ForwardBase', - useMaterialRenderStates: true, - shaders: [0, 1] - }], - shaders: + defaultRenderQueue: 2, + passes: [{ + renderStates: { + blendOn: true, + depthWrite: false, + // Default FrontFace is CW + cullOn: true, + cullFace: xrFrameSystem.ECullMode.BACK, + }, + lightMode: 'ForwardBase', + useMaterialRenderStates: true, + shaders: [0, 1] + }], + shaders: [ `#version 100 attribute vec3 a_position; @@ -565,44 +556,44 @@ Component({ ` ] })) - shoeMaskEffect = scene.assets.getAsset('effect', 'ar-shoe-mask'); + shoeMaskEffect = scene.assets.getAsset('effect', 'ar-shoe-mask') } - const shoeMaskMat = scene.createMaterial(shoeMaskEffect); + const shoeMaskMat = scene.createMaterial(shoeMaskEffect) // 获取屏幕renderTexture - this.renderTexture = scene.assets.getAsset('render-texture', 'rt'); - shoeMaskMat.setTexture('u_renderTexture', this.renderTexture.texture); + this.renderTexture = scene.assets.getAsset('render-texture', 'rt') + shoeMaskMat.setTexture('u_renderTexture', this.renderTexture.texture) - shoeMaskMat.renderQueue = 2; // 第二个绘制 + shoeMaskMat.renderQueue = 2 // 第二个绘制 const mesh = el.addComponent(xrFrameSystem.Mesh, { geometry: shoeMaskGeometry, material: shoeMaskMat - }); + }) // ShoeMask纹理 - this.shoeMaskMat = shoeMaskMat; - this.shoeMaskMatInit = false; + this.shoeMaskMat = shoeMaskMat + this.shoeMaskMatInit = false // 不进入正常的剔除 - rootShadow.addChild(el); - + rootShadow.addChild(el) }, updateShoeMask(frame) { - const scene = this.xrScene; - const xrFrameSystem = wx.getXrFrameSystem(); + const scene = this.xrScene + const xrFrameSystem = wx.getXrFrameSystem() // 腿部分割 - const legSegmentBuffer = frame.getLegSegmentBuffer(); + const legSegmentBuffer = frame.getLegSegmentBuffer() // 存在数据才进行rt初始化 if (legSegmentBuffer && legSegmentBuffer.width > 0 && legSegmentBuffer.height > 0) { // 存在数据,开启宏 - this.shoeMaskMat.setMacro("WX_USE_SHOEMASK", true); + this.shoeMaskMat.setMacro('WX_USE_SHOEMASK', true) - // 未创建贴图缓存,先创建 + // 未创建贴图缓存,先创建 if (!this.shoeMaskTexure) { this.shoeMaskTexure = scene.createTexture({ - width: legSegmentBuffer.width, height: legSegmentBuffer.height, + width: legSegmentBuffer.width, + height: legSegmentBuffer.height, source: [legSegmentBuffer.MaskAddress], magFilter: xrFrameSystem.EFilterMode.LINEAR, minFilter: xrFrameSystem.EFilterMode.LINEAR, @@ -610,56 +601,56 @@ Component({ }) } - const shoeMaskMat = this.shoeMaskMat; + const shoeMaskMat = this.shoeMaskMat // 未绑定贴图的情况下,绑定贴图 if (!this.shoeMaskMatInit) { - shoeMaskMat.setTexture('u_shoeMask', this.shoeMaskTexure); - this.shoeMaskMatInit = true; + shoeMaskMat.setTexture('u_shoeMask', this.shoeMaskTexure) + this.shoeMaskMatInit = true } - this.shoeMaskTexure.update({buffer: legSegmentBuffer.MaskAddress}); + this.shoeMaskTexure.update({ buffer: legSegmentBuffer.MaskAddress }) } else { console.error('getLegSegmentBuffer is empty', legSegmentBuffer, legSegmentBuffer.width, legSegmentBuffer.height) } }, // 点击腿Mask切换 onTapMask() { - const maskFlag = !this.data.showLegMask; + const maskFlag = !this.data.showLegMask if (this.session && this.session.updateMaskMode) { // 开启关闭 shoeMask - this.session.updateMaskMode({useMask: maskFlag}); + this.session.updateMaskMode({ useMask: maskFlag }) if (!maskFlag) { - this.shoeMaskMat.setMacro("WX_USE_SHOEMASK", false); + this.shoeMaskMat.setMacro('WX_USE_SHOEMASK', false) } this.setData({ showLegMask: maskFlag }) } else { - console.error("请初始化vk后,再点击切换按钮") + console.error('请初始化vk后,再点击切换按钮') } }, - // 点击提示点切换 - onTapHint() { - const hintFlag = !this.data.showHintBox; + // 点击提示点切换 + onTapHint() { + const hintFlag = !this.data.showHintBox this.setData({ showHintBox: hintFlag }) // nextTick 保证 setData - setTimeout(()=>{ + setTimeout(() => { if (this.modelShowLeft && this.modelTrsLeft) { // 左脚 - this.updateHintBoxVisible(this.hintBoxListLeft, hintFlag); + this.updateHintBoxVisible(this.hintBoxListLeft, hintFlag) } if (this.modelShowRight && this.modelTrsRight) { // 右脚 - this.updateHintBoxVisible(this.hintBoxListRight, hintFlag); + this.updateHintBoxVisible(this.hintBoxListRight, hintFlag) } - }, 33); + }, 33) }, }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/behavior.js b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/behavior.js index 5727b637..e2e3eb19 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/behavior.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/behavior.js @@ -1,252 +1,252 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' import cloneGltf from '../loaders/gltf-clone' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - const THREE = this.THREE - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 1 - }, - }, - version: 'v2', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - const loader = new THREE.GLTFLoader() - loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { - this.model = { - scene: gltf.scene, - animations: gltf.animations, - } - }) - - this.clock = new THREE.Clock() - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - - copyRobot() { - const THREE = this.THREE - const { - scene, - animations - } = cloneGltf(this.model, THREE) - scene.scale.set(0.05, 0.05, 0.05) - - // 动画混合器 - const mixer = new THREE.AnimationMixer(scene) - for (let i = 0; i < animations.length; i++) { - const clip = animations[i] - if (clip.name === 'Dance') { - const action = mixer.clipAction(clip) - action.play() - } - } - - this.mixers = this.mixers || [] - this.mixers.push(mixer) - - scene._mixer = mixer - return scene - }, - getRobot() { - const THREE = this.THREE - - const model = new THREE.Object3D() - model.add(this.copyRobot()) - - this._insertModels = this._insertModels || [] - this._insertModels.push(model) - - if (this._insertModels.length > 5) { - const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) - needRemove.forEach(item => { - if (item._mixer) { - const mixer = item._mixer - this.mixers.splice(this.mixers.indexOf(mixer), 1) - mixer.uncacheRoot(mixer.getRoot()) - } - if (item.parent) item.parent.remove(item) - }) - } - - return model + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + const THREE = this.THREE + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 1 }, - onTouchEnd(evt) { - // 点击位置放一个机器人 - const touches = evt.changedTouches.length ? evt.changedTouches : evt.touches - if (touches.length === 1) { - const touch = touches[0] - if (this.session && this.scene && this.model) { - const hitTestRes = this.session.hitTest(touch.x / this.data.width, touch.y / this.data.height, this.resetPanel) - this.resetPanel = false - if (hitTestRes.length) { - const model = this.getRobot() - model.matrixAutoUpdate = false - model.matrix.fromArray(hitTestRes[0].transform) - this.scene.add(model) - } - } - } + }, + version: 'v2', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + const loader = new THREE.GLTFLoader() + loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { + this.model = { + scene: gltf.scene, + animations: gltf.animations, + } + }) + + this.clock = new THREE.Clock() + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + + copyRobot() { + const THREE = this.THREE + const { + scene, + animations + } = cloneGltf(this.model, THREE) + scene.scale.set(0.05, 0.05, 0.05) + + // 动画混合器 + const mixer = new THREE.AnimationMixer(scene) + for (let i = 0; i < animations.length; i++) { + const clip = animations[i] + if (clip.name === 'Dance') { + const action = mixer.clipAction(clip) + action.play() + } + } + + this.mixers = this.mixers || [] + this.mixers.push(mixer) + + scene._mixer = mixer + return scene + }, + getRobot() { + const THREE = this.THREE + + const model = new THREE.Object3D() + model.add(this.copyRobot()) + + this._insertModels = this._insertModels || [] + this._insertModels.push(model) + + if (this._insertModels.length > 5) { + const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) + needRemove.forEach(item => { + if (item._mixer) { + const mixer = item._mixer + this.mixers.splice(this.mixers.indexOf(mixer), 1) + mixer.uncacheRoot(mixer.getRoot()) + } + if (item.parent) item.parent.remove(item) + }) + } + + return model + }, + onTouchEnd(evt) { + // 点击位置放一个机器人 + const touches = evt.changedTouches.length ? evt.changedTouches : evt.touches + if (touches.length === 1) { + const touch = touches[0] + if (this.session && this.scene && this.model) { + const hitTestRes = this.session.hitTest(touch.x / this.data.width, touch.y / this.data.height, this.resetPanel) + this.resetPanel = false + if (hitTestRes.length) { + const model = this.getRobot() + model.matrixAutoUpdate = false + model.matrix.fromArray(hitTestRes[0].transform) + this.scene.add(model) } - }, - }) -} \ No newline at end of file + } + } + } + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/visionkit-basic-v2.js b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/visionkit-basic-v2.js index 8029a4fe..95ce730c 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/visionkit-basic-v2.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/visionkit-basic-v2.js @@ -5,61 +5,61 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - this.renderGL(frame) + render(frame) { + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - const dt = this.clock.getDelta() - if (this.mixers) { - this.mixers.forEach(mixer => mixer.update(dt)) - } + const dt = this.clock.getDelta() + if (this.mixers) { + this.mixers.forEach(mixer => mixer.update(dt)) + } - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic-v2/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic/behavior.js b/miniprogram/packageAPI/pages/ar/visionkit-basic/behavior.js index d2f0ea1d..a39b11b6 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic/behavior.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic/behavior.js @@ -1,253 +1,252 @@ import { - createScopedThreejs + createScopedThreejs } from './threejs-miniprogram' import { - registerGLTFLoader + registerGLTFLoader } from '../loaders/gltf-loader' import cloneGltf from '../loaders/gltf-clone' const info = wx.getSystemInfoSync() export default function getBehavior() { - return Behavior({ - data: { - width: 1, - height: 1, - fps: 0, - memory: 0, - cpu: 0, - }, - methods: { - onReady() { - wx.createSelectorQuery() - .select('#webgl') - .node() - .exec(res => { - this.canvas = res[0].node - - const info = wx.getSystemInfoSync() - const pixelRatio = info.pixelRatio - const calcSize = (width, height) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - calcSize(info.windowWidth, info.windowHeight * 0.8) - - this.initVK() - }) - }, - onUnload() { - if (this._texture) { - this._texture.dispose() - this._texture = null - } - if (this.renderer) { - this.renderer.dispose() - this.renderer = null - } - if (this.scene) { - this.scene.dispose() - this.scene = null - } - if (this.camera) this.camera = null - if (this.model) this.model = null - if (this._insertModel) this._insertModel = null - if (this._insertModels) this._insertModels = null - if (this.planeBox) this.planeBox = null - if (this.mixers) { - this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) - this.mixers = null - } - if (this.clock) this.clock = null - - if (this.THREE) this.THREE = null - if (this._tempTexture && this._tempTexture.gl) { - this._tempTexture.gl.deleteTexture(this._tempTexture) - this._tempTexture = null - } - if (this._fb && this._fb.gl) { - this._fb.gl.deleteFramebuffer(this._fb) - this._fb = null - } - if (this._program && this._program.gl) { - this._program.gl.deleteProgram(this._program) - this._program = null - } - if (this.canvas) this.canvas = null - if (this.gl) this.gl = null - if (this.session) this.session = null - if (this.anchor2DList) this.anchor2DList = [] - }, - initVK() { - // 初始化 threejs - this.initTHREE() - const THREE = this.THREE - - // 自定义初始化 - if (this.init) this.init() - - console.log('this.gl', this.gl) - - const session = this.session = wx.createVKSession({ - track: { - plane: { - mode: 3 - }, - }, - version: 'v1', - gl: this.gl - }) - session.start(err => { - if (err) return console.error('VK error: ', err) - - console.log('@@@@@@@@ VKSession.version', session.version) - - const canvas = this.canvas - - const calcSize = (width, height, pixelRatio) => { - console.log(`canvas size: width = ${width} , height = ${height}`) - this.canvas.width = width * pixelRatio - this.canvas.height = height * pixelRatio - this.setData({ - width, - height, - }) - } - - session.on('resize', () => { - const info = wx.getSystemInfoSync() - calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) - }) - - const loader = new THREE.GLTFLoader() - loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { - this.model = { - scene: gltf.scene, - animations: gltf.animations, - } - }) - - this.clock = new THREE.Clock() - - - //限制调用帧率 - let fps = 30 - let fpsInterval = 1000 / fps - let last = Date.now() - - // 逐帧渲染 - const onFrame = timestamp => { - let now = Date.now() - const mill = now - last - // 经过了足够的时间 - if (mill > fpsInterval) { - last = now - (mill % fpsInterval); //校正当前时间 - const frame = session.getVKFrame(canvas.width, canvas.height) - if (frame) { - this.render(frame) - } - } - session.requestAnimationFrame(onFrame) - } - session.requestAnimationFrame(onFrame) - }) - }, - initTHREE() { - const THREE = this.THREE = createScopedThreejs(this.canvas) - registerGLTFLoader(THREE) - - // 相机 - this.camera = new THREE.Camera() - - // 场景 - const scene = this.scene = new THREE.Scene() - - // 光源 - const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 - light1.position.set(0, 0.2, 0) - scene.add(light1) - const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 - light2.position.set(0, 0.2, 0.1) - scene.add(light2) - - // 渲染层 - const renderer = this.renderer = new THREE.WebGLRenderer({ - antialias: true, - alpha: true - }) - renderer.gammaOutput = true - renderer.gammaFactor = 2.2 - }, - - copyRobot() { - const THREE = this.THREE - const { - scene, - animations - } = cloneGltf(this.model, THREE) - scene.scale.set(0.05, 0.05, 0.05) - - // 动画混合器 - const mixer = new THREE.AnimationMixer(scene) - for (let i = 0; i < animations.length; i++) { - const clip = animations[i] - if (clip.name === 'Dance') { - const action = mixer.clipAction(clip) - action.play() - } - } - - this.mixers = this.mixers || [] - this.mixers.push(mixer) - - scene._mixer = mixer - return scene - }, - getRobot() { - const THREE = this.THREE - - const model = new THREE.Object3D() - model.add(this.copyRobot()) - - this._insertModels = this._insertModels || [] - this._insertModels.push(model) - - if (this._insertModels.length > 5) { - const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) - needRemove.forEach(item => { - if (item._mixer) { - const mixer = item._mixer - this.mixers.splice(this.mixers.indexOf(mixer), 1) - mixer.uncacheRoot(mixer.getRoot()) - } - if (item.parent) item.parent.remove(item) - }) - } - - return model + return Behavior({ + data: { + width: 1, + height: 1, + fps: 0, + memory: 0, + cpu: 0, + }, + methods: { + onReady() { + wx.createSelectorQuery() + .select('#webgl') + .node() + .exec(res => { + this.canvas = res[0].node + + const info = wx.getSystemInfoSync() + const pixelRatio = info.pixelRatio + const calcSize = (width, height) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + calcSize(info.windowWidth, info.windowHeight * 0.8) + + this.initVK() + }) + }, + onUnload() { + if (this._texture) { + this._texture.dispose() + this._texture = null + } + if (this.renderer) { + this.renderer.dispose() + this.renderer = null + } + if (this.scene) { + this.scene.dispose() + this.scene = null + } + if (this.camera) this.camera = null + if (this.model) this.model = null + if (this._insertModel) this._insertModel = null + if (this._insertModels) this._insertModels = null + if (this.planeBox) this.planeBox = null + if (this.mixers) { + this.mixers.forEach(mixer => mixer.uncacheRoot(mixer.getRoot())) + this.mixers = null + } + if (this.clock) this.clock = null + + if (this.THREE) this.THREE = null + if (this._tempTexture && this._tempTexture.gl) { + this._tempTexture.gl.deleteTexture(this._tempTexture) + this._tempTexture = null + } + if (this._fb && this._fb.gl) { + this._fb.gl.deleteFramebuffer(this._fb) + this._fb = null + } + if (this._program && this._program.gl) { + this._program.gl.deleteProgram(this._program) + this._program = null + } + if (this.canvas) this.canvas = null + if (this.gl) this.gl = null + if (this.session) this.session = null + if (this.anchor2DList) this.anchor2DList = [] + }, + initVK() { + // 初始化 threejs + this.initTHREE() + const THREE = this.THREE + + // 自定义初始化 + if (this.init) this.init() + + console.log('this.gl', this.gl) + + const session = this.session = wx.createVKSession({ + track: { + plane: { + mode: 3 }, - onTouchEnd(evt) { - // 点击位置放一个机器人 - const touches = evt.changedTouches.length ? evt.changedTouches : evt.touches - if (touches.length === 1) { - const touch = touches[0] - if (this.session && this.scene && this.model) { - const hitTestRes = this.session.hitTest(touch.x / this.data.width, touch.y / this.data.height, this.resetPanel) - this.resetPanel = false - if (hitTestRes.length) { - const model = this.getRobot() - model.matrixAutoUpdate = false - model.matrix.fromArray(hitTestRes[0].transform) - this.scene.add(model) - } - } - } + }, + version: 'v1', + gl: this.gl + }) + session.start(err => { + if (err) return console.error('VK error: ', err) + + console.log('@@@@@@@@ VKSession.version', session.version) + + const canvas = this.canvas + + const calcSize = (width, height, pixelRatio) => { + console.log(`canvas size: width = ${width} , height = ${height}`) + this.canvas.width = width * pixelRatio + this.canvas.height = height * pixelRatio + this.setData({ + width, + height, + }) + } + + session.on('resize', () => { + const info = wx.getSystemInfoSync() + calcSize(info.windowWidth, info.windowHeight * 0.8, info.pixelRatio) + }) + + const loader = new THREE.GLTFLoader() + loader.load('https://dldir1.qq.com/weixin/miniprogram/RobotExpressive_aa2603d917384b68bb4a086f32dabe83.glb', gltf => { + this.model = { + scene: gltf.scene, + animations: gltf.animations, + } + }) + + this.clock = new THREE.Clock() + + // 限制调用帧率 + const fps = 30 + const fpsInterval = 1000 / fps + let last = Date.now() + + // 逐帧渲染 + const onFrame = timestamp => { + const now = Date.now() + const mill = now - last + // 经过了足够的时间 + if (mill > fpsInterval) { + last = now - (mill % fpsInterval) // 校正当前时间 + const frame = session.getVKFrame(canvas.width, canvas.height) + if (frame) { + this.render(frame) + } + } + session.requestAnimationFrame(onFrame) + } + session.requestAnimationFrame(onFrame) + }) + }, + initTHREE() { + const THREE = this.THREE = createScopedThreejs(this.canvas) + registerGLTFLoader(THREE) + + // 相机 + this.camera = new THREE.Camera() + + // 场景 + const scene = this.scene = new THREE.Scene() + + // 光源 + const light1 = new THREE.HemisphereLight(0xffffff, 0x444444) // 半球光 + light1.position.set(0, 0.2, 0) + scene.add(light1) + const light2 = new THREE.DirectionalLight(0xffffff) // 平行光 + light2.position.set(0, 0.2, 0.1) + scene.add(light2) + + // 渲染层 + const renderer = this.renderer = new THREE.WebGLRenderer({ + antialias: true, + alpha: true + }) + renderer.gammaOutput = true + renderer.gammaFactor = 2.2 + }, + + copyRobot() { + const THREE = this.THREE + const { + scene, + animations + } = cloneGltf(this.model, THREE) + scene.scale.set(0.05, 0.05, 0.05) + + // 动画混合器 + const mixer = new THREE.AnimationMixer(scene) + for (let i = 0; i < animations.length; i++) { + const clip = animations[i] + if (clip.name === 'Dance') { + const action = mixer.clipAction(clip) + action.play() + } + } + + this.mixers = this.mixers || [] + this.mixers.push(mixer) + + scene._mixer = mixer + return scene + }, + getRobot() { + const THREE = this.THREE + + const model = new THREE.Object3D() + model.add(this.copyRobot()) + + this._insertModels = this._insertModels || [] + this._insertModels.push(model) + + if (this._insertModels.length > 5) { + const needRemove = this._insertModels.splice(0, this._insertModels.length - 5) + needRemove.forEach(item => { + if (item._mixer) { + const mixer = item._mixer + this.mixers.splice(this.mixers.indexOf(mixer), 1) + mixer.uncacheRoot(mixer.getRoot()) + } + if (item.parent) item.parent.remove(item) + }) + } + + return model + }, + onTouchEnd(evt) { + // 点击位置放一个机器人 + const touches = evt.changedTouches.length ? evt.changedTouches : evt.touches + if (touches.length === 1) { + const touch = touches[0] + if (this.session && this.scene && this.model) { + const hitTestRes = this.session.hitTest(touch.x / this.data.width, touch.y / this.data.height, this.resetPanel) + this.resetPanel = false + if (hitTestRes.length) { + const model = this.getRobot() + model.matrixAutoUpdate = false + model.matrix.fromArray(hitTestRes[0].transform) + this.scene.add(model) } - }, - }) -} \ No newline at end of file + } + } + } + }, + }) +} diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic/visionkit-basic.js b/miniprogram/packageAPI/pages/ar/visionkit-basic/visionkit-basic.js index 8029a4fe..95ce730c 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic/visionkit-basic.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic/visionkit-basic.js @@ -5,61 +5,61 @@ const NEAR = 0.001 const FAR = 1000 Component({ - behaviors: [getBehavior(), yuvBehavior], - data: { - theme: 'light', - }, - lifetimes: { - /** + behaviors: [getBehavior(), yuvBehavior], + data: { + theme: 'light', + }, + lifetimes: { + /** * 生命周期函数--监听页面加载 */ - detached() { - console.log("页面detached") - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, - ready() { - console.log("页面准备完全") - this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' - }) - - if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) - }) - } - }, + detached() { + console.log('页面detached') + if (wx.offThemeChange) { + wx.offThemeChange() + } + }, + ready() { + console.log('页面准备完全') + this.setData({ + theme: getApp().globalData.theme || 'light' + }) + + if (wx.onThemeChange) { + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) + }) + } + }, + }, + methods: { + init() { + this.initGL() }, - methods: { - init() { - this.initGL() - }, - render(frame) { - this.renderGL(frame) + render(frame) { + this.renderGL(frame) - const camera = frame.camera + const camera = frame.camera - const dt = this.clock.getDelta() - if (this.mixers) { - this.mixers.forEach(mixer => mixer.update(dt)) - } + const dt = this.clock.getDelta() + if (this.mixers) { + this.mixers.forEach(mixer => mixer.update(dt)) + } - // 相机 - if (camera) { - this.camera.matrixAutoUpdate = false - this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) - this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) + // 相机 + if (camera) { + this.camera.matrixAutoUpdate = false + this.camera.matrixWorldInverse.fromArray(camera.viewMatrix) + this.camera.matrixWorld.getInverse(this.camera.matrixWorldInverse) - const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) - this.camera.projectionMatrix.fromArray(projectionMatrix) - this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) - } + const projectionMatrix = camera.getProjectionMatrix(NEAR, FAR) + this.camera.projectionMatrix.fromArray(projectionMatrix) + this.camera.projectionMatrixInverse.getInverse(this.camera.projectionMatrix) + } - this.renderer.autoClearColor = false - this.renderer.render(this.scene, this.camera) - this.renderer.state.setCullFace(this.THREE.CullFaceNone) - }, + this.renderer.autoClearColor = false + this.renderer.render(this.scene, this.camera) + this.renderer.state.setCullFace(this.THREE.CullFaceNone) }, -}) \ No newline at end of file + }, +}) diff --git a/miniprogram/packageAPI/pages/ar/visionkit-basic/yuvBehavior.js b/miniprogram/packageAPI/pages/ar/visionkit-basic/yuvBehavior.js index 5d4e249c..1c7cb263 100644 --- a/miniprogram/packageAPI/pages/ar/visionkit-basic/yuvBehavior.js +++ b/miniprogram/packageAPI/pages/ar/visionkit-basic/yuvBehavior.js @@ -1,9 +1,9 @@ const yuvBehavior = Behavior({ - methods: { - initShader() { - const gl = this.gl = this.renderer.getContext() - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const vs = ` + methods: { + initShader() { + const gl = this.gl = this.renderer.getContext() + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const vs = ` attribute vec2 a_position; attribute vec2 a_texCoord; uniform mat3 displayTransform; @@ -14,7 +14,7 @@ const yuvBehavior = Behavior({ v_texCoord = a_texCoord; } ` - const fs = ` + const fs = ` precision highp float; uniform sampler2D y_texture; @@ -37,103 +37,103 @@ const yuvBehavior = Behavior({ gl_FragColor = vec4(R, G, B, 1.0); } ` - const vertShader = gl.createShader(gl.VERTEX_SHADER) - gl.shaderSource(vertShader, vs) - gl.compileShader(vertShader) - - const fragShader = gl.createShader(gl.FRAGMENT_SHADER) - gl.shaderSource(fragShader, fs) - gl.compileShader(fragShader) - - const program = this._program = gl.createProgram() - this._program.gl = gl - gl.attachShader(program, vertShader) - gl.attachShader(program, fragShader) - gl.deleteShader(vertShader) - gl.deleteShader(fragShader) - gl.linkProgram(program) - gl.useProgram(program) - - const uniformYTexture = gl.getUniformLocation(program, 'y_texture') - gl.uniform1i(uniformYTexture, 5) - const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') - gl.uniform1i(uniformUVTexture, 6) - - this._dt = gl.getUniformLocation(program, 'displayTransform') - gl.useProgram(currentProgram) - }, - initVAO() { - const gl = this.renderer.getContext() - const ext = gl.getExtension('OES_vertex_array_object') - this.ext = ext - - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - const vao = ext.createVertexArrayOES() - - ext.bindVertexArrayOES(vao) - - const posAttr = gl.getAttribLocation(this._program, 'a_position') - const pos = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, pos) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) - gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(posAttr) - vao.posBuffer = pos - - const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') - const texcoord = gl.createBuffer() - gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) - gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) - gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) - gl.enableVertexAttribArray(texcoordAttr) - vao.texcoordBuffer = texcoord - - ext.bindVertexArrayOES(currentVAO) - this._vao = vao - }, - initGL() { - this.initShader() - this.initVAO() - }, - renderGL(frame) { - const gl = this.renderer.getContext() - gl.disable(gl.DEPTH_TEST) - const { - yTexture, - uvTexture - } = frame.getCameraTexture(gl, 'yuv') - const displayTransform = frame.getDisplayTransform() - if (yTexture && uvTexture) { - const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) - const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) - const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) - - gl.useProgram(this._program) - this.ext.bindVertexArrayOES(this._vao) - - gl.uniformMatrix3fv(this._dt, false, displayTransform) - gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) - - gl.activeTexture(gl.TEXTURE0 + 5) - const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, yTexture) - - gl.activeTexture(gl.TEXTURE0 + 6) - const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) - gl.bindTexture(gl.TEXTURE_2D, uvTexture) - - gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) - - gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) - gl.activeTexture(gl.TEXTURE0 + 5) - gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) - - gl.useProgram(currentProgram) - gl.activeTexture(currentActiveTexture) - this.ext.bindVertexArrayOES(currentVAO) - } - }, + const vertShader = gl.createShader(gl.VERTEX_SHADER) + gl.shaderSource(vertShader, vs) + gl.compileShader(vertShader) + + const fragShader = gl.createShader(gl.FRAGMENT_SHADER) + gl.shaderSource(fragShader, fs) + gl.compileShader(fragShader) + + const program = this._program = gl.createProgram() + this._program.gl = gl + gl.attachShader(program, vertShader) + gl.attachShader(program, fragShader) + gl.deleteShader(vertShader) + gl.deleteShader(fragShader) + gl.linkProgram(program) + gl.useProgram(program) + + const uniformYTexture = gl.getUniformLocation(program, 'y_texture') + gl.uniform1i(uniformYTexture, 5) + const uniformUVTexture = gl.getUniformLocation(program, 'uv_texture') + gl.uniform1i(uniformUVTexture, 6) + + this._dt = gl.getUniformLocation(program, 'displayTransform') + gl.useProgram(currentProgram) }, + initVAO() { + const gl = this.renderer.getContext() + const ext = gl.getExtension('OES_vertex_array_object') + this.ext = ext + + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + const vao = ext.createVertexArrayOES() + + ext.bindVertexArrayOES(vao) + + const posAttr = gl.getAttribLocation(this._program, 'a_position') + const pos = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, pos) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), gl.STATIC_DRAW) + gl.vertexAttribPointer(posAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(posAttr) + vao.posBuffer = pos + + const texcoordAttr = gl.getAttribLocation(this._program, 'a_texCoord') + const texcoord = gl.createBuffer() + gl.bindBuffer(gl.ARRAY_BUFFER, texcoord) + gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([1, 1, 0, 1, 1, 0, 0, 0]), gl.STATIC_DRAW) + gl.vertexAttribPointer(texcoordAttr, 2, gl.FLOAT, false, 0, 0) + gl.enableVertexAttribArray(texcoordAttr) + vao.texcoordBuffer = texcoord + + ext.bindVertexArrayOES(currentVAO) + this._vao = vao + }, + initGL() { + this.initShader() + this.initVAO() + }, + renderGL(frame) { + const gl = this.renderer.getContext() + gl.disable(gl.DEPTH_TEST) + const { + yTexture, + uvTexture + } = frame.getCameraTexture(gl, 'yuv') + const displayTransform = frame.getDisplayTransform() + if (yTexture && uvTexture) { + const currentProgram = gl.getParameter(gl.CURRENT_PROGRAM) + const currentActiveTexture = gl.getParameter(gl.ACTIVE_TEXTURE) + const currentVAO = gl.getParameter(gl.VERTEX_ARRAY_BINDING) + + gl.useProgram(this._program) + this.ext.bindVertexArrayOES(this._vao) + + gl.uniformMatrix3fv(this._dt, false, displayTransform) + gl.pixelStorei(gl.UNPACK_ALIGNMENT, 1) + + gl.activeTexture(gl.TEXTURE0 + 5) + const bindingTexture5 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, yTexture) + + gl.activeTexture(gl.TEXTURE0 + 6) + const bindingTexture6 = gl.getParameter(gl.TEXTURE_BINDING_2D) + gl.bindTexture(gl.TEXTURE_2D, uvTexture) + + gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4) + + gl.bindTexture(gl.TEXTURE_2D, bindingTexture6) + gl.activeTexture(gl.TEXTURE0 + 5) + gl.bindTexture(gl.TEXTURE_2D, bindingTexture5) + + gl.useProgram(currentProgram) + gl.activeTexture(currentActiveTexture) + this.ext.bindVertexArrayOES(currentVAO) + } + }, + }, }) -export default yuvBehavior \ No newline at end of file +export default yuvBehavior diff --git a/miniprogram/packageAPI/pages/chattool/activity_assist/activity_assist.js b/miniprogram/packageAPI/pages/chattool/activity_assist/activity_assist.js index 7f2eb1bf..b4d87e33 100644 --- a/miniprogram/packageAPI/pages/chattool/activity_assist/activity_assist.js +++ b/miniprogram/packageAPI/pages/chattool/activity_assist/activity_assist.js @@ -1,6 +1,7 @@ const config = require('../../../../config') const util = require('../../../../util/util') -const systemInfo = wx.getSystemInfoSync() + +const systemInfo = getApp().globalData Page({ data: { activityList: [], @@ -33,9 +34,9 @@ Page({ env: config.envId, traceUser: true, }) - + this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { diff --git a/miniprogram/packageAPI/pages/chattool/material_open/material_open.js b/miniprogram/packageAPI/pages/chattool/material_open/material_open.js index f06e7a8f..8ae28e84 100644 --- a/miniprogram/packageAPI/pages/chattool/material_open/material_open.js +++ b/miniprogram/packageAPI/pages/chattool/material_open/material_open.js @@ -1,15 +1,16 @@ import { getGroupEnterInfo } from '../util' + const config = require('../../../../config') let needShowEntrance = true -let entrancePath = 'packageAPI/pages/chattool/material_open/material_open' -let templateId = '4A68CBB88A92B0A9311848DBA1E94A199B166463' // 完成 +const entrancePath = 'packageAPI/pages/chattool/material_open/material_open' +const templateId = '4A68CBB88A92B0A9311848DBA1E94A199B166463' // 完成 // let templateId = '2A84254B945674A2F88CE4970782C402795EB607' // 参与 const fileUrl = 'https://res.wx.qq.com/open/js/jweixin-1.6.0.js' const videoUrl = 'https://res.wx.qq.com/op_res/o3RWIC_o--wNf_qA3B4ghHbL_qKRRwsUM39dGTzltCR2__61DnEANInj5AJJmVXsHvx9FyHlDftU3KhcGCukDA' -const {envVersion} = wx.getAccountInfoSync().miniProgram +const { envVersion } = wx.getAccountInfoSync().miniProgram const getVersionType = () => { if (envVersion === 'release') { @@ -48,9 +49,9 @@ Page({ env: config.envId, traceUser: true, }) - + this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -71,24 +72,24 @@ Page({ } await getGroupEnterInfo() - .then(groupInfo => { - const {groupOpenID} = groupInfo - this.updateChatToolMsg(activityId, { - targetState: 1, - parameterList: [{ - groupOpenID, - state: 1, - }] - }) - wx.showToast({ - title: '签到成功', - icon: 'none' + .then(groupInfo => { + const { groupOpenID } = groupInfo + this.updateChatToolMsg(activityId, { + targetState: 1, + parameterList: [{ + groupOpenID, + state: 1, + }] + }) + wx.showToast({ + title: '签到成功', + icon: 'none' + }) + }).catch(err => { + console.error('getGroupEnterInfo fail: ', err) }) - }).catch(err => { - console.error('getGroupEnterInfo fail: ', err) - }) }, - + remindExpiration() { const activityId = this._activityId if (!activityId) { @@ -126,7 +127,7 @@ Page({ }, updateChatToolMsg(activityId, params = {}) { - const {targetState, parameterList } = params + const { targetState, parameterList } = params wx.cloud.callFunction({ name: 'openapi', data: { @@ -203,7 +204,7 @@ Page({ complete(res) { console.info('shareImageToGroup: ', res) } - }) + }) } }) }, @@ -219,7 +220,7 @@ Page({ complete(res) { console.info('shareEmojiToGroup: ', res) } - }) + }) } }) }, @@ -227,7 +228,7 @@ Page({ shareVideo() { wx.downloadFile({ url: videoUrl, - success (res) { + success(res) { wx.shareVideoToGroup({ videoPath: res.tempFilePath, thumbPath: '', @@ -236,7 +237,7 @@ Page({ complete(res) { console.info('shareVideoToGroup: ', res) } - }) + }) }, fail: console.error, }) @@ -245,7 +246,7 @@ Page({ shareFile() { wx.downloadFile({ url: fileUrl, - success (res) { + success(res) { wx.shareFileToGroup({ filePath: res.tempFilePath, fileName: '', @@ -254,7 +255,7 @@ Page({ complete(res) { console.info('shareFileToGroup: ', res) } - }) + }) }, fail: console.error, }) diff --git a/miniprogram/packageAPI/pages/chattool/material_view/material_view.js b/miniprogram/packageAPI/pages/chattool/material_view/material_view.js index 4a72ef5a..2d042b82 100644 --- a/miniprogram/packageAPI/pages/chattool/material_view/material_view.js +++ b/miniprogram/packageAPI/pages/chattool/material_view/material_view.js @@ -104,7 +104,7 @@ Page({ // this.formatMaterials(mockData.materials) this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -131,7 +131,7 @@ Page({ this.triggerMergedImage() const materials = [] - for (let item of forwardMaterials) { + for (const item of forwardMaterials) { let recordType = '' if (item.type === 'text/message') { recordType = chatRecordTypes[0] @@ -155,15 +155,14 @@ Page({ async triggerMergedImage() { try { const tempFilePaths = this._forwardMaterials - .filter(item => item.type.startsWith('image')) - .map(item => item.path) + .filter(item => item.type.startsWith('image')) + .map(item => item.path) console.info('tempFilePaths: ', tempFilePaths) const shareImagePath = await this.mergeImages(tempFilePaths) this.setData({ shareImagePath, }) console.info('shareImagePath: ', shareImagePath) - } catch (error) { console.error('mergeImages fail: ', error) } @@ -190,22 +189,22 @@ Page({ async mergeImages(tempFilePaths) { try { // 获取 canvas 节点 - const { node: canvas, width: cw, height: ch } = await this.getCanvasNode(); - + const { node: canvas, width: cw, height: ch } = await this.getCanvasNode() + // 获取 2D 上下文 - const ctx = canvas.getContext('2d'); - + const ctx = canvas.getContext('2d') + // 预加载所有图片 - const images = await this.loadAllImages(canvas, tempFilePaths); - + const images = await this.loadAllImages(canvas, tempFilePaths) + // 绘制图片 - this.drawImages(ctx, images, 400); - + this.drawImages(ctx, images, 400) + // 生成临时文件 - return await this.canvasToTempFile(canvas); + return await this.canvasToTempFile(canvas) } catch (err) { - console.error('合并失败:', err); - return null; + console.error('合并失败:', err) + return null } }, @@ -216,72 +215,76 @@ Page({ .select('#myCanvas') .fields({ node: true, size: true }) .exec(res => { - if (res[0]) resolve(res[0]); - else reject(new Error('Canvas 节点获取失败')); - }); - }); + if (res[0]) resolve(res[0]) + else reject(new Error('Canvas 节点获取失败')) + }) + }) }, // 计算画布尺寸 calculateLayout(paths) { - const imgSize = 100; - const spacing = 10; - const perLine = 3; - - const rows = Math.ceil(paths.length / perLine); + const imgSize = 100 + const spacing = 10 + const perLine = 3 + + const rows = Math.ceil(paths.length / perLine) return { canvasWidth: perLine * imgSize + (perLine - 1) * spacing, canvasHeight: rows * imgSize + (rows - 1) * spacing - }; + } }, // 加载所有图片(Web Image 对象) loadAllImages(canvas, paths) { - return Promise.all(paths.map(url => { - return new Promise((resolve, reject) => { - const image = canvas.createImage(); - image.onload = () => resolve(image); - image.onerror = reject; - image.src = url; // 支持本地路径和网络图片 - }); - })); + return Promise.all(paths.map(url => new Promise((resolve, reject) => { + const image = canvas.createImage() + image.onload = () => resolve(image) + image.onerror = reject + image.src = url // 支持本地路径和网络图片 + }))) }, // 执行图片绘制 drawImages(ctx, images, canvasWidth) { - const imgSize = 100; - const spacing = 10; - const perLine = 3; - + const imgSize = 100 + const spacing = 10 + const perLine = 3 + images.forEach((image, index) => { - const row = Math.floor(index / perLine); - const col = index % perLine; - - const x = col * (imgSize + spacing); - const y = row * (imgSize + spacing); - + const row = Math.floor(index / perLine) + const col = index % perLine + + const x = col * (imgSize + spacing) + const y = row * (imgSize + spacing) + // 绘制图像(支持缩放裁剪) ctx.drawImage( image, - 0, 0, image.width, image.height, // 源图裁剪区域 - x, y, imgSize, imgSize // 画布绘制区域 - ); - }); + 0, + 0, + image.width, + image.height, // 源图裁剪区域 + x, + y, + imgSize, + imgSize // 画布绘制区域 + ) + }) }, // Canvas 转临时文件 canvasToTempFile(canvas) { return new Promise((resolve, reject) => { wx.canvasToTempFilePath({ - canvas: canvas, + canvas, fileType: 'png', width: 400, height: 500, quality: 1, success: res => resolve(res.tempFilePath), fail: reject - }); - }); + }) + }) } }) diff --git a/miniprogram/packageAPI/pages/chattool/util.js b/miniprogram/packageAPI/pages/chattool/util.js index 9efb68aa..81a52ae7 100644 --- a/miniprogram/packageAPI/pages/chattool/util.js +++ b/miniprogram/packageAPI/pages/chattool/util.js @@ -36,8 +36,8 @@ export function getGroupEnterInfo() { reject(res) }, complete(res) { - console.info('getGroupEnterInfo complete: ',res) + console.info('getGroupEnterInfo complete: ', res) } }) }) -} \ No newline at end of file +} diff --git a/miniprogram/packageAPI/pages/device/add-contact/add-contact.js b/miniprogram/packageAPI/pages/device/add-contact/add-contact.js index 4e31a7f5..9618da9c 100644 --- a/miniprogram/packageAPI/pages/device/add-contact/add-contact.js +++ b/miniprogram/packageAPI/pages/device/add-contact/add-contact.js @@ -29,12 +29,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/bluetooth/bluetooth.js b/miniprogram/packageAPI/pages/device/bluetooth/bluetooth.js index b67860c1..d22c288d 100644 --- a/miniprogram/packageAPI/pages/device/bluetooth/bluetooth.js +++ b/miniprogram/packageAPI/pages/device/bluetooth/bluetooth.js @@ -32,9 +32,6 @@ Page({ connected: false, chs: [], }, - onUnload() { - this.closeBluetoothAdapter() - }, openBluetoothAdapter() { const that = this wx.openBluetoothAdapter({ @@ -252,15 +249,16 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + this.closeBluetoothAdapter() }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/bluetooth/slave/slave.js b/miniprogram/packageAPI/pages/device/bluetooth/slave/slave.js index 7d0886c9..8674f8b2 100644 --- a/miniprogram/packageAPI/pages/device/bluetooth/slave/slave.js +++ b/miniprogram/packageAPI/pages/device/bluetooth/slave/slave.js @@ -1,10 +1,8 @@ - const uuid3 = '0C76801A-62EB-45E5-96A8-37C8882ABB2B' const serviceId = 'D0611E78-BBB4-4591-A5F8-487910AE4366' const characteristicId = '8667556C-9A37-4C91-84ED-54EE27D90049' // 上面需要配置主机的 serviceId 和 characteristicId - // ArrayBuffer转16进制字符串示例 // function ab2hex(buffer) { // const hexArr = Array.prototype.map.call( @@ -43,15 +41,19 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + this.data.servers.forEach(() => { + // server.close() + }) }, + onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } wx.onBLEPeripheralConnectionStateChanged(res => { @@ -63,7 +65,7 @@ Page({ } else { connects.push(res) } - this.setData({connects}) + this.setData({ connects }) }) }, @@ -106,7 +108,7 @@ Page({ title: '创建 server ', }) this.server.onCharacteristicReadRequest(res => { - const {serviceId, characteristicId, callbackId} = res + const { serviceId, characteristicId, callbackId } = res const buffer = new ArrayBuffer(1) const dataView = new DataView(buffer) const newValue = Math.ceil(Math.random() * 10) @@ -141,7 +143,7 @@ Page({ }).catch(() => {}) }, closeServer() { - if (this.server) { + if (this.server) { this.server.close() wx.showToast({ title: '关闭 server', @@ -302,10 +304,4 @@ Page({ }) wx.closeBluetoothAdapter() }, - - onUnload() { - this.data.servers.forEach(() => { - // server.close() - }) - }, }) diff --git a/miniprogram/packageAPI/pages/device/capture-screen/capture-screen.js b/miniprogram/packageAPI/pages/device/capture-screen/capture-screen.js index 4e25f6d2..a31b90fb 100644 --- a/miniprogram/packageAPI/pages/device/capture-screen/capture-screen.js +++ b/miniprogram/packageAPI/pages/device/capture-screen/capture-screen.js @@ -17,12 +17,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } wx.onUserCaptureScreen(() => { diff --git a/miniprogram/packageAPI/pages/device/clipboard-data/clipboard-data.js b/miniprogram/packageAPI/pages/device/clipboard-data/clipboard-data.js index 32d86f58..19fee164 100644 --- a/miniprogram/packageAPI/pages/device/clipboard-data/clipboard-data.js +++ b/miniprogram/packageAPI/pages/device/clipboard-data/clipboard-data.js @@ -58,12 +58,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/get-battery-info/get-battery-info.js b/miniprogram/packageAPI/pages/device/get-battery-info/get-battery-info.js index 681fc884..87022900 100644 --- a/miniprogram/packageAPI/pages/device/get-battery-info/get-battery-info.js +++ b/miniprogram/packageAPI/pages/device/get-battery-info/get-battery-info.js @@ -29,12 +29,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/get-network-type/get-network-type.js b/miniprogram/packageAPI/pages/device/get-network-type/get-network-type.js index 3e5f14fc..fccc5093 100644 --- a/miniprogram/packageAPI/pages/device/get-network-type/get-network-type.js +++ b/miniprogram/packageAPI/pages/device/get-network-type/get-network-type.js @@ -35,12 +35,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/get-system-info/get-system-info.js b/miniprogram/packageAPI/pages/device/get-system-info/get-system-info.js index d0a058a6..e0678162 100644 --- a/miniprogram/packageAPI/pages/device/get-system-info/get-system-info.js +++ b/miniprogram/packageAPI/pages/device/get-system-info/get-system-info.js @@ -27,12 +27,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/ibeacon/ibeacon.js b/miniprogram/packageAPI/pages/device/ibeacon/ibeacon.js index 6ebbed60..78c86ec1 100644 --- a/miniprogram/packageAPI/pages/device/ibeacon/ibeacon.js +++ b/miniprogram/packageAPI/pages/device/ibeacon/ibeacon.js @@ -12,10 +12,6 @@ Page({ beacons: [] }, - onUnload() { - this.stopSearch() - }, - enterUuid(e) { this.setData({ uuid: e.detail.value @@ -29,7 +25,7 @@ Page({ uuids: [this.data.uuid], success: (res) => { console.log(res) - wx.onBeaconUpdate(({beacons}) => { + wx.onBeaconUpdate(({ beacons }) => { this.setData({ beacons }) @@ -49,15 +45,16 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + this.stopSearch() }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/make-phone-call/make-phone-call.js b/miniprogram/packageAPI/pages/device/make-phone-call/make-phone-call.js index dacdea2f..2766f8b4 100644 --- a/miniprogram/packageAPI/pages/device/make-phone-call/make-phone-call.js +++ b/miniprogram/packageAPI/pages/device/make-phone-call/make-phone-call.js @@ -38,12 +38,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/on-accelerometer-change/on-accelerometer-change.js b/miniprogram/packageAPI/pages/device/on-accelerometer-change/on-accelerometer-change.js index 7364f3ca..90f649f9 100644 --- a/miniprogram/packageAPI/pages/device/on-accelerometer-change/on-accelerometer-change.js +++ b/miniprogram/packageAPI/pages/device/on-accelerometer-change/on-accelerometer-change.js @@ -117,22 +117,20 @@ Page({ } }) }, - onUnload() { - clearInterval(this.interval) - }, onUnload() { if (wx.offThemeChange) { wx.offThemeChange() } + clearInterval(this.interval) }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/on-compass-change/on-compass-change.js b/miniprogram/packageAPI/pages/device/on-compass-change/on-compass-change.js index 4332a350..c77670e1 100644 --- a/miniprogram/packageAPI/pages/device/on-compass-change/on-compass-change.js +++ b/miniprogram/packageAPI/pages/device/on-compass-change/on-compass-change.js @@ -52,12 +52,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/on-network-status-change/on-network-status-change.js b/miniprogram/packageAPI/pages/device/on-network-status-change/on-network-status-change.js index 8b3b6a0f..d2f34ab2 100644 --- a/miniprogram/packageAPI/pages/device/on-network-status-change/on-network-status-change.js +++ b/miniprogram/packageAPI/pages/device/on-network-status-change/on-network-status-change.js @@ -17,12 +17,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const that = this diff --git a/miniprogram/packageAPI/pages/device/scan-code/scan-code.js b/miniprogram/packageAPI/pages/device/scan-code/scan-code.js index 112e2796..f16ce851 100644 --- a/miniprogram/packageAPI/pages/device/scan-code/scan-code.js +++ b/miniprogram/packageAPI/pages/device/scan-code/scan-code.js @@ -32,12 +32,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/screen-brightness/screen-brightness.js b/miniprogram/packageAPI/pages/device/screen-brightness/screen-brightness.js index a7976ab7..f9ca2268 100644 --- a/miniprogram/packageAPI/pages/device/screen-brightness/screen-brightness.js +++ b/miniprogram/packageAPI/pages/device/screen-brightness/screen-brightness.js @@ -18,12 +18,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this._updateScreenBrightness() diff --git a/miniprogram/packageAPI/pages/device/vibrate/vibrate.js b/miniprogram/packageAPI/pages/device/vibrate/vibrate.js index 1f4af12a..ea956160 100644 --- a/miniprogram/packageAPI/pages/device/vibrate/vibrate.js +++ b/miniprogram/packageAPI/pages/device/vibrate/vibrate.js @@ -40,12 +40,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/device/wifi/wifi.js b/miniprogram/packageAPI/pages/device/wifi/wifi.js index a56657c9..0bc99255 100644 --- a/miniprogram/packageAPI/pages/device/wifi/wifi.js +++ b/miniprogram/packageAPI/pages/device/wifi/wifi.js @@ -11,10 +11,6 @@ Page({ wifiList: [] }, - onUnload() { - this.stopSearch() - }, - startSearch() { const getWifiList = () => { wx.getWifiList({ @@ -24,7 +20,7 @@ Page({ .sort((a, b) => b.signalStrength - a.signalStrength) .map(wifi => { const strength = Math.ceil(wifi.signalStrength * 4) - return Object.assign(wifi, {strength}) + return Object.assign(wifi, { strength }) }) this.setData({ wifiList @@ -76,18 +72,19 @@ Page({ }) }, onUnload() { + this.stopSearch() if (wx.offThemeChange) { wx.offThemeChange() } }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/framework/resizable/resizable.js b/miniprogram/packageAPI/pages/framework/resizable/resizable.js index 2f66ecd8..3585a590 100644 --- a/miniprogram/packageAPI/pages/framework/resizable/resizable.js +++ b/miniprogram/packageAPI/pages/framework/resizable/resizable.js @@ -22,12 +22,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/framework/two-way-bindings/two-way-bindings.js b/miniprogram/packageAPI/pages/framework/two-way-bindings/two-way-bindings.js index ea50ab59..f285414a 100644 --- a/miniprogram/packageAPI/pages/framework/two-way-bindings/two-way-bindings.js +++ b/miniprogram/packageAPI/pages/framework/two-way-bindings/two-way-bindings.js @@ -12,22 +12,16 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onUnload() { - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } - }, /** @@ -55,7 +49,9 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload() { - + if (wx.offThemeChange) { + wx.offThemeChange() + } }, /** diff --git a/miniprogram/packageAPI/pages/framework/wxs/movable.js b/miniprogram/packageAPI/pages/framework/wxs/movable.js index 8071a734..d6e86550 100644 --- a/miniprogram/packageAPI/pages/framework/wxs/movable.js +++ b/miniprogram/packageAPI/pages/framework/wxs/movable.js @@ -30,15 +30,14 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } - }, /** diff --git a/miniprogram/packageAPI/pages/framework/wxs/nearby.js b/miniprogram/packageAPI/pages/framework/wxs/nearby.js index 4b4e0efd..f2138af5 100644 --- a/miniprogram/packageAPI/pages/framework/wxs/nearby.js +++ b/miniprogram/packageAPI/pages/framework/wxs/nearby.js @@ -65,12 +65,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/framework/wxs/sidebar.js b/miniprogram/packageAPI/pages/framework/wxs/sidebar.js index 8ae91b66..d3245ed6 100644 --- a/miniprogram/packageAPI/pages/framework/wxs/sidebar.js +++ b/miniprogram/packageAPI/pages/framework/wxs/sidebar.js @@ -19,12 +19,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const tabs = [ @@ -35,7 +35,7 @@ Page({ desc: '本视频系列课程,由腾讯课堂NEXT学院与微信团队联合出品,通过实战案例,深入浅出地进行讲解。', }, ] - this.setData({tabs}) + this.setData({ tabs }) // setTimeout(() => { // this.initInteraction() // }, 5000) diff --git a/miniprogram/packageAPI/pages/framework/wxs/stick-top.js b/miniprogram/packageAPI/pages/framework/wxs/stick-top.js index e9fd54d7..52fc4e40 100644 --- a/miniprogram/packageAPI/pages/framework/wxs/stick-top.js +++ b/miniprogram/packageAPI/pages/framework/wxs/stick-top.js @@ -25,12 +25,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const tabs = [ @@ -65,6 +65,6 @@ Page({ desc: '微信小程序应用开发赛', }, ] - this.setData({tabs}) + this.setData({ tabs }) } }) diff --git a/miniprogram/packageAPI/pages/framework/wxs/wxs.js b/miniprogram/packageAPI/pages/framework/wxs/wxs.js index 6a9037fe..fc1f38cc 100644 --- a/miniprogram/packageAPI/pages/framework/wxs/wxs.js +++ b/miniprogram/packageAPI/pages/framework/wxs/wxs.js @@ -19,12 +19,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/location/choose-location/choose-location.js b/miniprogram/packageAPI/pages/location/choose-location/choose-location.js index 62ed518d..3cd0259f 100644 --- a/miniprogram/packageAPI/pages/location/choose-location/choose-location.js +++ b/miniprogram/packageAPI/pages/location/choose-location/choose-location.js @@ -39,12 +39,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/location/get-location/get-location.js b/miniprogram/packageAPI/pages/location/get-location/get-location.js index e21854be..0e287be1 100644 --- a/miniprogram/packageAPI/pages/location/get-location/get-location.js +++ b/miniprogram/packageAPI/pages/location/get-location/get-location.js @@ -41,12 +41,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/location/open-location/open-location.js b/miniprogram/packageAPI/pages/location/open-location/open-location.js index 3347250b..f5c3ef64 100644 --- a/miniprogram/packageAPI/pages/location/open-location/open-location.js +++ b/miniprogram/packageAPI/pages/location/open-location/open-location.js @@ -24,12 +24,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/media/audio/audio.js b/miniprogram/packageAPI/pages/media/audio/audio.js index ec4b7074..fc2e0e5f 100644 --- a/miniprogram/packageAPI/pages/media/audio/audio.js +++ b/miniprogram/packageAPI/pages/media/audio/audio.js @@ -34,12 +34,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/media/background-audio/background-audio.js b/miniprogram/packageAPI/pages/media/background-audio/background-audio.js index 47be9d5b..baa13d2f 100644 --- a/miniprogram/packageAPI/pages/media/background-audio/background-audio.js +++ b/miniprogram/packageAPI/pages/media/background-audio/background-audio.js @@ -1,7 +1,6 @@ // const app = getApp() const util = require('../../../../util/util.js') - const backgroundAudioManager = wx.getBackgroundAudioManager() let updateInterval let draging @@ -20,10 +19,8 @@ Page({ playing: true }) } - }, - data: { theme: 'light', playing: false, // 播放状态 @@ -75,33 +72,31 @@ Page({ _enableInterval() { const that = this function update() { - if(!draging){ + if (!draging) { that.setData({ - playTime: backgroundAudioManager.currentTime + 1, - formatedPlayTime: util.formatTime(backgroundAudioManager.currentTime + 1) + playTime: backgroundAudioManager.currentTime + 1, + formatedPlayTime: util.formatTime(backgroundAudioManager.currentTime + 1) }) } } updateInterval = setInterval(update, 1000) }, - onUnload() { - clearInterval(updateInterval) - }, - onUnload() { if (wx.offThemeChange) { wx.offThemeChange() } + clearInterval(updateInterval) }, + onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const that = this @@ -125,7 +120,7 @@ Page({ // 拖动到指定位置结束,恢复slider滚动 backgroundAudioManager.onSeeked((res) => { - draging = false + draging = false }) backgroundAudioManager.onEnded(() => { diff --git a/miniprogram/packageAPI/pages/media/file/file.js b/miniprogram/packageAPI/pages/media/file/file.js index c802af36..162c4a2c 100644 --- a/miniprogram/packageAPI/pages/media/file/file.js +++ b/miniprogram/packageAPI/pages/media/file/file.js @@ -13,12 +13,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ diff --git a/miniprogram/packageAPI/pages/media/image/image.js b/miniprogram/packageAPI/pages/media/image/image.js index 3f8153c6..8abae70a 100644 --- a/miniprogram/packageAPI/pages/media/image/image.js +++ b/miniprogram/packageAPI/pages/media/image/image.js @@ -65,12 +65,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/media/load-font-face/load-font-face.js b/miniprogram/packageAPI/pages/media/load-font-face/load-font-face.js index 559d4e6b..c0d11c90 100644 --- a/miniprogram/packageAPI/pages/media/load-font-face/load-font-face.js +++ b/miniprogram/packageAPI/pages/media/load-font-face/load-font-face.js @@ -19,12 +19,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ @@ -39,7 +39,7 @@ Page({ source: 'url("https://sungd.github.io/Pacifico.ttf")', success(res) { console.log(res.status) - self.setData({loaded: true}) + self.setData({ loaded: true }) }, fail(res) { console.log(res.status) @@ -51,6 +51,6 @@ Page({ }, clear() { - this.setData({loaded: false}) + this.setData({ loaded: false }) } }) diff --git a/miniprogram/packageAPI/pages/media/media-container/media-container.js b/miniprogram/packageAPI/pages/media/media-container/media-container.js index 87a48057..6982e0ad 100644 --- a/miniprogram/packageAPI/pages/media/media-container/media-container.js +++ b/miniprogram/packageAPI/pages/media/media-container/media-container.js @@ -1,4 +1,3 @@ - Page({ onShareAppMessage() { return { @@ -13,12 +12,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const canIUse = wx.canIUse('wx.createMediaContainer()') diff --git a/miniprogram/packageAPI/pages/media/video/video.js b/miniprogram/packageAPI/pages/media/video/video.js index 64249875..c289d1fd 100644 --- a/miniprogram/packageAPI/pages/media/video/video.js +++ b/miniprogram/packageAPI/pages/media/video/video.js @@ -62,12 +62,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/media/voice/voice.js b/miniprogram/packageAPI/pages/media/voice/voice.js index 377528c5..6ed6c45f 100644 --- a/miniprogram/packageAPI/pages/media/voice/voice.js +++ b/miniprogram/packageAPI/pages/media/voice/voice.js @@ -37,12 +37,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const that = this diff --git a/miniprogram/packageAPI/pages/network/download-file/download-file.js b/miniprogram/packageAPI/pages/network/download-file/download-file.js index b06c1854..5eecd142 100644 --- a/miniprogram/packageAPI/pages/network/download-file/download-file.js +++ b/miniprogram/packageAPI/pages/network/download-file/download-file.js @@ -30,12 +30,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/network/mdns/mdns.js b/miniprogram/packageAPI/pages/network/mdns/mdns.js index 4e376ff5..b85061c3 100644 --- a/miniprogram/packageAPI/pages/network/mdns/mdns.js +++ b/miniprogram/packageAPI/pages/network/mdns/mdns.js @@ -71,7 +71,6 @@ Page({ }) }, - // 监听列表 onLocalService() { const that = this @@ -135,12 +134,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/network/request/request.js b/miniprogram/packageAPI/pages/network/request/request.js index ddf8b842..5c228338 100644 --- a/miniprogram/packageAPI/pages/network/request/request.js +++ b/miniprogram/packageAPI/pages/network/request/request.js @@ -20,7 +20,7 @@ Page({ wx.request({ url: requestUrl, data: { - theme: 'light', + theme: 'light', noncestr: Date.now() }, success(result) { @@ -36,7 +36,7 @@ Page({ console.log('request success', result) }, - fail({errMsg}) { + fail({ errMsg }) { console.log('request fail', errMsg) self.setData({ loading: false @@ -51,12 +51,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/network/udp-socket/udp-socket.js b/miniprogram/packageAPI/pages/network/udp-socket/udp-socket.js index 0a9e8681..df518b85 100644 --- a/miniprogram/packageAPI/pages/network/udp-socket/udp-socket.js +++ b/miniprogram/packageAPI/pages/network/udp-socket/udp-socket.js @@ -1,4 +1,3 @@ - const AB2String = (arrayBuffer) => { const unit8Arr = new Uint8Array(arrayBuffer) const encodedString = String.fromCharCode.apply(null, unit8Arr) @@ -29,12 +28,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const canIUse = wx.canIUse('createUDPSocket') @@ -58,7 +57,7 @@ Page({ startUDP: true, }) this.remoteUDPSocket.onMessage((res) => { - const {remoteInfo} = res + const { remoteInfo } = res console.log(res) wx.showModal({ title: `IP:${remoteInfo.address}发来的信息`, @@ -101,5 +100,4 @@ Page({ }) }, - }) diff --git a/miniprogram/packageAPI/pages/network/upload-file/upload-file.js b/miniprogram/packageAPI/pages/network/upload-file/upload-file.js index d7aab8d4..4f7f401f 100644 --- a/miniprogram/packageAPI/pages/network/upload-file/upload-file.js +++ b/miniprogram/packageAPI/pages/network/upload-file/upload-file.js @@ -13,7 +13,7 @@ Page({ count: 1, sizeType: ['compressed'], sourceType: ['album'], - success: async function(res) { + async success(res) { const imageSrc = res.tempFilePaths[0] const r = await wx.cloud.callFunction({ name: 'login', @@ -21,10 +21,10 @@ Page({ action: 'openid' }, }) - const openId = r.result.openid; + const openId = r.result.openid const cloudPath = `upload/${openId}.png` wx.cloud.uploadFile({ - cloudPath, // 上传至云端的路径 + cloudPath, // 上传至云端的路径 filePath: imageSrc, // 小程序临时文件路径 config: { env: 'release-b86096' @@ -44,7 +44,7 @@ Page({ fileID: res.fileID, }) }, - fail({errMsg}) { + fail({ errMsg }) { console.log('uploadImage fail, errMsg is', errMsg) } }) @@ -59,26 +59,25 @@ Page({ } }) }, + onUnload() { if (this.data.fileID) { wx.cloud.deleteFile({ fileList: [this.data.fileID] }) } - }, - onUnload() { if (wx.offThemeChange) { wx.offThemeChange() } }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/network/web-socket/web-socket.js b/miniprogram/packageAPI/pages/network/web-socket/web-socket.js index ae0e1a3b..e40a991a 100644 --- a/miniprogram/packageAPI/pages/network/web-socket/web-socket.js +++ b/miniprogram/packageAPI/pages/network/web-socket/web-socket.js @@ -14,7 +14,6 @@ function showSuccess(title) { }) } - Page({ onShareAppMessage() { return { @@ -32,15 +31,16 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + this.closeSocket() }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const self = this @@ -63,10 +63,6 @@ Page({ // }) }, - onUnload() { - this.closeSocket() - }, - toggleSocket(e) { const turnedOn = e.detail.value @@ -91,7 +87,7 @@ Page({ wx.onSocketClose(() => { console.log('WebSocket 已断开') - this.setData({socketStatus: 'closed'}) + this.setData({ socketStatus: 'closed' }) }) wx.onSocketError(error => { @@ -122,7 +118,7 @@ Page({ wx.closeSocket({ success: () => { showSuccess('Socket已断开') - this.setData({socketStatus: 'closed'}) + this.setData({ socketStatus: 'closed' }) } }) } diff --git a/miniprogram/packageAPI/pages/page/action-sheet/action-sheet.js b/miniprogram/packageAPI/pages/page/action-sheet/action-sheet.js index 380b9982..0d85ba4d 100644 --- a/miniprogram/packageAPI/pages/page/action-sheet/action-sheet.js +++ b/miniprogram/packageAPI/pages/page/action-sheet/action-sheet.js @@ -21,12 +21,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/animation/animation.js b/miniprogram/packageAPI/pages/page/animation/animation.js index cc00e08f..19615dae 100644 --- a/miniprogram/packageAPI/pages/page/animation/animation.js +++ b/miniprogram/packageAPI/pages/page/animation/animation.js @@ -18,12 +18,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const canIUse = this.animate !== undefined @@ -39,24 +39,24 @@ Page({ change() { this.animate('#container1', [ - {opacity: 1.0, rotate: 0, backgroundColor: '#FF0000'}, + { opacity: 1.0, rotate: 0, backgroundColor: '#FF0000' }, { opacity: 0.5, rotate: 45, backgroundColor: '#00FF00', offset: 0.9 }, - {opacity: 0.0, rotate: 90, backgroundColor: '#FF0000'}, + { opacity: 0.0, rotate: 90, backgroundColor: '#FF0000' }, ], 5000, function () { - this.clearAnimation('#container1', {opacity: true, rotate: true}, function () { + this.clearAnimation('#container1', { opacity: true, rotate: true }, function () { console.log('清除了#container上的动画属性') }) }.bind(this)) this.animate('.block1', [ - {scale: [1, 1], rotate: 0, ease: 'ease-out'}, + { scale: [1, 1], rotate: 0, ease: 'ease-out' }, { scale: [1.5, 1.5], rotate: 45, ease: 'ease-in', offset: 0.9 }, - {scale: [2, 2], rotate: 90}, + { scale: [2, 2], rotate: 90 }, ], 5000, function () { - this.clearAnimation('.block1', {scale: true, rotate: true}, function () { + this.clearAnimation('.block1', { scale: true, rotate: true }, function () { console.log('清除了.block1上的动画属性') }) }.bind(this)) diff --git a/miniprogram/packageAPI/pages/page/canvas/canvas.js b/miniprogram/packageAPI/pages/page/canvas/canvas.js index 49f1c744..59c563be 100644 --- a/miniprogram/packageAPI/pages/page/canvas/canvas.js +++ b/miniprogram/packageAPI/pages/page/canvas/canvas.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.context = wx.createContext() diff --git a/miniprogram/packageAPI/pages/page/get-wxml-node-info/get-wxml-node-info.js b/miniprogram/packageAPI/pages/page/get-wxml-node-info/get-wxml-node-info.js index 1d114a33..fa91ac6a 100644 --- a/miniprogram/packageAPI/pages/page/get-wxml-node-info/get-wxml-node-info.js +++ b/miniprogram/packageAPI/pages/page/get-wxml-node-info/get-wxml-node-info.js @@ -28,11 +28,11 @@ Page({ for (const key in rect) { if (key !== 'id' && key !== 'dataset') { const val = rect[key] - metrics.push({key, val}) + metrics.push({ key, val }) } } - this.setData({metrics}) + this.setData({ metrics }) } }) }, @@ -43,12 +43,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/intersection-observer/intersection-observer.js b/miniprogram/packageAPI/pages/page/intersection-observer/intersection-observer.js index 671153c9..b221dc60 100644 --- a/miniprogram/packageAPI/pages/page/intersection-observer/intersection-observer.js +++ b/miniprogram/packageAPI/pages/page/intersection-observer/intersection-observer.js @@ -14,15 +14,16 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + if (this._observer) this._observer.disconnect() }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this._observer = wx.createIntersectionObserver(this) @@ -34,8 +35,5 @@ Page({ appear: res.intersectionRatio > 0 }) }) - }, - onUnload() { - if (this._observer) this._observer.disconnect() } }) diff --git a/miniprogram/packageAPI/pages/page/modal/modal.js b/miniprogram/packageAPI/pages/page/modal/modal.js index 6ca7ca3b..96144c77 100644 --- a/miniprogram/packageAPI/pages/page/modal/modal.js +++ b/miniprogram/packageAPI/pages/page/modal/modal.js @@ -33,12 +33,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/navigation-bar-loading/navigation-bar-loading.js b/miniprogram/packageAPI/pages/page/navigation-bar-loading/navigation-bar-loading.js index 338cd7b6..e4f7759e 100644 --- a/miniprogram/packageAPI/pages/page/navigation-bar-loading/navigation-bar-loading.js +++ b/miniprogram/packageAPI/pages/page/navigation-bar-loading/navigation-bar-loading.js @@ -19,12 +19,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/navigator/navigator.js b/miniprogram/packageAPI/pages/page/navigator/navigator.js index ab183fbb..7aef205e 100644 --- a/miniprogram/packageAPI/pages/page/navigator/navigator.js +++ b/miniprogram/packageAPI/pages/page/navigator/navigator.js @@ -7,7 +7,7 @@ Page({ }, navigateTo() { - wx.navigateTo({url: './navigator'}) + wx.navigateTo({ url: './navigator' }) }, navigateBack() { @@ -15,15 +15,15 @@ Page({ }, redirectTo() { - wx.redirectTo({url: './navigator'}) + wx.redirectTo({ url: './navigator' }) }, switchTab() { - wx.switchTab({url: '/page/component/index'}) + wx.switchTab({ url: '/page/component/index' }) }, reLaunch() { - wx.reLaunch({url: '/page/component/index'}) + wx.reLaunch({ url: '/page/component/index' }) }, onUnload() { if (wx.offThemeChange) { @@ -32,12 +32,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/page-scroll/page-scroll.js b/miniprogram/packageAPI/pages/page/page-scroll/page-scroll.js index df59b257..4fb36727 100644 --- a/miniprogram/packageAPI/pages/page/page-scroll/page-scroll.js +++ b/miniprogram/packageAPI/pages/page/page-scroll/page-scroll.js @@ -26,12 +26,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/pull-down-refresh/pull-down-refresh.js b/miniprogram/packageAPI/pages/page/pull-down-refresh/pull-down-refresh.js index f909f88a..9b88457c 100644 --- a/miniprogram/packageAPI/pages/page/pull-down-refresh/pull-down-refresh.js +++ b/miniprogram/packageAPI/pages/page/pull-down-refresh/pull-down-refresh.js @@ -29,12 +29,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/set-navigation-bar-title/set-navigation-bar-title.js b/miniprogram/packageAPI/pages/page/set-navigation-bar-title/set-navigation-bar-title.js index ff89c480..e2ab22a0 100644 --- a/miniprogram/packageAPI/pages/page/set-navigation-bar-title/set-navigation-bar-title.js +++ b/miniprogram/packageAPI/pages/page/set-navigation-bar-title/set-navigation-bar-title.js @@ -28,12 +28,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/page/toast/toast.js b/miniprogram/packageAPI/pages/page/toast/toast.js index a940d1be..0bca9545 100644 --- a/miniprogram/packageAPI/pages/page/toast/toast.js +++ b/miniprogram/packageAPI/pages/page/toast/toast.js @@ -37,12 +37,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/performance/get-performance/get-performance.js b/miniprogram/packageAPI/pages/performance/get-performance/get-performance.js index 5f6f8346..22ffdfb3 100644 --- a/miniprogram/packageAPI/pages/performance/get-performance/get-performance.js +++ b/miniprogram/packageAPI/pages/performance/get-performance/get-performance.js @@ -5,7 +5,6 @@ const util = require('./util') const performance = wx.getPerformance ? wx.getPerformance() : {} const performanceObserver = performance.createObserver ? performance.createObserver() : null - Page({ onShareAppMessage() { return { @@ -25,12 +24,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } console.log('canIUse:getPerformance:', wx.canIUse('getPerformance')) @@ -60,7 +59,7 @@ Page({ startObserver() { // 监听需要的性能指标 - performanceObserver.observe({entryTypes: ['render', 'script', 'navigation']}) + performanceObserver.observe({ entryTypes: ['render', 'script', 'navigation'] }) }, stopObserver() { diff --git a/miniprogram/packageAPI/pages/storage/get-background-fetch-data/get-background-fetch-data.js b/miniprogram/packageAPI/pages/storage/get-background-fetch-data/get-background-fetch-data.js index 5de96a30..95fc8e10 100644 --- a/miniprogram/packageAPI/pages/storage/get-background-fetch-data/get-background-fetch-data.js +++ b/miniprogram/packageAPI/pages/storage/get-background-fetch-data/get-background-fetch-data.js @@ -25,7 +25,7 @@ Page({ fetchType: 'periodic', success(res) { console.log(res) - const {fetchedData} = res + const { fetchedData } = res const result = JSON.parse(fetchedData) that.setData({ appid: result.appid, @@ -60,12 +60,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/storage/get-background-prefetch-data/get-background-prefetch-data.js b/miniprogram/packageAPI/pages/storage/get-background-prefetch-data/get-background-prefetch-data.js index 4cef2ed3..07a13389 100644 --- a/miniprogram/packageAPI/pages/storage/get-background-prefetch-data/get-background-prefetch-data.js +++ b/miniprogram/packageAPI/pages/storage/get-background-prefetch-data/get-background-prefetch-data.js @@ -44,7 +44,7 @@ Page({ if (wx.getBackgroundFetchData) { console.log('读取预拉取数据') const res = app.globalData.backgroundFetchData - const {fetchedData} = res + const { fetchedData } = res const result = JSON.parse(fetchedData) const systemInfo = wx.getSystemInfoSync() const timeStamp = systemInfo.brand === 'iPhone' ? res.timeStamp * 1000 : res.timeStamp @@ -71,11 +71,11 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/storage/storage/storage.js b/miniprogram/packageAPI/pages/storage/storage/storage.js index 6f7ec126..a77326fe 100644 --- a/miniprogram/packageAPI/pages/storage/storage/storage.js +++ b/miniprogram/packageAPI/pages/storage/storage/storage.js @@ -26,7 +26,7 @@ Page({ }, getStorage() { - const {key, data} = this.data + const { key, data } = this.data let storageData if (key.length === 0) { @@ -64,7 +64,7 @@ Page({ }, setStorage() { - const {key, data} = this.data + const { key, data } = this.data if (key.length === 0) { this.setData({ key, @@ -104,12 +104,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageAPI/pages/worker/worker/worker.js b/miniprogram/packageAPI/pages/worker/worker/worker.js index c5b0ce63..5e1d60d1 100644 --- a/miniprogram/packageAPI/pages/worker/worker/worker.js +++ b/miniprogram/packageAPI/pages/worker/worker/worker.js @@ -1,4 +1,4 @@ -const {fib} = require('../../../../util/util.js') +const { fib } = require('../../../../util/util.js') Page({ onShareAppMessage() { @@ -18,29 +18,27 @@ Page({ if (wx.offThemeChange) { wx.offThemeChange() } + clearInterval(this.interval) + if (this._worker) this._worker.terminate() }, + onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this._worker = wx.createWorker('workers/fib/index.js') }, - onUnload() { - clearInterval(this.interval) - if (this._worker) this._worker.terminate() - }, - bindInput(e) { const val = Number(e.detail.value) - if (val > 40) return {value: 40} - if (Number.isNaN(val)) return {value: 33} + if (val > 40) return { value: 40 } + if (Number.isNaN(val)) return { value: 33 } this.setData({ input: val }) @@ -48,7 +46,7 @@ Page({ }, reset() { - this.setData({res: ''}) + this.setData({ res: '' }) }, compute() { diff --git a/miniprogram/packageAPI/pages/worker/worker/worker/worker.js b/miniprogram/packageAPI/pages/worker/worker/worker/worker.js index bfda3297..8f3d260a 100644 --- a/miniprogram/packageAPI/pages/worker/worker/worker/worker.js +++ b/miniprogram/packageAPI/pages/worker/worker/worker/worker.js @@ -12,56 +12,56 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onLoad: function (options) { + onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { + onReady() { }, /** * 生命周期函数--监听页面显示 */ - onShow: function () { + onShow() { }, /** * 生命周期函数--监听页面隐藏 */ - onHide: function () { + onHide() { }, /** * 生命周期函数--监听页面卸载 */ - onUnload: function () { + onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ - onPullDownRefresh: function () { + onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function () { + onReachBottom() { }, /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageChatTool/components/apiCategory/index.js b/miniprogram/packageChatTool/components/apiCategory/index.js index a9b4b70c..d2775c04 100644 --- a/miniprogram/packageChatTool/components/apiCategory/index.js +++ b/miniprogram/packageChatTool/components/apiCategory/index.js @@ -11,7 +11,7 @@ Component({ data: { apiCategory: '', }, - + methods: { }, @@ -19,7 +19,7 @@ Component({ pageLifetimes: { show() { const apiCategory = wx.getApiCategory() - this.setData({apiCategory}) + this.setData({ apiCategory }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageChatTool/pages/activity_create/index.js b/miniprogram/packageChatTool/pages/activity_create/index.js index 26834fc5..4f64a1cc 100644 --- a/miniprogram/packageChatTool/pages/activity_create/index.js +++ b/miniprogram/packageChatTool/pages/activity_create/index.js @@ -79,34 +79,34 @@ Page({ }, showPicker(e) { - const { mode } = e.currentTarget.dataset; + const { mode } = e.currentTarget.dataset this.setData({ mode, [`${mode}Visible`]: true, - }); + }) }, hidePicker() { - const { mode } = this.data; + const { mode } = this.data this.setData({ [`${mode}Visible`]: false, - }); + }) }, onConfirm(e) { - const { value } = e.detail; - const { mode, dateOption } = this.data; + const { value } = e.detail + const { mode, dateOption } = this.data - console.log('confirm', value); + console.log('confirm', value) this.setData({ [mode]: value, [`${mode}Text${dateOption}`]: value, - }); + }) - this.hidePicker(); + this.hidePicker() }, onColumnChange(e) { - console.log('pick', e.detail.value); + console.log('pick', e.detail.value) }, chooseShareImage() { @@ -125,7 +125,7 @@ Page({ wx.cloud.uploadFile({ cloudPath: `image-${Date.now()}.png`, // 上传至云端的路径 - filePath: shareImage, + filePath: shareImage, success: res => { // 返回文件 ID console.log('uploadFile: ', res.fileID) @@ -220,7 +220,6 @@ Page({ if (!activityId) { this.createActivityID(() => { this.publish() - return }) } @@ -270,7 +269,7 @@ Page({ }) }, fail(res) { - console.info("updateShareMenu fail: ", res) + console.info('updateShareMenu fail: ', res) wx.showToast({ title: '分享失败', icon: 'none' @@ -293,4 +292,4 @@ Page({ }) }) }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageChatTool/pages/activity_detail/index.js b/miniprogram/packageChatTool/pages/activity_detail/index.js index f635c0d7..adaca218 100644 --- a/miniprogram/packageChatTool/pages/activity_detail/index.js +++ b/miniprogram/packageChatTool/pages/activity_detail/index.js @@ -5,7 +5,7 @@ const roleType = ['unkown', 'owner', 'participant', 'nonParticipant'] const activityStatus = ['未开始', '进行中', '已结束'] -const {envVersion} = wx.getAccountInfoSync().miniProgram +const { envVersion } = wx.getAccountInfoSync().miniProgram const getVersionType = () => { if (envVersion === 'release') { @@ -77,12 +77,11 @@ Page({ console.log('onAbort', e) }, - onGoHome() { wx.reLaunch({ url: '/packageAPI/pages/chattool/activity_assist/activity_assist', complete(res) { - console.info("relaunch", res) + console.info('relaunch', res) } }) }, @@ -155,7 +154,6 @@ Page({ console.info('fetchActivity fail: ', err) }) }) - }, onTabsChange(e) { @@ -255,7 +253,7 @@ Page({ action: 'updateChatToolMsg', activityId: this.data.activityId, targetState: targetState || 1, - templateId: templateId, + templateId, parameterList: parameterList || [], versionType: getVersionType() } @@ -270,7 +268,7 @@ Page({ const that = this setTimeout(() => { this.createSelectorQuery() - .select("#target") + .select('#target') .node() .exec(res => { const node = res[0].node @@ -295,7 +293,7 @@ Page({ }, sendProgress() { - const { progressImage, activityId} = this.data + const { progressImage, activityId } = this.data const entrancePath = `packageChatTool/pages/activity_detail/index?activityId=${activityId}` wx.shareImageToGroup({ imagePath: progressImage, @@ -323,4 +321,4 @@ Page({ fail: console.error }) }, -}) \ No newline at end of file +}) diff --git a/miniprogram/packageChatTool/util.js b/miniprogram/packageChatTool/util.js index 92fa5c0d..258fa8fd 100644 --- a/miniprogram/packageChatTool/util.js +++ b/miniprogram/packageChatTool/util.js @@ -34,8 +34,8 @@ export function getChatToolInfo() { reject(res) }, complete(res) { - console.info('getChatToolInfo complete: ',res) + console.info('getChatToolInfo complete: ', res) } }) }) -} \ No newline at end of file +} diff --git a/miniprogram/packageCloud/pages/database/crud/crud.js b/miniprogram/packageCloud/pages/database/crud/crud.js index 351496c1..68105246 100644 --- a/miniprogram/packageCloud/pages/database/crud/crud.js +++ b/miniprogram/packageCloud/pages/database/crud/crud.js @@ -28,12 +28,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (app.globalData.openid) { @@ -74,12 +74,12 @@ Page({ if (this.data.loading) { return } - const {newContent} = this.data + const { newContent } = this.data if (!newContent) { return } - this.setData({loading: true}) + this.setData({ loading: true }) const db = wx.cloud.database() db.collection('todos').add({ data: { @@ -113,7 +113,7 @@ Page({ console.error('[数据库] [新增记录] 失败:', err) }, complete: () => { - this.setData({loading: false}) + this.setData({ loading: false }) } }) }, @@ -148,7 +148,7 @@ Page({ }, searchTodo() { - const {searchContent} = this.data + const { searchContent } = this.data if (!searchContent) { this.queryTodoList() return @@ -194,13 +194,13 @@ Page({ if (this.data.loading) { return } - const {id: todoId, index} = e.currentTarget.dataset + const { id: todoId, index } = e.currentTarget.dataset const todo = this.data.todoList[index] - this.setData({loading: true}) + this.setData({ loading: true }) const db = wx.cloud.database() db.collection('todos').doc(todoId).update({ - data: {done: !todo.done}, + data: { done: !todo.done }, success: () => { this.setData({ [`todoList[${index}].done`]: !todo.done @@ -214,13 +214,13 @@ Page({ console.error('[数据库] [更新记录] 失败:', err) }, complete: () => { - this.setData({loading: false}) + this.setData({ loading: false }) } }) }, toDetail(e) { - const {id: todoId} = e.currentTarget.dataset + const { id: todoId } = e.currentTarget.dataset wx.navigateTo({ url: `/page/cloud/pages/crud-detail/crud-detail?todoId=${todoId}`, }) diff --git a/miniprogram/packageCloud/pages/database/db-permission/db-permission.js b/miniprogram/packageCloud/pages/database/db-permission/db-permission.js index 97cf0750..617198d8 100644 --- a/miniprogram/packageCloud/pages/database/db-permission/db-permission.js +++ b/miniprogram/packageCloud/pages/database/db-permission/db-permission.js @@ -47,12 +47,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (app.globalData.openid) { @@ -127,7 +127,7 @@ Page({ }, bindInput(e) { - const {name} = e.currentTarget.dataset + const { name } = e.currentTarget.dataset this.setData({ [name]: e.detail.value }) @@ -235,7 +235,7 @@ Page({ data, success: res => { console.log('[数据库] [新增记录] 成功:', res) - if (successCallback) successCallback.call(this, {_id: res._id}) + if (successCallback) successCallback.call(this, { _id: res._id }) }, fail: err => { if (showError) this.showErrorModal('设置', err) diff --git a/miniprogram/packageCloud/pages/database/server-date/server-date.js b/miniprogram/packageCloud/pages/database/server-date/server-date.js index 3401e762..1bb3910b 100644 --- a/miniprogram/packageCloud/pages/database/server-date/server-date.js +++ b/miniprogram/packageCloud/pages/database/server-date/server-date.js @@ -31,12 +31,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (app.globalData.openid) { @@ -82,7 +82,7 @@ Page({ insertOrUpdateData(existedData, data) { const db = wx.cloud.database() if (existedData._id) { - db.collection(collection).doc(existedData._id).update({data}) + db.collection(collection).doc(existedData._id).update({ data }) .then(res => { this.setCompletedData(existedData._id) return res @@ -93,7 +93,7 @@ Page({ this.completeTask() }) } else { - db.collection(collection).add({data}) + db.collection(collection).add({ data }) .then(res => { this.setCompletedData(res._id) return res diff --git a/miniprogram/packageCloud/pages/nouse/crud-detail/crud-detail.js b/miniprogram/packageCloud/pages/nouse/crud-detail/crud-detail.js index 0da36b13..e38a8c98 100644 --- a/miniprogram/packageCloud/pages/nouse/crud-detail/crud-detail.js +++ b/miniprogram/packageCloud/pages/nouse/crud-detail/crud-detail.js @@ -19,7 +19,7 @@ Page({ }, onLoad(options) { - const {todoId} = options + const { todoId } = options this.setData({ todoId }) @@ -77,12 +77,12 @@ Page({ if (this.data.updating || !this.data.todoId) { return } - const {todoId, description} = this.data + const { todoId, description } = this.data if (!description) { return } - this.setData({updating: true}) + this.setData({ updating: true }) const db = wx.cloud.database() db.collection('todos').doc(todoId).update({ data: { @@ -103,7 +103,7 @@ Page({ console.error('[数据库] [更新记录] 失败:', err) }, complete: () => { - this.setData({updating: false}) + this.setData({ updating: false }) } }) }, @@ -112,9 +112,9 @@ Page({ if (this.data.deleting || !this.data.todoId) { return } - const {todoId} = this.data + const { todoId } = this.data - this.setData({deleting: true}) + this.setData({ deleting: true }) const db = wx.cloud.database() db.collection('todos').doc(todoId).remove({ success: () => { @@ -131,7 +131,7 @@ Page({ console.error('[数据库] [删除记录] 失败:', err) }, complete: () => { - this.setData({deleting: false}) + this.setData({ deleting: false }) } }) }, diff --git a/miniprogram/packageCloud/pages/scf/get-wx-context/get-wx-context.js b/miniprogram/packageCloud/pages/scf/get-wx-context/get-wx-context.js index 685c5d4b..322474e8 100644 --- a/miniprogram/packageCloud/pages/scf/get-wx-context/get-wx-context.js +++ b/miniprogram/packageCloud/pages/scf/get-wx-context/get-wx-context.js @@ -49,12 +49,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageCloud/pages/scf/scf-database/scf-database.js b/miniprogram/packageCloud/pages/scf/scf-database/scf-database.js index bd2d37f7..f621e76f 100644 --- a/miniprogram/packageCloud/pages/scf/scf-database/scf-database.js +++ b/miniprogram/packageCloud/pages/scf/scf-database/scf-database.js @@ -26,12 +26,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageCloud/pages/scf/scf-openapi/scf-openapi.js b/miniprogram/packageCloud/pages/scf/scf-openapi/scf-openapi.js index c45b0aaf..0a0bb707 100644 --- a/miniprogram/packageCloud/pages/scf/scf-openapi/scf-openapi.js +++ b/miniprogram/packageCloud/pages/scf/scf-openapi/scf-openapi.js @@ -26,12 +26,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageCloud/pages/scf/scf-storage/scf-storage.js b/miniprogram/packageCloud/pages/scf/scf-storage/scf-storage.js index d123ecdf..7ce7bd2b 100644 --- a/miniprogram/packageCloud/pages/scf/scf-storage/scf-storage.js +++ b/miniprogram/packageCloud/pages/scf/scf-storage/scf-storage.js @@ -27,12 +27,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ diff --git a/miniprogram/packageCloud/pages/storage/cloud-file-component/cloud-file-component.js b/miniprogram/packageCloud/pages/storage/cloud-file-component/cloud-file-component.js index dc1e3c6d..f4f785b5 100644 --- a/miniprogram/packageCloud/pages/storage/cloud-file-component/cloud-file-component.js +++ b/miniprogram/packageCloud/pages/storage/cloud-file-component/cloud-file-component.js @@ -1,4 +1,4 @@ -const {demoImageFileId, demoVideoFileId} = require('../../../../config') +const { demoImageFileId, demoVideoFileId } = require('../../../../config') Page({ onShareAppMessage() { @@ -20,12 +20,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageCloud/pages/storage/delete-file/delete-file.js b/miniprogram/packageCloud/pages/storage/delete-file/delete-file.js index 06f75a94..74223819 100644 --- a/miniprogram/packageCloud/pages/storage/delete-file/delete-file.js +++ b/miniprogram/packageCloud/pages/storage/delete-file/delete-file.js @@ -23,12 +23,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ diff --git a/miniprogram/packageCloud/pages/storage/download-file/download-file.js b/miniprogram/packageCloud/pages/storage/download-file/download-file.js index c9aa920d..c63a2a5e 100644 --- a/miniprogram/packageCloud/pages/storage/download-file/download-file.js +++ b/miniprogram/packageCloud/pages/storage/download-file/download-file.js @@ -27,12 +27,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ diff --git a/miniprogram/packageCloud/pages/storage/get-temp-file-url/get-temp-file-url.js b/miniprogram/packageCloud/pages/storage/get-temp-file-url/get-temp-file-url.js index 47e6da72..c76a8a2b 100644 --- a/miniprogram/packageCloud/pages/storage/get-temp-file-url/get-temp-file-url.js +++ b/miniprogram/packageCloud/pages/storage/get-temp-file-url/get-temp-file-url.js @@ -28,12 +28,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.setData({ diff --git a/miniprogram/packageCloud/pages/storage/upload-file/upload-file.js b/miniprogram/packageCloud/pages/storage/upload-file/upload-file.js index 682227ee..8541c82f 100644 --- a/miniprogram/packageCloud/pages/storage/upload-file/upload-file.js +++ b/miniprogram/packageCloud/pages/storage/upload-file/upload-file.js @@ -24,12 +24,12 @@ Page({ }, onLoad(options) { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (options.from) { @@ -85,7 +85,7 @@ Page({ wx.hideLoading() }) }, - fail({errMsg}) { + fail({ errMsg }) { console.log('chooseImage fail, err is', errMsg) } }) diff --git a/miniprogram/packageCloud/pages/user/user-authentication/user-authentication.js b/miniprogram/packageCloud/pages/user/user-authentication/user-authentication.js index 1ee8c6e1..b89abdc0 100644 --- a/miniprogram/packageCloud/pages/user/user-authentication/user-authentication.js +++ b/miniprogram/packageCloud/pages/user/user-authentication/user-authentication.js @@ -43,12 +43,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.js b/miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.js index 07616752..7f52f326 100644 --- a/miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.js +++ b/miniprogram/packageComponent/pages/canvas/canvas-2d/canvas-2d.js @@ -1,4 +1,4 @@ -import {compareVersion} from '../../../../util/util' +import { compareVersion } from '../../../../util/util' Page({ onShareAppMessage() { @@ -18,7 +18,7 @@ Page({ }, _onReady() { // 解决基础库小于 2.7.0 的兼容问题 - const {SDKVersion} = wx.getSystemInfoSync() + const { SDKVersion } = wx.getSystemInfoSync() console.log(SDKVersion) if (compareVersion(SDKVersion, '2.7.0') < 0) { console.log('123') @@ -135,12 +135,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/canvas/canvas/canvas.js b/miniprogram/packageComponent/pages/canvas/canvas/canvas.js index b671fd4e..c7dfc578 100644 --- a/miniprogram/packageComponent/pages/canvas/canvas/canvas.js +++ b/miniprogram/packageComponent/pages/canvas/canvas/canvas.js @@ -1,4 +1,4 @@ -import {compareVersion} from '../../../../util/util' +import { compareVersion } from '../../../../util/util' Page({ @@ -11,7 +11,7 @@ Page({ }, onReady() { // 解决基础库小于 2.7.0 的兼容问题 - const {SDKVersion} = wx.getSystemInfoSync() + const { SDKVersion } = wx.getSystemInfoSync() if (compareVersion(SDKVersion, '2.7.0') < 0) { console.log('123') this.setData({ @@ -34,49 +34,49 @@ Page({ /** * 生命周期函数--监听页面初次渲染完成 */ - onReady: function () { + onReady() { }, /** * 生命周期函数--监听页面显示 */ - onShow: function () { + onShow() { }, /** * 生命周期函数--监听页面隐藏 */ - onHide: function () { + onHide() { }, /** * 生命周期函数--监听页面卸载 */ - onUnload: function () { + onUnload() { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ - onPullDownRefresh: function () { + onPullDownRefresh() { }, /** * 页面上拉触底事件的处理函数 */ - onReachBottom: function () { + onReachBottom() { }, /** * 用户点击右上角分享 */ - onShareAppMessage: function () { + onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/canvas/webgl/webgl.js b/miniprogram/packageComponent/pages/canvas/webgl/webgl.js index c38723cf..602c617b 100644 --- a/miniprogram/packageComponent/pages/canvas/webgl/webgl.js +++ b/miniprogram/packageComponent/pages/canvas/webgl/webgl.js @@ -1,4 +1,4 @@ -import {compareVersion} from '../../../../util/util' +import { compareVersion } from '../../../../util/util' // WebGL const vs = ` @@ -42,7 +42,7 @@ Page({ }, onReady() { // 解决基础库小于 2.7.0 的兼容问题 - const {SDKVersion} = wx.getSystemInfoSync() + const { SDKVersion } = wx.getSystemInfoSync() if (compareVersion(SDKVersion, '2.7.0') < 0) { console.log('123') this.setData({ @@ -129,12 +129,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/content/icon/icon.js b/miniprogram/packageComponent/pages/content/icon/icon.js index 11c19901..9958c37e 100644 --- a/miniprogram/packageComponent/pages/content/icon/icon.js +++ b/miniprogram/packageComponent/pages/content/icon/icon.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/content/progress/progress.js b/miniprogram/packageComponent/pages/content/progress/progress.js index 679b7190..f84f7c22 100644 --- a/miniprogram/packageComponent/pages/content/progress/progress.js +++ b/miniprogram/packageComponent/pages/content/progress/progress.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/content/rich-text/rich-text.js b/miniprogram/packageComponent/pages/content/rich-text/rich-text.js index 67e3b5dd..8850be01 100644 --- a/miniprogram/packageComponent/pages/content/rich-text/rich-text.js +++ b/miniprogram/packageComponent/pages/content/rich-text/rich-text.js @@ -74,12 +74,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/content/selection/selection.js b/miniprogram/packageComponent/pages/content/selection/selection.js index abf4afcc..c29a6aa8 100644 --- a/miniprogram/packageComponent/pages/content/selection/selection.js +++ b/miniprogram/packageComponent/pages/content/selection/selection.js @@ -30,12 +30,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageComponent/pages/content/text/text.js b/miniprogram/packageComponent/pages/content/text/text.js index 44a49667..1b2ccf09 100644 --- a/miniprogram/packageComponent/pages/content/text/text.js +++ b/miniprogram/packageComponent/pages/content/text/text.js @@ -69,12 +69,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/button/button.js b/miniprogram/packageComponent/pages/form/button/button.js index e22d9263..dd8a5a27 100644 --- a/miniprogram/packageComponent/pages/form/button/button.js +++ b/miniprogram/packageComponent/pages/form/button/button.js @@ -76,12 +76,12 @@ const pageObject = { }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } if (wx.getUserProfile) { diff --git a/miniprogram/packageComponent/pages/form/checkbox/checkbox.js b/miniprogram/packageComponent/pages/form/checkbox/checkbox.js index ccfa0e05..9cd716b5 100644 --- a/miniprogram/packageComponent/pages/form/checkbox/checkbox.js +++ b/miniprogram/packageComponent/pages/form/checkbox/checkbox.js @@ -9,12 +9,12 @@ Page({ data: { theme: 'light', items: [ - {value: 'USA', name: '美国'}, - {value: 'CHN', name: '中国', checked: 'true'}, - {value: 'BRA', name: '巴西'}, - {value: 'JPN', name: '日本'}, - {value: 'ENG', name: '英国'}, - {value: 'FRA', name: '法国'} + { value: 'USA', name: '美国' }, + { value: 'CHN', name: '中国', checked: 'true' }, + { value: 'BRA', name: '巴西' }, + { value: 'JPN', name: '日本' }, + { value: 'ENG', name: '英国' }, + { value: 'FRA', name: '法国' } ] }, @@ -45,12 +45,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/editor/editor.js b/miniprogram/packageComponent/pages/form/editor/editor.js index a695555f..c09469e1 100644 --- a/miniprogram/packageComponent/pages/form/editor/editor.js +++ b/miniprogram/packageComponent/pages/form/editor/editor.js @@ -27,12 +27,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } const { @@ -46,7 +46,7 @@ Page({ } this._safeHeight = safeHeight const isIOS = platform === 'ios' - this.setData({isIOS, safeHeight, toolBarHeight: isIOS ? safeHeight + 50 : 50}) + this.setData({ isIOS, safeHeight, toolBarHeight: isIOS ? safeHeight + 50 : 50 }) const that = this this.updatePosition(0) let keyboardHeight = 0 @@ -69,7 +69,7 @@ Page({ }, updatePosition(keyboardHeight) { const toolbarHeight = 50 - const {windowHeight} = wx.getSystemInfoSync() + const { windowHeight } = wx.getSystemInfoSync() let editorHeight = windowHeight if (keyboardHeight > 0) { editorHeight = windowHeight - keyboardHeight - toolbarHeight @@ -92,7 +92,7 @@ Page({ }, calNavigationBarAndStatusBar() { const systemInfo = wx.getSystemInfoSync() - const {statusBarHeight, platform} = systemInfo + const { statusBarHeight, platform } = systemInfo const isIOS = platform === 'ios' const navigationBarHeight = isIOS ? 44 : 48 return statusBarHeight + navigationBarHeight @@ -107,14 +107,14 @@ Page({ this.editorCtx.blur() }, format(e) { - const {name, value} = e.target.dataset + const { name, value } = e.target.dataset if (!name) return // console.log('format', name, value) this.editorCtx.format(name, value) }, onStatusChange(e) { const formats = e.detail - this.setData({formats}) + this.setData({ formats }) }, insertDivider() { this.editorCtx.insertDivider({ diff --git a/miniprogram/packageComponent/pages/form/form/form.js b/miniprogram/packageComponent/pages/form/form/form.js index 13ae8736..f105bd3c 100644 --- a/miniprogram/packageComponent/pages/form/form/form.js +++ b/miniprogram/packageComponent/pages/form/form/form.js @@ -50,12 +50,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/input/input.js b/miniprogram/packageComponent/pages/form/input/input.js index 5ee276f4..c324031b 100644 --- a/miniprogram/packageComponent/pages/form/input/input.js +++ b/miniprogram/packageComponent/pages/form/input/input.js @@ -10,7 +10,7 @@ Page({ theme: 'light', focus: false, inputValue: '', - style: {color: '#F76260', fontSize: 16}, + style: { color: '#F76260', fontSize: 16 }, }, bindKeyInput(e) { @@ -53,12 +53,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/label/label.js b/miniprogram/packageComponent/pages/form/label/label.js index f63ac2ae..2b220b9e 100644 --- a/miniprogram/packageComponent/pages/form/label/label.js +++ b/miniprogram/packageComponent/pages/form/label/label.js @@ -9,12 +9,12 @@ Page({ data: { theme: 'light', checkboxItems: [ - {name: 'USA', value: '美国'}, - {name: 'CHN', value: '中国', checked: 'true'} + { name: 'USA', value: '美国' }, + { name: 'CHN', value: '中国', checked: 'true' } ], radioItems: [ - {name: 'USA', value: '美国'}, - {name: 'CHN', value: '中国', checked: 'true'} + { name: 'USA', value: '美国' }, + { name: 'CHN', value: '中国', checked: 'true' } ], hidden: false }, @@ -55,12 +55,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/picker-view/picker-view.js b/miniprogram/packageComponent/pages/form/picker-view/picker-view.js index 0ee2a0a2..f25dabdf 100644 --- a/miniprogram/packageComponent/pages/form/picker-view/picker-view.js +++ b/miniprogram/packageComponent/pages/form/picker-view/picker-view.js @@ -51,12 +51,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/picker/picker.js b/miniprogram/packageComponent/pages/form/picker/picker.js index 7e8a81f9..610cdf25 100644 --- a/miniprogram/packageComponent/pages/form/picker/picker.js +++ b/miniprogram/packageComponent/pages/form/picker/picker.js @@ -39,12 +39,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/radio/radio.js b/miniprogram/packageComponent/pages/form/radio/radio.js index bf3e8b4b..fcc918d7 100644 --- a/miniprogram/packageComponent/pages/form/radio/radio.js +++ b/miniprogram/packageComponent/pages/form/radio/radio.js @@ -9,12 +9,12 @@ Page({ data: { theme: 'light', items: [ - {value: 'USA', name: '美国'}, - {value: 'CHN', name: '中国', checked: 'true'}, - {value: 'BRA', name: '巴西'}, - {value: 'JPN', name: '日本'}, - {value: 'ENG', name: '英国'}, - {value: 'FRA', name: '法国'}, + { value: 'USA', name: '美国' }, + { value: 'CHN', name: '中国', checked: 'true' }, + { value: 'BRA', name: '巴西' }, + { value: 'JPN', name: '日本' }, + { value: 'ENG', name: '英国' }, + { value: 'FRA', name: '法国' }, ] }, @@ -37,12 +37,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/slider/slider.js b/miniprogram/packageComponent/pages/form/slider/slider.js index 15286272..d960adfe 100644 --- a/miniprogram/packageComponent/pages/form/slider/slider.js +++ b/miniprogram/packageComponent/pages/form/slider/slider.js @@ -15,12 +15,12 @@ const pageData = { }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/switch/switch.js b/miniprogram/packageComponent/pages/form/switch/switch.js index e62bdf64..ae2d5e06 100644 --- a/miniprogram/packageComponent/pages/form/switch/switch.js +++ b/miniprogram/packageComponent/pages/form/switch/switch.js @@ -23,12 +23,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/form/textarea/textarea.js b/miniprogram/packageComponent/pages/form/textarea/textarea.js index 9a7cc173..9f58017b 100644 --- a/miniprogram/packageComponent/pages/form/textarea/textarea.js +++ b/miniprogram/packageComponent/pages/form/textarea/textarea.js @@ -21,12 +21,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/map/map/map.js b/miniprogram/packageComponent/pages/map/map/map.js index ae98a5af..8351789c 100644 --- a/miniprogram/packageComponent/pages/map/map/map.js +++ b/miniprogram/packageComponent/pages/map/map/map.js @@ -96,12 +96,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/media/camera/camera.js b/miniprogram/packageComponent/pages/media/camera/camera.js index 47f5e1ec..f3dab07b 100644 --- a/miniprogram/packageComponent/pages/media/camera/camera.js +++ b/miniprogram/packageComponent/pages/media/camera/camera.js @@ -111,14 +111,11 @@ function createRenderer(canvas, width, height) { return (arrayBuffer, width, height) => { gl.bindTexture(gl.TEXTURE_2D, texture) - gl.texImage2D( - gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, arrayBuffer - ) + gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, arrayBuffer) gl.drawElements(gl.TRIANGLES, 6, gl.UNSIGNED_SHORT, 0) } } - Page({ onShareAppMessage() { return { @@ -232,12 +229,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/media/channel-live/channel-live.js b/miniprogram/packageComponent/pages/media/channel-live/channel-live.js index 14e69279..e135a045 100644 --- a/miniprogram/packageComponent/pages/media/channel-live/channel-live.js +++ b/miniprogram/packageComponent/pages/media/channel-live/channel-live.js @@ -2,11 +2,11 @@ const app = getApp() Page({ data: { - feedId: 'export/UzFfAgtgekIEAQAAAAAAQ3s56WvdaQAAAAstQy6ubaLX4KHWvLEZgBPEjYMcaThvAvSDzNPgMJpU00S4DKmOC1N5VwE8t9F-' + feedId: 'export/UzFfAgtgekIEAQAAAAAAQ3s56WvdaQAAAAstQy6ubaLX4KHWvLEZgBPEjYMcaThvAvSDzNPgMJpU00S4DKmOC1N5VwE8t9F-' }, onLoad() { - // this.getliveinfo() - // this.openlive() + // this.getliveinfo() + // this.openlive() console.log('代码片段是一种迷你、可分享的小程序或小游戏项目,可用于分享小程序和小游戏的开发经验、展示组件和 API 的使用、复现开发问题和 Bug 等。可点击以下链接查看代码片段的详细文档:') console.log('https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/devtools.html') }, diff --git a/miniprogram/packageComponent/pages/media/channel-video/channel-video.js b/miniprogram/packageComponent/pages/media/channel-video/channel-video.js index 0b0feada..0cad242f 100644 --- a/miniprogram/packageComponent/pages/media/channel-video/channel-video.js +++ b/miniprogram/packageComponent/pages/media/channel-video/channel-video.js @@ -5,7 +5,7 @@ Page({ * 页面的初始数据 */ data: { - feedId: 'export/UzFfAgtgekIEAQAAAAAAQ3s56WvdaQAAAAstQy6ubaLX4KHWvLEZgBPEjYMcaThvAvSDzNPgMJpU00S4DKmOC1N5VwE8t9F-' + feedId: 'export/UzFfAgtgekIEAQAAAAAAQ3s56WvdaQAAAAstQy6ubaLX4KHWvLEZgBPEjYMcaThvAvSDzNPgMJpU00S4DKmOC1N5VwE8t9F-' }, /** @@ -63,4 +63,4 @@ Page({ onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/media/image/image.js b/miniprogram/packageComponent/pages/media/image/image.js index fbf48206..d7c73e18 100644 --- a/miniprogram/packageComponent/pages/media/image/image.js +++ b/miniprogram/packageComponent/pages/media/image/image.js @@ -1,4 +1,3 @@ - Page({ onShareAppMessage() { return { @@ -13,12 +12,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } wx.cloud.getTempFileURL({ diff --git a/miniprogram/packageComponent/pages/media/live-player/live-player.js b/miniprogram/packageComponent/pages/media/live-player/live-player.js index d257e6e8..d35eab2e 100644 --- a/miniprogram/packageComponent/pages/media/live-player/live-player.js +++ b/miniprogram/packageComponent/pages/media/live-player/live-player.js @@ -15,7 +15,7 @@ Page({ handleScanQRCode() { wx.scanCode({ complete: (res) => { - const {result} = res + const { result } = res this.setData({ videoSrc: result }) @@ -90,12 +90,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/media/live-pusher/live-pusher.js b/miniprogram/packageComponent/pages/media/live-pusher/live-pusher.js index 07cf04a8..fec24df3 100644 --- a/miniprogram/packageComponent/pages/media/live-pusher/live-pusher.js +++ b/miniprogram/packageComponent/pages/media/live-pusher/live-pusher.js @@ -31,7 +31,7 @@ Page({ handleScanQRCode() { wx.scanCode({ complete: (res) => { - const {result} = res + const { result } = res this.setData({ videoSrc: result }) @@ -90,12 +90,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/media/video/picture-in-picture.js b/miniprogram/packageComponent/pages/media/video/picture-in-picture.js index d18aff8d..a7faab3d 100644 --- a/miniprogram/packageComponent/pages/media/video/picture-in-picture.js +++ b/miniprogram/packageComponent/pages/media/video/picture-in-picture.js @@ -9,15 +9,14 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } - }, onReady() { diff --git a/miniprogram/packageComponent/pages/media/video/video.js b/miniprogram/packageComponent/pages/media/video/video.js index 4f6cd7ad..7a79ccb7 100644 --- a/miniprogram/packageComponent/pages/media/video/video.js +++ b/miniprogram/packageComponent/pages/media/video/video.js @@ -93,12 +93,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/nav/navigator/navigate.js b/miniprogram/packageComponent/pages/nav/navigator/navigate.js index 87a5e0e4..fea3fc29 100644 --- a/miniprogram/packageComponent/pages/nav/navigator/navigate.js +++ b/miniprogram/packageComponent/pages/nav/navigator/navigate.js @@ -15,12 +15,12 @@ Page({ }, onLoad(options) { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/nav/navigator/navigator.js b/miniprogram/packageComponent/pages/nav/navigator/navigator.js index d90e8905..e5b301d2 100644 --- a/miniprogram/packageComponent/pages/nav/navigator/navigator.js +++ b/miniprogram/packageComponent/pages/nav/navigator/navigator.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/nav/navigator/redirect.js b/miniprogram/packageComponent/pages/nav/navigator/redirect.js index 94202e81..cff3bc03 100644 --- a/miniprogram/packageComponent/pages/nav/navigator/redirect.js +++ b/miniprogram/packageComponent/pages/nav/navigator/redirect.js @@ -15,12 +15,12 @@ Page({ }, onLoad(options) { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } console.log(options) diff --git a/miniprogram/packageComponent/pages/obstacle-free/aria-component/aria-component.js b/miniprogram/packageComponent/pages/obstacle-free/aria-component/aria-component.js index 139be091..2d3fa45d 100644 --- a/miniprogram/packageComponent/pages/obstacle-free/aria-component/aria-component.js +++ b/miniprogram/packageComponent/pages/obstacle-free/aria-component/aria-component.js @@ -16,12 +16,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/official-account/official-account.js b/miniprogram/packageComponent/pages/official-account/official-account.js index d2c55547..0b22cab6 100644 --- a/miniprogram/packageComponent/pages/official-account/official-account.js +++ b/miniprogram/packageComponent/pages/official-account/official-account.js @@ -12,22 +12,16 @@ Page({ /** * 生命周期函数--监听页面加载 */ - onUnload() { - if (wx.offThemeChange) { - wx.offThemeChange() - } - }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } - }, /** @@ -55,7 +49,9 @@ Page({ * 生命周期函数--监听页面卸载 */ onUnload() { - + if (wx.offThemeChange) { + wx.offThemeChange() + } }, /** diff --git a/miniprogram/packageComponent/pages/open/ad/ad.js b/miniprogram/packageComponent/pages/open/ad/ad.js index 1f675868..125b25cd 100644 --- a/miniprogram/packageComponent/pages/open/ad/ad.js +++ b/miniprogram/packageComponent/pages/open/ad/ad.js @@ -20,36 +20,36 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) const res = wx.getExptInfoSync(['expt_args_2']) if (res.expt_args_2 === undefined) { - // 返回空对象;未命中实验、实验待发布(白名单除外)或者实验结束后会命中该分支 - /* 业务逻辑,可对齐线上 */ + // 返回空对象;未命中实验、实验待发布(白名单除外)或者实验结束后会命中该分支 + /* 业务逻辑,可对齐线上 */ } else if (res.expt_args_2 == '0') { - /* 对照组业务逻辑 */ - this.setData({ - index: 1 - }) + /* 对照组业务逻辑 */ + this.setData({ + index: 1 + }) } else if (res.expt_args_2 == '1') { - /* 实验组1业务逻辑 */ - this.setData({ - index: 2 - }) + /* 实验组1业务逻辑 */ + this.setData({ + index: 2 + }) } else if (res.expt_args_2 == '2') { - /* 实验组2业务逻辑 */ - this.setData({ - index: 3 - }) + /* 实验组2业务逻辑 */ + this.setData({ + index: 3 + }) } else { - /* 异常分支逻辑 */ - console.log('error') - } + /* 异常分支逻辑 */ + console.log('error') + } if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/open/open-data/open-data.js b/miniprogram/packageComponent/pages/open/open-data/open-data.js index 33966b40..5c718e9b 100644 --- a/miniprogram/packageComponent/pages/open/open-data/open-data.js +++ b/miniprogram/packageComponent/pages/open/open-data/open-data.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/open/web-view/web-view.js b/miniprogram/packageComponent/pages/open/web-view/web-view.js index 14bae8ee..ec119030 100644 --- a/miniprogram/packageComponent/pages/open/web-view/web-view.js +++ b/miniprogram/packageComponent/pages/open/web-view/web-view.js @@ -15,12 +15,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/view/cover-view/cover-view.js b/miniprogram/packageComponent/pages/view/cover-view/cover-view.js index 9937a1d2..e0773595 100644 --- a/miniprogram/packageComponent/pages/view/cover-view/cover-view.js +++ b/miniprogram/packageComponent/pages/view/cover-view/cover-view.js @@ -18,12 +18,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/view/grid-view/demo-1/demo-1.js b/miniprogram/packageComponent/pages/view/grid-view/demo-1/demo-1.js index 2ba43565..8ef26191 100644 --- a/miniprogram/packageComponent/pages/view/grid-view/demo-1/demo-1.js +++ b/miniprogram/packageComponent/pages/view/grid-view/demo-1/demo-1.js @@ -67,4 +67,4 @@ Page({ onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/view/grid-view/demo-2/demo-2.js b/miniprogram/packageComponent/pages/view/grid-view/demo-2/demo-2.js index 2ab17152..df27e831 100644 --- a/miniprogram/packageComponent/pages/view/grid-view/demo-2/demo-2.js +++ b/miniprogram/packageComponent/pages/view/grid-view/demo-2/demo-2.js @@ -68,4 +68,4 @@ Page({ onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/view/grid-view/grid-view.js b/miniprogram/packageComponent/pages/view/grid-view/grid-view.js index fa4e8c34..6b90f6bc 100644 --- a/miniprogram/packageComponent/pages/view/grid-view/grid-view.js +++ b/miniprogram/packageComponent/pages/view/grid-view/grid-view.js @@ -10,16 +10,14 @@ Page({ go1() { wx.navigateTo({ - url: './demo-1/demo-1', - }) + url: './demo-1/demo-1', + }) }, - goGrid1() { wx.navigateTo({ - url: './demo-2/demo-2', + url: './demo-2/demo-2', }) }, - }) diff --git a/miniprogram/packageComponent/pages/view/match-media/match-media.js b/miniprogram/packageComponent/pages/view/match-media/match-media.js index 51826421..1eaf2515 100644 --- a/miniprogram/packageComponent/pages/view/match-media/match-media.js +++ b/miniprogram/packageComponent/pages/view/match-media/match-media.js @@ -16,12 +16,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/view/movable-view/movable-view.js b/miniprogram/packageComponent/pages/view/movable-view/movable-view.js index 2c46d624..44560fc7 100644 --- a/miniprogram/packageComponent/pages/view/movable-view/movable-view.js +++ b/miniprogram/packageComponent/pages/view/movable-view/movable-view.js @@ -40,12 +40,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/view/page-container/page-container.js b/miniprogram/packageComponent/pages/view/page-container/page-container.js index 69fbcab3..873e6024 100644 --- a/miniprogram/packageComponent/pages/view/page-container/page-container.js +++ b/miniprogram/packageComponent/pages/view/page-container/page-container.js @@ -22,12 +22,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, @@ -51,10 +51,10 @@ Page({ }) }, changeRound() { - this.setData({round: !this.data.round}) + this.setData({ round: !this.data.round }) }, changeOverlay() { - this.setData({overlay: !this.data.overlay, show: true}) + this.setData({ overlay: !this.data.overlay, show: true }) }, changeOverlayStyle(e) { let overlayStyle = '' @@ -69,10 +69,10 @@ Page({ case 'blur': overlayStyle = 'background-color: rgba(0, 0, 0, 0.7); filter: blur(4px);' } - this.setData({overlayStyle, show: true}) + this.setData({ overlayStyle, show: true }) }, exit() { - this.setData({show: false}) + this.setData({ show: false }) }, onBeforeEnter(res) { console.log(res) diff --git a/miniprogram/packageComponent/pages/view/root-portal/root-portal.js b/miniprogram/packageComponent/pages/view/root-portal/root-portal.js index 29f2ac9b..ca05090c 100644 --- a/miniprogram/packageComponent/pages/view/root-portal/root-portal.js +++ b/miniprogram/packageComponent/pages/view/root-portal/root-portal.js @@ -13,7 +13,7 @@ Page({ // const b = Math.floor(255 * Math.random()) // item.bg = `background-color: rgb(${r}, ${g}, ${b})` - const r = Math.floor(Math.random() * (229 - 105) + 105);//生成固定灰色 + const r = Math.floor(Math.random() * (229 - 105) + 105)// 生成固定灰色 item.bg = `background-color: rgb(${r}, ${r}, ${r})` items.push(item) } diff --git a/miniprogram/packageComponent/pages/view/scroll-view/scroll-view.js b/miniprogram/packageComponent/pages/view/scroll-view/scroll-view.js index d0d8fbcc..5ebbcfcb 100644 --- a/miniprogram/packageComponent/pages/view/scroll-view/scroll-view.js +++ b/miniprogram/packageComponent/pages/view/scroll-view/scroll-view.js @@ -11,12 +11,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } this.animate('#scroll-sample-object1', [{ diff --git a/miniprogram/packageComponent/pages/view/sticky/sticky-header/sticky-header.js b/miniprogram/packageComponent/pages/view/sticky/sticky-header/sticky-header.js index cb4b31d9..8d0f7910 100644 --- a/miniprogram/packageComponent/pages/view/sticky/sticky-header/sticky-header.js +++ b/miniprogram/packageComponent/pages/view/sticky/sticky-header/sticky-header.js @@ -1,7 +1,6 @@ // demo-1/index.js import { generateList } from '../../../../../util/util' - Page({ /** @@ -70,4 +69,4 @@ Page({ onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/view/sticky/sticky-section/sticky-section.js b/miniprogram/packageComponent/pages/view/sticky/sticky-section/sticky-section.js index 6fe027bd..6a4c6532 100644 --- a/miniprogram/packageComponent/pages/view/sticky/sticky-section/sticky-section.js +++ b/miniprogram/packageComponent/pages/view/sticky/sticky-section/sticky-section.js @@ -9,7 +9,7 @@ Page({ data: { list: generateList(20), }, - + back() { wx.navigateBack({}) }, @@ -69,4 +69,4 @@ Page({ onShareAppMessage() { } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageComponent/pages/view/sticky/sticky.js b/miniprogram/packageComponent/pages/view/sticky/sticky.js index 3b276f80..5a992f4f 100644 --- a/miniprogram/packageComponent/pages/view/sticky/sticky.js +++ b/miniprogram/packageComponent/pages/view/sticky/sticky.js @@ -10,16 +10,14 @@ Page({ go1() { wx.navigateTo({ - url: './sticky-header/sticky-header', - }) + url: './sticky-header/sticky-header', + }) }, - goGrid1() { wx.navigateTo({ - url: './sticky-section/sticky-section', + url: './sticky-section/sticky-section', }) }, - }) diff --git a/miniprogram/packageComponent/pages/view/swiper/swiper.js b/miniprogram/packageComponent/pages/view/swiper/swiper.js index 782b7bd8..ac8bc5f7 100644 --- a/miniprogram/packageComponent/pages/view/swiper/swiper.js +++ b/miniprogram/packageComponent/pages/view/swiper/swiper.js @@ -6,7 +6,7 @@ Page({ } }, - data: { + data: { theme: 'light', background: ['A', 'B', 'C'], indicatorDots: true, @@ -46,12 +46,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } } diff --git a/miniprogram/packageComponent/pages/view/view/view.js b/miniprogram/packageComponent/pages/view/view/view.js index 4087a1c6..def223f4 100644 --- a/miniprogram/packageComponent/pages/view/view/view.js +++ b/miniprogram/packageComponent/pages/view/view/view.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageExtend/base/CustomPage.js b/miniprogram/packageExtend/base/CustomPage.js index 18a47b36..9193e35c 100644 --- a/miniprogram/packageExtend/base/CustomPage.js +++ b/miniprogram/packageExtend/base/CustomPage.js @@ -2,7 +2,8 @@ import themeMixin from './behaviors/theme' const CustomPage = function (options) { return Page( - Object.assign({}, options, { + { + ...options, behaviors: [themeMixin].concat(options.behaviors || []), onLoad(query) { const app = getApp() @@ -18,17 +19,17 @@ const CustomPage = function (options) { app.unWatchThemeChange && app.unWatchThemeChange(this.themeChanged) options.onUnload && options.onUnload.call(this) } - }, - onShareAppMessage() { - const route = this.route - const segments = route.split('/') - const title = segments[segments.length - 1] - return { - title: title, - path: route, - } - }, - }) + }, + onShareAppMessage() { + const route = this.route + const segments = route.split('/') + const title = segments[segments.length - 1] + return { + title, + path: route, + } + }, + } ) } diff --git a/miniprogram/packageExtend/components/actionsheet/actionsheet.js b/miniprogram/packageExtend/components/actionsheet/actionsheet.js index 4bb51d7f..d17c8959 100644 --- a/miniprogram/packageExtend/components/actionsheet/actionsheet.js +++ b/miniprogram/packageExtend/components/actionsheet/actionsheet.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } diff --git a/miniprogram/packageExtend/components/badge/badge.js b/miniprogram/packageExtend/components/badge/badge.js index e7a33704..983182ef 100644 --- a/miniprogram/packageExtend/components/badge/badge.js +++ b/miniprogram/packageExtend/components/badge/badge.js @@ -1,5 +1,3 @@ - - Component({ options: { }, diff --git a/miniprogram/packageExtend/components/cell/cell.js b/miniprogram/packageExtend/components/cell/cell.js index 1bfb92f5..9fd8b2ed 100644 --- a/miniprogram/packageExtend/components/cell/cell.js +++ b/miniprogram/packageExtend/components/cell/cell.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -206,4 +206,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/cells/cells.js b/miniprogram/packageExtend/components/cells/cells.js index c6aea93f..c5bba1b5 100644 --- a/miniprogram/packageExtend/components/cells/cells.js +++ b/miniprogram/packageExtend/components/cells/cells.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -167,4 +167,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/checkbox-group/checkbox-group.js b/miniprogram/packageExtend/components/checkbox-group/checkbox-group.js index 6a7a95c0..e8ec8538 100644 --- a/miniprogram/packageExtend/components/checkbox-group/checkbox-group.js +++ b/miniprogram/packageExtend/components/checkbox-group/checkbox-group.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -159,7 +159,7 @@ module.exports = vals.push(item.data.value) } }) - this.triggerEvent('change', {value: vals}) + this.triggerEvent('change', { value: vals }) } else { let val = '' this.data.targetList.forEach(function (item) { @@ -171,7 +171,7 @@ module.exports = }) } }) - this.triggerEvent('change', {value: val}, {}) + this.triggerEvent('change', { value: val }, {}) } }, setParentCellsClass: function setParentCellsClass() { @@ -193,4 +193,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/checkbox/checkbox.js b/miniprogram/packageExtend/components/checkbox/checkbox.js index 7980ab66..44583b55 100644 --- a/miniprogram/packageExtend/components/checkbox/checkbox.js +++ b/miniprogram/packageExtend/components/checkbox/checkbox.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -155,10 +155,10 @@ module.exports = this.data.group.checkedChange(_checked, this) } } - this.triggerEvent('change', {value: this.data.value, checked: this.data.checked}) + this.triggerEvent('change', { value: this.data.value, checked: this.data.checked }) } } }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/col/index.js b/miniprogram/packageExtend/components/col/index.js index 4e3e1cce..c2456f68 100644 --- a/miniprogram/packageExtend/components/col/index.js +++ b/miniprogram/packageExtend/components/col/index.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -206,4 +206,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/dialog/dialog.js b/miniprogram/packageExtend/components/dialog/dialog.js index f8d13708..7a9387bb 100644 --- a/miniprogram/packageExtend/components/dialog/dialog.js +++ b/miniprogram/packageExtend/components/dialog/dialog.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -164,4 +164,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/emoji/emoji.js b/miniprogram/packageExtend/components/emoji/emoji.js index 096bdbde..b9829f4e 100644 --- a/miniprogram/packageExtend/components/emoji/emoji.js +++ b/miniprogram/packageExtend/components/emoji/emoji.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -86,7 +86,7 @@ module.exports = /** *** */ }([ /* 0 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) exports.default = [{ id: 0, cn: '[微笑]', hk: '[微笑]', us: '[Smile]', code: '/::)', web_code: '/微笑', style: 'smiley_0' }, { @@ -370,7 +370,7 @@ module.exports = /* 1 */, /* 2 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const emoji_data_1 = __webpack_require__(0) const emoji_panel_data_1 = __webpack_require__(3) const parser_1 = __webpack_require__(4) @@ -455,8 +455,8 @@ module.exports = const idx = evt.currentTarget.dataset.idx const emotionName = data.emotions[idx].cn this.LRUCache(data.history, data.perLine, idx) - this.setData({history: data.history}) - this.triggerEvent('insertemoji', {emotionName}) + this.setData({ history: data.history }) + this.triggerEvent('insertemoji', { emotionName }) }, deleteEmoji() { this.triggerEvent('delemoji') @@ -480,12 +480,12 @@ module.exports = /***/ }), /* 3 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) exports.default = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 22, 23, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, 56, 57, 60, 62, 63, 64, 65, 66, 67, 68, 70, 74, 75, 76, 78, 79, 80, 81, 82, 83, 84, 85, 89, 92, 93, 94, 95, 300, 301, 302, 303, 304, 305, 306, 307, 204, 205, 202, 206, 212, 211, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 308, 309, 310, 311, 312, 209] /***/ }), /* 4 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const emoji_data_1 = __webpack_require__(0) const emotionMap = {} emoji_data_1.default.forEach(function (item, index) { @@ -500,7 +500,7 @@ module.exports = for (const k in emotionMap) { let idx = content.indexOf(k) while (idx >= 0) { - emojiIndexList.push({idx, code: k, type: 2}) + emojiIndexList.push({ idx, code: k, type: 2 }) idx = content.indexOf(k, idx + k.length) } } diff --git a/miniprogram/packageExtend/components/form-page/form-page.js b/miniprogram/packageExtend/components/form-page/form-page.js index 237854cb..1bb9b4db 100644 --- a/miniprogram/packageExtend/components/form-page/form-page.js +++ b/miniprogram/packageExtend/components/form-page/form-page.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -121,4 +121,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/form/form.js b/miniprogram/packageExtend/components/form/form.js index 206fb2d7..7c0861e2 100644 --- a/miniprogram/packageExtend/components/form/form.js +++ b/miniprogram/packageExtend/components/form/form.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -86,7 +86,7 @@ module.exports = /** *** */ }([ /* 0 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) exports.diff = function (old, newVal) { if (!old && newVal || old && !newVal) return true for (const k in newVal) { @@ -122,7 +122,7 @@ module.exports = /* 3 */, /* 4 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const form_validator_1 = __webpack_require__(5) const object_1 = __webpack_require__(0) function linked(target) { @@ -189,7 +189,7 @@ module.exports = newRules[rule.name] = rule.rules || [] } }) - this.setData({newRules}) + this.setData({ newRules }) return newRules }, _modelChange: function _modelChange(newVal, oldVal, path) { @@ -222,7 +222,7 @@ module.exports = _loop(k) } _this._showErrors(diffObj, errorMap) - _this.triggerEvent(isValid ? 'success' : 'fail', isValid ? {trigger: 'change'} : {errors, trigger: 'change'}) + _this.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'change' } : { errors, trigger: 'change' }) }()) } return newVal @@ -256,7 +256,7 @@ module.exports = return this.formValidator.validate(function (isValid, errors) { _this2._showAllErrors(errors) const handleError = _this2.handleErrors(errors) - _this2.triggerEvent(isValid ? 'success' : 'fail', isValid ? {trigger: 'validate'} : {errors: handleError, trigger: 'validate'}) + _this2.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'validate' } : { errors: handleError, trigger: 'validate' }) cb && cb(isValid, handleError) }) }, @@ -270,7 +270,7 @@ module.exports = return this.formValidator.validateField(name, value, function (isValid, errors) { _this3._showError(name, errors) const handleError = _this3.handleErrors(errors) - _this3.triggerEvent(isValid ? 'success' : 'fail', isValid ? {trigger: 'validate'} : {errors: handleError, trigger: 'validate'}) + _this3.triggerEvent(isValid ? 'success' : 'fail', isValid ? { trigger: 'validate' } : { errors: handleError, trigger: 'validate' }) cb && cb(isValid, handleError) }) }, @@ -298,7 +298,7 @@ module.exports = /***/ (function (module, exports, __webpack_require__) { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function') } } - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const validator_1 = __webpack_require__(6) const object_1 = __webpack_require__(0) const toString = Object.prototype.toString @@ -361,7 +361,7 @@ module.exports = keys.forEach(function (key) { if (!errors[key]) delete errors[key] }) - resolve({isValid: !failCount, errors: failCount ? errors : undefined}) + resolve({ isValid: !failCount, errors: failCount ? errors : undefined }) cb && cb(!failCount, failCount ? errors : undefined) }) } @@ -377,7 +377,7 @@ module.exports = _this2._innerValidateField(name, value, function (valid, error) { const errObj = {} errObj[name] = error - resolve({valid, error: valid ? undefined : error}) + resolve({ valid, error: valid ? undefined : error }) cb(valid, valid ? undefined : errObj) const oldError = _this2.errors[name] const errorChanged = object_1.diff(oldError, error) @@ -412,7 +412,7 @@ module.exports = const resMessage = validateSingleRule(rule, value || models[name], rule.param, models) if (resMessage && !isFail) { isFail = true - const error = resMessage ? {message: resMessage, rule} : undefined + const error = resMessage ? { message: resMessage, rule } : undefined cb(false, error) } }) @@ -423,7 +423,7 @@ module.exports = const rule = rules rule.name = name const resMessage = validateSingleRule(rule, value || models[name], rule.param, models) - const error = resMessage ? {message: resMessage, rule} : undefined + const error = resMessage ? { message: resMessage, rule } : undefined if (resMessage) { isFail = true } @@ -450,7 +450,7 @@ module.exports = /***/ }), /* 6 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const string_1 = __webpack_require__(7) const defaultMessage = { required: '%s必填', @@ -528,7 +528,7 @@ module.exports = /***/ }), /* 7 */ /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) exports.sprintf = function () { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key] diff --git a/miniprogram/packageExtend/components/gallery/gallery.js b/miniprogram/packageExtend/components/gallery/gallery.js index 8bbccd47..ce38813f 100644 --- a/miniprogram/packageExtend/components/gallery/gallery.js +++ b/miniprogram/packageExtend/components/gallery/gallery.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -95,7 +95,7 @@ module.exports = type: Array, value: [], observer: function observer(newVal, oldVal, changedPath) { - this.setData({currentImgs: newVal}) + this.setData({ currentImgs: newVal }) } }, showDelete: { @@ -172,4 +172,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/grids/grids.js b/miniprogram/packageExtend/components/grids/grids.js index b8707060..7ec5d30b 100644 --- a/miniprogram/packageExtend/components/grids/grids.js +++ b/miniprogram/packageExtend/components/grids/grids.js @@ -1,4 +1,3 @@ - /** *** */ (function (modules) { // webpackBootstrap /** *** */ // The module cache /** *** */ const installedModules = {} @@ -15,7 +14,7 @@ /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +36,16 @@ /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +59,7 @@ /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -132,7 +131,7 @@ attached() { if (this.data.grids) { this.setData({ - innerGrids: this.data.grids.map(grid => Object.assign({}, this.data._defaultGridProps, grid)) + innerGrids: this.data.grids.map(grid => ({ ...this.data._defaultGridProps, ...grid })) }) } } @@ -141,4 +140,4 @@ }) /***/ }) -/** *** */})) +/** *** */ })) diff --git a/miniprogram/packageExtend/components/icon/icon.js b/miniprogram/packageExtend/components/icon/icon.js index 714a3721..fc4ab659 100644 --- a/miniprogram/packageExtend/components/icon/icon.js +++ b/miniprogram/packageExtend/components/icon/icon.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -91,7 +91,7 @@ module.exports = const _icondata = _interopRequireDefault(__webpack_require__(12)) - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {default: obj} } + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj } } const getFixedIconType = function (type) { // 兼容旧版本 typo @@ -153,7 +153,7 @@ module.exports = /***/ 11: /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) const b64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' const cb_encode = function cb_encode(ccc) { const padlen = [0, 2, 1][ccc.length % 3] @@ -199,90 +199,90 @@ module.exports = /***/ 12: /***/ (function (module, exports, __webpack_require__) { - Object.defineProperty(exports, '__esModule', {value: true}) + Object.defineProperty(exports, '__esModule', { value: true }) exports.default = { - 'add-friends': {outline: '3.Icons/Outlined/add-friendsCreated with Sketch. ', field: ' 3.Icons/Filled/add-friends Created with Sketch. '}, - add: {outline: ' 3.Icons/Outlined/add Created with Sketch. ', field: ' 3.Icons/Filled/add Created with Sketch. '}, - add2: {outline: ' 3.Icons/Outlined/add2 Created with Sketch. ', field: ' 3.Icons/Filled/add2 Created with Sketch. '}, - album: {outline: ' 3.Icons/Outlined/album Created with Sketch. ', field: ' 3.Icons/Filled/album Created with Sketch. '}, - arrow: {outline: ' 3.Icons/Outlined/arrow Created with Sketch. ', field: ' 3.Icons/Filled/arrow Created with Sketch. '}, - at: {outline: ' 3.Icons/Outlined/at Created with Sketch. ', field: ' 3.Icons/Filled/at Created with Sketch. '}, - back: {outline: ' 3.Icons/Outlined/back Created with Sketch. ', field: ' 3.Icons/Filled/back Created with Sketch. '}, - back2: {outline: ' 3.Icons/Outlined/back2 Created with Sketch. ', field: ' 3.Icons/Filled/back2 Created with Sketch. '}, - 'bellring-off': {outline: ' 3.Icons/Outlined/bellring_off Created with Sketch. ', field: ' 3.Icons/Filled/bell-ring_off Created with Sketch. '}, - 'bellring-on': {outline: ' 3.Icons/Outlined/bellring_on Created with Sketch. ', field: ' 3.Icons/Filled/bell-ring_on Created with Sketch. '}, - camera: {outline: ' 3.Icons/Outlined/camera Created with Sketch. ', field: ' 3.Icons/Filled/camera Created with Sketch. '}, - cellphone: {outline: ' 3.Icons/Outlined/cellphone Created with Sketch. ', field: ' 3.Icons/Filled/cellphone Created with Sketch. '}, - clip: {outline: ' 3.Icons/Outlined/clip Created with Sketch. ', field: ' 3.Icons/Filled/clip Created with Sketch. '}, - close: {outline: ' 3.Icons/Outlined/close Created with Sketch. ', field: ' 3.Icons/Filled/close Created with Sketch. '}, - close2: {outline: ' 3.Icons/Outlined/close2 Created with Sketch. ', field: ' 3.Icons/Filled/close2 Created with Sketch. '}, - comment: {outline: ' 3.Icons/Outlined/comment Created with Sketch. ', field: ' 3.Icons/Filled/comment Created with Sketch. '}, - contacts: {outline: ' 3.Icons/Outlined/contacts Created with Sketch. ', field: ' 3.Icons/Filled/contacts Created with Sketch. '}, - copy: {outline: ' 3.Icons/Outlined/copy Created with Sketch. ', field: ' 3.Icons/Filled/copy Created with Sketch. '}, - 'delete-on': {outline: ' 3.Icons/Outlined/delete_on Created with Sketch. ', field: ' 3.Icons/Filled/delete_on Created with Sketch. '}, - delete: {outline: ' 3.Icons/Outlined/delete Created with Sketch. ', field: ' 3.Icons/Filled/delete Created with Sketch. '}, - discover: {outline: ' 3.Icons/Outlined/discover Created with Sketch. ', field: ' 3.Icons/Filled/discover Created with Sketch. '}, - display: {outline: ' 3.Icons/Outlined/display Created with Sketch. ', field: ' 3.Icons/Filled/display Created with Sketch. '}, - done: {outline: ' 3.Icons/Outlined/done Created with Sketch. ', field: ' 3.Icons/Filled/done Created with Sketch. '}, - done2: {outline: ' 3.Icons/Outlined/done2 Created with Sketch. ', field: ' 3.Icons/Filled/done2 Created with Sketch. '}, - download: {outline: ' 3.Icons/Outlined/download Created with Sketch. ', field: ' 3.Icons/Filled/download Created with Sketch. '}, - email: {outline: ' 3.Icons/Outlined/email Created with Sketch. ', field: ' 3.Icons/Filled/email Created with Sketch. '}, - error: {outline: ' 3.Icons/Outlined/error Created with Sketch. ', field: ' 3.Icons/Filled/error Created with Sketch. '}, - 'eyes-off': {outline: ' 3.Icons/Outlined/eyes_off Created with Sketch. ', field: ' 3.Icons/Filled/eyes_off Created with Sketch. '}, - 'eyes-on': {outline: ' 3.Icons/Outlined/eyes_on Created with Sketch. ', field: ' 3.Icons/Filled/eyes_on Created with Sketch. '}, - folder: {outline: ' 3.Icons/Outlined/folder Created with Sketch. ', field: ' 3.Icons/Filled/folder Created with Sketch. '}, - 'group-detail': {outline: ' 3.Icons/Outlined/group-detail Created with Sketch. ', field: ' 3.Icons/Filled/group-detail Created with Sketch. '}, - help: {outline: ' 3.Icons/Outlined/help Created with Sketch. ', field: ' 3.Icons/Filled/help Created with Sketch. '}, - home: {outline: ' 3.Icons/Outlined/home Created with Sketch. ', field: ' 3.Icons/Filled/home Created with Sketch. '}, - imac: {outline: ' 3.Icons/Outlined/imac Created with Sketch. ', field: ' 3.Icons/Filled/imac Created with Sketch. '}, - info: {outline: ' 3.Icons/Outlined/info Created with Sketch. ', field: ' 3.Icons/Filled/info Created with Sketch. '}, - keyboard: {outline: ' 3.Icons/Outlined/keyboard Created with Sketch. ', field: ' 3.Icons/Filled/keyboard Created with Sketch. '}, - like: {outline: ' 3.Icons/Outlined/like Created with Sketch. ', field: ' 3.Icons/Filled/like Created with Sketch. '}, - link: {outline: ' 3.Icons/Outlined/link Created with Sketch. ', field: ' 3.Icons/Filled/link Created with Sketch. '}, - location: {outline: ' 3.Icons/Outlined/location Created with Sketch. ', field: ' 3.Icons/Filled/location Created with Sketch. '}, - lock: {outline: ' 3.Icons/Outlined/lock Created with Sketch. ', field: ' 3.Icons/Filled/lock Created with Sketch. '}, - 'max-window': {outline: ' 3.Icons/Outlined/max-window Created with Sketch. ', field: ' 3.Icons/Filled/max-window Created with Sketch. '}, - me: {outline: ' 3.Icons/Outlined/me Created with Sketch. ', field: ' 3.Icons/Filled/me Created with Sketch. '}, - mike: {outline: ' 3.Icons/Outlined/mike Created with Sketch. ', field: ' 3.Icons/Filled/mike Created with Sketch. '}, - mike2: {outline: ' 3.Icons/Outlined/mike2 Created with Sketch. ', field: ' 3.Icons/Filled/mike2 Created with Sketch. '}, - 'mobile-contacts': {outline: ' 3.Icons/Outlined/mobile-contacts Created with Sketch. ', field: ' 3.Icons/Filled/mobile-contacts Created with Sketch. '}, - more: {outline: ' 3.Icons/Outlined/more Created with Sketch. ', field: ' 3.Icons/Filled/more Created with Sketch. '}, - more2: {outline: ' 3.Icons/Outlined/more2 Created with Sketch. ', field: ' 3.Icons/Filled/more2 Created with Sketch. '}, - mosaic: {outline: ' 3.Icons/Outlined/mosaic Created with Sketch. ', field: ' 3.Icons/Filled/mask Created with Sketch. '}, - 'music-off': {outline: ' 3.Icons/Outlined/music_off Created with Sketch. ', field: ' 3.Icons/Filled/music-off Created with Sketch. '}, - music: {outline: ' 3.Icons/Outlined/music Created with Sketch. ', field: ' 3.Icons/Filled/music Created with Sketch. '}, - note: {outline: ' 3.Icons/Outlined/note Created with Sketch. ', field: ' 3.Icons/Filled/note Created with Sketch. '}, - pad: {outline: ' 3.Icons/Outlined/pad Created with Sketch. ', field: ' 3.Icons/Filled/pad Created with Sketch. '}, - pause: {outline: ' 3.Icons/Outlined/pause Created with Sketch. ', field: ' 3.Icons/Filled/pause Created with Sketch. '}, - pencil: {outline: ' 3.Icons/Outlined/pencil Created with Sketch. ', field: ' 3.Icons/Filled/pencil Created with Sketch. '}, - 'photo-wall': {outline: ' 3.Icons/Outlined/photo-wall Created with Sketch. ', field: ' 3.Icons/Filled/photo-wall Created with Sketch. '}, - play: {outline: ' 3.Icons/Outlined/play Created with Sketch. ', field: ' 3.Icons/Filled/play Created with Sketch. '}, - play2: {outline: ' 3.Icons/Outlined/play2 Created with Sketch. ', field: ' 3.Icons/Filled/play2 Created with Sketch. '}, - previous: {outline: ' 3.Icons/Outlined/previous Created with Sketch. ', field: ' 3.Icons/Filled/previous Created with Sketch. '}, - previous2: {outline: ' 3.Icons/Outlined/previous2 Created with Sketch. ', field: ' 3.Icons/Filled/previous2 Created with Sketch. '}, - 'qr-code': {outline: ' 3.Icons/Outlined/qr-code Created with Sketch. ', field: ' 3.Icons/Filled/qr-code Created with Sketch. '}, - refresh: {outline: ' 3.Icons/Outlined/refresh Created with Sketch. ', field: ' 3.Icons/Filled/refresh Created with Sketch. '}, - 'report-problem': {outline: ' 3.Icons/Outlined/report_problem Created with Sketch. ', field: ' 3.Icons/Filled/report-problem Created with Sketch. '}, - search: {outline: ' 3.Icons/Outlined/search Created with Sketch. ', field: ' 3.Icons/Filled/search Created with Sketch. '}, - sending: {outline: ' 3.Icons/Outlined/sending Created with Sketch. ', field: ' 3.Icons/Filled/sending Created with Sketch. '}, - setting: {outline: ' 3.Icons/Outlined/setting Created with Sketch. ', field: ' 3.Icons/Filled/setting Created with Sketch. '}, - share: {outline: ' 3.Icons/Outlined/share Created with Sketch. ', field: ' 3.Icons/Filled/share Created with Sketch. '}, - shop: {outline: ' 3.Icons/Outlined/shop Created with Sketch. ', field: ' 3.Icons/Filled/shop Created with Sketch. '}, - star: {outline: ' 3.Icons/Outlined/star Created with Sketch. ', field: ' 3.Icons/Filled/star Created with Sketch. '}, - sticker: {outline: ' 3.Icons/Outlined/sticker Created with Sketch. ', field: ' 3.Icons/Filled/sticker Created with Sketch. '}, - tag: {outline: ' 3.Icons/Outlined/tag Created with Sketch. ', field: ' 3.Icons/Filled/tag Created with Sketch. '}, - text: {outline: ' 3.Icons/Outlined/text Created with Sketch. ', field: ' 3.Icons/Filled/text Created with Sketch. '}, - time: {outline: ' 3.Icons/Outlined/time Created with Sketch. ', field: ' 3.Icons/Filled/time Created with Sketch. '}, - 'transfer-text': {outline: ' 3.Icons/Outlined/transfer-text Created with Sketch. ', field: ' 3.Icons/Filled/transfer-text Created with Sketch. '}, - transfer2: {outline: ' 3.Icons/Outlined/transfer2 Created with Sketch. ', field: ' 3.Icons/Filled/transfer2 Created with Sketch. '}, - translate: {outline: ' 3.Icons/Outlined/translate Created with Sketch. ', field: ' 3.Icons/Filled/translate Created with Sketch. '}, - tv: {outline: ' 3.Icons/Outlined/tv Created with Sketch. ', field: ' 3.Icons/Filled/tv Created with Sketch. '}, - 'video-call': {outline: ' 3.Icons/Outlined/video-call Created with Sketch. ', field: ' 3.Icons/Filled/video-call Created with Sketch. '}, - voice: {outline: ' 3.Icons/Outlined/voice Created with Sketch. ', field: ' 3.Icons/Filled/voice Created with Sketch. '}, - 'volume-down': {outline: ' 3.Icons/Outlined/volume_down Created with Sketch. ', field: ' 3.Icons/Filled/volume-down Created with Sketch. '}, - 'volume-off': {outline: ' 3.Icons/Outlined/volume_off Created with Sketch. ', field: ' 3.Icons/Filled/volume-off Created with Sketch. '}, - 'volume-up': {outline: ' 3.Icons/Outlined/volume_up Created with Sketch. ', field: ' 3.Icons/Filled/volume-up Created with Sketch. '} + 'add-friends': { outline: '3.Icons/Outlined/add-friendsCreated with Sketch. ', field: ' 3.Icons/Filled/add-friends Created with Sketch. ' }, + add: { outline: ' 3.Icons/Outlined/add Created with Sketch. ', field: ' 3.Icons/Filled/add Created with Sketch. ' }, + add2: { outline: ' 3.Icons/Outlined/add2 Created with Sketch. ', field: ' 3.Icons/Filled/add2 Created with Sketch. ' }, + album: { outline: ' 3.Icons/Outlined/album Created with Sketch. ', field: ' 3.Icons/Filled/album Created with Sketch. ' }, + arrow: { outline: ' 3.Icons/Outlined/arrow Created with Sketch. ', field: ' 3.Icons/Filled/arrow Created with Sketch. ' }, + at: { outline: ' 3.Icons/Outlined/at Created with Sketch. ', field: ' 3.Icons/Filled/at Created with Sketch. ' }, + back: { outline: ' 3.Icons/Outlined/back Created with Sketch. ', field: ' 3.Icons/Filled/back Created with Sketch. ' }, + back2: { outline: ' 3.Icons/Outlined/back2 Created with Sketch. ', field: ' 3.Icons/Filled/back2 Created with Sketch. ' }, + 'bellring-off': { outline: ' 3.Icons/Outlined/bellring_off Created with Sketch. ', field: ' 3.Icons/Filled/bell-ring_off Created with Sketch. ' }, + 'bellring-on': { outline: ' 3.Icons/Outlined/bellring_on Created with Sketch. ', field: ' 3.Icons/Filled/bell-ring_on Created with Sketch. ' }, + camera: { outline: ' 3.Icons/Outlined/camera Created with Sketch. ', field: ' 3.Icons/Filled/camera Created with Sketch. ' }, + cellphone: { outline: ' 3.Icons/Outlined/cellphone Created with Sketch. ', field: ' 3.Icons/Filled/cellphone Created with Sketch. ' }, + clip: { outline: ' 3.Icons/Outlined/clip Created with Sketch. ', field: ' 3.Icons/Filled/clip Created with Sketch. ' }, + close: { outline: ' 3.Icons/Outlined/close Created with Sketch. ', field: ' 3.Icons/Filled/close Created with Sketch. ' }, + close2: { outline: ' 3.Icons/Outlined/close2 Created with Sketch. ', field: ' 3.Icons/Filled/close2 Created with Sketch. ' }, + comment: { outline: ' 3.Icons/Outlined/comment Created with Sketch. ', field: ' 3.Icons/Filled/comment Created with Sketch. ' }, + contacts: { outline: ' 3.Icons/Outlined/contacts Created with Sketch. ', field: ' 3.Icons/Filled/contacts Created with Sketch. ' }, + copy: { outline: ' 3.Icons/Outlined/copy Created with Sketch. ', field: ' 3.Icons/Filled/copy Created with Sketch. ' }, + 'delete-on': { outline: ' 3.Icons/Outlined/delete_on Created with Sketch. ', field: ' 3.Icons/Filled/delete_on Created with Sketch. ' }, + delete: { outline: ' 3.Icons/Outlined/delete Created with Sketch. ', field: ' 3.Icons/Filled/delete Created with Sketch. ' }, + discover: { outline: ' 3.Icons/Outlined/discover Created with Sketch. ', field: ' 3.Icons/Filled/discover Created with Sketch. ' }, + display: { outline: ' 3.Icons/Outlined/display Created with Sketch. ', field: ' 3.Icons/Filled/display Created with Sketch. ' }, + done: { outline: ' 3.Icons/Outlined/done Created with Sketch. ', field: ' 3.Icons/Filled/done Created with Sketch. ' }, + done2: { outline: ' 3.Icons/Outlined/done2 Created with Sketch. ', field: ' 3.Icons/Filled/done2 Created with Sketch. ' }, + download: { outline: ' 3.Icons/Outlined/download Created with Sketch. ', field: ' 3.Icons/Filled/download Created with Sketch. ' }, + email: { outline: ' 3.Icons/Outlined/email Created with Sketch. ', field: ' 3.Icons/Filled/email Created with Sketch. ' }, + error: { outline: ' 3.Icons/Outlined/error Created with Sketch. ', field: ' 3.Icons/Filled/error Created with Sketch. ' }, + 'eyes-off': { outline: ' 3.Icons/Outlined/eyes_off Created with Sketch. ', field: ' 3.Icons/Filled/eyes_off Created with Sketch. ' }, + 'eyes-on': { outline: ' 3.Icons/Outlined/eyes_on Created with Sketch. ', field: ' 3.Icons/Filled/eyes_on Created with Sketch. ' }, + folder: { outline: ' 3.Icons/Outlined/folder Created with Sketch. ', field: ' 3.Icons/Filled/folder Created with Sketch. ' }, + 'group-detail': { outline: ' 3.Icons/Outlined/group-detail Created with Sketch. ', field: ' 3.Icons/Filled/group-detail Created with Sketch. ' }, + help: { outline: ' 3.Icons/Outlined/help Created with Sketch. ', field: ' 3.Icons/Filled/help Created with Sketch. ' }, + home: { outline: ' 3.Icons/Outlined/home Created with Sketch. ', field: ' 3.Icons/Filled/home Created with Sketch. ' }, + imac: { outline: ' 3.Icons/Outlined/imac Created with Sketch. ', field: ' 3.Icons/Filled/imac Created with Sketch. ' }, + info: { outline: ' 3.Icons/Outlined/info Created with Sketch. ', field: ' 3.Icons/Filled/info Created with Sketch. ' }, + keyboard: { outline: ' 3.Icons/Outlined/keyboard Created with Sketch. ', field: ' 3.Icons/Filled/keyboard Created with Sketch. ' }, + like: { outline: ' 3.Icons/Outlined/like Created with Sketch. ', field: ' 3.Icons/Filled/like Created with Sketch. ' }, + link: { outline: ' 3.Icons/Outlined/link Created with Sketch. ', field: ' 3.Icons/Filled/link Created with Sketch. ' }, + location: { outline: ' 3.Icons/Outlined/location Created with Sketch. ', field: ' 3.Icons/Filled/location Created with Sketch. ' }, + lock: { outline: ' 3.Icons/Outlined/lock Created with Sketch. ', field: ' 3.Icons/Filled/lock Created with Sketch. ' }, + 'max-window': { outline: ' 3.Icons/Outlined/max-window Created with Sketch. ', field: ' 3.Icons/Filled/max-window Created with Sketch. ' }, + me: { outline: ' 3.Icons/Outlined/me Created with Sketch. ', field: ' 3.Icons/Filled/me Created with Sketch. ' }, + mike: { outline: ' 3.Icons/Outlined/mike Created with Sketch. ', field: ' 3.Icons/Filled/mike Created with Sketch. ' }, + mike2: { outline: ' 3.Icons/Outlined/mike2 Created with Sketch. ', field: ' 3.Icons/Filled/mike2 Created with Sketch. ' }, + 'mobile-contacts': { outline: ' 3.Icons/Outlined/mobile-contacts Created with Sketch. ', field: ' 3.Icons/Filled/mobile-contacts Created with Sketch. ' }, + more: { outline: ' 3.Icons/Outlined/more Created with Sketch. ', field: ' 3.Icons/Filled/more Created with Sketch. ' }, + more2: { outline: ' 3.Icons/Outlined/more2 Created with Sketch. ', field: ' 3.Icons/Filled/more2 Created with Sketch. ' }, + mosaic: { outline: ' 3.Icons/Outlined/mosaic Created with Sketch. ', field: ' 3.Icons/Filled/mask Created with Sketch. ' }, + 'music-off': { outline: ' 3.Icons/Outlined/music_off Created with Sketch. ', field: ' 3.Icons/Filled/music-off Created with Sketch. ' }, + music: { outline: ' 3.Icons/Outlined/music Created with Sketch. ', field: ' 3.Icons/Filled/music Created with Sketch. ' }, + note: { outline: ' 3.Icons/Outlined/note Created with Sketch. ', field: ' 3.Icons/Filled/note Created with Sketch. ' }, + pad: { outline: ' 3.Icons/Outlined/pad Created with Sketch. ', field: ' 3.Icons/Filled/pad Created with Sketch. ' }, + pause: { outline: ' 3.Icons/Outlined/pause Created with Sketch. ', field: ' 3.Icons/Filled/pause Created with Sketch. ' }, + pencil: { outline: ' 3.Icons/Outlined/pencil Created with Sketch. ', field: ' 3.Icons/Filled/pencil Created with Sketch. ' }, + 'photo-wall': { outline: ' 3.Icons/Outlined/photo-wall Created with Sketch. ', field: ' 3.Icons/Filled/photo-wall Created with Sketch. ' }, + play: { outline: ' 3.Icons/Outlined/play Created with Sketch. ', field: ' 3.Icons/Filled/play Created with Sketch. ' }, + play2: { outline: ' 3.Icons/Outlined/play2 Created with Sketch. ', field: ' 3.Icons/Filled/play2 Created with Sketch. ' }, + previous: { outline: ' 3.Icons/Outlined/previous Created with Sketch. ', field: ' 3.Icons/Filled/previous Created with Sketch. ' }, + previous2: { outline: ' 3.Icons/Outlined/previous2 Created with Sketch. ', field: ' 3.Icons/Filled/previous2 Created with Sketch. ' }, + 'qr-code': { outline: ' 3.Icons/Outlined/qr-code Created with Sketch. ', field: ' 3.Icons/Filled/qr-code Created with Sketch. ' }, + refresh: { outline: ' 3.Icons/Outlined/refresh Created with Sketch. ', field: ' 3.Icons/Filled/refresh Created with Sketch. ' }, + 'report-problem': { outline: ' 3.Icons/Outlined/report_problem Created with Sketch. ', field: ' 3.Icons/Filled/report-problem Created with Sketch. ' }, + search: { outline: ' 3.Icons/Outlined/search Created with Sketch. ', field: ' 3.Icons/Filled/search Created with Sketch. ' }, + sending: { outline: ' 3.Icons/Outlined/sending Created with Sketch. ', field: ' 3.Icons/Filled/sending Created with Sketch. ' }, + setting: { outline: ' 3.Icons/Outlined/setting Created with Sketch. ', field: ' 3.Icons/Filled/setting Created with Sketch. ' }, + share: { outline: ' 3.Icons/Outlined/share Created with Sketch. ', field: ' 3.Icons/Filled/share Created with Sketch. ' }, + shop: { outline: ' 3.Icons/Outlined/shop Created with Sketch. ', field: ' 3.Icons/Filled/shop Created with Sketch. ' }, + star: { outline: ' 3.Icons/Outlined/star Created with Sketch. ', field: ' 3.Icons/Filled/star Created with Sketch. ' }, + sticker: { outline: ' 3.Icons/Outlined/sticker Created with Sketch. ', field: ' 3.Icons/Filled/sticker Created with Sketch. ' }, + tag: { outline: ' 3.Icons/Outlined/tag Created with Sketch. ', field: ' 3.Icons/Filled/tag Created with Sketch. ' }, + text: { outline: ' 3.Icons/Outlined/text Created with Sketch. ', field: ' 3.Icons/Filled/text Created with Sketch. ' }, + time: { outline: ' 3.Icons/Outlined/time Created with Sketch. ', field: ' 3.Icons/Filled/time Created with Sketch. ' }, + 'transfer-text': { outline: ' 3.Icons/Outlined/transfer-text Created with Sketch. ', field: ' 3.Icons/Filled/transfer-text Created with Sketch. ' }, + transfer2: { outline: ' 3.Icons/Outlined/transfer2 Created with Sketch. ', field: ' 3.Icons/Filled/transfer2 Created with Sketch. ' }, + translate: { outline: ' 3.Icons/Outlined/translate Created with Sketch. ', field: ' 3.Icons/Filled/translate Created with Sketch. ' }, + tv: { outline: ' 3.Icons/Outlined/tv Created with Sketch. ', field: ' 3.Icons/Filled/tv Created with Sketch. ' }, + 'video-call': { outline: ' 3.Icons/Outlined/video-call Created with Sketch. ', field: ' 3.Icons/Filled/video-call Created with Sketch. ' }, + voice: { outline: ' 3.Icons/Outlined/voice Created with Sketch. ', field: ' 3.Icons/Filled/voice Created with Sketch. ' }, + 'volume-down': { outline: ' 3.Icons/Outlined/volume_down Created with Sketch. ', field: ' 3.Icons/Filled/volume-down Created with Sketch. ' }, + 'volume-off': { outline: ' 3.Icons/Outlined/volume_off Created with Sketch. ', field: ' 3.Icons/Filled/volume-off Created with Sketch. ' }, + 'volume-up': { outline: ' 3.Icons/Outlined/volume_up Created with Sketch. ', field: ' 3.Icons/Filled/volume-up Created with Sketch. ' } } /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/index-list/index-list.js b/miniprogram/packageExtend/components/index-list/index-list.js index 98c118e4..05c43b25 100644 --- a/miniprogram/packageExtend/components/index-list/index-list.js +++ b/miniprogram/packageExtend/components/index-list/index-list.js @@ -85,13 +85,13 @@ Component({ const _wx$getSystemInfoSync = wx.getSystemInfoSync(); const windowHeight = _wx$getSystemInfoSync.windowHeight - this.setData({windowHeight}) + this.setData({ windowHeight }) }, }, methods: { choose(e) { const item = e.target.dataset.item - this.triggerEvent('choose', {item}) + this.triggerEvent('choose', { item }) }, scrollTo(e) { this.__scrollTo(e) @@ -101,7 +101,7 @@ Component({ const clientY = e.changedTouches[0].clientY const index = Math.floor((clientY - data._anchorTop) / data._anchorItemH) const current = data.alphabet[index] - this.setData({current, intoView: current, touching: true}) + this.setData({ current, intoView: current, touching: true }) if (data.vibrated) wx.vibrateShort() }, computedSize() { @@ -126,7 +126,7 @@ Component({ const _this2 = this setTimeout(function () { - _this2.setData({touching: false}) + _this2.setData({ touching: false }) }, 150) }, onScroll: function onScroll(e) { @@ -149,7 +149,7 @@ Component({ } } if (!current) current = alphabet[alphabet.length - 1] - this.setData({current}) + this.setData({ current }) } } }) diff --git a/miniprogram/packageExtend/components/index.js b/miniprogram/packageExtend/components/index.js index c9c4a06c..3fa84d71 100644 --- a/miniprogram/packageExtend/components/index.js +++ b/miniprogram/packageExtend/components/index.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -90,4 +90,4 @@ module.exports = exports.__esModule = true /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/loading/loading.js b/miniprogram/packageExtend/components/loading/loading.js index 1ec6ebce..af6c9592 100644 --- a/miniprogram/packageExtend/components/loading/loading.js +++ b/miniprogram/packageExtend/components/loading/loading.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -176,4 +176,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/msg/msg.js b/miniprogram/packageExtend/components/msg/msg.js index 1ee50300..67b34189 100644 --- a/miniprogram/packageExtend/components/msg/msg.js +++ b/miniprogram/packageExtend/components/msg/msg.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -123,4 +123,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/navigation-bar/navigation-bar.js b/miniprogram/packageExtend/components/navigation-bar/navigation-bar.js index 1e3d5eaa..fe62968b 100644 --- a/miniprogram/packageExtend/components/navigation-bar/navigation-bar.js +++ b/miniprogram/packageExtend/components/navigation-bar/navigation-bar.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -184,4 +184,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/row/index.js b/miniprogram/packageExtend/components/row/index.js index 9f41d15c..c6e778b3 100644 --- a/miniprogram/packageExtend/components/row/index.js +++ b/miniprogram/packageExtend/components/row/index.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -103,4 +103,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/searchbar/searchbar.js b/miniprogram/packageExtend/components/searchbar/searchbar.js index a3af1ce9..c888a8a5 100644 --- a/miniprogram/packageExtend/components/searchbar/searchbar.js +++ b/miniprogram/packageExtend/components/searchbar/searchbar.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -214,4 +214,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/select-text/select-text.js b/miniprogram/packageExtend/components/select-text/select-text.js index 97725244..b8b4e22f 100644 --- a/miniprogram/packageExtend/components/select-text/select-text.js +++ b/miniprogram/packageExtend/components/select-text/select-text.js @@ -1,4 +1,3 @@ - Component({ /** * 组件的属性列表 diff --git a/miniprogram/packageExtend/components/slideview/slideview.js b/miniprogram/packageExtend/components/slideview/slideview.js index 663f2169..568e059c 100644 --- a/miniprogram/packageExtend/components/slideview/slideview.js +++ b/miniprogram/packageExtend/components/slideview/slideview.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -195,4 +195,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/sticky/sticky.js b/miniprogram/packageExtend/components/sticky/sticky.js index 9af6afa2..bc81f1d5 100644 --- a/miniprogram/packageExtend/components/sticky/sticky.js +++ b/miniprogram/packageExtend/components/sticky/sticky.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -231,7 +231,7 @@ module.exports = scrollTop: top, isFixed: fixed }) - this.setData({fixed}) + this.setData({ fixed }) } } }) @@ -271,4 +271,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/tabbar/tabbar.js b/miniprogram/packageExtend/components/tabbar/tabbar.js index 4754b573..de30eb37 100644 --- a/miniprogram/packageExtend/components/tabbar/tabbar.js +++ b/miniprogram/packageExtend/components/tabbar/tabbar.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -125,4 +125,4 @@ module.exports = }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/tabs/tabs.js b/miniprogram/packageExtend/components/tabs/tabs.js index 32b36f56..a3b9560e 100644 --- a/miniprogram/packageExtend/components/tabs/tabs.js +++ b/miniprogram/packageExtend/components/tabs/tabs.js @@ -1,23 +1,22 @@ - Component({ options: { pureDataPattern: /^_/, multipleSlots: true }, properties: { - tabs: {type: Array, value: []}, - tabClass: {type: String, value: ''}, - swiperClass: {type: String, value: ''}, - activeClass: {type: String, value: ''}, - tabUnderlineColor: {type: String, value: '#07c160'}, - tabActiveTextColor: {type: String, value: '#000000'}, - tabInactiveTextColor: {type: String, value: '#000000'}, - tabBackgroundColor: {type: String, value: '#ffffff'}, - activeTab: {type: Number, value: 0}, - swipeable: {type: Boolean, value: true}, - animation: {type: Boolean, value: true}, - duration: {type: Number, value: 500}, - theme: {type: String, value: 'light'} // light dark + tabs: { type: Array, value: [] }, + tabClass: { type: String, value: '' }, + swiperClass: { type: String, value: '' }, + activeClass: { type: String, value: '' }, + tabUnderlineColor: { type: String, value: '#07c160' }, + tabActiveTextColor: { type: String, value: '#000000' }, + tabInactiveTextColor: { type: String, value: '#000000' }, + tabBackgroundColor: { type: String, value: '#ffffff' }, + activeTab: { type: Number, value: 0 }, + swipeable: { type: Boolean, value: true }, + animation: { type: Boolean, value: true }, + duration: { type: Number, value: 500 }, + theme: { type: String, value: 'light' } // light dark }, data: { currentView: 0 @@ -29,7 +28,7 @@ Component({ let currentView = _activeTab - 1 if (currentView < 0) currentView = 0 if (currentView > len - 1) currentView = len - 1 - this.setData({currentView}) + this.setData({ currentView }) } }, lifetimes: { @@ -38,13 +37,13 @@ Component({ methods: { handleTabClick: function handleTabClick(e) { const index = e.currentTarget.dataset.index - this.setData({activeTab: index}) - this.triggerEvent('tabclick', {index}) + this.setData({ activeTab: index }) + this.triggerEvent('tabclick', { index }) }, handleSwiperChange: function handleSwiperChange(e) { const index = e.detail.current - this.setData({activeTab: index}) - this.triggerEvent('change', {index}) + this.setData({ activeTab: index }) + this.triggerEvent('change', { index }) } } }) diff --git a/miniprogram/packageExtend/components/toptips/toptips.js b/miniprogram/packageExtend/components/toptips/toptips.js index 6f3f54b5..050c70ac 100644 --- a/miniprogram/packageExtend/components/toptips/toptips.js +++ b/miniprogram/packageExtend/components/toptips/toptips.js @@ -1,4 +1,3 @@ - Component({ options: { }, diff --git a/miniprogram/packageExtend/components/uploader/uploader.js b/miniprogram/packageExtend/components/uploader/uploader.js index 1fcdf67c..1c773502 100644 --- a/miniprogram/packageExtend/components/uploader/uploader.js +++ b/miniprogram/packageExtend/components/uploader/uploader.js @@ -15,7 +15,7 @@ module.exports = /** *** */ i: moduleId, /** *** */ l: false, /** *** */ exports: {} - /** *** */} + /** *** */ } /** *** */ /** *** */ // Execute the module function /** *** */ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__) @@ -37,16 +37,16 @@ module.exports = /** *** */ // define getter function for harmony exports /** *** */ __webpack_require__.d = function (exports, name, getter) { /** *** */ if (!__webpack_require__.o(exports, name)) { - /** *** */ Object.defineProperty(exports, name, {enumerable: true, get: getter}) + /** *** */ Object.defineProperty(exports, name, { enumerable: true, get: getter }) /** *** */ } /** *** */ } /** *** */ /** *** */ // define __esModule on exports /** *** */ __webpack_require__.r = function (exports) { /** *** */ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) { - /** *** */ Object.defineProperty(exports, Symbol.toStringTag, {value: 'Module'}) + /** *** */ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }) /** *** */ } - /** *** */ Object.defineProperty(exports, '__esModule', {value: true}) + /** *** */ Object.defineProperty(exports, '__esModule', { value: true }) /** *** */ } /** *** */ /** *** */ // create a fake namespace object @@ -60,7 +60,7 @@ module.exports = /** *** */ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value /** *** */ const ns = Object.create(null) /** *** */ __webpack_require__.r(ns) - /** *** */ Object.defineProperty(ns, 'default', {enumerable: true, value}) + /** *** */ Object.defineProperty(ns, 'default', { enumerable: true, value }) /** *** */ if (mode & 2 && typeof value !== 'string') for (const key in value) __webpack_require__.d(ns, key, function (key) { return value[key] }.bind(null, key)) /** *** */ return ns /** *** */ } @@ -193,16 +193,16 @@ module.exports = const fileContent = mgr.readFileSync(item) return fileContent }) - const obj = {tempFilePaths: res.tempFilePaths, tempFiles: res.tempFiles, contents} + const obj = { tempFilePaths: res.tempFilePaths, tempFiles: res.tempFiles, contents } _this.triggerEvent('select', obj, {}) const files = res.tempFilePaths.map(function (item, i) { - return {loading: true, url: 'data:image/jpg;base64,' + wx.arrayBufferToBase64(contents[i])} + return { loading: true, url: 'data:image/jpg;base64,' + wx.arrayBufferToBase64(contents[i]) } }) if (!files || !files.length) return if (typeof _this.data.upload === 'function') { const len = _this.data.files.length const newFiles = _this.data.files.concat(files) - _this.setData({files: newFiles, currentFiles: newFiles}) + _this.setData({ files: newFiles, currentFiles: newFiles }) _this.loading = true _this.data.upload(obj).then(function (json) { _this.loading = false @@ -212,10 +212,10 @@ module.exports = oldFiles[len + index].url = url oldFiles[len + index].loading = false }) - _this.setData({files: oldFiles, currentFiles: newFiles}) + _this.setData({ files: oldFiles, currentFiles: newFiles }) _this.triggerEvent('success', json, {}) } else { - _this.triggerEvent('fail', {type: 3, errMsg: 'upload file fail, urls not found'}, {}) + _this.triggerEvent('fail', { type: 3, errMsg: 'upload file fail, urls not found' }, {}) } }).catch(function (err) { _this.loading = false @@ -224,8 +224,8 @@ module.exports = oldFiles[len + index].error = true oldFiles[len + index].loading = false }) - _this.setData({files: oldFiles, currentFiles: newFiles}) - _this.triggerEvent('fail', {type: 3, errMsg: 'upload file fail', error: err}, {}) + _this.setData({ files: oldFiles, currentFiles: newFiles }) + _this.triggerEvent('fail', { type: 3, errMsg: 'upload file fail', error: err }, {}) }) } }, @@ -247,10 +247,10 @@ module.exports = files, currentFiles: files }) - this.triggerEvent('delete', {index, item: file[0]}) + this.triggerEvent('delete', { index, item: file[0] }) } } }) /***/ }) - /** *** */})) + /** *** */ })) diff --git a/miniprogram/packageExtend/components/video-swiper/video-swiper.js b/miniprogram/packageExtend/components/video-swiper/video-swiper.js index eba9d75a..74a6fc36 100644 --- a/miniprogram/packageExtend/components/video-swiper/video-swiper.js +++ b/miniprogram/packageExtend/components/video-swiper/video-swiper.js @@ -71,7 +71,7 @@ Component({ if (diff === 0) return this.data._last = current this.playCurrent(current) - this.triggerEvent('change', {activeId: curQueue[current].id}) + this.triggerEvent('change', { activeId: curQueue[current].id }) const direction = diff === 1 || diff === -2 ? 'up' : 'down' if (direction === 'up') { console.log(this.data) @@ -157,9 +157,7 @@ Component({ const detail = e.detail const activeId = e.target.dataset.id - this.triggerEvent( - type, Object.assign(Object.assign(Object.assign({}, detail), {activeId}), ext) - ) + this.triggerEvent(type, { ...detail, activeId, ...ext }) } }, }) diff --git a/miniprogram/packageExtend/components/vtabs-content/vtabs-content.js b/miniprogram/packageExtend/components/vtabs-content/vtabs-content.js index b8efabb0..2418e034 100644 --- a/miniprogram/packageExtend/components/vtabs-content/vtabs-content.js +++ b/miniprogram/packageExtend/components/vtabs-content/vtabs-content.js @@ -1,5 +1,3 @@ - - Component({ options: { multipleSlots: true diff --git a/miniprogram/packageExtend/components/vtabs/vtabs.js b/miniprogram/packageExtend/components/vtabs/vtabs.js index 7f5796fe..7fcdef2a 100644 --- a/miniprogram/packageExtend/components/vtabs/vtabs.js +++ b/miniprogram/packageExtend/components/vtabs/vtabs.js @@ -1,21 +1,19 @@ - - Component({ options: { pureDataPattern: /^_/, multipleSlots: true }, properties: { - vtabs: {type: Array, value: []}, - tabBarClass: {type: String, value: ''}, - activeClass: {type: String, value: ''}, - tabBarLineColor: {type: String, value: '#07c160'}, - tabBarInactiveTextColor: {type: String, value: '#000000'}, - tabBarActiveTextColor: {type: String, value: '#07c160'}, - tabBarInactiveBgColor: {type: String, value: '#eeeeee'}, - tabBarActiveBgColor: {type: String, value: '#ffffff'}, - activeTab: {type: Number, value: 0}, - animation: {type: Boolean, value: true} + vtabs: { type: Array, value: [] }, + tabBarClass: { type: String, value: '' }, + activeClass: { type: String, value: '' }, + tabBarLineColor: { type: String, value: '#07c160' }, + tabBarInactiveTextColor: { type: String, value: '#000000' }, + tabBarActiveTextColor: { type: String, value: '#07c160' }, + tabBarInactiveBgColor: { type: String, value: '#eeeeee' }, + tabBarActiveBgColor: { type: String, value: '#ffffff' }, + activeTab: { type: Number, value: 0 }, + animation: { type: Boolean, value: true } }, data: { currentView: 0, @@ -69,13 +67,13 @@ Component({ if (len === 0) return let currentView = index < 6 ? 0 : index - 5 if (currentView >= len) currentView = len - 1 - this.setData({currentView}) + this.setData({ currentView }) }, handleTabClick: function handleTabClick(e) { const _heightRecords = this.data._heightRecords const index = e.currentTarget.dataset.index const contentScrollTop = _heightRecords[index - 1] || 0 - this.triggerEvent('tabclick', {index}) + this.triggerEvent('tabclick', { index }) this.setData({ activeTab: index, contentScrollTop @@ -96,8 +94,8 @@ Component({ } } if (index !== this.data.activeTab) { - this.triggerEvent('change', {index}) - this.setData({activeTab: index}) + this.triggerEvent('change', { index }) + this.setData({ activeTab: index }) } } } diff --git a/miniprogram/packageExtend/pages/adapt/freelayout/freelayout.js b/miniprogram/packageExtend/pages/adapt/freelayout/freelayout.js index 61d8892b..cbe4eda6 100644 --- a/miniprogram/packageExtend/pages/adapt/freelayout/freelayout.js +++ b/miniprogram/packageExtend/pages/adapt/freelayout/freelayout.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageExtend/pages/adapt/horizontalexpansion/horizontalexpansion.js b/miniprogram/packageExtend/pages/adapt/horizontalexpansion/horizontalexpansion.js index 3363cf85..74120659 100644 --- a/miniprogram/packageExtend/pages/adapt/horizontalexpansion/horizontalexpansion.js +++ b/miniprogram/packageExtend/pages/adapt/horizontalexpansion/horizontalexpansion.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageExtend/pages/adapt/layeredpresentation/layeredpresentation.js b/miniprogram/packageExtend/pages/adapt/layeredpresentation/layeredpresentation.js index 7c482657..37edc10e 100644 --- a/miniprogram/packageExtend/pages/adapt/layeredpresentation/layeredpresentation.js +++ b/miniprogram/packageExtend/pages/adapt/layeredpresentation/layeredpresentation.js @@ -2,8 +2,7 @@ Page({ data: { theme: 'light', hide1: false, - hide2: false, - theme: 'light' + hide2: false }, onUnload() { if (wx.offThemeChange) { @@ -12,17 +11,17 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, onClick(e) { - this.setData({[e.target.dataset.set]: true}) + this.setData({ [e.target.dataset.set]: true }) }, onShareAppMessage() { return { diff --git a/miniprogram/packageExtend/pages/adapt/linebreak/linebreak.js b/miniprogram/packageExtend/pages/adapt/linebreak/linebreak.js index 9dc8305d..2ab7b330 100644 --- a/miniprogram/packageExtend/pages/adapt/linebreak/linebreak.js +++ b/miniprogram/packageExtend/pages/adapt/linebreak/linebreak.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageExtend/pages/adapt/pagination/pagination.js b/miniprogram/packageExtend/pages/adapt/pagination/pagination.js index 515f4861..f334f6ed 100644 --- a/miniprogram/packageExtend/pages/adapt/pagination/pagination.js +++ b/miniprogram/packageExtend/pages/adapt/pagination/pagination.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/packageExtend/pages/adapt/sidenavigation/sidenavigation.js b/miniprogram/packageExtend/pages/adapt/sidenavigation/sidenavigation.js index f7af59dd..c6862aa0 100644 --- a/miniprogram/packageExtend/pages/adapt/sidenavigation/sidenavigation.js +++ b/miniprogram/packageExtend/pages/adapt/sidenavigation/sidenavigation.js @@ -10,20 +10,20 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, show() { - this.setData({show: true}) + this.setData({ show: true }) }, hide() { - this.setData({show: false}) + this.setData({ show: false }) }, onShareAppMessage() { return { diff --git a/miniprogram/packageExtend/pages/adapt/telescopic/telescopic.js b/miniprogram/packageExtend/pages/adapt/telescopic/telescopic.js index 1a50d4af..d1e643c9 100644 --- a/miniprogram/packageExtend/pages/adapt/telescopic/telescopic.js +++ b/miniprogram/packageExtend/pages/adapt/telescopic/telescopic.js @@ -9,12 +9,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } // wx.showModal({ diff --git a/miniprogram/packageExtend/pages/base/gallery/gallery.js b/miniprogram/packageExtend/pages/base/gallery/gallery.js index ac3b0b72..1b306365 100644 --- a/miniprogram/packageExtend/pages/base/gallery/gallery.js +++ b/miniprogram/packageExtend/pages/base/gallery/gallery.js @@ -8,10 +8,10 @@ CustomPage({ 'https://res.wx.qq.com/op_res/0TZreUFL8sWsS1cFx5_f7MF5aY767_cWsd9JiKdHxL9Ktu6O6JLAJwvF-jLVxpB3' ], show: true - }, - openGallery() { - this.setData({ show: true }) - }, + }, + openGallery() { + this.setData({ show: true }) + }, change(e) { console.log('current index has changed', e.detail) }, diff --git a/miniprogram/packageExtend/pages/base/grid/grid.js b/miniprogram/packageExtend/pages/base/grid/grid.js index bde3ce40..c3ce27de 100644 --- a/miniprogram/packageExtend/pages/base/grid/grid.js +++ b/miniprogram/packageExtend/pages/base/grid/grid.js @@ -1,6 +1,6 @@ import CustomPage from '../../../base/CustomPage' -const {GRID_DEMO_URL} = getApp().globalData +const { GRID_DEMO_URL } = getApp().globalData const app = getApp() CustomPage({ diff --git a/miniprogram/packageExtend/pages/extend/barrage/barrage.js b/miniprogram/packageExtend/pages/extend/barrage/barrage.js index aaef7333..666a2e92 100644 --- a/miniprogram/packageExtend/pages/extend/barrage/barrage.js +++ b/miniprogram/packageExtend/pages/extend/barrage/barrage.js @@ -1,6 +1,6 @@ import CustomPage from '../../../base/CustomPage' -const {mockData} = require('./utils') +const { mockData } = require('./utils') CustomPage({ onShareAppMessage() { @@ -43,7 +43,7 @@ CustomPage({ }) setTimeout(() => { if (this.barrage) this.barrage.close() - this.setData({toggle: true}) + this.setData({ toggle: true }) this.addBarrage() }, 1000) }, diff --git a/miniprogram/packageExtend/pages/extend/emoji/emoji.js b/miniprogram/packageExtend/pages/extend/emoji/emoji.js index 54e931d5..f1086cdf 100644 --- a/miniprogram/packageExtend/pages/extend/emoji/emoji.js +++ b/miniprogram/packageExtend/pages/extend/emoji/emoji.js @@ -1,5 +1,5 @@ import CustomPage from '../../../base/CustomPage' -import {compareVersion} from '../../../../util/util' +import { compareVersion } from '../../../../util/util' CustomPage({ onShareAppMessage() { @@ -44,7 +44,7 @@ CustomPage({ }, onReady() { // 解决基础库小于 2.9.2 的兼容问题 - const {SDKVersion} = wx.getSystemInfoSync() + const { SDKVersion } = wx.getSystemInfoSync() if (compareVersion(SDKVersion, '2.9.1') < 0) { this.setData({ canIUse: false, @@ -52,7 +52,7 @@ CustomPage({ } }, onkeyboardHeightChange(e) { - const {height} = e.detail + const { height } = e.detail if (height === 0) { this.data._keyboardShow = false @@ -108,7 +108,7 @@ CustomPage({ }, insertEmoji(evt) { const emotionName = evt.detail.emotionName - const {cursor, comment} = this.data + const { cursor, comment } = this.data const newComment = comment.slice(0, cursor) + emotionName + comment.slice(cursor) this.setData({ diff --git a/miniprogram/packageExtend/pages/extend/index-list/index-list.js b/miniprogram/packageExtend/pages/extend/index-list/index-list.js index 8f30d90c..c5494808 100644 --- a/miniprogram/packageExtend/pages/extend/index-list/index-list.js +++ b/miniprogram/packageExtend/pages/extend/index-list/index-list.js @@ -1,4 +1,3 @@ - import CustomPage from '../../../base/CustomPage' CustomPage({ @@ -34,7 +33,7 @@ CustomPage({ for (const city of cities) { const alpha = city.pinyin[0].charAt(0).toUpperCase() if (!map.has(alpha)) map.set(alpha, []) - map.get(alpha).push({name: city.fullname}) + map.get(alpha).push({ name: city.fullname }) } const keys = [] @@ -51,7 +50,7 @@ CustomPage({ }) } - _this.setData({list}) + _this.setData({ list }) } }) } diff --git a/miniprogram/packageExtend/pages/extend/tabs/tabs.js b/miniprogram/packageExtend/pages/extend/tabs/tabs.js index a4b56677..f690f820 100644 --- a/miniprogram/packageExtend/pages/extend/tabs/tabs.js +++ b/miniprogram/packageExtend/pages/extend/tabs/tabs.js @@ -45,7 +45,7 @@ CustomPage({ desc: '微信小程序应用开发赛', }, ] - this.setData({tabs}) + this.setData({ tabs }) }, onTabClick(e) { diff --git a/miniprogram/packageExtend/pages/extend/vtabs/vtabs.js b/miniprogram/packageExtend/pages/extend/vtabs/vtabs.js index 69aefe7d..8038b5f5 100644 --- a/miniprogram/packageExtend/pages/extend/vtabs/vtabs.js +++ b/miniprogram/packageExtend/pages/extend/vtabs/vtabs.js @@ -45,7 +45,7 @@ CustomPage({ desc: '微信小程序应用开发赛', }, ] - this.setData({vtabs: tabs}) + this.setData({ vtabs: tabs }) }, onTabClick(e) { diff --git a/miniprogram/packageExtend/pages/extend/wxml-to-canvas/demo.js b/miniprogram/packageExtend/pages/extend/wxml-to-canvas/demo.js index 29ba63de..5b3cd1d2 100644 --- a/miniprogram/packageExtend/pages/extend/wxml-to-canvas/demo.js +++ b/miniprogram/packageExtend/pages/extend/wxml-to-canvas/demo.js @@ -1,4 +1,3 @@ - const wxml = (url) => ` diff --git a/miniprogram/packageExtend/pages/extend/wxml-to-canvas/wxml-to-canvas.js b/miniprogram/packageExtend/pages/extend/wxml-to-canvas/wxml-to-canvas.js index 591451e7..c1fe5f9c 100644 --- a/miniprogram/packageExtend/pages/extend/wxml-to-canvas/wxml-to-canvas.js +++ b/miniprogram/packageExtend/pages/extend/wxml-to-canvas/wxml-to-canvas.js @@ -1,4 +1,4 @@ -const {wxml, style} = require('./demo.js') +const { wxml, style } = require('./demo.js') Page({ onShareAppMessage() { @@ -26,7 +26,7 @@ Page({ }, renderToCanvas() { console.log(wxml(this.url)) - const p1 = this.widget.renderToCanvas({wxml: wxml(this.url), style}) + const p1 = this.widget.renderToCanvas({ wxml: wxml(this.url), style }) p1.then((re) => { console.log('container', re.layoutBox) this.data.showCanvas = true diff --git a/miniprogram/packageExtend/pages/form/cell/cell.js b/miniprogram/packageExtend/pages/form/cell/cell.js index 2ce9f3d4..532a3ddf 100644 --- a/miniprogram/packageExtend/pages/form/cell/cell.js +++ b/miniprogram/packageExtend/pages/form/cell/cell.js @@ -3,25 +3,25 @@ import CustomPage from '../../../base/CustomPage' const base64 = require('../../images/base64') CustomPage({ - onLoad() { - this.setData({ - icon: base64.icon20, - slideButtons: [{ - text: '普通', - src: global.isDemo ? '/page/weui/example/cell/icon_love.svg' : '/example/cell/icon_love.svg', // icon的路径 - }, { - text: '普通', - extClass: 'test', - src: global.isDemo ? '/page/weui/example/cell/icon_star.svg' : '/example/cell/icon_star.svg', // icon的路径 - }, { - type: 'warn', - text: '警示', - extClass: 'test', - src: global.isDemo ? '/page/weui/example/cell/icon_del.svg' : '/example/cell/icon_del.svg', // icon的路径 - }], - }) -}, -slideButtonTap(e) { - console.log('slide button tap', e.detail) -} + onLoad() { + this.setData({ + icon: base64.icon20, + slideButtons: [{ + text: '普通', + src: global.isDemo ? '/page/weui/example/cell/icon_love.svg' : '/example/cell/icon_love.svg', // icon的路径 + }, { + text: '普通', + extClass: 'test', + src: global.isDemo ? '/page/weui/example/cell/icon_star.svg' : '/example/cell/icon_star.svg', // icon的路径 + }, { + type: 'warn', + text: '警示', + extClass: 'test', + src: global.isDemo ? '/page/weui/example/cell/icon_del.svg' : '/example/cell/icon_del.svg', // icon的路径 + }], + }) + }, + slideButtonTap(e) { + console.log('slide button tap', e.detail) + } }) diff --git a/miniprogram/packageExtend/pages/form/form/form.js b/miniprogram/packageExtend/pages/form/form/form.js index b18068da..a5327701 100644 --- a/miniprogram/packageExtend/pages/form/form/form.js +++ b/miniprogram/packageExtend/pages/form/form/form.js @@ -5,20 +5,20 @@ CustomPage({ showTopTips: false, radioItems: [ - {name: 'cell standard', value: '0', checked: true}, - {name: 'cell standard', value: '1'} + { name: 'cell standard', value: '0', checked: true }, + { name: 'cell standard', value: '1' } ], checkboxItems: [ - {name: 'standard is dealt for u.', value: '0', checked: true}, - {name: 'standard is dealicient for u.', value: '1'} + { name: 'standard is dealt for u.', value: '0', checked: true }, + { name: 'standard is dealicient for u.', value: '1' } ], items: [ - {name: 'USA', value: '美国'}, - {name: 'CHN', value: '中国', checked: 'true'}, - {name: 'BRA', value: '巴西'}, - {name: 'JPN', value: '日本'}, - {name: 'ENG', value: '英国'}, - {name: 'TUR', value: '法国'}, + { name: 'USA', value: '美国' }, + { name: 'CHN', value: '中国', checked: 'true' }, + { name: 'BRA', value: '巴西' }, + { name: 'JPN', value: '日本' }, + { name: 'ENG', value: '英国' }, + { name: 'TUR', value: '法国' }, ], date: '2016-09-01', @@ -39,22 +39,22 @@ CustomPage({ }, rules: [{ name: 'radio', - rules: {required: false, message: '单选列表是必选项'}, + rules: { required: false, message: '单选列表是必选项' }, }, { name: 'checkbox', - rules: {required: true, message: '多选列表是必选项'}, + rules: { required: true, message: '多选列表是必选项' }, }, { name: 'name', - rules: {required: true, message: '请输入姓名'}, + rules: { required: true, message: '请输入姓名' }, }, { name: 'qq', - rules: {required: true, message: 'qq必填'}, + rules: { required: true, message: 'qq必填' }, }, { name: 'mobile', - rules: [{required: true, message: 'mobile必填'}, {mobile: true, message: 'mobile格式不对'}], + rules: [{ required: true, message: 'mobile必填' }, { mobile: true, message: 'mobile格式不对' }], }, { name: 'vcode', - rules: {required: true, message: '验证码必填'}, + rules: { required: true, message: '验证码必填' }, }, { name: 'idcard', rules: { @@ -108,7 +108,7 @@ CustomPage({ }) }, formInputChange(e) { - const {field} = e.currentTarget.dataset + const { field } = e.currentTarget.dataset this.setData({ [`formData.${field}`]: e.detail.value }) diff --git a/miniprogram/packageExtend/pages/navigation/navigation/navigation.js b/miniprogram/packageExtend/pages/navigation/navigation/navigation.js index 76dfaa1f..b5c127f9 100644 --- a/miniprogram/packageExtend/pages/navigation/navigation/navigation.js +++ b/miniprogram/packageExtend/pages/navigation/navigation/navigation.js @@ -1,41 +1,41 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - data: { - loading: false, - show: true, - animated: false, - title: 'UI组件库' - }, - toggleLoading() { - this.setData({ - loading: !this.data.loading - }) - }, - changeTitle() { - this.setData({ - title: '修改标题内容之后的标题长这个样子' - }) - }, - changeColor() { - this.setData({ - color: '#07C160' - }) - }, - changeBgColor() { - this.setData({ - background: '#adadad' - }) - }, - toggleShow() { - this.setData({ - show: !this.data.show - }) - }, - toggleAnimated() { - this.setData({ - animated: !this.data.animated, - show: !this.data.show - }) - } + data: { + loading: false, + show: true, + animated: false, + title: 'UI组件库' + }, + toggleLoading() { + this.setData({ + loading: !this.data.loading + }) + }, + changeTitle() { + this.setData({ + title: '修改标题内容之后的标题长这个样子' + }) + }, + changeColor() { + this.setData({ + color: '#07C160' + }) + }, + changeBgColor() { + this.setData({ + background: '#adadad' + }) + }, + toggleShow() { + this.setData({ + show: !this.data.show + }) + }, + toggleAnimated() { + this.setData({ + animated: !this.data.animated, + show: !this.data.show + }) + } }) diff --git a/miniprogram/packageExtend/pages/navigation/tabbar/tabbar.js b/miniprogram/packageExtend/pages/navigation/tabbar/tabbar.js index e7e2dfa2..3f6373e8 100644 --- a/miniprogram/packageExtend/pages/navigation/tabbar/tabbar.js +++ b/miniprogram/packageExtend/pages/navigation/tabbar/tabbar.js @@ -3,35 +3,35 @@ import CustomPage from '../../../base/CustomPage' const app = getApp() CustomPage({ - data: { - list: [ - { - text: '微信', - iconPath: app.globalData.iconTabbar, - selectedIconPath: app.globalData.iconTabbar, - badge: '8', - ariaLabel: '8个新通知' - }, - { - text: '通讯录', - iconPath: app.globalData.iconTabbar, - selectedIconPath: app.globalData.iconTabbar - }, - { - text: '发现', - iconPath: app.globalData.iconTabbar, - selectedIconPath: app.globalData.iconTabbar, - dot: true, - ariaLabel: '未读' - }, - { - text: '我', - iconPath: app.globalData.iconTabbar, - selectedIconPath: app.globalData.iconTabbar - } - ] - }, - tabChange(e) { - console.log('tab change', e) - } -}) \ No newline at end of file + data: { + list: [ + { + text: '微信', + iconPath: app.globalData.iconTabbar, + selectedIconPath: app.globalData.iconTabbar, + badge: '8', + ariaLabel: '8个新通知' + }, + { + text: '通讯录', + iconPath: app.globalData.iconTabbar, + selectedIconPath: app.globalData.iconTabbar + }, + { + text: '发现', + iconPath: app.globalData.iconTabbar, + selectedIconPath: app.globalData.iconTabbar, + dot: true, + ariaLabel: '未读' + }, + { + text: '我', + iconPath: app.globalData.iconTabbar, + selectedIconPath: app.globalData.iconTabbar + } + ] + }, + tabChange(e) { + console.log('tab change', e) + } +}) diff --git a/miniprogram/packageExtend/pages/operate/actionsheet/actionsheet.js b/miniprogram/packageExtend/pages/operate/actionsheet/actionsheet.js index 6612d3ea..9693d706 100644 --- a/miniprogram/packageExtend/pages/operate/actionsheet/actionsheet.js +++ b/miniprogram/packageExtend/pages/operate/actionsheet/actionsheet.js @@ -1,36 +1,36 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - open: function () { - wx.showActionSheet({ - itemList: ['A', 'B', 'C'], - success: function (res) { - if (!res.cancel) { - console.log(res.tapIndex) - } - } - }) - }, - data: { - showDialog: false, - groups: [ - { text: '示例菜单', value: 1 }, - { text: '示例菜单', value: 2 }, - { text: '负向菜单', type: 'warn', value: 3 } - ] - }, - openDialog: function () { - this.setData({ - showDialog: true - }) - }, - closeDialog: function () { - this.setData({ - showDialog: false - }) - }, - btnClick(e) { - console.log(e) - this.closeDialog() - } + open() { + wx.showActionSheet({ + itemList: ['A', 'B', 'C'], + success(res) { + if (!res.cancel) { + console.log(res.tapIndex) + } + } + }) + }, + data: { + showDialog: false, + groups: [ + { text: '示例菜单', value: 1 }, + { text: '示例菜单', value: 2 }, + { text: '负向菜单', type: 'warn', value: 3 } + ] + }, + openDialog() { + this.setData({ + showDialog: true + }) + }, + closeDialog() { + this.setData({ + showDialog: false + }) + }, + btnClick(e) { + console.log(e) + this.closeDialog() + } }) diff --git a/miniprogram/packageExtend/pages/operate/dialog/dialog.js b/miniprogram/packageExtend/pages/operate/dialog/dialog.js index 19a32cb0..d396eba8 100644 --- a/miniprogram/packageExtend/pages/operate/dialog/dialog.js +++ b/miniprogram/packageExtend/pages/operate/dialog/dialog.js @@ -1,27 +1,26 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - data: { - dialogShow: false, - showOneButtonDialog: false, - buttons: [{ text: '取消' }, { text: '确定' }], - oneButton: [{ text: '确定' }] - }, - openConfirm: function () { - this.setData({ - dialogShow: true - }) - }, - tapDialogButton(e) { - this.setData({ - dialogShow: false, - showOneButtonDialog: false - }) - }, - tapOneDialogButton(e) { - this.setData({ - showOneButtonDialog: true - }) - } + data: { + dialogShow: false, + showOneButtonDialog: false, + buttons: [{ text: '取消' }, { text: '确定' }], + oneButton: [{ text: '确定' }] + }, + openConfirm() { + this.setData({ + dialogShow: true + }) + }, + tapDialogButton(e) { + this.setData({ + dialogShow: false, + showOneButtonDialog: false + }) + }, + tapOneDialogButton(e) { + this.setData({ + showOneButtonDialog: true + }) + } }) - diff --git a/miniprogram/packageExtend/pages/operate/msg/msg.js b/miniprogram/packageExtend/pages/operate/msg/msg.js index 7522c908..69d75030 100644 --- a/miniprogram/packageExtend/pages/operate/msg/msg.js +++ b/miniprogram/packageExtend/pages/operate/msg/msg.js @@ -1,24 +1,24 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - openSuccess: function () { - wx.navigateTo({ - url: 'msg_success' - }) - }, - openText: function () { - wx.navigateTo({ - url: 'msg_text' - }) - }, - openTextPrimary: function () { - wx.navigateTo({ - url: 'msg_text_primary' - }) - }, - openFail: function () { - wx.navigateTo({ - url: 'msg_fail' - }) - } -}); + openSuccess() { + wx.navigateTo({ + url: 'msg_success' + }) + }, + openText() { + wx.navigateTo({ + url: 'msg_text' + }) + }, + openTextPrimary() { + wx.navigateTo({ + url: 'msg_text_primary' + }) + }, + openFail() { + wx.navigateTo({ + url: 'msg_fail' + }) + } +}) diff --git a/miniprogram/packageExtend/pages/operate/msg/msg_text.js b/miniprogram/packageExtend/pages/operate/msg/msg_text.js index ad63b245..828e7e4a 100644 --- a/miniprogram/packageExtend/pages/operate/msg/msg_text.js +++ b/miniprogram/packageExtend/pages/operate/msg/msg_text.js @@ -1,4 +1,3 @@ import CustomPage from '../../../base/CustomPage' CustomPage({}) - diff --git a/miniprogram/packageExtend/pages/operate/toptips/toptips.js b/miniprogram/packageExtend/pages/operate/toptips/toptips.js index a2a375f4..aefd36f8 100644 --- a/miniprogram/packageExtend/pages/operate/toptips/toptips.js +++ b/miniprogram/packageExtend/pages/operate/toptips/toptips.js @@ -1,24 +1,24 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - data: { - show1: false, - show2: false, - show3: false - }, - showToptips1() { - this.setData({ - show1: true - }) - }, - showToptips2() { - this.setData({ - show2: true - }) - }, - showToptips3() { - this.setData({ - show3: true - }) - } + data: { + show1: false, + show2: false, + show3: false + }, + showToptips1() { + this.setData({ + show1: true + }) + }, + showToptips2() { + this.setData({ + show2: true + }) + }, + showToptips3() { + this.setData({ + show3: true + }) + } }) diff --git a/miniprogram/packageExtend/pages/search/searchbar/searchbar.js b/miniprogram/packageExtend/pages/search/searchbar/searchbar.js index 6ea2bacd..9e4390a9 100644 --- a/miniprogram/packageExtend/pages/search/searchbar/searchbar.js +++ b/miniprogram/packageExtend/pages/search/searchbar/searchbar.js @@ -1,34 +1,33 @@ import CustomPage from '../../../base/CustomPage' CustomPage({ - data: { - inputShowed: false, - inputVal: "", - i: 0 - }, - onLoad() { - this.setData({ - search: this.search.bind(this) - }) - }, - search: function (value) { - return new Promise((resolve, reject) => { - if (this.data.i % 2 === 0) { - setTimeout(() => { - resolve([{text: '搜索结果', value: 1}, {text: '搜索结果2', value: 2}]) - }, 200) - } else { - setTimeout(() => { - resolve([]) - }, 200) - - } - this.setData({ - i: this.data.i + 1 - }) - }) - }, - selectResult: function (e) { - console.log('select result', e.detail) - }, -}); + data: { + inputShowed: false, + inputVal: '', + i: 0 + }, + onLoad() { + this.setData({ + search: this.search.bind(this) + }) + }, + search(value) { + return new Promise((resolve, reject) => { + if (this.data.i % 2 === 0) { + setTimeout(() => { + resolve([{ text: '搜索结果', value: 1 }, { text: '搜索结果2', value: 2 }]) + }, 200) + } else { + setTimeout(() => { + resolve([]) + }, 200) + } + this.setData({ + i: this.data.i + 1 + }) + }) + }, + selectResult(e) { + console.log('select result', e.detail) + }, +}) diff --git a/miniprogram/packageSkyline/common/custom-route/common.js b/miniprogram/packageSkyline/common/custom-route/common.js index ef2ceab3..2cda64ec 100644 --- a/miniprogram/packageSkyline/common/custom-route/common.js +++ b/miniprogram/packageSkyline/common/custom-route/common.js @@ -29,7 +29,7 @@ export const AnimationStatus = { export const Curves = {} if (wx.worklet) { - const {Easing} = wx.worklet + const { Easing } = wx.worklet Object.assign(Curves, { fastLinearToSlowEaseIn: Easing.bezier(0.18, 1.0, 0.04, 1.0).factory(), linearToEaseOut: Easing.bezier(0.35, 0.91, 0.33, 0.97).factory(), @@ -55,7 +55,7 @@ export const clamp = function (cur, lowerBound, upperBound) { export function CurveAnimation({ animation, animationStatus, curve, reverseCurve }) { - const {derived} = wx.worklet + const { derived } = wx.worklet return derived(() => { 'worklet' diff --git a/miniprogram/packageSkyline/common/custom-route/cupertino-route.js b/miniprogram/packageSkyline/common/custom-route/cupertino-route.js index b8036114..ed036046 100644 --- a/miniprogram/packageSkyline/common/custom-route/cupertino-route.js +++ b/miniprogram/packageSkyline/common/custom-route/cupertino-route.js @@ -1,5 +1,4 @@ - -import {CurveAnimation, Curves} from './common' +import { CurveAnimation, Curves } from './common' /** * 仿 iOS 返回自定义路由 @@ -11,7 +10,7 @@ export const CupertinoRouteBuilder = ({ secondaryAnimationStatus, userGestureInProgress, }) => { - const {windowWidth} = wx.getSystemInfoSync() + const { windowWidth } = wx.getSystemInfoSync() const _curvePrimaryAnimation = CurveAnimation({ animation: primaryAnimation, @@ -35,7 +34,7 @@ export const CupertinoRouteBuilder = ({ // 页面从右至左推入 return { - transform: [{translateX: windowWidth * (1 - t)}], + transform: [{ translateX: windowWidth * (1 - t) }], } } @@ -56,7 +55,7 @@ export const CupertinoRouteBuilder = ({ // 下一个页面推入时,当前页面继续向左推入 1/3 return { - transform: [{translateX: (-1 / 3) * windowWidth * t}], + transform: [{ translateX: (-1 / 3) * windowWidth * t }], } } diff --git a/miniprogram/packageSkyline/common/custom-route/hafl-screen-route.js b/miniprogram/packageSkyline/common/custom-route/hafl-screen-route.js index e5985587..b2ec3513 100644 --- a/miniprogram/packageSkyline/common/custom-route/hafl-screen-route.js +++ b/miniprogram/packageSkyline/common/custom-route/hafl-screen-route.js @@ -1,11 +1,11 @@ -import {CurveAnimation, Curves} from './common' +import { CurveAnimation, Curves } from './common' const HalfScreenDialogRouteBuilder = ({ primaryAnimation, primaryAnimationStatus, userGestureInProgress, }) => { - const {screenHeight} = getApp().globalData + const { screenHeight } = getApp().globalData console.info('HalfScreenDialogRouteBuilder ', screenHeight) const _curvePrimaryAnimation = CurveAnimation({ diff --git a/miniprogram/packageSkyline/common/custom-route/opacity-route.js b/miniprogram/packageSkyline/common/custom-route/opacity-route.js index 4fc47558..4263cd95 100644 --- a/miniprogram/packageSkyline/common/custom-route/opacity-route.js +++ b/miniprogram/packageSkyline/common/custom-route/opacity-route.js @@ -1,6 +1,6 @@ -import {Curves} from './common' +import { Curves } from './common' -const OpacityTransitionRouteBuilder = ({primaryAnimation}) => { +const OpacityTransitionRouteBuilder = ({ primaryAnimation }) => { const handlePrimaryAnimation = () => { 'worklet' diff --git a/miniprogram/packageSkyline/common/custom-route/scale-route.js b/miniprogram/packageSkyline/common/custom-route/scale-route.js index 6655ff71..84144719 100644 --- a/miniprogram/packageSkyline/common/custom-route/scale-route.js +++ b/miniprogram/packageSkyline/common/custom-route/scale-route.js @@ -1,4 +1,4 @@ -import {CurveAnimation, Curves} from './common' +import { CurveAnimation, Curves } from './common' const ScaleTransitionRouteBuilder = ({ primaryAnimation, @@ -7,8 +7,8 @@ const ScaleTransitionRouteBuilder = ({ secondaryAnimationStatus, userGestureInProgress, }) => { - const {windowWidth} = getApp().globalData - const {screenHeight} = getApp().globalData + const { windowWidth } = getApp().globalData + const { screenHeight } = getApp().globalData console.info('ScaleTransitionRouteBuilder ', windowWidth) const _curvePrimaryAnimation = CurveAnimation({ diff --git a/miniprogram/packageSkyline/common/custom-route/util.js b/miniprogram/packageSkyline/common/custom-route/util.js index d6db2d47..2ad744cd 100644 --- a/miniprogram/packageSkyline/common/custom-route/util.js +++ b/miniprogram/packageSkyline/common/custom-route/util.js @@ -24,10 +24,9 @@ function compareVersion(v1, v2) { return 0 } - export function isOfficialSkyline() { if (!wx.getSkylineInfoSync) return false - const {isSupported, version} = wx.getSkylineInfoSync() + const { isSupported, version } = wx.getSkylineInfoSync() if (!isSupported) return false return compareVersion(version, '1.0.1') >= 0 -} \ No newline at end of file +} diff --git a/miniprogram/packageSkyline/common/tips.js b/miniprogram/packageSkyline/common/tips.js index 79a3fcc1..f41200c8 100644 --- a/miniprogram/packageSkyline/common/tips.js +++ b/miniprogram/packageSkyline/common/tips.js @@ -1,7 +1,7 @@ -export function showTips () { +export function showTips() { wx.showToast({ title: '该版本暂不支持 Skyline', icon: 'none', duration: 3000 }) -} \ No newline at end of file +} diff --git a/miniprogram/packageSkyline/common/types.js b/miniprogram/packageSkyline/common/types.js index 2eaad9d0..9d6cbda4 100644 --- a/miniprogram/packageSkyline/common/types.js +++ b/miniprogram/packageSkyline/common/types.js @@ -21,4 +21,4 @@ export const IPointerEvent = { tilt: 'number', force: 'number', timeStamp: 'number', -}; +} diff --git a/miniprogram/packageSkyline/common/worklet-api.js b/miniprogram/packageSkyline/common/worklet-api.js index 5faa7637..1330fa5c 100644 --- a/miniprogram/packageSkyline/common/worklet-api.js +++ b/miniprogram/packageSkyline/common/worklet-api.js @@ -1,7 +1,7 @@ function foo() {} function bar() { - 'worklet'; + 'worklet' } export const worklet = { @@ -14,24 +14,24 @@ export const worklet = { timing: bar, decay: bar, Easing: {}, -}; +} export const router = { addRouteBuilder: foo, removeRouteBuilder: foo, getRouteContext: foo, -}; +} if (wx.worklet) { - Object.assign(worklet, wx.worklet); + Object.assign(worklet, wx.worklet) } if (wx.router) { - Object.assign(router, wx.router); + Object.assign(router, wx.router) } export function supportWorklet() { - return typeof wx.worklet === 'object' && typeof wx.worklet.shared === 'function'; + return typeof wx.worklet === 'object' && typeof wx.worklet.shared === 'function' } export function shared(args) { diff --git a/miniprogram/packageSkyline/pages/base.js b/miniprogram/packageSkyline/pages/base.js index 02720c18..e7a6f7cd 100644 --- a/miniprogram/packageSkyline/pages/base.js +++ b/miniprogram/packageSkyline/pages/base.js @@ -5,6 +5,7 @@ export default Behavior({ created() { runOnUI(() => { 'worklet' + if (!globalThis.temp) globalThis.temp = {} if (!globalThis.eventBus) { const eventBus = { diff --git a/miniprogram/packageSkyline/pages/half-page/half-page/index.less b/miniprogram/packageSkyline/pages/half-page/half-page/index.less index 31fe010e..cf130348 100644 --- a/miniprogram/packageSkyline/pages/half-page/half-page/index.less +++ b/miniprogram/packageSkyline/pages/half-page/half-page/index.less @@ -1,6 +1,15 @@ page { padding: 15px 0; } + +.comment-container { + width: 100%; + height: 100%; + padding-top: 40px; + display: flex; + flex-direction: column; +} + .bottom-sheet { position: relative; display: flex; @@ -9,6 +18,7 @@ page { justify-content: center; height: 50px; } + .bottom-sheet .btn-wrp { position: absolute; left: 0; @@ -18,6 +28,7 @@ page { align-items: center; justify-content: center; } + .bottom-sheet .btn { width: 24px; height: 24px; @@ -27,13 +38,16 @@ page { align-items: center; justify-content: center; } + .bottom-sheet .icon { width: 12px; height: 12px; } + .bottom-sheet .title { font-size: 18px; } + .comment-item { // width: 100%; // height: 60px; @@ -42,6 +56,7 @@ page { // flex-direction: row; // align-items: center; } + .avatar { width: 40px; height: 40px; @@ -49,6 +64,7 @@ page { border-radius: 50%; background: #ccc; } + /* .comment { height: 40px; flex-grow: 1; @@ -74,7 +90,8 @@ page { font-size: 13px; line-height: 1.4; - .main-comment, .sub-comment { + .main-comment, + .sub-comment { width: 100%; display: flex; flex-direction: row; diff --git a/miniprogram/packageSkyline/pages/half-page/half-page/index.wxml b/miniprogram/packageSkyline/pages/half-page/half-page/index.wxml index 5feea3fb..4b268a8f 100644 --- a/miniprogram/packageSkyline/pages/half-page/half-page/index.wxml +++ b/miniprogram/packageSkyline/pages/half-page/half-page/index.wxml @@ -1,6 +1,6 @@ - + diff --git a/miniprogram/packageSkyline/pages/half-page/scale-page/index.js b/miniprogram/packageSkyline/pages/half-page/scale-page/index.js index 1b6c9335..6299b525 100644 --- a/miniprogram/packageSkyline/pages/half-page/scale-page/index.js +++ b/miniprogram/packageSkyline/pages/half-page/scale-page/index.js @@ -1,22 +1,21 @@ -import { showTips } from '../../../common/tips'; -import { worklet, supportWorklet } from '../../../common/worklet-api'; +import { showTips } from '../../../common/tips' +import { worklet, supportWorklet } from '../../../common/worklet-api' Page({ data: {}, onLoad: function onLoad() { if (this.renderer !== 'skyline' || !supportWorklet()) { showTips() - return; } }, jump: function jump() { wx.navigateTo({ routeType: 'HalfScreenDialog', url: '/packageSkyline/pages/half-page/half-page/index' - }); + }) }, back: function back() { - wx.navigateBack(); + wx.navigateBack() }, /** @@ -28,4 +27,4 @@ Page({ path: 'packageSkyline/pages/half-page/scale-page/index' } }, -}); +}) diff --git a/miniprogram/packageSkyline/pages/share-element/card/index.js b/miniprogram/packageSkyline/pages/share-element/card/index.js index a4f75380..63db979a 100644 --- a/miniprogram/packageSkyline/pages/share-element/card/index.js +++ b/miniprogram/packageSkyline/pages/share-element/card/index.js @@ -1,4 +1,4 @@ -import {cardList} from '../data' +import { cardList } from '../data' Component({ properties: { diff --git a/miniprogram/packageSkyline/pages/share-element/list/index.js b/miniprogram/packageSkyline/pages/share-element/list/index.js index 52d1fd78..6d466c28 100644 --- a/miniprogram/packageSkyline/pages/share-element/list/index.js +++ b/miniprogram/packageSkyline/pages/share-element/list/index.js @@ -1,8 +1,8 @@ // @ts-nocheck -import {supportWorklet} from '../../../common/worklet-api' -import {cardList} from '../data' +import { supportWorklet } from '../../../common/worklet-api' +import { cardList } from '../data' import CustomRouteType from '../../../common/custom-route/index' -import {showTips} from '../../../common/tips' +import { showTips } from '../../../common/tips' Page({ data: { @@ -16,7 +16,7 @@ Page({ }, go(e) { - const {idx} = e.currentTarget.dataset + const { idx } = e.currentTarget.dataset wx.navigateTo({ url: `/packageSkyline/pages/share-element/card/index?idx=${idx}`, routeType: CustomRouteType.OpacityTransition, diff --git a/miniprogram/packageSkyline/pages/worklet/animation/index.js b/miniprogram/packageSkyline/pages/worklet/animation/index.js index 899d42be..451697eb 100644 --- a/miniprogram/packageSkyline/pages/worklet/animation/index.js +++ b/miniprogram/packageSkyline/pages/worklet/animation/index.js @@ -1,86 +1,89 @@ -import { worklet, supportWorklet } from '../../../common/worklet-api'; -import { showTips } from '../../../common/tips'; -const { shared, repeat, sequence, spring, timing, Easing, cancelAnimation } = worklet; +import { worklet, supportWorklet } from '../../../common/worklet-api' +import { showTips } from '../../../common/tips' -var app = getApp(); -var windowWidth = app.globalData.windowWidth - 100; +const { + shared, repeat, sequence, spring, timing, Easing, cancelAnimation +} = worklet + +const app = getApp() +const windowWidth = app.globalData.windowWidth - 100 Page({ data: { list: ['Basic Move', 'Timing Move', 'Spring Animation', 'Repeat Animation', 'Sequence Animation' // 'Decay Animation', ] }, onLoad: function onLoad() { - var _this = this; + const _this = this if (this.renderer !== 'skyline' || !supportWorklet()) { showTips() - return; + return } - var numsOfBox = this.data.list.length; - var sharedValueArr = []; + const numsOfBox = this.data.list.length + const sharedValueArr = [] - var _loop = function _loop(i) { - var translate = shared(0); - sharedValueArr.push(translate); + const _loop = function _loop(i) { + const translate = shared(0) + sharedValueArr.push(translate) - _this.applyAnimatedStyle(".box".concat(i), function () { - 'worklet'; + _this.applyAnimatedStyle('.box'.concat(i), function () { + 'worklet' return { - transform: "translateX(".concat(translate.value, "px)") - }; - }); - }; + transform: 'translateX('.concat(translate.value, 'px)') + } + }) + } - for (var i = 0; i < numsOfBox; i++) { - _loop(i); + for (let i = 0; i < numsOfBox; i++) { + _loop(i) } - this.sharedValueArr = sharedValueArr; + this.sharedValueArr = sharedValueArr }, startAnimation: function startAnimation() { - var toValue = this.toValue === windowWidth ? 0 : windowWidth; - this.didBasic(0, toValue); - this.didTiming(1, toValue); - this.didSpring(2, toValue); - this.didRepeat(3, toValue); - this.didSequence(4, toValue); + const toValue = this.toValue === windowWidth ? 0 : windowWidth + this.didBasic(0, toValue) + this.didTiming(1, toValue) + this.didSpring(2, toValue) + this.didRepeat(3, toValue) + this.didSequence(4, toValue) - this.toValue = toValue; + this.toValue = toValue }, cancelAnimation() { for (const sv of this.sharedValueArr) { - cancelAnimation(sv); + cancelAnimation(sv) } }, didBasic: function didBasic(idx, toValue) { - this.sharedValueArr[idx].value = toValue; + this.sharedValueArr[idx].value = toValue }, didTiming: function didTiming(idx, toValue) { this.sharedValueArr[idx].value = timing(toValue, { duration: 1500, easing: Easing.linear }, function () { - 'worklet'; + 'worklet' - console.log('timing done'); - }); + console.log('timing done') + }) }, didSpring: function didSpring(idx, toValue) { this.sharedValueArr[idx].value = spring(toValue, {}, function () { - 'worklet'; + 'worklet' - console.log('spring done'); - }); + console.log('spring done') + }) }, didRepeat: function didRepeat(idx, toValue) { this.sharedValueArr[idx].value = repeat(timing(toValue, { duration: 400 }), 4, true, function () { - 'worklet'; + 'worklet' - console.log('repeat done'); - }); + console.log('repeat done') + }) }, didSequence: function didSequence(idx) { this.sharedValueArr[idx].value = sequence(timing(0, { @@ -93,7 +96,7 @@ Page({ duration: 400 }), timing(0, { duration: 50 - })); + })) }, /** @@ -106,4 +109,4 @@ Page({ } }, -}); +}) diff --git a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.js b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.js index 6ced972d..3b9ba186 100644 --- a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.js +++ b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.js @@ -1,8 +1,8 @@ -import { GestureState } from '../../../common/types'; -import { worklet, supportWorklet } from '../../../common/worklet-api'; -import { showTips } from '../../../common/tips'; +import { GestureState } from '../../../common/types' +import { worklet, supportWorklet } from '../../../common/worklet-api' +import { showTips } from '../../../common/tips' -const { shared, timing } = worklet; +const { shared, timing } = worklet Page({ data: { @@ -12,52 +12,58 @@ Page({ onLoad() { if (this.renderer !== 'skyline' || !supportWorklet()) { showTips() - return; + return } - const transY = shared(0); + const transY = shared(0) this.applyAnimatedStyle('.list-wrp', () => { - 'worklet'; - return { transform: `translateY(${transY.value}px)` }; - }); - this.transY = transY; - this.scrollTop = shared(0); - this.startPan = shared(false); + 'worklet' + + return { transform: `translateY(${transY.value}px)` } + }) + this.transY = transY + this.scrollTop = shared(0) + this.startPan = shared(false) }, shouldPanResponse() { - 'worklet'; - return this.startPan.value; + 'worklet' + + return this.startPan.value }, shouldScrollViewResponse(pointerEvent) { - 'worklet'; - if (this.transY.value > 0) return false; - const scrollTop = this.scrollTop.value; - const { deltaY } = pointerEvent; - const result = !(scrollTop <= 0 && deltaY > 0); - this.startPan.value = !result; - return result; + 'worklet' + + if (this.transY.value > 0) return false + const scrollTop = this.scrollTop.value + const { deltaY } = pointerEvent + const result = !(scrollTop <= 0 && deltaY > 0) + this.startPan.value = !result + return result }, handlePan(gestureEvent) { - 'worklet'; + 'worklet' + if (gestureEvent.state === GestureState.ACTIVE) { - const curPosition = this.transY.value; - const destination = Math.max(0, curPosition + gestureEvent.deltaY); - if (curPosition === destination) return; - this.transY.value = destination; + const curPosition = this.transY.value + const destination = Math.max(0, curPosition + gestureEvent.deltaY) + if (curPosition === destination) return + this.transY.value = destination } if (gestureEvent.state === GestureState.END || gestureEvent.state === GestureState.CANCELLED) { - this.transY.value = timing(0); - this.startPan.value = false; + this.transY.value = timing(0) + this.startPan.value = false } }, adjustDecelerationVelocity(velocity) { - 'worklet'; - const scrollTop = this.scrollTop.value; - return scrollTop <= 0 ? 0 : velocity; + 'worklet' + + const scrollTop = this.scrollTop.value + return scrollTop <= 0 ? 0 : velocity }, handleScroll(evt) { - 'worklet'; - this.scrollTop.value = evt.detail.scrollTop; + 'worklet' + + this.scrollTop.value = evt.detail.scrollTop }, /** @@ -69,4 +75,4 @@ Page({ path: 'packageSkyline/pages/worklet/bottom-sheet/index' } }, -}); +}) diff --git a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxml b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxml index 0c4e5889..dcaa5ea7 100644 --- a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxml +++ b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxml @@ -1,15 +1,17 @@ - + + - - - - - - - - + + + + + + + + - + + \ No newline at end of file diff --git a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxss b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxss index 7c35c806..512ea687 100644 --- a/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxss +++ b/miniprogram/packageSkyline/pages/worklet/bottom-sheet/index.wxss @@ -1,3 +1,4 @@ +@import "/common/reset.wxss"; .page-container { width: 100%; height: 100%; diff --git a/miniprogram/packageSkyline/pages/worklet/gesture/index.js b/miniprogram/packageSkyline/pages/worklet/gesture/index.js index f2a680de..fc6fa252 100644 --- a/miniprogram/packageSkyline/pages/worklet/gesture/index.js +++ b/miniprogram/packageSkyline/pages/worklet/gesture/index.js @@ -1,7 +1,8 @@ -import { GestureState } from '../../../common/types'; -import { worklet, supportWorklet } from '../../../common/worklet-api'; -import { showTips } from '../../../common/tips'; -const { shared, derived, spring } = worklet; +import { GestureState } from '../../../common/types' +import { worklet, supportWorklet } from '../../../common/worklet-api' +import { showTips } from '../../../common/tips' + +const { shared, derived, spring } = worklet Page({ data: {}, @@ -9,37 +10,39 @@ Page({ onLoad() { if (this.renderer !== 'skyline' || !supportWorklet()) { showTips() - return; + return } - const x = shared(0); - const y = shared(0); - const pressed = shared(false); - const scale = derived(() => spring(pressed.value ? 1.2 : 1)); + const x = shared(0) + const y = shared(0) + const pressed = shared(false) + const scale = derived(() => spring(pressed.value ? 1.2 : 1)) this.applyAnimatedStyle('.circle', () => { - 'worklet'; + 'worklet' + return { backgroundColor: pressed.value ? '#5f9ea0' : '#adff2f', transform: `translate(${x.value}px, ${y.value}px) scale(${scale.value})`, - }; - }); + } + }) - this.x = x; - this.y = y; - this.pressed = pressed; + this.x = x + this.y = y + this.pressed = pressed }, handlepan(gestureEvent) { - 'worklet'; + 'worklet' + console.log('gestureEvent--------------', gestureEvent.state) if (gestureEvent.state === GestureState.POSSIBLE) { - this.pressed.value = true; + this.pressed.value = true } else if (gestureEvent.state === GestureState.END || gestureEvent.state === GestureState.CANCELLED) { - this.pressed.value = false; - this.x.value = spring(0); - this.y.value = spring(0); + this.pressed.value = false + this.x.value = spring(0) + this.y.value = spring(0) } else if (gestureEvent.state === GestureState.ACTIVE) { - this.x.value += gestureEvent.deltaX; - this.y.value += gestureEvent.deltaY; + this.x.value += gestureEvent.deltaX + this.y.value += gestureEvent.deltaY } }, @@ -52,4 +55,4 @@ Page({ path: 'packageSkyline/pages/worklet/gesture/index' } }, -}); +}) diff --git a/miniprogram/packageSkyline/utils/comment.js b/miniprogram/packageSkyline/utils/comment.js index 814f40a6..fe7401c6 100644 --- a/miniprogram/packageSkyline/utils/comment.js +++ b/miniprogram/packageSkyline/utils/comment.js @@ -2,124 +2,124 @@ export function getCommentList() { return [ { - "comment":"为了进一步优化小程序性能,提供更为接近原生的用户体验,我们在 WebView 渲染之外新增了一个渲染引擎 Skyline,其使用更精简高效的渲染管线,并带来诸多增强特性,让 Skyline 拥有更接近原生渲染的性能体验。", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "subCommentList":[ - { - "comment":"界面更不容易被逻辑阻塞,进一步减少卡顿。", - "userName":"拖拉机🚜", - "userHeadImg":"https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw", - "replyUserName":"binnie" + comment: '为了进一步优化小程序性能,提供更为接近原生的用户体验,我们在 WebView 渲染之外新增了一个渲染引擎 Skyline,其使用更精简高效的渲染管线,并带来诸多增强特性,让 Skyline 拥有更接近原生渲染的性能体验。', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + subCommentList: [ + { + comment: '界面更不容易被逻辑阻塞,进一步减少卡顿。', + userName: '拖拉机🚜', + userHeadImg: 'https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw', + replyUserName: 'binnie' }, - { - "comment":"无需为每个页面新建一个 JS 引擎实例(WebView),减少了内存、时间开销。", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "replyUserName":"拖拉机🚜", + { + comment: '无需为每个页面新建一个 JS 引擎实例(WebView),减少了内存、时间开销。', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + replyUserName: '拖拉机🚜', }, - { - "comment":"框架可以在页面之间共享更多的资源,进一步减少运行时内存、时间开销。", - "userName":"拖拉机🚜", - "userHeadImg":"https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw", - "replyUserName":"binnie" + { + comment: '框架可以在页面之间共享更多的资源,进一步减少运行时内存、时间开销。', + userName: '拖拉机🚜', + userHeadImg: 'https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw', + replyUserName: 'binnie' }, - { - "comment":"框架的代码之间无需再通过 JSBridge 进行数据交换,减少了大量通信时间开销。", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "replyUserName":"拖拉机🚜", + { + comment: '框架的代码之间无需再通过 JSBridge 进行数据交换,减少了大量通信时间开销。', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + replyUserName: '拖拉机🚜', } ] }, { - "comment":"Skyline 以性能为首要目标,因此特性上在满足基本需求的前提下进行了大幅精简,目前 Skyline 只实现了 CSS 特性的子集。在编码上,Skyline 与 WebView 模式保持一致,仍使用 WXML 和 WXSS 编写界面。在不采用 Skyline 新增特性的情况下,适配了 Skyline 的小程序在低版本或未支持 Skyline 的平台上可无缝自动退回到 WebView 渲染。", - "userName":"拖拉机🚜", - "userHeadImg":"https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw", - "subCommentList":[ - { - "comment":"基于 Worklet 机制的 动画模块,能够在渲染线程同步运行动画相关逻辑。", - "userName":"拖拉机🚜", - "userHeadImg":"https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw", - "replyUserName":"binnie" + comment: 'Skyline 以性能为首要目标,因此特性上在满足基本需求的前提下进行了大幅精简,目前 Skyline 只实现了 CSS 特性的子集。在编码上,Skyline 与 WebView 模式保持一致,仍使用 WXML 和 WXSS 编写界面。在不采用 Skyline 新增特性的情况下,适配了 Skyline 的小程序在低版本或未支持 Skyline 的平台上可无缝自动退回到 WebView 渲染。', + userName: '拖拉机🚜', + userHeadImg: 'https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw', + subCommentList: [ + { + comment: '基于 Worklet 机制的 动画模块,能够在渲染线程同步运行动画相关逻辑。', + userName: '拖拉机🚜', + userHeadImg: 'https://res.wx.qq.com/op_res/0AG3_hOKnGAqBhAhBx_a__0nu3Q_hGgnBQgiQhJMqZrvroKqdtYXhcSUdlp59bXjx7qF-ddTwGCcB-AqzYmlrw', + replyUserName: 'binnie' }, - { - "comment":"基于 Worklet 机制的 手势系统。在渲染线程同步监听手势、执行手势相关逻辑;支持手势协商处理;", - "userName":"小苹果🍎", - "userHeadImg":"https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJBAK7KJg9KId_6N1-rJ4OyCCQoJGVMOaTabboo2viRucoxkPvHRkn2fVl6tectlzBg", - "replyUserName":"binnie" + { + comment: '基于 Worklet 机制的 手势系统。在渲染线程同步监听手势、执行手势相关逻辑;支持手势协商处理;', + userName: '小苹果🍎', + userHeadImg: 'https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJBAK7KJg9KId_6N1-rJ4OyCCQoJGVMOaTabboo2viRucoxkPvHRkn2fVl6tectlzBg', + replyUserName: 'binnie' }, - { - "comment":"基于 Worklet 机制的 自定义路由模块,支持实现自定义路由动画和交互。", - "userName":"流星雨", - "userHeadImg":"https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYf3q0W302-kseD8VxLKoItZ6HgneLkgpQSEMIgEKz_xVE7putZxs2YEYqB13Uh37_w", - "replyUserName":"binnie" + { + comment: '基于 Worklet 机制的 自定义路由模块,支持实现自定义路由动画和交互。', + userName: '流星雨', + userHeadImg: 'https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYf3q0W302-kseD8VxLKoItZ6HgneLkgpQSEMIgEKz_xVE7putZxs2YEYqB13Uh37_w', + replyUserName: 'binnie' }, - { - "comment":"支持 跨页面共享元素,能够将上一个页面的元素“共享”到下一个页面,并伴随着过渡动画。", - "userName":"落日余晖", - "userHeadImg":"https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA", - "replyUserName":"binnie" + { + comment: '支持 跨页面共享元素,能够将上一个页面的元素“共享”到下一个页面,并伴随着过渡动画。', + userName: '落日余晖', + userHeadImg: 'https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA', + replyUserName: 'binnie' }, ] }, { - "comment":"Skyline 能很好地保持和原有架构的兼容性,基于 WebView 环境的小程序代码基本上无需任何改动即可直接在新的架构下运行。", - "userName":"小苹果🍎", - "userHeadImg":"https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJBAK7KJg9KId_6N1-rJ4OyCCQoJGVMOaTabboo2viRucoxkPvHRkn2fVl6tectlzBg", - "subCommentList":[] + comment: 'Skyline 能很好地保持和原有架构的兼容性,基于 WebView 环境的小程序代码基本上无需任何改动即可直接在新的架构下运行。', + userName: '小苹果🍎', + userHeadImg: 'https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJBAK7KJg9KId_6N1-rJ4OyCCQoJGVMOaTabboo2viRucoxkPvHRkn2fVl6tectlzBg', + subCommentList: [] }, { - "comment":"Skyline 支持了一些 Web 所缺失的但很重要的能力,以满足开发者实现更好的交互体验。", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "subCommentList":[ + comment: 'Skyline 支持了一些 Web 所缺失的但很重要的能力,以满足开发者实现更好的交互体验。', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + subCommentList: [ ] }, { - "comment":"worklet 动画可以做到类原生动画般的体验。", - "userName":"流星雨", - "userHeadImg":"https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYf3q0W302-kseD8VxLKoItZ6HgneLkgpQSEMIgEKz_xVE7putZxs2YEYqB13Uh37_w", - "subCommentList":[ + comment: 'worklet 动画可以做到类原生动画般的体验。', + userName: '流星雨', + userHeadImg: 'https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYf3q0W302-kseD8VxLKoItZ6HgneLkgpQSEMIgEKz_xVE7putZxs2YEYqB13Uh37_w', + subCommentList: [ { - "comment":"提供如 timing、spring 等常见动画方式的封装方法,开发者可自定义动画曲线,同时可对不同的动画类型进行组合、重复,形成交织动画。😄", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "replyUserName":"流星雨" + comment: '提供如 timing、spring 等常见动画方式的封装方法,开发者可自定义动画曲线,同时可对不同的动画类型进行组合、重复,形成交织动画。😄', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + replyUserName: '流星雨' } ] }, { - "comment":"Skyline 中 wxs 代码运行在 AppService 线程,而事件产生在 UI 线程,因此 wxs 动画 性能有所降低,为了提升小程序交互体验的效果,我们内置了一批手势组件。", - "userName":"落日余晖", - "userHeadImg":"https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA", - "subCommentList": [ + comment: 'Skyline 中 wxs 代码运行在 AppService 线程,而事件产生在 UI 线程,因此 wxs 动画 性能有所降低,为了提升小程序交互体验的效果,我们内置了一批手势组件。', + userName: '落日余晖', + userHeadImg: 'https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA', + subCommentList: [ { - "comment":"免去开发者监听 touch 事件,自行计算手势逻辑的复杂步骤;", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "replyUserName":"落日余晖" + comment: '免去开发者监听 touch 事件,自行计算手势逻辑的复杂步骤;', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + replyUserName: '落日余晖' }, { - "comment":"手势组件直接在 UI 线程响应,避免了传递到 JS 线程带来的延迟;", - "userName":"落日余晖", - "userHeadImg":"https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA", - "replyUserName":"binnie" + comment: '手势组件直接在 UI 线程响应,避免了传递到 JS 线程带来的延迟;', + userName: '落日余晖', + userHeadImg: 'https://res.wx.qq.com/op_res/7_miJnK0wxIrh5bV2QqvYYjda9Dp372N3T05q_nn3PgvoXBoReXvaXBfkthtXQLN7m5_YI6FoTre-xvJBDFLMA', + replyUserName: 'binnie' } ] }, { - "comment":"在连续的 Skyline 页面间跳转时,可实现自定义路由效果,路由动画的曲线、时长均可交由开发者控制。", - "userName":"binnie", - "userHeadImg":"http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132", - "subCommentList":[] + comment: '在连续的 Skyline 页面间跳转时,可实现自定义路由效果,路由动画的曲线、时长均可交由开发者控制。', + userName: 'binnie', + userHeadImg: 'http://wx.qlogo.cn/mmhead/uI5pczeERTajXl904XSbHwAtGENC5ccKvo2F54sgYeqibHxOXNAFKdg/132', + subCommentList: [] }, { - "comment":"在连续的两个 Skyline 页面跳转时,可以将上一个页面的元素“共享”到下一个页面,并伴随着过渡动画。", - "userName":"绿意盎然", - "userHeadImg":"https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJH2f0R4uXyqnNGlrivO8cKbn0nz1DE_6s22rc91zluwIrqiAVZNREvCeVYAUS8aaZw", - "subCommentList":[] + comment: '在连续的两个 Skyline 页面跳转时,可以将上一个页面的元素“共享”到下一个页面,并伴随着过渡动画。', + userName: '绿意盎然', + userHeadImg: 'https://res.wx.qq.com/op_res/0-l2fyKjv3_BR62E3KwTJH2f0R4uXyqnNGlrivO8cKbn0nz1DE_6s22rc91zluwIrqiAVZNREvCeVYAUS8aaZw', + subCommentList: [] }, ] -} \ No newline at end of file +} diff --git a/miniprogram/packageSkyline/utils/route.js b/miniprogram/packageSkyline/utils/route.js index 531cdca3..d9880a1a 100644 --- a/miniprogram/packageSkyline/utils/route.js +++ b/miniprogram/packageSkyline/utils/route.js @@ -4,6 +4,7 @@ export function initRoute() { wx.router.addRouteBuilder('fadeToggle', ({ primaryAnimation }) => { const handlePrimaryAnimation = () => { 'worklet' + return { opacity: fastOutSlowIn(primaryAnimation.value), } diff --git a/miniprogram/packageSkyline/utils/tool.js b/miniprogram/packageSkyline/utils/tool.js index 0031e0c1..0dea6767 100644 --- a/miniprogram/packageSkyline/utils/tool.js +++ b/miniprogram/packageSkyline/utils/tool.js @@ -73,7 +73,9 @@ export function getAlbum() { let rectInfo = null export function getRectInfo() { if (!rectInfo) { - const { safeArea, screenWidth, screenHeight, windowWidth, windowHeight } = wx.getSystemInfoSync() + const { + safeArea, screenWidth, screenHeight, windowWidth, windowHeight + } = wx.getSystemInfoSync() const menuButtomRect = wx.getMenuButtonBoundingClientRect() rectInfo = { @@ -91,8 +93,6 @@ export function getRectInfo() { return rectInfo } - - export function timeFormat(date, reg) { date = date instanceof Date ? date : new Date(date) const map = {} diff --git a/miniprogram/packageXRFrame/components/common/share-behavior.js b/miniprogram/packageXRFrame/components/common/share-behavior.js index c93ba02b..6424375c 100644 --- a/miniprogram/packageXRFrame/components/common/share-behavior.js +++ b/miniprogram/packageXRFrame/components/common/share-behavior.js @@ -1,48 +1,48 @@ export default Behavior({ - created: function () { - this.checkInitShare(); + created() { + this.checkInitShare() }, methods: { checkInitShare() { - wx.xrScene = undefined; + wx.xrScene = undefined if (!this.scene) { setTimeout(() => { this.checkInitShare() - }, 100); - return; + }, 100) + return } if (this.scene.ar) { if (this.scene.ar.ready) { - this.initARTrackerState(this.scene); - } else { - this.scene.event.add('ar-ready', () => this.initARTrackerState(this.scene)); + this.initARTrackerState(this.scene) + } else { + this.scene.event.add('ar-ready', () => this.initARTrackerState(this.scene)) } } if (!this.scene.share.supported) { - console.warn('Not support xr-frame share system now!'); - return; + console.warn('Not support xr-frame share system now!') + return } - this.sharing = false; - wx.xrScene = this.scene; + this.sharing = false + wx.xrScene = this.scene }, initARTrackerState(scene) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() scene.dfs(() => {}, undefined, true, el => { - const comp = el.getComponent(xrFrameSystem.ARTracker); + const comp = el.getComponent(xrFrameSystem.ARTracker) if (comp) { if (typeof comp.state === 'number') { - this.triggerEvent('arTrackerState', {state: comp.state, error: comp.errorMessage}); + this.triggerEvent('arTrackerState', { state: comp.state, error: comp.errorMessage }) el.event.add('ar-tracker-state', tracker => { - this.triggerEvent('arTrackerState', {state: tracker.state, error: tracker.errorMessage}); - }); + this.triggerEvent('arTrackerState', { state: tracker.state, error: tracker.errorMessage }) + }) } - return true; + return true } - }); + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/pull-down-list/index.js b/miniprogram/packageXRFrame/components/pull-down-list/index.js index 3a49895c..42f96326 100644 --- a/miniprogram/packageXRFrame/components/pull-down-list/index.js +++ b/miniprogram/packageXRFrame/components/pull-down-list/index.js @@ -1,48 +1,48 @@ -const itemHeight = 56 * 2; +const itemHeight = 56 * 2 Component({ - data: { - childBoxHeight: 0, + data: { + childBoxHeight: 0, + }, + externalClasses: ['t-class'], + properties: { + defaultOpen: { + type: Boolean, + value: false, }, - externalClasses: ['t-class'], - properties: { - defaultOpen: { - type: Boolean, - value: false, - }, - name: { - type: String, - value: '', - }, - tag: { - type: String, - value: '', - }, - root: { - type: String, - value: '', - }, - childArr: { - type: Array, - value: [], - observer(childArr) { - this.setData({ - childBoxHeight: this.data.defaultOpen ? itemHeight * childArr.length : 0, - }); - }, - }, + name: { + type: String, + value: '', }, - methods: { - switchHandle() { - const { childArr, childBoxHeight } = this.data; - this.setData({ - childBoxHeight: childBoxHeight > 0 ? 0 : childArr.length * itemHeight, - }); - }, - tapChild(e) { - this.triggerEvent('click', { - ...e.target.dataset, - root: this.data.root - }); - }, + tag: { + type: String, + value: '', }, -}); + root: { + type: String, + value: '', + }, + childArr: { + type: Array, + value: [], + observer(childArr) { + this.setData({ + childBoxHeight: this.data.defaultOpen ? itemHeight * childArr.length : 0, + }) + }, + }, + }, + methods: { + switchHandle() { + const { childArr, childBoxHeight } = this.data + this.setData({ + childBoxHeight: childBoxHeight > 0 ? 0 : childArr.length * itemHeight, + }) + }, + tapChild(e) { + this.triggerEvent('click', { + ...e.target.dataset, + root: this.data.root + }) + }, + }, +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-arGlasses/index.js b/miniprogram/packageXRFrame/components/template/xr-template-arGlasses/index.js index 978de010..55118853 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-arGlasses/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-arGlasses/index.js @@ -5,45 +5,45 @@ Component({ arReady: false, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) // 延时保证场上存在脸模 - setTimeout(()=>{ - const xrSystem = wx.getXrFrameSystem(); + setTimeout(() => { + const xrSystem = wx.getXrFrameSystem() // 替换状态 - const faceElm = this.scene.getElementById('face'); - const faceGLTF = faceElm.getComponent(xrSystem.GLTF); + const faceElm = this.scene.getElementById('face') + const faceGLTF = faceElm.getComponent(xrSystem.GLTF) - for(const mesh of faceGLTF.meshes) { + for (const mesh of faceGLTF.meshes) { // 通过alphaMode 的 Setter 设置,或者写入renderState,但需要手动控制宏 - mesh.material.alphaMode = "BLEND"; - mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(1, 1, 1, 0.0)); + mesh.material.alphaMode = 'BLEND' + mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(1, 1, 1, 0.0)) } - }, 33); + }, 33) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -53,8 +53,7 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); - + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-arLine/index.js b/miniprogram/packageXRFrame/components/template/xr-template-arLine/index.js index fe441181..c39dbecf 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-arLine/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-arLine/index.js @@ -25,118 +25,115 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) - const xr = wx.getXrFrameSystem(); - const scene = this.scene; + const xr = wx.getXrFrameSystem() + const scene = this.scene - const root = scene.getElementById('root'); - const cursor = scene.getElementById('cursor'); - const cursorTrs = cursor.getComponent(xr.Transform); + const root = scene.getElementById('root') + const cursor = scene.getElementById('cursor') + const cursorTrs = cursor.getComponent(xr.Transform) - const geometryPoint = scene.assets.getAsset('geometry', 'sphere'); - const geometryLine = scene.assets.getAsset('geometry', 'cube'); - const effectStandard = scene.assets.getAsset('effect', 'standard'); + const geometryPoint = scene.assets.getAsset('geometry', 'sphere') + const geometryLine = scene.assets.getAsset('geometry', 'cube') + const effectStandard = scene.assets.getAsset('effect', 'standard') - let preCubeTrs = undefined; - let touchFlag = false; + let preCubeTrs + let touchFlag = false // 缓存这些常量 - const forward = xr.Vector3.createFromNumber(0,0,0); - const up = xr.Vector3.createFromNumber(0, 1, 0); - const useQuaternion = xr.Quaternion.createFromNumber(0, 0, 0, 0); + const forward = xr.Vector3.createFromNumber(0, 0, 0) + const up = xr.Vector3.createFromNumber(0, 1, 0) + const useQuaternion = xr.Quaternion.createFromNumber(0, 0, 0, 0) scene.event.add('touchstart', (e) => { // 点击开始后,放置 if (touchFlag) { // 控制点击频率 - return; + return } - touchFlag = true; + touchFlag = true // 新的cube const cubeEle = scene.createElement(xr.XRNode, { - }); - const cubeTrs = cubeEle.getComponent(xr.Transform); - const mat = scene.createMaterial(effectStandard); - const color1 = colorPattern1[Math.floor(Math.random() * colorPattern1.length)]; - mat.setVector('u_baseColorFactor', xr.Vector4.createFromNumber(color1[0], color1[1], color1[2], 1.0)); - mat.setRenderState('cullFace', xr.ECullMode.BACK); + }) + const cubeTrs = cubeEle.getComponent(xr.Transform) + const mat = scene.createMaterial(effectStandard) + const color1 = colorPattern1[Math.floor(Math.random() * colorPattern1.length)] + mat.setVector('u_baseColorFactor', xr.Vector4.createFromNumber(color1[0], color1[1], color1[2], 1.0)) + mat.setRenderState('cullFace', xr.ECullMode.BACK) const mesh = cubeEle.addComponent(xr.Mesh, { geometry: geometryPoint, material: mat, - }); + }) // 加到场上 - root.addChild(cubeEle); + root.addChild(cubeEle) // 获取相机 cursor 位置,并设置到新元素 - cubeTrs.setLocalMatrix(cursorTrs.worldMatrix); + cubeTrs.setLocalMatrix(cursorTrs.worldMatrix) // 延时,控制点击频率,并保证矩阵信息完备 setTimeout(() => { - touchFlag = false; + touchFlag = false if (preCubeTrs) { // 存在上一个,进行连线 - const preWorldPosition = preCubeTrs.worldPosition; - const worldPosition = cubeTrs.worldPosition; + const preWorldPosition = preCubeTrs.worldPosition + const worldPosition = cubeTrs.worldPosition // console.log(preWorldPosition.x, preWorldPosition.y, preWorldPosition.z, worldPosition.x, worldPosition.y, worldPosition.z) - + // 算中点 const posX = (preWorldPosition.x + worldPosition.x) / 2 const posY = (preWorldPosition.y + worldPosition.y) / 2 const posZ = (preWorldPosition.z + worldPosition.z) / 2 // forwad 向量 - preWorldPosition.sub(worldPosition, forward); - console.log(forward.x, forward.y, forward.z); + preWorldPosition.sub(worldPosition, forward) + console.log(forward.x, forward.y, forward.z) // 向量的模 - const module = preWorldPosition.distanceTo(worldPosition); + const module = preWorldPosition.distanceTo(worldPosition) // 方向四元数 - xr.Quaternion.lookRotation(forward, up, useQuaternion); + xr.Quaternion.lookRotation(forward, up, useQuaternion) console.log(useQuaternion.x, useQuaternion.y, useQuaternion.z, useQuaternion.w) - const lineSize = 0.02; + const lineSize = 0.02 // line const lineEle = scene.createElement(xr.XRNode, { position: `${posX} ${posY} ${posZ}`, scale: `${lineSize} ${lineSize} ${module}` - }); + }) // 加到场上 - root.addChild(lineEle); - const lineTrs = lineEle.getComponent(xr.Transform); - lineTrs.quaternion.x = useQuaternion.x; - lineTrs.quaternion.y = useQuaternion.y; - lineTrs.quaternion.z = useQuaternion.z; - lineTrs.quaternion.w = useQuaternion.w; - - const matLine = scene.createMaterial(effectStandard); - const color2 = colorPattern2[Math.floor(Math.random() * colorPattern2.length)]; - - matLine.setVector('u_baseColorFactor', xr.Vector4.createFromNumber(color2[0], color2[1], color2[2], 1.0)); - matLine.setRenderState('cullFace', xr.ECullMode.FRONT); + root.addChild(lineEle) + const lineTrs = lineEle.getComponent(xr.Transform) + lineTrs.quaternion.x = useQuaternion.x + lineTrs.quaternion.y = useQuaternion.y + lineTrs.quaternion.z = useQuaternion.z + lineTrs.quaternion.w = useQuaternion.w + + const matLine = scene.createMaterial(effectStandard) + const color2 = colorPattern2[Math.floor(Math.random() * colorPattern2.length)] + + matLine.setVector('u_baseColorFactor', xr.Vector4.createFromNumber(color2[0], color2[1], color2[2], 1.0)) + matLine.setRenderState('cullFace', xr.ECullMode.FRONT) const meshLine = lineEle.addComponent(xr.Mesh, { geometry: geometryLine, material: matLine, - }); - + }) + preCubeTrs = cubeTrs - }else { + } else { preCubeTrs = cubeTrs } - }, 100); - - - }); - + }, 100) + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-arPreview/index.js b/miniprogram/packageXRFrame/components/template/xr-template-arPreview/index.js index da4fa50d..65c06b56 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-arPreview/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-arPreview/index.js @@ -19,17 +19,19 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) const { width, height } = this.scene // 旋转缩放相关配置 this.radius = (width + height) / 4 this.rotateSpeed = 5 this.handleTouchStart = (event) => { - this.mouseInfo = { startX: 0, startY: 0, isDown: false, startPointerDistance: 0, state: STATE.NONE } + this.mouseInfo = { + startX: 0, startY: 0, isDown: false, startPointerDistance: 0, state: STATE.NONE + } this.mouseInfo.isDown = true const touch0 = event.touches[0] @@ -50,7 +52,6 @@ Component({ this.scene.event.add('touchmove', this.handleTouchMove.bind(this)) this.scene.event.addOnce('touchend', this.handleTouchEnd.bind(this)) - }, this.handleTouchMove = (event) => { const mouseInfo = this.mouseInfo @@ -59,26 +60,25 @@ Component({ } switch (mouseInfo.state) { - case STATE.MOVE: - if (event.touches.length === 1) { - this.handleRotate(event) - } else if (event.touches.length === 2) { + case STATE.MOVE: + if (event.touches.length === 1) { + this.handleRotate(event) + } else if (event.touches.length === 2) { // 支持单指变双指,兼容双指操作但是两根手指触屏时间不一致的情况 - this.scene.event.remove('touchmove', this.handleTouchMove) - this.scene.event.remove('touchend', this.handleTouchEnd) - this.handleTouchStart(event) - } - break - case STATE.ZOOM_OR_PAN: - if (event.touches.length === 1) { + this.scene.event.remove('touchmove', this.handleTouchMove) + this.scene.event.remove('touchend', this.handleTouchEnd) + this.handleTouchStart(event) + } + break + case STATE.ZOOM_OR_PAN: + if (event.touches.length === 1) { // 感觉双指松掉一指的行为还是不要自动切换成旋转了,实际操作有点奇怪 - } - else if (event.touches.length === 2) { - this.handleZoomOrPan(event) - } - break - default: - break + } else if (event.touches.length === 2) { + this.handleZoomOrPan(event) + } + break + default: + break } } @@ -96,9 +96,9 @@ Component({ const { startX, startY } = this.mouseInfo - const theta = (x - startX) / this.radius * - this.rotateSpeed - const phi = (y - startY) / this.radius * - this.rotateSpeed - if (Math.abs(theta) < .01 && Math.abs(phi) < .01) { + const theta = (x - startX) / this.radius * -this.rotateSpeed + const phi = (y - startY) / this.radius * -this.rotateSpeed + if (Math.abs(theta) < 0.01 && Math.abs(phi) < 0.01) { return } this.gltfItemTRS.rotation.x -= phi @@ -132,24 +132,24 @@ Component({ this.gltfItemTRS.scale.z *= s } }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // this.setData({loaded: true}); - this.placedFlag = false; - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.placedFlag = false + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) }, placeNode(event) { if (this.placedFlag) { - return; + return } const xrFrameSystem = wx.getXrFrameSystem() - this.placedFlag = true; + this.placedFlag = true this.scene.ar.placeHere('setitem', true) const anchorTRS = this.scene.getElementById('anchor').getComponent(xrFrameSystem.Transform) anchorTRS.setData({ visible: false }) @@ -158,15 +158,12 @@ Component({ anchorTRS.scale.z = 0 wx.setKeepScreenOn({ keepScreenOn: true }) - // 获取改动元素 this.gltfItemTRS = this.scene.getElementById('preview-model').getComponent(xrFrameSystem.Transform) this.gltfItemSubTRS = this.scene.getElementById('preview-model-sub').getComponent(xrFrameSystem.Transform) - - // 开启旋转缩放逻辑 this.scene.event.addOnce('touchstart', this.handleTouchStart) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-arui/index.js b/miniprogram/packageXRFrame/components/template/xr-template-arui/index.js index f508dc8f..0ed75f94 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-arui/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-arui/index.js @@ -19,28 +19,28 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // this.setData({loaded: true}); - this.placedFlag = false; - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.placedFlag = false + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) }, placeNode(event) { if (this.placedFlag) { - return; + return } const xrFrameSystem = wx.getXrFrameSystem() - this.placedFlag = true; + this.placedFlag = true this.scene.ar.placeHere('setitem', true) const anchorTRS = this.scene.getElementById('anchor').getComponent(xrFrameSystem.Transform) anchorTRS.setData({ visible: false }) @@ -50,4 +50,4 @@ Component({ wx.setKeepScreenOn({ keepScreenOn: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-blendDouble/index.js b/miniprogram/packageXRFrame/components/template/xr-template-blendDouble/index.js index 6cfc3f74..fc3b2084 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-blendDouble/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-blendDouble/index.js @@ -8,48 +8,44 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setBlend(); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setBlend() }, setBlend() { - const scene = this.scene; - const xrSystem = wx.getXrFrameSystem(); + const scene = this.scene + const xrSystem = wx.getXrFrameSystem() // 替换状态 - const blendElm = this.scene.getElementById('blend'); - const blendGLTF = blendElm.getComponent(xrSystem.GLTF); + const blendElm = this.scene.getElementById('blend') + const blendGLTF = blendElm.getComponent(xrSystem.GLTF) // 延时保证glTF解析完毕 - setTimeout(()=>{ - const frontMesh = blendGLTF.getPrimitivesByMeshName('柱体')[0].primitives[0]; - const frontMat = frontMesh.material; + setTimeout(() => { + const frontMesh = blendGLTF.getPrimitivesByMeshName('柱体')[0].primitives[0] + const frontMat = frontMesh.material // 正面 // 改变 RenderQueue 先绘制 - frontMat.setRenderState('renderQueue', 2500); + frontMat.setRenderState('renderQueue', 2500) // 开启剔除,去掉背面 - frontMat.setRenderState('cullOn', true); - frontMat.setRenderState('cullFace', xrSystem.ECullMode.BACK); + frontMat.setRenderState('cullOn', true) + frontMat.setRenderState('cullFace', xrSystem.ECullMode.BACK) - const backMesh = blendGLTF.getPrimitivesByMeshName('柱体.001')[0].primitives[0]; - const backMat = backMesh.material; + const backMesh = blendGLTF.getPrimitivesByMeshName('柱体.001')[0].primitives[0] + const backMat = backMesh.material // 背面 // 改变 RenderQueue 后绘制 - backMat.setRenderState('renderQueue', 2501); + backMat.setRenderState('renderQueue', 2501) // 开启剔除,去掉正面 - backMat.setRenderState('cullOn', true); - backMat.setRenderState('cullFace', xrSystem.ECullMode.FRONT); - - - }, 200); - + backMat.setRenderState('cullOn', true) + backMat.setRenderState('cullFace', xrSystem.ECullMode.FRONT) + }, 200) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-control/index.js b/miniprogram/packageXRFrame/components/template/xr-template-control/index.js index 8456e5a7..814e119f 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-control/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-control/index.js @@ -1,61 +1,61 @@ -let camera; -let player; -let xrFrameSystem; +let camera +let player +let xrFrameSystem // 位移速度 -let speed = 5; +const speed = 5 // 视角旋转的速度 -let smoothSpeed = 8; +const smoothSpeed = 8 // 世界坐标系下的标准方位 -let up; -let left; +let up +let left // player相关 -let position; -let quaternionP; //player的四元数 -let quaternionPIni; //player每次转动开始时的角度 -let quaternionPRes; //player每次需要转动到的角度 -let quaternionPTemp; //旋转四元数的临时变量 +let position +let quaternionP // player的四元数 +let quaternionPIni // player每次转动开始时的角度 +let quaternionPRes // player每次需要转动到的角度 +let quaternionPTemp // 旋转四元数的临时变量 // camera相关 -let quaternionC; //camera的四元数 -let quaternionCIni; //camera每次转动开始时的角度 -let quaternionCRes; //camera每次需要转动到的角度 +let quaternionC // camera的四元数 +let quaternionCIni // camera每次转动开始时的角度 +let quaternionCRes // camera每次需要转动到的角度 // 初始化是否完成的标记 -let initFinish = false; +let initFinish = false Component({ behaviors: [require('../../common/share-behavior').default], properties: { - width:Number, - height:Number, + width: Number, + height: Number, transferData: { - type:Object, - observer(newVal, oldVal){ - if(newVal.biasRotX != undefined){ - this.biasRotX = newVal.biasRotX; - this.biasRotY = newVal.biasRotY; + type: Object, + observer(newVal, oldVal) { + if (newVal.biasRotX != undefined) { + this.biasRotX = newVal.biasRotX + this.biasRotY = newVal.biasRotY } - if(newVal.initRotX != undefined){ - this.initRotX = newVal.initRotX; - this.initRotY = newVal.initRotY; + if (newVal.initRotX != undefined) { + this.initRotX = newVal.initRotX + this.initRotY = newVal.initRotY } - if(newVal.biasX != undefined){ - this.biasX = newVal.biasX; - this.biasY = newVal.biasY; + if (newVal.biasX != undefined) { + this.biasX = newVal.biasX + this.biasY = newVal.biasY } }, }, reset: { type: Number, observer(newVal, oldVal) { - //监听发生变化的reset后,执行重置逻辑 - position.set(xrFrameSystem.Vector3.createFromNumber(0, 1.6, 1)); - quaternionC.setFromYawRollPitch(0, 0, 0); - quaternionP.setFromYawRollPitch(Math.PI, 0, 0); + // 监听发生变化的reset后,执行重置逻辑 + position.set(xrFrameSystem.Vector3.createFromNumber(0, 1.6, 1)) + quaternionC.setFromYawRollPitch(0, 0, 0) + quaternionP.setFromYawRollPitch(Math.PI, 0, 0) } } }, @@ -67,100 +67,98 @@ Component({ handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - - xrFrameSystem = wx.getXrFrameSystem(); - camera = xrScene.getElementById("camera"); - player = xrScene.getElementById("player"); - - up = xrFrameSystem.Vector3.createFromNumber(0, 1, 0); - left = xrFrameSystem.Vector3.createFromNumber(1, 0, 0); - - quaternionC = camera.getComponent(xrFrameSystem.Transform).quaternion; - quaternionP = player.getComponent(xrFrameSystem.Transform).quaternion; - position = player.getComponent(xrFrameSystem.Transform).position; - - quaternionPIni = new xrFrameSystem.Quaternion(); - quaternionPIni.set(quaternionP); - quaternionPRes = new xrFrameSystem.Quaternion(); - quaternionPRes.set(quaternionP); - quaternionPTemp = new xrFrameSystem.Quaternion(); - quaternionPTemp.setFromYawRollPitch(0, 0, 0); - - quaternionCIni = new xrFrameSystem.Quaternion(); - quaternionCIni.set(quaternionC); - quaternionCRes = new xrFrameSystem.Quaternion(); - quaternionCRes.set(quaternionC); - - this.biasRotX = 0; - this.biasRotY = 0; - this.initRotX = 0; - this.initRotY = 0; - this.biasX = 0; - this.biasY = 0; - - initFinish = true; + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + + xrFrameSystem = wx.getXrFrameSystem() + camera = xrScene.getElementById('camera') + player = xrScene.getElementById('player') + + up = xrFrameSystem.Vector3.createFromNumber(0, 1, 0) + left = xrFrameSystem.Vector3.createFromNumber(1, 0, 0) + + quaternionC = camera.getComponent(xrFrameSystem.Transform).quaternion + quaternionP = player.getComponent(xrFrameSystem.Transform).quaternion + position = player.getComponent(xrFrameSystem.Transform).position + + quaternionPIni = new xrFrameSystem.Quaternion() + quaternionPIni.set(quaternionP) + quaternionPRes = new xrFrameSystem.Quaternion() + quaternionPRes.set(quaternionP) + quaternionPTemp = new xrFrameSystem.Quaternion() + quaternionPTemp.setFromYawRollPitch(0, 0, 0) + + quaternionCIni = new xrFrameSystem.Quaternion() + quaternionCIni.set(quaternionC) + quaternionCRes = new xrFrameSystem.Quaternion() + quaternionCRes.set(quaternionC) + + this.biasRotX = 0 + this.biasRotY = 0 + this.initRotX = 0 + this.initRotY = 0 + this.biasX = 0 + this.biasY = 0 + + initFinish = true }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleTick: function (dt) { - - //确保handleReady时期的初始化完成 - if (!initFinish) - return; + handleTick(dt) { + // 确保handleReady时期的初始化完成 + if (!initFinish) return - var deltaTime = dt.detail.value / 1000; + const deltaTime = dt.detail.value / 1000 - //------摄像头旋转逻辑------// - let rotX = (this.biasRotX - this.initRotX) / this.data.width * Math.PI; - let rotY = (this.biasRotY - this.initRotY) / this.data.height * Math.PI; + // ------摄像头旋转逻辑------// + const rotX = (this.biasRotX - this.initRotX) / this.data.width * Math.PI + const rotY = (this.biasRotY - this.initRotY) / this.data.height * Math.PI - //水平方向旋转player node + // 水平方向旋转player node if (this.biasRotX == 0) { - quaternionPIni.set(quaternionPTemp); - quaternionPRes.set(quaternionPTemp); + quaternionPIni.set(quaternionPTemp) + quaternionPRes.set(quaternionPTemp) } else { - quaternionPIni.multiply(xrFrameSystem.Quaternion.createFromAxisAngle(up, -rotX), quaternionPRes); + quaternionPIni.multiply(xrFrameSystem.Quaternion.createFromAxisAngle(up, -rotX), quaternionPRes) } - //垂直方向旋转camera node + // 垂直方向旋转camera node if (this.biasRotY == 0) { - quaternionCIni.set(quaternionCRes); - quaternionCRes.set(quaternionCRes); + quaternionCIni.set(quaternionCRes) + quaternionCRes.set(quaternionCRes) } else { - quaternionCIni.multiply(xrFrameSystem.Quaternion.createFromAxisAngle(left, rotY), quaternionCRes); + quaternionCIni.multiply(xrFrameSystem.Quaternion.createFromAxisAngle(left, rotY), quaternionCRes) } - quaternionPTemp.slerp(quaternionPRes, smoothSpeed * deltaTime, quaternionPTemp); - quaternionC.slerp(quaternionPTemp.multiply(quaternionCRes), smoothSpeed * deltaTime, quaternionC); + quaternionPTemp.slerp(quaternionPRes, smoothSpeed * deltaTime, quaternionPTemp) + quaternionC.slerp(quaternionPTemp.multiply(quaternionCRes), smoothSpeed * deltaTime, quaternionC) - //------摄像头位移逻辑------// - var x = this.biasX; - var y = this.biasY; + // ------摄像头位移逻辑------// + const x = this.biasX + const y = this.biasY if (x || y) { - var z = Math.sqrt(x * x + y * y); - var ratio = z / 50; //此处除以50,因为摇杆盘半径为50 - ratio = ratio > 1 ? 1 : ratio < 0 ? 0 : ratio; - var temp = xrFrameSystem.Vector3.createFromNumber(-x / z, 0, -y / z); - temp = temp.scale(ratio * speed * deltaTime); - //位移需要根据旋转角度做转化, 这里需要取得camera的世界旋转矩阵 - temp.applyQuaternion(camera.getComponent(xrFrameSystem.Transform).worldQuaternion); - position.set(position.add(temp)); + const z = Math.sqrt(x * x + y * y) + let ratio = z / 50 // 此处除以50,因为摇杆盘半径为50 + ratio = ratio > 1 ? 1 : ratio < 0 ? 0 : ratio + let temp = xrFrameSystem.Vector3.createFromNumber(-x / z, 0, -y / z) + temp = temp.scale(ratio * speed * deltaTime) + // 位移需要根据旋转角度做转化, 这里需要取得camera的世界旋转矩阵 + temp.applyQuaternion(camera.getComponent(xrFrameSystem.Transform).worldQuaternion) + position.set(position.add(temp)) } }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/index.js b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/index.js index 15e5b675..e1b03449 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/index.js @@ -1,8 +1,8 @@ // 着色器 -import dissolveVert from './shaders/dissolveVert'; -import dissolveFrag from './shaders/dissolveFrag'; +import dissolveVert from './shaders/dissolveVert' +import dissolveFrag from './shaders/dissolveFrag' -const xrFrameSystem = wx.getXrFrameSystem(); +const xrFrameSystem = wx.getXrFrameSystem() Component({ behaviors: [require('../../common/share-behavior').default], @@ -14,12 +14,12 @@ Component({ type: Number }, thresHold: { - type: Number, - value: 0, + type: Number, + value: 0, }, autoPlay: { - type: Boolean, - value: false, + type: Boolean, + value: false, }, }, data: { @@ -42,115 +42,114 @@ Component({ handleReady({ detail }) { - console.log('scene progress', detail.value); - this.scene = detail.value; - this.camera = this.scene.getElementById('camera'); - this.root = this.scene.getElementById('root'); - this.offset = - 0.005; + console.log('scene progress', detail.value) + this.scene = detail.value + this.camera = this.scene.getElementById('camera') + this.root = this.scene.getElementById('root') + this.offset = -0.005 }, handleTick(delta) { - if(this.data.autoPlay){ - if(this.dissolveMaterial.getFloat('u_threshold') < 0){ - this.dissolveMaterial.setFloat('u_threshold', 0); - this.offset = 0.005; - } - if(this.dissolveMaterial.getFloat('u_threshold') > 1){ - this.dissolveMaterial.setFloat('u_threshold', 1); - this.offset = - 0.005; - } - this.dissolveMaterial.setFloat('u_threshold', this.dissolveMaterial.getFloat('u_threshold') + this.offset); - }else{ - this.dissolveMaterial.setFloat('u_threshold', this.data.thresHold); + if (this.data.autoPlay) { + if (this.dissolveMaterial.getFloat('u_threshold') < 0) { + this.dissolveMaterial.setFloat('u_threshold', 0) + this.offset = 0.005 } + if (this.dissolveMaterial.getFloat('u_threshold') > 1) { + this.dissolveMaterial.setFloat('u_threshold', 1) + this.offset = -0.005 + } + this.dissolveMaterial.setFloat('u_threshold', this.dissolveMaterial.getFloat('u_threshold') + this.offset) + } else { + this.dissolveMaterial.setFloat('u_threshold', this.data.thresHold) + } }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ - detail - }) { - console.log('assets loaded', detail.value); - this.setData({ - loaded: true - }); - - this.dissolveMaterial = this.scene.createMaterial(this.createDissolveEffect(), { - u_mainTexture: this.scene.assets.getAsset('texture', 'surface_texture1'), - u_mainTexture2: this.scene.assets.getAsset('texture', 'surface_texture2'), - u_noiseTexture: this.scene.assets.getAsset('texture', 'noise_texture'), - }); - - const geometryPlane = this.scene.assets.getAsset('geometry', 'plane'); - const planeElem = this.scene.createElement(xrFrameSystem.XRNode, { - position: "0 0 0", - scale: "3 3 3", - }); - - // this.dissolveMaterial.setVector('u_firstColor', xrFrameSystem.Vector4.createFromNumber(1.0, 0.0, 0.0, 1.0)); - // this.dissolveMaterial.setVector('u_secondColor', xrFrameSystem.Vector4.createFromNumber(0.0, 1.0, 0.0, 1.0)); - planeElem.addComponent(xrFrameSystem.Mesh, { - geometry: geometryPlane, - material: this.dissolveMaterial, - }); - // 加到场上 - this.root.addChild(planeElem); - - // 绑定tick事件 - this.scene.event.add('tick', this.handleTick.bind(this)); - }, + handleAssetsLoaded({ + detail + }) { + console.log('assets loaded', detail.value) + this.setData({ + loaded: true + }) + + this.dissolveMaterial = this.scene.createMaterial(this.createDissolveEffect(), { + u_mainTexture: this.scene.assets.getAsset('texture', 'surface_texture1'), + u_mainTexture2: this.scene.assets.getAsset('texture', 'surface_texture2'), + u_noiseTexture: this.scene.assets.getAsset('texture', 'noise_texture'), + }) + + const geometryPlane = this.scene.assets.getAsset('geometry', 'plane') + const planeElem = this.scene.createElement(xrFrameSystem.XRNode, { + position: '0 0 0', + scale: '3 3 3', + }) + + // this.dissolveMaterial.setVector('u_firstColor', xrFrameSystem.Vector4.createFromNumber(1.0, 0.0, 0.0, 1.0)); + // this.dissolveMaterial.setVector('u_secondColor', xrFrameSystem.Vector4.createFromNumber(0.0, 1.0, 0.0, 1.0)); + planeElem.addComponent(xrFrameSystem.Mesh, { + geometry: geometryPlane, + material: this.dissolveMaterial, + }) + // 加到场上 + this.root.addChild(planeElem) + + // 绑定tick事件 + this.scene.event.add('tick', this.handleTick.bind(this)) + }, - - createDissolveEffect() { - const effect = this.scene.createEffect({ - name: 'dissolveEffect', - properties: [ - { key: 'u_firstColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 0, 0, 1] }, - { key: 'u_secondColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [0, 1, 0, 1] }, - { key: 'u_threshold', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5] }, - { key: 'u_edgeWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [0.1] }, - ], - images: [ - { - key: 'u_mainTexture', - default: 'white', - macro: 'WX_USE_BASECOLORMAP' - }, - { + createDissolveEffect() { + const effect = this.scene.createEffect({ + name: 'dissolveEffect', + properties: [ + { key: 'u_firstColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 0, 0, 1] }, + { key: 'u_secondColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [0, 1, 0, 1] }, + { key: 'u_threshold', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5] }, + { key: 'u_edgeWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [0.1] }, + ], + images: [ + { + key: 'u_mainTexture', + default: 'white', + macro: 'WX_USE_BASECOLORMAP' + }, + { key: 'u_mainTexture2', default: 'white', macro: 'WX_USE_BASECOLORMAP' - }, - { - key: 'u_noiseTexture', - default: 'white', - macro: 'WX_USE_BASECOLORMAP' - } - ], - defaultRenderQueue: 2000, - passes: [ - { - "renderStates": { - cullOn: false, - blendOn: false, - depthWrite: true, - depthTestOn: true, - cullFace: xrFrameSystem.ECullMode.BACK, - }, - lightMode: "ForwardBase", - useMaterialRenderStates: false, - shaders: [0, 1] - }], - shaders: [ - dissolveVert, - dissolveFrag, - ], - }) - return effect; - }, + }, + { + key: 'u_noiseTexture', + default: 'white', + macro: 'WX_USE_BASECOLORMAP' + } + ], + defaultRenderQueue: 2000, + passes: [ + { + renderStates: { + cullOn: false, + blendOn: false, + depthWrite: true, + depthTestOn: true, + cullFace: xrFrameSystem.ECullMode.BACK, + }, + lightMode: 'ForwardBase', + useMaterialRenderStates: false, + shaders: [0, 1] + }], + shaders: [ + dissolveVert, + dissolveFrag, + ], + }) + return effect + }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveFrag.js b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveFrag.js index 6c2640f3..fdf3603b 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveFrag.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveFrag.js @@ -32,4 +32,4 @@ void main() gl_FragColor = vec4(color.rgb, 1.0); } - ` \ No newline at end of file + ` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveVert.js b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveVert.js index b20cf417..c7e1882a 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveVert.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-dissolve/shaders/dissolveVert.js @@ -12,4 +12,4 @@ void main(){ v_UV = a_texCoord; gl_Position = u_projection * u_view * u_world * vec4(a_position, 1.0); } -` \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-featherVideo/index.js b/miniprogram/packageXRFrame/components/template/xr-template-featherVideo/index.js index 89245dc1..f75c2c33 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-featherVideo/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-featherVideo/index.js @@ -23,30 +23,30 @@ Component({ }, observers: { gltfListRaw(newVal) { - this.releaseGLTF(); - this.loadGLTF(newVal); + this.releaseGLTF() + this.loadGLTF(newVal) }, videoListRaw(newVal) { - this.releaseVideo(); - this.loadVideo(newVal); + this.releaseVideo() + this.loadVideo(newVal) }, }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) // 绑定tick事件 - xrScene.event.add('tick', this.handleTick.bind(this)); + xrScene.event.add('tick', this.handleTick.bind(this)) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleTick: function () { + handleTick() { }, releaseGLTF() { if (this.data.gltfIdList && this.data.gltfIdList.length > 0) { @@ -54,7 +54,7 @@ Component({ this.data.gltfIdList.map((id) => { // 释放加载过的资源 - scene.assets.releaseAsset('gltf',`gltf-${id}`); + scene.assets.releaseAsset('gltf', `gltf-${id}`) }) } }, @@ -62,27 +62,27 @@ Component({ const scene = this.scene if (gltfList.length > 0) { - const gltfIdList = []; - const gltfModel = await Promise.all(gltfList.map( (gltfItem) => { + const gltfIdList = [] + const gltfModel = await Promise.all(gltfList.map((gltfItem) => { gltfIdList.push(gltfItem.id) const gtltfPromise = scene.assets.loadAsset({ type: 'gltf', assetId: `gltf-${gltfItem.id}`, src: gltfItem.src, }) - return gtltfPromise; - })); - + return gtltfPromise + })) + console.log('glTF asset loaded') - this.setData({ - gltfIdList: gltfIdList, + this.setData({ + gltfIdList, gltfLoaded: true }) } else { - this.setData({ + this.setData({ gltfIdList: [], gltfLoaded: false, - }); + }) } }, releaseVideo() { @@ -91,17 +91,17 @@ Component({ this.data.videoIdList.map((id) => { // 释放加载过的资源 - scene.assets.releaseAsset('video-texture', `video-${id}`); - scene.assets.releaseAsset('material', `video-mat-${id}`); + scene.assets.releaseAsset('video-texture', `video-${id}`) + scene.assets.releaseAsset('material', `video-mat-${id}`) }) } }, async loadVideo(videoList) { const scene = this.scene if (videoList.length > 0) { - const videoIdList = []; - const videos = await Promise.all(videoList.map((videoItem) =>{ - videoIdList.push(videoItem.id); + const videoIdList = [] + const videos = await Promise.all(videoList.map((videoItem) => { + videoIdList.push(videoItem.id) return scene.assets.loadAsset({ type: 'video-texture', assetId: `video-${videoItem.id}`, @@ -119,7 +119,7 @@ Component({ }) console.log('video asset loaded') this.setData({ - videoIdList: videoIdList, + videoIdList, videoLoaded: true }) } else { @@ -130,4 +130,4 @@ Component({ } }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-frameEffect/index.js b/miniprogram/packageXRFrame/components/template/xr-template-frameEffect/index.js index dd11dc76..64555341 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-frameEffect/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-frameEffect/index.js @@ -4,10 +4,10 @@ Component({ data: { }, methods: { - handleReady({detail}) { - const xrFrameSystem = wx.getXrFrameSystem() + handleReady({ detail }) { + const xrFrameSystem = wx.getXrFrameSystem() const createFrameEffect = (scene) => { - const xrFrameSystem = wx.getXrFrameSystem() + const xrFrameSystem = wx.getXrFrameSystem() return scene.createEffect({ name: 'frame-effect', properties: [ @@ -17,14 +17,14 @@ Component({ default: 1 }, { - key: 'rowCount', - type: xrFrameSystem.EUniformType.FLOAT, - default: 1 + key: 'rowCount', + type: xrFrameSystem.EUniformType.FLOAT, + default: 1 }, { - key: 'during', - type: xrFrameSystem.EUniformType.FLOAT, - default: 1 + key: 'during', + type: xrFrameSystem.EUniformType.FLOAT, + default: 1 } ], images: [ @@ -90,53 +90,51 @@ Component({ vec4 color = texture2D(u_baseColorMap, texCoord); gl_FragColor = color; }` - ], - }); + ], + }) } console.log('序列帧特效加载') xrFrameSystem.registerEffect('frame-effect', createFrameEffect) - const xrScene = this.scene = detail.value; + const xrScene = this.scene = detail.value this.loadAsset() }, - async loadAsset(){ - const xrFrameSystem = wx.getXrFrameSystem(); - const xrScene = this.scene; - // const shadowRoot = xrScene.getElementById("shadow-root"); - - await xrScene.assets.loadAsset({type: 'texture', assetId: 'frame', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/sprite-frames.png'}) + async loadAsset() { + const xrFrameSystem = wx.getXrFrameSystem() + const xrScene = this.scene + // const shadowRoot = xrScene.getElementById("shadow-root"); - // 第一个参数是效果实例的引用,第二个参数是默认`uniforms` - const frameMaterial = xrScene.createMaterial( - // 使用定制的效果 - xrScene.assets.getAsset('effect', 'frame-effect'), - {u_baseColorMap: xrScene.assets.getAsset('texture', 'frame')} - ); - - // 可以将其添加到资源系统中备用 - xrScene.assets.addAsset('material', 'frame-effect', frameMaterial); + await xrScene.assets.loadAsset({ type: 'texture', assetId: 'frame', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/sprite-frames.png' }) - const meshElement = xrScene.getElementById("animation-mesh").getComponent(xrFrameSystem.Mesh); - frameMaterial.setFloat('columCount', 4); - frameMaterial.setFloat('rowCount', 32); - frameMaterial.setFloat('during', 2); - frameMaterial.alphaMode = "BLEND"; - meshElement.material = frameMaterial; + // 第一个参数是效果实例的引用,第二个参数是默认`uniforms` + const frameMaterial = xrScene.createMaterial( + // 使用定制的效果 + xrScene.assets.getAsset('effect', 'frame-effect'), + { u_baseColorMap: xrScene.assets.getAsset('texture', 'frame') } + ) - // 不同的序列帧需要使用不同的材质 - const frameMaterial2 = xrScene.createMaterial( - // 使用定制的效果 - xrScene.assets.getAsset('effect', 'frame-effect'), - {u_baseColorMap: xrScene.assets.getAsset('texture', 'frame')} - ); + // 可以将其添加到资源系统中备用 + xrScene.assets.addAsset('material', 'frame-effect', frameMaterial) - const meshElement2 = xrScene.getElementById("animation-mesh2").getComponent(xrFrameSystem.Mesh); - frameMaterial2.setFloat('columCount', 4); - frameMaterial2.setFloat('rowCount', 32); - frameMaterial2.setFloat('during', 2); - frameMaterial2.alphaMode = "BLEND"; - meshElement2.material = frameMaterial2; + const meshElement = xrScene.getElementById('animation-mesh').getComponent(xrFrameSystem.Mesh) + frameMaterial.setFloat('columCount', 4) + frameMaterial.setFloat('rowCount', 32) + frameMaterial.setFloat('during', 2) + frameMaterial.alphaMode = 'BLEND' + meshElement.material = frameMaterial + // 不同的序列帧需要使用不同的材质 + const frameMaterial2 = xrScene.createMaterial( + // 使用定制的效果 + xrScene.assets.getAsset('effect', 'frame-effect'), + { u_baseColorMap: xrScene.assets.getAsset('texture', 'frame') } + ) + const meshElement2 = xrScene.getElementById('animation-mesh2').getComponent(xrFrameSystem.Mesh) + frameMaterial2.setFloat('columCount', 4) + frameMaterial2.setFloat('rowCount', 32) + frameMaterial2.setFloat('during', 2) + frameMaterial2.alphaMode = 'BLEND' + meshElement2.material = frameMaterial2 }, } }) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-geometry/index.js b/miniprogram/packageXRFrame/components/template/xr-template-geometry/index.js index 1338987e..75bd0b1e 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-geometry/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-geometry/index.js @@ -1,16 +1,14 @@ - - function getVertexBuffer(vertexData) { - const vertexCount = vertexData.length / 12; - const noise = 0.03; + const vertexCount = vertexData.length / 12 + const noise = 0.03 for (let i = 0; i < vertexCount; i++) { - const vertexIndex = i * 12; + const vertexIndex = i * 12 // x - vertexData[vertexIndex] = vertexData[vertexIndex] + Math.random() * noise - noise / 2; + vertexData[vertexIndex] = vertexData[vertexIndex] + Math.random() * noise - noise / 2 // y - vertexData[vertexIndex + 1] = vertexData[vertexIndex + 1]+ Math.random() * noise - noise / 2; + vertexData[vertexIndex + 1] = vertexData[vertexIndex + 1] + Math.random() * noise - noise / 2 // z - vertexData[vertexIndex + 2] = vertexData[vertexIndex + 2] + Math.random() * noise - noise / 2; + vertexData[vertexIndex + 2] = vertexData[vertexIndex + 2] + Math.random() * noise - noise / 2 // normal x // vertexData[vertexIndex + 3] // normal y @@ -22,78 +20,75 @@ function getVertexBuffer(vertexData) { // v // vertexData[vertexIndex + 7] // r - vertexData[vertexIndex + 8] = i / vertexCount; + vertexData[vertexIndex + 8] = i / vertexCount // g - vertexData[vertexIndex + 9] = i / vertexCount; + vertexData[vertexIndex + 9] = i / vertexCount // b - vertexData[vertexIndex + 10] = i / vertexCount; + vertexData[vertexIndex + 10] = i / vertexCount // a // vertexData[vertexIndex + 11] } - return new Float32Array(vertexData); + return new Float32Array(vertexData) } - function buildSphere( vertexs, indices, radius = 1, widthSegments = 32, heightSegments = 16, - phiStart = Math.PI /2, + phiStart = Math.PI / 2, phiLength = Math.PI * 2, thetaStart = Math.PI, thetaLength = Math.PI ) { - - widthSegments = Math.max( 3, Math.floor( widthSegments ) ); - heightSegments = Math.max( 2, Math.floor( heightSegments ) ); + widthSegments = Math.max(3, Math.floor(widthSegments)) + heightSegments = Math.max(2, Math.floor(heightSegments)) - const thetaEnd = Math.min( thetaStart + thetaLength, Math.PI ); + const thetaEnd = Math.min(thetaStart + thetaLength, Math.PI) - let index = 0; - const grid = []; + let index = 0 + const grid = [] // generate vertices, normals and uvs - for ( let iy = 0; iy <= heightSegments; iy ++ ) { - const verticesRow = []; - const v = iy / heightSegments; + for (let iy = 0; iy <= heightSegments; iy++) { + const verticesRow = [] + const v = iy / heightSegments // special case for the poles - let uOffset = 0; - if ( iy == 0 && thetaStart == 0 ) { - uOffset = 0.5 / widthSegments; - } else if ( iy == heightSegments && thetaEnd == Math.PI ) { - uOffset = - 0.5 / widthSegments; + let uOffset = 0 + if (iy == 0 && thetaStart == 0) { + uOffset = 0.5 / widthSegments + } else if (iy == heightSegments && thetaEnd == Math.PI) { + uOffset = -0.5 / widthSegments } - for ( let ix = 0; ix <= widthSegments; ix ++ ) { - const u = ix / widthSegments; + for (let ix = 0; ix <= widthSegments; ix++) { + const u = ix / widthSegments // vertex - const vertexX = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - const vertexY = radius * Math.cos( thetaStart + v * thetaLength ); - const vertexZ = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength ); - vertexs.push(vertexX, vertexY, vertexZ); + const vertexX = -radius * Math.cos(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength) + const vertexY = radius * Math.cos(thetaStart + v * thetaLength) + const vertexZ = radius * Math.sin(phiStart + u * phiLength) * Math.sin(thetaStart + v * thetaLength) + vertexs.push(vertexX, vertexY, vertexZ) // normal - vertexs.push(vertexX / 3, vertexY / 3, vertexZ / 3); + vertexs.push(vertexX / 3, vertexY / 3, vertexZ / 3) // uv - vertexs.push(u + uOffset, 1 - v ); + vertexs.push(u + uOffset, 1 - v) // color - vertexs.push(0, 0, 0, 1); + vertexs.push(0, 0, 0, 1) - - verticesRow.push( index ++ ); + verticesRow.push(index++) } - grid.push( verticesRow ); + grid.push(verticesRow) } // indices - for ( let iy = 0; iy < heightSegments; iy ++ ) { - for ( let ix = 0; ix < widthSegments; ix ++ ) { - const a = grid[ iy ][ ix + 1 ]; - const b = grid[ iy ][ ix ]; - const c = grid[ iy + 1 ][ ix ]; - const d = grid[ iy + 1 ][ ix + 1 ]; - - if ( iy !== 0 || thetaStart > 0 ) indices.push( a, d, b ); - if ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, d, c ); + for (let iy = 0; iy < heightSegments; iy++) { + for (let ix = 0; ix < widthSegments; ix++) { + const a = grid[iy][ix + 1] + const b = grid[iy][ix] + const c = grid[iy + 1][ix] + const d = grid[iy + 1][ix + 1] + + if (iy !== 0 || thetaStart > 0) indices.push(a, d, b) + if (iy !== heightSegments - 1 || thetaEnd < Math.PI) indices.push(b, d, c) } } } @@ -108,102 +103,99 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() - this.geometryRoot = this.scene.getElementById('geometryRoot'); + this.geometryRoot = this.scene.getElementById('geometryRoot') - const geoRadius = 1; + const geoRadius = 1 - this.vertexData = []; - this.indexData = []; + this.vertexData = [] + this.indexData = [] // 构造圆形的 顶点信息,可以通过增加切分区域增加顶点数量 // 一般复杂人物 vertex 长度 77030 index 88266 - buildSphere(this.vertexData, this.indexData, geoRadius, 64, 64); - - console.log('vertexDataCount', this.vertexData.length); - console.log('indexDataCount', this.indexData.length); + buildSphere(this.vertexData, this.indexData, geoRadius, 64, 64) + console.log('vertexDataCount', this.vertexData.length) + console.log('indexDataCount', this.indexData.length) // 注册 Geometry 信息 xrFrameSystem.registerGeometry('man', scene => { const vl = scene.createVertexLayout({ attributes: [ { - name: "a_position", + name: 'a_position', format: xrFrameSystem.EVertexFormat.FLOAT3, offset: 0, }, { - name: "a_normal", + name: 'a_normal', format: xrFrameSystem.EVertexFormat.FLOAT3, offset: 12, }, { - name: "a_texCoord", + name: 'a_texCoord', format: xrFrameSystem.EVertexFormat.FLOAT2, offset: 24, }, { - name: "a_color", + name: 'a_color', format: xrFrameSystem.EVertexFormat.FLOAT4, offset: 32, } ], stride: 48 - }); - + }) + // VertexBuffer IndexBuffer 不能动态更改长度,需要一开始设定较大的长度。 - const vb = new Float32Array(this.vertexData.length); - const ib = new Uint16Array(this.indexData); - - const geo = scene.createGeometry(vl, vb, ib); - - geo.setBoundBall(new xrFrameSystem.Vector3(), 1); - geo.addSubMesh(ib.length, 0, 0); - - return geo; - }); + const vb = new Float32Array(this.vertexData.length) + const ib = new Uint16Array(this.indexData) + + const geo = scene.createGeometry(vl, vb, ib) + + geo.setBoundBall(new xrFrameSystem.Vector3(), 1) + geo.addSubMesh(ib.length, 0, 0) + + return geo + }) this.geoElem = xrScene.createElement(xrFrameSystem.XRMesh, { - geometry: "man", + geometry: 'man', material: 'simple-mat', - position: "0 0 0" - }); - this.geometryRoot.addChild(this.geoElem); + position: '0 0 0' + }) + this.geometryRoot.addChild(this.geoElem) // 延时保证挂载与初始化完毕 - setTimeout(()=>{ - this.meshGeo = this.geoElem.getComponent(xrFrameSystem.Mesh); - this.geometryGeo = this.meshGeo.geometry; + setTimeout(() => { + this.meshGeo = this.geoElem.getComponent(xrFrameSystem.Mesh) + this.geometryGeo = this.meshGeo.geometry - this.matGeo = this.meshGeo.material; + this.matGeo = this.meshGeo.material // 使用顶点色 - this.matGeo.setMacro("WX_USE_COLOR_0", true); + this.matGeo.setMacro('WX_USE_COLOR_0', true) // 设定 绘制双面 - this.matGeo.setRenderState("cullOn", false); - - xrScene.event.add('tick', this.handleTick.bind(this)); - },100); + this.matGeo.setRenderState('cullOn', false) + xrScene.event.add('tick', this.handleTick.bind(this)) + }, 100) }, - - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) }, handleTick(delta) { + const vb = getVertexBuffer(this.vertexData) + const ib = new Uint16Array(this.indexData) - const vb = getVertexBuffer(this.vertexData); - const ib = new Uint16Array(this.indexData); - - this.geometryGeo.uploadVertexBuffer(0, vb); - this.geometryGeo.uploadIndexBuffer(0, ib); + this.geometryGeo.uploadVertexBuffer(0, vb) + this.geometryGeo.uploadIndexBuffer(0, ib) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-gltfAnimation/index.js b/miniprogram/packageXRFrame/components/template/xr-template-gltfAnimation/index.js index 156b5f10..3d0ce5c2 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-gltfAnimation/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-gltfAnimation/index.js @@ -8,61 +8,59 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, handleGLTFLoaded({ detail }) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() - const wrapElement = this.scene.getElementById("wrap"); - this.wrapTRS = wrapElement.getComponent(xrFrameSystem.Transform); - const gltfElement = this.scene.getElementById("gltf"); - this.gltfTRS = gltfElement.getComponent(xrFrameSystem.Transform); - this.editGLTF = gltfElement.getComponent(xrFrameSystem.GLTF); + const wrapElement = this.scene.getElementById('wrap') + this.wrapTRS = wrapElement.getComponent(xrFrameSystem.Transform) + const gltfElement = this.scene.getElementById('gltf') + this.gltfTRS = gltfElement.getComponent(xrFrameSystem.Transform) + this.editGLTF = gltfElement.getComponent(xrFrameSystem.GLTF) console.log(this.wrapTRS, this.gltfTRS) // Birds - const brid = this.editGLTF.getInternalNodeByName("Birds"); - this.bridTRS = brid.getComponent(xrFrameSystem.Transform); + const brid = this.editGLTF.getInternalNodeByName('Birds') + this.bridTRS = brid.getComponent(xrFrameSystem.Transform) // TurtleAndCastle - const turtle = this.editGLTF.getInternalNodeByName("TurtleAndCastle"); - this.turtleTRS = turtle.getComponent(xrFrameSystem.Transform); + const turtle = this.editGLTF.getInternalNodeByName('TurtleAndCastle') + this.turtleTRS = turtle.getComponent(xrFrameSystem.Transform) // 都用四元数 - this.rotation = this.turtleTRS.quaternion.toEulerAngles(); + this.rotation = this.turtleTRS.quaternion.toEulerAngles() - this.scene.event.add('tick', this.handleTick.bind(this)); + this.scene.event.add('tick', this.handleTick.bind(this)) }, - handleTick: function (time) { - const xrSystem = wx.getXrFrameSystem(); + handleTick(time) { + const xrSystem = wx.getXrFrameSystem() - this.wrapTRS.position.x -= 0.002; + this.wrapTRS.position.x -= 0.002 // this.wrapTRS.rotation.y += Math.PI * 0.0001; // 比例尺不一样,需要放大改变数值 - this.bridTRS.position.x += 1; - this.bridTRS.position.y += Math.random() * 4 - 2; + this.bridTRS.position.x += 1 + this.bridTRS.position.y += Math.random() * 4 - 2 // 欧拉角直接设置有误 v2.31.0 // this.turtleTRS.rotation.y += Math.PI * 0.0004; // 目前使用四元数兼容 - this.rotation.y += Math.PI * 0.0004; - xrSystem.Quaternion.fromEulerAngles(this.rotation, this.turtleTRS.quaternion); - + this.rotation.y += Math.PI * 0.0004 + xrSystem.Quaternion.fromEulerAngles(this.rotation, this.turtleTRS.quaternion) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-gltfEdit/index.js b/miniprogram/packageXRFrame/components/template/xr-template-gltfEdit/index.js index a7c0b238..f8a53994 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-gltfEdit/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-gltfEdit/index.js @@ -8,48 +8,46 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); - this.setBallon(); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) + this.setBallon() }, async setBallon() { - const scene = this.scene; - const xrSystem = wx.getXrFrameSystem(); + const scene = this.scene + const xrSystem = wx.getXrFrameSystem() // 替换贴图 - const ballonElm = this.scene.getElementById('ballon'); - const ballonGLTF = ballonElm.getComponent(xrSystem.GLTF); + const ballonElm = this.scene.getElementById('ballon') + const ballonGLTF = ballonElm.getComponent(xrSystem.GLTF) const textureAsset = await scene.assets.loadAsset({ type: 'texture', - assetId: `texture-1`, + assetId: 'texture-1', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/waifu.png', - }); - for(const mesh of ballonGLTF.meshes) { - console.log('textureAsset', textureAsset.value); - mesh.material.setTexture('u_baseColorMap', textureAsset.value); + }) + for (const mesh of ballonGLTF.meshes) { + console.log('textureAsset', textureAsset.value) + mesh.material.setTexture('u_baseColorMap', textureAsset.value) } // 替换状态 - const ballonBlendElm = this.scene.getElementById('ballonBlend'); - const ballonBlendGLTF = ballonBlendElm.getComponent(xrSystem.GLTF); - for(const mesh of ballonBlendGLTF.meshes) { + const ballonBlendElm = this.scene.getElementById('ballonBlend') + const ballonBlendGLTF = ballonBlendElm.getComponent(xrSystem.GLTF) + for (const mesh of ballonBlendGLTF.meshes) { // 清理模型金属度 - mesh.material.setVector('u_specularFactor', xrSystem.Vector3.createFromNumber(0, 0, 0)); + mesh.material.setVector('u_specularFactor', xrSystem.Vector3.createFromNumber(0, 0, 0)) // 通过alphaMode 的 Setter 设置,或者写入renderState,但需要手动控制宏 - mesh.material.alphaMode = "BLEND"; - mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(0, 0.5, 0, 0.5)); + mesh.material.alphaMode = 'BLEND' + mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(0, 0.5, 0, 0.5)) } - } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-gltfOcclusion/index.js b/miniprogram/packageXRFrame/components/template/xr-template-gltfOcclusion/index.js index a2947814..2cb8bb99 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-gltfOcclusion/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-gltfOcclusion/index.js @@ -8,17 +8,17 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-gltfUVAnimation/index.js b/miniprogram/packageXRFrame/components/template/xr-template-gltfUVAnimation/index.js index 2d100c72..02920f9d 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-gltfUVAnimation/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-gltfUVAnimation/index.js @@ -8,45 +8,45 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) // 做个简单的延时,保证glTF构建完成 - setTimeout(()=>{ - this.setUVAnimation(); - },200); + setTimeout(() => { + this.setUVAnimation() + }, 200) }, setUVAnimation() { - const scene = this.scene; - const xrSystem = wx.getXrFrameSystem(); + const scene = this.scene + const xrSystem = wx.getXrFrameSystem() // 获取元素 - const twaElm = this.scene.getElementById('twa'); - const twaGLTF = twaElm.getComponent(xrSystem.GLTF); + const twaElm = this.scene.getElementById('twa') + const twaGLTF = twaElm.getComponent(xrSystem.GLTF) // console.log(twaGLTF); - const changeMesh = twaGLTF.getPrimitivesByNodeName('Cube_0')[0]; - const changeMaterial = changeMesh.material; + const changeMesh = twaGLTF.getPrimitivesByNodeName('Cube_0')[0] + const changeMaterial = changeMesh.material - let offsetX = 0; - let offsetY = 0; - let scaleX = 1; - let scaleY = 1; - let rotation = 0; + let offsetX = 0 + let offsetY = 0 + const scaleX = 1 + const scaleY = 1 + const rotation = 0 // 这里采用一个固定计时器方便编写,建议使用tick - setInterval(()=>{ + setInterval(() => { // 这里做一个 1% 每帧的偏移。 - offsetX = offsetX > 1 ? 0 : offsetX + 0.01; - offsetY = offsetY > 1 ? 0 : offsetY + 0.01; + offsetX = offsetX > 1 ? 0 : offsetX + 0.01 + offsetY = offsetY > 1 ? 0 : offsetY + 0.01 // 这里做一个每帧的缩放 // scaleX = scaleX > 2 ? 1 : scaleX + 0.01; // scaleY = scaleY > 2 ? 1 : scaleY + 0.01; @@ -54,20 +54,19 @@ Component({ // rotation = rotation > Math.PI ? 0 : rotation + Math.PI / 360; const uvMatrix = xrSystem.Matrix4.createFromArray(this.getUvTransform(offsetX, offsetY, scaleX, scaleY, rotation)) // 设置uv矩阵 - changeMaterial.setMatrix('u_uvTransform', uvMatrix); - }, 40); + changeMaterial.setMatrix('u_uvTransform', uvMatrix) + }, 40) const uvMatrix = xrSystem.Matrix4.createFromArray(this.getUvTransform(offsetX, offsetY, scaleX, scaleY, rotation)) // 设置uv矩阵 - changeMaterial.setMatrix('u_uvTransform', uvMatrix); + changeMaterial.setMatrix('u_uvTransform', uvMatrix) // 开启使用uv矩阵的宏 - changeMaterial.setMacro('WX_USE_UVTRANSFORM', true ); - changeMaterial.setMacro('WX_USE_UVTRANSFORM_BASECOLOR', true ); - } - , + changeMaterial.setMacro('WX_USE_UVTRANSFORM', true) + changeMaterial.setMacro('WX_USE_UVTRANSFORM_BASECOLOR', true) + }, /** * 获取UV变化矩阵,列主序 - * + * * @param {number} tx x轴偏移 * @param {number} ty y轴偏移 * @param {number} sx x轴缩放 @@ -76,15 +75,15 @@ Component({ * @return {Array} uvMatrixArray */ getUvTransform(tx, ty, sx, sy, rotation) { - const c = Math.cos( rotation ); - const s = Math.sin( rotation ); + const c = Math.cos(rotation) + const s = Math.sin(rotation) return [ sx * c, -sx * s, 0, 0, sy * s, sy * c, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1, - ]; + ] } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-loading/index.js b/miniprogram/packageXRFrame/components/template/xr-template-loading/index.js index 7381db56..96763d03 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-loading/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-loading/index.js @@ -29,34 +29,34 @@ Component({ }, observers: { gltfListRaw(newVal) { - this.releaseGLTF(); - this.loadGLTF(newVal); + this.releaseGLTF() + this.loadGLTF(newVal) }, videoListRaw(newVal) { - this.releaseVideo(); - this.loadVideo(newVal); + this.releaseVideo() + this.loadVideo(newVal) }, imageListRaw(newVal) { - this.releaseImage(); - this.loadImage(newVal); + this.releaseImage() + this.loadImage(newVal) }, }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) // 绑定tick事件 - xrScene.event.add('tick', this.handleTick.bind(this)); + xrScene.event.add('tick', this.handleTick.bind(this)) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleTick: function () { + handleTick() { }, releaseGLTF() { if (this.data.gltfIdList && this.data.gltfIdList.length > 0) { @@ -65,11 +65,11 @@ Component({ // 声明使 gltf Mesh 移除 this.setData({ gltfLoaded: false - }); + }) this.data.gltfIdList.map((id) => { // 释放加载过的资源 - scene.assets.releaseAsset('gltf',`gltf-${id}`); + scene.assets.releaseAsset('gltf', `gltf-${id}`) }) } }, @@ -77,27 +77,27 @@ Component({ const scene = this.scene if (gltfList.length > 0) { - const gltfIdList = []; - const gltfModel = await Promise.all(gltfList.map( (gltfItem) => { + const gltfIdList = [] + const gltfModel = await Promise.all(gltfList.map((gltfItem) => { gltfIdList.push(gltfItem.id) const gtltfPromise = scene.assets.loadAsset({ type: 'gltf', assetId: `gltf-${gltfItem.id}`, src: gltfItem.src, }) - return gtltfPromise; - })); - + return gtltfPromise + })) + console.log('glTF asset loaded') - this.setData({ - gltfIdList: gltfIdList, + this.setData({ + gltfIdList, gltfLoaded: true }) } else { - this.setData({ + this.setData({ gltfIdList: [], gltfLoaded: false, - }); + }) } }, releaseVideo() { @@ -107,21 +107,21 @@ Component({ // 声明使视频 Mesh 移除 this.setData({ videoLoaded: false - }); + }) this.data.videoIdList.map((id) => { // 释放加载过的资源 - scene.assets.releaseAsset('video-texture', `video-${id}`); - scene.assets.releaseAsset('material', `video-mat-${id}`); + scene.assets.releaseAsset('video-texture', `video-${id}`) + scene.assets.releaseAsset('material', `video-mat-${id}`) }) } }, async loadVideo(videoList) { const scene = this.scene if (videoList.length > 0) { - const videoIdList = []; - const videos = await Promise.all(videoList.map((videoItem) =>{ - videoIdList.push(videoItem.id); + const videoIdList = [] + const videos = await Promise.all(videoList.map((videoItem) => { + videoIdList.push(videoItem.id) return scene.assets.loadAsset({ type: 'video-texture', assetId: `video-${videoItem.id}`, @@ -138,7 +138,7 @@ Component({ }) console.log('video asset loaded') this.setData({ - videoIdList: videoIdList, + videoIdList, videoLoaded: true }) } else { @@ -155,25 +155,25 @@ Component({ // 声明使视频 Mesh 移除 this.setData({ imageLoaded: false - }); + }) this.data.imageIdList.map((id) => { // 释放加载过的资源 - scene.assets.releaseAsset('texture', `texture-${id}`); - scene.assets.releaseAsset('material', `texture-mat-${id}`); + scene.assets.releaseAsset('texture', `texture-${id}`) + scene.assets.releaseAsset('material', `texture-mat-${id}`) }) } }, async loadImage(imageList) { const scene = this.scene if (imageList.length > 0) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() - const imageIdList = []; - const images = await Promise.all(imageList.map((imageItem) =>{ - const id = imageItem.id; - console.log(imageItem, id); - imageIdList.push(id); + const imageIdList = [] + const images = await Promise.all(imageList.map((imageItem) => { + const id = imageItem.id + console.log(imageItem, id) + imageIdList.push(id) if (id === 2) { // 走 asset 直接加载方式 return scene.assets.loadAsset({ @@ -181,12 +181,11 @@ Component({ assetId: `texture-${imageItem.id}`, src: imageItem.src, }) - } else if (id === 3) { // 走 createImage 方式 return new Promise(resolve => { - const image = scene.createImage(); - image.src = imageItem.src; + const image = scene.createImage() + image.src = imageItem.src image.onload = () => { resolve({ value: scene.createTexture({ @@ -198,17 +197,17 @@ Component({ minFilter: xrFrameSystem.EFilterMode.LINEAR_MIPMAP_LINEAR, wrapU: xrFrameSystem.EWrapMode.CLAMP_TO_EDGE, wrapV: xrFrameSystem.EWrapMode.CLAMP_TO_EDGE, - anisoLevel:1 + anisoLevel: 1 }) - }); - }; - image.onerror = error => {}; - }); + }) + } + image.onerror = error => {} + }) } - })); + })) + + console.log(images) - console.log(images); - images.map((texture, index) => { const textureMat = scene.createMaterial( scene.assets.getAsset('effect', 'simple'), @@ -218,7 +217,7 @@ Component({ }) this.setData({ - imageIdList: imageIdList, + imageIdList, imageLoaded: true }) } else { @@ -229,4 +228,4 @@ Component({ } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-lookat/index.js b/miniprogram/packageXRFrame/components/template/xr-template-lookat/index.js index 85fbcb3e..04b170f8 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-lookat/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-lookat/index.js @@ -19,56 +19,54 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - const xrSystem = wx.getXrFrameSystem(); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + const xrSystem = wx.getXrFrameSystem() - this.mat = new (xrSystem.Matrix4)(); - console.log('xr-scene', xrScene); + this.mat = new (xrSystem.Matrix4)() + console.log('xr-scene', xrScene) const { width, height } = this.scene + this.cameraTrs = this.scene.getElementById('camera').getComponent(xrSystem.Transform) - this.cameraTrs = this.scene.getElementById('camera').getComponent(xrSystem.Transform); - - this.leftTRS = this.scene.getElementById('l').getComponent(xrSystem.Transform); - this.rightTRS = this.scene.getElementById('r').getComponent(xrSystem.Transform); - this.frontTRS = this.scene.getElementById('f').getComponent(xrSystem.Transform); - this.backTRS = this.scene.getElementById('b').getComponent(xrSystem.Transform); + this.leftTRS = this.scene.getElementById('l').getComponent(xrSystem.Transform) + this.rightTRS = this.scene.getElementById('r').getComponent(xrSystem.Transform) + this.frontTRS = this.scene.getElementById('f').getComponent(xrSystem.Transform) + this.backTRS = this.scene.getElementById('b').getComponent(xrSystem.Transform) - this.FACING = xrSystem.Vector3.createFromNumber(0, 0, 0); - this.UP = xrSystem.Vector3.createFromNumber(0, 1, 0); + this.FACING = xrSystem.Vector3.createFromNumber(0, 0, 0) + this.UP = xrSystem.Vector3.createFromNumber(0, 1, 0) - - xrScene.event.add('tick', this.handleTick.bind(this)); + xrScene.event.add('tick', this.handleTick.bind(this)) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); + handleTick() { + const xrSystem = wx.getXrFrameSystem() if (this.leftTRS) { console.log() - const quaternion = this.leftTRS.quaternion; + const quaternion = this.leftTRS.quaternion // 算出从物体到相机的向量 - this.FACING.set(this.cameraTrs.position).sub(this.leftTRS.position, this.FACING); - xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion); + this.FACING.set(this.cameraTrs.position).sub(this.leftTRS.position, this.FACING) + xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion) } if (this.rightTRS) { - const quaternion = this.rightTRS.quaternion; + const quaternion = this.rightTRS.quaternion // 算出从物体到相机的向量 - this.FACING.set(this.cameraTrs.position).sub(this.rightTRS.position, this.FACING); - xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion); + this.FACING.set(this.cameraTrs.position).sub(this.rightTRS.position, this.FACING) + xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion) } if (this.frontTRS) { - const quaternion = this.frontTRS.quaternion; + const quaternion = this.frontTRS.quaternion // // 算出从物体到相机的向量 - this.FACING.set(this.cameraTrs.position).sub(this.frontTRS.position, this.FACING); - xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion); + this.FACING.set(this.cameraTrs.position).sub(this.frontTRS.position, this.FACING) + xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion) } if (this.backTRS) { - const quaternion = this.backTRS.quaternion; + const quaternion = this.backTRS.quaternion // 算出从物体到相机的向量 - this.FACING.set(this.cameraTrs.position).sub(this.backTRS.position, this.FACING); - xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion); + this.FACING.set(this.cameraTrs.position).sub(this.backTRS.position, this.FACING) + xrSystem.Quaternion.lookRotation(this.FACING, this.UP, quaternion) } }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-markerCenter/index.js b/miniprogram/packageXRFrame/components/template/xr-template-markerCenter/index.js index 54158eef..dbe84694 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-markerCenter/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-markerCenter/index.js @@ -14,52 +14,50 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) }, - handleARReady: async function({detail}) { - console.log('arReady', this.scene.ar.arVersion); - const xr = wx.getXrFrameSystem(); + async handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) + const xr = wx.getXrFrameSystem() // shadow root - this.root = this.scene.getElementById('root'); + this.root = this.scene.getElementById('root') // 动态创建添加tracker - const lockTrackerEl = this.scene.createElement(xr.XRNode); + const lockTrackerEl = this.scene.createElement(xr.XRNode) const lockTracker = lockTrackerEl.addComponent(xr.ARTracker, { mode: 'Marker', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/2dmarker-test.jpg', - }); - - this.root.addChild(lockTrackerEl); + }) + + this.root.addChild(lockTrackerEl) + + let waiting = false - let waiting = false; - lockTrackerEl.event.add('ar-tracker-state', tracker => { // 获取当前状态和错误信息 - const {state, errorMessage} = tracker; + const { state, errorMessage } = tracker if (state === 2 && !waiting) { console.log('match') - waiting = true; + waiting = true // 识别成功后切换到世界坐标 - + // 延时保证坐标已经设置 setTimeout(() => { - this.setData({ markerMatch: true - }); + }) // 去除tracker监听 - this.root.removeChild(lockTrackerEl); - }, 30); - + this.root.removeChild(lockTrackerEl) + }, 30) } }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-markerLock/index.js b/miniprogram/packageXRFrame/components/template/xr-template-markerLock/index.js index fe39c05b..312aee2e 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-markerLock/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-markerLock/index.js @@ -13,34 +13,34 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) }, - handleARReady: async function({detail}) { - console.log('arReady', this.scene.ar.arVersion); - const xr = wx.getXrFrameSystem(); + async handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) + const xr = wx.getXrFrameSystem() // shadow root - this.root = this.scene.getElementById('root'); + this.root = this.scene.getElementById('root') // 动态创建添加tracker - const lockTrackerEl = this.scene.createElement(xr.XRNode); + const lockTrackerEl = this.scene.createElement(xr.XRNode) const lockTracker = lockTrackerEl.addComponent(xr.ARTracker, { mode: 'Marker', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/2dmarker-test.jpg', - }); - - this.root.addChild(lockTrackerEl); + }) + + this.root.addChild(lockTrackerEl) // 动态改动模型根节点 const lockItemEle = this.scene.createElement(xr.XRNode, { position: '10000 0 0', - }); + }) - const {value: model} = await this.scene.assets.loadAsset({type: 'gltf', assetId: 'butterfly', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/butterfly/index.glb'}); + const { value: model } = await this.scene.assets.loadAsset({ type: 'gltf', assetId: 'butterfly', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/butterfly/index.glb' }) // 添加蝴蝶 const gltf1 = this.scene.createElement(xr.XRGLTF, { @@ -48,58 +48,57 @@ Component({ scale: '0.6 0.6 0.6', rotation: '0 -50 0', 'anim-autoplay': '', - }); - lockItemEle.addChild(gltf1); + }) + lockItemEle.addChild(gltf1) gltf1.getComponent(xr.GLTF).setData({ - model: model, - }); + model, + }) const gltf2 = this.scene.createElement(xr.XRGLTF, { position: '0.4 0 0.3', scale: '0.5 0.5 0.5', rotation: '0 -50 0', 'anim-autoplay': '', - }); - lockItemEle.addChild(gltf2); + }) + lockItemEle.addChild(gltf2) gltf2.getComponent(xr.GLTF).setData({ - model: model, - }); + model, + }) const gltf3 = this.scene.createElement(xr.XRGLTF, { position: '-0.3 0 0.3', scale: '0.4 0.4 0.4', rotation: '0 -50 0', 'anim-autoplay': '', - }); - lockItemEle.addChild(gltf3); + }) + lockItemEle.addChild(gltf3) gltf3.getComponent(xr.GLTF).setData({ - model: model, - }); + model, + }) // 先挂到场上,但是可以放在离屏 - this.root.addChild(lockItemEle); + this.root.addChild(lockItemEle) + + let waiting = false - let waiting = false; - lockTrackerEl.event.add('ar-tracker-state', tracker => { // 获取当前状态和错误信息 - const {state, errorMessage} = tracker; + const { state, errorMessage } = tracker if (state === 2 && !waiting) { console.log('match') - waiting = true; + waiting = true // 识别成功后切换到世界坐标 - + // 延时保证坐标已经设置 setTimeout(() => { // 将 lockTrackerEl 的世界矩阵信息同步到 lockItemEle const lockTrackerTrs = lockTrackerEl.getComponent(xr.Transform) const lockItemTrs = lockItemEle.getComponent(xr.Transform) - lockItemTrs.setLocalMatrix(lockTrackerTrs.worldMatrix); - - // 去除tracker监听 - this.root.removeChild(lockTrackerEl); - }, 30); + lockItemTrs.setLocalMatrix(lockTrackerTrs.worldMatrix) + // 去除tracker监听 + this.root.removeChild(lockTrackerEl) + }, 30) } }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-message/index.js b/miniprogram/packageXRFrame/components/template/xr-template-message/index.js index 271c954e..a3a80dfa 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-message/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-message/index.js @@ -1,4 +1,3 @@ - Component({ behaviors: [require('../../common/share-behavior').default], properties: { @@ -10,8 +9,8 @@ Component({ moveZ: 0, }, observer(newVal, oldVal) { - this.speedX = Math.sign(this.speedX) !== 0 ? Math.sign(this.speedX) * Math.abs(newVal.moveX) * 0.01 : newVal.moveX * 0.01; - this.speedZ = Math.sign(this.speedZ) !== 0 ? Math.sign(this.speedZ) * Math.abs(newVal.moveZ) * 0.01 : newVal.moveZ * 0.01; + this.speedX = Math.sign(this.speedX) !== 0 ? Math.sign(this.speedX) * Math.abs(newVal.moveX) * 0.01 : newVal.moveX * 0.01 + this.speedZ = Math.sign(this.speedZ) !== 0 ? Math.sign(this.speedZ) * Math.abs(newVal.moveZ) * 0.01 : newVal.moveZ * 0.01 } } }, @@ -20,51 +19,50 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrSystem = wx.getXrFrameSystem(); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrSystem = wx.getXrFrameSystem() // 绑定运动目标 - this.moveSphereTRS = this.scene.getElementById('move-sphere').getComponent(xrSystem.Transform); + this.moveSphereTRS = this.scene.getElementById('move-sphere').getComponent(xrSystem.Transform) // 绑定内置变量 - this.speedX = 0; - this.speedZ = 0; - this.planeWidth = 5; + this.speedX = 0 + this.speedZ = 0 + this.planeWidth = 5 // 绑定tick事件 - xrScene.event.add('tick', this.handleTick.bind(this)); + xrScene.event.add('tick', this.handleTick.bind(this)) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleTick: function () { + handleTick() { if (this.moveSphereTRS) { - const nowPos = this.moveSphereTRS.position; - if(nowPos.x > this.planeWidth) { - this.speedX = -this.speedX; - } else if (nowPos.x < -this.planeWidth){ - this.speedX = -this.speedX; + const nowPos = this.moveSphereTRS.position + if (nowPos.x > this.planeWidth) { + this.speedX = -this.speedX + } else if (nowPos.x < -this.planeWidth) { + this.speedX = -this.speedX } - if(nowPos.z > this.planeWidth) { - this.speedZ = -this.speedZ; - } else if (nowPos.z < -this.planeWidth){ - this.speedZ = -this.speedZ; + if (nowPos.z > this.planeWidth) { + this.speedZ = -this.speedZ + } else if (nowPos.z < -this.planeWidth) { + this.speedZ = -this.speedZ } - nowPos.x += this.speedX; - nowPos.z += this.speedZ; + nowPos.x += this.speedX + nowPos.z += this.speedZ - this.triggerEvent('infoListener', { + this.triggerEvent('infoListener', { speedX: this.speedX, speedZ: this.speedZ, posX: nowPos.x.toFixed(2), posZ: nowPos.z.toFixed(2), - }); + }) } - } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-pbr/index.js b/miniprogram/packageXRFrame/components/template/xr-template-pbr/index.js index a37c8d1d..f48f1449 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-pbr/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-pbr/index.js @@ -1,5 +1,3 @@ - - Component({ behaviors: [require('../../common/share-behavior').default], properties: { @@ -10,36 +8,34 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-saaacene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-saaacene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // 延时保证 glTF 解析完毕 setTimeout(() => { - this.setToon(); - }, 200); - + this.setToon() + }, 200) }, setToon() { - const scene = this.scene; - const xrFrameSystem = wx.getXrFrameSystem() + const scene = this.scene + const xrFrameSystem = wx.getXrFrameSystem() - const gltfElement = scene.getElementById("gltf"); - const gltf = gltfElement.getComponent(xrFrameSystem.GLTF); + const gltfElement = scene.getElementById('gltf') + const gltf = gltfElement.getComponent(xrFrameSystem.GLTF) - console.log('custom-pbr gltf', gltf); + console.log('custom-pbr gltf', gltf) - for(const mesh of gltf.meshes) { + for (const mesh of gltf.meshes) { console.log('custom-pbr mesh material', mesh.material) - console.log('custom-pbr effect', scene.assets.getAsset('effect', 'custom-pbr')); + console.log('custom-pbr effect', scene.assets.getAsset('effect', 'custom-pbr')) const pbrMaterial = scene.createMaterial( // 使用定制的效果 @@ -49,8 +45,8 @@ Component({ u_baseColorMap: mesh.material.getTexture('u_baseColorMap'), u_metallicRoughnessMap: mesh.material.getTexture('u_metallicRoughnessMap'), u_normalMap: mesh.material.getTexture('u_normalMap'), - u_emissiveMap: mesh.material.getTexture('u_emissiveMap'), - u_emissiveFactor: mesh.material.getTexture('u_emissiveFactor'), + u_emissiveMap: mesh.material.getTexture('u_emissiveMap'), + u_emissiveFactor: mesh.material.getTexture('u_emissiveFactor'), u_occlusionMap: mesh.material.getTexture('u_occlusionMap'), u_clearcoatMap: mesh.material.getTexture('u_clearcoatMap'), u_specularGlossinessMap: mesh.material.getTexture('u_specularGlossinessMap'), @@ -63,12 +59,11 @@ Component({ u_sheenRoughnessMap: mesh.material.getTexture('u_sheenRoughnessMap'), u_specularEnvMapMat: mesh.material.getTexture('u_specularEnvMapMat'), } - ); + ) - console.log('custom-pbr material', pbrMaterial); - mesh.material = pbrMaterial; + console.log('custom-pbr material', pbrMaterial) + mesh.material = pbrMaterial } - } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-planeShadow/index.js b/miniprogram/packageXRFrame/components/template/xr-template-planeShadow/index.js index fb023579..b28ae073 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-planeShadow/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-planeShadow/index.js @@ -1,5 +1,3 @@ - - Component({ behaviors: [require('../../common/share-behavior').default], properties: { @@ -10,17 +8,15 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-removeBlack/index.js b/miniprogram/packageXRFrame/components/template/xr-template-removeBlack/index.js index de737a0f..a697016d 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-removeBlack/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-removeBlack/index.js @@ -8,16 +8,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-select/index.js b/miniprogram/packageXRFrame/components/template/xr-template-select/index.js index ca9482b0..18085264 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-select/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-select/index.js @@ -1,4 +1,4 @@ -var touch = false; +let touch = false Component({ behaviors: [require('../../common/share-behavior').default], properties: { @@ -9,15 +9,15 @@ Component({ switch (newVal) { case 0: this.pause() - break; + break case 1: this.resume() - break; + break default: - //前两位给了暂停、继续状态, 这里需要-2 + // 前两位给了暂停、继续状态, 这里需要-2 this.play(newVal - 2) - this.itemIndex = newVal - 2; - break; + this.itemIndex = newVal - 2 + break } } }, @@ -31,29 +31,29 @@ Component({ handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, handleTouchModel(e) { touch = true - const xrScene = this.scene; - const xrFrameSystem = wx.getXrFrameSystem(); - const myModel = xrScene.getElementById('myModel'); - this.myModelAnimator = myModel.getComponent(xrFrameSystem.Animator); - const clips = this.myModelAnimator._clips; + const xrScene = this.scene + const xrFrameSystem = wx.getXrFrameSystem() + const myModel = xrScene.getElementById('myModel') + this.myModelAnimator = myModel.getComponent(xrFrameSystem.Animator) + const clips = this.myModelAnimator._clips this.clipName = [] clips.forEach((v, key) => { @@ -64,68 +64,67 @@ Component({ this.triggerEvent('infoListener', { clipName: this.clipName, - }); + }) }, - handleTick: function (dt) { + handleTick(dt) { if (touch) { - const xrFrameSystem = wx.getXrFrameSystem(); + const xrFrameSystem = wx.getXrFrameSystem() const camera = this.scene.getElementById('camera').getComponent(xrFrameSystem.Camera) - const myModel = this.scene.getElementById('myModel'); + const myModel = this.scene.getElementById('myModel') const modelTRS = myModel.getComponent(xrFrameSystem.Transform) const trackerPos = camera.convertWorldPositionToClip(modelTRS.worldPosition.add(xrFrameSystem.Vector3.createFromNumber(0, 2, 0))) - const dirX = camera.convertWorldPositionToClip(xrFrameSystem.Vector3.createFromNumber(1, 0, 0)) const dirO = camera.convertWorldPositionToClip(xrFrameSystem.Vector3.createFromNumber(0, 0, 0)) const dirZ = camera.convertWorldPositionToClip(xrFrameSystem.Vector3.createFromNumber(0, 0, 1)) - var len1 = dirX.sub(dirO).length() - var len2 = dirZ.sub(dirO).length() - var lenRes = len1 > len2 ? len1 : len2 + const len1 = dirX.sub(dirO).length() + const len2 = dirZ.sub(dirO).length() + let lenRes = len1 > len2 ? len1 : len2 lenRes = lenRes < 0 ? 0 : lenRes > 1 ? 1 : lenRes this.triggerEvent('infoListener', { position: { - 'x': trackerPos.x, - 'y': trackerPos.y, + x: trackerPos.x, + y: trackerPos.y, }, len: 0.5 + lenRes - }); + }) } }, - handleGltfLoaded: async function () { - const xrScene = this.scene; - const xrFrameSystem = wx.getXrFrameSystem(); - const myModel = xrScene.getElementById('myModel'); - const shadowNode = myModel.getComponent("gltf").getInternalNodeByName("mixamorig:RightHandIndex1") + async handleGltfLoaded() { + const xrScene = this.scene + const xrFrameSystem = wx.getXrFrameSystem() + const myModel = xrScene.getElementById('myModel') + const shadowNode = myModel.getComponent('gltf').getInternalNodeByName('mixamorig:RightHandIndex1') const el = this.scene.createElement(xrFrameSystem.XRMesh, { - geometry: "cube", - scale: "20 20 20", - uniforms: "u_baseColorFactor:1 0 0 1", - position: "0 0 0", - rotation: "0 0 0" - }); + geometry: 'cube', + scale: '20 20 20', + uniforms: 'u_baseColorFactor:1 0 0 1', + position: '0 0 0', + rotation: '0 0 0' + }) - shadowNode.addChild(el); + shadowNode.addChild(el) }, play(index) { - console.log("play:", this.clipName[index]) + console.log('play:', this.clipName[index]) if (this.clipName.length != 0) { this.myModelAnimator.play(this.clipName[index], { loop: 10, - }); + }) } }, pause() { - console.log("pause:", this.clipName[this.itemIndex]) + console.log('pause:', this.clipName[this.itemIndex]) // this.myModelAnimator.pause(this.clipName[this.itemIndex]) this.myModelAnimator.pause() }, resume() { - console.log("resume:", this.clipName[this.itemIndex]) + console.log('resume:', this.clipName[this.itemIndex]) // this.myModelAnimator.resume(this.clipName[this.itemIndex]) this.myModelAnimator.resume() } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-share/index.js b/miniprogram/packageXRFrame/components/template/xr-template-share/index.js index 5c45cdff..56590e8d 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-share/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-share/index.js @@ -8,19 +8,18 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - this.scene.event.add('touchstart', this.handleShare.bind(this)); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + this.scene.event.add('touchstart', this.handleShare.bind(this)) }, handleShare(event) { - const {clientX, clientY} = event.touches[0]; - const {frameWidth: width, frameHeight: height} = this.scene; + const { clientX, clientY } = event.touches[0] + const { frameWidth: width, frameHeight: height } = this.scene if (clientY / height > 0.7 && clientX / width > 0.7) { - this.scene.share.captureToFriends(); + this.scene.share.captureToFriends() } - } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-textEdit/index.js b/miniprogram/packageXRFrame/components/template/xr-template-textEdit/index.js index ea6d851b..889377e4 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-textEdit/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-textEdit/index.js @@ -5,33 +5,32 @@ Component({ }, data: { loaded: false, - words: "文本内容", - fontColor: "1.0 1.0 1.0", + words: '文本内容', + fontColor: '1.0 1.0 1.0', fontSize: 1, }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) - let number = 0; - let fontSize = 1; - setInterval(()=>{ + let number = 0 + let fontSize = 1 + setInterval(() => { this.setData({ words: number, - fontSize: fontSize, + fontSize, fontColor: `${Math.random()} ${Math.random()} ${Math.random()}` }) - number++; + number++ if (fontSize > 2) { - fontSize = 1; + fontSize = 1 } else { - fontSize+= 0.1; + fontSize += 0.1 } - }, 200); - + }, 200) } - + } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-toon/index.js b/miniprogram/packageXRFrame/components/template/xr-template-toon/index.js index e6f5dc87..c8308805 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-toon/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-toon/index.js @@ -1,5 +1,3 @@ - - Component({ behaviors: [require('../../common/share-behavior').default], properties: { @@ -10,38 +8,35 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // 延时保证 glTF 解析完毕 setTimeout(() => { - this.setToon(); - }, 200); + this.setToon() + }, 200) }, setToon() { - const scene = this.scene; - const xrFrameSystem = wx.getXrFrameSystem() - - const gltfElement = scene.getElementById("gltf"); - const gltf = gltfElement.getComponent(xrFrameSystem.GLTF); - - console.log('toon gltf', gltf); + const scene = this.scene + const xrFrameSystem = wx.getXrFrameSystem() + const gltfElement = scene.getElementById('gltf') + const gltf = gltfElement.getComponent(xrFrameSystem.GLTF) - for(const mesh of gltf.meshes) { + console.log('toon gltf', gltf) + for (const mesh of gltf.meshes) { // console.log('toon mesh', mesh) console.log('toon mesh material', mesh.material) - console.log('toon effect', scene.assets.getAsset('effect', 'toon-user')); + console.log('toon effect', scene.assets.getAsset('effect', 'toon-user')) const toonMaterial = scene.createMaterial( // 使用定制的效果 @@ -49,20 +44,16 @@ Component({ { u_baseColorMap: mesh.material.getTexture('u_baseColorMap') } - ); - - console.log('toon toonMaterial', toonMaterial); + ) + console.log('toon toonMaterial', toonMaterial) // 接管渲染状态 // toonMaterial.setRenderState('cullFace', xrFrameSystem.ECullMode.BACK); - toonMaterial.setRenderState('cullOn', false); - - - mesh.material = toonMaterial; + toonMaterial.setRenderState('cullOn', false) + mesh.material = toonMaterial } - } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-tracker/index.js b/miniprogram/packageXRFrame/components/template/xr-template-tracker/index.js index d2a47d0f..1e58a437 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-tracker/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-tracker/index.js @@ -27,29 +27,28 @@ Component({ lifetimes: { detached() { // 关闭时候去除计时器 - clearInterval(this.innerInterval); + clearInterval(this.innerInterval) } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) // 加载场景资源 - const gltfResList = []; - const videoResList = []; + const gltfResList = [] + const videoResList = [] - const markerList = this.data.markerList; - for(let i = 0; i < markerList.length; i++) { - const marker = markerList[i]; + const markerList = this.data.markerList + for (let i = 0; i < markerList.length; i++) { + const marker = markerList[i] switch (marker.renderType) { case 'gltf': - gltfResList.push(marker); - break; + gltfResList.push(marker) + break case 'video': - videoResList.push(marker); - break; + videoResList.push(marker) + break } } @@ -59,7 +58,7 @@ Component({ console.log('[gltf load] error: ', err) } }, - handleARReady: function() { + handleARReady() { console.log('arReady') this.setData({ arReady: true }) }, @@ -77,10 +76,10 @@ Component({ const scene = this.scene const videoTexture = await scene.assets.loadAsset({ type: 'video-texture', - assetId: `video-` + videoItem.id, + assetId: 'video-' + videoItem.id, src: videoItem.src, options: { loop: true, autoPlay: true }, - }); + }) // console.log('videoTexture', videoTexture); const videoMat = scene.createMaterial( scene.assets.getAsset('effect', 'simple'), @@ -98,40 +97,40 @@ Component({ // 存在纹理才进行释放 const scene = this.scene // 释放加载过的资源 - scene.assets.releaseAsset('video-texture', `video-${id}`); - scene.assets.releaseAsset('material', `video-mat-${id}`); + scene.assets.releaseAsset('video-texture', `video-${id}`) + scene.assets.releaseAsset('material', `video-mat-${id}`) } }, handleTrackerSwitch({ detail }) { console.log('tracked match') if (this.data.loaded) { - const element = detail.el; - const active = detail.value; - const data = this.data; - const markerList = data.markerList; + const element = detail.el + const active = detail.value + const data = this.data + const markerList = data.markerList for (let i = 0; i < markerList.length; i++) { - const markerInfo = markerList[i]; + const markerInfo = markerList[i] const markerTracker = this.scene.getElementById(`marker-${markerInfo.id}`) if (element === markerTracker) { // 处理视频纹理 - this.releaseVideo(this.videoId); - this.videoId = -1; + this.releaseVideo(this.videoId) + this.videoId = -1 // 匹配 tracker switch (markerInfo.renderType) { case 'scan': // scan - this.scanHandler(markerTracker, markerInfo, active); - break; + this.scanHandler(markerTracker, markerInfo, active) + break case 'video': // video if (active) { - this.videoHanler(markerInfo); + this.videoHanler(markerInfo) } - break; + break case 'gltf': // gltf - break; + break } this.triggerEvent('trackerchange', { name: markerInfo.name, - active: active, + active, type: markerInfo.renderType, }) } @@ -141,9 +140,9 @@ Component({ scanHandler(markerTracker, markerInfo, active) { const renderType = markerInfo.renderType const xrFrameSystem = wx.getXrFrameSystem() - const camera = this.scene.getElementById('camera').getComponent(xrFrameSystem.Camera); + const camera = this.scene.getElementById('camera').getComponent(xrFrameSystem.Camera) const trackerTRS = markerTracker.getComponent(xrFrameSystem.Transform) - const rightTRS = this.scene.getElementById(`normal-right-${markerInfo.id}`).getComponent(xrFrameSystem.Transform); + const rightTRS = this.scene.getElementById(`normal-right-${markerInfo.id}`).getComponent(xrFrameSystem.Transform) const trackerPos = camera.convertWorldPositionToClip(trackerTRS.worldPosition) const rightPos = camera.convertWorldPositionToClip(rightTRS.worldPosition) const posX = ((trackerPos.x + 1) / 2) @@ -168,7 +167,7 @@ Component({ // 通知上层 this.triggerEvent('trackerchange', { name: markerInfo.name, - active: active, + active, type: renderType, trackerInfo: { x: posX, @@ -179,10 +178,10 @@ Component({ }) if (active) { // 激活态开启tracker位置同步 - let preX = posX; - let preY = posY; + let preX = posX + let preY = posY let preR = rightPosX - this.innerInterval = setInterval(()=>{ + this.innerInterval = setInterval(() => { const tPos = camera.convertWorldPositionToClip(trackerTRS.worldPosition) const rPos = camera.convertWorldPositionToClip(rightTRS.worldPosition) const pX = ((tPos.x + 1) / 2) @@ -194,8 +193,8 @@ Component({ const dR = Math.abs(rX - preR) if (dX > 0.005 || dY > 0.005 || dR > 0.005) { - preX = pX; - preY = pY; + preX = pX + preY = pY preR = rX this.triggerEvent('trackermove', { active: true, @@ -222,7 +221,6 @@ Component({ } }) } - }, videoHanler(markerInfo) { this.setData({ @@ -238,14 +236,13 @@ Component({ width, height } = res - const widthDivideHeight = width / height; + const widthDivideHeight = width / height this.setData({ markerWidth: 1, markerHeight: (1 / widthDivideHeight).toFixed(2), videoRatioLoaded: true, - }); - + }) }, fail: res => { console.error(res) @@ -258,7 +255,7 @@ Component({ console.log('[video load] error: ', err) } - this.videoId = markerInfo.id; + this.videoId = markerInfo.id } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/index.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/index.js index e5e808d8..3b0b7795 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/index.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/index.js @@ -59,14 +59,14 @@ Component({ releaseAll() { // 释放资源 for (let i = 0, len = markerList.length; i < len; i++) { - const markerInfo = markerList[i]; - let meshPlayer = this.meshPlayObj[markerInfo.name].meshPlayer + const markerInfo = markerList[i] + const meshPlayer = this.meshPlayObj[markerInfo.name].meshPlayer meshPlayer && meshPlayer.release('all') } }, handleArError(e) { - console.log(e.detail); + console.log(e.detail) let errormsg = '当前设备不支持AR' if (String(e.detail.value).indexOf('2003002') > -1) { errormsg = '未开启小程序相机权限,打开右上角“设置”选项,开启小程序相机权限' @@ -81,15 +81,15 @@ Component({ handleReady({ detail }) { - this.scene = detail.value; + this.scene = detail.value this.camera = this.scene.getElementById('camera') // 绑定tick事件 - this.scene.event.add('tick', this.handleTick.bind(this)); + this.scene.event.add('tick', this.handleTick.bind(this)) this.meshPlayObj = {} for (let i = 0, len = this.data.markerList.length; i < len; i++) { - const markerInfo = this.data.markerList[i]; + const markerInfo = this.data.markerList[i] this.meshPlayObj[markerInfo.name] = { meshPlayer: new mesh4DPlayer({ scene: this.scene, @@ -98,17 +98,17 @@ Component({ preStart: true, loop: true, mountedComplete: () => { - this.camera.addChild(this.meshPlayer.manElem); + this.camera.addChild(this.meshPlayer.manElem) } }) } } - + this.meshPlayer = this.meshPlayObj[this.data.markerList[0].name].meshPlayer setTimeout(() => { - this.play() - }, 2000); + this.play() + }, 2000) }, play() { @@ -130,34 +130,34 @@ Component({ }, handleTick(delta) { - //更新体积视频 + // 更新体积视频 if (this.meshPlayer) { - this.meshPlayer.update(); + this.meshPlayer.update() } }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleARReady: function ({ + handleARReady({ detail }) { - console.log('arReady'); + console.log('arReady') this.setData({ arReady: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/mesh4DPlayer.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/mesh4DPlayer.js index 528e72af..416e7e68 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/mesh4DPlayer.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/mesh4DPlayer.js @@ -1,24 +1,23 @@ - // 着色器 -import videoVert from './shaders/videoVert'; -import videoFrag from './shaders/videoFrag'; -import shadowVert from './shaders/shadowVert'; -import shadowFrag from './shaders/shadowFrag'; +import videoVert from './shaders/videoVert' +import videoFrag from './shaders/videoFrag' +import shadowVert from './shaders/shadowVert' +import shadowFrag from './shaders/shadowFrag' const xrFrameSystem = wx.getXrFrameSystem() -const maxVB = 800000; -const maxIB = 800000; -const max_bones = 60; +const maxVB = 800000 +const maxIB = 800000 +const max_bones = 60 // VertexBuffer IndexBuffer 不能动态更改长度,需要一开始设定较大的长度。 -const vb0 = new Float32Array(new Array(maxVB)); // 人物 vertex 长度 77030 -const ib0 = new Uint16Array(new Array(maxIB)); // 人物 index 88266 88266 -const vb0Clear = new Float32Array(new Array(maxVB)); // 人物 vertex 长度 77030 -const ib0Clear = new Uint16Array(new Array(maxIB)); // 人物 index 88266 88266 +const vb0 = new Float32Array(new Array(maxVB)) // 人物 vertex 长度 77030 +const ib0 = new Uint16Array(new Array(maxIB)) // 人物 index 88266 88266 +const vb0Clear = new Float32Array(new Array(maxVB)) // 人物 vertex 长度 77030 +const ib0Clear = new Uint16Array(new Array(maxIB)) // 人物 index 88266 88266 -const getFrame_ = 5; -const xrTimeOut_ = 5; +const getFrame_ = 5 +const xrTimeOut_ = 5 -//文件管理器 +// 文件管理器 let fs class mesh4DPlayer { @@ -26,25 +25,25 @@ class mesh4DPlayer { this.name = options.name || 'demo' this.rootName = 'geometryRoot-' + options.name this.urlRoot = options.urlRoot - //XRFrame的scene - this.scene = options.scene; - this.startTime = options.startTime || 0; - this.startFrameIndex = this.startTime * 22; - this.index = options.index || 0; - this.nextRenderFrameCount = 20; + // XRFrame的scene + this.scene = options.scene + this.startTime = options.startTime || 0 + this.startFrameIndex = this.startTime * 22 + this.index = options.index || 0 + this.nextRenderFrameCount = 20 this.loop = options.loop this.autoPlay = options.autoPlay this.initComplete = options.initComplete this.mountedComplete = options.mountedComplete - this.pendingBufferDownload = false; - this.nextBufferLoadIndex = 0; - this.playing = false; - this.arrayBuffers = []; + this.pendingBufferDownload = false + this.nextBufferLoadIndex = 0 + this.playing = false + this.arrayBuffers = [] this.decoder = false - this.decoderStart = false; - this.preStart = options.preStart; + this.decoderStart = false + this.preStart = options.preStart if (options.urlRoot) { this.load(options.urlRoot) } @@ -53,15 +52,15 @@ class mesh4DPlayer { createVideoTexture(scene, data, width, height, pixelFormat) { return scene.createTexture({ source: [data], - pixelFormat: pixelFormat, - width: width, - height: height, + pixelFormat, + width, + height, magFilter: xrFrameSystem.EFilterMode.NEAREST, minFilter: xrFrameSystem.EFilterMode.NEAREST, wrapU: xrFrameSystem.EWrapMode.CLAMP_TO_EDGE, wrapV: xrFrameSystem.EWrapMode.CLAMP_TO_EDGE, anisoLevel: 1 - }); + }) } createSimpleEffect() { @@ -79,7 +78,7 @@ class mesh4DPlayer { default: 'white', macro: 'WX_USE_BASECOLORMAP' }, - + { key: 'texture2', default: 'white', @@ -89,28 +88,28 @@ class mesh4DPlayer { defaultRenderQueue: 2000, passes: [ { - renderStates: { - cullOn: true, - blendOn: false, - depthWrite: true, - cullFace: xrFrameSystem.ECullMode.FRONT, - }, - lightMode: "ShadowCaster", - useMaterialRenderStates: false, - shaders: [2, 3], + renderStates: { + cullOn: true, + blendOn: false, + depthWrite: true, + cullFace: xrFrameSystem.ECullMode.FRONT, }, - { - "renderStates": { - cullOn: false, - blendOn: false, - depthWrite: true, - depthTestOn: true, - cullFace: xrFrameSystem.ECullMode.BACK, + lightMode: 'ShadowCaster', + useMaterialRenderStates: false, + shaders: [2, 3], }, - lightMode: "ForwardBase", - useMaterialRenderStates: false, - shaders: [0, 1] - }], + { + renderStates: { + cullOn: false, + blendOn: false, + depthWrite: true, + depthTestOn: true, + cullFace: xrFrameSystem.ECullMode.BACK, + }, + lightMode: 'ForwardBase', + useMaterialRenderStates: false, + shaders: [0, 1] + }], shaders: [ videoVert, videoFrag, @@ -118,26 +117,26 @@ class mesh4DPlayer { shadowFrag, ], }) - this.scene.assets.addAsset('effect', 'frame-effect' + this.name, effect); - return effect; + this.scene.assets.addAsset('effect', 'frame-effect' + this.name, effect) + return effect } calcFrameIndex(data) { this.pixelBuffer = new Uint8Array(data) - this.frameIndex = 0; // 帧索引初始化为 0 - for (let a = 0; 16 > a; ++a) { + this.frameIndex = 0 // 帧索引初始化为 0 + for (let a = 0; a < 16; ++a) { // 遍历 16 个像素 - if (128 < this.pixelBuffer[4 * a] || 128 < this.pixelBuffer[4 * a + 1]) { + if (this.pixelBuffer[4 * a] > 128 || this.pixelBuffer[4 * a + 1] > 128) { // 如果像素值大于 128 - this.frameIndex += 1 << a; // 更新帧索引 + this.frameIndex += 1 << a // 更新帧索引 } } } updateRender(data) { this.calcFrameIndex(data) - let current_frame = this.frames[this.frameIndex]; - if (!current_frame) return; + let current_frame = this.frames[this.frameIndex] + if (!current_frame) return const { isFirstFrame, deformation, @@ -147,73 +146,73 @@ class mesh4DPlayer { tc, weights, indices - } = current_frame; - const arrayBufferIndex = this.buffers[this.frames[this.frameIndex].binFileIdx].arrayBufferIndex; - let mesh_buffers = this.arrayBuffers[arrayBufferIndex]; + } = current_frame + const arrayBufferIndex = this.buffers[this.frames[this.frameIndex].binFileIdx].arrayBufferIndex + let mesh_buffers = this.arrayBuffers[arrayBufferIndex] if (isFirstFrame != 'true') { - const idx = this.seekNearestFirstFrame(this.frameIndex, this.firstFrames); + const idx = this.seekNearestFirstFrame(this.frameIndex, this.firstFrames) if (idx != this.lastFirstFrameIdx) { - this.reloadFirstFrame = true; - this.lastFirstFrameIdx = idx; + this.reloadFirstFrame = true + this.lastFirstFrameIdx = idx } else { - this.reloadFirstFrame = false; + this.reloadFirstFrame = false } } else { - this.lastFirstFrameIdx = this.frameIndex; + this.lastFirstFrameIdx = this.frameIndex } - //清理内存 - current_frame = false; - //获取当前基础数据 + // 清理内存 + current_frame = false + // 获取当前基础数据 if (isFirstFrame == 'true' || this.reloadFirstFrame) { - this.index = new Uint16Array(mesh_buffers, this.boxs[f].start_byte, this.boxs[f].count * 3); + this.index = new Uint16Array(mesh_buffers, this.boxs[f].start_byte, this.boxs[f].count * 3) if (vbo) { - this.vbo = new Float32Array(mesh_buffers, this.boxs[vbo].start_byte, this.boxs[vbo].count * 13); + this.vbo = new Float32Array(mesh_buffers, this.boxs[vbo].start_byte, this.boxs[vbo].count * 13) } else { - this.pos = new Float32Array(mesh_buffers, this.boxs[pos].start_byte, this.boxs[pos].count * 3); - this.uv = new Float32Array(mesh_buffers, this.boxs[tc].start_byte, this.boxs[tc].count * 2); - this.weights = new Float32Array(mesh_buffers, this.boxs[weights].start_byte, this.boxs[weights].count * 4); - this.indices = new Float32Array(mesh_buffers, this.boxs[indices].start_byte, this.boxs[indices].count * 4); + this.pos = new Float32Array(mesh_buffers, this.boxs[pos].start_byte, this.boxs[pos].count * 3) + this.uv = new Float32Array(mesh_buffers, this.boxs[tc].start_byte, this.boxs[tc].count * 2) + this.weights = new Float32Array(mesh_buffers, this.boxs[weights].start_byte, this.boxs[weights].count * 4) + this.indices = new Float32Array(mesh_buffers, this.boxs[indices].start_byte, this.boxs[indices].count * 4) } } const { count, start_byte - } = this.boxs[deformation]; - let deform = new Float32Array(mesh_buffers, start_byte, count * 12); - //清理内存 - mesh_buffers = false; + } = this.boxs[deformation] + let deform = new Float32Array(mesh_buffers, start_byte, count * 12) + // 清理内存 + mesh_buffers = false if (!this.pixelData) { - this.pixelData = new Float32Array(max_bones * 16); - this.pixelDataClear = new Float32Array(max_bones * 16); - } - this.pixelData.set(this.pixelDataClear); - - for (var i = 0; i < count; i++) { - const start_idx = i * 16; - this.pixelData[start_idx + 0] = deform[12 * i + 0]; - this.pixelData[start_idx + 1] = deform[12 * i + 3]; - this.pixelData[start_idx + 2] = deform[12 * i + 6]; - this.pixelData[start_idx + 3] = 0; - this.pixelData[start_idx + 4] = deform[12 * i + 1]; - this.pixelData[start_idx + 5] = deform[12 * i + 4]; - this.pixelData[start_idx + 6] = deform[12 * i + 7]; - this.pixelData[start_idx + 7] = 0; - this.pixelData[start_idx + 8] = deform[12 * i + 2]; - this.pixelData[start_idx + 9] = deform[12 * i + 5]; - this.pixelData[start_idx + 10] = deform[12 * i + 8]; - this.pixelData[start_idx + 11] = 0; - this.pixelData[start_idx + 12] = deform[12 * i + 9]; - this.pixelData[start_idx + 13] = deform[12 * i + 10]; - this.pixelData[start_idx + 14] = deform[12 * i + 11]; - this.pixelData[start_idx + 15] = 1; - } - //清理内存 - deform = false; + this.pixelData = new Float32Array(max_bones * 16) + this.pixelDataClear = new Float32Array(max_bones * 16) + } + this.pixelData.set(this.pixelDataClear) + + for (let i = 0; i < count; i++) { + const start_idx = i * 16 + this.pixelData[start_idx + 0] = deform[12 * i + 0] + this.pixelData[start_idx + 1] = deform[12 * i + 3] + this.pixelData[start_idx + 2] = deform[12 * i + 6] + this.pixelData[start_idx + 3] = 0 + this.pixelData[start_idx + 4] = deform[12 * i + 1] + this.pixelData[start_idx + 5] = deform[12 * i + 4] + this.pixelData[start_idx + 6] = deform[12 * i + 7] + this.pixelData[start_idx + 7] = 0 + this.pixelData[start_idx + 8] = deform[12 * i + 2] + this.pixelData[start_idx + 9] = deform[12 * i + 5] + this.pixelData[start_idx + 10] = deform[12 * i + 8] + this.pixelData[start_idx + 11] = 0 + this.pixelData[start_idx + 12] = deform[12 * i + 9] + this.pixelData[start_idx + 13] = deform[12 * i + 10] + this.pixelData[start_idx + 14] = deform[12 * i + 11] + this.pixelData[start_idx + 15] = 1 + } + // 清理内存 + deform = false if (this.geometryMan) { this.updateData(isFirstFrame, 'updateRender(data)') if (!this.decoderStart) { this.ended_ = false - this.decoderStart = true; + this.decoderStart = true } } else { // 挂载dom @@ -223,103 +222,102 @@ class mesh4DPlayer { initXRMesh(isFirstFrame) { this.decoderStart_ = -1 - this.geometryRoot = this.scene.getElementById(this.rootName); + this.geometryRoot = this.scene.getElementById(this.rootName) const vl = this.scene.createVertexLayout({ attributes: [{ - name: "a_position", - format: xrFrameSystem.EVertexFormat.FLOAT3, - offset: 0, - usage: xrFrameSystem.EVertexLayoutUsage.POSITION - }, - { - name: "a_texCoord", - format: xrFrameSystem.EVertexFormat.FLOAT2, - offset: 12, - usage: xrFrameSystem.EVertexLayoutUsage.UV0 - }, - { - name: "a_boneIndices", - format: xrFrameSystem.EVertexFormat.FLOAT4, - offset: 20, - }, - { - name: "a_weights", - format: xrFrameSystem.EVertexFormat.FLOAT4, - offset: 36, - }, + name: 'a_position', + format: xrFrameSystem.EVertexFormat.FLOAT3, + offset: 0, + usage: xrFrameSystem.EVertexLayoutUsage.POSITION + }, + { + name: 'a_texCoord', + format: xrFrameSystem.EVertexFormat.FLOAT2, + offset: 12, + usage: xrFrameSystem.EVertexLayoutUsage.UV0 + }, + { + name: 'a_boneIndices', + format: xrFrameSystem.EVertexFormat.FLOAT4, + offset: 20, + }, + { + name: 'a_weights', + format: xrFrameSystem.EVertexFormat.FLOAT4, + offset: 36, + }, ], - }); - const geometry = this.scene.createGeometry(vl, vb0, ib0); - geometry.setBoundBall(new xrFrameSystem.Vector3(), 1); - geometry.addSubMesh(ib0.length, 0, 0); - this.scene.assets.addAsset('geometry', 'geometry-' + this.name, geometry); - const Format1 = xrFrameSystem.ETextureFormat.RGBA8; - const Format2 = xrFrameSystem.ETextureFormat.RGBA32F; - //Uint8Array + }) + const geometry = this.scene.createGeometry(vl, vb0, ib0) + geometry.setBoundBall(new xrFrameSystem.Vector3(), 1) + geometry.addSubMesh(ib0.length, 0, 0) + this.scene.assets.addAsset('geometry', 'geometry-' + this.name, geometry) + const Format1 = xrFrameSystem.ETextureFormat.RGBA8 + const Format2 = xrFrameSystem.ETextureFormat.RGBA32F + // Uint8Array this.texture_ = this.createVideoTexture(this.scene, this.pixelBuffer, 1024, 1024, Format1) - this.scene.assets.addAsset('texture', 'texture1-' + this.name, this.texture_); - //Float32Array + this.scene.assets.addAsset('texture', 'texture1-' + this.name, this.texture_) + // Float32Array this.texture_2 = this.createVideoTexture(this.scene, this.pixelData, 4, 60, Format2) - this.scene.assets.addAsset('texture', 'texture2-' + this.name, this.texture_2); + this.scene.assets.addAsset('texture', 'texture2-' + this.name, this.texture_2) this.simple2 = this.createSimpleEffect() const toonMaterial = this.scene.createMaterial(this.simple2, { texture2: this.texture_2, u_baseColorMap: this.texture_ - }); - this.scene.assets.addAsset('material', 'material-' + this.name, toonMaterial); + }) + this.scene.assets.addAsset('material', 'material-' + this.name, toonMaterial) this.manElem = this.scene.createElement(xrFrameSystem.XRMesh, { geometry: 'geometry-' + this.name, material: 'material-' + this.name, - position: "0 0 0", + position: '0 0 0', name: this.name, - "cast-shadow": true, - }); - console.log(this.manElem,'manele---------') - this.geometryRoot.addChild(this.manElem); + 'cast-shadow': true, + }) + console.log(this.manElem, 'manele---------') + this.geometryRoot.addChild(this.manElem) // 延时保证挂载与初始化完毕 this.xrTimeOut = setTimeout(() => { - vb0.set(vb0Clear); - ib0.set(ib0Clear); - this.manTRS = this.manElem.getComponent(xrFrameSystem.Transform); - this.meshMan = this.manElem.getComponent(xrFrameSystem.Mesh); - this.geometryMan = this.meshMan.geometry; - this.matGeo = this.meshMan.material; - this.matGeo.setRenderState("cullOn", false); + vb0.set(vb0Clear) + ib0.set(ib0Clear) + this.manTRS = this.manElem.getComponent(xrFrameSystem.Transform) + this.meshMan = this.manElem.getComponent(xrFrameSystem.Mesh) + this.geometryMan = this.meshMan.geometry + this.matGeo = this.meshMan.material + this.matGeo.setRenderState('cullOn', false) this.updateData(isFirstFrame, 'initXRMesh') - this.decoderStart = true; + this.decoderStart = true // x轴左移 this.manTRS.position.setValue(0, 0, 0) this.manTRS.scale.setValue(2, 2, 2) this.manTRS.rotation.setValue(0, (45 * Math.PI / 180), 0) - if (this.playStartEvent) this.playStartEvent(); + if (this.playStartEvent) this.playStartEvent() this.decoderStart_ = 1 this.mountedComplete && this.mountedComplete() - - }, xrTimeOut_); + }, xrTimeOut_) } updateData(isFirstFrame, type) { this.showHidden(true, 'updateData', type) if (isFirstFrame == 'true' || this.reloadFirstFrame) { - vb0.set(vb0Clear); + vb0.set(vb0Clear) if (this.vbo) { - vb0.set(this.vbo); + vb0.set(this.vbo) } else { - this.updateVertexBuffer(this.pos, this.uv, this.indices, this.weights); + this.updateVertexBuffer(this.pos, this.uv, this.indices, this.weights) } - ib0.set(ib0Clear); - ib0.set(this.index); - this.geometryMan.uploadVertexBuffer(0, vb0); - this.geometryMan.uploadIndexBuffer(0, ib0); + ib0.set(ib0Clear) + ib0.set(this.index) + this.geometryMan.uploadVertexBuffer(0, vb0) + this.geometryMan.uploadIndexBuffer(0, ib0) } - this.texture_2.update(this.pixelData, 0, 0, 4, 60); - this.texture_.update(this.pixelBuffer, 0, 0, 1024, 1024); + this.texture_2.update(this.pixelData, 0, 0, 4, 60) + this.texture_.update(this.pixelBuffer, 0, 0, 1024, 1024) } load() { - let info_fn = this.urlRoot + '/mesh.json'; + const info_fn = this.urlRoot + '/mesh.json' console.log(info_fn) this.requestTask0 = wx.request({ url: info_fn, @@ -327,17 +325,17 @@ class mesh4DPlayer { success: (res) => { this.loadData(res.data) } - }); + }) } async loadData(json) { - this.boxs = json.boxs; - this.frames = json.frames; - this.firstFrames = json.firstFrames; - this.buffers = json.buffers; - this.bufferIndexMaxL = json.buffers.length; - this.framesLength = json.frames.length; - this.videoUrl = this.urlRoot + '/' + json.mp4Url; + this.boxs = json.boxs + this.frames = json.frames + this.firstFrames = json.firstFrames + this.buffers = json.buffers + this.bufferIndexMaxL = json.buffers.length + this.framesLength = json.frames.length + this.videoUrl = this.urlRoot + '/' + json.mp4Url this.cacheBuffers() @@ -349,10 +347,10 @@ class mesh4DPlayer { } cacheVideo(url) { - let storageKey = this.name + 'Video' - let videoDownload = () => { + const storageKey = this.name + 'Video' + const videoDownload = () => { wx.downloadFile({ - url: url, + url, success: (res) => { if (res.statusCode === 200) { this.cacheVideoUrl = res.tempFilePath @@ -362,7 +360,7 @@ class mesh4DPlayer { }) } - let localVideoPath = wx.getStorageSync(storageKey) + const localVideoPath = wx.getStorageSync(storageKey) if (localVideoPath) { try { this.getFS().accessSync(localVideoPath) @@ -377,13 +375,13 @@ class mesh4DPlayer { } cacheBuffers() { - let storageKey = this.name + 'Buffers' - let localBuffersPathArr = wx.getStorageSync(storageKey) + const storageKey = this.name + 'Buffers' + const localBuffersPathArr = wx.getStorageSync(storageKey) if (localBuffersPathArr) { try { this.buffers = localBuffersPathArr for (let i = 0; i < this.bufferIndexMaxL; i++) { - let keybin = wx.getStorageSync(this.name + localBuffersPathArr[i].url) + const keybin = wx.getStorageSync(this.name + localBuffersPathArr[i].url) console.log(localBuffersPathArr[i], 'keybin') if (!keybin) { throw 'no data' @@ -413,7 +411,7 @@ class mesh4DPlayer { clearUserDataFileList(list) { for (let i = 0, len = list.length; i < len; i++) { - const element = list[i]; + const element = list[i] if (element.path.toLowerCase().indexOf('.bin') > -1 || element.path.toLowerCase().indexOf('.mp4') > -1) { this.getFS().unlinkSync(`${wx.env.USER_DATA_PATH}/${element.path}`) } @@ -421,29 +419,29 @@ class mesh4DPlayer { } checkBufferData() { - const frameIndex = this.frameIndex + this.nextRenderFrameCount; - if (frameIndex >= this.framesLength) return true; + const frameIndex = this.frameIndex + this.nextRenderFrameCount + if (frameIndex >= this.framesLength) return true const binFileIdx = this.frames[frameIndex].binFileIdx - const arrayBufferIndex = this.buffers[binFileIdx].arrayBufferIndex; - if (arrayBufferIndex == undefined) return false; + const arrayBufferIndex = this.buffers[binFileIdx].arrayBufferIndex + if (arrayBufferIndex == undefined) return false if (arrayBufferIndex < this.arrayBuffers.length) { - return true; + return true } - return false; + return false } loadNextBuffer() { if (this.pendingBufferDownload || this.nextBufferLoadIndex >= this.bufferIndexMaxL) { - return; + return } - let cbFn = (res, urlkey) => { - if (this.arrayBuffers == null) this.arrayBuffers = []; + const cbFn = (res, urlkey) => { + if (this.arrayBuffers == null) this.arrayBuffers = [] if (res) { - const arrayBuffer = res.data; - this.arrayBuffers[bufferIndex] = arrayBuffer; + const arrayBuffer = res.data + this.arrayBuffers[bufferIndex] = arrayBuffer try { - let filePath = `${wx.env.USER_DATA_PATH}/${urlkey}` + const filePath = `${wx.env.USER_DATA_PATH}/${urlkey}` fs.writeFileSync( filePath, arrayBuffer, @@ -451,17 +449,17 @@ class mesh4DPlayer { console.log(filePath, 'filepth') wx.setStorageSync(urlkey, filePath) } catch (error) { - //当空间不足时,清空用户本地文件夹 + // 当空间不足时,清空用户本地文件夹 this.clearUserDataFileList(this.getUserDataFileList()) - console.log(error, 'error'); + console.log(error, 'error') } } - this.nextBufferLoadIndex += 1; - this.pendingBufferDownload = false; - buffer.arrayBufferIndex = bufferIndex; + this.nextBufferLoadIndex += 1 + this.pendingBufferDownload = false + buffer.arrayBufferIndex = bufferIndex if (this.nextBufferLoadIndex < this.bufferIndexMaxL) { - this.loadNextBuffer(); - //判断的加载到一半数据时允许播放,如果想加载完成才播放写在else里面 + this.loadNextBuffer() + // 判断的加载到一半数据时允许播放,如果想加载完成才播放写在else里面 if (this.nextBufferLoadIndex == Math.max(Math.floor(this.bufferIndexMaxL / 2), 1)) { this.executePlay() } @@ -471,12 +469,11 @@ class mesh4DPlayer { wx.setStorageSync(this.name + 'Buffers', this.buffers) console.log(this.buffers, 'this.buffers') } - } - const bufferIndex = this.nextBufferLoadIndex; - const buffer = this.buffers[bufferIndex]; - const bufferURL = this.urlRoot + '/' + buffer.url; - this.pendingBufferDownload = true; + const bufferIndex = this.nextBufferLoadIndex + const buffer = this.buffers[bufferIndex] + const bufferURL = this.urlRoot + '/' + buffer.url + this.pendingBufferDownload = true this.requestTask1 = wx.request({ url: bufferURL, method: 'GET', @@ -485,7 +482,7 @@ class mesh4DPlayer { cbFn(res, this.name + buffer.url) // console.log('加载:', bufferURL) } - }); + }) } executePlay() { @@ -496,14 +493,14 @@ class mesh4DPlayer { } seekNearestFirstFrame(idx, arrays) { - const length = arrays.length; + const length = arrays.length for (let i = 0; i < length - 1; ++i) { if (arrays[i] <= idx && arrays[i + 1] > idx) { - return arrays[i]; + return arrays[i] } } if (idx >= arrays[length - 1]) { - return arrays[length - 1]; + return arrays[length - 1] } } @@ -514,28 +511,26 @@ class mesh4DPlayer { } async updateVideo() { - if (this.ended_) return; - if (!this.frames) return false; + if (this.ended_) return + if (!this.frames) return false if (!this.checkBufferData()) { - if (!this.decoder) return; + if (!this.decoder) return if (!this.paused) { console.log('下一个 mesh 没有准备好') - this.paused = true; - await this.decoder.wait(true); // 暂停视频播放 - } - } else { - if (this.paused) { - console.log('下一个 mesh 准备好了') - await this.decoder.wait(false); - this.paused = false; + this.paused = true + await this.decoder.wait(true) // 暂停视频播放 } + } else if (this.paused) { + console.log('下一个 mesh 准备好了') + await this.decoder.wait(false) + this.paused = false } if (this.decoder) { let frameData_0 = this.decoder.getFrameData() if (frameData_0) { const { data - } = frameData_0; + } = frameData_0 this.updateRender(data) } frameData_0 = null @@ -543,27 +538,27 @@ class mesh4DPlayer { } decoderEndEvent() { - let bindEndFn = async () => { + const bindEndFn = async () => { this.ended_ = true - this.decoderStart = false; - this.playing = false; + this.decoderStart = false + this.playing = false if (this.decoder) { - await this.decoder.stop(); - this.preStartDecoderEnd = true; + await this.decoder.stop() + this.preStartDecoderEnd = true } - console.log('进来再次播放'); + console.log('进来再次播放') - //延迟20ms之后再开始预先解码 + // 延迟20ms之后再开始预先解码 setTimeout(async () => { - console.log('再次播放'); + console.log('再次播放') await this.preStartDecoder() this.loop && this.play() }, 20) } if (this.decoder) { - console.log('执行注册'); + console.log('执行注册') this.decoder.off('ended', bindEndFn) this.decoder.on('ended', bindEndFn) } @@ -573,9 +568,9 @@ class mesh4DPlayer { if (!this.decoder) { this.decoder = wx.createVideoDecoder({ type: 'wemedia' - }); + }) // 新建解码器的时候就注册ended事件 - this.decoderEndEvent(); + this.decoderEndEvent() } const start_0 = Date.now() @@ -590,83 +585,83 @@ class mesh4DPlayer { wx.showToast({ title: '网络错误,视频加载失败', }) - return; + return } - const timeDiff_0 = Date.now() - start_0; + const timeDiff_0 = Date.now() - start_0 console.log('this.decoder.start的时长', timeDiff_0) - await this.decoder.wait(false); - this.decoder.seek(pos); - await this.decoder.wait(true); - this.preStartDecoderEnd = true; + await this.decoder.wait(false) + this.decoder.seek(pos) + await this.decoder.wait(true) + this.preStartDecoderEnd = true } async play() { - //无缓存时播放 - let frameData_0, data; + // 无缓存时播放 + let frameData_0; let + data const start_1 = Date.now() - console.log(this.decoder, 'this.decoder'); - console.log(this.preStartDecoderEnd, 'this.preStartDecoderEnd'); + console.log(this.decoder, 'this.decoder') + console.log(this.preStartDecoderEnd, 'this.preStartDecoderEnd') if (this.preStartDecoderEnd) { - await this.decoder.wait(false); - console.log('wait over'); + await this.decoder.wait(false) + console.log('wait over') } await new Promise(resolve => { this.frameDataflag = setInterval(() => { - if(this.decoder) - frameData_0 = this.decoder.getFrameData() + if (this.decoder) frameData_0 = this.decoder.getFrameData() if (frameData_0) { - data = frameData_0.data; - clearInterval(this.frameDataflag); + data = frameData_0.data + clearInterval(this.frameDataflag) this.frameDataflag = null - resolve(); + resolve() } - }, getFrame_); - }); - const timeDiff_1 = Date.now() - start_1; + }, getFrame_) + }) + const timeDiff_1 = Date.now() - start_1 console.log('setInterval解码后直到显示时的时长', timeDiff_1) - this.playing = true; + this.playing = true this.startTime_ = Date.now() this.updateRender(data) - frameData_0 = null; - data = null; + frameData_0 = null + data = null } async pause() { if (this.decoder) { - this.pauseExecute = true; + this.pauseExecute = true this.playing = false - this.decoderStart = false; - await this.decoder.wait(true); + this.decoderStart = false + await this.decoder.wait(true) } } async resume(start = true) { if (this.decoder && this.pauseExecute) { - this.playing = true; - this.pauseExecute = false; + this.playing = true + this.pauseExecute = false // this.decoder.seek(0); - await this.decoder.wait(false); + await this.decoder.wait(false) if (start) { - this.decoderStart = true; + this.decoderStart = true } } } stop(type) { if (this.decoder) { - this.decoder.stop(); + this.decoder.stop() } } showHidden(visible, type, type2) { - if (visible == this.visible) return; + if (visible == this.visible) return if (this.manTRS) { if (this.manTRS.el) { - this.visible = visible; + this.visible = visible this.manTRS.setData({ - visible: visible - }); + visible + }) } else { console.error('showHidden报错', type, type2, this.manTRS, visible, this.visible) } @@ -674,119 +669,119 @@ class mesh4DPlayer { } releaseAsset() { - this.scene.assets.releaseAsset('geometry', 'geometry-' + this.name); - this.scene.assets.releaseAsset('effect', 'frame-effect' + this.name); - this.scene.assets.releaseAsset('texture', 'texture1-' + this.name); - this.scene.assets.releaseAsset('texture', 'texture2-' + this.name); - this.scene.assets.releaseAsset('material', 'material-' + this.name); + this.scene.assets.releaseAsset('geometry', 'geometry-' + this.name) + this.scene.assets.releaseAsset('effect', 'frame-effect' + this.name) + this.scene.assets.releaseAsset('texture', 'texture1-' + this.name) + this.scene.assets.releaseAsset('texture', 'texture2-' + this.name) + this.scene.assets.releaseAsset('material', 'material-' + this.name) } releaseDecoder() { if (this.decoder) { - this.decoder.on('ended', () => {}); - this.decoder.stop(); - this.decoder.remove(); - this.decoder = null; + this.decoder.on('ended', () => {}) + this.decoder.stop() + this.decoder.remove() + this.decoder = null } } releaseNetwork() { - if (this.requestTask1) this.requestTask1.abort(); - this.requestTask1 = null; + if (this.requestTask1) this.requestTask1.abort() + this.requestTask1 = null } releaseBuffer() { - this.arrayBuffers = null; - this.buffers = null; - this.frames = null; - this.firstFrames = null; - this.boxs = null; + this.arrayBuffers = null + this.buffers = null + this.frames = null + this.firstFrames = null + this.boxs = null - this.index = null; - this.pixelData = null; - this.pixelDataClear = null; + this.index = null + this.pixelData = null + this.pixelDataClear = null } releaseEvent() { if (this.frameDataflag) { - clearInterval(this.frameDataflag); - this.frameDataflag = null; + clearInterval(this.frameDataflag) + this.frameDataflag = null } if (this.xrTimeOut) { clearTimeout(this.xrTimeOut) - this.xrTimeOut = null; + this.xrTimeOut = null } - this.playStartEvent = null; + this.playStartEvent = null } release(type = true) { this.releaseDecoder() this.releaseNetwork() if (type == 'all' || !type) { - this.texture_ = null; - this.texture_2 = null; - this.matGeo = null; - this.geometryMan = null; - this.meshMan = null; - this.manTRS = null; - this.manElem = null; + this.texture_ = null + this.texture_2 = null + this.matGeo = null + this.geometryMan = null + this.meshMan = null + this.manTRS = null + this.manElem = null } if (type) { - this.showHidden(false, 'replease'); - this.nextBufferLoadIndex = 1; - if (this.arrayBuffers && this.arrayBuffers.length) this.arrayBuffers.length = type ? 1 : 0; + this.showHidden(false, 'replease') + this.nextBufferLoadIndex = 1 + if (this.arrayBuffers && this.arrayBuffers.length) this.arrayBuffers.length = type ? 1 : 0 if (type == 'all') { this.releaseBuffer() - if (this.manElem) this.geometryRoot.removeChild(this.manElem); - this.geometryRoot = null; + if (this.manElem) this.geometryRoot.removeChild(this.manElem) + this.geometryRoot = null } } else { this.releaseBuffer() } this.releaseEvent() - this.startTime = null; - this.pendingBufferDownload = false; + this.startTime = null + this.pendingBufferDownload = false } close() { if (this.decoder) { - this.decoder.stop(); - this.decoder.remove(); + this.decoder.stop() + this.decoder.remove() } } updateVertexBuffer(positionData, uvDataArray, indices, weights) { - const vertexCount = positionData.length / 3; - let vbIndex = 0; + const vertexCount = positionData.length / 3 + let vbIndex = 0 for (let i = 0; i < vertexCount; i++) { - const vertexIndex = i * 3; - const uvIndex = i * 2; - const weightIndex = i * 4; + const vertexIndex = i * 3 + const uvIndex = i * 2 + const weightIndex = i * 4 // 0 xyz - vb0[vbIndex] = positionData[vertexIndex]; - vb0[vbIndex + 1] = positionData[vertexIndex + 1]; - vb0[vbIndex + 2] = positionData[vertexIndex + 2]; + vb0[vbIndex] = positionData[vertexIndex] + vb0[vbIndex + 1] = positionData[vertexIndex + 1] + vb0[vbIndex + 2] = positionData[vertexIndex + 2] // 2 uv - vb0[vbIndex + 3] = uvDataArray[uvIndex]; - vb0[vbIndex + 4] = uvDataArray[uvIndex + 1]; + vb0[vbIndex + 3] = uvDataArray[uvIndex] + vb0[vbIndex + 4] = uvDataArray[uvIndex + 1] // 4 indices - vb0[vbIndex + 5] = indices[weightIndex]; - vb0[vbIndex + 6] = indices[weightIndex + 1]; - vb0[vbIndex + 7] = indices[weightIndex + 2]; - vb0[vbIndex + 8] = indices[weightIndex + 3]; + vb0[vbIndex + 5] = indices[weightIndex] + vb0[vbIndex + 6] = indices[weightIndex + 1] + vb0[vbIndex + 7] = indices[weightIndex + 2] + vb0[vbIndex + 8] = indices[weightIndex + 3] // 8 weights - vb0[vbIndex + 9] = weights[weightIndex]; - vb0[vbIndex + 10] = weights[weightIndex + 1]; - vb0[vbIndex + 11] = weights[weightIndex + 2]; - vb0[vbIndex + 12] = weights[weightIndex + 3]; + vb0[vbIndex + 9] = weights[weightIndex] + vb0[vbIndex + 10] = weights[weightIndex + 1] + vb0[vbIndex + 11] = weights[weightIndex + 2] + vb0[vbIndex + 12] = weights[weightIndex + 3] // total 13 - vbIndex += 13; + vbIndex += 13 } - return vb0; + return vb0 } } export { mesh4DPlayer -}; \ No newline at end of file +} diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/common.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/common.js index 987ba6c5..cf2e868c 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/common.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/common.js @@ -166,4 +166,4 @@ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowFrag.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowFrag.js index 2ea9b132..a3a950b4 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowFrag.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowFrag.js @@ -18,4 +18,4 @@ void main() { gl_FragData[0] = packDepth(v_shadowDepth * 0.5 + 0.5); } - ` \ No newline at end of file + ` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowVert.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowVert.js index 5a804e49..449402a2 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowVert.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/shadowVert.js @@ -46,4 +46,4 @@ void main(){ } -` \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoFrag.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoFrag.js index 0ab4dd91..fb8c0b52 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoFrag.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoFrag.js @@ -11,4 +11,4 @@ void main() // gl_FragColor = vec4(1.0,1.0,1.0,1.0); gl_FragColor = vec4(color.rgb, 1.0); } - ` \ No newline at end of file + ` diff --git a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoVert.js b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoVert.js index 983a6e0c..49c40619 100644 --- a/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoVert.js +++ b/miniprogram/packageXRFrame/components/template/xr-template-volumeVideo/shaders/videoVert.js @@ -37,4 +37,4 @@ void main(){ gl_Position = u_projection * u_view * worldPosition; } -` \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/components/xr-ar-2dmarker/index.js b/miniprogram/packageXRFrame/components/xr-ar-2dmarker/index.js index c89f99d1..f6752d1b 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-2dmarker/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-2dmarker/index.js @@ -18,29 +18,29 @@ Component({ handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleARReady: function ({ + handleARReady({ detail }) { - console.log('arReady'); + console.log('arReady') this.setData({ arReady: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-basic/index.js b/miniprogram/packageXRFrame/components/xr-ar-basic/index.js index a5b5fb86..6e7f4223 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-basic/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-basic/index.js @@ -13,34 +13,34 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // this.setData({loaded: true}); - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) }, placeNode(event) { - const {clientX, clientY} = event.touches[0]; - const {frameWidth: width, frameHeight: height} = this.scene; + const { clientX, clientY } = event.touches[0] + const { frameWidth: width, frameHeight: height } = this.scene if (clientY / height > 0.8 && clientX / width < 0.2) { - this.scene.getNodeById('setitem').visible = false; - this.scene.ar.resetPlane(); + this.scene.getNodeById('setitem').visible = false + this.scene.ar.resetPlane() } else { - this.scene.ar.placeHere('setitem', true); + this.scene.ar.placeHere('setitem', true) } - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-body-3d/index.js b/miniprogram/packageXRFrame/components/xr-ar-body-3d/index.js index 67667637..16c86240 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-body-3d/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-body-3d/index.js @@ -10,55 +10,53 @@ Component({ syncBoxSize: 0.03 }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) // 同步点信息 - const syncNumber = 24; - - let syncStr = ''; - const syncList = []; + const syncNumber = 24 + + let syncStr = '' + const syncList = [] for (let i = 0; i <= syncNumber; i++) { - const colorFloat = i / 16; - const colorR = 1.0 - colorFloat; - syncStr += ` ${i}`; + const colorFloat = i / 16 + const colorR = 1.0 - colorFloat + syncStr += ` ${i}` syncList.push(`1.0 ${colorR} ${colorR} 1.0`) } - this.setData({ trackerReady: true, - syncNumber: syncNumber, - syncStr: syncStr, - syncList: syncList + syncNumber, + syncStr, + syncList }) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { - return - } + } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-body/index.js b/miniprogram/packageXRFrame/components/xr-ar-body/index.js index df1ce157..4d1c2dd7 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-body/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-body/index.js @@ -5,30 +5,30 @@ Component({ arReady: false, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -38,11 +38,11 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) // 获取总体置信度 - const score = tracker.score; + const score = tracker.score - this.triggerEvent('info', {score}); + this.triggerEvent('info', { score }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-camera/index.js b/miniprogram/packageXRFrame/components/xr-ar-camera/index.js index 7bd3d6b7..bc261fcc 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-camera/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-camera/index.js @@ -12,26 +12,26 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function({detail}) { - console.log('ar-ready', this.scene.ar.arModes, this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('ar-ready', this.scene.ar.arModes, this.scene.ar.arVersion) }, - handleARError: function({detail}) { - console.log('ar-error', detail); + handleARError({ detail }) { + console.log('ar-error', detail) }, - handleLog: function({detail}) { - const {el, value} = detail; - console.log('log', detail.value); + handleLog({ detail }) { + const { el, value } = detail + console.log('log', detail.value) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-face-3d/index.js b/miniprogram/packageXRFrame/components/xr-ar-face-3d/index.js index d90faaf9..b1c6d907 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-face-3d/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-face-3d/index.js @@ -11,78 +11,75 @@ Component({ }, infoInited: false, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) // 同步点信息 - const syncNumber = 106; - - let syncStr = ''; - const syncList = []; + const syncNumber = 106 + + let syncStr = '' + const syncList = [] for (let i = 0; i <= syncNumber; i++) { - const colorFloat = i / 106; - const colorR = 1.0 - colorFloat; - syncStr += ` ${i}`; + const colorFloat = i / 106 + const colorR = 1.0 - colorFloat + syncStr += ` ${i}` syncList.push(`1.0 ${colorR} ${colorR} 1.0`) } - this.setData({ trackerReady: true, - syncNumber: syncNumber, - syncStr: syncStr, - syncList: syncList + syncNumber, + syncStr, + syncList }) - - }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, handleInfoInit() { - this.infoInited = true; + this.infoInited = true console.log('handleInfoInit') // 延时保证glTF加载完毕 - setTimeout(()=>{ - const xrSystem = wx.getXrFrameSystem(); + setTimeout(() => { + const xrSystem = wx.getXrFrameSystem() // 头模设为半透明 - const faceElem = this.scene.getElementById('face'); - const faceGLTF = faceElem.getComponent(xrSystem.GLTF); - console.log(faceGLTF, faceGLTF.meshes); - for(const mesh of faceGLTF.meshes) { + const faceElem = this.scene.getElementById('face') + const faceGLTF = faceElem.getComponent(xrSystem.GLTF) + console.log(faceGLTF, faceGLTF.meshes) + for (const mesh of faceGLTF.meshes) { // 通过alphaMode 的 Setter 设置,或者写入renderState,但需要手动控制宏 - mesh.material.alphaMode = "BLEND"; - mesh.material.renderQueue = 3000; - mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(1, 1, 1, 0.4)); + mesh.material.alphaMode = 'BLEND' + mesh.material.renderQueue = 3000 + mesh.material.setVector('u_baseColorFactor', xrSystem.Vector4.createFromNumber(1, 1, 1, 0.4)) } }, 30) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); + handleTick() { + const xrSystem = wx.getXrFrameSystem() if (this.data.arReady && this.data.loaded && this.data.trackerReady && !this.infoInited) { - this.handleInfoInit(); + this.handleInfoInit() } - const trackerEl = this.scene.getElementById('tracker'); + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -92,7 +89,7 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-face/index.js b/miniprogram/packageXRFrame/components/xr-ar-face/index.js index aec9454b..842b241c 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-face/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-face/index.js @@ -5,30 +5,30 @@ Component({ arReady: false, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -38,7 +38,7 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-hand-3d/index.js b/miniprogram/packageXRFrame/components/xr-ar-hand-3d/index.js index 56249eab..e7dbf1fe 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-hand-3d/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-hand-3d/index.js @@ -10,56 +10,53 @@ Component({ syncBoxSize: 0.006 }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) // 同步点信息 - const syncNumber = 16; - - let syncStr = ''; - const syncList = []; + const syncNumber = 16 + + let syncStr = '' + const syncList = [] for (let i = 0; i <= syncNumber; i++) { - const colorFloat = i / 16; - const colorR = 1.0 - colorFloat; - syncStr += ` ${i}`; + const colorFloat = i / 16 + const colorR = 1.0 - colorFloat + syncStr += ` ${i}` syncList.push(`1.0 ${colorR} ${colorR} 1.0`) } - this.setData({ trackerReady: true, - syncNumber: syncNumber, - syncStr: syncStr, - syncList: syncList + syncNumber, + syncStr, + syncList }) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); - + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { - return - } + } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-hand/index.js b/miniprogram/packageXRFrame/components/xr-ar-hand/index.js index 39d6b2af..5f40ff52 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-hand/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-hand/index.js @@ -5,30 +5,30 @@ Component({ arReady: false, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -38,13 +38,13 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) // 获取手势姿态,详见官网 - const gesture = tracker.gesture; + const gesture = tracker.gesture // 获取总体置信度 - const score = tracker.score; + const score = tracker.score - this.triggerEvent('info', {gesture, score}); + this.triggerEvent('info', { gesture, score }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-osdmarker/index.js b/miniprogram/packageXRFrame/components/xr-ar-osdmarker/index.js index 06de62f2..82a2f883 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-osdmarker/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-osdmarker/index.js @@ -18,34 +18,34 @@ Component({ handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleARReady: function ({ + handleARReady({ detail }) { - console.log('arReady'); + console.log('arReady') this.setData({ arReady: true }) }, - handleLog: function ({ + handleLog({ detail }) { - console.log('log', detail.value); + console.log('log', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-shoe/index.js b/miniprogram/packageXRFrame/components/xr-ar-shoe/index.js index 512f1ac5..fa0f7b54 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-shoe/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-shoe/index.js @@ -11,63 +11,60 @@ Component({ }, infoInited: false, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); - + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) // 同步点信息 - const syncNumber = 8; - - let syncStr = ''; - const syncList = []; + const syncNumber = 8 + + let syncStr = '' + const syncList = [] for (let i = 0; i < syncNumber; i++) { - const colorFloat = i / 8; - const colorR = 1.0 - colorFloat; - syncStr += ` ${i}`; + const colorFloat = i / 8 + const colorR = 1.0 - colorFloat + syncStr += ` ${i}` syncList.push(`1.0 ${colorR} ${colorR} 1.0`) } this.setData({ trackerReady: true, - syncNumber: syncNumber, - syncStr: syncStr, - syncList: syncList + syncNumber, + syncStr, + syncList }) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, handleInfoInit() { - this.infoInited = true; + this.infoInited = true console.log('handleInfoInit') - - }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); + handleTick() { + const xrSystem = wx.getXrFrameSystem() if (this.data.arReady && this.data.loaded && this.data.trackerReady && !this.infoInited) { - this.handleInfoInit(); + this.handleInfoInit() } - const trackerEl = this.scene.getElementById('tracker-1'); + const trackerEl = this.scene.getElementById('tracker-1') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -77,7 +74,7 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-threeDof/index.js b/miniprogram/packageXRFrame/components/xr-ar-threeDof/index.js index 2a5f1eab..69a121d6 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-threeDof/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-threeDof/index.js @@ -13,19 +13,19 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-vio-depth/index.js b/miniprogram/packageXRFrame/components/xr-ar-vio-depth/index.js index a5b5fb86..6e7f4223 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-vio-depth/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-vio-depth/index.js @@ -13,34 +13,34 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // this.setData({loaded: true}); - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) }, placeNode(event) { - const {clientX, clientY} = event.touches[0]; - const {frameWidth: width, frameHeight: height} = this.scene; + const { clientX, clientY } = event.touches[0] + const { frameWidth: width, frameHeight: height } = this.scene if (clientY / height > 0.8 && clientX / width < 0.2) { - this.scene.getNodeById('setitem').visible = false; - this.scene.ar.resetPlane(); + this.scene.getNodeById('setitem').visible = false + this.scene.ar.resetPlane() } else { - this.scene.ar.placeHere('setitem', true); + this.scene.ar.placeHere('setitem', true) } - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-ar-vio-marker/index.js b/miniprogram/packageXRFrame/components/xr-ar-vio-marker/index.js index a5b5fb86..6e7f4223 100644 --- a/miniprogram/packageXRFrame/components/xr-ar-vio-marker/index.js +++ b/miniprogram/packageXRFrame/components/xr-ar-vio-marker/index.js @@ -13,34 +13,34 @@ Component({ } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.mat = new (wx.getXrFrameSystem().Matrix4)(); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.mat = new (wx.getXrFrameSystem().Matrix4)() + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) // this.setData({loaded: true}); - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) }, - handleARReady: function({detail}) { - console.log('arReady', this.scene.ar.arVersion); + handleARReady({ detail }) { + console.log('arReady', this.scene.ar.arVersion) }, placeNode(event) { - const {clientX, clientY} = event.touches[0]; - const {frameWidth: width, frameHeight: height} = this.scene; + const { clientX, clientY } = event.touches[0] + const { frameWidth: width, frameHeight: height } = this.scene if (clientY / height > 0.8 && clientX / width < 0.2) { - this.scene.getNodeById('setitem').visible = false; - this.scene.ar.resetPlane(); + this.scene.getNodeById('setitem').visible = false + this.scene.ar.resetPlane() } else { - this.scene.ar.placeHere('setitem', true); + this.scene.ar.placeHere('setitem', true) } - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-alpha/index.js b/miniprogram/packageXRFrame/components/xr-basic-alpha/index.js index 8d170255..39f65472 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-alpha/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-alpha/index.js @@ -16,9 +16,9 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-animation/index.js b/miniprogram/packageXRFrame/components/xr-basic-animation/index.js index a7b39523..36b781e8 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-animation/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-animation/index.js @@ -8,19 +8,19 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-envData/index.js b/miniprogram/packageXRFrame/components/xr-basic-envData/index.js index 1da2f44a..2672660a 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-envData/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-envData/index.js @@ -8,16 +8,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-light/index.js b/miniprogram/packageXRFrame/components/xr-basic-light/index.js index a7b39523..36b781e8 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-light/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-light/index.js @@ -8,19 +8,19 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-postprocessing/index.js b/miniprogram/packageXRFrame/components/xr-basic-postprocessing/index.js index 70ad2434..18e33a8c 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-postprocessing/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-postprocessing/index.js @@ -2,53 +2,53 @@ const blurData = { cullMask: 0b101, aIntensity: 1, dIntensity: 2, - env: "", - background: "default", + env: '', + background: 'default', cameraPosition: 1.3, - clearColor: "0 0 0 1", - cameraTarget: "camera-target", + clearColor: '0 0 0 1', + cameraTarget: 'camera-target', - pp: "blur", + pp: 'blur', // blurRadius: 0 -}; +} const bloomData = { cullMask: 0b11, aIntensity: 0, dIntensity: 0, - env: "", - background: "default", + env: '', + background: 'default', cameraPosition: 10, - clearColor: "0 0 0 1", - cameraTarget: "camera-target", + clearColor: '0 0 0 1', + cameraTarget: 'camera-target', - pp: "bloom2", + pp: 'bloom2', // bloomRadius_0: 0, // bloomRadius_1: 0 -}; +} const fxaaData = { cullMask: 0b1001, aIntensity: 1, dIntensity: 3, - env: "", - background: "default", + env: '', + background: 'default', cameraPosition: 1, - clearColor: "0.925 0.925 0.925 1", - cameraTarget: "mesh-sphere" -}; + clearColor: '0.925 0.925 0.925 1', + cameraTarget: 'mesh-sphere' +} const vignetteData = { cullMask: 0b101, aIntensity: 1, dIntensity: 2, - env: "", - background: "default", + env: '', + background: 'default', cameraPosition: 1.3, - clearColor: "0 0 0 1", - cameraTarget: "camera-target", - pp: "vignette", -}; + clearColor: '0 0 0 1', + cameraTarget: 'camera-target', + pp: 'vignette', +} Component({ behaviors: [require('../common/share-behavior').default], @@ -56,16 +56,16 @@ Component({ type: { type: Number, value: 0, - observer: function (newVal, oldVal) { + observer(newVal, oldVal) { if (newVal !== oldVal) { if (newVal === 0) { - this.activeBlur(); + this.activeBlur() } else if (newVal === 1) { - this.activeBloom(); + this.activeBloom() } else if (newVal === 2) { - this.activeVignette(); + this.activeVignette() } else if (newVal === 3) { - this.activeFXAA(); + this.activeFXAA() } } } @@ -81,7 +81,7 @@ Component({ this.setData({ bloomRadius_0: newVal * 0.2, bloomRadius_1: newVal * 0.8 - }); + }) } }, bloomIntensity: { @@ -110,29 +110,29 @@ Component({ observer(newVal, oldVal) { this.setData({ fxaaEnabled: newVal - }); + }) if (this.data.type === 3) { - this.activeFXAA(); + this.activeFXAA() } } } }, data: { loaded: false, - env: "", + env: '', cullMask: 0, - background: "default", + background: 'default', aIntensity: 0, dIntensity: 0, - pp: "", + pp: '', cameraPosition: 1, - cameraTarget: "camera-target", + cameraTarget: 'camera-target', - //---bloom--- + // ---bloom--- bloomRadius_0: 0, bloomRadius_1: 1, - //---fxaa--- + // ---fxaa--- fxaaEnabled: false }, lifetimes: { @@ -141,12 +141,12 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); - this.activeBlur(); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) + this.activeBlur() }, - handleTick: function() { + handleTick() { // const camera = this.scene.getNodeById("camera"); // const transform = camera.el._components.transform; // if (transform.rotation.y > Math.PI * 0.25) { @@ -155,27 +155,27 @@ Component({ // transform.rotation.y = -Math.PI * 0.25; // } }, - handleAssetsProgress: function({detail}) { - this.triggerEvent('assetsProgress', detail.value); + handleAssetsProgress({ detail }) { + this.triggerEvent('assetsProgress', detail.value) }, - handleAssetsLoaded: function({detail}) { - this.triggerEvent('assetsLoaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + this.triggerEvent('assetsLoaded', detail.value) + this.setData({ loaded: true }) }, activeBlur() { - this.setData(blurData); + this.setData(blurData) }, activeBloom() { - this.setData(bloomData); + this.setData(bloomData) }, activeVignette() { - this.setData(vignetteData); + this.setData(vignetteData) }, activeFXAA() { - this.setData(fxaaData); + this.setData(fxaaData) this.setData({ - pp: this.data.fxaaEnabled ? "fxaa" : "" - }); + pp: this.data.fxaaEnabled ? 'fxaa' : '' + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-render-texture/index.js b/miniprogram/packageXRFrame/components/xr-basic-render-texture/index.js index 6558a05a..d874a34e 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-render-texture/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-render-texture/index.js @@ -5,16 +5,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-shadow/index.js b/miniprogram/packageXRFrame/components/xr-basic-shadow/index.js index 221e2997..4b30e6c4 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-shadow/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-shadow/index.js @@ -6,11 +6,11 @@ Component({ meshCount: { type: Number, value: 0, - observer: function(newVal, oldVal) { + observer(newVal, oldVal) { if (newVal > oldVal) { - this.addOne(); + this.addOne() } else if (newVal < oldVal) { - this.removeOne(); + this.removeOne() } } } @@ -20,57 +20,57 @@ Component({ arReady: false }, methods: { - async handleReady({detail}) { - const scene = this.scene = detail.value; - console.log('xr-scene', scene); - this.meshList = []; + async handleReady({ detail }) { + const scene = this.scene = detail.value + console.log('xr-scene', scene) + this.meshList = [] const xrFrameSystem = wx.getXrFrameSystem() - this.shadowRoot = scene.getElementById('shadow-root'); + this.shadowRoot = scene.getElementById('shadow-root') - const {value: envData} = await scene.assets.loadAsset({type: 'env-data', assetId: 'env1', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/env-test.bin'}); - const envElement = scene.createElement(xrFrameSystem.XREnv); - this.shadowRoot.addChild(envElement); - const envComp = envElement.getComponent(xrFrameSystem.Env); - envComp.setData({envData: envData}); + const { value: envData } = await scene.assets.loadAsset({ type: 'env-data', assetId: 'env1', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/env-test.bin' }) + const envElement = scene.createElement(xrFrameSystem.XREnv) + this.shadowRoot.addChild(envElement) + const envComp = envElement.getComponent(xrFrameSystem.Env) + envComp.setData({ envData }) - const {value: model} = await scene.assets.loadAsset({type: 'gltf', assetId: 'damage-helmet', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/damage-helmet/index.glb'}); - this.gltfModle = model; - const gltfElement = scene.createElement(xrFrameSystem.XRGLTF); - this.shadowRoot.addChild(gltfElement); - const gltfComp = gltfElement.getComponent(xrFrameSystem.GLTF); - gltfComp.setData({model: model}); + const { value: model } = await scene.assets.loadAsset({ type: 'gltf', assetId: 'damage-helmet', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/damage-helmet/index.glb' }) + this.gltfModle = model + const gltfElement = scene.createElement(xrFrameSystem.XRGLTF) + this.shadowRoot.addChild(gltfElement) + const gltfComp = gltfElement.getComponent(xrFrameSystem.GLTF) + gltfComp.setData({ model }) - const cameraElement = scene.createElement(xrFrameSystem.XRCamera); - this.shadowRoot.addChild(cameraElement); - cameraElement.getComponent(xrFrameSystem.Transform).position.setValue(0, 0, 9); + const cameraElement = scene.createElement(xrFrameSystem.XRCamera) + this.shadowRoot.addChild(cameraElement) + cameraElement.getComponent(xrFrameSystem.Transform).position.setValue(0, 0, 9) cameraElement.getComponent(xrFrameSystem.Camera).setData({ target: gltfElement.getComponent(xrFrameSystem.Transform), background: 'skybox' - }); - cameraElement.addComponent(xrFrameSystem.CameraOrbitControl, {}); + }) + cameraElement.addComponent(xrFrameSystem.CameraOrbitControl, {}) }, addOne() { const xrFrameSystem = wx.getXrFrameSystem() - const pos = [Math.random(), Math.random(), Math.random()].map(v => (v * 2 - 1) * 6); + const pos = [Math.random(), Math.random(), Math.random()].map(v => (v * 2 - 1) * 6) - const gltfElement = this.scene.createElement(xrFrameSystem.XRGLTF); - this.shadowRoot.addChild(gltfElement); - gltfElement.getComponent(xrFrameSystem.Transform).position.setArray(pos); - gltfElement.getComponent(xrFrameSystem.GLTF).setData({model: this.gltfModle}); + const gltfElement = this.scene.createElement(xrFrameSystem.XRGLTF) + this.shadowRoot.addChild(gltfElement) + gltfElement.getComponent(xrFrameSystem.Transform).position.setArray(pos) + gltfElement.getComponent(xrFrameSystem.GLTF).setData({ model: this.gltfModle }) - this.meshList.push(gltfElement); + this.meshList.push(gltfElement) }, removeOne() { - const element = this.meshList.pop(); + const element = this.meshList.pop() if (element) { - this.shadowRoot.removeChild(element); + this.shadowRoot.removeChild(element) } }, - handleTick: function({detail}) { - const {el, value} = detail; + handleTick({ detail }) { + const { el, value } = detail }, handleDesotry() { }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-share/index.js b/miniprogram/packageXRFrame/components/xr-basic-share/index.js index 30bb9bac..d42d076b 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-share/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-share/index.js @@ -4,10 +4,10 @@ Component({ captureState: { type: Number, value: 0, - observer: function (newVal, oldVal) { + observer(newVal, oldVal) { if (newVal !== oldVal) { if (newVal === 1) { - this.capture(); + this.capture() } } }, @@ -15,12 +15,12 @@ Component({ recordState: { type: Number, value: 0, - observer: function (newVal, oldVal) { + observer(newVal, oldVal) { if (newVal !== oldVal) { if (newVal === 0) { - this.recordEnd(); + this.recordEnd() } else { - this.recordStart(); + this.recordStart() } } } @@ -55,22 +55,22 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const scene = this.scene = detail.value; - const appHide = () => this.scene.share.recordPause(); - const appShow = () => this.scene.share.recordResume(); - wx.onAppHide(appHide); - wx.onAppShow(appShow); - wx.offAppHide(appHide); - wx.offAppShow(appShow); - - this.triggerEvent('sceneReady', {width: scene.width, height: scene.height}); + handleReady({ detail }) { + const scene = this.scene = detail.value + const appHide = () => this.scene.share.recordPause() + const appShow = () => this.scene.share.recordResume() + wx.onAppHide(appHide) + wx.onAppShow(appShow) + wx.offAppHide(appHide) + wx.offAppShow(appShow) + + this.triggerEvent('sceneReady', { width: scene.width, height: scene.height }) }, capture() { this.scene.share.captureToFriends({ fileType: this.data.captureType, quality: this.data.captureQuality - }); + }) }, recordStart() { console.log('recordStart') @@ -79,11 +79,11 @@ Component({ videoBitsPerSecond: this.data.recordBPS, width: this.data.recordWidth, height: this.data.recordHeight - }); + }) }, recordEnd() { console.log('recordEnd') - this.scene.share.recordFinishToAlbum(); + this.scene.share.recordFinishToAlbum() } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-touch/index.js b/miniprogram/packageXRFrame/components/xr-basic-touch/index.js index 07645323..8c9c5992 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-touch/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-touch/index.js @@ -15,74 +15,74 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleTouchEarth: function() { + handleTouchEarth() { this.setData({ touchingEarth: true - }); + }) }, - handleUntouchEarth: function() { + handleUntouchEarth() { this.setData({ touchingEarth: false - }); + }) }, - handleEarthRotation: function({detail}) { - const { target, deltaX } = detail.value; - target._components.transform.rotation.y += deltaX / 100; + handleEarthRotation({ detail }) { + const { target, deltaX } = detail.value + target._components.transform.rotation.y += deltaX / 100 }, - handleDragMoon: function({detail}) { - const { dir, target, camera } = detail.value; - const cameraPos = camera.el._components.transform.worldPosition; - const k = -cameraPos.y / dir[1]; - const x = cameraPos.x + k * dir[0]; - const z = cameraPos.z + k * dir[2]; - const len = Math.sqrt(x * x + z * z); - if (len > this.data.innerRing) { - const transform = target._components.transform; - const scale = len > this.data.outerRing ? this.data.outerRing / len : 1.0; - transform.position.x = x * scale; - transform.position.z = z * scale; - } + handleDragMoon({ detail }) { + const { dir, target, camera } = detail.value + const cameraPos = camera.el._components.transform.worldPosition + const k = -cameraPos.y / dir[1] + const x = cameraPos.x + k * dir[0] + const z = cameraPos.z + k * dir[2] + const len = Math.sqrt(x * x + z * z) + if (len > this.data.innerRing) { + const transform = target._components.transform + const scale = len > this.data.outerRing ? this.data.outerRing / len : 1.0 + transform.position.x = x * scale + transform.position.z = z * scale + } }, - handleTouchMoon: function() { - this.setData({touchingMoon: true}); + handleTouchMoon() { + this.setData({ touchingMoon: true }) }, - handleUntouchMoon: function() { - const moon = this.scene.getNodeById("mesh-moon"); - const transform = moon.el._components.transform; - const x = transform.position.x; - const z = transform.position.z; - const len = Math.sqrt(x * x + z * z); - this.setData({ - r: len, - θ: x < 0 ? Math.atan(z / x) + Math.PI : Math.atan(z / x), - ω: Math.sqrt(2.5e-4 / (len * len * len)) - }); - this.setData({touchingMoon: false}); + handleUntouchMoon() { + const moon = this.scene.getNodeById('mesh-moon') + const transform = moon.el._components.transform + const x = transform.position.x + const z = transform.position.z + const len = Math.sqrt(x * x + z * z) + this.setData({ + r: len, + θ: x < 0 ? Math.atan(z / x) + Math.PI : Math.atan(z / x), + ω: Math.sqrt(2.5e-4 / (len * len * len)) + }) + this.setData({ touchingMoon: false }) }, - handleTick: function({detail}) { - if (this.data.touchingMoon || !this.scene) return; - const deltaTime = detail.value; - const moon = this.scene.getNodeById("mesh-moon"); - const transform = moon.el._components.transform; - const x = Math.cos(this.data.θ) * this.data.r; - const z = Math.sin(this.data.θ) * this.data.r; - transform.position.x = x; - transform.position.z = z; - transform.rotation.y -= this.data.ω * deltaTime; - this.setData({ - θ: this.data.θ + this.data.ω * deltaTime - }); + handleTick({ detail }) { + if (this.data.touchingMoon || !this.scene) return + const deltaTime = detail.value + const moon = this.scene.getNodeById('mesh-moon') + const transform = moon.el._components.transform + const x = Math.cos(this.data.θ) * this.data.r + const z = Math.sin(this.data.θ) * this.data.r + transform.position.x = x + transform.position.z = z + transform.rotation.y -= this.data.ω * deltaTime + this.setData({ + θ: this.data.θ + this.data.ω * deltaTime + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-video/index.js b/miniprogram/packageXRFrame/components/xr-basic-video/index.js index 390dc1c8..930be390 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-video/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-video/index.js @@ -8,30 +8,30 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleTouchCube: async function() { - const xrSystem = wx.getXrFrameSystem(); - const video = this.scene.assets.getAsset('video-texture', 'cat'); + async handleTouchCube() { + const xrSystem = wx.getXrFrameSystem() + const video = this.scene.assets.getAsset('video-texture', 'cat') if (!video) { - return; + return } if (video.state === xrSystem.EVideoState.Playing) { - video.pause(); + video.pause() } else if (video.state === xrSystem.EVideoState.Paused) { - video.resume(); + video.resume() } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic-visible-layer/index.js b/miniprogram/packageXRFrame/components/xr-basic-visible-layer/index.js index 081c45d4..f87e963e 100644 --- a/miniprogram/packageXRFrame/components/xr-basic-visible-layer/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic-visible-layer/index.js @@ -4,15 +4,15 @@ Component({ visibleIndex: { type: Number, value: 1, - observer: function (newVal, oldVal) { - + observer(newVal, oldVal) { + } }, cullMask: { type: Number, value: 0b001, - observer: function (newVal, oldVal) { - + observer(newVal, oldVal) { + } } }, @@ -21,16 +21,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-basic/index.js b/miniprogram/packageXRFrame/components/xr-basic/index.js index 1da2f44a..2672660a 100644 --- a/miniprogram/packageXRFrame/components/xr-basic/index.js +++ b/miniprogram/packageXRFrame/components/xr-basic/index.js @@ -8,16 +8,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-beside-edge/config.js b/miniprogram/packageXRFrame/components/xr-beside-edge/config.js index e7ae796c..4d0ba00d 100644 --- a/miniprogram/packageXRFrame/components/xr-beside-edge/config.js +++ b/miniprogram/packageXRFrame/components/xr-beside-edge/config.js @@ -1,161 +1,161 @@ export default { - "intro": { - "texts": [ - "你有点浑浑噩噩,感觉有些不对,但是回忆不起是哪里不对。", - "你究竟在逃避些什么?那些痛苦的回忆?", - "我知道你撑不住了,这里是你封藏的那些记忆,和某些人、某个人相关的回忆。", - "作为一个四处奔波的异乡人,刚被某游戏公司裁掉的你,当时究竟为什么还会留在这座城市。", - "努力想想,你们初次相遇时,就在那个吧台,点了一瓶酒,我还记得店员是{{在柜子的第二层}}取下来的。", - "你是程序,她是美术。" + intro: { + texts: [ + '你有点浑浑噩噩,感觉有些不对,但是回忆不起是哪里不对。', + '你究竟在逃避些什么?那些痛苦的回忆?', + '我知道你撑不住了,这里是你封藏的那些记忆,和某些人、某个人相关的回忆。', + '作为一个四处奔波的异乡人,刚被某游戏公司裁掉的你,当时究竟为什么还会留在这座城市。', + '努力想想,你们初次相遇时,就在那个吧台,点了一瓶酒,我还记得店员是{{在柜子的第二层}}取下来的。', + '你是程序,她是美术。' ] }, - "steps": [ + steps: [ { - "itemCount": 1, - "texts": [ - "那时的你并未想到,你们还会有第二次相遇。", - "这相遇仍是一次偶然,并且恰巧还会在同一个地点——", - "一次游戏活动,她就在那个{{自动售货机}}前。" + itemCount: 1, + texts: [ + '那时的你并未想到,你们还会有第二次相遇。', + '这相遇仍是一次偶然,并且恰巧还会在同一个地点——', + '一次游戏活动,她就在那个{{自动售货机}}前。' ] }, { - "itemCount": 1, - "texts": [ - "你们在一起了,却在相处后,有了越来越多的争吵。", - "终于有一次,你们都说了一些狠话,仅仅是踟蹰的瞬间,她的身影便消失于了眼前。", - "犹豫和徘徊了许久的你,按照直觉,再次来到了这里,然后你发现——", - "她{{正坐在那个角落,望着窗外}},一言不发。" + itemCount: 1, + texts: [ + '你们在一起了,却在相处后,有了越来越多的争吵。', + '终于有一次,你们都说了一些狠话,仅仅是踟蹰的瞬间,她的身影便消失于了眼前。', + '犹豫和徘徊了许久的你,按照直觉,再次来到了这里,然后你发现——', + '她{{正坐在那个角落,望着窗外}},一言不发。' ] }, { - "itemCount": 1, - "texts": [ - "那次之后,连带着你们共同的游戏理想,她彻底离开了你。", - "你失魂落魄,反复诘问着自己为了理想到底牺牲了什么,然后又不断用新的“理想”麻醉自己。", - "你完成了一些项目,内心却知道再也找不到那样的一个人了,再也没有那样的快乐了。", - "你再也没有找过新的对象,出于“体面”,你也再也没有打探过她的消息。", - "直到多年后的某一天,出于一次偶然,不知道是忘却了还是...你打破了“原则”,再次来到了这里。", - "在这一次名为GlobalGameJam的活动中,你却发现她就{{坐在那个沙发上}},错愕地望着你。" + itemCount: 1, + texts: [ + '那次之后,连带着你们共同的游戏理想,她彻底离开了你。', + '你失魂落魄,反复诘问着自己为了理想到底牺牲了什么,然后又不断用新的“理想”麻醉自己。', + '你完成了一些项目,内心却知道再也找不到那样的一个人了,再也没有那样的快乐了。', + '你再也没有找过新的对象,出于“体面”,你也再也没有打探过她的消息。', + '直到多年后的某一天,出于一次偶然,不知道是忘却了还是...你打破了“原则”,再次来到了这里。', + '在这一次名为GlobalGameJam的活动中,你却发现她就{{坐在那个沙发上}},错愕地望着你。' ] }, { - "itemCount": 1, - "texts": [ - "你逃走了,连带着这些记忆。", - "但既然又回到了这个地方,走到了这一步,还是让我告诉你一件真正重要的事情吧。", - "她在最后给你留下了一封信,虽然从未真正“看过”,但我却一直保存着。", - "打开它吧,然后做出选择。" + itemCount: 1, + texts: [ + '你逃走了,连带着这些记忆。', + '但既然又回到了这个地方,走到了这一步,还是让我告诉你一件真正重要的事情吧。', + '她在最后给你留下了一封信,虽然从未真正“看过”,但我却一直保存着。', + '打开它吧,然后做出选择。' ] } ], - "items": { - "wine": { - "texts": [ - "你们点了一瓶质量并不高的红酒,那时的你并不知道她和你一样,都不怎么喝酒。", - "对酒精比较敏感的你们小酌稍许,便打开了话匣子。", - "你说:“现在的业界都是什么垃圾游戏”。", - "她说:“是啊,一直这么搞下去,不知道什么时候才能出来精彩的作品。”", - "你说:“对,像极乐迪斯科、Gorogoa那样精彩的作品!”", - "她说:“哈哈,我也很喜欢这两部,遇到同好了。”" + items: { + wine: { + texts: [ + '你们点了一瓶质量并不高的红酒,那时的你并不知道她和你一样,都不怎么喝酒。', + '对酒精比较敏感的你们小酌稍许,便打开了话匣子。', + '你说:“现在的业界都是什么垃圾游戏”。', + '她说:“是啊,一直这么搞下去,不知道什么时候才能出来精彩的作品。”', + '你说:“对,像极乐迪斯科、Gorogoa那样精彩的作品!”', + '她说:“哈哈,我也很喜欢这两部,遇到同好了。”' ] }, - "vending": { - "texts": [ - "“这么巧?”你远远就望见了她,假装偶遇漫不经心搭起了话。", - "“啊是你,我就猜你也会来。”她转过了头,甜甜得笑着。", - "你说:“嗯,这次活动来了不少独立开发者,扩展一下交际圈。”", - "她停顿了下,拿出了手机:“我也是这么想的...嗯,这么巧,不如加个微信?”", - "你看着她,故作体面,缓缓拿出了手机:“好,有什么好作品可以互相交流。”", - "她说:“对哦,正好有个双人游戏一直找不到人打,你有兴趣嘛?”" + vending: { + texts: [ + '“这么巧?”你远远就望见了她,假装偶遇漫不经心搭起了话。', + '“啊是你,我就猜你也会来。”她转过了头,甜甜得笑着。', + '你说:“嗯,这次活动来了不少独立开发者,扩展一下交际圈。”', + '她停顿了下,拿出了手机:“我也是这么想的...嗯,这么巧,不如加个微信?”', + '你看着她,故作体面,缓缓拿出了手机:“好,有什么好作品可以互相交流。”', + '她说:“对哦,正好有个双人游戏一直找不到人打,你有兴趣嘛?”' ] }, - "corner": { - "texts": [ - "你走到了角落,默默看着她,一言不发。", - "她用余光瞥了你一眼,你能够看到她的眼角还有泪花。", - "你说:“我...我还是觉得我想的没错,你太激动了,这事肯定还有办法。”", - "她低着头,小声:“你,还是这个样子,真是一点都没变。”", - "你不解,仿佛还有点自豪:“我当然不会改变,这是我的特质,改变了就不是我了。”", - "她说:“唉...是啊,你是不会改变的,我知道的。”", - "接着她站了起来,给了你一个拥抱,你很错愕,杵在原地不知如何是好。", - "“我...”还没等你说完,她便松开了你,转身快步离去。", - "从此,你再也没有找到过她。" + corner: { + texts: [ + '你走到了角落,默默看着她,一言不发。', + '她用余光瞥了你一眼,你能够看到她的眼角还有泪花。', + '你说:“我...我还是觉得我想的没错,你太激动了,这事肯定还有办法。”', + '她低着头,小声:“你,还是这个样子,真是一点都没变。”', + '你不解,仿佛还有点自豪:“我当然不会改变,这是我的特质,改变了就不是我了。”', + '她说:“唉...是啊,你是不会改变的,我知道的。”', + '接着她站了起来,给了你一个拥抱,你很错愕,杵在原地不知如何是好。', + '“我...”还没等你说完,她便松开了你,转身快步离去。', + '从此,你再也没有找到过她。' ] }, - "sofa": { - "texts": [ - "虽然已经过去了许久,但你还是一眼就认出了她。", - "同样她也一眼就认出了你,在互相错愕的神情中,你们相视无言。", - "“好...好久不见”这次仍然是她先主动开的口。", - "你忽然有一种感觉,想说什么,却下意识克制住了:“确实...好久不见。”", - "再也没有对话,再也没有交流,活动就这么过去了。", - "只是在结束之后,她似乎递过来了什么东西,你好像收了,又好像没收。", - "然后,你就被困住了。" + sofa: { + texts: [ + '虽然已经过去了许久,但你还是一眼就认出了她。', + '同样她也一眼就认出了你,在互相错愕的神情中,你们相视无言。', + '“好...好久不见”这次仍然是她先主动开的口。', + '你忽然有一种感觉,想说什么,却下意识克制住了:“确实...好久不见。”', + '再也没有对话,再也没有交流,活动就这么过去了。', + '只是在结束之后,她似乎递过来了什么东西,你好像收了,又好像没收。', + '然后,你就被困住了。' ] } }, - "chars": { - "xinyi": { - "name": "路人Z?", - "texts": [ - "这两人聊得还挺投机的,说不定有戏。", - "就是这小子,最后扭扭捏捏的,真不像话。", - "年轻人,试一试有什么大不了的,连个微信都不敢加,呸!", - "哪怕再勇敢一点点...这事八成不就成了吗?" + chars: { + xinyi: { + name: '路人Z?', + texts: [ + '这两人聊得还挺投机的,说不定有戏。', + '就是这小子,最后扭扭捏捏的,真不像话。', + '年轻人,试一试有什么大不了的,连个微信都不敢加,呸!', + '哪怕再勇敢一点点...这事八成不就成了吗?' ] }, - "roam": { - "name": "路人Y?", - "texts": [ - "怯懦,退缩,故作体面。", - "现在的小伙子,都不如女孩子勇敢。", - "要是这时候开始改变心态,不被牵着走,多付出些努力。", - "也不会是后来的下场吧?" + roam: { + name: '路人Y?', + texts: [ + '怯懦,退缩,故作体面。', + '现在的小伙子,都不如女孩子勇敢。', + '要是这时候开始改变心态,不被牵着走,多付出些努力。', + '也不会是后来的下场吧?' ] }, - "hikari": { - "name": "路人H?", - "texts": [ - "以“永远不会改变”为傲的少年。", - "以“不为任何人妥协”为荣的少年。", - "不知伤害为何物的少年。", - "不知妥协为何物的少年。", - "现在的你,是怎么想的呢?" + hikari: { + name: '路人H?', + texts: [ + '以“永远不会改变”为傲的少年。', + '以“不为任何人妥协”为荣的少年。', + '不知伤害为何物的少年。', + '不知妥协为何物的少年。', + '现在的你,是怎么想的呢?' ] }, - "final": { - "name": "你的影子们", - "texts": [ - "相识时,被动。", - "相知时,被动。", - "相离时,被动。", - "用“理想”掩饰“怠惰”。", - "以“桀骜”定义“崇高”。", - "将“鲁莽”命名为“真诚”。", - "脆弱的我,懦弱的我,怯懦的我。", - "如果真的勇敢一些,会不会更好呢?" + final: { + name: '你的影子们', + texts: [ + '相识时,被动。', + '相知时,被动。', + '相离时,被动。', + '用“理想”掩饰“怠惰”。', + '以“桀骜”定义“崇高”。', + '将“鲁莽”命名为“真诚”。', + '脆弱的我,懦弱的我,怯懦的我。', + '如果真的勇敢一些,会不会更好呢?' ] } }, - "letter": { - "texts": [ - "不知道你会不会打开这封信,按照你的性格,大概是不会吧。", - "毕竟,我最了解你了,你会觉得很麻烦嘛,逃避麻烦,也是你“不变”的一部分。", - "但即便如此,我还是写了这封信,之所以如此,是因为——", - "我恨你,非常得恨,因为我倾尽了所有勇气对你好,却没有任何用。", - "你一直都是那个样子,从未变过,你不懂得什么是包容,不懂得什么是妥协。", - "你将其命名为“真诚”,哪怕明知会伤害我,却将其称为“必要的代价”。", - "什么代价啊?这么爱你的人,却要被你当做代价,你真的有人的心吗?", - "......", - "虽然想骂更多,但边看着你边写的我,却也只能到此为止了。", - "毕竟你现在样子,和那时候已经完全不同了。", - "你看起来更“友善随和”了,但可能只有我知道这对于你而言是多么得艰难。", - "所以虽然别人看起来你成为了一个更好的人,但我却觉得有些可悲。", - "你失去了原先那种鲁莽的勇气,却没有找到更为坚定的勇气。", - "你到底在畏惧什么呢?到底...在害怕什么呢?畏惧改变,畏惧失去自我吗?", - "你想一直活在悬浮于空的象牙塔上,畏惧在真正的大地上生根,那样会让你失去自由,所以你必须永不认错,一直桀骜——本应是如此。", - "但你刚才的眼神,你这个人啊,永远都需要有人主动拉一把才会去做选择。", - "那么,这次你的选择到底是什么?" + letter: { + texts: [ + '不知道你会不会打开这封信,按照你的性格,大概是不会吧。', + '毕竟,我最了解你了,你会觉得很麻烦嘛,逃避麻烦,也是你“不变”的一部分。', + '但即便如此,我还是写了这封信,之所以如此,是因为——', + '我恨你,非常得恨,因为我倾尽了所有勇气对你好,却没有任何用。', + '你一直都是那个样子,从未变过,你不懂得什么是包容,不懂得什么是妥协。', + '你将其命名为“真诚”,哪怕明知会伤害我,却将其称为“必要的代价”。', + '什么代价啊?这么爱你的人,却要被你当做代价,你真的有人的心吗?', + '......', + '虽然想骂更多,但边看着你边写的我,却也只能到此为止了。', + '毕竟你现在样子,和那时候已经完全不同了。', + '你看起来更“友善随和”了,但可能只有我知道这对于你而言是多么得艰难。', + '所以虽然别人看起来你成为了一个更好的人,但我却觉得有些可悲。', + '你失去了原先那种鲁莽的勇气,却没有找到更为坚定的勇气。', + '你到底在畏惧什么呢?到底...在害怕什么呢?畏惧改变,畏惧失去自我吗?', + '你想一直活在悬浮于空的象牙塔上,畏惧在真正的大地上生根,那样会让你失去自由,所以你必须永不认错,一直桀骜——本应是如此。', + '但你刚才的眼神,你这个人啊,永远都需要有人主动拉一把才会去做选择。', + '那么,这次你的选择到底是什么?' ] } -} \ No newline at end of file +} diff --git a/miniprogram/packageXRFrame/components/xr-beside-edge/index.js b/miniprogram/packageXRFrame/components/xr-beside-edge/index.js index b2992e9d..3f9d5147 100644 --- a/miniprogram/packageXRFrame/components/xr-beside-edge/index.js +++ b/miniprogram/packageXRFrame/components/xr-beside-edge/index.js @@ -1,25 +1,25 @@ -const info = wx.getSystemInfoSync(); -const dpi = info.pixelRatio; -const width = info.windowWidth * dpi; -const height = info.windowHeight * dpi; +import CONFIG from './config.js' -import CONFIG from './config.js'; +const info = wx.getSystemInfoSync() +const dpi = info.pixelRatio +const width = info.windowWidth * dpi +const height = info.windowHeight * dpi const ROOT_DURATIONS = [ 3000, 4500, 6000, Infinity -]; +] const ROOT_DELAYS = [ 2000, 1500, 1000, 0 -]; +] const ROOT_AMBIENTS = [ 0.05, 0.15, 0.4, 1 -]; +] const ROOT_BLURS = [ 32, 32, 16, 0 -]; +] const REAL_BLURS = [ 0, 32, 48, 96 -]; +] function showFinalChoose(content, callback) { wx.showModal({ @@ -30,19 +30,19 @@ function showFinalChoose(content, callback) { cancelText: '我不要!', success: (res) => { if (res.cancel) { - showFinalChoose('不能逃避!', callback); + showFinalChoose('不能逃避!', callback) } else { - callback(); + callback() setTimeout(() => { wx.showToast({ title: '勇敢一些\n不要怯懦', duration: 5000, icon: 'none' }) - }, 500); + }, 500) } } - }); + }) } Component({ @@ -53,26 +53,26 @@ Component({ value: '', observer(fromWhat, old) { if (fromWhat === 'item') { - this.remainItems -= 1; + this.remainItems -= 1 if (this.remainItems === 0) { - this.disable3DTouch = false; - this.setData({subStep: true}); - return; + this.disable3DTouch = false + this.setData({ subStep: true }) + return } - this.switchSide(false); - this.triggerEvent('requireLight', {state: 'idle'}); - return; + this.switchSide(false) + this.triggerEvent('requireLight', { state: 'idle' }) + return } if (fromWhat === 'char') { - const {texts} = this.config.steps[this.data.step]; - this.requireDialog({texts, from: 'step'}); - return; + const { texts } = this.config.steps[this.data.step] + this.requireDialog({ texts, from: 'step' }) + return } if (fromWhat === 'step' || fromWhat === 'intro') { - const step = this.data.step + 1; + const step = this.data.step + 1 if (step === 4) { wx.showModal({ title: '最后的信', @@ -80,29 +80,29 @@ Component({ showCancel: false, confirmText: '做出选择', complete: () => { - showFinalChoose('', () => this.switchSide(false, 0)); + showFinalChoose('', () => this.switchSide(false, 0)) } - }); - return; + }) + return } if (step === 3) { - this.bgm.stop(); - this.bgm2.play(); + this.bgm.stop() + this.bgm2.play() } - this.remainItems = this.config.steps[step].itemCount; - this.setData({step, subStep: false, ambient: ROOT_AMBIENTS[step]}); - this.switchSide(false); - this.triggerEvent('requireLight', {state: 'idle'}); - return; + this.remainItems = this.config.steps[step].itemCount + this.setData({ step, subStep: false, ambient: ROOT_AMBIENTS[step] }) + this.switchSide(false) + this.triggerEvent('requireLight', { state: 'idle' }) + return } if (fromWhat === 'light') { - this.switchSide(true); - this.disable3DTouch = false; - this.lightDuration = ROOT_DURATIONS[this.data.step]; - this.lightDelay = ROOT_DELAYS[this.data.step]; + this.switchSide(true) + this.disable3DTouch = false + this.lightDuration = ROOT_DURATIONS[this.data.step] + this.lightDelay = ROOT_DELAYS[this.data.step] } } } @@ -111,148 +111,148 @@ Component({ step: -1, subStep: false, ambient: 0, - width: width, - height: height, + width, + height, loaded: false, arReady: false }, lifetimes: { detached() { - this.bgm.stop(); - this.bgm2.stop(); - wx.setKeepScreenOn({keepScreenOn: false}); + this.bgm.stop() + this.bgm2.stop() + wx.setKeepScreenOn({ keepScreenOn: false }) } }, methods: { - handleReady({detail}) { - this.scene = detail.value; - this.scene.event.add('tick', this.handleTick.bind(this)); - this.inited = false; - this.disable3DTouch = false; - this.remainItems = 0; - this.lightDuration = 0; - this.lightDelay = 0; - this.bgm = wx.createInnerAudioContext({}); - this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/beside-edge/bgm1.mp3'; - this.bgm.loop = true; - this.bgm2 = wx.createInnerAudioContext({}); - this.bgm2.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/beside-edge/bgm2.mp3'; - this.bgm2.loop = true; + handleReady({ detail }) { + this.scene = detail.value + this.scene.event.add('tick', this.handleTick.bind(this)) + this.inited = false + this.disable3DTouch = false + this.remainItems = 0 + this.lightDuration = 0 + this.lightDelay = 0 + this.bgm = wx.createInnerAudioContext({}) + this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/beside-edge/bgm1.mp3' + this.bgm.loop = true + this.bgm2 = wx.createInnerAudioContext({}) + this.bgm2.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/beside-edge/bgm2.mp3' + this.bgm2.loop = true }, handleARReady() { - wx.setKeepScreenOn({keepScreenOn: true}); - this.setData({arReady: true}); + wx.setKeepScreenOn({ keepScreenOn: true }) + this.setData({ arReady: true }) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.config = CONFIG; - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.config = CONFIG + this.setData({ loaded: true }) }, handleTick(dt) { - const mainCamera = this.scene.getNodeById('main-camera'); - const light = this.scene.getNodeById('light'); + const mainCamera = this.scene.getNodeById('main-camera') + const light = this.scene.getNodeById('light') if (mainCamera && light) { - light.position.set(mainCamera.position); - light.rotation.set(mainCamera.rotation); - light.rotation.x = Math.PI - light.rotation.x; - light.rotation.y += Math.PI; + light.position.set(mainCamera.position) + light.rotation.set(mainCamera.rotation) + light.rotation.x = Math.PI - light.rotation.x + light.rotation.y += Math.PI } if (this.inited) { - const nextDuration = Math.max(this.lightDuration - dt, 0); + const nextDuration = Math.max(this.lightDuration - dt, 0) if (this.lightDuration > 0 && nextDuration === 0) { - this.disable3DTouch = true; - this.switchSide(false); - this.triggerEvent('requireLight', {state: 'cd', wait: 1}); + this.disable3DTouch = true + this.switchSide(false) + this.triggerEvent('requireLight', { state: 'cd', wait: 1 }) } else if (this.lightDuration === 0) { - const nextDelay = Math.max(this.lightDelay - dt, 0); + const nextDelay = Math.max(this.lightDelay - dt, 0) if (this.lightDelay > 0 && nextDelay === 0) { - this.triggerEvent('requireLight', {state: 'idle'}); + this.triggerEvent('requireLight', { state: 'idle' }) } else if (this.lightDelay > 0) { - this.triggerEvent('requireLight', {state: 'cd', wait: nextDelay / ROOT_DELAYS[this.data.step]}); + this.triggerEvent('requireLight', { state: 'cd', wait: nextDelay / ROOT_DELAYS[this.data.step] }) } - this.lightDelay = nextDelay; + this.lightDelay = nextDelay } - this.lightDuration = nextDuration; - return; + this.lightDuration = nextDuration + return } if (!this.data.arReady || !this.data.loaded) { - return; + return } - const setItem = this.scene.getNodeById('setitem'); - setItem.position.set(mainCamera.position); - setItem.position.y = 1; - this.inited = true; + const setItem = this.scene.getNodeById('setitem') + setItem.position.set(mainCamera.position) + setItem.position.y = 1 + this.inited = true setTimeout(() => { - this.switchSide(true, ROOT_BLURS[0]); - const {texts} = this.config.intro; - this.requireDialog({texts, from: 'intro'}); - this.bgm.play(); - }, 1000); + this.switchSide(true, ROOT_BLURS[0]) + const { texts } = this.config.intro + this.requireDialog({ texts, from: 'intro' }) + this.bgm.play() + }, 1000) }, switchSide(virtual, blur) { - const setItem = this.scene.getNodeById('setitem'); - setItem.visible = virtual; - const blurAsset = this.scene.assets.getAsset('post-process', 'blur'); + const setItem = this.scene.getNodeById('setitem') + setItem.visible = virtual + const blurAsset = this.scene.assets.getAsset('post-process', 'blur') if (virtual) { - blurAsset.data.radius = blur === undefined ? ROOT_BLURS[this.data.step] : blur; - this.triggerEvent('requireLight', {state: 'hide'}); + blurAsset.data.radius = blur === undefined ? ROOT_BLURS[this.data.step] : blur + this.triggerEvent('requireLight', { state: 'hide' }) } else { - blurAsset.data.radius = blur === undefined ? REAL_BLURS[this.data.step] : blur; + blurAsset.data.radius = blur === undefined ? REAL_BLURS[this.data.step] : blur } }, handleResume() { if (this.inited) { - this.data.step === 3 ? this.bgm2.play() : this.bgm2.play(); + this.data.step === 3 ? this.bgm2.play() : this.bgm2.play() } }, - handleTouchObj({detail}) { + handleTouchObj({ detail }) { if (!this.inDistance(detail)) { - return; + return } - const id = detail.value.target.id; - const {texts} = this.config.items[id]; + const id = detail.value.target.id + const { texts } = this.config.items[id] - this.requireDialog({texts, from: 'item'}); + this.requireDialog({ texts, from: 'item' }) }, - handleTouchChar({detail}) { + handleTouchChar({ detail }) { if (!this.inDistance(detail)) { - return; + return } - const id = this.data.step === 3 ? 'final' : detail.value.target.id; - const {name, texts} = this.config.chars[id]; - this.requireDialog({name, texts, from: 'char'}); + const id = this.data.step === 3 ? 'final' : detail.value.target.id + const { name, texts } = this.config.chars[id] + this.requireDialog({ name, texts, from: 'char' }) }, requireDialog(info) { - this.disable3DTouch = true; - this.lightDuration = Infinity; - this.triggerEvent('requireLight', {state: 'hide'}); - info.name = info.name || '某个声音'; - this.triggerEvent('requireDialog', info); + this.disable3DTouch = true + this.lightDuration = Infinity + this.triggerEvent('requireLight', { state: 'hide' }) + info.name = info.name || '某个声音' + this.triggerEvent('requireDialog', info) }, inDistance(detail) { if (detail.value.camera.el.id !== 'main-camera') { - return false; + return false } if (this.disable3DTouch) { - return false; + return false } - const xrSystem = wx.getXrFrameSystem(); - const {camera, target} = detail.value; - const camTrs = camera.el.getComponent(xrSystem.Transform); - const targetTrs = target.getComponent(xrSystem.Transform); - const diff = camTrs.worldPosition.sub(targetTrs.worldPosition); + const xrSystem = wx.getXrFrameSystem() + const { camera, target } = detail.value + const camTrs = camera.el.getComponent(xrSystem.Transform) + const targetTrs = target.getComponent(xrSystem.Transform) + const diff = camTrs.worldPosition.sub(targetTrs.worldPosition) - return Math.sqrt(diff.x * diff.x + diff.z * diff.z) < 3; + return Math.sqrt(diff.x * diff.x + diff.z * diff.z) < 3 } } }) diff --git a/miniprogram/packageXRFrame/components/xr-classic-face/index.js b/miniprogram/packageXRFrame/components/xr-classic-face/index.js index ca8273e3..842b241c 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-face/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-face/index.js @@ -5,30 +5,30 @@ Component({ arReady: false, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - xrScene.event.add('tick', this.handleTick.bind(this)); - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + xrScene.event.add('tick', this.handleTick.bind(this)) + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARReady: function ({detail}) { - console.log('arReady'); - this.setData({arReady: true}); + handleARReady({ detail }) { + console.log('arReady') + this.setData({ arReady: true }) }, - handleTick: function () { - const xrSystem = wx.getXrFrameSystem(); - const trackerEl = this.scene.getElementById('tracker'); + handleTick() { + const xrSystem = wx.getXrFrameSystem() + const trackerEl = this.scene.getElementById('tracker') if (!trackerEl) { - return; + return } - const tracker = trackerEl.getComponent(xrSystem.ARTracker); + const tracker = trackerEl.getComponent(xrSystem.ARTracker) if (!tracker.arActive) { return } @@ -38,8 +38,7 @@ Component({ // 视情况需要自己同步`tracker`的`scale`和`rotation`特定节点。 // 第一个参数是特征点编好,第二个是可选的复用结果,第三个是可选的是否相对于`ARTracker`。 // 为`false`为世界空间的位置,需要配合`scale`自己使用 - const position = tracker.getPosition(98, new xrSystem.Vector3(), false); - + const position = tracker.getPosition(98, new xrSystem.Vector3(), false) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-classic-osd/index.js b/miniprogram/packageXRFrame/components/xr-classic-osd/index.js index ae3405ae..e65c8c72 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-osd/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-osd/index.js @@ -14,53 +14,52 @@ Component({ }, lifetimes: { async attached() { - console.log('data', this.data); + console.log('data', this.data) } }, methods: { handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleToySwitch: function ({detail}) { - const active = detail.value; + handleToySwitch({ detail }) { + const active = detail.value if (active) { - this.setData({toyReady: true}); + this.setData({ toyReady: true }) } else { - this.setData({toyReady: false}); + this.setData({ toyReady: false }) } }, - handleDaySwitch: function ({detail}) { - const active = detail.value; + handleDaySwitch({ detail }) { + const active = detail.value if (active) { - this.setData({gzDayReady: true}); + this.setData({ gzDayReady: true }) } else { - this.setData({gzDayReady: false}); + this.setData({ gzDayReady: false }) } }, - handleNightSwitch: function ({detail}) { - const active = detail.value; + handleNightSwitch({ detail }) { + const active = detail.value if (active) { - this.setData({gzNightReady: true}); + this.setData({ gzNightReady: true }) } else { - this.setData({gzNightReady: false}); + this.setData({ gzNightReady: false }) } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-classic-perspect/index.js b/miniprogram/packageXRFrame/components/xr-classic-perspect/index.js index 2b29185d..e95b362d 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-perspect/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-perspect/index.js @@ -8,31 +8,29 @@ Component({ }, lifetimes: { async attached() { - console.log('data', this.data); + console.log('data', this.data) } }, methods: { handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - - + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-classic-portal/index.js b/miniprogram/packageXRFrame/components/xr-classic-portal/index.js index 19dba3e9..7b65e435 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-portal/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-portal/index.js @@ -8,108 +8,108 @@ Component({ }, lifetimes: { detached() { - wx.setKeepScreenOn({keepScreenOn: false}); + wx.setKeepScreenOn({ keepScreenOn: false }) } }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.inRealWorld = true; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.inRealWorld = true + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); - wx.showToast({title: '点击屏幕放置'}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) + wx.showToast({ title: '点击屏幕放置' }) }, handleTick() { if (!this.placed) { - return; + return } - const xrSystem = wx.getXrFrameSystem(); - const mainCamEl = this.scene.getElementById('main-camera'); - const magicCamEl = this.scene.getElementById('magic-camera'); - const mainTrs = mainCamEl.getComponent(xrSystem.Transform); - const door = this.scene.getElementById('door').getComponent(xrSystem.Transform); + const xrSystem = wx.getXrFrameSystem() + const mainCamEl = this.scene.getElementById('main-camera') + const magicCamEl = this.scene.getElementById('magic-camera') + const mainTrs = mainCamEl.getComponent(xrSystem.Transform) + const door = this.scene.getElementById('door').getComponent(xrSystem.Transform) - let forward = door.worldForward; - forward = xrSystem.Vector2.createFromNumber(forward.x, forward.z); - let diff = mainTrs.worldPosition.sub(door.worldPosition); - diff = xrSystem.Vector2.createFromNumber(diff.x, diff.z); - const preDiff = this.diff || diff; - this.diff = diff; + let forward = door.worldForward + forward = xrSystem.Vector2.createFromNumber(forward.x, forward.z) + let diff = mainTrs.worldPosition.sub(door.worldPosition) + diff = xrSystem.Vector2.createFromNumber(diff.x, diff.z) + const preDiff = this.diff || diff + this.diff = diff - const dis = diff.length(); - const preDis = preDiff.length(); - const dir = forward.dot(diff); + const dis = diff.length() + const preDis = preDiff.length() + const dir = forward.dot(diff) - //@todo: 等待物理加上碰撞检测,替换 + // @todo: 等待物理加上碰撞检测,替换 if (preDis <= 0.2 || dis > 0.2) { - return; + return } if (this.inRealWorld && dir >= 0) { - return; + return } if (!this.inRealWorld && dir <= 0) { - return; + return } - const mainCam = mainCamEl.getComponent(xrSystem.Camera); - const magicCam = magicCamEl.getComponent(xrSystem.Camera); - const doorMesh = this.scene.getElementById('door-mesh').getComponent(xrSystem.Mesh); - const sceneMesh = this.scene.getElementById('scene-mesh').getComponent(xrSystem.GLTF); + const mainCam = mainCamEl.getComponent(xrSystem.Camera) + const magicCam = magicCamEl.getComponent(xrSystem.Camera) + const doorMesh = this.scene.getElementById('door-mesh').getComponent(xrSystem.Mesh) + const sceneMesh = this.scene.getElementById('scene-mesh').getComponent(xrSystem.GLTF) if (!this.inRealWorld) { // 现实世界 // mainCam: ar -> stencil -> scene // magicCam: nothing - this.inRealWorld = true; - mainCam.setData({background: 'ar'}); - magicCam.setData({background: 'default'}); - magicCam.setData({isClearDepth: false}); - magicCam.clearBackgroundRenderStates(); - doorMesh.material.renderQueue = 1; - doorMesh.material.setRenderState('cullFace', 2); - sceneMesh.meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 3)); + this.inRealWorld = true + mainCam.setData({ background: 'ar' }) + magicCam.setData({ background: 'default' }) + magicCam.setData({ isClearDepth: false }) + magicCam.clearBackgroundRenderStates() + doorMesh.material.renderQueue = 1 + doorMesh.material.setRenderState('cullFace', 2) + sceneMesh.meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 3)) } else { // 虚拟世界 // mainCam: scene -> stencil // magicCam: ar - this.inRealWorld = false; - mainCam.setData({background: 'default'}); - magicCam.setData({background: 'ar'}); - magicCam.setData({isClearDepth: true}); + this.inRealWorld = false + mainCam.setData({ background: 'default' }) + magicCam.setData({ background: 'ar' }) + magicCam.setData({ isClearDepth: true }) magicCam.setBackgroundRenderStates({ stencilComp: 3, stencilRef: 1, stencilReadMask: 1 - }); - doorMesh.material.renderQueue = 9999; - doorMesh.material.setRenderState('cullFace', 1); - sceneMesh.meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 0)); + }) + doorMesh.material.renderQueue = 9999 + doorMesh.material.setRenderState('cullFace', 1) + sceneMesh.meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 0)) } }, placeNode(event) { - const {clientX, clientY} = event.touches[0]; - const {frameWidth: width, frameHeight: height} = this.scene; + const { clientX, clientY } = event.touches[0] + const { frameWidth: width, frameHeight: height } = this.scene if (clientY / height > 0.8 && clientX / width > 0.8) { - this.scene.getNodeById('setitem').visible = false; - this.scene.ar.resetPlane(); - this.scene.event.addOnce('touchstart', this.placeNode.bind(this)); + this.scene.getNodeById('setitem').visible = false + this.scene.ar.resetPlane() + this.scene.event.addOnce('touchstart', this.placeNode.bind(this)) } else { - this.scene.ar.placeHere('setitem', true); - this.scene.getElementById('anchor').getComponent(wx.getXrFrameSystem().Transform).setData({visible: false}); - this.placed = true; - wx.setKeepScreenOn({keepScreenOn: true}); + this.scene.ar.placeHere('setitem', true) + this.scene.getElementById('anchor').getComponent(wx.getXrFrameSystem().Transform).setData({ visible: false }) + this.placed = true + wx.setKeepScreenOn({ keepScreenOn: true }) } }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-classic-video/index.js b/miniprogram/packageXRFrame/components/xr-classic-video/index.js index adbc6d51..af98147f 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-video/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-video/index.js @@ -7,32 +7,32 @@ Component({ }, lifetimes: { async attached() { - console.log('data', this.data); + console.log('data', this.data) } }, methods: { - handleReady: function ({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleTrackerSwitch: function ({detail}) { - const active = detail.value; - console.log('handleTrackerSwitch', detail); - const video = this.scene.assets.getAsset('video-texture', 'hikari'); + handleTrackerSwitch({ detail }) { + const active = detail.value + console.log('handleTrackerSwitch', detail) + const video = this.scene.assets.getAsset('video-texture', 'hikari') if (active) { - video.play(); + video.play() } else { - video.stop(); + video.stop() } } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-classic-wxball/index.js b/miniprogram/packageXRFrame/components/xr-classic-wxball/index.js index 49a689f6..ca3e5be5 100644 --- a/miniprogram/packageXRFrame/components/xr-classic-wxball/index.js +++ b/miniprogram/packageXRFrame/components/xr-classic-wxball/index.js @@ -12,77 +12,73 @@ Component({ }, lifetimes: { async attached() { - console.log('data', this.data); + console.log('data', this.data) } }, methods: { handleReady({ detail }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) - const xrFrameSystem = wx.getXrFrameSystem(); - - this.wxball = xrScene.getElementById('wxball'); - - this.wxballTransform = this.wxball.getComponent(xrFrameSystem.Transform); - this.wxballTransform.visible = false; + const xrFrameSystem = wx.getXrFrameSystem() + this.wxball = xrScene.getElementById('wxball') + this.wxballTransform = this.wxball.getComponent(xrFrameSystem.Transform) + this.wxballTransform.visible = false }, - handleAssetsProgress: function ({ + handleAssetsProgress({ detail }) { - console.log('assets progress', detail.value); + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function ({ + handleAssetsLoaded({ detail }) { - console.log('assets loaded', detail.value); + console.log('assets loaded', detail.value) this.setData({ loaded: true - }); + }) }, - handleGltfLoaded: function() { - const xrScene = this.scene; + handleGltfLoaded() { + const xrScene = this.scene + + const xrFrameSystem = wx.getXrFrameSystem() - const xrFrameSystem = wx.getXrFrameSystem(); - - this.wxball = xrScene.getElementById('wxball'); + this.wxball = xrScene.getElementById('wxball') - this.wxballAnimator = this.wxball.getComponent(xrFrameSystem.Animator); + this.wxballAnimator = this.wxball.getComponent(xrFrameSystem.Animator) this.wxballAnimator.play('gltfAnimation', { loop: 0, - }); + }) this.wxballAnimator.play('gltfAnimation#0', { loop: 0, - }); + }) - this.wxballAnimator.pauseToFrame('gltfAnimation', 1); - this.wxballAnimator.pauseToFrame('gltfAnimation#0', 1); - - this.wxballTransform.visible = true; + this.wxballAnimator.pauseToFrame('gltfAnimation', 1) + this.wxballAnimator.pauseToFrame('gltfAnimation#0', 1) + this.wxballTransform.visible = true }, - handleTouchWXball: function() { - + handleTouchWXball() { if (!this.animationRuning) { - console.log('WXBALL TOUCH'); + console.log('WXBALL TOUCH') + + this.animationRuning = true - this.animationRuning = true; + this.wxballAnimator.pauseToFrame('gltfAnimation', 1) + this.wxballAnimator.pauseToFrame('gltfAnimation#0', 1) - this.wxballAnimator.pauseToFrame('gltfAnimation', 1); - this.wxballAnimator.pauseToFrame('gltfAnimation#0', 1); - - this.wxballAnimator.resume('gltfAnimation'); - this.wxballAnimator.resume('gltfAnimation#0'); + this.wxballAnimator.resume('gltfAnimation') + this.wxballAnimator.resume('gltfAnimation#0') } }, - handleAnimationStop: function() { - console.log('animation Stop'); + handleAnimationStop() { + console.log('animation Stop') } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-custom-logic/index.js b/miniprogram/packageXRFrame/components/xr-custom-logic/index.js index eda3b7e8..7e430560 100644 --- a/miniprogram/packageXRFrame/components/xr-custom-logic/index.js +++ b/miniprogram/packageXRFrame/components/xr-custom-logic/index.js @@ -6,47 +6,47 @@ Component({ }, lifetimes: {}, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - this.rotSpeed = 1; - this.rotAxis = 0; + handleReady({ detail }) { + this.scene = detail.value + this.rotSpeed = 1 + this.rotAxis = 0 }, - handleTouchStart: function({detail}) { - console.log('touch start', detail.value); + handleTouchStart({ detail }) { + console.log('touch start', detail.value) }, - handleTouchEnd: function({detail}) { - console.log('touch end', detail.value); - this.rotAxis += 1; + handleTouchEnd({ detail }) { + console.log('touch end', detail.value) + this.rotAxis += 1 if (this.rotAxis >= 3) { - this.rotAxis = 0; + this.rotAxis = 0 } - this.changeSpeed(); + this.changeSpeed() }, - handleDrag: function({detail}) { - const info = detail.value; - console.log('drag', info); - this.rotSpeed += info.deltaX / this.scene.width; - this.changeSpeed(); + handleDrag({ detail }) { + const info = detail.value + console.log('drag', info) + this.rotSpeed += info.deltaX / this.scene.width + this.changeSpeed() }, changeSpeed() { - const xrSystem = wx.getXrFrameSystem(); - const el = this.scene.getElementById('artg'); - const comp = el.getComponent('auto-rotate'); - + const xrSystem = wx.getXrFrameSystem() + const el = this.scene.getElementById('artg') + const comp = el.getComponent('auto-rotate') + if (comp) { - comp.setData({speed: [0, 0, 0].map((_, i) => i === this.rotAxis ? this.rotSpeed : 0)}); + comp.setData({ speed: [0, 0, 0].map((_, i) => (i === this.rotAxis ? this.rotSpeed : 0)) }) } }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleLog: function({detail}) { - console.log('log', detail.value); + handleLog({ detail }) { + console.log('log', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-custom-render/index.js b/miniprogram/packageXRFrame/components/xr-custom-render/index.js index 0a263505..e73d8e3f 100644 --- a/miniprogram/packageXRFrame/components/xr-custom-render/index.js +++ b/miniprogram/packageXRFrame/components/xr-custom-render/index.js @@ -6,34 +6,32 @@ Component({ }, lifetimes: {}, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - const stars = new Array(44).fill(0).map(() => { - return { - pos: [ - (Math.random() * 2 - 1) * 4, - (Math.random() * 2 - 1) * 4, - (Math.random() * 2 - 1) * 4, - ].join(' '), - color: [ - Math.random(), - Math.random(), - Math.random(), - 1 - ].join(' '), - speed: (Math.random() + 0.2) * 3 - }; - }); + handleReady({ detail }) { + this.scene = detail.value + const stars = new Array(44).fill(0).map(() => ({ + pos: [ + (Math.random() * 2 - 1) * 4, + (Math.random() * 2 - 1) * 4, + (Math.random() * 2 - 1) * 4, + ].join(' '), + color: [ + Math.random(), + Math.random(), + Math.random(), + 1 + ].join(' '), + speed: (Math.random() + 0.2) * 3 + })) console.log(stars) - this.setData({stars}); + this.setData({ stars }) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-custom-render/index.wxml b/miniprogram/packageXRFrame/components/xr-custom-render/index.wxml index 8d540ec0..f749e422 100644 --- a/miniprogram/packageXRFrame/components/xr-custom-render/index.wxml +++ b/miniprogram/packageXRFrame/components/xr-custom-render/index.wxml @@ -15,7 +15,7 @@ > - + \ No newline at end of file diff --git a/miniprogram/packageXRFrame/components/xr-customParticle-firework/index.js b/miniprogram/packageXRFrame/components/xr-customParticle-firework/index.js index 67bc5fb6..c3e564ba 100644 --- a/miniprogram/packageXRFrame/components/xr-customParticle-firework/index.js +++ b/miniprogram/packageXRFrame/components/xr-customParticle-firework/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,47 +19,46 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() - - const fireworkField = xrScene.getElementById("firework"); - const tempSystem = fireworkField.getComponent('custom-particle') - tempSystem.addSizeGradient(0,0.2); - tempSystem.addSizeGradient(3,0.5); - - var myData ={} - myData = { - "capacity": 200, - "emitRate": 0, //子发射器不进行每秒发射 - "burstCount": 200, // 一次爆发200粒子 - "burstTime": 0, // 爆发延时为0 - "burstCycle": 1, // 发射一次 - "size":[0.05], - "startColor":[1,1,0,1], - "endColor":[1,0,0,0], - "emitterType":"SphereShape", - "emitterProps": [["radius","0.8"]], - "lifeTime":[3], // 粒子生命周期为3秒 - "stopDuration":[3], // 子发射器生命周期为3秒 - "speed":[1], - "texture":"flarePicture" - } - - var subEmitter = tempSystem.createSubEmitter(myData) - - subEmitter.state = 1 // 设置为1为当粒子消失后出现作用子发射器 - //可以规定多个子发射器的阵列 - tempSystem.subEmitters = [subEmitter] + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() + + const fireworkField = xrScene.getElementById('firework') + const tempSystem = fireworkField.getComponent('custom-particle') + tempSystem.addSizeGradient(0, 0.2) + tempSystem.addSizeGradient(3, 0.5) + + let myData = {} + myData = { + capacity: 200, + emitRate: 0, // 子发射器不进行每秒发射 + burstCount: 200, // 一次爆发200粒子 + burstTime: 0, // 爆发延时为0 + burstCycle: 1, // 发射一次 + size: [0.05], + startColor: [1, 1, 0, 1], + endColor: [1, 0, 0, 0], + emitterType: 'SphereShape', + emitterProps: [['radius', '0.8']], + lifeTime: [3], // 粒子生命周期为3秒 + stopDuration: [3], // 子发射器生命周期为3秒 + speed: [1], + texture: 'flarePicture' + } + + const subEmitter = tempSystem.createSubEmitter(myData) + + subEmitter.state = 1 // 设置为1为当粒子消失后出现作用子发射器 + // 可以规定多个子发射器的阵列 + tempSystem.subEmitters = [subEmitter] }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { + handleAssetsLoaded({ detail }) { } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-customParticle-meshEmitter/index.js b/miniprogram/packageXRFrame/components/xr-customParticle-meshEmitter/index.js index 73bb97c7..c954c849 100644 --- a/miniprogram/packageXRFrame/components/xr-customParticle-meshEmitter/index.js +++ b/miniprogram/packageXRFrame/components/xr-customParticle-meshEmitter/index.js @@ -1,4 +1,3 @@ - Component({ behaviors: [require('../common/share-behavior').default], properties: { @@ -10,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -20,32 +19,31 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); - this.setMeshRender(); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) + this.setMeshRender() }, - async setMeshRender(){ - const xrFrameSystem = wx.getXrFrameSystem() - const magicField = this.scene.getElementById("magicField"); - const tempSystem = magicField.getComponent("custom-particle") - - tempSystem.addSizeGradient(0,0.7); - tempSystem.addSizeGradient(0.5,1.0); - tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1,0.89,0.27,1)); - tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1,0.64,0,1)); - tempSystem.addAlphaGradient(0,0,0); - tempSystem.addAlphaGradient(0.5,1,1); - tempSystem.addAlphaGradient(1,0,0); + async setMeshRender() { + const xrFrameSystem = wx.getXrFrameSystem() + const magicField = this.scene.getElementById('magicField') + const tempSystem = magicField.getComponent('custom-particle') + + tempSystem.addSizeGradient(0, 0.7) + tempSystem.addSizeGradient(0.5, 1.0) + tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 0.89, 0.27, 1)) + tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.64, 0, 1)) + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-customParticle-orb/index.js b/miniprogram/packageXRFrame/components/xr-customParticle-orb/index.js index dbf51fc6..637ab0ef 100644 --- a/miniprogram/packageXRFrame/components/xr-customParticle-orb/index.js +++ b/miniprogram/packageXRFrame/components/xr-customParticle-orb/index.js @@ -8,7 +8,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -18,35 +18,34 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() - //orb vfx - const orb = xrScene.getElementById("orb"); - var tempSystem = orb.getComponent('custom-particle'); - tempSystem.addAlphaGradient(0, 0, 0); - tempSystem.addAlphaGradient(0.5, 1, 1); - tempSystem.addAlphaGradient(1, 0, 0); - tempSystem.addSizeGradient(0, 1, 1); - tempSystem.addSizeGradient(1, 0, 0); + // orb vfx + const orb = xrScene.getElementById('orb') + let tempSystem = orb.getComponent('custom-particle') + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(1, 0, 0) - //orbline vfx - const orbLine = xrScene.getElementById("orbLine"); - tempSystem = orbLine.getComponent('custom-particle'); - tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1)); - tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1)); - tempSystem.addAlphaGradient(0, 0, 0); - tempSystem.addAlphaGradient(0.5, 1, 1); - tempSystem.addAlphaGradient(1, 0, 0); - tempSystem.addSizeGradient(0, 1, 1); - tempSystem.addSizeGradient(1, 0, 0); + // orbline vfx + const orbLine = xrScene.getElementById('orbLine') + tempSystem = orbLine.getComponent('custom-particle') + tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1)) + tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1)) + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(1, 0, 0) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-customParticle-portal/index.js b/miniprogram/packageXRFrame/components/xr-customParticle-portal/index.js index 26fe069f..fe8ac610 100644 --- a/miniprogram/packageXRFrame/components/xr-customParticle-portal/index.js +++ b/miniprogram/packageXRFrame/components/xr-customParticle-portal/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,23 +19,22 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - const portal = xrScene.getElementById("portal"); - const xrFrameSystem = wx.getXrFrameSystem(); - const tempSystem = portal.getComponent('custom-particle'); - tempSystem.addSizeGradient(0,1,1); - tempSystem.addSizeGradient(0.5,0.8,0.8); - tempSystem.addSizeGradient(0.75,0.5,0.5); - tempSystem.addSizeGradient(0.9,0.2,0.2); - tempSystem.addSizeGradient(1,0,0); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + const portal = xrScene.getElementById('portal') + const xrFrameSystem = wx.getXrFrameSystem() + const tempSystem = portal.getComponent('custom-particle') + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(0.5, 0.8, 0.8) + tempSystem.addSizeGradient(0.75, 0.5, 0.5) + tempSystem.addSizeGradient(0.9, 0.2, 0.2) + tempSystem.addSizeGradient(1, 0, 0) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { + handleAssetsLoaded({ detail }) { } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-customParticle-shapeEmitter/index.js b/miniprogram/packageXRFrame/components/xr-customParticle-shapeEmitter/index.js index 4b115c07..9429fdb5 100644 --- a/miniprogram/packageXRFrame/components/xr-customParticle-shapeEmitter/index.js +++ b/miniprogram/packageXRFrame/components/xr-customParticle-shapeEmitter/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,15 +19,14 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { + handleReady({ detail }) { }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { + handleAssetsLoaded({ detail }) { } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-demo-viewer/index.js b/miniprogram/packageXRFrame/components/xr-demo-viewer/index.js index 79520c57..c605d36d 100644 --- a/miniprogram/packageXRFrame/components/xr-demo-viewer/index.js +++ b/miniprogram/packageXRFrame/components/xr-demo-viewer/index.js @@ -33,7 +33,7 @@ Component({ }, lifetimes: { attached() { - wx.xrTitle = this.data.title; + wx.xrTitle = this.data.title } }, methods: { @@ -44,4 +44,4 @@ Component({ options: { multipleSlots: true } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-animation/index.js b/miniprogram/packageXRFrame/components/xr-gltf-animation/index.js index 6b2ee0a5..0b2d6e0b 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-animation/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-animation/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-compressTextures/index.js b/miniprogram/packageXRFrame/components/xr-gltf-compressTextures/index.js index a7b39523..36b781e8 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-compressTextures/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-compressTextures/index.js @@ -8,19 +8,19 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-damageHelmet/index.js b/miniprogram/packageXRFrame/components/xr-gltf-damageHelmet/index.js index 6b2ee0a5..0b2d6e0b 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-damageHelmet/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-damageHelmet/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-light-loading/index.js b/miniprogram/packageXRFrame/components/xr-gltf-light-loading/index.js index 7b134154..32bd148d 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-light-loading/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-light-loading/index.js @@ -5,18 +5,18 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - this.triggerEvent('assetsProgress', detail.value); + handleAssetsProgress({ detail }) { + this.triggerEvent('assetsProgress', detail.value) }, - handleAssetsLoaded: function({detail}) { - this.triggerEvent('assetsLoaded', detail.value); + handleAssetsLoaded({ detail }) { + this.triggerEvent('assetsLoaded', detail.value) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-lightsPunctual/index.js b/miniprogram/packageXRFrame/components/xr-gltf-lightsPunctual/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-lightsPunctual/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-lightsPunctual/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-morph/index.js b/miniprogram/packageXRFrame/components/xr-gltf-morph/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-morph/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-morph/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-sheen/index.js b/miniprogram/packageXRFrame/components/xr-gltf-sheen/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-sheen/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-sheen/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-specularGlossiness/index.js b/miniprogram/packageXRFrame/components/xr-gltf-specularGlossiness/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-specularGlossiness/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-specularGlossiness/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-textureTransform/index.js b/miniprogram/packageXRFrame/components/xr-gltf-textureTransform/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-textureTransform/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-textureTransform/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-transmission/index.js b/miniprogram/packageXRFrame/components/xr-gltf-transmission/index.js index a8d27f6f..d48e9b38 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-transmission/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-transmission/index.js @@ -12,19 +12,19 @@ Component({ } }, methods: { - handleReady: function({detail}) { - this.scene = detail.value; - console.log('scene', detail.value); + handleReady({ detail }) { + this.scene = detail.value + console.log('scene', detail.value) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-gltf-unlit/index.js b/miniprogram/packageXRFrame/components/xr-gltf-unlit/index.js index a7b39523..36b781e8 100644 --- a/miniprogram/packageXRFrame/components/xr-gltf-unlit/index.js +++ b/miniprogram/packageXRFrame/components/xr-gltf-unlit/index.js @@ -8,19 +8,19 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleRaf: function({detail}) { - console.log('raf', detail.value); + handleRaf({ detail }) { + console.log('raf', detail.value) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-last-record/index.js b/miniprogram/packageXRFrame/components/xr-last-record/index.js index e287cd6e..0ee9fdec 100644 --- a/miniprogram/packageXRFrame/components/xr-last-record/index.js +++ b/miniprogram/packageXRFrame/components/xr-last-record/index.js @@ -1,14 +1,14 @@ -const info = wx.getSystemInfoSync(); -const dpi = info.pixelRatio; -const width = info.windowWidth * dpi; -const height = info.windowHeight * dpi; +const info = wx.getSystemInfoSync() +const dpi = info.pixelRatio +const width = info.windowWidth * dpi +const height = info.windowHeight * dpi Component({ scene: null, properties: {}, data: { - width: width, - height: height, + width, + height, loaded: false, arReady: false, placed: false, @@ -16,208 +16,213 @@ Component({ }, lifetimes: { attached() { - wx.reportEvent("xr_frame", { - "xr_page_path": '/pages/scene-last-record/index', - "xr_last_record_click": 1 - }); + wx.reportEvent('xr_frame', { + xr_page_path: '/pages/scene-last-record/index', + xr_last_record_click: 1 + }) }, detached() { - this.bgm.stop(); - wx.setKeepScreenOn({keepScreenOn: false}); + this.bgm.stop() + wx.setKeepScreenOn({ keepScreenOn: false }) } }, methods: { - handleReady({detail}) { - this.scene = detail.value; - this.scene.event.add('tick', this.handleTick.bind(this)); - this.inRealWorld = true; - this.texts = {}; - this.textsIndex = {}; - this.bgm = wx.createInnerAudioContext({}); - this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/bgm.mp3'; - this.bgm.loop = true; + handleReady({ detail }) { + this.scene = detail.value + this.scene.event.add('tick', this.handleTick.bind(this)) + this.inRealWorld = true + this.texts = {} + this.textsIndex = {} + this.bgm = wx.createInnerAudioContext({}) + this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/bgm.mp3' + this.bgm.loop = true }, - handleAssetsProgress: function ({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, handleARReady() { - this.setData({arReady: true}); + this.setData({ arReady: true }) }, - handleAssetsLoaded: function ({detail}) { - console.log('assets loaded', detail.value); - this.records = JSON.parse(this.scene.assets.getAsset('raw', 'records')); - this.note = this.scene.assets.getAsset('raw', 'note'); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.records = JSON.parse(this.scene.assets.getAsset('raw', 'records')) + this.note = this.scene.assets.getAsset('raw', 'note') + this.setData({ loaded: true }) }, handleTick(dt) { - this.syncTexts(); + this.syncTexts() if (!this.data.placed || !this.inRealWorld) { - return; + return } - const xrSystem = wx.getXrFrameSystem(); - const mainCamEl = this.scene.getElementById('main-camera'); - const mainTrs = mainCamEl.getComponent(xrSystem.Transform); - const door = this.scene.getElementById('door').getComponent(xrSystem.Transform); - - let forward = door.worldForward; - forward = xrSystem.Vector2.createFromNumber(forward.x, forward.z); - let diff = mainTrs.worldPosition.sub(door.worldPosition); - diff = xrSystem.Vector2.createFromNumber(diff.x, diff.z); - const preDiff = this.diff || diff; - this.diff = diff; - - const dis = diff.length(); - const preDis = preDiff.length(); - const dir = forward.dot(diff); - this.startDis = this.startDis || dis; - - const blurAsset = this.scene.assets.getAsset('post-process', 'blur'); - const vignetteAsset = this.scene.assets.getAsset('post-process', 'vignette'); - const bloomAsset = this.scene.assets.getAsset('post-process', 'bloom'); - const edgeEnv1 = 0.5; - const edgeEnv2 = 0.8; - const edgeDoor1 = 0.3; - const edgeDoor2 = 0.7; + const xrSystem = wx.getXrFrameSystem() + const mainCamEl = this.scene.getElementById('main-camera') + const mainTrs = mainCamEl.getComponent(xrSystem.Transform) + const door = this.scene.getElementById('door').getComponent(xrSystem.Transform) + + let forward = door.worldForward + forward = xrSystem.Vector2.createFromNumber(forward.x, forward.z) + let diff = mainTrs.worldPosition.sub(door.worldPosition) + diff = xrSystem.Vector2.createFromNumber(diff.x, diff.z) + const preDiff = this.diff || diff + this.diff = diff + + const dis = diff.length() + const preDis = preDiff.length() + const dir = forward.dot(diff) + this.startDis = this.startDis || dis + + const blurAsset = this.scene.assets.getAsset('post-process', 'blur') + const vignetteAsset = this.scene.assets.getAsset('post-process', 'vignette') + const bloomAsset = this.scene.assets.getAsset('post-process', 'bloom') + const edgeEnv1 = 0.5 + const edgeEnv2 = 0.8 + const edgeDoor1 = 0.3 + const edgeDoor2 = 0.7 if (this.blurDuration) { - this.blurDuration = Math.max(0, this.blurDuration - dt); - const p = 1 - this.blurDuration / this.blurTotal; + this.blurDuration = Math.max(0, this.blurDuration - dt) + const p = 1 - this.blurDuration / this.blurTotal if (p <= edgeEnv1) { - const progress = xrSystem.noneParamsEaseFuncs['ease-in-out'](p / edgeEnv1); - vignetteAsset.data.intensity = progress * 2; - blurAsset.data.radius = progress * 86 + 10; + const progress = xrSystem.noneParamsEaseFuncs['ease-in-out'](p / edgeEnv1) + vignetteAsset.data.intensity = progress * 2 + blurAsset.data.radius = progress * 86 + 10 } else if (p > edgeEnv2) { - const progress = xrSystem.noneParamsEaseFuncs['ease-in-out']((1 - p) / (1 - edgeEnv2)); - vignetteAsset.data.intensity = progress * 2; - blurAsset.data.radius = progress * 96; + const progress = xrSystem.noneParamsEaseFuncs['ease-in-out']((1 - p) / (1 - edgeEnv2)) + vignetteAsset.data.intensity = progress * 2 + blurAsset.data.radius = progress * 96 } - + if (p >= edgeDoor1 && p < edgeDoor2) { - const progress = xrSystem.noneParamsEaseFuncs['ease-in-out']((p - edgeDoor1) / (edgeDoor2 - edgeDoor1)); - door.scale.setValue(progress, 1, 1); + const progress = xrSystem.noneParamsEaseFuncs['ease-in-out']((p - edgeDoor1) / (edgeDoor2 - edgeDoor1)) + door.scale.setValue(progress, 1, 1) } } else if (this.blurTotal) { - let progress = (1 - Math.max(0, Math.min(dis / this.startDis, 0.8))); + let progress = (1 - Math.max(0, Math.min(dis / this.startDis, 0.8))) if (progress >= 0.2) { - progress = (progress - 0.2) / 0.6; - blurAsset.data.radius = progress * 96; - vignetteAsset.data.intensity = progress * 2; - bloomAsset.data.threshold = 0.5 + progress * 2; + progress = (progress - 0.2) / 0.6 + blurAsset.data.radius = progress * 96 + vignetteAsset.data.intensity = progress * 2 + bloomAsset.data.threshold = 0.5 + progress * 2 } } - //@todo: 等待物理加上碰撞检测,替换 + // @todo: 等待物理加上碰撞检测,替换 if (dir >= 0 || preDis <= 0.2 || dis > 0.2) { - return; + return } ['sky', 'scene-mesh', 'hikari', 'roam', 'xinyi'].forEach(id => { this.scene .getElementById(id) - .getComponent(xrSystem.GLTF).meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 0)); - }); + .getComponent(xrSystem.GLTF).meshes.forEach(mesh => mesh.material.setRenderState('stencilComp', 0)) + }) mainCamEl.getComponent(xrSystem.Camera).setData({ renderTarget: null, postProcess: ['tone'] - }); - this.setData({gateClosed: true}); - this.inRealWorld = false; + }) + this.setData({ gateClosed: true }) + this.inRealWorld = false }, - handleShowDoor({detail}) { + handleShowDoor({ detail }) { if (detail.value.camera.el.id !== 'main-camera') { - return; + return } - const success = this.scene.ar.placeHere('setitem', true); + const success = this.scene.ar.placeHere('setitem', true) if (!success) { - return; + return } setTimeout(() => { - this.blurTotal = this.blurDuration = 1700; - }, 300); - wx.setKeepScreenOn({keepScreenOn: true}); - this.bgm.play(); - this.setData({placed: true}); + this.blurTotal = this.blurDuration = 1700 + }, 300) + wx.setKeepScreenOn({ keepScreenOn: true }) + this.bgm.play() + this.setData({ placed: true }) }, handleResume() { if (this.data.placed) { - this.bgm.play(); + this.bgm.play() } }, - handleTouchNote({detail}) { + handleTouchNote({ detail }) { if (detail.value.camera.el.id !== 'main-camera') { - return; + return } - this.triggerEvent('showNote', this.note); + this.triggerEvent('showNote', this.note) }, - handleTouchObj({detail}) { + handleTouchObj({ detail }) { if (detail.value.camera.el.id !== 'main-camera') { - return; + return } - const xrSystem = wx.getXrFrameSystem(); - const {el, value} = detail; - const {camera, target} = value; - const id = target.id; - let text = this.texts[id]; - const camTrs = camera.el.getComponent(xrSystem.Transform); - const targetTrs = target.getComponent(xrSystem.Transform); - const diff = camTrs.worldPosition.sub(targetTrs.worldPosition); - const distance = Math.sqrt(diff.x * diff.x + diff.z * diff.z); + const xrSystem = wx.getXrFrameSystem() + const { el, value } = detail + const { camera, target } = value + const id = target.id + const text = this.texts[id] + const camTrs = camera.el.getComponent(xrSystem.Transform) + const targetTrs = target.getComponent(xrSystem.Transform) + const diff = camTrs.worldPosition.sub(targetTrs.worldPosition) + const distance = Math.sqrt(diff.x * diff.x + diff.z * diff.z) if (!this.records[id]) { - return; + return } - const {y, d, texts: records} = this.records[id]; + const { y, d, texts: records } = this.records[id] if (distance > (d || 1.5)) { - return; + return } if (text) { - clearTimeout(text.timerId); + clearTimeout(text.timerId) } - let index = this.textsIndex[id] === undefined ? -1 : this.textsIndex[id]; + let index = this.textsIndex[id] === undefined ? -1 : this.textsIndex[id] if (index >= records.length - 1) { - index = 0; + index = 0 } else { - index += 1; + index += 1 } - this.textsIndex[id] = index; + this.textsIndex[id] = index this.texts[id] = { content: records[index], - camera, target, y, + camera, + target, + y, timerId: setTimeout(() => { - delete this.texts[id]; + delete this.texts[id] }, 4000) - }; + } }, - syncTexts: function() { + syncTexts() { const texts = Object.keys(this.texts).map(id => { - const {camera, target, content, y} = this.texts[id]; - const xrSystem = wx.getXrFrameSystem(); - const trs = target.getComponent(xrSystem.Transform); - const tmp = trs.worldPosition.clone(); - tmp.y += y; - const clipPos = camera.convertWorldPositionToClip(tmp); - const {frameWidth, frameHeight} = this.scene; - + const { + camera, target, content, y + } = this.texts[id] + const xrSystem = wx.getXrFrameSystem() + const trs = target.getComponent(xrSystem.Transform) + const tmp = trs.worldPosition.clone() + tmp.y += y + const clipPos = camera.convertWorldPositionToClip(tmp) + const { frameWidth, frameHeight } = this.scene + return { - content, id, + content, + id, x: ((clipPos.x + 1) / 2) * frameWidth, y: (1 - (clipPos.y + 1) / 2) * frameHeight - }; - }); + } + }) - this.triggerEvent('changeTexts', texts); + this.triggerEvent('changeTexts', texts) } } }) diff --git a/miniprogram/packageXRFrame/components/xr-particle-custom/earring.js b/miniprogram/packageXRFrame/components/xr-particle-custom/earring.js index 1c36c36b..9464d4ce 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-custom/earring.js +++ b/miniprogram/packageXRFrame/components/xr-particle-custom/earring.js @@ -1,13629 +1,13629 @@ const content = [ [ - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.09803921568627452, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.09411764705882353, - 0.07450980392156863, - 0.07058823529411765, - 0.10980392156862745, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.0784313725490196, - 0.0588235294117647, - 0.09019607843137255, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.08627450980392157, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.08627450980392157, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.1450980392156863, - 0.07058823529411765 + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.09803921568627452, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.09411764705882353, + 0.07450980392156863, + 0.07058823529411765, + 0.10980392156862745, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.0784313725490196, + 0.0588235294117647, + 0.09019607843137255, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.08627450980392157, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.08627450980392157, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.1450980392156863, + 0.07058823529411765 ], [ - 0.09019607843137255, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.10196078431372549, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.050980392156862744, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.10588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196 + 0.09019607843137255, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.10196078431372549, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.050980392156862744, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.10588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196 ], [ - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.050980392156862744, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.06666666666666667, - 0.09411764705882353, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.06666666666666667, - 0.08627450980392157, - 0.08627450980392157, - 0.0784313725490196, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.13725490196078433, - 0.10196078431372549, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765 + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.050980392156862744, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.06666666666666667, + 0.09411764705882353, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.06666666666666667, + 0.08627450980392157, + 0.08627450980392157, + 0.0784313725490196, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.13725490196078433, + 0.10196078431372549, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.08235294117647057, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.10980392156862745, - 0.07058823529411765, - 0.08235294117647057, - 0.08627450980392157, - 0.0588235294117647, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.06666666666666667, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.08235294117647057, - 0.09019607843137255, - 0.06274509803921569, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.08627450980392157, - 0.08627450980392157, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.09803921568627452, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.0588235294117647, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.1176470588235294, - 0.10196078431372549, - 0.09019607843137255, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.08235294117647057, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.10980392156862745, + 0.07058823529411765, + 0.08235294117647057, + 0.08627450980392157, + 0.0588235294117647, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.06666666666666667, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.08235294117647057, + 0.09019607843137255, + 0.06274509803921569, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.08627450980392157, + 0.08627450980392157, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.09803921568627452, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.0588235294117647, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.1176470588235294, + 0.10196078431372549, + 0.09019607843137255, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.11372549019607843, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.09019607843137255, - 0.06666666666666667, - 0.08627450980392157, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.08235294117647057, - 0.050980392156862744, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.050980392156862744, - 0.043137254901960784, - 0.0784313725490196, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569, - 0.0588235294117647, - 0.08235294117647057, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.054901960784313725, - 0.09411764705882353, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0588235294117647, - 0.09411764705882353, - 0.0784313725490196, - 0.0784313725490196, - 0.10980392156862745, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.11372549019607843, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.09019607843137255, + 0.06666666666666667, + 0.08627450980392157, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.08235294117647057, + 0.050980392156862744, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.050980392156862744, + 0.043137254901960784, + 0.0784313725490196, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569, + 0.0588235294117647, + 0.08235294117647057, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.054901960784313725, + 0.09411764705882353, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0588235294117647, + 0.09411764705882353, + 0.0784313725490196, + 0.0784313725490196, + 0.10980392156862745, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.09019607843137255, - 0.10588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.07450980392156863, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.07450980392156863, - 0.1176470588235294, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.0588235294117647, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.12549019607843137, - 0.06666666666666667, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.0588235294117647, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.10196078431372549, - 0.07450980392156863, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.06274509803921569, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.09411764705882353, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863 + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.09019607843137255, + 0.10588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.07450980392156863, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.07450980392156863, + 0.1176470588235294, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.0588235294117647, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.12549019607843137, + 0.06666666666666667, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.0588235294117647, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.10196078431372549, + 0.07450980392156863, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.06274509803921569, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.09411764705882353, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.0784313725490196, - 0.10196078431372549, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.09019607843137255, - 0.050980392156862744, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.054901960784313725, - 0.0588235294117647, - 0.11372549019607843, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.047058823529411764, - 0.0784313725490196, - 0.08235294117647057, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.08627450980392157, - 0.054901960784313725, - 0.06666666666666667, - 0.10588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.08627450980392157, - 0.09411764705882353, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.10196078431372549, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.07450980392156863, - 0.050980392156862744, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.09019607843137255, - 0.07450980392156863 + 0.07058823529411765, + 0.0784313725490196, + 0.10196078431372549, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.09019607843137255, + 0.050980392156862744, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.054901960784313725, + 0.0588235294117647, + 0.11372549019607843, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.047058823529411764, + 0.0784313725490196, + 0.08235294117647057, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.08627450980392157, + 0.054901960784313725, + 0.06666666666666667, + 0.10588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.08627450980392157, + 0.09411764705882353, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.10196078431372549, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.07450980392156863, + 0.050980392156862744, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.09019607843137255, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.07450980392156863, - 0.09803921568627452, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.10196078431372549, - 0.0784313725490196, - 0.10588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.054901960784313725, - 0.06274509803921569, - 0.10980392156862745, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.050980392156862744, - 0.07058823529411765, - 0.054901960784313725, - 0.08235294117647057, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0588235294117647, - 0.0588235294117647, - 0.06666666666666667, - 0.08627450980392157, - 0.08235294117647057, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.11372549019607843, - 0.07450980392156863, - 0.07450980392156863, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863 + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.07450980392156863, + 0.09803921568627452, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.10196078431372549, + 0.0784313725490196, + 0.10588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.054901960784313725, + 0.06274509803921569, + 0.10980392156862745, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.050980392156862744, + 0.07058823529411765, + 0.054901960784313725, + 0.08235294117647057, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0588235294117647, + 0.0588235294117647, + 0.06666666666666667, + 0.08627450980392157, + 0.08235294117647057, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.11372549019607843, + 0.07450980392156863, + 0.07450980392156863, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.09803921568627452, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.10588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.09803921568627452, - 0.07450980392156863 + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.09803921568627452, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.10588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.09803921568627452, + 0.07450980392156863 ], [ - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.050980392156862744, - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.08627450980392157, - 0.08235294117647057, - 0.0588235294117647, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.0588235294117647, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0588235294117647, - 0.0588235294117647, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647 + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.050980392156862744, + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.08627450980392157, + 0.08235294117647057, + 0.0588235294117647, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.0588235294117647, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0588235294117647, + 0.0588235294117647, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647 ], [ - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.09019607843137255, - 0.07450980392156863, - 0.06666666666666667, - 0.09411764705882353, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.10980392156862745, - 0.07058823529411765, - 0.0588235294117647, - 0.050980392156862744, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.0784313725490196, - 0.08627450980392157, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.08235294117647057, - 0.10588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.047058823529411764, - 0.07450980392156863 + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.09019607843137255, + 0.07450980392156863, + 0.06666666666666667, + 0.09411764705882353, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.10980392156862745, + 0.07058823529411765, + 0.0588235294117647, + 0.050980392156862744, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.0784313725490196, + 0.08627450980392157, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.08235294117647057, + 0.10588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.047058823529411764, + 0.07450980392156863 ], [ - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.09019607843137255, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.09411764705882353, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.08235294117647057, - 0.08235294117647057, - 0.0784313725490196, - 0.047058823529411764, - 0.09411764705882353, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.09411764705882353, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.10980392156862745, - 0.0588235294117647, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.054901960784313725, - 0.09019607843137255, - 0.07450980392156863, - 0.07058823529411765, - 0.11372549019607843, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.09019607843137255, - 0.08627450980392157, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.09803921568627452, - 0.1176470588235294, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765 + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.09019607843137255, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.09411764705882353, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.08235294117647057, + 0.08235294117647057, + 0.0784313725490196, + 0.047058823529411764, + 0.09411764705882353, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.09411764705882353, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.10980392156862745, + 0.0588235294117647, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.054901960784313725, + 0.09019607843137255, + 0.07450980392156863, + 0.07058823529411765, + 0.11372549019607843, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.09019607843137255, + 0.08627450980392157, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.09803921568627452, + 0.1176470588235294, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.0588235294117647, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.09019607843137255, - 0.050980392156862744, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.050980392156862744, - 0.0588235294117647, - 0.054901960784313725, - 0.0784313725490196, - 0.07058823529411765, - 0.1176470588235294, - 0.08627450980392157, - 0.054901960784313725, - 0.047058823529411764, - 0.09411764705882353, - 0.06666666666666667, - 0.0784313725490196, - 0.09019607843137255, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.08627450980392157, - 0.0588235294117647, - 0.06666666666666667, - 0.08627450980392157, - 0.06274509803921569, - 0.06274509803921569, - 0.09411764705882353, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.050980392156862744, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.10588235294117647, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.08627450980392157, - 0.10980392156862745, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.09019607843137255, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.09803921568627452, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.0588235294117647, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.09019607843137255, + 0.050980392156862744, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.050980392156862744, + 0.0588235294117647, + 0.054901960784313725, + 0.0784313725490196, + 0.07058823529411765, + 0.1176470588235294, + 0.08627450980392157, + 0.054901960784313725, + 0.047058823529411764, + 0.09411764705882353, + 0.06666666666666667, + 0.0784313725490196, + 0.09019607843137255, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.08627450980392157, + 0.0588235294117647, + 0.06666666666666667, + 0.08627450980392157, + 0.06274509803921569, + 0.06274509803921569, + 0.09411764705882353, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.050980392156862744, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.10588235294117647, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.08627450980392157, + 0.10980392156862745, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.09019607843137255, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.09803921568627452, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.08627450980392157, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.1411764705882353, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.050980392156862744, - 0.06274509803921569, - 0.08627450980392157, - 0.07450980392156863, - 0.054901960784313725, - 0.0588235294117647, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.09803921568627452, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.09803921568627452, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.11372549019607843, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.1176470588235294, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.08627450980392157, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.1411764705882353, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.050980392156862744, + 0.06274509803921569, + 0.08627450980392157, + 0.07450980392156863, + 0.054901960784313725, + 0.0588235294117647, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.09803921568627452, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.09803921568627452, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.11372549019607843, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.1176470588235294, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.09411764705882353, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.08235294117647057, - 0.0588235294117647, - 0.09803921568627452, - 0.07058823529411765, - 0.09019607843137255, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.10196078431372549, - 0.0784313725490196, - 0.10196078431372549, - 0.07450980392156863, - 0.07058823529411765, - 0.050980392156862744, - 0.10588235294117647, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.08627450980392157, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.0588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.0588235294117647, - 0.09803921568627452, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.09019607843137255, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.09411764705882353, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.08235294117647057, + 0.0588235294117647, + 0.09803921568627452, + 0.07058823529411765, + 0.09019607843137255, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.10196078431372549, + 0.0784313725490196, + 0.10196078431372549, + 0.07450980392156863, + 0.07058823529411765, + 0.050980392156862744, + 0.10588235294117647, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.08627450980392157, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.0588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.0588235294117647, + 0.09803921568627452, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.09019607843137255, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.09803921568627452, - 0.10196078431372549, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.13725490196078433, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.09803921568627452, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.08627450980392157, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.10588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.12941176470588237, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.09803921568627452, - 0.09411764705882353, - 0.10980392156862745, - 0.17647058823529413, - 0.2235294117647059, - 0.10196078431372549, - 0.09803921568627452, - 0.09019607843137255, - 0.08235294117647057, - 0.054901960784313725, - 0.07058823529411765, - 0.08627450980392157, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.1176470588235294, - 0.07450980392156863, - 0.050980392156862744, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863 + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.09803921568627452, + 0.10196078431372549, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.13725490196078433, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.09803921568627452, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.08627450980392157, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.10588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.12941176470588237, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.09803921568627452, + 0.09411764705882353, + 0.10980392156862745, + 0.17647058823529413, + 0.2235294117647059, + 0.10196078431372549, + 0.09803921568627452, + 0.09019607843137255, + 0.08235294117647057, + 0.054901960784313725, + 0.07058823529411765, + 0.08627450980392157, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.1176470588235294, + 0.07450980392156863, + 0.050980392156862744, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.09411764705882353, - 0.1568627450980392, - 0.12549019607843137, - 0.0784313725490196, - 0.10588235294117647, - 0.10196078431372549, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.050980392156862744, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.0588235294117647, - 0.11372549019607843, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.0784313725490196, - 0.08627450980392157, - 0.07058823529411765, - 0.1176470588235294, - 0.6901960784313725, - 0.8196078431372549, - 0.7647058823529411, - 0.6666666666666665, - 0.6549019607843136, - 0.6627450980392156, - 0.5686274509803921, - 0.615686274509804, - 0.5254901960784314, - 0.44313725490196076, - 0.10980392156862745, - 0.09019607843137255, - 0.09803921568627452, - 0.09411764705882353, - 0.08235294117647057, - 0.12156862745098039, - 0.09803921568627452, - 0.08235294117647057, - 0.054901960784313725, - 0.06666666666666667, - 0.10980392156862745, - 0.09411764705882353, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.13333333333333333, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.09411764705882353, + 0.1568627450980392, + 0.12549019607843137, + 0.0784313725490196, + 0.10588235294117647, + 0.10196078431372549, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.050980392156862744, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.0588235294117647, + 0.11372549019607843, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.0784313725490196, + 0.08627450980392157, + 0.07058823529411765, + 0.1176470588235294, + 0.6901960784313725, + 0.8196078431372549, + 0.7647058823529411, + 0.6666666666666665, + 0.6549019607843136, + 0.6627450980392156, + 0.5686274509803921, + 0.615686274509804, + 0.5254901960784314, + 0.44313725490196076, + 0.10980392156862745, + 0.09019607843137255, + 0.09803921568627452, + 0.09411764705882353, + 0.08235294117647057, + 0.12156862745098039, + 0.09803921568627452, + 0.08235294117647057, + 0.054901960784313725, + 0.06666666666666667, + 0.10980392156862745, + 0.09411764705882353, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.13333333333333333, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.09411764705882353, - 0.08627450980392157, - 0.08235294117647057, - 0.09019607843137255, - 0.12941176470588237, - 0.050980392156862744, - 0.08235294117647057, - 0.1176470588235294, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.054901960784313725, - 0.08235294117647057, - 0.07450980392156863, - 0.054901960784313725, - 0.1176470588235294, - 0.08627450980392157, - 0.09411764705882353, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.09803921568627452, - 0.08627450980392157, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.08627450980392157, - 0.0588235294117647, - 0.07058823529411765, - 0.09411764705882353, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07450980392156863, - 0.7137254901960784, - 0.6431372549019607, - 0.6862745098039216, - 0.5450980392156862, - 0.803921568627451, - 0.6980392156862745, - 0.5450980392156862, - 0.8117647058823529, - 0.9294117647058823, - 0.8588235294117647, - 0.6235294117647059, - 0.6392156862745098, - 0.6745098039215687, - 0.5882352941176471, - 0.15294117647058825, - 0.10588235294117647, - 0.09411764705882353, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.050980392156862744, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.0784313725490196, - 0.054901960784313725, - 0.07450980392156863, - 0.06666666666666667, - 0.047058823529411764, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.09411764705882353, + 0.08627450980392157, + 0.08235294117647057, + 0.09019607843137255, + 0.12941176470588237, + 0.050980392156862744, + 0.08235294117647057, + 0.1176470588235294, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.054901960784313725, + 0.08235294117647057, + 0.07450980392156863, + 0.054901960784313725, + 0.1176470588235294, + 0.08627450980392157, + 0.09411764705882353, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.09803921568627452, + 0.08627450980392157, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.08627450980392157, + 0.0588235294117647, + 0.07058823529411765, + 0.09411764705882353, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07450980392156863, + 0.7137254901960784, + 0.6431372549019607, + 0.6862745098039216, + 0.5450980392156862, + 0.803921568627451, + 0.6980392156862745, + 0.5450980392156862, + 0.8117647058823529, + 0.9294117647058823, + 0.8588235294117647, + 0.6235294117647059, + 0.6392156862745098, + 0.6745098039215687, + 0.5882352941176471, + 0.15294117647058825, + 0.10588235294117647, + 0.09411764705882353, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.050980392156862744, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.0784313725490196, + 0.054901960784313725, + 0.07450980392156863, + 0.06666666666666667, + 0.047058823529411764, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.0784313725490196, - 0.09411764705882353, - 0.054901960784313725, - 0.07058823529411765, - 0.09019607843137255, - 0.06274509803921569, - 0.06274509803921569, - 0.08627450980392157, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.050980392156862744, - 0.10980392156862745, - 0.06666666666666667, - 0.07450980392156863, - 0.12941176470588237, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.08627450980392157, - 0.09019607843137255, - 0.06274509803921569, - 0.09803921568627452, - 0.06274509803921569, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.12156862745098039, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.050980392156862744, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.09803921568627452, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.0588235294117647, - 0.08627450980392157, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.2549019607843137, - 0.596078431372549, - 0.7647058823529411, - 0.7058823529411765, - 0.6039215686274509, - 0.8156862745098039, - 0.3176470588235294, - 0.7882352941176471, - 0.9725490196078431, - 0.9647058823529412, - 0.984313725490196, - 0.9529411764705881, - 0.9921568627450981, - 0.9294117647058823, - 0.9490196078431371, - 0.7137254901960784, - 0.6274509803921569, - 0.25098039215686274, - 0.06666666666666667, - 0.0588235294117647, - 0.050980392156862744, - 0.09803921568627452, - 0.09411764705882353, - 0.0784313725490196, - 0.08627450980392157, - 0.047058823529411764, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.054901960784313725, - 0.054901960784313725, - 0.0784313725490196, - 0.12549019607843137, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.047058823529411764, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765 + 0.0784313725490196, + 0.09411764705882353, + 0.054901960784313725, + 0.07058823529411765, + 0.09019607843137255, + 0.06274509803921569, + 0.06274509803921569, + 0.08627450980392157, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.050980392156862744, + 0.10980392156862745, + 0.06666666666666667, + 0.07450980392156863, + 0.12941176470588237, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.08627450980392157, + 0.09019607843137255, + 0.06274509803921569, + 0.09803921568627452, + 0.06274509803921569, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.12156862745098039, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.050980392156862744, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.09803921568627452, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.0588235294117647, + 0.08627450980392157, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.2549019607843137, + 0.596078431372549, + 0.7647058823529411, + 0.7058823529411765, + 0.6039215686274509, + 0.8156862745098039, + 0.3176470588235294, + 0.7882352941176471, + 0.9725490196078431, + 0.9647058823529412, + 0.984313725490196, + 0.9529411764705881, + 0.9921568627450981, + 0.9294117647058823, + 0.9490196078431371, + 0.7137254901960784, + 0.6274509803921569, + 0.25098039215686274, + 0.06666666666666667, + 0.0588235294117647, + 0.050980392156862744, + 0.09803921568627452, + 0.09411764705882353, + 0.0784313725490196, + 0.08627450980392157, + 0.047058823529411764, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.054901960784313725, + 0.054901960784313725, + 0.0784313725490196, + 0.12549019607843137, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.047058823529411764, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.08235294117647057, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.1176470588235294, - 0.06666666666666667, - 0.09803921568627452, - 0.12156862745098039, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.10588235294117647, - 0.12156862745098039, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.09411764705882353, - 0.06274509803921569, - 0.10980392156862745, - 0.0784313725490196, - 0.07058823529411765, - 0.08235294117647057, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.054901960784313725, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.08627450980392157, - 0.054901960784313725, - 0.0588235294117647, - 0.10588235294117647, - 0.07058823529411765, - 0.0588235294117647, - 0.050980392156862744, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.1411764705882353, - 0.5411764705882353, - 0.5647058823529412, - 0.6784313725490196, - 0.7411764705882353, - 0.7490196078431373, - 0.403921568627451, - 0.38431372549019616, - 0.6039215686274509, - 0.8549019607843137, - 0.9607843137254902, - 0.9294117647058823, - 0.9568627450980393, - 0.7686274509803923, - 0.9333333333333332, - 0.9568627450980393, - 0.9098039215686274, - 0.5843137254901961, - 0.5607843137254902, - 0.4470588235294118, - 0.1450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.10588235294117647, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.08235294117647057, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.1176470588235294, + 0.06666666666666667, + 0.09803921568627452, + 0.12156862745098039, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.10588235294117647, + 0.12156862745098039, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.09411764705882353, + 0.06274509803921569, + 0.10980392156862745, + 0.0784313725490196, + 0.07058823529411765, + 0.08235294117647057, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.054901960784313725, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.08627450980392157, + 0.054901960784313725, + 0.0588235294117647, + 0.10588235294117647, + 0.07058823529411765, + 0.0588235294117647, + 0.050980392156862744, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.1411764705882353, + 0.5411764705882353, + 0.5647058823529412, + 0.6784313725490196, + 0.7411764705882353, + 0.7490196078431373, + 0.403921568627451, + 0.38431372549019616, + 0.6039215686274509, + 0.8549019607843137, + 0.9607843137254902, + 0.9294117647058823, + 0.9568627450980393, + 0.7686274509803923, + 0.9333333333333332, + 0.9568627450980393, + 0.9098039215686274, + 0.5843137254901961, + 0.5607843137254902, + 0.4470588235294118, + 0.1450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.10588235294117647, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.11372549019607843, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.08627450980392157, - 0.07450980392156863, - 0.10980392156862745, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.08627450980392157, - 0.07058823529411765, - 0.10196078431372549, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.06274509803921569, - 0.10196078431372549, - 0.07058823529411765, - 0.09411764705882353, - 0.06274509803921569, - 0.06274509803921569, - 0.09019607843137255, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.0588235294117647, - 0.10588235294117647, - 0.09803921568627452, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.12941176470588237, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.06274509803921569, - 0.06666666666666667, - 0.08627450980392157, - 0.25098039215686274, - 0.5058823529411764, - 0.7098039215686275, - 0.8509803921568627, - 0.9254901960784313, - 0.9058823529411765, - 0.8627450980392157, - 0.8823529411764706, - 0.9098039215686274, - 0.8627450980392157, - 0.8117647058823529, - 0.7529411764705882, - 0.6901960784313725, - 0.9490196078431371, - 0.8823529411764706, - 0.8509803921568627, - 0.8627450980392157, - 0.9019607843137255, - 0.8313725490196079, - 0.5882352941176471, - 0.6, - 0.47450980392156855, - 0.3294117647058823, - 0.08235294117647057, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.09411764705882353, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.07058823529411765 + 0.11372549019607843, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.08627450980392157, + 0.07450980392156863, + 0.10980392156862745, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.08627450980392157, + 0.07058823529411765, + 0.10196078431372549, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.06274509803921569, + 0.10196078431372549, + 0.07058823529411765, + 0.09411764705882353, + 0.06274509803921569, + 0.06274509803921569, + 0.09019607843137255, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.0588235294117647, + 0.10588235294117647, + 0.09803921568627452, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.12941176470588237, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.06274509803921569, + 0.06666666666666667, + 0.08627450980392157, + 0.25098039215686274, + 0.5058823529411764, + 0.7098039215686275, + 0.8509803921568627, + 0.9254901960784313, + 0.9058823529411765, + 0.8627450980392157, + 0.8823529411764706, + 0.9098039215686274, + 0.8627450980392157, + 0.8117647058823529, + 0.7529411764705882, + 0.6901960784313725, + 0.9490196078431371, + 0.8823529411764706, + 0.8509803921568627, + 0.8627450980392157, + 0.9019607843137255, + 0.8313725490196079, + 0.5882352941176471, + 0.6, + 0.47450980392156855, + 0.3294117647058823, + 0.08235294117647057, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.09411764705882353, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.07058823529411765 ], [ - 0.06274509803921569, - 0.10588235294117647, - 0.07450980392156863, - 0.08627450980392157, - 0.050980392156862744, - 0.0588235294117647, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.08627450980392157, - 0.12156862745098039, - 0.10588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.10588235294117647, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.0784313725490196, - 0.10196078431372549, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.08627450980392157, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.0784313725490196, - 0.1411764705882353, - 0.08627450980392157, - 0.06666666666666667, - 0.09803921568627452, - 0.08235294117647057, - 0.43137254901960786, - 0.8431372549019608, - 0.8235294117647058, - 0.8980392156862745, - 0.9686274509803922, - 0.9529411764705881, - 0.9490196078431371, - 0.8784313725490196, - 0.9215686274509803, - 0.803921568627451, - 0.7882352941176471, - 0.9254901960784313, - 0.807843137254902, - 0.9568627450980393, - 0.7803921568627452, - 0.6941176470588235, - 0.6, - 0.9215686274509803, - 0.9411764705882352, - 0.8470588235294118, - 0.8627450980392157, - 0.8823529411764706, - 0.47843137254901963, - 0.3607843137254902, - 0.37254901960784315, - 0.41568627450980394, - 0.1843137254901961, - 0.09019607843137255, - 0.10588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.0588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.06274509803921569, + 0.10588235294117647, + 0.07450980392156863, + 0.08627450980392157, + 0.050980392156862744, + 0.0588235294117647, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.08627450980392157, + 0.12156862745098039, + 0.10588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.10588235294117647, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.0784313725490196, + 0.10196078431372549, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.08627450980392157, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.0784313725490196, + 0.1411764705882353, + 0.08627450980392157, + 0.06666666666666667, + 0.09803921568627452, + 0.08235294117647057, + 0.43137254901960786, + 0.8431372549019608, + 0.8235294117647058, + 0.8980392156862745, + 0.9686274509803922, + 0.9529411764705881, + 0.9490196078431371, + 0.8784313725490196, + 0.9215686274509803, + 0.803921568627451, + 0.7882352941176471, + 0.9254901960784313, + 0.807843137254902, + 0.9568627450980393, + 0.7803921568627452, + 0.6941176470588235, + 0.6, + 0.9215686274509803, + 0.9411764705882352, + 0.8470588235294118, + 0.8627450980392157, + 0.8823529411764706, + 0.47843137254901963, + 0.3607843137254902, + 0.37254901960784315, + 0.41568627450980394, + 0.1843137254901961, + 0.09019607843137255, + 0.10588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.0588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.0588235294117647, - 0.06666666666666667, - 0.09411764705882353, - 0.10196078431372549, - 0.06274509803921569, - 0.09411764705882353, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.0784313725490196, - 0.09019607843137255, - 0.12549019607843137, - 0.07058823529411765, - 0.10588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.050980392156862744, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.0588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.054901960784313725, - 0.08235294117647057, - 0.09019607843137255, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.054901960784313725, - 0.0588235294117647, - 0.12156862745098039, - 0.13725490196078433, - 0.13333333333333333, - 0.19607843137254904, - 0.5411764705882353, - 0.4549019607843137, - 0.5647058823529412, - 0.6823529411764706, - 0.807843137254902, - 0.7960784313725491, - 0.8745098039215686, - 0.9372549019607842, - 0.9568627450980393, - 0.9411764705882352, - 0.9686274509803922, - 0.8627450980392157, - 0.6470588235294117, - 0.5529411764705883, - 0.7372549019607844, - 0.7686274509803923, - 0.8666666666666667, - 0.5843137254901961, - 0.5411764705882353, - 0.5568627450980392, - 0.6196078431372549, - 0.807843137254902, - 0.7215686274509804, - 0.7137254901960784, - 0.35294117647058826, - 0.2549019607843137, - 0.20392156862745098, - 0.30980392156862746, - 0.1803921568627451, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.09019607843137255, - 0.07450980392156863, - 0.08627450980392157, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765 + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.0588235294117647, + 0.06666666666666667, + 0.09411764705882353, + 0.10196078431372549, + 0.06274509803921569, + 0.09411764705882353, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.0784313725490196, + 0.09019607843137255, + 0.12549019607843137, + 0.07058823529411765, + 0.10588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.050980392156862744, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.0588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.054901960784313725, + 0.08235294117647057, + 0.09019607843137255, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.054901960784313725, + 0.0588235294117647, + 0.12156862745098039, + 0.13725490196078433, + 0.13333333333333333, + 0.19607843137254904, + 0.5411764705882353, + 0.4549019607843137, + 0.5647058823529412, + 0.6823529411764706, + 0.807843137254902, + 0.7960784313725491, + 0.8745098039215686, + 0.9372549019607842, + 0.9568627450980393, + 0.9411764705882352, + 0.9686274509803922, + 0.8627450980392157, + 0.6470588235294117, + 0.5529411764705883, + 0.7372549019607844, + 0.7686274509803923, + 0.8666666666666667, + 0.5843137254901961, + 0.5411764705882353, + 0.5568627450980392, + 0.6196078431372549, + 0.807843137254902, + 0.7215686274509804, + 0.7137254901960784, + 0.35294117647058826, + 0.2549019607843137, + 0.20392156862745098, + 0.30980392156862746, + 0.1803921568627451, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.09019607843137255, + 0.07450980392156863, + 0.08627450980392157, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.0588235294117647, - 0.11372549019607843, - 0.06274509803921569, - 0.07450980392156863, - 0.13725490196078433, - 0.06274509803921569, - 0.0784313725490196, - 0.10980392156862745, - 0.0784313725490196, - 0.10196078431372549, - 0.09019607843137255, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.08627450980392157, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.14901960784313725, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.050980392156862744, - 0.06666666666666667, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.0784313725490196, - 0.054901960784313725, - 0.06666666666666667, - 0.08235294117647057, - 0.054901960784313725, - 0.10980392156862745, - 0.3686274509803922, - 0.3058823529411765, - 0.5019607843137255, - 0.8196078431372549, - 0.8941176470588236, - 0.6823529411764706, - 0.8431372549019608, - 0.7333333333333333, - 0.6627450980392156, - 0.7450980392156863, - 0.7764705882352942, - 0.592156862745098, - 0.3294117647058823, - 0.5254901960784314, - 0.8627450980392157, - 0.9450980392156861, - 0.9647058823529412, - 0.9490196078431371, - 0.9686274509803922, - 0.6666666666666665, - 0.6352941176470588, - 0.7215686274509804, - 0.6745098039215687, - 0.6941176470588235, - 0.5372549019607843, - 0.47843137254901963, - 0.7647058823529411, - 0.8156862745098039, - 0.7803921568627452, - 0.5450980392156862, - 0.27058823529411763, - 0.2235294117647059, - 0.2823529411764706, - 0.22745098039215686, - 0.1176470588235294, - 0.08235294117647057, - 0.08235294117647057, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.11372549019607843, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.09019607843137255, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667 + 0.0588235294117647, + 0.11372549019607843, + 0.06274509803921569, + 0.07450980392156863, + 0.13725490196078433, + 0.06274509803921569, + 0.0784313725490196, + 0.10980392156862745, + 0.0784313725490196, + 0.10196078431372549, + 0.09019607843137255, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.08627450980392157, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.14901960784313725, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.050980392156862744, + 0.06666666666666667, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.0784313725490196, + 0.054901960784313725, + 0.06666666666666667, + 0.08235294117647057, + 0.054901960784313725, + 0.10980392156862745, + 0.3686274509803922, + 0.3058823529411765, + 0.5019607843137255, + 0.8196078431372549, + 0.8941176470588236, + 0.6823529411764706, + 0.8431372549019608, + 0.7333333333333333, + 0.6627450980392156, + 0.7450980392156863, + 0.7764705882352942, + 0.592156862745098, + 0.3294117647058823, + 0.5254901960784314, + 0.8627450980392157, + 0.9450980392156861, + 0.9647058823529412, + 0.9490196078431371, + 0.9686274509803922, + 0.6666666666666665, + 0.6352941176470588, + 0.7215686274509804, + 0.6745098039215687, + 0.6941176470588235, + 0.5372549019607843, + 0.47843137254901963, + 0.7647058823529411, + 0.8156862745098039, + 0.7803921568627452, + 0.5450980392156862, + 0.27058823529411763, + 0.2235294117647059, + 0.2823529411764706, + 0.22745098039215686, + 0.1176470588235294, + 0.08235294117647057, + 0.08235294117647057, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.11372549019607843, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.09019607843137255, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667 ], [ - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.09411764705882353, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.08627450980392157, - 0.11372549019607843, - 0.1411764705882353, - 0.07058823529411765, - 0.054901960784313725, - 0.11372549019607843, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.047058823529411764, - 0.06274509803921569, - 0.08627450980392157, - 0.06274509803921569, - 0.09411764705882353, - 0.12156862745098039, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.0588235294117647, - 0.08235294117647057, - 0.06666666666666667, - 0.09411764705882353, - 0.054901960784313725, - 0.10196078431372549, - 0.0588235294117647, - 0.06274509803921569, - 0.08235294117647057, - 0.10980392156862745, - 0.09019607843137255, - 0.08627450980392157, - 0.054901960784313725, - 0.09411764705882353, - 0.06666666666666667, - 0.10980392156862745, - 0.06666666666666667, - 0.08235294117647057, - 0.20784313725490197, - 0.6588235294117646, - 0.7764705882352942, - 0.9058823529411765, - 0.8196078431372549, - 0.8352941176470589, - 0.7254901960784313, - 0.7607843137254902, - 0.8274509803921568, - 0.6392156862745098, - 0.8941176470588236, - 0.7803921568627452, - 0.8627450980392157, - 0.6588235294117646, - 0.6509803921568627, - 0.47843137254901963, - 0.6549019607843136, - 0.615686274509804, - 0.6705882352941175, - 0.996078431372549, - 0.9725490196078431, - 0.7686274509803923, - 0.6196078431372549, - 0.7254901960784313, - 0.5411764705882353, - 0.6941176470588235, - 0.8705882352941177, - 0.6078431372549019, - 0.6, - 0.38431372549019616, - 0.8784313725490196, - 0.7647058823529411, - 0.6235294117647059, - 0.39607843137254906, - 0.19607843137254904, - 0.09411764705882353, - 0.21568627450980393, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.10196078431372549, - 0.0784313725490196, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.08627450980392157, - 0.08627450980392157, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765 + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.09411764705882353, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.08627450980392157, + 0.11372549019607843, + 0.1411764705882353, + 0.07058823529411765, + 0.054901960784313725, + 0.11372549019607843, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.047058823529411764, + 0.06274509803921569, + 0.08627450980392157, + 0.06274509803921569, + 0.09411764705882353, + 0.12156862745098039, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.0588235294117647, + 0.08235294117647057, + 0.06666666666666667, + 0.09411764705882353, + 0.054901960784313725, + 0.10196078431372549, + 0.0588235294117647, + 0.06274509803921569, + 0.08235294117647057, + 0.10980392156862745, + 0.09019607843137255, + 0.08627450980392157, + 0.054901960784313725, + 0.09411764705882353, + 0.06666666666666667, + 0.10980392156862745, + 0.06666666666666667, + 0.08235294117647057, + 0.20784313725490197, + 0.6588235294117646, + 0.7764705882352942, + 0.9058823529411765, + 0.8196078431372549, + 0.8352941176470589, + 0.7254901960784313, + 0.7607843137254902, + 0.8274509803921568, + 0.6392156862745098, + 0.8941176470588236, + 0.7803921568627452, + 0.8627450980392157, + 0.6588235294117646, + 0.6509803921568627, + 0.47843137254901963, + 0.6549019607843136, + 0.615686274509804, + 0.6705882352941175, + 0.996078431372549, + 0.9725490196078431, + 0.7686274509803923, + 0.6196078431372549, + 0.7254901960784313, + 0.5411764705882353, + 0.6941176470588235, + 0.8705882352941177, + 0.6078431372549019, + 0.6, + 0.38431372549019616, + 0.8784313725490196, + 0.7647058823529411, + 0.6235294117647059, + 0.39607843137254906, + 0.19607843137254904, + 0.09411764705882353, + 0.21568627450980393, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.10196078431372549, + 0.0784313725490196, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.08627450980392157, + 0.08627450980392157, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.0588235294117647, - 0.08627450980392157, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.050980392156862744, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.10588235294117647, - 0.06274509803921569, - 0.10980392156862745, - 0.10588235294117647, - 0.0784313725490196, - 0.13725490196078433, - 0.0784313725490196, - 0.10196078431372549, - 0.07450980392156863, - 0.08235294117647057, - 0.10588235294117647, - 0.054901960784313725, - 0.06274509803921569, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.08235294117647057, - 0.20784313725490197, - 0.8156862745098039, - 0.8431372549019608, - 0.7529411764705882, - 0.8745098039215686, - 0.8274509803921568, - 0.8392156862745098, - 0.7960784313725491, - 0.6588235294117646, - 0.7254901960784313, - 0.6980392156862745, - 0.5607843137254902, - 0.8392156862745098, - 0.8431372549019608, - 0.8235294117647058, - 0.7921568627450981, - 0.8313725490196079, - 0.6549019607843136, - 0.6862745098039216, - 0.6549019607843136, - 0.5137254901960784, - 0.5568627450980392, - 0.5803921568627451, - 0.9725490196078431, - 0.9686274509803922, - 0.6784313725490196, - 0.8627450980392157, - 0.5882352941176471, - 0.6039215686274509, - 0.803921568627451, - 0.5411764705882353, - 0.6274509803921569, - 0.4980392156862745, - 0.7686274509803923, - 0.7176470588235294, - 0.5254901960784314, - 0.5058823529411764, - 0.2, - 0.1803921568627451, - 0.12549019607843137, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.12941176470588237, - 0.08627450980392157, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.08235294117647057 + 0.0588235294117647, + 0.08627450980392157, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.050980392156862744, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.10588235294117647, + 0.06274509803921569, + 0.10980392156862745, + 0.10588235294117647, + 0.0784313725490196, + 0.13725490196078433, + 0.0784313725490196, + 0.10196078431372549, + 0.07450980392156863, + 0.08235294117647057, + 0.10588235294117647, + 0.054901960784313725, + 0.06274509803921569, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.08235294117647057, + 0.20784313725490197, + 0.8156862745098039, + 0.8431372549019608, + 0.7529411764705882, + 0.8745098039215686, + 0.8274509803921568, + 0.8392156862745098, + 0.7960784313725491, + 0.6588235294117646, + 0.7254901960784313, + 0.6980392156862745, + 0.5607843137254902, + 0.8392156862745098, + 0.8431372549019608, + 0.8235294117647058, + 0.7921568627450981, + 0.8313725490196079, + 0.6549019607843136, + 0.6862745098039216, + 0.6549019607843136, + 0.5137254901960784, + 0.5568627450980392, + 0.5803921568627451, + 0.9725490196078431, + 0.9686274509803922, + 0.6784313725490196, + 0.8627450980392157, + 0.5882352941176471, + 0.6039215686274509, + 0.803921568627451, + 0.5411764705882353, + 0.6274509803921569, + 0.4980392156862745, + 0.7686274509803923, + 0.7176470588235294, + 0.5254901960784314, + 0.5058823529411764, + 0.2, + 0.1803921568627451, + 0.12549019607843137, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.12941176470588237, + 0.08627450980392157, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.08235294117647057 ], [ - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.050980392156862744, - 0.10588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.12549019607843137, - 0.0588235294117647, - 0.08627450980392157, - 0.06274509803921569, - 0.09411764705882353, - 0.06274509803921569, - 0.13333333333333333, - 0.08627450980392157, - 0.08235294117647057, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.10588235294117647, - 0.08235294117647057, - 0.07450980392156863, - 0.08235294117647057, - 0.08235294117647057, - 0.10196078431372549, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.08627450980392157, - 0.08235294117647057, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.1411764705882353, - 0.11372549019607843, - 0.6666666666666665, - 0.8901960784313725, - 0.7725490196078433, - 0.8196078431372549, - 0.8745098039215686, - 0.8745098039215686, - 0.7607843137254902, - 0.7372549019607844, - 0.8431372549019608, - 0.8470588235294118, - 0.8352941176470589, - 0.8196078431372549, - 0.8352941176470589, - 0.7725490196078433, - 0.7058823529411765, - 0.8470588235294118, - 0.7411764705882353, - 0.7254901960784313, - 0.7254901960784313, - 0.6196078431372549, - 0.6235294117647059, - 0.5529411764705883, - 0.6235294117647059, - 0.5686274509803921, - 0.7137254901960784, - 0.8588235294117647, - 0.7490196078431373, - 0.8, - 0.6039215686274509, - 0.5254901960784314, - 0.6509803921568627, - 0.5843137254901961, - 0.7254901960784313, - 0.3764705882352941, - 0.6196078431372549, - 0.4470588235294118, - 0.35294117647058826, - 0.43529411764705883, - 0.12941176470588237, - 0.1450980392156863, - 0.11372549019607843, - 0.0784313725490196, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863 + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.050980392156862744, + 0.10588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.12549019607843137, + 0.0588235294117647, + 0.08627450980392157, + 0.06274509803921569, + 0.09411764705882353, + 0.06274509803921569, + 0.13333333333333333, + 0.08627450980392157, + 0.08235294117647057, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.10588235294117647, + 0.08235294117647057, + 0.07450980392156863, + 0.08235294117647057, + 0.08235294117647057, + 0.10196078431372549, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.08627450980392157, + 0.08235294117647057, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.1411764705882353, + 0.11372549019607843, + 0.6666666666666665, + 0.8901960784313725, + 0.7725490196078433, + 0.8196078431372549, + 0.8745098039215686, + 0.8745098039215686, + 0.7607843137254902, + 0.7372549019607844, + 0.8431372549019608, + 0.8470588235294118, + 0.8352941176470589, + 0.8196078431372549, + 0.8352941176470589, + 0.7725490196078433, + 0.7058823529411765, + 0.8470588235294118, + 0.7411764705882353, + 0.7254901960784313, + 0.7254901960784313, + 0.6196078431372549, + 0.6235294117647059, + 0.5529411764705883, + 0.6235294117647059, + 0.5686274509803921, + 0.7137254901960784, + 0.8588235294117647, + 0.7490196078431373, + 0.8, + 0.6039215686274509, + 0.5254901960784314, + 0.6509803921568627, + 0.5843137254901961, + 0.7254901960784313, + 0.3764705882352941, + 0.6196078431372549, + 0.4470588235294118, + 0.35294117647058826, + 0.43529411764705883, + 0.12941176470588237, + 0.1450980392156863, + 0.11372549019607843, + 0.0784313725490196, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.054901960784313725, - 0.08235294117647057, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.09411764705882353, - 0.12156862745098039, - 0.08627450980392157, - 0.08235294117647057, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.13333333333333333, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.09803921568627452, - 0.07450980392156863, - 0.11372549019607843, - 0.07058823529411765, - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.09019607843137255, - 0.12549019607843137, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.06274509803921569, - 0.09019607843137255, - 0.10980392156862745, - 0.10588235294117647, - 0.17254901960784313, - 0.9254901960784313, - 0.8745098039215686, - 0.8941176470588236, - 0.8627450980392157, - 0.8745098039215686, - 0.8666666666666667, - 0.8823529411764706, - 0.8274509803921568, - 0.8901960784313725, - 0.8431372549019608, - 0.7882352941176471, - 0.807843137254902, - 0.8784313725490196, - 0.8705882352941177, - 0.8196078431372549, - 0.7803921568627452, - 0.6705882352941175, - 0.7254901960784313, - 0.6980392156862745, - 0.6941176470588235, - 0.6705882352941175, - 0.6901960784313725, - 0.6078431372549019, - 0.6431372549019607, - 0.43529411764705883, - 0.6980392156862745, - 0.4, - 0.7137254901960784, - 0.6823529411764706, - 0.8352941176470589, - 0.48627450980392156, - 0.47843137254901963, - 0.5882352941176471, - 0.5019607843137255, - 0.4549019607843137, - 0.3411764705882353, - 0.6470588235294117, - 0.29411764705882354, - 0.2235294117647059, - 0.30980392156862746, - 0.13725490196078433, - 0.2235294117647059, - 0.10196078431372549, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.0588235294117647, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.047058823529411764, - 0.07058823529411765, - 0.09803921568627452, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667 + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.054901960784313725, + 0.08235294117647057, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.09411764705882353, + 0.12156862745098039, + 0.08627450980392157, + 0.08235294117647057, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.13333333333333333, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.09803921568627452, + 0.07450980392156863, + 0.11372549019607843, + 0.07058823529411765, + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.09019607843137255, + 0.12549019607843137, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.06274509803921569, + 0.09019607843137255, + 0.10980392156862745, + 0.10588235294117647, + 0.17254901960784313, + 0.9254901960784313, + 0.8745098039215686, + 0.8941176470588236, + 0.8627450980392157, + 0.8745098039215686, + 0.8666666666666667, + 0.8823529411764706, + 0.8274509803921568, + 0.8901960784313725, + 0.8431372549019608, + 0.7882352941176471, + 0.807843137254902, + 0.8784313725490196, + 0.8705882352941177, + 0.8196078431372549, + 0.7803921568627452, + 0.6705882352941175, + 0.7254901960784313, + 0.6980392156862745, + 0.6941176470588235, + 0.6705882352941175, + 0.6901960784313725, + 0.6078431372549019, + 0.6431372549019607, + 0.43529411764705883, + 0.6980392156862745, + 0.4, + 0.7137254901960784, + 0.6823529411764706, + 0.8352941176470589, + 0.48627450980392156, + 0.47843137254901963, + 0.5882352941176471, + 0.5019607843137255, + 0.4549019607843137, + 0.3411764705882353, + 0.6470588235294117, + 0.29411764705882354, + 0.2235294117647059, + 0.30980392156862746, + 0.13725490196078433, + 0.2235294117647059, + 0.10196078431372549, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.0588235294117647, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.047058823529411764, + 0.07058823529411765, + 0.09803921568627452, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667 ], [ - 0.08627450980392157, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.08235294117647057, - 0.09019607843137255, - 0.09411764705882353, - 0.07058823529411765, - 0.12549019607843137, - 0.09803921568627452, - 0.08235294117647057, - 0.08235294117647057, - 0.10196078431372549, - 0.0588235294117647, - 0.08627450980392157, - 0.10980392156862745, - 0.09019607843137255, - 0.050980392156862744, - 0.06666666666666667, - 0.08235294117647057, - 0.06666666666666667, - 0.10196078431372549, - 0.0784313725490196, - 0.13725490196078433, - 0.07058823529411765, - 0.07450980392156863, - 0.11372549019607843, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.09803921568627452, - 0.07450980392156863, - 0.07058823529411765, - 0.37254901960784315, - 0.8431372549019608, - 0.7686274509803923, - 0.7725490196078433, - 0.8313725490196079, - 0.8431372549019608, - 0.8627450980392157, - 0.7725490196078433, - 0.8117647058823529, - 0.8862745098039215, - 0.8745098039215686, - 0.7372549019607844, - 0.8235294117647058, - 0.7843137254901962, - 0.7725490196078433, - 0.8117647058823529, - 0.8235294117647058, - 0.7607843137254902, - 0.7921568627450981, - 0.8509803921568627, - 0.6941176470588235, - 0.7372549019607844, - 0.6627450980392156, - 0.7019607843137254, - 0.611764705882353, - 0.611764705882353, - 0.596078431372549, - 0.5686274509803921, - 0.5843137254901961, - 0.4117647058823529, - 0.6941176470588235, - 0.6313725490196078, - 0.7921568627450981, - 0.5019607843137255, - 0.42745098039215684, - 0.44313725490196076, - 0.49411764705882355, - 0.22745098039215686, - 0.4705882352941176, - 0.6627450980392156, - 0.20784313725490197, - 0.2627450980392157, - 0.3254901960784313, - 0.09411764705882353, - 0.09411764705882353, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.09019607843137255, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.10196078431372549 + 0.08627450980392157, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.08235294117647057, + 0.09019607843137255, + 0.09411764705882353, + 0.07058823529411765, + 0.12549019607843137, + 0.09803921568627452, + 0.08235294117647057, + 0.08235294117647057, + 0.10196078431372549, + 0.0588235294117647, + 0.08627450980392157, + 0.10980392156862745, + 0.09019607843137255, + 0.050980392156862744, + 0.06666666666666667, + 0.08235294117647057, + 0.06666666666666667, + 0.10196078431372549, + 0.0784313725490196, + 0.13725490196078433, + 0.07058823529411765, + 0.07450980392156863, + 0.11372549019607843, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.09803921568627452, + 0.07450980392156863, + 0.07058823529411765, + 0.37254901960784315, + 0.8431372549019608, + 0.7686274509803923, + 0.7725490196078433, + 0.8313725490196079, + 0.8431372549019608, + 0.8627450980392157, + 0.7725490196078433, + 0.8117647058823529, + 0.8862745098039215, + 0.8745098039215686, + 0.7372549019607844, + 0.8235294117647058, + 0.7843137254901962, + 0.7725490196078433, + 0.8117647058823529, + 0.8235294117647058, + 0.7607843137254902, + 0.7921568627450981, + 0.8509803921568627, + 0.6941176470588235, + 0.7372549019607844, + 0.6627450980392156, + 0.7019607843137254, + 0.611764705882353, + 0.611764705882353, + 0.596078431372549, + 0.5686274509803921, + 0.5843137254901961, + 0.4117647058823529, + 0.6941176470588235, + 0.6313725490196078, + 0.7921568627450981, + 0.5019607843137255, + 0.42745098039215684, + 0.44313725490196076, + 0.49411764705882355, + 0.22745098039215686, + 0.4705882352941176, + 0.6627450980392156, + 0.20784313725490197, + 0.2627450980392157, + 0.3254901960784313, + 0.09411764705882353, + 0.09411764705882353, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.09019607843137255, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.10196078431372549 ], [ - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.11372549019607843, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.06666666666666667, - 0.08627450980392157, - 0.08235294117647057, - 0.050980392156862744, - 0.07058823529411765, - 0.08235294117647057, - 0.09803921568627452, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.09803921568627452, - 0.10980392156862745, - 0.0784313725490196, - 0.07058823529411765, - 0.08235294117647057, - 0.08235294117647057, - 0.09019607843137255, - 0.07450980392156863, - 0.09803921568627452, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.08627450980392157, - 0.0784313725490196, - 0.16862745098039217, - 0.10980392156862745, - 0.9215686274509803, - 0.8588235294117647, - 0.9019607843137255, - 0.8627450980392157, - 0.8627450980392157, - 0.8313725490196079, - 0.8235294117647058, - 0.8745098039215686, - 0.8196078431372549, - 0.8901960784313725, - 0.8705882352941177, - 0.8431372549019608, - 0.8235294117647058, - 0.803921568627451, - 0.6588235294117646, - 0.803921568627451, - 0.7490196078431373, - 0.7882352941176471, - 0.6941176470588235, - 0.7294117647058823, - 0.6235294117647059, - 0.7215686274509804, - 0.7568627450980392, - 0.5725490196078431, - 0.6980392156862745, - 0.6980392156862745, - 0.6470588235294117, - 0.49411764705882355, - 0.49019607843137253, - 0.27058823529411763, - 0.32156862745098036, - 0.6784313725490196, - 0.592156862745098, - 0.6039215686274509, - 0.5019607843137255, - 0.29411764705882354, - 0.2627450980392157, - 0.33333333333333326, - 0.3294117647058823, - 0.7137254901960784, - 0.2627450980392157, - 0.25098039215686274, - 0.23137254901960783, - 0.21568627450980393, - 0.08235294117647057, - 0.07058823529411765, - 0.050980392156862744, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863 + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.11372549019607843, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.06666666666666667, + 0.08627450980392157, + 0.08235294117647057, + 0.050980392156862744, + 0.07058823529411765, + 0.08235294117647057, + 0.09803921568627452, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.09803921568627452, + 0.10980392156862745, + 0.0784313725490196, + 0.07058823529411765, + 0.08235294117647057, + 0.08235294117647057, + 0.09019607843137255, + 0.07450980392156863, + 0.09803921568627452, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.08627450980392157, + 0.0784313725490196, + 0.16862745098039217, + 0.10980392156862745, + 0.9215686274509803, + 0.8588235294117647, + 0.9019607843137255, + 0.8627450980392157, + 0.8627450980392157, + 0.8313725490196079, + 0.8235294117647058, + 0.8745098039215686, + 0.8196078431372549, + 0.8901960784313725, + 0.8705882352941177, + 0.8431372549019608, + 0.8235294117647058, + 0.803921568627451, + 0.6588235294117646, + 0.803921568627451, + 0.7490196078431373, + 0.7882352941176471, + 0.6941176470588235, + 0.7294117647058823, + 0.6235294117647059, + 0.7215686274509804, + 0.7568627450980392, + 0.5725490196078431, + 0.6980392156862745, + 0.6980392156862745, + 0.6470588235294117, + 0.49411764705882355, + 0.49019607843137253, + 0.27058823529411763, + 0.32156862745098036, + 0.6784313725490196, + 0.592156862745098, + 0.6039215686274509, + 0.5019607843137255, + 0.29411764705882354, + 0.2627450980392157, + 0.33333333333333326, + 0.3294117647058823, + 0.7137254901960784, + 0.2627450980392157, + 0.25098039215686274, + 0.23137254901960783, + 0.21568627450980393, + 0.08235294117647057, + 0.07058823529411765, + 0.050980392156862744, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.06274509803921569, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.08627450980392157, - 0.07058823529411765, - 0.08235294117647057, - 0.1568627450980392, - 0.08235294117647057, - 0.0784313725490196, - 0.07450980392156863, - 0.12156862745098039, - 0.0784313725490196, - 0.10588235294117647, - 0.09411764705882353, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.10196078431372549, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.09411764705882353, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.08627450980392157, - 0.07058823529411765, - 0.7882352941176471, - 0.8509803921568627, - 0.9294117647058823, - 0.9098039215686274, - 0.8823529411764706, - 0.8313725490196079, - 0.8549019607843137, - 0.8235294117647058, - 0.8196078431372549, - 0.8588235294117647, - 0.7843137254901962, - 0.803921568627451, - 0.8627450980392157, - 0.8666666666666667, - 0.7568627450980392, - 0.6862745098039216, - 0.7019607843137254, - 0.8, - 0.7490196078431373, - 0.7803921568627452, - 0.7019607843137254, - 0.7372549019607844, - 0.7647058823529411, - 0.6745098039215687, - 0.6196078431372549, - 0.7294117647058823, - 0.8470588235294118, - 0.7372549019607844, - 0.35294117647058826, - 0.5843137254901961, - 0.3411764705882353, - 0.34509803921568627, - 0.21176470588235294, - 0.29411764705882354, - 0.5215686274509804, - 0.47843137254901963, - 0.47450980392156855, - 0.26666666666666666, - 0.28627450980392155, - 0.2901960784313726, - 0.8470588235294118, - 0.35294117647058826, - 0.2549019607843137, - 0.25098039215686274, - 0.10588235294117647, - 0.10196078431372549, - 0.09411764705882353, - 0.10196078431372549, - 0.11372549019607843, - 0.08235294117647057, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.13333333333333333, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765 + 0.06274509803921569, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.08627450980392157, + 0.07058823529411765, + 0.08235294117647057, + 0.1568627450980392, + 0.08235294117647057, + 0.0784313725490196, + 0.07450980392156863, + 0.12156862745098039, + 0.0784313725490196, + 0.10588235294117647, + 0.09411764705882353, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.10196078431372549, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.09411764705882353, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.08627450980392157, + 0.07058823529411765, + 0.7882352941176471, + 0.8509803921568627, + 0.9294117647058823, + 0.9098039215686274, + 0.8823529411764706, + 0.8313725490196079, + 0.8549019607843137, + 0.8235294117647058, + 0.8196078431372549, + 0.8588235294117647, + 0.7843137254901962, + 0.803921568627451, + 0.8627450980392157, + 0.8666666666666667, + 0.7568627450980392, + 0.6862745098039216, + 0.7019607843137254, + 0.8, + 0.7490196078431373, + 0.7803921568627452, + 0.7019607843137254, + 0.7372549019607844, + 0.7647058823529411, + 0.6745098039215687, + 0.6196078431372549, + 0.7294117647058823, + 0.8470588235294118, + 0.7372549019607844, + 0.35294117647058826, + 0.5843137254901961, + 0.3411764705882353, + 0.34509803921568627, + 0.21176470588235294, + 0.29411764705882354, + 0.5215686274509804, + 0.47843137254901963, + 0.47450980392156855, + 0.26666666666666666, + 0.28627450980392155, + 0.2901960784313726, + 0.8470588235294118, + 0.35294117647058826, + 0.2549019607843137, + 0.25098039215686274, + 0.10588235294117647, + 0.10196078431372549, + 0.09411764705882353, + 0.10196078431372549, + 0.11372549019607843, + 0.08235294117647057, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.13333333333333333, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.15294117647058825, - 0.0784313725490196, - 0.047058823529411764, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.0588235294117647, - 0.06274509803921569, - 0.10588235294117647, - 0.08235294117647057, - 0.0784313725490196, - 0.0588235294117647, - 0.09803921568627452, - 0.09411764705882353, - 0.0588235294117647, - 0.13725490196078433, - 0.06274509803921569, - 0.06274509803921569, - 0.09411764705882353, - 0.07058823529411765, - 0.10196078431372549, - 0.09411764705882353, - 0.054901960784313725, - 0.07058823529411765, - 0.09411764705882353, - 0.06666666666666667, - 0.08627450980392157, - 0.09019607843137255, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09411764705882353, - 0.10196078431372549, - 0.16470588235294115, - 0.8313725490196079, - 0.8627450980392157, - 0.8745098039215686, - 0.9372549019607842, - 0.8509803921568627, - 0.8470588235294118, - 0.8666666666666667, - 0.8196078431372549, - 0.7921568627450981, - 0.9529411764705881, - 0.7686274509803923, - 0.8, - 0.8235294117647058, - 0.8666666666666667, - 0.8392156862745098, - 0.8705882352941177, - 0.9215686274509803, - 0.7294117647058823, - 0.7411764705882353, - 0.7529411764705882, - 0.7882352941176471, - 0.7803921568627452, - 0.7450980392156863, - 0.7843137254901962, - 0.7215686274509804, - 0.7058823529411765, - 0.6666666666666665, - 0.6549019607843136, - 0.6313725490196078, - 0.4705882352941176, - 0.403921568627451, - 0.45098039215686275, - 0.3568627450980392, - 0.09019607843137255, - 0.2235294117647059, - 0.21176470588235294, - 0.5372549019607843, - 0.4705882352941176, - 0.3137254901960784, - 0.21568627450980393, - 0.27450980392156865, - 0.7098039215686275, - 0.4588235294117647, - 0.2627450980392157, - 0.23137254901960783, - 0.14901960784313725, - 0.09803921568627452, - 0.09019607843137255, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.09019607843137255, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.06666666666666667, + 0.15294117647058825, + 0.0784313725490196, + 0.047058823529411764, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.0588235294117647, + 0.06274509803921569, + 0.10588235294117647, + 0.08235294117647057, + 0.0784313725490196, + 0.0588235294117647, + 0.09803921568627452, + 0.09411764705882353, + 0.0588235294117647, + 0.13725490196078433, + 0.06274509803921569, + 0.06274509803921569, + 0.09411764705882353, + 0.07058823529411765, + 0.10196078431372549, + 0.09411764705882353, + 0.054901960784313725, + 0.07058823529411765, + 0.09411764705882353, + 0.06666666666666667, + 0.08627450980392157, + 0.09019607843137255, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09411764705882353, + 0.10196078431372549, + 0.16470588235294115, + 0.8313725490196079, + 0.8627450980392157, + 0.8745098039215686, + 0.9372549019607842, + 0.8509803921568627, + 0.8470588235294118, + 0.8666666666666667, + 0.8196078431372549, + 0.7921568627450981, + 0.9529411764705881, + 0.7686274509803923, + 0.8, + 0.8235294117647058, + 0.8666666666666667, + 0.8392156862745098, + 0.8705882352941177, + 0.9215686274509803, + 0.7294117647058823, + 0.7411764705882353, + 0.7529411764705882, + 0.7882352941176471, + 0.7803921568627452, + 0.7450980392156863, + 0.7843137254901962, + 0.7215686274509804, + 0.7058823529411765, + 0.6666666666666665, + 0.6549019607843136, + 0.6313725490196078, + 0.4705882352941176, + 0.403921568627451, + 0.45098039215686275, + 0.3568627450980392, + 0.09019607843137255, + 0.2235294117647059, + 0.21176470588235294, + 0.5372549019607843, + 0.4705882352941176, + 0.3137254901960784, + 0.21568627450980393, + 0.27450980392156865, + 0.7098039215686275, + 0.4588235294117647, + 0.2627450980392157, + 0.23137254901960783, + 0.14901960784313725, + 0.09803921568627452, + 0.09019607843137255, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.09019607843137255, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.09019607843137255, - 0.054901960784313725, - 0.06666666666666667, - 0.054901960784313725, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.08235294117647057, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.08627450980392157, - 0.10196078431372549, - 0.09019607843137255, - 0.09411764705882353, - 0.0784313725490196, - 0.09019607843137255, - 0.1176470588235294, - 0.0784313725490196, - 0.09019607843137255, - 0.09019607843137255, - 0.09019607843137255, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.08235294117647057, - 0.08235294117647057, - 0.09411764705882353, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.0784313725490196, - 0.047058823529411764, - 0.33333333333333326, - 0.8156862745098039, - 0.7450980392156863, - 0.7803921568627452, - 0.8470588235294118, - 0.9254901960784313, - 0.8392156862745098, - 0.8823529411764706, - 0.7372549019607844, - 0.8705882352941177, - 0.8117647058823529, - 0.7215686274509804, - 0.7843137254901962, - 0.8, - 0.7450980392156863, - 0.8862745098039215, - 0.6588235294117646, - 0.803921568627451, - 0.7921568627450981, - 0.8156862745098039, - 0.7294117647058823, - 0.8313725490196079, - 0.8313725490196079, - 0.6745098039215687, - 0.7450980392156863, - 0.7607843137254902, - 0.7450980392156863, - 0.6745098039215687, - 0.7058823529411765, - 0.6431372549019607, - 0.7372549019607844, - 0.40784313725490196, - 0.30980392156862746, - 0.3764705882352941, - 0.2823529411764706, - 0.09803921568627452, - 0.1176470588235294, - 0.36470588235294116, - 0.46274509803921565, - 0.44313725490196076, - 0.2784313725490196, - 0.33333333333333326, - 0.9098039215686274, - 0.5529411764705883, - 0.2627450980392157, - 0.23921568627450981, - 0.28627450980392155, - 0.10196078431372549, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.050980392156862744, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.09019607843137255, + 0.054901960784313725, + 0.06666666666666667, + 0.054901960784313725, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.08235294117647057, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.08627450980392157, + 0.10196078431372549, + 0.09019607843137255, + 0.09411764705882353, + 0.0784313725490196, + 0.09019607843137255, + 0.1176470588235294, + 0.0784313725490196, + 0.09019607843137255, + 0.09019607843137255, + 0.09019607843137255, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.08235294117647057, + 0.08235294117647057, + 0.09411764705882353, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.0784313725490196, + 0.047058823529411764, + 0.33333333333333326, + 0.8156862745098039, + 0.7450980392156863, + 0.7803921568627452, + 0.8470588235294118, + 0.9254901960784313, + 0.8392156862745098, + 0.8823529411764706, + 0.7372549019607844, + 0.8705882352941177, + 0.8117647058823529, + 0.7215686274509804, + 0.7843137254901962, + 0.8, + 0.7450980392156863, + 0.8862745098039215, + 0.6588235294117646, + 0.803921568627451, + 0.7921568627450981, + 0.8156862745098039, + 0.7294117647058823, + 0.8313725490196079, + 0.8313725490196079, + 0.6745098039215687, + 0.7450980392156863, + 0.7607843137254902, + 0.7450980392156863, + 0.6745098039215687, + 0.7058823529411765, + 0.6431372549019607, + 0.7372549019607844, + 0.40784313725490196, + 0.30980392156862746, + 0.3764705882352941, + 0.2823529411764706, + 0.09803921568627452, + 0.1176470588235294, + 0.36470588235294116, + 0.46274509803921565, + 0.44313725490196076, + 0.2784313725490196, + 0.33333333333333326, + 0.9098039215686274, + 0.5529411764705883, + 0.2627450980392157, + 0.23921568627450981, + 0.28627450980392155, + 0.10196078431372549, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.050980392156862744, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.047058823529411764, - 0.0784313725490196, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.0784313725490196, - 0.06274509803921569, - 0.09803921568627452, - 0.0784313725490196, - 0.0588235294117647, - 0.08235294117647057, - 0.08235294117647057, - 0.09803921568627452, - 0.07450980392156863, - 0.06274509803921569, - 0.10588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.0784313725490196, - 0.12549019607843137, - 0.07058823529411765, - 0.08235294117647057, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.8549019607843137, - 0.7686274509803923, - 0.9019607843137255, - 0.8509803921568627, - 0.8117647058823529, - 0.8156862745098039, - 0.8941176470588236, - 0.8705882352941177, - 0.8588235294117647, - 0.7450980392156863, - 0.8823529411764706, - 0.803921568627451, - 0.8392156862745098, - 0.7686274509803923, - 0.7254901960784313, - 0.7215686274509804, - 0.8901960784313725, - 0.8862745098039215, - 0.7490196078431373, - 0.7843137254901962, - 0.7843137254901962, - 0.7450980392156863, - 0.6823529411764706, - 0.803921568627451, - 0.8117647058823529, - 0.7137254901960784, - 0.6901960784313725, - 0.7294117647058823, - 0.7294117647058823, - 0.5882352941176471, - 0.5411764705882353, - 0.43529411764705883, - 0.4117647058823529, - 0.48627450980392156, - 0.23921568627450981, - 0.35294117647058826, - 0.27450980392156865, - 0.23137254901960783, - 0.3176470588235294, - 0.49019607843137253, - 0.3882352941176471, - 0.29411764705882354, - 0.807843137254902, - 0.5372549019607843, - 0.23921568627450981, - 0.25098039215686274, - 0.4470588235294118, - 0.14901960784313725, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.054901960784313725, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765 + 0.06666666666666667, + 0.047058823529411764, + 0.0784313725490196, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.0784313725490196, + 0.06274509803921569, + 0.09803921568627452, + 0.0784313725490196, + 0.0588235294117647, + 0.08235294117647057, + 0.08235294117647057, + 0.09803921568627452, + 0.07450980392156863, + 0.06274509803921569, + 0.10588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.0784313725490196, + 0.12549019607843137, + 0.07058823529411765, + 0.08235294117647057, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.8549019607843137, + 0.7686274509803923, + 0.9019607843137255, + 0.8509803921568627, + 0.8117647058823529, + 0.8156862745098039, + 0.8941176470588236, + 0.8705882352941177, + 0.8588235294117647, + 0.7450980392156863, + 0.8823529411764706, + 0.803921568627451, + 0.8392156862745098, + 0.7686274509803923, + 0.7254901960784313, + 0.7215686274509804, + 0.8901960784313725, + 0.8862745098039215, + 0.7490196078431373, + 0.7843137254901962, + 0.7843137254901962, + 0.7450980392156863, + 0.6823529411764706, + 0.803921568627451, + 0.8117647058823529, + 0.7137254901960784, + 0.6901960784313725, + 0.7294117647058823, + 0.7294117647058823, + 0.5882352941176471, + 0.5411764705882353, + 0.43529411764705883, + 0.4117647058823529, + 0.48627450980392156, + 0.23921568627450981, + 0.35294117647058826, + 0.27450980392156865, + 0.23137254901960783, + 0.3176470588235294, + 0.49019607843137253, + 0.3882352941176471, + 0.29411764705882354, + 0.807843137254902, + 0.5372549019607843, + 0.23921568627450981, + 0.25098039215686274, + 0.4470588235294118, + 0.14901960784313725, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.054901960784313725, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765 ], [ - 0.09803921568627452, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.08627450980392157, - 0.08627450980392157, - 0.06666666666666667, - 0.08627450980392157, - 0.07058823529411765, - 0.0784313725490196, - 0.08627450980392157, - 0.06666666666666667, - 0.10196078431372549, - 0.10980392156862745, - 0.08627450980392157, - 0.06666666666666667, - 0.0784313725490196, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.10196078431372549, - 0.10588235294117647, - 0.1411764705882353, - 0.8431372549019608, - 0.6588235294117646, - 0.8666666666666667, - 0.8745098039215686, - 0.7372549019607844, - 0.7843137254901962, - 0.7058823529411765, - 0.8431372549019608, - 0.8901960784313725, - 0.8117647058823529, - 0.8705882352941177, - 0.7137254901960784, - 0.8313725490196079, - 0.7764705882352942, - 0.7098039215686275, - 0.7568627450980392, - 0.7372549019607844, - 0.8745098039215686, - 0.8588235294117647, - 0.7882352941176471, - 0.8470588235294118, - 0.803921568627451, - 0.8392156862745098, - 0.7764705882352942, - 0.7372549019607844, - 0.7098039215686275, - 0.7607843137254902, - 0.6588235294117646, - 0.611764705882353, - 0.3921568627450981, - 0.23921568627450981, - 0.30980392156862746, - 0.43137254901960786, - 0.2980392156862745, - 0.3294117647058823, - 0.3921568627450981, - 0.2627450980392157, - 0.4392156862745098, - 0.2627450980392157, - 0.34509803921568627, - 0.43137254901960786, - 0.40784313725490196, - 0.6431372549019607, - 0.6745098039215687, - 0.2627450980392157, - 0.25098039215686274, - 0.34901960784313724, - 0.43529411764705883, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.09019607843137255, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.09803921568627452, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.08627450980392157, + 0.08627450980392157, + 0.06666666666666667, + 0.08627450980392157, + 0.07058823529411765, + 0.0784313725490196, + 0.08627450980392157, + 0.06666666666666667, + 0.10196078431372549, + 0.10980392156862745, + 0.08627450980392157, + 0.06666666666666667, + 0.0784313725490196, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.10196078431372549, + 0.10588235294117647, + 0.1411764705882353, + 0.8431372549019608, + 0.6588235294117646, + 0.8666666666666667, + 0.8745098039215686, + 0.7372549019607844, + 0.7843137254901962, + 0.7058823529411765, + 0.8431372549019608, + 0.8901960784313725, + 0.8117647058823529, + 0.8705882352941177, + 0.7137254901960784, + 0.8313725490196079, + 0.7764705882352942, + 0.7098039215686275, + 0.7568627450980392, + 0.7372549019607844, + 0.8745098039215686, + 0.8588235294117647, + 0.7882352941176471, + 0.8470588235294118, + 0.803921568627451, + 0.8392156862745098, + 0.7764705882352942, + 0.7372549019607844, + 0.7098039215686275, + 0.7607843137254902, + 0.6588235294117646, + 0.611764705882353, + 0.3921568627450981, + 0.23921568627450981, + 0.30980392156862746, + 0.43137254901960786, + 0.2980392156862745, + 0.3294117647058823, + 0.3921568627450981, + 0.2627450980392157, + 0.4392156862745098, + 0.2627450980392157, + 0.34509803921568627, + 0.43137254901960786, + 0.40784313725490196, + 0.6431372549019607, + 0.6745098039215687, + 0.2627450980392157, + 0.25098039215686274, + 0.34901960784313724, + 0.43529411764705883, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.09019607843137255, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.11372549019607843, - 0.10196078431372549, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.10588235294117647, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.12549019607843137, - 0.043137254901960784, - 0.06274509803921569, - 0.07058823529411765, - 0.08627450980392157, - 0.09019607843137255, - 0.06666666666666667, - 0.10980392156862745, - 0.10588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.054901960784313725, - 0.09411764705882353, - 0.0588235294117647, - 0.08627450980392157, - 0.12156862745098039, - 0.7764705882352942, - 0.8470588235294118, - 0.7647058823529411, - 0.8392156862745098, - 0.8392156862745098, - 0.7607843137254902, - 0.8156862745098039, - 0.8431372549019608, - 0.7294117647058823, - 0.9137254901960784, - 0.8549019607843137, - 0.7450980392156863, - 0.7607843137254902, - 0.8196078431372549, - 0.7215686274509804, - 0.6784313725490196, - 0.6862745098039216, - 0.6745098039215687, - 0.7137254901960784, - 0.7647058823529411, - 0.8, - 0.7803921568627452, - 0.8784313725490196, - 0.7254901960784313, - 0.7921568627450981, - 0.7529411764705882, - 0.47450980392156855, - 0.6078431372549019, - 0.6980392156862745, - 0.7019607843137254, - 0.38431372549019616, - 0.3254901960784313, - 0.30980392156862746, - 0.33333333333333326, - 0.3686274509803922, - 0.33725490196078434, - 0.36470588235294116, - 0.2901960784313726, - 0.3803921568627451, - 0.4, - 0.3254901960784313, - 0.33725490196078434, - 0.32156862745098036, - 0.6823529411764706, - 0.7843137254901962, - 0.36470588235294116, - 0.2980392156862745, - 0.33725490196078434, - 0.4470588235294118, - 0.13725490196078433, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.09019607843137255, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.11372549019607843, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057 + 0.07058823529411765, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.11372549019607843, + 0.10196078431372549, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.10588235294117647, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.12549019607843137, + 0.043137254901960784, + 0.06274509803921569, + 0.07058823529411765, + 0.08627450980392157, + 0.09019607843137255, + 0.06666666666666667, + 0.10980392156862745, + 0.10588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.054901960784313725, + 0.09411764705882353, + 0.0588235294117647, + 0.08627450980392157, + 0.12156862745098039, + 0.7764705882352942, + 0.8470588235294118, + 0.7647058823529411, + 0.8392156862745098, + 0.8392156862745098, + 0.7607843137254902, + 0.8156862745098039, + 0.8431372549019608, + 0.7294117647058823, + 0.9137254901960784, + 0.8549019607843137, + 0.7450980392156863, + 0.7607843137254902, + 0.8196078431372549, + 0.7215686274509804, + 0.6784313725490196, + 0.6862745098039216, + 0.6745098039215687, + 0.7137254901960784, + 0.7647058823529411, + 0.8, + 0.7803921568627452, + 0.8784313725490196, + 0.7254901960784313, + 0.7921568627450981, + 0.7529411764705882, + 0.47450980392156855, + 0.6078431372549019, + 0.6980392156862745, + 0.7019607843137254, + 0.38431372549019616, + 0.3254901960784313, + 0.30980392156862746, + 0.33333333333333326, + 0.3686274509803922, + 0.33725490196078434, + 0.36470588235294116, + 0.2901960784313726, + 0.3803921568627451, + 0.4, + 0.3254901960784313, + 0.33725490196078434, + 0.32156862745098036, + 0.6823529411764706, + 0.7843137254901962, + 0.36470588235294116, + 0.2980392156862745, + 0.33725490196078434, + 0.4470588235294118, + 0.13725490196078433, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.09019607843137255, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.11372549019607843, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057 ], [ - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.050980392156862744, - 0.07450980392156863, - 0.06666666666666667, - 0.08235294117647057, - 0.10196078431372549, - 0.0784313725490196, - 0.06666666666666667, - 0.10588235294117647, - 0.08627450980392157, - 0.06666666666666667, - 0.08235294117647057, - 0.10196078431372549, - 0.09019607843137255, - 0.09803921568627452, - 0.10588235294117647, - 0.047058823529411764, - 0.08627450980392157, - 0.06274509803921569, - 0.054901960784313725, - 0.09411764705882353, - 0.050980392156862744, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.09803921568627452, - 0.0588235294117647, - 0.08235294117647057, - 0.0784313725490196, - 0.7098039215686275, - 0.7019607843137254, - 0.7137254901960784, - 0.6549019607843136, - 0.7137254901960784, - 0.8705882352941177, - 0.8823529411764706, - 0.7843137254901962, - 0.9098039215686274, - 0.7725490196078433, - 0.803921568627451, - 0.8627450980392157, - 0.6823529411764706, - 0.6980392156862745, - 0.5843137254901961, - 0.5254901960784314, - 0.6313725490196078, - 0.6627450980392156, - 0.6823529411764706, - 0.7098039215686275, - 0.7098039215686275, - 0.6784313725490196, - 0.6705882352941175, - 0.7058823529411765, - 0.7098039215686275, - 0.34509803921568627, - 0.6039215686274509, - 0.5568627450980392, - 0.7098039215686275, - 0.5882352941176471, - 0.33725490196078434, - 0.1450980392156863, - 0.3254901960784313, - 0.1411764705882353, - 0.38431372549019616, - 0.2352941176470588, - 0.2823529411764706, - 0.3176470588235294, - 0.30980392156862746, - 0.24313725490196078, - 0.35294117647058826, - 0.2196078431372549, - 0.4, - 0.5843137254901961, - 0.7411764705882353, - 0.30196078431372547, - 0.2823529411764706, - 0.29411764705882354, - 0.4549019607843137, - 0.09019607843137255, - 0.0588235294117647, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.09019607843137255, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.09803921568627452, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765 + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.050980392156862744, + 0.07450980392156863, + 0.06666666666666667, + 0.08235294117647057, + 0.10196078431372549, + 0.0784313725490196, + 0.06666666666666667, + 0.10588235294117647, + 0.08627450980392157, + 0.06666666666666667, + 0.08235294117647057, + 0.10196078431372549, + 0.09019607843137255, + 0.09803921568627452, + 0.10588235294117647, + 0.047058823529411764, + 0.08627450980392157, + 0.06274509803921569, + 0.054901960784313725, + 0.09411764705882353, + 0.050980392156862744, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.09803921568627452, + 0.0588235294117647, + 0.08235294117647057, + 0.0784313725490196, + 0.7098039215686275, + 0.7019607843137254, + 0.7137254901960784, + 0.6549019607843136, + 0.7137254901960784, + 0.8705882352941177, + 0.8823529411764706, + 0.7843137254901962, + 0.9098039215686274, + 0.7725490196078433, + 0.803921568627451, + 0.8627450980392157, + 0.6823529411764706, + 0.6980392156862745, + 0.5843137254901961, + 0.5254901960784314, + 0.6313725490196078, + 0.6627450980392156, + 0.6823529411764706, + 0.7098039215686275, + 0.7098039215686275, + 0.6784313725490196, + 0.6705882352941175, + 0.7058823529411765, + 0.7098039215686275, + 0.34509803921568627, + 0.6039215686274509, + 0.5568627450980392, + 0.7098039215686275, + 0.5882352941176471, + 0.33725490196078434, + 0.1450980392156863, + 0.3254901960784313, + 0.1411764705882353, + 0.38431372549019616, + 0.2352941176470588, + 0.2823529411764706, + 0.3176470588235294, + 0.30980392156862746, + 0.24313725490196078, + 0.35294117647058826, + 0.2196078431372549, + 0.4, + 0.5843137254901961, + 0.7411764705882353, + 0.30196078431372547, + 0.2823529411764706, + 0.29411764705882354, + 0.4549019607843137, + 0.09019607843137255, + 0.0588235294117647, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.09019607843137255, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.09803921568627452, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.09411764705882353, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.10196078431372549, - 0.09019607843137255, - 0.07058823529411765, - 0.09411764705882353, - 0.12941176470588237, - 0.06274509803921569, - 0.0784313725490196, - 0.050980392156862744, - 0.07058823529411765, - 0.08235294117647057, - 0.10196078431372549, - 0.08235294117647057, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.06274509803921569, - 0.054901960784313725, - 0.10980392156862745, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.08627450980392157, - 0.0784313725490196, - 0.07450980392156863, - 0.0588235294117647, - 0.19607843137254904, - 0.6, - 0.5490196078431373, - 0.9490196078431371, - 0.9058823529411765, - 0.9215686274509803, - 0.8745098039215686, - 0.9686274509803922, - 0.8980392156862745, - 0.8666666666666667, - 0.6549019607843136, - 0.8, - 0.8274509803921568, - 0.7294117647058823, - 0.6392156862745098, - 0.6431372549019607, - 0.6235294117647059, - 0.6823529411764706, - 0.6078431372549019, - 0.5019607843137255, - 0.5529411764705883, - 0.6901960784313725, - 0.5764705882352941, - 0.7294117647058823, - 0.6588235294117646, - 0.7137254901960784, - 0.27058823529411763, - 0.6, - 0.403921568627451, - 0.2549019607843137, - 0.5568627450980392, - 0.3686274509803922, - 0.37254901960784315, - 0.3411764705882353, - 0.10980392156862745, - 0.29411764705882354, - 0.3176470588235294, - 0.2, - 0.3882352941176471, - 0.2627450980392157, - 0.27450980392156865, - 0.33333333333333326, - 0.27450980392156865, - 0.26666666666666666, - 0.8313725490196079, - 0.7843137254901962, - 0.3607843137254902, - 0.2549019607843137, - 0.2784313725490196, - 0.44313725490196076, - 0.47843137254901963, - 0.10588235294117647, - 0.0392156862745098, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.050980392156862744, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.09411764705882353, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.10196078431372549, + 0.09019607843137255, + 0.07058823529411765, + 0.09411764705882353, + 0.12941176470588237, + 0.06274509803921569, + 0.0784313725490196, + 0.050980392156862744, + 0.07058823529411765, + 0.08235294117647057, + 0.10196078431372549, + 0.08235294117647057, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.06274509803921569, + 0.054901960784313725, + 0.10980392156862745, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.08627450980392157, + 0.0784313725490196, + 0.07450980392156863, + 0.0588235294117647, + 0.19607843137254904, + 0.6, + 0.5490196078431373, + 0.9490196078431371, + 0.9058823529411765, + 0.9215686274509803, + 0.8745098039215686, + 0.9686274509803922, + 0.8980392156862745, + 0.8666666666666667, + 0.6549019607843136, + 0.8, + 0.8274509803921568, + 0.7294117647058823, + 0.6392156862745098, + 0.6431372549019607, + 0.6235294117647059, + 0.6823529411764706, + 0.6078431372549019, + 0.5019607843137255, + 0.5529411764705883, + 0.6901960784313725, + 0.5764705882352941, + 0.7294117647058823, + 0.6588235294117646, + 0.7137254901960784, + 0.27058823529411763, + 0.6, + 0.403921568627451, + 0.2549019607843137, + 0.5568627450980392, + 0.3686274509803922, + 0.37254901960784315, + 0.3411764705882353, + 0.10980392156862745, + 0.29411764705882354, + 0.3176470588235294, + 0.2, + 0.3882352941176471, + 0.2627450980392157, + 0.27450980392156865, + 0.33333333333333326, + 0.27450980392156865, + 0.26666666666666666, + 0.8313725490196079, + 0.7843137254901962, + 0.3607843137254902, + 0.2549019607843137, + 0.2784313725490196, + 0.44313725490196076, + 0.47843137254901963, + 0.10588235294117647, + 0.0392156862745098, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.050980392156862744, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.08235294117647057, - 0.07058823529411765, - 0.09411764705882353, - 0.08235294117647057, - 0.06666666666666667, - 0.08627450980392157, - 0.09019607843137255, - 0.054901960784313725, - 0.0588235294117647, - 0.08627450980392157, - 0.06666666666666667, - 0.0784313725490196, - 0.10196078431372549, - 0.1411764705882353, - 0.06274509803921569, - 0.054901960784313725, - 0.050980392156862744, - 0.07058823529411765, - 0.14901960784313725, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.050980392156862744, - 0.0784313725490196, - 0.09019607843137255, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.1568627450980392, - 0.10980392156862745, - 0.47843137254901963, - 0.9686274509803922, - 0.8588235294117647, - 0.9450980392156861, - 0.9647058823529412, - 0.9607843137254902, - 0.9058823529411765, - 0.9254901960784313, - 0.9411764705882352, - 0.8862745098039215, - 0.7568627450980392, - 0.7294117647058823, - 0.8196078431372549, - 0.7372549019607844, - 0.7607843137254902, - 0.6627450980392156, - 0.6509803921568627, - 0.6784313725490196, - 0.5725490196078431, - 0.3686274509803922, - 0.2980392156862745, - 0.4980392156862745, - 0.5725490196078431, - 0.7058823529411765, - 0.9019607843137255, - 0.08235294117647057, - 0.08235294117647057, - 0.09411764705882353, - 0.10196078431372549, - 0.2549019607843137, - 0.25882352941176473, - 0.38431372549019616, - 0.2196078431372549, - 0.27058823529411763, - 0.1176470588235294, - 0.23921568627450981, - 0.39607843137254906, - 0.12156862745098039, - 0.34901960784313724, - 0.2823529411764706, - 0.3176470588235294, - 0.2901960784313726, - 0.2549019607843137, - 0.8745098039215686, - 0.9372549019607842, - 0.3607843137254902, - 0.23921568627450981, - 0.2549019607843137, - 0.4, - 0.5529411764705883, - 0.12941176470588237, - 0.10980392156862745, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.0588235294117647, - 0.12941176470588237, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647 + 0.08235294117647057, + 0.07058823529411765, + 0.09411764705882353, + 0.08235294117647057, + 0.06666666666666667, + 0.08627450980392157, + 0.09019607843137255, + 0.054901960784313725, + 0.0588235294117647, + 0.08627450980392157, + 0.06666666666666667, + 0.0784313725490196, + 0.10196078431372549, + 0.1411764705882353, + 0.06274509803921569, + 0.054901960784313725, + 0.050980392156862744, + 0.07058823529411765, + 0.14901960784313725, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.050980392156862744, + 0.0784313725490196, + 0.09019607843137255, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.1568627450980392, + 0.10980392156862745, + 0.47843137254901963, + 0.9686274509803922, + 0.8588235294117647, + 0.9450980392156861, + 0.9647058823529412, + 0.9607843137254902, + 0.9058823529411765, + 0.9254901960784313, + 0.9411764705882352, + 0.8862745098039215, + 0.7568627450980392, + 0.7294117647058823, + 0.8196078431372549, + 0.7372549019607844, + 0.7607843137254902, + 0.6627450980392156, + 0.6509803921568627, + 0.6784313725490196, + 0.5725490196078431, + 0.3686274509803922, + 0.2980392156862745, + 0.4980392156862745, + 0.5725490196078431, + 0.7058823529411765, + 0.9019607843137255, + 0.08235294117647057, + 0.08235294117647057, + 0.09411764705882353, + 0.10196078431372549, + 0.2549019607843137, + 0.25882352941176473, + 0.38431372549019616, + 0.2196078431372549, + 0.27058823529411763, + 0.1176470588235294, + 0.23921568627450981, + 0.39607843137254906, + 0.12156862745098039, + 0.34901960784313724, + 0.2823529411764706, + 0.3176470588235294, + 0.2901960784313726, + 0.2549019607843137, + 0.8745098039215686, + 0.9372549019607842, + 0.3607843137254902, + 0.23921568627450981, + 0.2549019607843137, + 0.4, + 0.5529411764705883, + 0.12941176470588237, + 0.10980392156862745, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.0588235294117647, + 0.12941176470588237, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.0784313725490196, - 0.09803921568627452, - 0.07450980392156863, - 0.09411764705882353, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.06666666666666667, - 0.054901960784313725, - 0.08235294117647057, - 0.09803921568627452, - 0.07058823529411765, - 0.054901960784313725, - 0.0588235294117647, - 0.10980392156862745, - 0.0588235294117647, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.09411764705882353, - 0.06666666666666667, - 0.0588235294117647, - 0.09411764705882353, - 0.06666666666666667, - 0.18823529411764706, - 0.9686274509803922, - 0.9215686274509803, - 0.9450980392156861, - 0.9686274509803922, - 0.9450980392156861, - 0.9254901960784313, - 0.9568627450980393, - 0.9215686274509803, - 0.9294117647058823, - 0.9254901960784313, - 0.8156862745098039, - 0.7529411764705882, - 0.6196078431372549, - 0.6509803921568627, - 0.7058823529411765, - 0.6313725490196078, - 0.5607843137254902, - 0.8549019607843137, - 0.38431372549019616, - 0.3882352941176471, - 0.1803921568627451, - 0.3882352941176471, - 0.4666666666666666, - 0.6078431372549019, - 0.4666666666666666, - 0.33333333333333326, - 0.3294117647058823, - 0.09019607843137255, - 0.34509803921568627, - 0.3411764705882353, - 0.3294117647058823, - 0.2823529411764706, - 0.4392156862745098, - 0.2901960784313726, - 0.21176470588235294, - 0.2235294117647059, - 0.3058823529411765, - 0.37254901960784315, - 0.403921568627451, - 0.33725490196078434, - 0.3411764705882353, - 0.2980392156862745, - 0.28627450980392155, - 0.8549019607843137, - 0.9137254901960784, - 0.33333333333333326, - 0.24313725490196078, - 0.30196078431372547, - 0.5843137254901961, - 0.5137254901960784, - 0.16470588235294115, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.09411764705882353, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.10196078431372549 + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.0784313725490196, + 0.09803921568627452, + 0.07450980392156863, + 0.09411764705882353, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.06666666666666667, + 0.054901960784313725, + 0.08235294117647057, + 0.09803921568627452, + 0.07058823529411765, + 0.054901960784313725, + 0.0588235294117647, + 0.10980392156862745, + 0.0588235294117647, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.09411764705882353, + 0.06666666666666667, + 0.0588235294117647, + 0.09411764705882353, + 0.06666666666666667, + 0.18823529411764706, + 0.9686274509803922, + 0.9215686274509803, + 0.9450980392156861, + 0.9686274509803922, + 0.9450980392156861, + 0.9254901960784313, + 0.9568627450980393, + 0.9215686274509803, + 0.9294117647058823, + 0.9254901960784313, + 0.8156862745098039, + 0.7529411764705882, + 0.6196078431372549, + 0.6509803921568627, + 0.7058823529411765, + 0.6313725490196078, + 0.5607843137254902, + 0.8549019607843137, + 0.38431372549019616, + 0.3882352941176471, + 0.1803921568627451, + 0.3882352941176471, + 0.4666666666666666, + 0.6078431372549019, + 0.4666666666666666, + 0.33333333333333326, + 0.3294117647058823, + 0.09019607843137255, + 0.34509803921568627, + 0.3411764705882353, + 0.3294117647058823, + 0.2823529411764706, + 0.4392156862745098, + 0.2901960784313726, + 0.21176470588235294, + 0.2235294117647059, + 0.3058823529411765, + 0.37254901960784315, + 0.403921568627451, + 0.33725490196078434, + 0.3411764705882353, + 0.2980392156862745, + 0.28627450980392155, + 0.8549019607843137, + 0.9137254901960784, + 0.33333333333333326, + 0.24313725490196078, + 0.30196078431372547, + 0.5843137254901961, + 0.5137254901960784, + 0.16470588235294115, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.09411764705882353, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.10196078431372549 ], [ - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.09803921568627452, - 0.0784313725490196, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.12156862745098039, - 0.12156862745098039, - 0.12549019607843137, - 0.06274509803921569, - 0.09019607843137255, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.09803921568627452, - 0.0784313725490196, - 0.5764705882352941, - 0.9568627450980393, - 0.8274509803921568, - 0.9333333333333332, - 0.9725490196078431, - 0.8941176470588236, - 0.9686274509803922, - 0.9254901960784313, - 0.9333333333333332, - 0.9098039215686274, - 0.9176470588235294, - 0.9411764705882352, - 0.9058823529411765, - 0.8274509803921568, - 0.7764705882352942, - 0.6039215686274509, - 0.4117647058823529, - 0.6705882352941175, - 0.8, - 0.7960784313725491, - 0.10588235294117647, - 0.21568627450980393, - 0.45098039215686275, - 0.4, - 0.33725490196078434, - 0.45098039215686275, - 0.2980392156862745, - 0.3764705882352941, - 0.19215686274509808, - 0.20392156862745098, - 0.3803921568627451, - 0.5098039215686274, - 0.3764705882352941, - 0.3803921568627451, - 0.4, - 0.3764705882352941, - 0.23137254901960783, - 0.15294117647058825, - 0.19215686274509808, - 0.32156862745098036, - 0.34509803921568627, - 0.3058823529411765, - 0.0784313725490196, - 0.1843137254901961, - 0.8627450980392157, - 0.6196078431372549, - 0.34509803921568627, - 0.27450980392156865, - 0.24313725490196078, - 0.5333333333333333, - 0.3882352941176471, - 0.10980392156862745, - 0.0588235294117647, - 0.09803921568627452, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.06274509803921569, - 0.10980392156862745, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057 + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.09803921568627452, + 0.0784313725490196, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.12156862745098039, + 0.12156862745098039, + 0.12549019607843137, + 0.06274509803921569, + 0.09019607843137255, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.09803921568627452, + 0.0784313725490196, + 0.5764705882352941, + 0.9568627450980393, + 0.8274509803921568, + 0.9333333333333332, + 0.9725490196078431, + 0.8941176470588236, + 0.9686274509803922, + 0.9254901960784313, + 0.9333333333333332, + 0.9098039215686274, + 0.9176470588235294, + 0.9411764705882352, + 0.9058823529411765, + 0.8274509803921568, + 0.7764705882352942, + 0.6039215686274509, + 0.4117647058823529, + 0.6705882352941175, + 0.8, + 0.7960784313725491, + 0.10588235294117647, + 0.21568627450980393, + 0.45098039215686275, + 0.4, + 0.33725490196078434, + 0.45098039215686275, + 0.2980392156862745, + 0.3764705882352941, + 0.19215686274509808, + 0.20392156862745098, + 0.3803921568627451, + 0.5098039215686274, + 0.3764705882352941, + 0.3803921568627451, + 0.4, + 0.3764705882352941, + 0.23137254901960783, + 0.15294117647058825, + 0.19215686274509808, + 0.32156862745098036, + 0.34509803921568627, + 0.3058823529411765, + 0.0784313725490196, + 0.1843137254901961, + 0.8627450980392157, + 0.6196078431372549, + 0.34509803921568627, + 0.27450980392156865, + 0.24313725490196078, + 0.5333333333333333, + 0.3882352941176471, + 0.10980392156862745, + 0.0588235294117647, + 0.09803921568627452, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.06274509803921569, + 0.10980392156862745, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057 ], [ - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.1176470588235294, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.050980392156862744, - 0.07450980392156863, - 0.08627450980392157, - 0.11372549019607843, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.09803921568627452, - 0.08235294117647057, - 0.13333333333333333, - 0.9411764705882352, - 0.9411764705882352, - 0.7568627450980392, - 0.7882352941176471, - 0.9176470588235294, - 0.9725490196078431, - 0.9490196078431371, - 0.8980392156862745, - 0.9058823529411765, - 0.9058823529411765, - 0.9176470588235294, - 0.8862745098039215, - 0.9294117647058823, - 0.8588235294117647, - 0.8431372549019608, - 0.6980392156862745, - 0.3882352941176471, - 0.4, - 0.5176470588235295, - 0.807843137254902, - 0.4549019607843137, - 0.24705882352941178, - 0.2823529411764706, - 0.27058823529411763, - 0.3058823529411765, - 0.27058823529411763, - 0.4705882352941176, - 0.2901960784313726, - 0.2549019607843137, - 0.34901960784313724, - 0.2627450980392157, - 0.26666666666666666, - 0.35294117647058826, - 0.3921568627450981, - 0.4, - 0.13725490196078433, - 0.3686274509803922, - 0.30196078431372547, - 0.1803921568627451, - 0.1803921568627451, - 0.3058823529411765, - 0.22745098039215686, - 0.13725490196078433, - 0.17647058823529413, - 0.8235294117647058, - 0.7882352941176471, - 0.35294117647058826, - 0.30980392156862746, - 0.25882352941176473, - 0.4666666666666666, - 0.45098039215686275, - 0.25882352941176473, - 0.2627450980392157, - 0.054901960784313725, - 0.0588235294117647, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.11372549019607843, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.09803921568627452 + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.1176470588235294, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.050980392156862744, + 0.07450980392156863, + 0.08627450980392157, + 0.11372549019607843, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.09803921568627452, + 0.08235294117647057, + 0.13333333333333333, + 0.9411764705882352, + 0.9411764705882352, + 0.7568627450980392, + 0.7882352941176471, + 0.9176470588235294, + 0.9725490196078431, + 0.9490196078431371, + 0.8980392156862745, + 0.9058823529411765, + 0.9058823529411765, + 0.9176470588235294, + 0.8862745098039215, + 0.9294117647058823, + 0.8588235294117647, + 0.8431372549019608, + 0.6980392156862745, + 0.3882352941176471, + 0.4, + 0.5176470588235295, + 0.807843137254902, + 0.4549019607843137, + 0.24705882352941178, + 0.2823529411764706, + 0.27058823529411763, + 0.3058823529411765, + 0.27058823529411763, + 0.4705882352941176, + 0.2901960784313726, + 0.2549019607843137, + 0.34901960784313724, + 0.2627450980392157, + 0.26666666666666666, + 0.35294117647058826, + 0.3921568627450981, + 0.4, + 0.13725490196078433, + 0.3686274509803922, + 0.30196078431372547, + 0.1803921568627451, + 0.1803921568627451, + 0.3058823529411765, + 0.22745098039215686, + 0.13725490196078433, + 0.17647058823529413, + 0.8235294117647058, + 0.7882352941176471, + 0.35294117647058826, + 0.30980392156862746, + 0.25882352941176473, + 0.4666666666666666, + 0.45098039215686275, + 0.25882352941176473, + 0.2627450980392157, + 0.054901960784313725, + 0.0588235294117647, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.11372549019607843, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.09803921568627452 ], [ - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.08235294117647057, - 0.054901960784313725, - 0.0784313725490196, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.10196078431372549, - 0.08627450980392157, - 0.08627450980392157, - 0.09803921568627452, - 0.09411764705882353, - 0.07450980392156863, - 0.08627450980392157, - 0.12549019607843137, - 0.08235294117647057, - 0.07450980392156863, - 0.08235294117647057, - 0.09411764705882353, - 0.054901960784313725, - 0.5686274509803921, - 0.8745098039215686, - 0.8313725490196079, - 0.9450980392156861, - 0.8784313725490196, - 0.9411764705882352, - 0.7647058823529411, - 0.8745098039215686, - 0.9137254901960784, - 0.9176470588235294, - 0.9019607843137255, - 0.8627450980392157, - 0.9333333333333332, - 0.9333333333333332, - 0.9372549019607842, - 0.8313725490196079, - 0.8941176470588236, - 0.8235294117647058, - 0.5882352941176471, - 0.3176470588235294, - 0.4196078431372549, - 0.3294117647058823, - 0.25882352941176473, - 0.09411764705882353, - 0.2196078431372549, - 0.2784313725490196, - 0.28627450980392155, - 0.2352941176470588, - 0.40784313725490196, - 0.2196078431372549, - 0.2196078431372549, - 0.10196078431372549, - 0.27450980392156865, - 0.38431372549019616, - 0.3882352941176471, - 0.403921568627451, - 0.2549019607843137, - 0.24313725490196078, - 0.16470588235294115, - 0.24313725490196078, - 0.15294117647058825, - 0.09803921568627452, - 0.3411764705882353, - 0.27058823529411763, - 0.0784313725490196, - 0.9411764705882352, - 0.7803921568627452, - 0.3686274509803922, - 0.33725490196078434, - 0.2352941176470588, - 0.3607843137254902, - 0.49019607843137253, - 0.23137254901960783, - 0.10196078431372549, - 0.06274509803921569, - 0.07450980392156863, - 0.10980392156862745, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.11372549019607843, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.08235294117647057, + 0.054901960784313725, + 0.0784313725490196, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.10196078431372549, + 0.08627450980392157, + 0.08627450980392157, + 0.09803921568627452, + 0.09411764705882353, + 0.07450980392156863, + 0.08627450980392157, + 0.12549019607843137, + 0.08235294117647057, + 0.07450980392156863, + 0.08235294117647057, + 0.09411764705882353, + 0.054901960784313725, + 0.5686274509803921, + 0.8745098039215686, + 0.8313725490196079, + 0.9450980392156861, + 0.8784313725490196, + 0.9411764705882352, + 0.7647058823529411, + 0.8745098039215686, + 0.9137254901960784, + 0.9176470588235294, + 0.9019607843137255, + 0.8627450980392157, + 0.9333333333333332, + 0.9333333333333332, + 0.9372549019607842, + 0.8313725490196079, + 0.8941176470588236, + 0.8235294117647058, + 0.5882352941176471, + 0.3176470588235294, + 0.4196078431372549, + 0.3294117647058823, + 0.25882352941176473, + 0.09411764705882353, + 0.2196078431372549, + 0.2784313725490196, + 0.28627450980392155, + 0.2352941176470588, + 0.40784313725490196, + 0.2196078431372549, + 0.2196078431372549, + 0.10196078431372549, + 0.27450980392156865, + 0.38431372549019616, + 0.3882352941176471, + 0.403921568627451, + 0.2549019607843137, + 0.24313725490196078, + 0.16470588235294115, + 0.24313725490196078, + 0.15294117647058825, + 0.09803921568627452, + 0.3411764705882353, + 0.27058823529411763, + 0.0784313725490196, + 0.9411764705882352, + 0.7803921568627452, + 0.3686274509803922, + 0.33725490196078434, + 0.2352941176470588, + 0.3607843137254902, + 0.49019607843137253, + 0.23137254901960783, + 0.10196078431372549, + 0.06274509803921569, + 0.07450980392156863, + 0.10980392156862745, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.11372549019607843, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.08235294117647057, - 0.08627450980392157, - 0.08235294117647057, - 0.08235294117647057, - 0.0588235294117647, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.10196078431372549, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.10588235294117647, - 0.11372549019607843, - 0.08627450980392157, - 0.07058823529411765, - 0.0784313725490196, - 0.09019607843137255, - 0.08627450980392157, - 0.09803921568627452, - 0.7333333333333333, - 0.8901960784313725, - 0.8901960784313725, - 0.9450980392156861, - 0.9647058823529412, - 0.9686274509803922, - 0.9803921568627451, - 0.9725490196078431, - 0.9450980392156861, - 0.9372549019607842, - 0.9176470588235294, - 0.9490196078431371, - 0.8705882352941177, - 0.9058823529411765, - 0.9294117647058823, - 0.9411764705882352, - 0.8823529411764706, - 0.8862745098039215, - 0.807843137254902, - 0.7215686274509804, - 0.34509803921568627, - 0.25098039215686274, - 0.28627450980392155, - 0.21176470588235294, - 0.25098039215686274, - 0.3411764705882353, - 0.16862745098039217, - 0.18823529411764706, - 0.10980392156862745, - 0.2352941176470588, - 0.3607843137254902, - 0.13725490196078433, - 0.10588235294117647, - 0.34901960784313724, - 0.25882352941176473, - 0.3294117647058823, - 0.32156862745098036, - 0.2901960784313726, - 0.2627450980392157, - 0.44313725490196076, - 0.3411764705882353, - 0.0784313725490196, - 0.22745098039215686, - 0.16470588235294115, - 0.07058823529411765, - 0.5450980392156862, - 0.7921568627450981, - 0.3686274509803922, - 0.27058823529411763, - 0.2196078431372549, - 0.2901960784313726, - 0.4980392156862745, - 0.25098039215686274, - 0.10588235294117647, - 0.09411764705882353, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.0588235294117647, - 0.06274509803921569, - 0.10588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667 + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.08235294117647057, + 0.08627450980392157, + 0.08235294117647057, + 0.08235294117647057, + 0.0588235294117647, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.10196078431372549, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.10588235294117647, + 0.11372549019607843, + 0.08627450980392157, + 0.07058823529411765, + 0.0784313725490196, + 0.09019607843137255, + 0.08627450980392157, + 0.09803921568627452, + 0.7333333333333333, + 0.8901960784313725, + 0.8901960784313725, + 0.9450980392156861, + 0.9647058823529412, + 0.9686274509803922, + 0.9803921568627451, + 0.9725490196078431, + 0.9450980392156861, + 0.9372549019607842, + 0.9176470588235294, + 0.9490196078431371, + 0.8705882352941177, + 0.9058823529411765, + 0.9294117647058823, + 0.9411764705882352, + 0.8823529411764706, + 0.8862745098039215, + 0.807843137254902, + 0.7215686274509804, + 0.34509803921568627, + 0.25098039215686274, + 0.28627450980392155, + 0.21176470588235294, + 0.25098039215686274, + 0.3411764705882353, + 0.16862745098039217, + 0.18823529411764706, + 0.10980392156862745, + 0.2352941176470588, + 0.3607843137254902, + 0.13725490196078433, + 0.10588235294117647, + 0.34901960784313724, + 0.25882352941176473, + 0.3294117647058823, + 0.32156862745098036, + 0.2901960784313726, + 0.2627450980392157, + 0.44313725490196076, + 0.3411764705882353, + 0.0784313725490196, + 0.22745098039215686, + 0.16470588235294115, + 0.07058823529411765, + 0.5450980392156862, + 0.7921568627450981, + 0.3686274509803922, + 0.27058823529411763, + 0.2196078431372549, + 0.2901960784313726, + 0.4980392156862745, + 0.25098039215686274, + 0.10588235294117647, + 0.09411764705882353, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.0588235294117647, + 0.06274509803921569, + 0.10588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667 ], [ - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.09019607843137255, - 0.047058823529411764, - 0.050980392156862744, - 0.12941176470588237, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.08235294117647057, - 0.08627450980392157, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.10588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.09019607843137255, - 0.06274509803921569, - 0.08627450980392157, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.10980392156862745, - 0.6862745098039216, - 0.8352941176470589, - 0.8274509803921568, - 0.7686274509803923, - 0.9294117647058823, - 0.8980392156862745, - 0.9333333333333332, - 0.9294117647058823, - 0.8627450980392157, - 0.8862745098039215, - 0.8980392156862745, - 0.8627450980392157, - 0.7647058823529411, - 0.8941176470588236, - 0.8196078431372549, - 0.8901960784313725, - 0.8980392156862745, - 0.8274509803921568, - 0.8196078431372549, - 0.7372549019607844, - 0.611764705882353, - 0.3294117647058823, - 0.19607843137254904, - 0.08627450980392157, - 0.47450980392156855, - 0.1450980392156863, - 0.11372549019607843, - 0.12156862745098039, - 0.10196078431372549, - 0.12549019607843137, - 0.20392156862745098, - 0.20784313725490197, - 0.16862745098039217, - 0.13725490196078433, - 0.2196078431372549, - 0.10588235294117647, - 0.29411764705882354, - 0.3686274509803922, - 0.22745098039215686, - 0.33725490196078434, - 0.42745098039215684, - 0.33725490196078434, - 0.34509803921568627, - 0.26666666666666666, - 0.16470588235294115, - 0.5215686274509804, - 0.7215686274509804, - 0.34509803921568627, - 0.3176470588235294, - 0.22745098039215686, - 0.2549019607843137, - 0.5019607843137255, - 0.34901960784313724, - 0.17254901960784313, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.043137254901960784, - 0.0784313725490196, - 0.11372549019607843, - 0.07450980392156863, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.09019607843137255, + 0.047058823529411764, + 0.050980392156862744, + 0.12941176470588237, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.08235294117647057, + 0.08627450980392157, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.10588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.09019607843137255, + 0.06274509803921569, + 0.08627450980392157, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.10980392156862745, + 0.6862745098039216, + 0.8352941176470589, + 0.8274509803921568, + 0.7686274509803923, + 0.9294117647058823, + 0.8980392156862745, + 0.9333333333333332, + 0.9294117647058823, + 0.8627450980392157, + 0.8862745098039215, + 0.8980392156862745, + 0.8627450980392157, + 0.7647058823529411, + 0.8941176470588236, + 0.8196078431372549, + 0.8901960784313725, + 0.8980392156862745, + 0.8274509803921568, + 0.8196078431372549, + 0.7372549019607844, + 0.611764705882353, + 0.3294117647058823, + 0.19607843137254904, + 0.08627450980392157, + 0.47450980392156855, + 0.1450980392156863, + 0.11372549019607843, + 0.12156862745098039, + 0.10196078431372549, + 0.12549019607843137, + 0.20392156862745098, + 0.20784313725490197, + 0.16862745098039217, + 0.13725490196078433, + 0.2196078431372549, + 0.10588235294117647, + 0.29411764705882354, + 0.3686274509803922, + 0.22745098039215686, + 0.33725490196078434, + 0.42745098039215684, + 0.33725490196078434, + 0.34509803921568627, + 0.26666666666666666, + 0.16470588235294115, + 0.5215686274509804, + 0.7215686274509804, + 0.34509803921568627, + 0.3176470588235294, + 0.22745098039215686, + 0.2549019607843137, + 0.5019607843137255, + 0.34901960784313724, + 0.17254901960784313, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.043137254901960784, + 0.0784313725490196, + 0.11372549019607843, + 0.07450980392156863, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.054901960784313725, - 0.054901960784313725, - 0.1176470588235294, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.08627450980392157, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.050980392156862744, - 0.06666666666666667, - 0.08235294117647057, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.10980392156862745, - 0.09803921568627452, - 0.2901960784313726, - 0.7333333333333333, - 0.7882352941176471, - 0.7960784313725491, - 0.6392156862745098, - 0.9215686274509803, - 0.9568627450980393, - 0.9137254901960784, - 0.8196078431372549, - 0.8117647058823529, - 0.7568627450980392, - 0.8235294117647058, - 0.7450980392156863, - 0.7960784313725491, - 0.7294117647058823, - 0.8392156862745098, - 0.8235294117647058, - 0.8392156862745098, - 0.8235294117647058, - 0.7764705882352942, - 0.6078431372549019, - 0.5215686274509804, - 0.3568627450980392, - 0.35294117647058826, - 0.27450980392156865, - 0.24313725490196078, - 0.06666666666666667, - 0.09411764705882353, - 0.11372549019607843, - 0.10196078431372549, - 0.19607843137254904, - 0.13333333333333333, - 0.0784313725490196, - 0.2549019607843137, - 0.10980392156862745, - 0.24313725490196078, - 0.13333333333333333, - 0.29411764705882354, - 0.3294117647058823, - 0.38431372549019616, - 0.3607843137254902, - 0.3254901960784313, - 0.29411764705882354, - 0.3254901960784313, - 0.10196078431372549, - 0.21568627450980393, - 0.7882352941176471, - 0.4117647058823529, - 0.34901960784313724, - 0.26666666666666666, - 0.2549019607843137, - 0.6274509803921569, - 0.3058823529411765, - 0.09411764705882353, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.13725490196078433, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569 + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.054901960784313725, + 0.054901960784313725, + 0.1176470588235294, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.08627450980392157, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.050980392156862744, + 0.06666666666666667, + 0.08235294117647057, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.10980392156862745, + 0.09803921568627452, + 0.2901960784313726, + 0.7333333333333333, + 0.7882352941176471, + 0.7960784313725491, + 0.6392156862745098, + 0.9215686274509803, + 0.9568627450980393, + 0.9137254901960784, + 0.8196078431372549, + 0.8117647058823529, + 0.7568627450980392, + 0.8235294117647058, + 0.7450980392156863, + 0.7960784313725491, + 0.7294117647058823, + 0.8392156862745098, + 0.8235294117647058, + 0.8392156862745098, + 0.8235294117647058, + 0.7764705882352942, + 0.6078431372549019, + 0.5215686274509804, + 0.3568627450980392, + 0.35294117647058826, + 0.27450980392156865, + 0.24313725490196078, + 0.06666666666666667, + 0.09411764705882353, + 0.11372549019607843, + 0.10196078431372549, + 0.19607843137254904, + 0.13333333333333333, + 0.0784313725490196, + 0.2549019607843137, + 0.10980392156862745, + 0.24313725490196078, + 0.13333333333333333, + 0.29411764705882354, + 0.3294117647058823, + 0.38431372549019616, + 0.3607843137254902, + 0.3254901960784313, + 0.29411764705882354, + 0.3254901960784313, + 0.10196078431372549, + 0.21568627450980393, + 0.7882352941176471, + 0.4117647058823529, + 0.34901960784313724, + 0.26666666666666666, + 0.2549019607843137, + 0.6274509803921569, + 0.3058823529411765, + 0.09411764705882353, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.13725490196078433, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.09411764705882353, - 0.08235294117647057, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.054901960784313725, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.13333333333333333, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.054901960784313725, - 0.10588235294117647, - 0.11372549019607843, - 0.24313725490196078, - 0.3764705882352941, - 0.49411764705882355, - 0.5882352941176471, - 0.6823529411764706, - 0.9098039215686274, - 0.9137254901960784, - 0.9176470588235294, - 0.803921568627451, - 0.7058823529411765, - 0.7215686274509804, - 0.7372549019607844, - 0.7450980392156863, - 0.9058823529411765, - 0.7960784313725491, - 0.7647058823529411, - 0.7607843137254902, - 0.8823529411764706, - 0.8235294117647058, - 0.7490196078431373, - 0.6980392156862745, - 0.5490196078431373, - 0.3411764705882353, - 0.24313725490196078, - 0.34509803921568627, - 0.1843137254901961, - 0.27058823529411763, - 0.3058823529411765, - 0.10980392156862745, - 0.25098039215686274, - 0.11372549019607843, - 0.27058823529411763, - 0.21176470588235294, - 0.08235294117647057, - 0.23137254901960783, - 0.1176470588235294, - 0.3176470588235294, - 0.24705882352941178, - 0.35294117647058826, - 0.3568627450980392, - 0.34901960784313724, - 0.2627450980392157, - 0.37254901960784315, - 0.10196078431372549, - 0.13333333333333333, - 0.27058823529411763, - 0.8666666666666667, - 0.47450980392156855, - 0.3568627450980392, - 0.23921568627450981, - 0.2549019607843137, - 0.7098039215686275, - 0.5176470588235295, - 0.14901960784313725, - 0.0784313725490196, - 0.10196078431372549, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.050980392156862744, - 0.10588235294117647, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.09411764705882353 + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.09411764705882353, + 0.08235294117647057, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.054901960784313725, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.13333333333333333, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.054901960784313725, + 0.10588235294117647, + 0.11372549019607843, + 0.24313725490196078, + 0.3764705882352941, + 0.49411764705882355, + 0.5882352941176471, + 0.6823529411764706, + 0.9098039215686274, + 0.9137254901960784, + 0.9176470588235294, + 0.803921568627451, + 0.7058823529411765, + 0.7215686274509804, + 0.7372549019607844, + 0.7450980392156863, + 0.9058823529411765, + 0.7960784313725491, + 0.7647058823529411, + 0.7607843137254902, + 0.8823529411764706, + 0.8235294117647058, + 0.7490196078431373, + 0.6980392156862745, + 0.5490196078431373, + 0.3411764705882353, + 0.24313725490196078, + 0.34509803921568627, + 0.1843137254901961, + 0.27058823529411763, + 0.3058823529411765, + 0.10980392156862745, + 0.25098039215686274, + 0.11372549019607843, + 0.27058823529411763, + 0.21176470588235294, + 0.08235294117647057, + 0.23137254901960783, + 0.1176470588235294, + 0.3176470588235294, + 0.24705882352941178, + 0.35294117647058826, + 0.3568627450980392, + 0.34901960784313724, + 0.2627450980392157, + 0.37254901960784315, + 0.10196078431372549, + 0.13333333333333333, + 0.27058823529411763, + 0.8666666666666667, + 0.47450980392156855, + 0.3568627450980392, + 0.23921568627450981, + 0.2549019607843137, + 0.7098039215686275, + 0.5176470588235295, + 0.14901960784313725, + 0.0784313725490196, + 0.10196078431372549, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.050980392156862744, + 0.10588235294117647, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.09411764705882353 ], [ - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.1411764705882353, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.10588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.08627450980392157, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.10196078431372549, - 0.1411764705882353, - 0.38431372549019616, - 0.9372549019607842, - 0.7960784313725491, - 0.26666666666666666, - 0.13333333333333333, - 0.9019607843137255, - 0.9647058823529412, - 0.8705882352941177, - 0.7490196078431373, - 0.6274509803921569, - 0.7647058823529411, - 0.5803921568627451, - 0.6823529411764706, - 0.8274509803921568, - 0.8627450980392157, - 0.8117647058823529, - 0.7882352941176471, - 0.8313725490196079, - 0.8901960784313725, - 0.7686274509803923, - 0.5529411764705883, - 0.42745098039215684, - 0.3686274509803922, - 0.26666666666666666, - 0.1803921568627451, - 0.30196078431372547, - 0.2784313725490196, - 0.3176470588235294, - 0.30980392156862746, - 0.20784313725490197, - 0.2784313725490196, - 0.08627450980392157, - 0.18823529411764706, - 0.0784313725490196, - 0.10588235294117647, - 0.24313725490196078, - 0.15294117647058825, - 0.1843137254901961, - 0.2196078431372549, - 0.3764705882352941, - 0.24313725490196078, - 0.18823529411764706, - 0.26666666666666666, - 0.08627450980392157, - 0.054901960784313725, - 0.14901960784313725, - 0.9254901960784313, - 0.4117647058823529, - 0.40784313725490196, - 0.25098039215686274, - 0.27450980392156865, - 0.5607843137254902, - 0.6196078431372549, - 0.21568627450980393, - 0.20392156862745098, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.10196078431372549, - 0.0784313725490196, - 0.12941176470588237, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.08627450980392157, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765 + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.1411764705882353, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.10588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.08627450980392157, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.10196078431372549, + 0.1411764705882353, + 0.38431372549019616, + 0.9372549019607842, + 0.7960784313725491, + 0.26666666666666666, + 0.13333333333333333, + 0.9019607843137255, + 0.9647058823529412, + 0.8705882352941177, + 0.7490196078431373, + 0.6274509803921569, + 0.7647058823529411, + 0.5803921568627451, + 0.6823529411764706, + 0.8274509803921568, + 0.8627450980392157, + 0.8117647058823529, + 0.7882352941176471, + 0.8313725490196079, + 0.8901960784313725, + 0.7686274509803923, + 0.5529411764705883, + 0.42745098039215684, + 0.3686274509803922, + 0.26666666666666666, + 0.1803921568627451, + 0.30196078431372547, + 0.2784313725490196, + 0.3176470588235294, + 0.30980392156862746, + 0.20784313725490197, + 0.2784313725490196, + 0.08627450980392157, + 0.18823529411764706, + 0.0784313725490196, + 0.10588235294117647, + 0.24313725490196078, + 0.15294117647058825, + 0.1843137254901961, + 0.2196078431372549, + 0.3764705882352941, + 0.24313725490196078, + 0.18823529411764706, + 0.26666666666666666, + 0.08627450980392157, + 0.054901960784313725, + 0.14901960784313725, + 0.9254901960784313, + 0.4117647058823529, + 0.40784313725490196, + 0.25098039215686274, + 0.27450980392156865, + 0.5607843137254902, + 0.6196078431372549, + 0.21568627450980393, + 0.20392156862745098, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.10196078431372549, + 0.0784313725490196, + 0.12941176470588237, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.08627450980392157, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.10588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.054901960784313725, - 0.06274509803921569, - 0.050980392156862744, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.10588235294117647, - 0.06274509803921569, - 0.054901960784313725, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.09019607843137255, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.10980392156862745, - 0.06666666666666667, - 0.0588235294117647, - 0.13333333333333333, - 0.11372549019607843, - 0.09019607843137255, - 0.8901960784313725, - 0.6784313725490196, - 0.2549019607843137, - 0.34901960784313724, - 0.8549019607843137, - 0.9490196078431371, - 0.8588235294117647, - 0.6705882352941175, - 0.6313725490196078, - 0.6901960784313725, - 0.7137254901960784, - 0.8509803921568627, - 0.7568627450980392, - 0.7490196078431373, - 0.47843137254901963, - 0.5137254901960784, - 0.5725490196078431, - 0.7568627450980392, - 0.7411764705882353, - 0.6, - 0.3686274509803922, - 0.37254901960784315, - 0.30980392156862746, - 0.25098039215686274, - 0.1450980392156863, - 0.07450980392156863, - 0.2784313725490196, - 0.2901960784313726, - 0.29411764705882354, - 0.2196078431372549, - 0.07450980392156863, - 0.3254901960784313, - 0.050980392156862744, - 0.13333333333333333, - 0.12156862745098039, - 0.1803921568627451, - 0.11372549019607843, - 0.3568627450980392, - 0.33333333333333326, - 0.3294117647058823, - 0.2627450980392157, - 0.23137254901960783, - 0.09411764705882353, - 0.11372549019607843, - 0.1176470588235294, - 0.8745098039215686, - 0.43529411764705883, - 0.5254901960784314, - 0.2980392156862745, - 0.27450980392156865, - 0.48627450980392156, - 0.6274509803921569, - 0.1803921568627451, - 0.09019607843137255, - 0.050980392156862744, - 0.23921568627450981, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08627450980392157 + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.10588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.054901960784313725, + 0.06274509803921569, + 0.050980392156862744, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.10588235294117647, + 0.06274509803921569, + 0.054901960784313725, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.09019607843137255, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.10980392156862745, + 0.06666666666666667, + 0.0588235294117647, + 0.13333333333333333, + 0.11372549019607843, + 0.09019607843137255, + 0.8901960784313725, + 0.6784313725490196, + 0.2549019607843137, + 0.34901960784313724, + 0.8549019607843137, + 0.9490196078431371, + 0.8588235294117647, + 0.6705882352941175, + 0.6313725490196078, + 0.6901960784313725, + 0.7137254901960784, + 0.8509803921568627, + 0.7568627450980392, + 0.7490196078431373, + 0.47843137254901963, + 0.5137254901960784, + 0.5725490196078431, + 0.7568627450980392, + 0.7411764705882353, + 0.6, + 0.3686274509803922, + 0.37254901960784315, + 0.30980392156862746, + 0.25098039215686274, + 0.1450980392156863, + 0.07450980392156863, + 0.2784313725490196, + 0.2901960784313726, + 0.29411764705882354, + 0.2196078431372549, + 0.07450980392156863, + 0.3254901960784313, + 0.050980392156862744, + 0.13333333333333333, + 0.12156862745098039, + 0.1803921568627451, + 0.11372549019607843, + 0.3568627450980392, + 0.33333333333333326, + 0.3294117647058823, + 0.2627450980392157, + 0.23137254901960783, + 0.09411764705882353, + 0.11372549019607843, + 0.1176470588235294, + 0.8745098039215686, + 0.43529411764705883, + 0.5254901960784314, + 0.2980392156862745, + 0.27450980392156865, + 0.48627450980392156, + 0.6274509803921569, + 0.1803921568627451, + 0.09019607843137255, + 0.050980392156862744, + 0.23921568627450981, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08627450980392157 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.0588235294117647, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.10196078431372549, - 0.08235294117647057, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.07450980392156863, - 0.08235294117647057, - 0.09803921568627452, - 0.08627450980392157, - 0.08627450980392157, - 0.49411764705882355, - 0.8470588235294118, - 0.8862745098039215, - 0.9019607843137255, - 0.7176470588235294, - 0.8862745098039215, - 0.9333333333333332, - 0.7686274509803923, - 0.6039215686274509, - 0.6, - 0.8, - 0.7647058823529411, - 0.9176470588235294, - 0.9725490196078431, - 0.9529411764705881, - 0.12941176470588237, - 0.2352941176470588, - 0.3803921568627451, - 0.4666666666666666, - 0.6313725490196078, - 0.5490196078431373, - 0.3686274509803922, - 0.4117647058823529, - 0.39607843137254906, - 0.3607843137254902, - 0.2823529411764706, - 0.24313725490196078, - 0.2627450980392157, - 0.2549019607843137, - 0.33725490196078434, - 0.2549019607843137, - 0.27058823529411763, - 0.12941176470588237, - 0.2549019607843137, - 0.3254901960784313, - 0.09019607843137255, - 0.08235294117647057, - 0.28627450980392155, - 0.2627450980392157, - 0.28627450980392155, - 0.34509803921568627, - 0.2627450980392157, - 0.24705882352941178, - 0.07450980392156863, - 0.07450980392156863, - 0.14901960784313725, - 0.8431372549019608, - 0.5019607843137255, - 0.6470588235294117, - 0.25098039215686274, - 0.28627450980392155, - 0.5882352941176471, - 0.6745098039215687, - 0.24705882352941178, - 0.11372549019607843, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.10196078431372549, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.09019607843137255, - 0.07450980392156863 + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.0588235294117647, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.10196078431372549, + 0.08235294117647057, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.07450980392156863, + 0.08235294117647057, + 0.09803921568627452, + 0.08627450980392157, + 0.08627450980392157, + 0.49411764705882355, + 0.8470588235294118, + 0.8862745098039215, + 0.9019607843137255, + 0.7176470588235294, + 0.8862745098039215, + 0.9333333333333332, + 0.7686274509803923, + 0.6039215686274509, + 0.6, + 0.8, + 0.7647058823529411, + 0.9176470588235294, + 0.9725490196078431, + 0.9529411764705881, + 0.12941176470588237, + 0.2352941176470588, + 0.3803921568627451, + 0.4666666666666666, + 0.6313725490196078, + 0.5490196078431373, + 0.3686274509803922, + 0.4117647058823529, + 0.39607843137254906, + 0.3607843137254902, + 0.2823529411764706, + 0.24313725490196078, + 0.2627450980392157, + 0.2549019607843137, + 0.33725490196078434, + 0.2549019607843137, + 0.27058823529411763, + 0.12941176470588237, + 0.2549019607843137, + 0.3254901960784313, + 0.09019607843137255, + 0.08235294117647057, + 0.28627450980392155, + 0.2627450980392157, + 0.28627450980392155, + 0.34509803921568627, + 0.2627450980392157, + 0.24705882352941178, + 0.07450980392156863, + 0.07450980392156863, + 0.14901960784313725, + 0.8431372549019608, + 0.5019607843137255, + 0.6470588235294117, + 0.25098039215686274, + 0.28627450980392155, + 0.5882352941176471, + 0.6745098039215687, + 0.24705882352941178, + 0.11372549019607843, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.10196078431372549, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.09019607843137255, + 0.07450980392156863 ], [ - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.050980392156862744, - 0.07450980392156863, - 0.09803921568627452, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.09803921568627452, - 0.0588235294117647, - 0.06666666666666667, - 0.10196078431372549, - 0.9490196078431371, - 0.8941176470588236, - 0.807843137254902, - 0.8196078431372549, - 0.7019607843137254, - 0.9019607843137255, - 0.9254901960784313, - 0.6784313725490196, - 0.6235294117647059, - 0.5843137254901961, - 0.7568627450980392, - 0.6980392156862745, - 0.996078431372549, - 0.9764705882352941, - 0.6078431372549019, - 0.29411764705882354, - 0.14901960784313725, - 0.1568627450980392, - 0.3568627450980392, - 0.47843137254901963, - 0.4, - 0.4470588235294118, - 0.4196078431372549, - 0.37254901960784315, - 0.3764705882352941, - 0.33725490196078434, - 0.29411764705882354, - 0.19215686274509808, - 0.27450980392156865, - 0.32156862745098036, - 0.3058823529411765, - 0.1568627450980392, - 0.12941176470588237, - 0.12549019607843137, - 0.2823529411764706, - 0.21568627450980393, - 0.10980392156862745, - 0.17647058823529413, - 0.23137254901960783, - 0.1411764705882353, - 0.33333333333333326, - 0.20784313725490197, - 0.12941176470588237, - 0.10588235294117647, - 0.0784313725490196, - 0.09019607843137255, - 0.8313725490196079, - 0.592156862745098, - 0.7529411764705882, - 0.2549019607843137, - 0.24313725490196078, - 0.592156862745098, - 0.5686274509803921, - 0.29411764705882354, - 0.2235294117647059, - 0.08627450980392157, - 0.25882352941176473, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.13725490196078433, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569 + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.050980392156862744, + 0.07450980392156863, + 0.09803921568627452, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.09803921568627452, + 0.0588235294117647, + 0.06666666666666667, + 0.10196078431372549, + 0.9490196078431371, + 0.8941176470588236, + 0.807843137254902, + 0.8196078431372549, + 0.7019607843137254, + 0.9019607843137255, + 0.9254901960784313, + 0.6784313725490196, + 0.6235294117647059, + 0.5843137254901961, + 0.7568627450980392, + 0.6980392156862745, + 0.996078431372549, + 0.9764705882352941, + 0.6078431372549019, + 0.29411764705882354, + 0.14901960784313725, + 0.1568627450980392, + 0.3568627450980392, + 0.47843137254901963, + 0.4, + 0.4470588235294118, + 0.4196078431372549, + 0.37254901960784315, + 0.3764705882352941, + 0.33725490196078434, + 0.29411764705882354, + 0.19215686274509808, + 0.27450980392156865, + 0.32156862745098036, + 0.3058823529411765, + 0.1568627450980392, + 0.12941176470588237, + 0.12549019607843137, + 0.2823529411764706, + 0.21568627450980393, + 0.10980392156862745, + 0.17647058823529413, + 0.23137254901960783, + 0.1411764705882353, + 0.33333333333333326, + 0.20784313725490197, + 0.12941176470588237, + 0.10588235294117647, + 0.0784313725490196, + 0.09019607843137255, + 0.8313725490196079, + 0.592156862745098, + 0.7529411764705882, + 0.2549019607843137, + 0.24313725490196078, + 0.592156862745098, + 0.5686274509803921, + 0.29411764705882354, + 0.2235294117647059, + 0.08627450980392157, + 0.25882352941176473, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.13725490196078433, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.043137254901960784, - 0.0588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.054901960784313725, - 0.07450980392156863, - 0.0588235294117647, - 0.09411764705882353, - 0.1176470588235294, - 0.07058823529411765, - 0.09803921568627452, - 0.11372549019607843, - 0.06666666666666667, - 0.9254901960784313, - 0.9058823529411765, - 0.9058823529411765, - 0.8431372549019608, - 0.9529411764705881, - 0.9725490196078431, - 0.8784313725490196, - 0.6784313725490196, - 0.6470588235294117, - 0.611764705882353, - 0.7490196078431373, - 0.8862745098039215, - 0.8196078431372549, - 0.9019607843137255, - 0.8823529411764706, - 0.24313725490196078, - 0.2901960784313726, - 0.3058823529411765, - 0.42745098039215684, - 0.5019607843137255, - 0.3882352941176471, - 0.41568627450980394, - 0.4823529411764706, - 0.3686274509803922, - 0.403921568627451, - 0.3254901960784313, - 0.3137254901960784, - 0.24313725490196078, - 0.14901960784313725, - 0.27450980392156865, - 0.32156862745098036, - 0.10196078431372549, - 0.2549019607843137, - 0.13333333333333333, - 0.18823529411764706, - 0.09803921568627452, - 0.2196078431372549, - 0.13333333333333333, - 0.24705882352941178, - 0.1803921568627451, - 0.23921568627450981, - 0.13725490196078433, - 0.09803921568627452, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.8156862745098039, - 0.6313725490196078, - 0.7921568627450981, - 0.44313725490196076, - 0.24313725490196078, - 0.5058823529411764, - 0.36470588235294116, - 0.5411764705882353, - 0.16078431372549018, - 0.09411764705882353, - 0.1450980392156863, - 0.12156862745098039, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765 + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.043137254901960784, + 0.0588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.054901960784313725, + 0.07450980392156863, + 0.0588235294117647, + 0.09411764705882353, + 0.1176470588235294, + 0.07058823529411765, + 0.09803921568627452, + 0.11372549019607843, + 0.06666666666666667, + 0.9254901960784313, + 0.9058823529411765, + 0.9058823529411765, + 0.8431372549019608, + 0.9529411764705881, + 0.9725490196078431, + 0.8784313725490196, + 0.6784313725490196, + 0.6470588235294117, + 0.611764705882353, + 0.7490196078431373, + 0.8862745098039215, + 0.8196078431372549, + 0.9019607843137255, + 0.8823529411764706, + 0.24313725490196078, + 0.2901960784313726, + 0.3058823529411765, + 0.42745098039215684, + 0.5019607843137255, + 0.3882352941176471, + 0.41568627450980394, + 0.4823529411764706, + 0.3686274509803922, + 0.403921568627451, + 0.3254901960784313, + 0.3137254901960784, + 0.24313725490196078, + 0.14901960784313725, + 0.27450980392156865, + 0.32156862745098036, + 0.10196078431372549, + 0.2549019607843137, + 0.13333333333333333, + 0.18823529411764706, + 0.09803921568627452, + 0.2196078431372549, + 0.13333333333333333, + 0.24705882352941178, + 0.1803921568627451, + 0.23921568627450981, + 0.13725490196078433, + 0.09803921568627452, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.8156862745098039, + 0.6313725490196078, + 0.7921568627450981, + 0.44313725490196076, + 0.24313725490196078, + 0.5058823529411764, + 0.36470588235294116, + 0.5411764705882353, + 0.16078431372549018, + 0.09411764705882353, + 0.1450980392156863, + 0.12156862745098039, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.10980392156862745, - 0.09411764705882353, - 0.09803921568627452, - 0.0784313725490196, - 0.08627450980392157, - 0.09019607843137255, - 0.9176470588235294, - 0.8588235294117647, - 0.9411764705882352, - 0.9686274509803922, - 0.9529411764705881, - 0.984313725490196, - 0.8431372549019608, - 0.7764705882352942, - 0.6352941176470588, - 0.6039215686274509, - 0.8509803921568627, - 0.8980392156862745, - 0.9372549019607842, - 0.7725490196078433, - 0.8117647058823529, - 0.5372549019607843, - 0.48627450980392156, - 0.2901960784313726, - 0.4980392156862745, - 0.7019607843137254, - 0.7843137254901962, - 0.6784313725490196, - 0.615686274509804, - 0.5411764705882353, - 0.4980392156862745, - 0.3686274509803922, - 0.3176470588235294, - 0.30980392156862746, - 0.23137254901960783, - 0.21568627450980393, - 0.33333333333333326, - 0.2823529411764706, - 0.24313725490196078, - 0.1450980392156863, - 0.07450980392156863, - 0.23137254901960783, - 0.33333333333333326, - 0.18823529411764706, - 0.3058823529411765, - 0.13725490196078433, - 0.16078431372549018, - 0.14901960784313725, - 0.0784313725490196, - 0.08235294117647057, - 0.09411764705882353, - 0.047058823529411764, - 0.803921568627451, - 0.8274509803921568, - 0.9529411764705881, - 0.8313725490196079, - 0.22745098039215686, - 0.27450980392156865, - 0.596078431372549, - 0.45098039215686275, - 0.17254901960784313, - 0.050980392156862744, - 0.14901960784313725, - 0.08627450980392157, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.10980392156862745, + 0.09411764705882353, + 0.09803921568627452, + 0.0784313725490196, + 0.08627450980392157, + 0.09019607843137255, + 0.9176470588235294, + 0.8588235294117647, + 0.9411764705882352, + 0.9686274509803922, + 0.9529411764705881, + 0.984313725490196, + 0.8431372549019608, + 0.7764705882352942, + 0.6352941176470588, + 0.6039215686274509, + 0.8509803921568627, + 0.8980392156862745, + 0.9372549019607842, + 0.7725490196078433, + 0.8117647058823529, + 0.5372549019607843, + 0.48627450980392156, + 0.2901960784313726, + 0.4980392156862745, + 0.7019607843137254, + 0.7843137254901962, + 0.6784313725490196, + 0.615686274509804, + 0.5411764705882353, + 0.4980392156862745, + 0.3686274509803922, + 0.3176470588235294, + 0.30980392156862746, + 0.23137254901960783, + 0.21568627450980393, + 0.33333333333333326, + 0.2823529411764706, + 0.24313725490196078, + 0.1450980392156863, + 0.07450980392156863, + 0.23137254901960783, + 0.33333333333333326, + 0.18823529411764706, + 0.3058823529411765, + 0.13725490196078433, + 0.16078431372549018, + 0.14901960784313725, + 0.0784313725490196, + 0.08235294117647057, + 0.09411764705882353, + 0.047058823529411764, + 0.803921568627451, + 0.8274509803921568, + 0.9529411764705881, + 0.8313725490196079, + 0.22745098039215686, + 0.27450980392156865, + 0.596078431372549, + 0.45098039215686275, + 0.17254901960784313, + 0.050980392156862744, + 0.14901960784313725, + 0.08627450980392157, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.08627450980392157, - 0.0588235294117647, - 0.08235294117647057, - 0.07450980392156863, - 0.0784313725490196, - 0.08627450980392157, - 0.0784313725490196, - 0.08235294117647057, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.12941176470588237, - 0.06666666666666667, - 0.9294117647058823, - 0.9294117647058823, - 0.8352941176470589, - 0.8705882352941177, - 0.9529411764705881, - 0.9647058823529412, - 0.8549019607843137, - 0.7411764705882353, - 0.6470588235294117, - 0.5803921568627451, - 0.9058823529411765, - 0.9333333333333332, - 0.8901960784313725, - 0.8901960784313725, - 0.8352941176470589, - 0.7450980392156863, - 0.6196078431372549, - 0.6588235294117646, - 0.6705882352941175, - 0.6431372549019607, - 0.7764705882352942, - 0.7843137254901962, - 0.6470588235294117, - 0.4705882352941176, - 0.3882352941176471, - 0.43137254901960786, - 0.34509803921568627, - 0.3254901960784313, - 0.30196078431372547, - 0.24705882352941178, - 0.24705882352941178, - 0.3058823529411765, - 0.12156862745098039, - 0.20784313725490197, - 0.08627450980392157, - 0.10588235294117647, - 0.24313725490196078, - 0.25098039215686274, - 0.30196078431372547, - 0.19607843137254904, - 0.13333333333333333, - 0.13333333333333333, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.09803921568627452, - 0.6705882352941175, - 0.8352941176470589, - 0.7568627450980392, - 0.8470588235294118, - 0.27450980392156865, - 0.2235294117647059, - 0.7411764705882353, - 0.46274509803921565, - 0.2627450980392157, - 0.26666666666666666, - 0.16470588235294115, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.08627450980392157, + 0.0588235294117647, + 0.08235294117647057, + 0.07450980392156863, + 0.0784313725490196, + 0.08627450980392157, + 0.0784313725490196, + 0.08235294117647057, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.12941176470588237, + 0.06666666666666667, + 0.9294117647058823, + 0.9294117647058823, + 0.8352941176470589, + 0.8705882352941177, + 0.9529411764705881, + 0.9647058823529412, + 0.8549019607843137, + 0.7411764705882353, + 0.6470588235294117, + 0.5803921568627451, + 0.9058823529411765, + 0.9333333333333332, + 0.8901960784313725, + 0.8901960784313725, + 0.8352941176470589, + 0.7450980392156863, + 0.6196078431372549, + 0.6588235294117646, + 0.6705882352941175, + 0.6431372549019607, + 0.7764705882352942, + 0.7843137254901962, + 0.6470588235294117, + 0.4705882352941176, + 0.3882352941176471, + 0.43137254901960786, + 0.34509803921568627, + 0.3254901960784313, + 0.30196078431372547, + 0.24705882352941178, + 0.24705882352941178, + 0.3058823529411765, + 0.12156862745098039, + 0.20784313725490197, + 0.08627450980392157, + 0.10588235294117647, + 0.24313725490196078, + 0.25098039215686274, + 0.30196078431372547, + 0.19607843137254904, + 0.13333333333333333, + 0.13333333333333333, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.09803921568627452, + 0.6705882352941175, + 0.8352941176470589, + 0.7568627450980392, + 0.8470588235294118, + 0.27450980392156865, + 0.2235294117647059, + 0.7411764705882353, + 0.46274509803921565, + 0.2627450980392157, + 0.26666666666666666, + 0.16470588235294115, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.09411764705882353, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.050980392156862744, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.10196078431372549, - 0.06666666666666667, - 0.10196078431372549, - 0.06666666666666667, - 0.09411764705882353, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.9411764705882352, - 0.7803921568627452, - 0.9529411764705881, - 0.9568627450980393, - 0.8431372549019608, - 0.9215686274509803, - 0.7568627450980392, - 0.5647058823529412, - 0.6431372549019607, - 0.6078431372549019, - 0.8392156862745098, - 0.8627450980392157, - 0.8784313725490196, - 0.9450980392156861, - 0.8862745098039215, - 0.8313725490196079, - 0.8156862745098039, - 0.8196078431372549, - 0.7294117647058823, - 0.8, - 0.8156862745098039, - 0.8117647058823529, - 0.6078431372549019, - 0.4823529411764706, - 0.33725490196078434, - 0.34901960784313724, - 0.34901960784313724, - 0.3568627450980392, - 0.2980392156862745, - 0.29411764705882354, - 0.2549019607843137, - 0.30196078431372547, - 0.3411764705882353, - 0.22745098039215686, - 0.33725490196078434, - 0.12941176470588237, - 0.17254901960784313, - 0.17254901960784313, - 0.16470588235294115, - 0.20784313725490197, - 0.20784313725490197, - 0.3176470588235294, - 0.17647058823529413, - 0.08235294117647057, - 0.0784313725490196, - 0.09411764705882353, - 0.6627450980392156, - 0.8705882352941177, - 0.7019607843137254, - 0.9137254901960784, - 0.3254901960784313, - 0.23137254901960783, - 0.6705882352941175, - 0.47450980392156855, - 0.09411764705882353, - 0.3137254901960784, - 0.1568627450980392, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765 + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.09411764705882353, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.050980392156862744, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.10196078431372549, + 0.06666666666666667, + 0.10196078431372549, + 0.06666666666666667, + 0.09411764705882353, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.9411764705882352, + 0.7803921568627452, + 0.9529411764705881, + 0.9568627450980393, + 0.8431372549019608, + 0.9215686274509803, + 0.7568627450980392, + 0.5647058823529412, + 0.6431372549019607, + 0.6078431372549019, + 0.8392156862745098, + 0.8627450980392157, + 0.8784313725490196, + 0.9450980392156861, + 0.8862745098039215, + 0.8313725490196079, + 0.8156862745098039, + 0.8196078431372549, + 0.7294117647058823, + 0.8, + 0.8156862745098039, + 0.8117647058823529, + 0.6078431372549019, + 0.4823529411764706, + 0.33725490196078434, + 0.34901960784313724, + 0.34901960784313724, + 0.3568627450980392, + 0.2980392156862745, + 0.29411764705882354, + 0.2549019607843137, + 0.30196078431372547, + 0.3411764705882353, + 0.22745098039215686, + 0.33725490196078434, + 0.12941176470588237, + 0.17254901960784313, + 0.17254901960784313, + 0.16470588235294115, + 0.20784313725490197, + 0.20784313725490197, + 0.3176470588235294, + 0.17647058823529413, + 0.08235294117647057, + 0.0784313725490196, + 0.09411764705882353, + 0.6627450980392156, + 0.8705882352941177, + 0.7019607843137254, + 0.9137254901960784, + 0.3254901960784313, + 0.23137254901960783, + 0.6705882352941175, + 0.47450980392156855, + 0.09411764705882353, + 0.3137254901960784, + 0.1568627450980392, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.08627450980392157, - 0.08627450980392157, - 0.9333333333333332, - 0.9137254901960784, - 0.8470588235294118, - 0.9411764705882352, - 0.9450980392156861, - 0.7568627450980392, - 0.6941176470588235, - 0.611764705882353, - 0.5882352941176471, - 0.615686274509804, - 0.7529411764705882, - 0.8941176470588236, - 0.9490196078431371, - 0.9372549019607842, - 0.8980392156862745, - 0.9647058823529412, - 0.9176470588235294, - 0.8745098039215686, - 0.8862745098039215, - 0.7843137254901962, - 0.7921568627450981, - 0.6823529411764706, - 0.5607843137254902, - 0.47450980392156855, - 0.33333333333333326, - 0.34901960784313724, - 0.33725490196078434, - 0.3568627450980392, - 0.33725490196078434, - 0.3294117647058823, - 0.23921568627450981, - 0.26666666666666666, - 0.17254901960784313, - 0.27058823529411763, - 0.30980392156862746, - 0.28627450980392155, - 0.1843137254901961, - 0.12941176470588237, - 0.11372549019607843, - 0.16862745098039217, - 0.12941176470588237, - 0.09803921568627452, - 0.09019607843137255, - 0.0784313725490196, - 0.0784313725490196, - 0.09019607843137255, - 0.4235294117647059, - 0.8313725490196079, - 0.5372549019607843, - 0.8862745098039215, - 0.2823529411764706, - 0.25098039215686274, - 0.6235294117647059, - 0.3411764705882353, - 0.24705882352941178, - 0.4, - 0.35294117647058826, - 0.12156862745098039, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.08627450980392157, + 0.08627450980392157, + 0.9333333333333332, + 0.9137254901960784, + 0.8470588235294118, + 0.9411764705882352, + 0.9450980392156861, + 0.7568627450980392, + 0.6941176470588235, + 0.611764705882353, + 0.5882352941176471, + 0.615686274509804, + 0.7529411764705882, + 0.8941176470588236, + 0.9490196078431371, + 0.9372549019607842, + 0.8980392156862745, + 0.9647058823529412, + 0.9176470588235294, + 0.8745098039215686, + 0.8862745098039215, + 0.7843137254901962, + 0.7921568627450981, + 0.6823529411764706, + 0.5607843137254902, + 0.47450980392156855, + 0.33333333333333326, + 0.34901960784313724, + 0.33725490196078434, + 0.3568627450980392, + 0.33725490196078434, + 0.3294117647058823, + 0.23921568627450981, + 0.26666666666666666, + 0.17254901960784313, + 0.27058823529411763, + 0.30980392156862746, + 0.28627450980392155, + 0.1843137254901961, + 0.12941176470588237, + 0.11372549019607843, + 0.16862745098039217, + 0.12941176470588237, + 0.09803921568627452, + 0.09019607843137255, + 0.0784313725490196, + 0.0784313725490196, + 0.09019607843137255, + 0.4235294117647059, + 0.8313725490196079, + 0.5372549019607843, + 0.8862745098039215, + 0.2823529411764706, + 0.25098039215686274, + 0.6235294117647059, + 0.3411764705882353, + 0.24705882352941178, + 0.4, + 0.35294117647058826, + 0.12156862745098039, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.09411764705882353, - 0.08627450980392157, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.047058823529411764, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.050980392156862744, - 0.10588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.9137254901960784, - 0.9372549019607842, - 0.9411764705882352, - 0.9215686274509803, - 0.9294117647058823, - 0.7215686274509804, - 0.6235294117647059, - 0.5450980392156862, - 0.5137254901960784, - 0.5450980392156862, - 0.7215686274509804, - 0.807843137254902, - 0.8784313725490196, - 0.9490196078431371, - 0.9490196078431371, - 0.9372549019607842, - 0.9725490196078431, - 0.9568627450980393, - 0.8745098039215686, - 0.8549019607843137, - 0.7137254901960784, - 0.6627450980392156, - 0.5568627450980392, - 0.38431372549019616, - 0.39607843137254906, - 0.34509803921568627, - 0.33725490196078434, - 0.3176470588235294, - 0.3058823529411765, - 0.3568627450980392, - 0.26666666666666666, - 0.24313725490196078, - 0.25882352941176473, - 0.21568627450980393, - 0.16470588235294115, - 0.20784313725490197, - 0.34509803921568627, - 0.1843137254901961, - 0.09803921568627452, - 0.1176470588235294, - 0.08627450980392157, - 0.12549019607843137, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.1176470588235294, - 0.29411764705882354, - 0.8, - 0.5176470588235295, - 0.8470588235294118, - 0.29411764705882354, - 0.22745098039215686, - 0.6509803921568627, - 0.24313725490196078, - 0.19215686274509808, - 0.34901960784313724, - 0.33725490196078434, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.10980392156862745 + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.09411764705882353, + 0.08627450980392157, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.047058823529411764, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.050980392156862744, + 0.10588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.9137254901960784, + 0.9372549019607842, + 0.9411764705882352, + 0.9215686274509803, + 0.9294117647058823, + 0.7215686274509804, + 0.6235294117647059, + 0.5450980392156862, + 0.5137254901960784, + 0.5450980392156862, + 0.7215686274509804, + 0.807843137254902, + 0.8784313725490196, + 0.9490196078431371, + 0.9490196078431371, + 0.9372549019607842, + 0.9725490196078431, + 0.9568627450980393, + 0.8745098039215686, + 0.8549019607843137, + 0.7137254901960784, + 0.6627450980392156, + 0.5568627450980392, + 0.38431372549019616, + 0.39607843137254906, + 0.34509803921568627, + 0.33725490196078434, + 0.3176470588235294, + 0.3058823529411765, + 0.3568627450980392, + 0.26666666666666666, + 0.24313725490196078, + 0.25882352941176473, + 0.21568627450980393, + 0.16470588235294115, + 0.20784313725490197, + 0.34509803921568627, + 0.1843137254901961, + 0.09803921568627452, + 0.1176470588235294, + 0.08627450980392157, + 0.12549019607843137, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.1176470588235294, + 0.29411764705882354, + 0.8, + 0.5176470588235295, + 0.8470588235294118, + 0.29411764705882354, + 0.22745098039215686, + 0.6509803921568627, + 0.24313725490196078, + 0.19215686274509808, + 0.34901960784313724, + 0.33725490196078434, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.10980392156862745 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.09019607843137255, - 0.08627450980392157, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.054901960784313725, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.10980392156862745, - 0.09019607843137255, - 0.13725490196078433, - 0.9137254901960784, - 0.8431372549019608, - 0.9215686274509803, - 0.9098039215686274, - 0.7843137254901962, - 0.6627450980392156, - 0.615686274509804, - 0.5215686274509804, - 0.5058823529411764, - 0.5333333333333333, - 0.8705882352941177, - 0.8745098039215686, - 0.9058823529411765, - 0.8823529411764706, - 0.9019607843137255, - 0.9450980392156861, - 0.9254901960784313, - 0.8901960784313725, - 0.7960784313725491, - 0.8117647058823529, - 0.7411764705882353, - 0.6392156862745098, - 0.45098039215686275, - 0.33333333333333326, - 0.3568627450980392, - 0.32156862745098036, - 0.3764705882352941, - 0.37254901960784315, - 0.37254901960784315, - 0.3568627450980392, - 0.27058823529411763, - 0.25098039215686274, - 0.25882352941176473, - 0.22745098039215686, - 0.12941176470588237, - 0.2352941176470588, - 0.2627450980392157, - 0.19215686274509808, - 0.16862745098039217, - 0.25098039215686274, - 0.07450980392156863, - 0.09019607843137255, - 0.0588235294117647, - 0.1176470588235294, - 0.06274509803921569, - 0.0588235294117647, - 0.20784313725490197, - 0.7725490196078433, - 0.6431372549019607, - 0.9215686274509803, - 0.33333333333333326, - 0.30196078431372547, - 0.5764705882352941, - 0.2784313725490196, - 0.23921568627450981, - 0.15294117647058825, - 0.2823529411764706, - 0.12941176470588237, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.12549019607843137, - 0.07058823529411765, - 0.11372549019607843, - 0.07450980392156863 + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.09019607843137255, + 0.08627450980392157, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.054901960784313725, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.10980392156862745, + 0.09019607843137255, + 0.13725490196078433, + 0.9137254901960784, + 0.8431372549019608, + 0.9215686274509803, + 0.9098039215686274, + 0.7843137254901962, + 0.6627450980392156, + 0.615686274509804, + 0.5215686274509804, + 0.5058823529411764, + 0.5333333333333333, + 0.8705882352941177, + 0.8745098039215686, + 0.9058823529411765, + 0.8823529411764706, + 0.9019607843137255, + 0.9450980392156861, + 0.9254901960784313, + 0.8901960784313725, + 0.7960784313725491, + 0.8117647058823529, + 0.7411764705882353, + 0.6392156862745098, + 0.45098039215686275, + 0.33333333333333326, + 0.3568627450980392, + 0.32156862745098036, + 0.3764705882352941, + 0.37254901960784315, + 0.37254901960784315, + 0.3568627450980392, + 0.27058823529411763, + 0.25098039215686274, + 0.25882352941176473, + 0.22745098039215686, + 0.12941176470588237, + 0.2352941176470588, + 0.2627450980392157, + 0.19215686274509808, + 0.16862745098039217, + 0.25098039215686274, + 0.07450980392156863, + 0.09019607843137255, + 0.0588235294117647, + 0.1176470588235294, + 0.06274509803921569, + 0.0588235294117647, + 0.20784313725490197, + 0.7725490196078433, + 0.6431372549019607, + 0.9215686274509803, + 0.33333333333333326, + 0.30196078431372547, + 0.5764705882352941, + 0.2784313725490196, + 0.23921568627450981, + 0.15294117647058825, + 0.2823529411764706, + 0.12941176470588237, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.12549019607843137, + 0.07058823529411765, + 0.11372549019607843, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.047058823529411764, - 0.07450980392156863, - 0.08627450980392157, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.050980392156862744, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.12156862745098039, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.0588235294117647, - 0.09019607843137255, - 0.10980392156862745, - 0.807843137254902, - 0.9490196078431371, - 0.9098039215686274, - 0.9333333333333332, - 0.7843137254901962, - 0.6823529411764706, - 0.5137254901960784, - 0.5529411764705883, - 0.5450980392156862, - 0.4549019607843137, - 0.592156862745098, - 0.9411764705882352, - 0.9254901960784313, - 0.7921568627450981, - 0.8431372549019608, - 0.8862745098039215, - 0.9019607843137255, - 0.807843137254902, - 0.7450980392156863, - 0.5803921568627451, - 0.6352941176470588, - 0.5882352941176471, - 0.4117647058823529, - 0.33725490196078434, - 0.34509803921568627, - 0.40784313725490196, - 0.39607843137254906, - 0.33725490196078434, - 0.3921568627450981, - 0.3254901960784313, - 0.2901960784313726, - 0.3254901960784313, - 0.19215686274509808, - 0.1803921568627451, - 0.26666666666666666, - 0.33333333333333326, - 0.3294117647058823, - 0.18823529411764706, - 0.12941176470588237, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.10196078431372549, - 0.10588235294117647, - 0.09803921568627452, - 0.20392156862745098, - 0.7568627450980392, - 0.5882352941176471, - 0.9568627450980393, - 0.3294117647058823, - 0.30196078431372547, - 0.7176470588235294, - 0.6313725490196078, - 0.2352941176470588, - 0.13725490196078433, - 0.2196078431372549, - 0.1450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.12156862745098039, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.09803921568627452 + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.047058823529411764, + 0.07450980392156863, + 0.08627450980392157, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.050980392156862744, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.12156862745098039, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.0588235294117647, + 0.09019607843137255, + 0.10980392156862745, + 0.807843137254902, + 0.9490196078431371, + 0.9098039215686274, + 0.9333333333333332, + 0.7843137254901962, + 0.6823529411764706, + 0.5137254901960784, + 0.5529411764705883, + 0.5450980392156862, + 0.4549019607843137, + 0.592156862745098, + 0.9411764705882352, + 0.9254901960784313, + 0.7921568627450981, + 0.8431372549019608, + 0.8862745098039215, + 0.9019607843137255, + 0.807843137254902, + 0.7450980392156863, + 0.5803921568627451, + 0.6352941176470588, + 0.5882352941176471, + 0.4117647058823529, + 0.33725490196078434, + 0.34509803921568627, + 0.40784313725490196, + 0.39607843137254906, + 0.33725490196078434, + 0.3921568627450981, + 0.3254901960784313, + 0.2901960784313726, + 0.3254901960784313, + 0.19215686274509808, + 0.1803921568627451, + 0.26666666666666666, + 0.33333333333333326, + 0.3294117647058823, + 0.18823529411764706, + 0.12941176470588237, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.10196078431372549, + 0.10588235294117647, + 0.09803921568627452, + 0.20392156862745098, + 0.7568627450980392, + 0.5882352941176471, + 0.9568627450980393, + 0.3294117647058823, + 0.30196078431372547, + 0.7176470588235294, + 0.6313725490196078, + 0.2352941176470588, + 0.13725490196078433, + 0.2196078431372549, + 0.1450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.12156862745098039, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.09803921568627452 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.06274509803921569, - 0.0588235294117647, - 0.09803921568627452, - 0.10196078431372549, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.09411764705882353, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.40784313725490196, - 0.9568627450980393, - 0.9568627450980393, - 0.8627450980392157, - 0.5372549019607843, - 0.5725490196078431, - 0.5450980392156862, - 0.48627450980392156, - 0.5215686274509804, - 0.43529411764705883, - 0.47450980392156855, - 0.8823529411764706, - 0.9411764705882352, - 0.8549019607843137, - 0.8745098039215686, - 0.7803921568627452, - 0.8235294117647058, - 0.8235294117647058, - 0.7176470588235294, - 0.6509803921568627, - 0.6313725490196078, - 0.4196078431372549, - 0.3803921568627451, - 0.32156862745098036, - 0.35294117647058826, - 0.39607843137254906, - 0.3882352941176471, - 0.35294117647058826, - 0.29411764705882354, - 0.3764705882352941, - 0.26666666666666666, - 0.3058823529411765, - 0.24705882352941178, - 0.34509803921568627, - 0.30196078431372547, - 0.23921568627450981, - 0.20784313725490197, - 0.06666666666666667, - 0.15294117647058825, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09411764705882353, - 0.07450980392156863, - 0.07450980392156863, - 0.12549019607843137, - 0.8901960784313725, - 0.6941176470588235, - 0.8862745098039215, - 0.3411764705882353, - 0.29411764705882354, - 0.6549019607843136, - 0.8980392156862745, - 0.2784313725490196, - 0.10980392156862745, - 0.3294117647058823, - 0.3411764705882353, - 0.09803921568627452, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647 + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.06274509803921569, + 0.0588235294117647, + 0.09803921568627452, + 0.10196078431372549, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.09411764705882353, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.40784313725490196, + 0.9568627450980393, + 0.9568627450980393, + 0.8627450980392157, + 0.5372549019607843, + 0.5725490196078431, + 0.5450980392156862, + 0.48627450980392156, + 0.5215686274509804, + 0.43529411764705883, + 0.47450980392156855, + 0.8823529411764706, + 0.9411764705882352, + 0.8549019607843137, + 0.8745098039215686, + 0.7803921568627452, + 0.8235294117647058, + 0.8235294117647058, + 0.7176470588235294, + 0.6509803921568627, + 0.6313725490196078, + 0.4196078431372549, + 0.3803921568627451, + 0.32156862745098036, + 0.35294117647058826, + 0.39607843137254906, + 0.3882352941176471, + 0.35294117647058826, + 0.29411764705882354, + 0.3764705882352941, + 0.26666666666666666, + 0.3058823529411765, + 0.24705882352941178, + 0.34509803921568627, + 0.30196078431372547, + 0.23921568627450981, + 0.20784313725490197, + 0.06666666666666667, + 0.15294117647058825, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09411764705882353, + 0.07450980392156863, + 0.07450980392156863, + 0.12549019607843137, + 0.8901960784313725, + 0.6941176470588235, + 0.8862745098039215, + 0.3411764705882353, + 0.29411764705882354, + 0.6549019607843136, + 0.8980392156862745, + 0.2784313725490196, + 0.10980392156862745, + 0.3294117647058823, + 0.3411764705882353, + 0.09803921568627452, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.09019607843137255, - 0.07058823529411765, - 0.11372549019607843, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.10980392156862745, - 0.0588235294117647, - 0.07058823529411765, - 0.0588235294117647, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.19215686274509808, - 0.9098039215686274, - 0.9411764705882352, - 0.9254901960784313, - 0.7607843137254902, - 0.3294117647058823, - 0.3411764705882353, - 0.40784313725490196, - 0.403921568627451, - 0.4705882352941176, - 0.3058823529411765, - 0.8784313725490196, - 0.9529411764705881, - 0.9215686274509803, - 0.8549019607843137, - 0.8274509803921568, - 0.7960784313725491, - 0.8156862745098039, - 0.6666666666666665, - 0.6431372549019607, - 0.596078431372549, - 0.48627450980392156, - 0.3411764705882353, - 0.34509803921568627, - 0.3568627450980392, - 0.3411764705882353, - 0.3764705882352941, - 0.3568627450980392, - 0.3803921568627451, - 0.34901960784313724, - 0.32156862745098036, - 0.2980392156862745, - 0.30196078431372547, - 0.3294117647058823, - 0.30980392156862746, - 0.2352941176470588, - 0.16470588235294115, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09019607843137255, - 0.06666666666666667, - 0.06666666666666667, - 0.10196078431372549, - 0.11372549019607843, - 0.8627450980392157, - 0.7019607843137254, - 0.9333333333333332, - 0.3254901960784313, - 0.33333333333333326, - 0.6509803921568627, - 0.9450980392156861, - 0.33333333333333326, - 0.14901960784313725, - 0.2784313725490196, - 0.5529411764705883, - 0.09019607843137255, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057 + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.09019607843137255, + 0.07058823529411765, + 0.11372549019607843, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.10980392156862745, + 0.0588235294117647, + 0.07058823529411765, + 0.0588235294117647, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.19215686274509808, + 0.9098039215686274, + 0.9411764705882352, + 0.9254901960784313, + 0.7607843137254902, + 0.3294117647058823, + 0.3411764705882353, + 0.40784313725490196, + 0.403921568627451, + 0.4705882352941176, + 0.3058823529411765, + 0.8784313725490196, + 0.9529411764705881, + 0.9215686274509803, + 0.8549019607843137, + 0.8274509803921568, + 0.7960784313725491, + 0.8156862745098039, + 0.6666666666666665, + 0.6431372549019607, + 0.596078431372549, + 0.48627450980392156, + 0.3411764705882353, + 0.34509803921568627, + 0.3568627450980392, + 0.3411764705882353, + 0.3764705882352941, + 0.3568627450980392, + 0.3803921568627451, + 0.34901960784313724, + 0.32156862745098036, + 0.2980392156862745, + 0.30196078431372547, + 0.3294117647058823, + 0.30980392156862746, + 0.2352941176470588, + 0.16470588235294115, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09019607843137255, + 0.06666666666666667, + 0.06666666666666667, + 0.10196078431372549, + 0.11372549019607843, + 0.8627450980392157, + 0.7019607843137254, + 0.9333333333333332, + 0.3254901960784313, + 0.33333333333333326, + 0.6509803921568627, + 0.9450980392156861, + 0.33333333333333326, + 0.14901960784313725, + 0.2784313725490196, + 0.5529411764705883, + 0.09019607843137255, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057 ], [ - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.12941176470588237, - 0.08235294117647057, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.09803921568627452, - 0.09019607843137255, - 0.9254901960784313, - 0.9333333333333332, - 0.9098039215686274, - 0.9764705882352941, - 0.8509803921568627, - 0.40784313725490196, - 0.3764705882352941, - 0.43137254901960786, - 0.5333333333333333, - 0.5764705882352941, - 0.8705882352941177, - 0.8980392156862745, - 0.8392156862745098, - 0.8627450980392157, - 0.8823529411764706, - 0.7803921568627452, - 0.8941176470588236, - 0.6823529411764706, - 0.6745098039215687, - 0.5450980392156862, - 0.42745098039215684, - 0.3568627450980392, - 0.37254901960784315, - 0.403921568627451, - 0.43137254901960786, - 0.4, - 0.3411764705882353, - 0.39607843137254906, - 0.37254901960784315, - 0.3058823529411765, - 0.3254901960784313, - 0.3254901960784313, - 0.3764705882352941, - 0.2549019607843137, - 0.25098039215686274, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.08235294117647057, - 0.10980392156862745, - 0.043137254901960784, - 0.9411764705882352, - 0.7529411764705882, - 0.8784313725490196, - 0.37254901960784315, - 0.3568627450980392, - 0.6901960784313725, - 0.9725490196078431, - 0.44313725490196076, - 0.22745098039215686, - 0.1803921568627451, - 0.5450980392156862, - 0.09803921568627452, - 0.08627450980392157, - 0.0588235294117647, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765 + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.12941176470588237, + 0.08235294117647057, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.09803921568627452, + 0.09019607843137255, + 0.9254901960784313, + 0.9333333333333332, + 0.9098039215686274, + 0.9764705882352941, + 0.8509803921568627, + 0.40784313725490196, + 0.3764705882352941, + 0.43137254901960786, + 0.5333333333333333, + 0.5764705882352941, + 0.8705882352941177, + 0.8980392156862745, + 0.8392156862745098, + 0.8627450980392157, + 0.8823529411764706, + 0.7803921568627452, + 0.8941176470588236, + 0.6823529411764706, + 0.6745098039215687, + 0.5450980392156862, + 0.42745098039215684, + 0.3568627450980392, + 0.37254901960784315, + 0.403921568627451, + 0.43137254901960786, + 0.4, + 0.3411764705882353, + 0.39607843137254906, + 0.37254901960784315, + 0.3058823529411765, + 0.3254901960784313, + 0.3254901960784313, + 0.3764705882352941, + 0.2549019607843137, + 0.25098039215686274, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.08235294117647057, + 0.10980392156862745, + 0.043137254901960784, + 0.9411764705882352, + 0.7529411764705882, + 0.8784313725490196, + 0.37254901960784315, + 0.3568627450980392, + 0.6901960784313725, + 0.9725490196078431, + 0.44313725490196076, + 0.22745098039215686, + 0.1803921568627451, + 0.5450980392156862, + 0.09803921568627452, + 0.08627450980392157, + 0.0588235294117647, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765 ], [ - 0.06274509803921569, - 0.06274509803921569, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.054901960784313725, - 0.06274509803921569, - 0.10196078431372549, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.0588235294117647, - 0.054901960784313725, - 0.08235294117647057, - 0.11372549019607843, - 0.08235294117647057, - 0.09803921568627452, - 0.8745098039215686, - 0.9215686274509803, - 0.9372549019607842, - 0.9411764705882352, - 0.8823529411764706, - 0.6470588235294117, - 0.6784313725490196, - 0.6627450980392156, - 0.7372549019607844, - 0.803921568627451, - 0.8509803921568627, - 0.9411764705882352, - 0.8274509803921568, - 0.8705882352941177, - 0.8274509803921568, - 0.7450980392156863, - 0.6313725490196078, - 0.6588235294117646, - 0.6352941176470588, - 0.4980392156862745, - 0.403921568627451, - 0.40784313725490196, - 0.3764705882352941, - 0.403921568627451, - 0.43137254901960786, - 0.4, - 0.3176470588235294, - 0.36470588235294116, - 0.29411764705882354, - 0.3764705882352941, - 0.38431372549019616, - 0.32156862745098036, - 0.30980392156862746, - 0.19215686274509808, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.09411764705882353, - 0.07450980392156863, - 0.06666666666666667, - 0.09019607843137255, - 0.08235294117647057, - 0.09411764705882353, - 0.06666666666666667, - 0.09803921568627452, - 0.08627450980392157, - 0.9568627450980393, - 0.9725490196078431, - 0.8745098039215686, - 0.43529411764705883, - 0.4, - 0.8509803921568627, - 0.9686274509803922, - 0.4980392156862745, - 0.24313725490196078, - 0.20784313725490197, - 0.47843137254901963, - 0.16470588235294115, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.050980392156862744, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765 + 0.06274509803921569, + 0.06274509803921569, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.054901960784313725, + 0.06274509803921569, + 0.10196078431372549, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.0588235294117647, + 0.054901960784313725, + 0.08235294117647057, + 0.11372549019607843, + 0.08235294117647057, + 0.09803921568627452, + 0.8745098039215686, + 0.9215686274509803, + 0.9372549019607842, + 0.9411764705882352, + 0.8823529411764706, + 0.6470588235294117, + 0.6784313725490196, + 0.6627450980392156, + 0.7372549019607844, + 0.803921568627451, + 0.8509803921568627, + 0.9411764705882352, + 0.8274509803921568, + 0.8705882352941177, + 0.8274509803921568, + 0.7450980392156863, + 0.6313725490196078, + 0.6588235294117646, + 0.6352941176470588, + 0.4980392156862745, + 0.403921568627451, + 0.40784313725490196, + 0.3764705882352941, + 0.403921568627451, + 0.43137254901960786, + 0.4, + 0.3176470588235294, + 0.36470588235294116, + 0.29411764705882354, + 0.3764705882352941, + 0.38431372549019616, + 0.32156862745098036, + 0.30980392156862746, + 0.19215686274509808, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.09411764705882353, + 0.07450980392156863, + 0.06666666666666667, + 0.09019607843137255, + 0.08235294117647057, + 0.09411764705882353, + 0.06666666666666667, + 0.09803921568627452, + 0.08627450980392157, + 0.9568627450980393, + 0.9725490196078431, + 0.8745098039215686, + 0.43529411764705883, + 0.4, + 0.8509803921568627, + 0.9686274509803922, + 0.4980392156862745, + 0.24313725490196078, + 0.20784313725490197, + 0.47843137254901963, + 0.16470588235294115, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.050980392156862744, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.08235294117647057, - 0.050980392156862744, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.09019607843137255, - 0.12156862745098039, - 0.596078431372549, - 0.9529411764705881, - 0.984313725490196, - 0.8745098039215686, - 0.9411764705882352, - 0.5803921568627451, - 0.6588235294117646, - 0.6941176470588235, - 0.6705882352941175, - 0.803921568627451, - 0.7803921568627452, - 0.8313725490196079, - 0.7803921568627452, - 0.807843137254902, - 0.8156862745098039, - 0.6901960784313725, - 0.6392156862745098, - 0.6745098039215687, - 0.5568627450980392, - 0.49019607843137253, - 0.4470588235294118, - 0.38431372549019616, - 0.34901960784313724, - 0.38431372549019616, - 0.36470588235294116, - 0.36470588235294116, - 0.3803921568627451, - 0.33725490196078434, - 0.3176470588235294, - 0.27450980392156865, - 0.1411764705882353, - 0.25882352941176473, - 0.12941176470588237, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.08627450980392157, - 0.0784313725490196, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.20784313725490197, - 0.9411764705882352, - 0.8705882352941177, - 0.9058823529411765, - 0.4666666666666666, - 0.35294117647058826, - 0.34509803921568627, - 0.9176470588235294, - 0.9647058823529412, - 0.24313725490196078, - 0.20784313725490197, - 0.30980392156862746, - 0.42745098039215684, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.08235294117647057, + 0.050980392156862744, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.09019607843137255, + 0.12156862745098039, + 0.596078431372549, + 0.9529411764705881, + 0.984313725490196, + 0.8745098039215686, + 0.9411764705882352, + 0.5803921568627451, + 0.6588235294117646, + 0.6941176470588235, + 0.6705882352941175, + 0.803921568627451, + 0.7803921568627452, + 0.8313725490196079, + 0.7803921568627452, + 0.807843137254902, + 0.8156862745098039, + 0.6901960784313725, + 0.6392156862745098, + 0.6745098039215687, + 0.5568627450980392, + 0.49019607843137253, + 0.4470588235294118, + 0.38431372549019616, + 0.34901960784313724, + 0.38431372549019616, + 0.36470588235294116, + 0.36470588235294116, + 0.3803921568627451, + 0.33725490196078434, + 0.3176470588235294, + 0.27450980392156865, + 0.1411764705882353, + 0.25882352941176473, + 0.12941176470588237, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.08627450980392157, + 0.0784313725490196, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.20784313725490197, + 0.9411764705882352, + 0.8705882352941177, + 0.9058823529411765, + 0.4666666666666666, + 0.35294117647058826, + 0.34509803921568627, + 0.9176470588235294, + 0.9647058823529412, + 0.24313725490196078, + 0.20784313725490197, + 0.30980392156862746, + 0.42745098039215684, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.050980392156862744, - 0.08235294117647057, - 0.0588235294117647, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.054901960784313725, - 0.12549019607843137, - 0.07058823529411765, - 0.10196078431372549, - 0.08627450980392157, - 0.07058823529411765, - 0.9019607843137255, - 0.7411764705882353, - 0.6549019607843136, - 0.6588235294117646, - 0.6274509803921569, - 0.6392156862745098, - 0.6705882352941175, - 0.6941176470588235, - 0.7254901960784313, - 0.7764705882352942, - 0.7607843137254902, - 0.8392156862745098, - 0.8196078431372549, - 0.6588235294117646, - 0.6627450980392156, - 0.5254901960784314, - 0.5725490196078431, - 0.5176470588235295, - 0.4705882352941176, - 0.46274509803921565, - 0.4666666666666666, - 0.4549019607843137, - 0.44313725490196076, - 0.4, - 0.4705882352941176, - 0.403921568627451, - 0.3764705882352941, - 0.3411764705882353, - 0.2823529411764706, - 0.22745098039215686, - 0.2823529411764706, - 0.10196078431372549, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.14901960784313725, - 0.1176470588235294, - 0.9294117647058823, - 0.7882352941176471, - 0.9450980392156861, - 0.4666666666666666, - 0.3607843137254902, - 0.37254901960784315, - 0.9568627450980393, - 0.9450980392156861, - 0.2627450980392157, - 0.2549019607843137, - 0.3137254901960784, - 0.4235294117647059, - 0.15294117647058825, - 0.2235294117647059, - 0.09019607843137255, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.1450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.050980392156862744, + 0.08235294117647057, + 0.0588235294117647, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.054901960784313725, + 0.12549019607843137, + 0.07058823529411765, + 0.10196078431372549, + 0.08627450980392157, + 0.07058823529411765, + 0.9019607843137255, + 0.7411764705882353, + 0.6549019607843136, + 0.6588235294117646, + 0.6274509803921569, + 0.6392156862745098, + 0.6705882352941175, + 0.6941176470588235, + 0.7254901960784313, + 0.7764705882352942, + 0.7607843137254902, + 0.8392156862745098, + 0.8196078431372549, + 0.6588235294117646, + 0.6627450980392156, + 0.5254901960784314, + 0.5725490196078431, + 0.5176470588235295, + 0.4705882352941176, + 0.46274509803921565, + 0.4666666666666666, + 0.4549019607843137, + 0.44313725490196076, + 0.4, + 0.4705882352941176, + 0.403921568627451, + 0.3764705882352941, + 0.3411764705882353, + 0.2823529411764706, + 0.22745098039215686, + 0.2823529411764706, + 0.10196078431372549, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.14901960784313725, + 0.1176470588235294, + 0.9294117647058823, + 0.7882352941176471, + 0.9450980392156861, + 0.4666666666666666, + 0.3607843137254902, + 0.37254901960784315, + 0.9568627450980393, + 0.9450980392156861, + 0.2627450980392157, + 0.2549019607843137, + 0.3137254901960784, + 0.4235294117647059, + 0.15294117647058825, + 0.2235294117647059, + 0.09019607843137255, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.1450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.08627450980392157, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.1176470588235294, - 0.0588235294117647, - 0.0588235294117647, - 0.0784313725490196, - 0.0588235294117647, - 0.054901960784313725, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.09803921568627452, - 0.07058823529411765, - 0.0784313725490196, - 0.9019607843137255, - 0.9411764705882352, - 0.6078431372549019, - 0.4980392156862745, - 0.6235294117647059, - 0.5764705882352941, - 0.596078431372549, - 0.5843137254901961, - 0.6549019607843136, - 0.6627450980392156, - 0.7764705882352942, - 0.8352941176470589, - 0.7647058823529411, - 0.6705882352941175, - 0.6, - 0.6392156862745098, - 0.5372549019607843, - 0.5058823529411764, - 0.4470588235294118, - 0.4588235294117647, - 0.5098039215686274, - 0.47843137254901963, - 0.43529411764705883, - 0.4980392156862745, - 0.40784313725490196, - 0.39607843137254906, - 0.3411764705882353, - 0.29411764705882354, - 0.27058823529411763, - 0.27450980392156865, - 0.18823529411764706, - 0.2352941176470588, - 0.10196078431372549, - 0.08235294117647057, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.13725490196078433, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.1411764705882353, - 0.9019607843137255, - 0.9254901960784313, - 0.8705882352941177, - 0.4549019607843137, - 0.3686274509803922, - 0.3176470588235294, - 0.8, - 0.9215686274509803, - 0.27058823529411763, - 0.16078431372549018, - 0.25098039215686274, - 0.45098039215686275, - 0.592156862745098, - 0.3764705882352941, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647 + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.08627450980392157, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.1176470588235294, + 0.0588235294117647, + 0.0588235294117647, + 0.0784313725490196, + 0.0588235294117647, + 0.054901960784313725, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.09803921568627452, + 0.07058823529411765, + 0.0784313725490196, + 0.9019607843137255, + 0.9411764705882352, + 0.6078431372549019, + 0.4980392156862745, + 0.6235294117647059, + 0.5764705882352941, + 0.596078431372549, + 0.5843137254901961, + 0.6549019607843136, + 0.6627450980392156, + 0.7764705882352942, + 0.8352941176470589, + 0.7647058823529411, + 0.6705882352941175, + 0.6, + 0.6392156862745098, + 0.5372549019607843, + 0.5058823529411764, + 0.4470588235294118, + 0.4588235294117647, + 0.5098039215686274, + 0.47843137254901963, + 0.43529411764705883, + 0.4980392156862745, + 0.40784313725490196, + 0.39607843137254906, + 0.3411764705882353, + 0.29411764705882354, + 0.27058823529411763, + 0.27450980392156865, + 0.18823529411764706, + 0.2352941176470588, + 0.10196078431372549, + 0.08235294117647057, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.13725490196078433, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.1411764705882353, + 0.9019607843137255, + 0.9254901960784313, + 0.8705882352941177, + 0.4549019607843137, + 0.3686274509803922, + 0.3176470588235294, + 0.8, + 0.9215686274509803, + 0.27058823529411763, + 0.16078431372549018, + 0.25098039215686274, + 0.45098039215686275, + 0.592156862745098, + 0.3764705882352941, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647 ], [ - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.08627450980392157, - 0.09019607843137255, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.0784313725490196, - 0.09803921568627452, - 0.07450980392156863, - 0.06274509803921569, - 0.08627450980392157, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.3254901960784313, - 0.8901960784313725, - 0.7098039215686275, - 0.7058823529411765, - 0.6666666666666665, - 0.7882352941176471, - 0.47450980392156855, - 0.5529411764705883, - 0.5019607843137255, - 0.6196078431372549, - 0.7372549019607844, - 0.7294117647058823, - 0.6549019607843136, - 0.7411764705882353, - 0.6235294117647059, - 0.5686274509803921, - 0.49411764705882355, - 0.47843137254901963, - 0.44313725490196076, - 0.48627450980392156, - 0.5254901960784314, - 0.5294117647058824, - 0.48627450980392156, - 0.48627450980392156, - 0.4705882352941176, - 0.41568627450980394, - 0.36470588235294116, - 0.3058823529411765, - 0.2784313725490196, - 0.3176470588235294, - 0.2901960784313726, - 0.23137254901960783, - 0.11372549019607843, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.0784313725490196, - 0.12941176470588237, - 0.07450980392156863, - 0.08235294117647057, - 0.08235294117647057, - 0.0784313725490196, - 0.07058823529411765, - 0.09411764705882353, - 0.1568627450980392, - 0.9529411764705881, - 0.9490196078431371, - 0.9411764705882352, - 0.4823529411764706, - 0.37254901960784315, - 0.33333333333333326, - 0.8392156862745098, - 0.9176470588235294, - 0.43137254901960786, - 0.1843137254901961, - 0.3176470588235294, - 0.5529411764705883, - 0.2784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196 + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.08627450980392157, + 0.09019607843137255, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.0784313725490196, + 0.09803921568627452, + 0.07450980392156863, + 0.06274509803921569, + 0.08627450980392157, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.3254901960784313, + 0.8901960784313725, + 0.7098039215686275, + 0.7058823529411765, + 0.6666666666666665, + 0.7882352941176471, + 0.47450980392156855, + 0.5529411764705883, + 0.5019607843137255, + 0.6196078431372549, + 0.7372549019607844, + 0.7294117647058823, + 0.6549019607843136, + 0.7411764705882353, + 0.6235294117647059, + 0.5686274509803921, + 0.49411764705882355, + 0.47843137254901963, + 0.44313725490196076, + 0.48627450980392156, + 0.5254901960784314, + 0.5294117647058824, + 0.48627450980392156, + 0.48627450980392156, + 0.4705882352941176, + 0.41568627450980394, + 0.36470588235294116, + 0.3058823529411765, + 0.2784313725490196, + 0.3176470588235294, + 0.2901960784313726, + 0.23137254901960783, + 0.11372549019607843, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.0784313725490196, + 0.12941176470588237, + 0.07450980392156863, + 0.08235294117647057, + 0.08235294117647057, + 0.0784313725490196, + 0.07058823529411765, + 0.09411764705882353, + 0.1568627450980392, + 0.9529411764705881, + 0.9490196078431371, + 0.9411764705882352, + 0.4823529411764706, + 0.37254901960784315, + 0.33333333333333326, + 0.8392156862745098, + 0.9176470588235294, + 0.43137254901960786, + 0.1843137254901961, + 0.3176470588235294, + 0.5529411764705883, + 0.2784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196 ], [ - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.1176470588235294, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.09411764705882353, - 0.08235294117647057, - 0.09019607843137255, - 0.12156862745098039, - 0.09411764705882353, - 0.8196078431372549, - 0.8901960784313725, - 0.9529411764705881, - 0.8705882352941177, - 0.8117647058823529, - 0.6901960784313725, - 0.6745098039215687, - 0.615686274509804, - 0.6509803921568627, - 0.7686274509803923, - 0.7960784313725491, - 0.6784313725490196, - 0.6274509803921569, - 0.5647058823529412, - 0.5254901960784314, - 0.48627450980392156, - 0.5058823529411764, - 0.5098039215686274, - 0.5019607843137255, - 0.5058823529411764, - 0.5137254901960784, - 0.5215686274509804, - 0.5294117647058824, - 0.4823529411764706, - 0.4, - 0.3568627450980392, - 0.37254901960784315, - 0.3254901960784313, - 0.9019607843137255, - 0.3764705882352941, - 0.2980392156862745, - 0.1803921568627451, - 0.08235294117647057, - 0.07058823529411765, - 0.14901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.054901960784313725, - 0.054901960784313725, - 0.10980392156862745, - 0.0784313725490196, - 0.9450980392156861, - 0.9647058823529412, - 0.9215686274509803, - 0.5254901960784314, - 0.5529411764705883, - 0.3803921568627451, - 0.7882352941176471, - 0.9294117647058823, - 0.7450980392156863, - 0.2549019607843137, - 0.25882352941176473, - 0.4117647058823529, - 0.3607843137254902, - 0.08627450980392157, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667 + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.1176470588235294, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.09411764705882353, + 0.08235294117647057, + 0.09019607843137255, + 0.12156862745098039, + 0.09411764705882353, + 0.8196078431372549, + 0.8901960784313725, + 0.9529411764705881, + 0.8705882352941177, + 0.8117647058823529, + 0.6901960784313725, + 0.6745098039215687, + 0.615686274509804, + 0.6509803921568627, + 0.7686274509803923, + 0.7960784313725491, + 0.6784313725490196, + 0.6274509803921569, + 0.5647058823529412, + 0.5254901960784314, + 0.48627450980392156, + 0.5058823529411764, + 0.5098039215686274, + 0.5019607843137255, + 0.5058823529411764, + 0.5137254901960784, + 0.5215686274509804, + 0.5294117647058824, + 0.4823529411764706, + 0.4, + 0.3568627450980392, + 0.37254901960784315, + 0.3254901960784313, + 0.9019607843137255, + 0.3764705882352941, + 0.2980392156862745, + 0.1803921568627451, + 0.08235294117647057, + 0.07058823529411765, + 0.14901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.054901960784313725, + 0.054901960784313725, + 0.10980392156862745, + 0.0784313725490196, + 0.9450980392156861, + 0.9647058823529412, + 0.9215686274509803, + 0.5254901960784314, + 0.5529411764705883, + 0.3803921568627451, + 0.7882352941176471, + 0.9294117647058823, + 0.7450980392156863, + 0.2549019607843137, + 0.25882352941176473, + 0.4117647058823529, + 0.3607843137254902, + 0.08627450980392157, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667 ], [ - 0.09019607843137255, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.09803921568627452, - 0.09411764705882353, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.09019607843137255, - 0.0784313725490196, - 0.08235294117647057, - 0.08235294117647057, - 0.7882352941176471, - 0.9098039215686274, - 0.8509803921568627, - 0.8549019607843137, - 0.6509803921568627, - 0.5803921568627451, - 0.6274509803921569, - 0.6039215686274509, - 0.7019607843137254, - 0.7686274509803923, - 0.7686274509803923, - 0.7568627450980392, - 0.6745098039215687, - 0.596078431372549, - 0.5647058823529412, - 0.5294117647058824, - 0.5176470588235295, - 0.5137254901960784, - 0.47450980392156855, - 0.4823529411764706, - 0.5450980392156862, - 0.5137254901960784, - 0.5294117647058824, - 0.4549019607843137, - 0.4235294117647059, - 0.30980392156862746, - 0.30980392156862746, - 0.34509803921568627, - 0.9294117647058823, - 0.5372549019607843, - 0.24705882352941178, - 0.17647058823529413, - 0.13333333333333333, - 0.1176470588235294, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.0784313725490196, - 0.09019607843137255, - 0.09411764705882353, - 0.13333333333333333, - 0.9490196078431371, - 0.9372549019607842, - 0.9764705882352941, - 0.5058823529411764, - 0.5725490196078431, - 0.3882352941176471, - 0.8745098039215686, - 0.803921568627451, - 0.9686274509803922, - 0.23921568627450981, - 0.28627450980392155, - 0.4117647058823529, - 0.5607843137254902, - 0.09019607843137255, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863 + 0.09019607843137255, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.09803921568627452, + 0.09411764705882353, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.09019607843137255, + 0.0784313725490196, + 0.08235294117647057, + 0.08235294117647057, + 0.7882352941176471, + 0.9098039215686274, + 0.8509803921568627, + 0.8549019607843137, + 0.6509803921568627, + 0.5803921568627451, + 0.6274509803921569, + 0.6039215686274509, + 0.7019607843137254, + 0.7686274509803923, + 0.7686274509803923, + 0.7568627450980392, + 0.6745098039215687, + 0.596078431372549, + 0.5647058823529412, + 0.5294117647058824, + 0.5176470588235295, + 0.5137254901960784, + 0.47450980392156855, + 0.4823529411764706, + 0.5450980392156862, + 0.5137254901960784, + 0.5294117647058824, + 0.4549019607843137, + 0.4235294117647059, + 0.30980392156862746, + 0.30980392156862746, + 0.34509803921568627, + 0.9294117647058823, + 0.5372549019607843, + 0.24705882352941178, + 0.17647058823529413, + 0.13333333333333333, + 0.1176470588235294, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.0784313725490196, + 0.09019607843137255, + 0.09411764705882353, + 0.13333333333333333, + 0.9490196078431371, + 0.9372549019607842, + 0.9764705882352941, + 0.5058823529411764, + 0.5725490196078431, + 0.3882352941176471, + 0.8745098039215686, + 0.803921568627451, + 0.9686274509803922, + 0.23921568627450981, + 0.28627450980392155, + 0.4117647058823529, + 0.5607843137254902, + 0.09019607843137255, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.08235294117647057, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.07450980392156863, - 0.043137254901960784, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.08627450980392157, - 0.08627450980392157, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.0588235294117647, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.050980392156862744, - 0.07450980392156863, - 0.09019607843137255, - 0.19215686274509808, - 0.9686274509803922, - 0.8196078431372549, - 0.6941176470588235, - 0.6274509803921569, - 0.6078431372549019, - 0.5764705882352941, - 0.6078431372549019, - 0.611764705882353, - 0.6470588235294117, - 0.6549019607843136, - 0.7019607843137254, - 0.5686274509803921, - 0.5529411764705883, - 0.5686274509803921, - 0.5725490196078431, - 0.5137254901960784, - 0.5333333333333333, - 0.5215686274509804, - 0.5254901960784314, - 0.596078431372549, - 0.5137254901960784, - 0.5333333333333333, - 0.4980392156862745, - 0.34901960784313724, - 0.2901960784313726, - 0.3411764705882353, - 0.403921568627451, - 0.5764705882352941, - 0.42745098039215684, - 0.16470588235294115, - 0.14901960784313725, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.23137254901960783, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.16078431372549018, - 0.12156862745098039, - 0.12549019607843137, - 0.10980392156862745, - 0.09411764705882353, - 0.9411764705882352, - 0.9607843137254902, - 0.9450980392156861, - 0.611764705882353, - 0.8352941176470589, - 0.403921568627451, - 0.7254901960784313, - 0.9058823529411765, - 0.9686274509803922, - 0.27058823529411763, - 0.3176470588235294, - 0.3294117647058823, - 0.5411764705882353, - 0.14901960784313725, - 0.0784313725490196, - 0.09019607843137255, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.08235294117647057, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.07450980392156863, + 0.043137254901960784, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.08627450980392157, + 0.08627450980392157, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.0588235294117647, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.050980392156862744, + 0.07450980392156863, + 0.09019607843137255, + 0.19215686274509808, + 0.9686274509803922, + 0.8196078431372549, + 0.6941176470588235, + 0.6274509803921569, + 0.6078431372549019, + 0.5764705882352941, + 0.6078431372549019, + 0.611764705882353, + 0.6470588235294117, + 0.6549019607843136, + 0.7019607843137254, + 0.5686274509803921, + 0.5529411764705883, + 0.5686274509803921, + 0.5725490196078431, + 0.5137254901960784, + 0.5333333333333333, + 0.5215686274509804, + 0.5254901960784314, + 0.596078431372549, + 0.5137254901960784, + 0.5333333333333333, + 0.4980392156862745, + 0.34901960784313724, + 0.2901960784313726, + 0.3411764705882353, + 0.403921568627451, + 0.5764705882352941, + 0.42745098039215684, + 0.16470588235294115, + 0.14901960784313725, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.23137254901960783, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.16078431372549018, + 0.12156862745098039, + 0.12549019607843137, + 0.10980392156862745, + 0.09411764705882353, + 0.9411764705882352, + 0.9607843137254902, + 0.9450980392156861, + 0.611764705882353, + 0.8352941176470589, + 0.403921568627451, + 0.7254901960784313, + 0.9058823529411765, + 0.9686274509803922, + 0.27058823529411763, + 0.3176470588235294, + 0.3294117647058823, + 0.5411764705882353, + 0.14901960784313725, + 0.0784313725490196, + 0.09019607843137255, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.08627450980392157, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.09019607843137255, - 0.06666666666666667, - 0.06666666666666667, - 0.09803921568627452, - 0.09803921568627452, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.054901960784313725, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.08235294117647057, - 0.11372549019607843, - 0.08627450980392157, - 0.9254901960784313, - 0.9333333333333332, - 0.8588235294117647, - 0.8901960784313725, - 0.6196078431372549, - 0.5529411764705883, - 0.592156862745098, - 0.6313725490196078, - 0.6588235294117646, - 0.6509803921568627, - 0.6941176470588235, - 0.5803921568627451, - 0.5725490196078431, - 0.5725490196078431, - 0.47843137254901963, - 0.596078431372549, - 0.5490196078431373, - 0.6, - 0.615686274509804, - 0.5215686274509804, - 0.5686274509803921, - 0.49411764705882355, - 0.3294117647058823, - 0.37254901960784315, - 0.3568627450980392, - 0.34509803921568627, - 0.3607843137254902, - 0.30980392156862746, - 0.4823529411764706, - 0.24313725490196078, - 0.4549019607843137, - 0.09803921568627452, - 0.07450980392156863, - 0.09803921568627452, - 0.09019607843137255, - 0.0588235294117647, - 0.06666666666666667, - 0.09411764705882353, - 0.054901960784313725, - 0.1450980392156863, - 0.16078431372549018, - 0.0588235294117647, - 0.0784313725490196, - 0.9411764705882352, - 0.9294117647058823, - 0.8352941176470589, - 0.6549019607843136, - 0.8784313725490196, - 0.39607843137254906, - 0.8666666666666667, - 0.9137254901960784, - 0.9215686274509803, - 0.24705882352941178, - 0.27058823529411763, - 0.16470588235294115, - 0.5882352941176471, - 0.5098039215686274, - 0.11372549019607843, - 0.10196078431372549, - 0.08627450980392157, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.12156862745098039, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863 + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.08627450980392157, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.09019607843137255, + 0.06666666666666667, + 0.06666666666666667, + 0.09803921568627452, + 0.09803921568627452, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.054901960784313725, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.08235294117647057, + 0.11372549019607843, + 0.08627450980392157, + 0.9254901960784313, + 0.9333333333333332, + 0.8588235294117647, + 0.8901960784313725, + 0.6196078431372549, + 0.5529411764705883, + 0.592156862745098, + 0.6313725490196078, + 0.6588235294117646, + 0.6509803921568627, + 0.6941176470588235, + 0.5803921568627451, + 0.5725490196078431, + 0.5725490196078431, + 0.47843137254901963, + 0.596078431372549, + 0.5490196078431373, + 0.6, + 0.615686274509804, + 0.5215686274509804, + 0.5686274509803921, + 0.49411764705882355, + 0.3294117647058823, + 0.37254901960784315, + 0.3568627450980392, + 0.34509803921568627, + 0.3607843137254902, + 0.30980392156862746, + 0.4823529411764706, + 0.24313725490196078, + 0.4549019607843137, + 0.09803921568627452, + 0.07450980392156863, + 0.09803921568627452, + 0.09019607843137255, + 0.0588235294117647, + 0.06666666666666667, + 0.09411764705882353, + 0.054901960784313725, + 0.1450980392156863, + 0.16078431372549018, + 0.0588235294117647, + 0.0784313725490196, + 0.9411764705882352, + 0.9294117647058823, + 0.8352941176470589, + 0.6549019607843136, + 0.8784313725490196, + 0.39607843137254906, + 0.8666666666666667, + 0.9137254901960784, + 0.9215686274509803, + 0.24705882352941178, + 0.27058823529411763, + 0.16470588235294115, + 0.5882352941176471, + 0.5098039215686274, + 0.11372549019607843, + 0.10196078431372549, + 0.08627450980392157, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.12156862745098039, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863 ], [ - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.054901960784313725, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.050980392156862744, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.0588235294117647, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.047058823529411764, - 0.07450980392156863, - 0.06274509803921569, - 0.0588235294117647, - 0.0588235294117647, - 0.08235294117647057, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.08627450980392157, - 0.0588235294117647, - 0.09803921568627452, - 0.9333333333333332, - 0.9490196078431371, - 0.9411764705882352, - 0.9137254901960784, - 0.7803921568627452, - 0.7450980392156863, - 0.6705882352941175, - 0.5647058823529412, - 0.6, - 0.6235294117647059, - 0.5882352941176471, - 0.6078431372549019, - 0.6039215686274509, - 0.5882352941176471, - 0.5803921568627451, - 0.611764705882353, - 0.5686274509803921, - 0.5607843137254902, - 0.5254901960784314, - 0.5607843137254902, - 0.403921568627451, - 0.41568627450980394, - 0.37254901960784315, - 0.34509803921568627, - 0.3803921568627451, - 0.3764705882352941, - 0.34509803921568627, - 0.3764705882352941, - 0.5411764705882353, - 0.3686274509803922, - 0.2627450980392157, - 0.16470588235294115, - 0.2, - 0.36470588235294116, - 0.5372549019607843, - 0.3607843137254902, - 0.5333333333333333, - 0.596078431372549, - 0.4980392156862745, - 0.3568627450980392, - 0.33725490196078434, - 0.3176470588235294, - 0.1176470588235294, - 0.807843137254902, - 0.9529411764705881, - 0.6313725490196078, - 0.7294117647058823, - 0.9254901960784313, - 0.39607843137254906, - 0.5450980392156862, - 0.8980392156862745, - 0.8784313725490196, - 0.3058823529411765, - 0.20392156862745098, - 0.3803921568627451, - 0.49411764705882355, - 0.6352941176470588, - 0.16862745098039217, - 0.10980392156862745, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765 + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.054901960784313725, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.050980392156862744, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.0588235294117647, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.047058823529411764, + 0.07450980392156863, + 0.06274509803921569, + 0.0588235294117647, + 0.0588235294117647, + 0.08235294117647057, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.08627450980392157, + 0.0588235294117647, + 0.09803921568627452, + 0.9333333333333332, + 0.9490196078431371, + 0.9411764705882352, + 0.9137254901960784, + 0.7803921568627452, + 0.7450980392156863, + 0.6705882352941175, + 0.5647058823529412, + 0.6, + 0.6235294117647059, + 0.5882352941176471, + 0.6078431372549019, + 0.6039215686274509, + 0.5882352941176471, + 0.5803921568627451, + 0.611764705882353, + 0.5686274509803921, + 0.5607843137254902, + 0.5254901960784314, + 0.5607843137254902, + 0.403921568627451, + 0.41568627450980394, + 0.37254901960784315, + 0.34509803921568627, + 0.3803921568627451, + 0.3764705882352941, + 0.34509803921568627, + 0.3764705882352941, + 0.5411764705882353, + 0.3686274509803922, + 0.2627450980392157, + 0.16470588235294115, + 0.2, + 0.36470588235294116, + 0.5372549019607843, + 0.3607843137254902, + 0.5333333333333333, + 0.596078431372549, + 0.4980392156862745, + 0.3568627450980392, + 0.33725490196078434, + 0.3176470588235294, + 0.1176470588235294, + 0.807843137254902, + 0.9529411764705881, + 0.6313725490196078, + 0.7294117647058823, + 0.9254901960784313, + 0.39607843137254906, + 0.5450980392156862, + 0.8980392156862745, + 0.8784313725490196, + 0.3058823529411765, + 0.20392156862745098, + 0.3803921568627451, + 0.49411764705882355, + 0.6352941176470588, + 0.16862745098039217, + 0.10980392156862745, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.0784313725490196, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.09019607843137255, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.08235294117647057, - 0.0784313725490196, - 0.1803921568627451, - 0.9294117647058823, - 0.9686274509803922, - 0.8666666666666667, - 0.7764705882352942, - 0.7490196078431373, - 0.6784313725490196, - 0.6196078431372549, - 0.5725490196078431, - 0.5725490196078431, - 0.5764705882352941, - 0.5490196078431373, - 0.611764705882353, - 0.5803921568627451, - 0.5058823529411764, - 0.6274509803921569, - 0.5254901960784314, - 0.5607843137254902, - 0.4235294117647059, - 0.44313725490196076, - 0.3882352941176471, - 0.41568627450980394, - 0.33725490196078434, - 0.3686274509803922, - 0.38431372549019616, - 0.34901960784313724, - 0.3411764705882353, - 0.34509803921568627, - 0.2196078431372549, - 0.2901960784313726, - 0.49019607843137253, - 0.6, - 0.5725490196078431, - 0.6, - 0.5686274509803921, - 0.6941176470588235, - 0.6745098039215687, - 0.5882352941176471, - 0.5254901960784314, - 0.4666666666666666, - 0.34901960784313724, - 0.3058823529411765, - 0.27450980392156865, - 0.8784313725490196, - 0.8784313725490196, - 0.6549019607843136, - 0.7019607843137254, - 0.9019607843137255, - 0.7803921568627452, - 0.403921568627451, - 0.8823529411764706, - 0.9372549019607842, - 0.36470588235294116, - 0.12156862745098039, - 0.2823529411764706, - 0.43529411764705883, - 0.5607843137254902, - 0.12156862745098039, - 0.12549019607843137, - 0.08235294117647057, - 0.10196078431372549, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.0784313725490196, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.09019607843137255, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.08235294117647057, + 0.0784313725490196, + 0.1803921568627451, + 0.9294117647058823, + 0.9686274509803922, + 0.8666666666666667, + 0.7764705882352942, + 0.7490196078431373, + 0.6784313725490196, + 0.6196078431372549, + 0.5725490196078431, + 0.5725490196078431, + 0.5764705882352941, + 0.5490196078431373, + 0.611764705882353, + 0.5803921568627451, + 0.5058823529411764, + 0.6274509803921569, + 0.5254901960784314, + 0.5607843137254902, + 0.4235294117647059, + 0.44313725490196076, + 0.3882352941176471, + 0.41568627450980394, + 0.33725490196078434, + 0.3686274509803922, + 0.38431372549019616, + 0.34901960784313724, + 0.3411764705882353, + 0.34509803921568627, + 0.2196078431372549, + 0.2901960784313726, + 0.49019607843137253, + 0.6, + 0.5725490196078431, + 0.6, + 0.5686274509803921, + 0.6941176470588235, + 0.6745098039215687, + 0.5882352941176471, + 0.5254901960784314, + 0.4666666666666666, + 0.34901960784313724, + 0.3058823529411765, + 0.27450980392156865, + 0.8784313725490196, + 0.8784313725490196, + 0.6549019607843136, + 0.7019607843137254, + 0.9019607843137255, + 0.7803921568627452, + 0.403921568627451, + 0.8823529411764706, + 0.9372549019607842, + 0.36470588235294116, + 0.12156862745098039, + 0.2823529411764706, + 0.43529411764705883, + 0.5607843137254902, + 0.12156862745098039, + 0.12549019607843137, + 0.08235294117647057, + 0.10196078431372549, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07450980392156863, - 0.050980392156862744, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.09019607843137255, - 0.07450980392156863, - 0.07450980392156863, - 0.09019607843137255, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.0588235294117647, - 0.09019607843137255, - 0.08627450980392157, - 0.07450980392156863, - 0.09411764705882353, - 0.10588235294117647, - 0.10196078431372549, - 0.07450980392156863, - 0.3294117647058823, - 0.8784313725490196, - 0.8745098039215686, - 0.7960784313725491, - 0.7176470588235294, - 0.5882352941176471, - 0.5686274509803921, - 0.5803921568627451, - 0.5215686274509804, - 0.5607843137254902, - 0.5882352941176471, - 0.5333333333333333, - 0.5215686274509804, - 0.5843137254901961, - 0.5294117647058824, - 0.49411764705882355, - 0.4196078431372549, - 0.45098039215686275, - 0.4235294117647059, - 0.4, - 0.39607843137254906, - 0.42745098039215684, - 0.34509803921568627, - 0.36470588235294116, - 0.3803921568627451, - 0.3294117647058823, - 0.4235294117647059, - 0.5803921568627451, - 0.7764705882352942, - 0.7568627450980392, - 0.8352941176470589, - 0.8274509803921568, - 0.7803921568627452, - 0.6352941176470588, - 0.6039215686274509, - 0.6509803921568627, - 0.6666666666666665, - 0.5450980392156862, - 0.45098039215686275, - 0.3764705882352941, - 0.34509803921568627, - 0.25098039215686274, - 0.5686274509803921, - 0.8862745098039215, - 0.6196078431372549, - 0.596078431372549, - 0.9215686274509803, - 0.9647058823529412, - 0.41568627450980394, - 0.8941176470588236, - 0.9254901960784313, - 0.3921568627450981, - 0.3137254901960784, - 0.25882352941176473, - 0.2901960784313726, - 0.6196078431372549, - 0.2901960784313726, - 0.0784313725490196, - 0.09411764705882353, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667 + 0.07058823529411765, + 0.07450980392156863, + 0.050980392156862744, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.09019607843137255, + 0.07450980392156863, + 0.07450980392156863, + 0.09019607843137255, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.0588235294117647, + 0.09019607843137255, + 0.08627450980392157, + 0.07450980392156863, + 0.09411764705882353, + 0.10588235294117647, + 0.10196078431372549, + 0.07450980392156863, + 0.3294117647058823, + 0.8784313725490196, + 0.8745098039215686, + 0.7960784313725491, + 0.7176470588235294, + 0.5882352941176471, + 0.5686274509803921, + 0.5803921568627451, + 0.5215686274509804, + 0.5607843137254902, + 0.5882352941176471, + 0.5333333333333333, + 0.5215686274509804, + 0.5843137254901961, + 0.5294117647058824, + 0.49411764705882355, + 0.4196078431372549, + 0.45098039215686275, + 0.4235294117647059, + 0.4, + 0.39607843137254906, + 0.42745098039215684, + 0.34509803921568627, + 0.36470588235294116, + 0.3803921568627451, + 0.3294117647058823, + 0.4235294117647059, + 0.5803921568627451, + 0.7764705882352942, + 0.7568627450980392, + 0.8352941176470589, + 0.8274509803921568, + 0.7803921568627452, + 0.6352941176470588, + 0.6039215686274509, + 0.6509803921568627, + 0.6666666666666665, + 0.5450980392156862, + 0.45098039215686275, + 0.3764705882352941, + 0.34509803921568627, + 0.25098039215686274, + 0.5686274509803921, + 0.8862745098039215, + 0.6196078431372549, + 0.596078431372549, + 0.9215686274509803, + 0.9647058823529412, + 0.41568627450980394, + 0.8941176470588236, + 0.9254901960784313, + 0.3921568627450981, + 0.3137254901960784, + 0.25882352941176473, + 0.2901960784313726, + 0.6196078431372549, + 0.2901960784313726, + 0.0784313725490196, + 0.09411764705882353, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.054901960784313725, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.09411764705882353, - 0.09019607843137255, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.44313725490196076, - 0.6666666666666665, - 0.6470588235294117, - 0.5529411764705883, - 0.4980392156862745, - 0.5411764705882353, - 0.5254901960784314, - 0.37254901960784315, - 0.3568627450980392, - 0.4196078431372549, - 0.4980392156862745, - 0.39607843137254906, - 0.4196078431372549, - 0.41568627450980394, - 0.5333333333333333, - 0.4823529411764706, - 0.4705882352941176, - 0.45098039215686275, - 0.45098039215686275, - 0.43137254901960786, - 0.5019607843137255, - 0.5176470588235295, - 0.7411764705882353, - 0.9450980392156861, - 0.9137254901960784, - 0.9450980392156861, - 0.9058823529411765, - 0.8941176470588236, - 0.8980392156862745, - 0.8392156862745098, - 0.6509803921568627, - 0.6862745098039216, - 0.6745098039215687, - 0.42745098039215684, - 0.28627450980392155, - 0.1411764705882353, - 0.25098039215686274, - 0.27450980392156865, - 0.2823529411764706, - 0.1843137254901961, - 0.5333333333333333, - 0.7333333333333333, - 0.6392156862745098, - 0.7411764705882353, - 0.8156862745098039, - 0.9490196078431371, - 0.4549019607843137, - 0.8784313725490196, - 0.9490196078431371, - 0.7254901960784313, - 0.14901960784313725, - 0.22745098039215686, - 0.3803921568627451, - 0.5137254901960784, - 0.4196078431372549, - 0.0784313725490196, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.09019607843137255 + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.054901960784313725, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.09411764705882353, + 0.09019607843137255, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.44313725490196076, + 0.6666666666666665, + 0.6470588235294117, + 0.5529411764705883, + 0.4980392156862745, + 0.5411764705882353, + 0.5254901960784314, + 0.37254901960784315, + 0.3568627450980392, + 0.4196078431372549, + 0.4980392156862745, + 0.39607843137254906, + 0.4196078431372549, + 0.41568627450980394, + 0.5333333333333333, + 0.4823529411764706, + 0.4705882352941176, + 0.45098039215686275, + 0.45098039215686275, + 0.43137254901960786, + 0.5019607843137255, + 0.5176470588235295, + 0.7411764705882353, + 0.9450980392156861, + 0.9137254901960784, + 0.9450980392156861, + 0.9058823529411765, + 0.8941176470588236, + 0.8980392156862745, + 0.8392156862745098, + 0.6509803921568627, + 0.6862745098039216, + 0.6745098039215687, + 0.42745098039215684, + 0.28627450980392155, + 0.1411764705882353, + 0.25098039215686274, + 0.27450980392156865, + 0.2823529411764706, + 0.1843137254901961, + 0.5333333333333333, + 0.7333333333333333, + 0.6392156862745098, + 0.7411764705882353, + 0.8156862745098039, + 0.9490196078431371, + 0.4549019607843137, + 0.8784313725490196, + 0.9490196078431371, + 0.7254901960784313, + 0.14901960784313725, + 0.22745098039215686, + 0.3803921568627451, + 0.5137254901960784, + 0.4196078431372549, + 0.0784313725490196, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.09019607843137255 ], [ - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.043137254901960784, - 0.07450980392156863, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.1450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.08627450980392157, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0392156862745098, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.1176470588235294, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.09411764705882353, - 0.08627450980392157, - 0.08627450980392157, - 0.054901960784313725, - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.047058823529411764, - 0.17647058823529413, - 0.2235294117647059, - 0.2549019607843137, - 0.17254901960784313, - 0.06274509803921569, - 0.08235294117647057, - 0.08235294117647057, - 0.3176470588235294, - 0.7137254901960784, - 0.6352941176470588, - 0.6196078431372549, - 0.5607843137254902, - 0.5607843137254902, - 0.5137254901960784, - 0.5490196078431373, - 0.35294117647058826, - 0.9333333333333332, - 0.9764705882352941, - 0.9647058823529412, - 0.8980392156862745, - 0.9490196078431371, - 0.9568627450980393, - 0.984313725490196, - 0.9411764705882352, - 0.8862745098039215, - 0.7725490196078433, - 0.7450980392156863, - 0.49019607843137253, - 0.24705882352941178, - 0.24313725490196078, - 0.28627450980392155, - 0.27058823529411763, - 0.2352941176470588, - 0.25882352941176473, - 0.24313725490196078, - 0.25882352941176473, - 0.2627450980392157, - 0.23137254901960783, - 0.41568627450980394, - 0.6470588235294117, - 0.6509803921568627, - 0.8980392156862745, - 0.7137254901960784, - 0.9058823529411765, - 0.42745098039215684, - 0.7647058823529411, - 0.8823529411764706, - 0.9372549019607842, - 0.2627450980392157, - 0.21568627450980393, - 0.39607843137254906, - 0.44313725490196076, - 0.5647058823529412, - 0.10588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.08235294117647057, - 0.07058823529411765 + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.043137254901960784, + 0.07450980392156863, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.1450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.08627450980392157, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0392156862745098, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.1176470588235294, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.09411764705882353, + 0.08627450980392157, + 0.08627450980392157, + 0.054901960784313725, + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.047058823529411764, + 0.17647058823529413, + 0.2235294117647059, + 0.2549019607843137, + 0.17254901960784313, + 0.06274509803921569, + 0.08235294117647057, + 0.08235294117647057, + 0.3176470588235294, + 0.7137254901960784, + 0.6352941176470588, + 0.6196078431372549, + 0.5607843137254902, + 0.5607843137254902, + 0.5137254901960784, + 0.5490196078431373, + 0.35294117647058826, + 0.9333333333333332, + 0.9764705882352941, + 0.9647058823529412, + 0.8980392156862745, + 0.9490196078431371, + 0.9568627450980393, + 0.984313725490196, + 0.9411764705882352, + 0.8862745098039215, + 0.7725490196078433, + 0.7450980392156863, + 0.49019607843137253, + 0.24705882352941178, + 0.24313725490196078, + 0.28627450980392155, + 0.27058823529411763, + 0.2352941176470588, + 0.25882352941176473, + 0.24313725490196078, + 0.25882352941176473, + 0.2627450980392157, + 0.23137254901960783, + 0.41568627450980394, + 0.6470588235294117, + 0.6509803921568627, + 0.8980392156862745, + 0.7137254901960784, + 0.9058823529411765, + 0.42745098039215684, + 0.7647058823529411, + 0.8823529411764706, + 0.9372549019607842, + 0.2627450980392157, + 0.21568627450980393, + 0.39607843137254906, + 0.44313725490196076, + 0.5647058823529412, + 0.10588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.08235294117647057, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.09411764705882353, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.10196078431372549, - 0.07450980392156863, - 0.06274509803921569, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.10980392156862745, - 0.8156862745098039, - 0.807843137254902, - 0.7764705882352942, - 0.6196078431372549, - 0.5803921568627451, - 0.5215686274509804, - 0.9372549019607842, - 0.9764705882352941, - 0.996078431372549, - 0.9450980392156861, - 0.9333333333333332, - 0.9686274509803922, - 0.9725490196078431, - 0.9882352941176471, - 0.9764705882352941, - 0.8901960784313725, - 0.7058823529411765, - 0.34901960784313724, - 0.25098039215686274, - 0.23137254901960783, - 0.20392156862745098, - 0.20392156862745098, - 0.1843137254901961, - 0.22745098039215686, - 0.2352941176470588, - 0.19215686274509808, - 0.2235294117647059, - 0.22745098039215686, - 0.27450980392156865, - 0.2549019607843137, - 0.21568627450980393, - 0.6431372549019607, - 0.7176470588235294, - 0.9294117647058823, - 0.6313725490196078, - 0.7843137254901962, - 0.4470588235294118, - 0.6666666666666665, - 0.8705882352941177, - 0.9372549019607842, - 0.3411764705882353, - 0.19215686274509808, - 0.33333333333333326, - 0.32156862745098036, - 0.5176470588235295, - 0.1803921568627451, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.09411764705882353, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.10196078431372549, + 0.07450980392156863, + 0.06274509803921569, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.10980392156862745, + 0.8156862745098039, + 0.807843137254902, + 0.7764705882352942, + 0.6196078431372549, + 0.5803921568627451, + 0.5215686274509804, + 0.9372549019607842, + 0.9764705882352941, + 0.996078431372549, + 0.9450980392156861, + 0.9333333333333332, + 0.9686274509803922, + 0.9725490196078431, + 0.9882352941176471, + 0.9764705882352941, + 0.8901960784313725, + 0.7058823529411765, + 0.34901960784313724, + 0.25098039215686274, + 0.23137254901960783, + 0.20392156862745098, + 0.20392156862745098, + 0.1843137254901961, + 0.22745098039215686, + 0.2352941176470588, + 0.19215686274509808, + 0.2235294117647059, + 0.22745098039215686, + 0.27450980392156865, + 0.2549019607843137, + 0.21568627450980393, + 0.6431372549019607, + 0.7176470588235294, + 0.9294117647058823, + 0.6313725490196078, + 0.7843137254901962, + 0.4470588235294118, + 0.6666666666666665, + 0.8705882352941177, + 0.9372549019607842, + 0.3411764705882353, + 0.19215686274509808, + 0.33333333333333326, + 0.32156862745098036, + 0.5176470588235295, + 0.1803921568627451, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.11372549019607843, - 0.0784313725490196, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.050980392156862744, - 0.08235294117647057, - 0.09411764705882353, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.12549019607843137, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.047058823529411764, - 0.054901960784313725, - 0.054901960784313725, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.054901960784313725, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.0784313725490196, - 0.06274509803921569, - 0.45098039215686275, - 0.7372549019607844, - 0.9019607843137255, - 0.7764705882352942, - 0.9019607843137255, - 0.9411764705882352, - 0.9490196078431371, - 0.9725490196078431, - 0.9333333333333332, - 0.9882352941176471, - 0.9529411764705881, - 0.9607843137254902, - 0.803921568627451, - 0.592156862745098, - 0.32156862745098036, - 0.3137254901960784, - 0.24313725490196078, - 0.25882352941176473, - 0.24705882352941178, - 0.14901960784313725, - 0.11372549019607843, - 0.1843137254901961, - 0.24313725490196078, - 0.24313725490196078, - 0.22745098039215686, - 0.2235294117647059, - 0.19215686274509808, - 0.2235294117647059, - 0.25882352941176473, - 0.1568627450980392, - 0.16862745098039217, - 0.7019607843137254, - 0.6588235294117646, - 0.9098039215686274, - 0.7254901960784313, - 0.8745098039215686, - 0.5137254901960784, - 0.3764705882352941, - 0.8666666666666667, - 0.9764705882352941, - 0.2901960784313726, - 0.1568627450980392, - 0.34509803921568627, - 0.3058823529411765, - 0.5215686274509804, - 0.2901960784313726, - 0.07058823529411765, - 0.10196078431372549, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765 + 0.07450980392156863, + 0.07058823529411765, + 0.11372549019607843, + 0.0784313725490196, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.050980392156862744, + 0.08235294117647057, + 0.09411764705882353, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.12549019607843137, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.047058823529411764, + 0.054901960784313725, + 0.054901960784313725, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.054901960784313725, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.0784313725490196, + 0.06274509803921569, + 0.45098039215686275, + 0.7372549019607844, + 0.9019607843137255, + 0.7764705882352942, + 0.9019607843137255, + 0.9411764705882352, + 0.9490196078431371, + 0.9725490196078431, + 0.9333333333333332, + 0.9882352941176471, + 0.9529411764705881, + 0.9607843137254902, + 0.803921568627451, + 0.592156862745098, + 0.32156862745098036, + 0.3137254901960784, + 0.24313725490196078, + 0.25882352941176473, + 0.24705882352941178, + 0.14901960784313725, + 0.11372549019607843, + 0.1843137254901961, + 0.24313725490196078, + 0.24313725490196078, + 0.22745098039215686, + 0.2235294117647059, + 0.19215686274509808, + 0.2235294117647059, + 0.25882352941176473, + 0.1568627450980392, + 0.16862745098039217, + 0.7019607843137254, + 0.6588235294117646, + 0.9098039215686274, + 0.7254901960784313, + 0.8745098039215686, + 0.5137254901960784, + 0.3764705882352941, + 0.8666666666666667, + 0.9764705882352941, + 0.2901960784313726, + 0.1568627450980392, + 0.34509803921568627, + 0.3058823529411765, + 0.5215686274509804, + 0.2901960784313726, + 0.07058823529411765, + 0.10196078431372549, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.09803921568627452, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.08627450980392157, - 0.08235294117647057, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.043137254901960784, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.047058823529411764, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.047058823529411764, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.09019607843137255, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.6666666666666665, - 0.7490196078431373, - 0.8627450980392157, - 0.9372549019607842, - 0.9529411764705881, - 0.8980392156862745, - 0.9725490196078431, - 0.9607843137254902, - 0.9607843137254902, - 0.5176470588235295, - 0.5725490196078431, - 0.4549019607843137, - 0.27450980392156865, - 0.27450980392156865, - 0.25882352941176473, - 0.2627450980392157, - 0.21568627450980393, - 0.21568627450980393, - 0.16862745098039217, - 0.22745098039215686, - 0.1843137254901961, - 0.25882352941176473, - 0.21568627450980393, - 0.2, - 0.19607843137254904, - 0.2196078431372549, - 0.14901960784313725, - 0.15294117647058825, - 0.27450980392156865, - 0.1568627450980392, - 0.7568627450980392, - 0.6509803921568627, - 0.9254901960784313, - 0.8980392156862745, - 0.6745098039215687, - 0.596078431372549, - 0.37254901960784315, - 0.7803921568627452, - 0.9137254901960784, - 0.3411764705882353, - 0.12549019607843137, - 0.2196078431372549, - 0.5294117647058824, - 0.4705882352941176, - 0.4823529411764706, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.09803921568627452, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.08627450980392157, + 0.08235294117647057, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.043137254901960784, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.047058823529411764, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.047058823529411764, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.09019607843137255, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.6666666666666665, + 0.7490196078431373, + 0.8627450980392157, + 0.9372549019607842, + 0.9529411764705881, + 0.8980392156862745, + 0.9725490196078431, + 0.9607843137254902, + 0.9607843137254902, + 0.5176470588235295, + 0.5725490196078431, + 0.4549019607843137, + 0.27450980392156865, + 0.27450980392156865, + 0.25882352941176473, + 0.2627450980392157, + 0.21568627450980393, + 0.21568627450980393, + 0.16862745098039217, + 0.22745098039215686, + 0.1843137254901961, + 0.25882352941176473, + 0.21568627450980393, + 0.2, + 0.19607843137254904, + 0.2196078431372549, + 0.14901960784313725, + 0.15294117647058825, + 0.27450980392156865, + 0.1568627450980392, + 0.7568627450980392, + 0.6509803921568627, + 0.9254901960784313, + 0.8980392156862745, + 0.6745098039215687, + 0.596078431372549, + 0.37254901960784315, + 0.7803921568627452, + 0.9137254901960784, + 0.3411764705882353, + 0.12549019607843137, + 0.2196078431372549, + 0.5294117647058824, + 0.4705882352941176, + 0.4823529411764706, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.12549019607843137, - 0.8941176470588236, - 0.807843137254902, - 0.984313725490196, - 0.9333333333333332, - 0.9098039215686274, - 0.984313725490196, - 0.9647058823529412, - 0.9254901960784313, - 0.6431372549019607, - 0.611764705882353, - 0.5098039215686274, - 0.34509803921568627, - 0.34901960784313724, - 0.2352941176470588, - 0.29411764705882354, - 0.28627450980392155, - 0.2235294117647059, - 0.14901960784313725, - 0.1843137254901961, - 0.18823529411764706, - 0.2196078431372549, - 0.23137254901960783, - 0.1843137254901961, - 0.22745098039215686, - 0.11372549019607843, - 0.19215686274509808, - 0.19607843137254904, - 0.13725490196078433, - 0.17254901960784313, - 0.10980392156862745, - 0.7568627450980392, - 0.7803921568627452, - 0.7882352941176471, - 0.9294117647058823, - 0.6784313725490196, - 0.7725490196078433, - 0.43137254901960786, - 0.6980392156862745, - 0.8745098039215686, - 0.4392156862745098, - 0.19607843137254904, - 0.27058823529411763, - 0.6392156862745098, - 0.39607843137254906, - 0.4235294117647059, - 0.12549019607843137, - 0.08627450980392157, - 0.07450980392156863, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196 + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.12549019607843137, + 0.8941176470588236, + 0.807843137254902, + 0.984313725490196, + 0.9333333333333332, + 0.9098039215686274, + 0.984313725490196, + 0.9647058823529412, + 0.9254901960784313, + 0.6431372549019607, + 0.611764705882353, + 0.5098039215686274, + 0.34509803921568627, + 0.34901960784313724, + 0.2352941176470588, + 0.29411764705882354, + 0.28627450980392155, + 0.2235294117647059, + 0.14901960784313725, + 0.1843137254901961, + 0.18823529411764706, + 0.2196078431372549, + 0.23137254901960783, + 0.1843137254901961, + 0.22745098039215686, + 0.11372549019607843, + 0.19215686274509808, + 0.19607843137254904, + 0.13725490196078433, + 0.17254901960784313, + 0.10980392156862745, + 0.7568627450980392, + 0.7803921568627452, + 0.7882352941176471, + 0.9294117647058823, + 0.6784313725490196, + 0.7725490196078433, + 0.43137254901960786, + 0.6980392156862745, + 0.8745098039215686, + 0.4392156862745098, + 0.19607843137254904, + 0.27058823529411763, + 0.6392156862745098, + 0.39607843137254906, + 0.4235294117647059, + 0.12549019607843137, + 0.08627450980392157, + 0.07450980392156863, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196 ], [ - 0.07450980392156863, - 0.07450980392156863, - 0.10196078431372549, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.11372549019607843, - 0.06666666666666667, - 0.0588235294117647, - 0.09411764705882353, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.12941176470588237, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.09019607843137255, - 0.0784313725490196, - 0.09803921568627452, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.09019607843137255, - 0.9098039215686274, - 0.7921568627450981, - 0.9411764705882352, - 0.9490196078431371, - 0.8901960784313725, - 0.9137254901960784, - 0.9294117647058823, - 0.7098039215686275, - 0.6352941176470588, - 0.6235294117647059, - 0.5725490196078431, - 0.5176470588235295, - 0.41568627450980394, - 0.3764705882352941, - 0.3176470588235294, - 0.27058823529411763, - 0.1803921568627451, - 0.21176470588235294, - 0.13333333333333333, - 0.21176470588235294, - 0.25882352941176473, - 0.24313725490196078, - 0.20784313725490197, - 0.16470588235294115, - 0.12156862745098039, - 0.13333333333333333, - 0.2, - 0.21568627450980393, - 0.18823529411764706, - 0.1176470588235294, - 0.13333333333333333, - 0.7882352941176471, - 0.9490196078431371, - 0.7372549019607844, - 0.7411764705882353, - 0.6549019607843136, - 0.9372549019607842, - 0.4666666666666666, - 0.6470588235294117, - 0.7450980392156863, - 0.7215686274509804, - 0.2549019607843137, - 0.27058823529411763, - 0.5882352941176471, - 0.4117647058823529, - 0.5607843137254902, - 0.12156862745098039, - 0.0784313725490196, - 0.054901960784313725, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.07450980392156863, + 0.10196078431372549, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.11372549019607843, + 0.06666666666666667, + 0.0588235294117647, + 0.09411764705882353, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.12941176470588237, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.09019607843137255, + 0.0784313725490196, + 0.09803921568627452, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.09019607843137255, + 0.9098039215686274, + 0.7921568627450981, + 0.9411764705882352, + 0.9490196078431371, + 0.8901960784313725, + 0.9137254901960784, + 0.9294117647058823, + 0.7098039215686275, + 0.6352941176470588, + 0.6235294117647059, + 0.5725490196078431, + 0.5176470588235295, + 0.41568627450980394, + 0.3764705882352941, + 0.3176470588235294, + 0.27058823529411763, + 0.1803921568627451, + 0.21176470588235294, + 0.13333333333333333, + 0.21176470588235294, + 0.25882352941176473, + 0.24313725490196078, + 0.20784313725490197, + 0.16470588235294115, + 0.12156862745098039, + 0.13333333333333333, + 0.2, + 0.21568627450980393, + 0.18823529411764706, + 0.1176470588235294, + 0.13333333333333333, + 0.7882352941176471, + 0.9490196078431371, + 0.7372549019607844, + 0.7411764705882353, + 0.6549019607843136, + 0.9372549019607842, + 0.4666666666666666, + 0.6470588235294117, + 0.7450980392156863, + 0.7215686274509804, + 0.2549019607843137, + 0.27058823529411763, + 0.5882352941176471, + 0.4117647058823529, + 0.5607843137254902, + 0.12156862745098039, + 0.0784313725490196, + 0.054901960784313725, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.12156862745098039, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.09019607843137255, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.19215686274509808, - 0.9490196078431371, - 0.9490196078431371, - 0.9137254901960784, - 0.9764705882352941, - 0.8627450980392157, - 0.6509803921568627, - 0.7450980392156863, - 0.7607843137254902, - 0.7254901960784313, - 0.6705882352941175, - 0.596078431372549, - 0.45098039215686275, - 0.33333333333333326, - 0.32156862745098036, - 0.23921568627450981, - 0.2823529411764706, - 0.2549019607843137, - 0.23137254901960783, - 0.1843137254901961, - 0.2196078431372549, - 0.2352941176470588, - 0.2196078431372549, - 0.20392156862745098, - 0.2, - 0.2, - 0.12156862745098039, - 0.2, - 0.17254901960784313, - 0.16078431372549018, - 0.21176470588235294, - 0.10588235294117647, - 0.7137254901960784, - 0.9372549019607842, - 0.7333333333333333, - 0.8980392156862745, - 0.6705882352941175, - 0.9490196078431371, - 0.4470588235294118, - 0.5529411764705883, - 0.592156862745098, - 0.8705882352941177, - 0.2, - 0.1450980392156863, - 0.5686274509803921, - 0.42745098039215684, - 0.6235294117647059, - 0.3137254901960784, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.12156862745098039, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863 + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.12156862745098039, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.09019607843137255, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.19215686274509808, + 0.9490196078431371, + 0.9490196078431371, + 0.9137254901960784, + 0.9764705882352941, + 0.8627450980392157, + 0.6509803921568627, + 0.7450980392156863, + 0.7607843137254902, + 0.7254901960784313, + 0.6705882352941175, + 0.596078431372549, + 0.45098039215686275, + 0.33333333333333326, + 0.32156862745098036, + 0.23921568627450981, + 0.2823529411764706, + 0.2549019607843137, + 0.23137254901960783, + 0.1843137254901961, + 0.2196078431372549, + 0.2352941176470588, + 0.2196078431372549, + 0.20392156862745098, + 0.2, + 0.2, + 0.12156862745098039, + 0.2, + 0.17254901960784313, + 0.16078431372549018, + 0.21176470588235294, + 0.10588235294117647, + 0.7137254901960784, + 0.9372549019607842, + 0.7333333333333333, + 0.8980392156862745, + 0.6705882352941175, + 0.9490196078431371, + 0.4470588235294118, + 0.5529411764705883, + 0.592156862745098, + 0.8705882352941177, + 0.2, + 0.1450980392156863, + 0.5686274509803921, + 0.42745098039215684, + 0.6235294117647059, + 0.3137254901960784, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.12156862745098039, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.050980392156862744, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.09803921568627452, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.06666666666666667, - 0.0588235294117647, - 0.9647058823529412, - 0.9686274509803922, - 0.9764705882352941, - 0.9372549019607842, - 0.8431372549019608, - 0.6352941176470588, - 0.7254901960784313, - 0.7843137254901962, - 0.7647058823529411, - 0.8, - 0.7372549019607844, - 0.5294117647058824, - 0.5176470588235295, - 0.3803921568627451, - 0.32156862745098036, - 0.3058823529411765, - 0.29411764705882354, - 0.23921568627450981, - 0.1568627450980392, - 0.16470588235294115, - 0.23137254901960783, - 0.1803921568627451, - 0.16470588235294115, - 0.1176470588235294, - 0.21568627450980393, - 0.16078431372549018, - 0.1843137254901961, - 0.2352941176470588, - 0.23137254901960783, - 0.17254901960784313, - 0.11372549019607843, - 0.1843137254901961, - 0.7568627450980392, - 0.9215686274509803, - 0.8941176470588236, - 0.8862745098039215, - 0.7490196078431373, - 0.8784313725490196, - 0.7843137254901962, - 0.403921568627451, - 0.592156862745098, - 0.8235294117647058, - 0.21568627450980393, - 0.15294117647058825, - 0.47843137254901963, - 0.4588235294117647, - 0.5686274509803921, - 0.3882352941176471, - 0.18823529411764706, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.09803921568627452, - 0.07450980392156863, - 0.07450980392156863, - 0.10980392156862745, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.050980392156862744, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.09803921568627452, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.06666666666666667, + 0.0588235294117647, + 0.9647058823529412, + 0.9686274509803922, + 0.9764705882352941, + 0.9372549019607842, + 0.8431372549019608, + 0.6352941176470588, + 0.7254901960784313, + 0.7843137254901962, + 0.7647058823529411, + 0.8, + 0.7372549019607844, + 0.5294117647058824, + 0.5176470588235295, + 0.3803921568627451, + 0.32156862745098036, + 0.3058823529411765, + 0.29411764705882354, + 0.23921568627450981, + 0.1568627450980392, + 0.16470588235294115, + 0.23137254901960783, + 0.1803921568627451, + 0.16470588235294115, + 0.1176470588235294, + 0.21568627450980393, + 0.16078431372549018, + 0.1843137254901961, + 0.2352941176470588, + 0.23137254901960783, + 0.17254901960784313, + 0.11372549019607843, + 0.1843137254901961, + 0.7568627450980392, + 0.9215686274509803, + 0.8941176470588236, + 0.8862745098039215, + 0.7490196078431373, + 0.8784313725490196, + 0.7843137254901962, + 0.403921568627451, + 0.592156862745098, + 0.8235294117647058, + 0.21568627450980393, + 0.15294117647058825, + 0.47843137254901963, + 0.4588235294117647, + 0.5686274509803921, + 0.3882352941176471, + 0.18823529411764706, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.09803921568627452, + 0.07450980392156863, + 0.07450980392156863, + 0.10980392156862745, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.054901960784313725, - 0.050980392156862744, - 0.09019607843137255, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.050980392156862744, - 0.14901960784313725, - 0.9411764705882352, - 0.9294117647058823, - 0.9411764705882352, - 0.9686274509803922, - 0.6705882352941175, - 0.8274509803921568, - 0.7921568627450981, - 0.8941176470588236, - 0.8470588235294118, - 0.7764705882352942, - 0.8, - 0.7294117647058823, - 0.5647058823529412, - 0.5254901960784314, - 0.30196078431372547, - 0.3058823529411765, - 0.3176470588235294, - 0.21568627450980393, - 0.16862745098039217, - 0.12156862745098039, - 0.2, - 0.21568627450980393, - 0.16470588235294115, - 0.17254901960784313, - 0.2, - 0.16862745098039217, - 0.16470588235294115, - 0.24705882352941178, - 0.16078431372549018, - 0.2352941176470588, - 0.1568627450980392, - 0.14901960784313725, - 0.10980392156862745, - 0.4, - 0.9568627450980393, - 0.8862745098039215, - 0.8901960784313725, - 0.7529411764705882, - 0.8980392156862745, - 0.8235294117647058, - 0.4, - 0.5176470588235295, - 0.7921568627450981, - 0.3686274509803922, - 0.17647058823529413, - 0.49019607843137253, - 0.35294117647058826, - 0.48627450980392156, - 0.6901960784313725, - 0.4196078431372549, - 0.15294117647058825, - 0.06666666666666667, - 0.10980392156862745, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.054901960784313725, + 0.050980392156862744, + 0.09019607843137255, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.050980392156862744, + 0.14901960784313725, + 0.9411764705882352, + 0.9294117647058823, + 0.9411764705882352, + 0.9686274509803922, + 0.6705882352941175, + 0.8274509803921568, + 0.7921568627450981, + 0.8941176470588236, + 0.8470588235294118, + 0.7764705882352942, + 0.8, + 0.7294117647058823, + 0.5647058823529412, + 0.5254901960784314, + 0.30196078431372547, + 0.3058823529411765, + 0.3176470588235294, + 0.21568627450980393, + 0.16862745098039217, + 0.12156862745098039, + 0.2, + 0.21568627450980393, + 0.16470588235294115, + 0.17254901960784313, + 0.2, + 0.16862745098039217, + 0.16470588235294115, + 0.24705882352941178, + 0.16078431372549018, + 0.2352941176470588, + 0.1568627450980392, + 0.14901960784313725, + 0.10980392156862745, + 0.4, + 0.9568627450980393, + 0.8862745098039215, + 0.8901960784313725, + 0.7529411764705882, + 0.8980392156862745, + 0.8235294117647058, + 0.4, + 0.5176470588235295, + 0.7921568627450981, + 0.3686274509803922, + 0.17647058823529413, + 0.49019607843137253, + 0.35294117647058826, + 0.48627450980392156, + 0.6901960784313725, + 0.4196078431372549, + 0.15294117647058825, + 0.06666666666666667, + 0.10980392156862745, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.047058823529411764, - 0.06666666666666667, - 0.08627450980392157, - 0.06274509803921569, - 0.06666666666666667, - 0.050980392156862744, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.1411764705882353, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.25098039215686274, - 0.9450980392156861, - 0.9647058823529412, - 0.8862745098039215, - 0.6352941176470588, - 0.7176470588235294, - 0.8509803921568627, - 0.8666666666666667, - 0.9058823529411765, - 0.7921568627450981, - 0.8941176470588236, - 0.7686274509803923, - 0.6313725490196078, - 0.5647058823529412, - 0.39607843137254906, - 0.3058823529411765, - 0.30196078431372547, - 0.2784313725490196, - 0.22745098039215686, - 0.32156862745098036, - 0.10980392156862745, - 0.1568627450980392, - 0.16470588235294115, - 0.2235294117647059, - 0.20784313725490197, - 0.13333333333333333, - 0.0784313725490196, - 0.16862745098039217, - 0.1843137254901961, - 0.2549019607843137, - 0.19607843137254904, - 0.12941176470588237, - 0.19215686274509808, - 0.1176470588235294, - 0.34509803921568627, - 0.8509803921568627, - 0.7803921568627452, - 0.9372549019607842, - 0.6901960784313725, - 0.7019607843137254, - 0.9490196078431371, - 0.41568627450980394, - 0.5686274509803921, - 0.2, - 0.2784313725490196, - 0.19215686274509808, - 0.3568627450980392, - 0.4588235294117647, - 0.46274509803921565, - 0.9607843137254902, - 0.3882352941176471, - 0.25098039215686274, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.047058823529411764, + 0.06666666666666667, + 0.08627450980392157, + 0.06274509803921569, + 0.06666666666666667, + 0.050980392156862744, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.1411764705882353, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.25098039215686274, + 0.9450980392156861, + 0.9647058823529412, + 0.8862745098039215, + 0.6352941176470588, + 0.7176470588235294, + 0.8509803921568627, + 0.8666666666666667, + 0.9058823529411765, + 0.7921568627450981, + 0.8941176470588236, + 0.7686274509803923, + 0.6313725490196078, + 0.5647058823529412, + 0.39607843137254906, + 0.3058823529411765, + 0.30196078431372547, + 0.2784313725490196, + 0.22745098039215686, + 0.32156862745098036, + 0.10980392156862745, + 0.1568627450980392, + 0.16470588235294115, + 0.2235294117647059, + 0.20784313725490197, + 0.13333333333333333, + 0.0784313725490196, + 0.16862745098039217, + 0.1843137254901961, + 0.2549019607843137, + 0.19607843137254904, + 0.12941176470588237, + 0.19215686274509808, + 0.1176470588235294, + 0.34509803921568627, + 0.8509803921568627, + 0.7803921568627452, + 0.9372549019607842, + 0.6901960784313725, + 0.7019607843137254, + 0.9490196078431371, + 0.41568627450980394, + 0.5686274509803921, + 0.2, + 0.2784313725490196, + 0.19215686274509808, + 0.3568627450980392, + 0.4588235294117647, + 0.46274509803921565, + 0.9607843137254902, + 0.3882352941176471, + 0.25098039215686274, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.0588235294117647, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.10588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.07450980392156863, - 0.8627450980392157, - 0.9137254901960784, - 0.9764705882352941, - 0.5372549019607843, - 0.7568627450980392, - 0.7450980392156863, - 0.8509803921568627, - 0.8980392156862745, - 0.8862745098039215, - 0.8156862745098039, - 0.7019607843137254, - 0.592156862745098, - 0.6078431372549019, - 0.4392156862745098, - 0.38431372549019616, - 0.3411764705882353, - 0.2901960784313726, - 0.26666666666666666, - 0.2980392156862745, - 0.17647058823529413, - 0.14901960784313725, - 0.2, - 0.16078431372549018, - 0.09803921568627452, - 0.1450980392156863, - 0.14901960784313725, - 0.11372549019607843, - 0.21176470588235294, - 0.16862745098039217, - 0.1803921568627451, - 0.1568627450980392, - 0.16470588235294115, - 0.1803921568627451, - 0.1450980392156863, - 0.0784313725490196, - 0.803921568627451, - 0.9098039215686274, - 0.9333333333333332, - 0.8588235294117647, - 0.6313725490196078, - 0.7607843137254902, - 0.49019607843137253, - 0.4196078431372549, - 0.4823529411764706, - 0.3294117647058823, - 0.3137254901960784, - 0.42745098039215684, - 0.3137254901960784, - 0.5490196078431373, - 0.8901960784313725, - 0.592156862745098, - 0.30980392156862746, - 0.09803921568627452, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.0588235294117647, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.10588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.07450980392156863, + 0.8627450980392157, + 0.9137254901960784, + 0.9764705882352941, + 0.5372549019607843, + 0.7568627450980392, + 0.7450980392156863, + 0.8509803921568627, + 0.8980392156862745, + 0.8862745098039215, + 0.8156862745098039, + 0.7019607843137254, + 0.592156862745098, + 0.6078431372549019, + 0.4392156862745098, + 0.38431372549019616, + 0.3411764705882353, + 0.2901960784313726, + 0.26666666666666666, + 0.2980392156862745, + 0.17647058823529413, + 0.14901960784313725, + 0.2, + 0.16078431372549018, + 0.09803921568627452, + 0.1450980392156863, + 0.14901960784313725, + 0.11372549019607843, + 0.21176470588235294, + 0.16862745098039217, + 0.1803921568627451, + 0.1568627450980392, + 0.16470588235294115, + 0.1803921568627451, + 0.1450980392156863, + 0.0784313725490196, + 0.803921568627451, + 0.9098039215686274, + 0.9333333333333332, + 0.8588235294117647, + 0.6313725490196078, + 0.7607843137254902, + 0.49019607843137253, + 0.4196078431372549, + 0.4823529411764706, + 0.3294117647058823, + 0.3137254901960784, + 0.42745098039215684, + 0.3137254901960784, + 0.5490196078431373, + 0.8901960784313725, + 0.592156862745098, + 0.30980392156862746, + 0.09803921568627452, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.050980392156862744, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.1176470588235294, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.9058823529411765, - 0.9803921568627451, - 0.5725490196078431, - 0.6470588235294117, - 0.6627450980392156, - 0.8352941176470589, - 0.7882352941176471, - 0.8823529411764706, - 0.7176470588235294, - 0.8, - 0.8627450980392157, - 0.7529411764705882, - 0.5411764705882353, - 0.403921568627451, - 0.4235294117647059, - 0.4196078431372549, - 0.3137254901960784, - 0.27450980392156865, - 0.3254901960784313, - 0.12549019607843137, - 0.16470588235294115, - 0.14901960784313725, - 0.19215686274509808, - 0.1843137254901961, - 0.12549019607843137, - 0.16078431372549018, - 0.12549019607843137, - 0.17647058823529413, - 0.21568627450980393, - 0.19607843137254904, - 0.20784313725490197, - 0.22745098039215686, - 0.22745098039215686, - 0.15294117647058825, - 0.10588235294117647, - 0.9215686274509803, - 0.8588235294117647, - 0.9568627450980393, - 0.7529411764705882, - 0.8235294117647058, - 0.9215686274509803, - 0.4666666666666666, - 0.5176470588235295, - 0.7294117647058823, - 0.4, - 0.23137254901960783, - 0.35294117647058826, - 0.6470588235294117, - 0.7215686274509804, - 0.9019607843137255, - 0.6392156862745098, - 0.30196078431372547, - 0.10980392156862745, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.050980392156862744, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.1176470588235294, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.9058823529411765, + 0.9803921568627451, + 0.5725490196078431, + 0.6470588235294117, + 0.6627450980392156, + 0.8352941176470589, + 0.7882352941176471, + 0.8823529411764706, + 0.7176470588235294, + 0.8, + 0.8627450980392157, + 0.7529411764705882, + 0.5411764705882353, + 0.403921568627451, + 0.4235294117647059, + 0.4196078431372549, + 0.3137254901960784, + 0.27450980392156865, + 0.3254901960784313, + 0.12549019607843137, + 0.16470588235294115, + 0.14901960784313725, + 0.19215686274509808, + 0.1843137254901961, + 0.12549019607843137, + 0.16078431372549018, + 0.12549019607843137, + 0.17647058823529413, + 0.21568627450980393, + 0.19607843137254904, + 0.20784313725490197, + 0.22745098039215686, + 0.22745098039215686, + 0.15294117647058825, + 0.10588235294117647, + 0.9215686274509803, + 0.8588235294117647, + 0.9568627450980393, + 0.7529411764705882, + 0.8235294117647058, + 0.9215686274509803, + 0.4666666666666666, + 0.5176470588235295, + 0.7294117647058823, + 0.4, + 0.23137254901960783, + 0.35294117647058826, + 0.6470588235294117, + 0.7215686274509804, + 0.9019607843137255, + 0.6392156862745098, + 0.30196078431372547, + 0.10980392156862745, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.11372549019607843, - 0.10588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.12156862745098039, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.047058823529411764, - 0.7960784313725491, - 0.6235294117647059, - 0.6823529411764706, - 0.5294117647058824, - 0.6313725490196078, - 0.7490196078431373, - 0.7568627450980392, - 0.7843137254901962, - 0.8235294117647058, - 0.8235294117647058, - 0.8470588235294118, - 0.6392156862745098, - 0.5725490196078431, - 0.45098039215686275, - 0.4196078431372549, - 0.3882352941176471, - 0.34901960784313724, - 0.19607843137254904, - 0.12156862745098039, - 0.13725490196078433, - 0.17647058823529413, - 0.12941176470588237, - 0.16470588235294115, - 0.13725490196078433, - 0.15294117647058825, - 0.16078431372549018, - 0.1450980392156863, - 0.20392156862745098, - 0.24705882352941178, - 0.20392156862745098, - 0.2196078431372549, - 0.23137254901960783, - 0.12941176470588237, - 0.16078431372549018, - 0.1843137254901961, - 0.9411764705882352, - 0.8941176470588236, - 0.8509803921568627, - 0.9215686274509803, - 0.8117647058823529, - 0.7607843137254902, - 0.47450980392156855, - 0.49019607843137253, - 0.6588235294117646, - 0.4823529411764706, - 0.3921568627450981, - 0.2901960784313726, - 0.8313725490196079, - 0.7725490196078433, - 0.7764705882352942, - 0.7333333333333333, - 0.29411764705882354, - 0.3686274509803922, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765 + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.11372549019607843, + 0.10588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.12156862745098039, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.047058823529411764, + 0.7960784313725491, + 0.6235294117647059, + 0.6823529411764706, + 0.5294117647058824, + 0.6313725490196078, + 0.7490196078431373, + 0.7568627450980392, + 0.7843137254901962, + 0.8235294117647058, + 0.8235294117647058, + 0.8470588235294118, + 0.6392156862745098, + 0.5725490196078431, + 0.45098039215686275, + 0.4196078431372549, + 0.3882352941176471, + 0.34901960784313724, + 0.19607843137254904, + 0.12156862745098039, + 0.13725490196078433, + 0.17647058823529413, + 0.12941176470588237, + 0.16470588235294115, + 0.13725490196078433, + 0.15294117647058825, + 0.16078431372549018, + 0.1450980392156863, + 0.20392156862745098, + 0.24705882352941178, + 0.20392156862745098, + 0.2196078431372549, + 0.23137254901960783, + 0.12941176470588237, + 0.16078431372549018, + 0.1843137254901961, + 0.9411764705882352, + 0.8941176470588236, + 0.8509803921568627, + 0.9215686274509803, + 0.8117647058823529, + 0.7607843137254902, + 0.47450980392156855, + 0.49019607843137253, + 0.6588235294117646, + 0.4823529411764706, + 0.3921568627450981, + 0.2901960784313726, + 0.8313725490196079, + 0.7725490196078433, + 0.7764705882352942, + 0.7333333333333333, + 0.29411764705882354, + 0.3686274509803922, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.07450980392156863, - 0.09411764705882353, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.10588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.10980392156862745, - 0.07450980392156863, - 0.11372549019607843, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.08235294117647057, - 0.09803921568627452, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.027450980392156862, - 0.7960784313725491, - 0.7215686274509804, - 0.5803921568627451, - 0.6392156862745098, - 0.7215686274509804, - 0.7372549019607844, - 0.7725490196078433, - 0.8588235294117647, - 0.8352941176470589, - 0.8117647058823529, - 0.7568627450980392, - 0.7333333333333333, - 0.615686274509804, - 0.5725490196078431, - 0.4392156862745098, - 0.3137254901960784, - 0.27058823529411763, - 0.2, - 0.1568627450980392, - 0.14901960784313725, - 0.1843137254901961, - 0.10588235294117647, - 0.1843137254901961, - 0.16078431372549018, - 0.17647058823529413, - 0.09411764705882353, - 0.17254901960784313, - 0.1176470588235294, - 0.23921568627450981, - 0.1450980392156863, - 0.16470588235294115, - 0.16862745098039217, - 0.17254901960784313, - 0.09803921568627452, - 0.13333333333333333, - 0.9098039215686274, - 0.8549019607843137, - 0.9607843137254902, - 0.8705882352941177, - 0.7529411764705882, - 0.8156862745098039, - 0.46274509803921565, - 0.46274509803921565, - 0.7294117647058823, - 0.4588235294117647, - 0.34901960784313724, - 0.41568627450980394, - 0.7254901960784313, - 0.8274509803921568, - 0.8470588235294118, - 0.6705882352941175, - 0.5490196078431373, - 0.24313725490196078, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863 + 0.06666666666666667, + 0.07450980392156863, + 0.09411764705882353, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.10588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.10980392156862745, + 0.07450980392156863, + 0.11372549019607843, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.08235294117647057, + 0.09803921568627452, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.027450980392156862, + 0.7960784313725491, + 0.7215686274509804, + 0.5803921568627451, + 0.6392156862745098, + 0.7215686274509804, + 0.7372549019607844, + 0.7725490196078433, + 0.8588235294117647, + 0.8352941176470589, + 0.8117647058823529, + 0.7568627450980392, + 0.7333333333333333, + 0.615686274509804, + 0.5725490196078431, + 0.4392156862745098, + 0.3137254901960784, + 0.27058823529411763, + 0.2, + 0.1568627450980392, + 0.14901960784313725, + 0.1843137254901961, + 0.10588235294117647, + 0.1843137254901961, + 0.16078431372549018, + 0.17647058823529413, + 0.09411764705882353, + 0.17254901960784313, + 0.1176470588235294, + 0.23921568627450981, + 0.1450980392156863, + 0.16470588235294115, + 0.16862745098039217, + 0.17254901960784313, + 0.09803921568627452, + 0.13333333333333333, + 0.9098039215686274, + 0.8549019607843137, + 0.9607843137254902, + 0.8705882352941177, + 0.7529411764705882, + 0.8156862745098039, + 0.46274509803921565, + 0.46274509803921565, + 0.7294117647058823, + 0.4588235294117647, + 0.34901960784313724, + 0.41568627450980394, + 0.7254901960784313, + 0.8274509803921568, + 0.8470588235294118, + 0.6705882352941175, + 0.5490196078431373, + 0.24313725490196078, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.08627450980392157, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.09411764705882353, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.6470588235294117, - 0.48627450980392156, - 0.6941176470588235, - 0.6509803921568627, - 0.6784313725490196, - 0.7450980392156863, - 0.8666666666666667, - 0.8352941176470589, - 0.8274509803921568, - 0.8509803921568627, - 0.8392156862745098, - 0.7568627450980392, - 0.6941176470588235, - 0.7215686274509804, - 0.6784313725490196, - 0.5411764705882353, - 0.3176470588235294, - 0.2823529411764706, - 0.23921568627450981, - 0.16470588235294115, - 0.2196078431372549, - 0.21568627450980393, - 0.1803921568627451, - 0.14901960784313725, - 0.1176470588235294, - 0.19215686274509808, - 0.10196078431372549, - 0.23921568627450981, - 0.17254901960784313, - 0.19607843137254904, - 0.2, - 0.17647058823529413, - 0.1176470588235294, - 0.14901960784313725, - 0.12549019607843137, - 0.09803921568627452, - 0.7882352941176471, - 0.8941176470588236, - 0.8627450980392157, - 0.8313725490196079, - 0.8509803921568627, - 0.8117647058823529, - 0.5490196078431373, - 0.44313725490196076, - 0.7764705882352942, - 0.5215686274509804, - 0.4, - 0.3882352941176471, - 0.7529411764705882, - 0.8509803921568627, - 0.8823529411764706, - 0.7921568627450981, - 0.5058823529411764, - 0.35294117647058826, - 0.043137254901960784, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.08627450980392157, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.09411764705882353, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.6470588235294117, + 0.48627450980392156, + 0.6941176470588235, + 0.6509803921568627, + 0.6784313725490196, + 0.7450980392156863, + 0.8666666666666667, + 0.8352941176470589, + 0.8274509803921568, + 0.8509803921568627, + 0.8392156862745098, + 0.7568627450980392, + 0.6941176470588235, + 0.7215686274509804, + 0.6784313725490196, + 0.5411764705882353, + 0.3176470588235294, + 0.2823529411764706, + 0.23921568627450981, + 0.16470588235294115, + 0.2196078431372549, + 0.21568627450980393, + 0.1803921568627451, + 0.14901960784313725, + 0.1176470588235294, + 0.19215686274509808, + 0.10196078431372549, + 0.23921568627450981, + 0.17254901960784313, + 0.19607843137254904, + 0.2, + 0.17647058823529413, + 0.1176470588235294, + 0.14901960784313725, + 0.12549019607843137, + 0.09803921568627452, + 0.7882352941176471, + 0.8941176470588236, + 0.8627450980392157, + 0.8313725490196079, + 0.8509803921568627, + 0.8117647058823529, + 0.5490196078431373, + 0.44313725490196076, + 0.7764705882352942, + 0.5215686274509804, + 0.4, + 0.3882352941176471, + 0.7529411764705882, + 0.8509803921568627, + 0.8823529411764706, + 0.7921568627450981, + 0.5058823529411764, + 0.35294117647058826, + 0.043137254901960784, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.08627450980392157, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.06274509803921569, - 0.0784313725490196, - 0.07058823529411765, - 0.09803921568627452, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.09019607843137255, - 0.0588235294117647, - 0.5882352941176471, - 0.6862745098039216, - 0.8313725490196079, - 0.7647058823529411, - 0.6941176470588235, - 0.9058823529411765, - 0.9333333333333332, - 0.8392156862745098, - 0.8705882352941177, - 0.7882352941176471, - 0.7098039215686275, - 0.6549019607843136, - 0.5803921568627451, - 0.5607843137254902, - 0.5490196078431373, - 0.7098039215686275, - 0.26666666666666666, - 0.30196078431372547, - 0.1568627450980392, - 0.4196078431372549, - 0.17647058823529413, - 0.21568627450980393, - 0.17647058823529413, - 0.17647058823529413, - 0.23921568627450981, - 0.19607843137254904, - 0.09803921568627452, - 0.1843137254901961, - 0.10588235294117647, - 0.20392156862745098, - 0.12941176470588237, - 0.12941176470588237, - 0.13333333333333333, - 0.13333333333333333, - 0.09019607843137255, - 0.1176470588235294, - 0.8509803921568627, - 0.8823529411764706, - 0.8901960784313725, - 0.5686274509803921, - 0.7843137254901962, - 0.7882352941176471, - 0.5058823529411764, - 0.3607843137254902, - 0.7254901960784313, - 0.6, - 0.5098039215686274, - 0.2627450980392157, - 0.7254901960784313, - 0.8980392156862745, - 0.7607843137254902, - 0.8470588235294118, - 0.6196078431372549, - 0.35294117647058826, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.08627450980392157, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.06274509803921569, + 0.0784313725490196, + 0.07058823529411765, + 0.09803921568627452, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.09019607843137255, + 0.0588235294117647, + 0.5882352941176471, + 0.6862745098039216, + 0.8313725490196079, + 0.7647058823529411, + 0.6941176470588235, + 0.9058823529411765, + 0.9333333333333332, + 0.8392156862745098, + 0.8705882352941177, + 0.7882352941176471, + 0.7098039215686275, + 0.6549019607843136, + 0.5803921568627451, + 0.5607843137254902, + 0.5490196078431373, + 0.7098039215686275, + 0.26666666666666666, + 0.30196078431372547, + 0.1568627450980392, + 0.4196078431372549, + 0.17647058823529413, + 0.21568627450980393, + 0.17647058823529413, + 0.17647058823529413, + 0.23921568627450981, + 0.19607843137254904, + 0.09803921568627452, + 0.1843137254901961, + 0.10588235294117647, + 0.20392156862745098, + 0.12941176470588237, + 0.12941176470588237, + 0.13333333333333333, + 0.13333333333333333, + 0.09019607843137255, + 0.1176470588235294, + 0.8509803921568627, + 0.8823529411764706, + 0.8901960784313725, + 0.5686274509803921, + 0.7843137254901962, + 0.7882352941176471, + 0.5058823529411764, + 0.3607843137254902, + 0.7254901960784313, + 0.6, + 0.5098039215686274, + 0.2627450980392157, + 0.7254901960784313, + 0.8980392156862745, + 0.7607843137254902, + 0.8470588235294118, + 0.6196078431372549, + 0.35294117647058826, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.054901960784313725, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.6509803921568627, - 0.6039215686274509, - 0.6901960784313725, - 0.7647058823529411, - 0.7137254901960784, - 0.8274509803921568, - 0.8235294117647058, - 0.9333333333333332, - 0.6627450980392156, - 0.6352941176470588, - 0.6941176470588235, - 0.6666666666666665, - 0.6901960784313725, - 0.7960784313725491, - 0.7215686274509804, - 0.6745098039215687, - 0.5450980392156862, - 0.5843137254901961, - 0.20392156862745098, - 0.16470588235294115, - 0.1803921568627451, - 0.1843137254901961, - 0.2196078431372549, - 0.14901960784313725, - 0.16470588235294115, - 0.17254901960784313, - 0.1568627450980392, - 0.1450980392156863, - 0.21176470588235294, - 0.1803921568627451, - 0.2196078431372549, - 0.15294117647058825, - 0.17647058823529413, - 0.16862745098039217, - 0.13725490196078433, - 0.10980392156862745, - 0.10588235294117647, - 0.596078431372549, - 0.7450980392156863, - 0.6823529411764706, - 0.7176470588235294, - 0.7058823529411765, - 0.8, - 0.6823529411764706, - 0.4549019607843137, - 0.6745098039215687, - 0.6313725490196078, - 0.5568627450980392, - 0.23921568627450981, - 0.5764705882352941, - 0.8941176470588236, - 0.7686274509803923, - 0.807843137254902, - 0.5490196078431373, - 0.47843137254901963, - 0.09019607843137255, - 0.10588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863 + 0.06666666666666667, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.054901960784313725, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.6509803921568627, + 0.6039215686274509, + 0.6901960784313725, + 0.7647058823529411, + 0.7137254901960784, + 0.8274509803921568, + 0.8235294117647058, + 0.9333333333333332, + 0.6627450980392156, + 0.6352941176470588, + 0.6941176470588235, + 0.6666666666666665, + 0.6901960784313725, + 0.7960784313725491, + 0.7215686274509804, + 0.6745098039215687, + 0.5450980392156862, + 0.5843137254901961, + 0.20392156862745098, + 0.16470588235294115, + 0.1803921568627451, + 0.1843137254901961, + 0.2196078431372549, + 0.14901960784313725, + 0.16470588235294115, + 0.17254901960784313, + 0.1568627450980392, + 0.1450980392156863, + 0.21176470588235294, + 0.1803921568627451, + 0.2196078431372549, + 0.15294117647058825, + 0.17647058823529413, + 0.16862745098039217, + 0.13725490196078433, + 0.10980392156862745, + 0.10588235294117647, + 0.596078431372549, + 0.7450980392156863, + 0.6823529411764706, + 0.7176470588235294, + 0.7058823529411765, + 0.8, + 0.6823529411764706, + 0.4549019607843137, + 0.6745098039215687, + 0.6313725490196078, + 0.5568627450980392, + 0.23921568627450981, + 0.5764705882352941, + 0.8941176470588236, + 0.7686274509803923, + 0.807843137254902, + 0.5490196078431373, + 0.47843137254901963, + 0.09019607843137255, + 0.10588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.12549019607843137, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.050980392156862744, - 0.06666666666666667, - 0.06274509803921569, - 0.1450980392156863, - 0.12156862745098039, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.5254901960784314, - 0.7607843137254902, - 0.5568627450980392, - 0.8, - 0.8117647058823529, - 0.6392156862745098, - 0.9764705882352941, - 0.5686274509803921, - 0.6392156862745098, - 0.6039215686274509, - 0.6, - 0.7254901960784313, - 0.7725490196078433, - 0.6627450980392156, - 0.7294117647058823, - 0.7372549019607844, - 0.6784313725490196, - 0.6588235294117646, - 0.3882352941176471, - 0.2235294117647059, - 0.2235294117647059, - 0.25098039215686274, - 0.21176470588235294, - 0.1803921568627451, - 0.13333333333333333, - 0.16078431372549018, - 0.17647058823529413, - 0.14901960784313725, - 0.20392156862745098, - 0.16470588235294115, - 0.16078431372549018, - 0.19215686274509808, - 0.13725490196078433, - 0.12156862745098039, - 0.1176470588235294, - 0.10588235294117647, - 0.12941176470588237, - 0.5803921568627451, - 0.5568627450980392, - 0.7294117647058823, - 0.7411764705882353, - 0.8745098039215686, - 0.8901960784313725, - 0.6313725490196078, - 0.43137254901960786, - 0.6549019607843136, - 0.7529411764705882, - 0.6431372549019607, - 0.20784313725490197, - 0.5137254901960784, - 0.7372549019607844, - 0.6784313725490196, - 0.8901960784313725, - 0.5450980392156862, - 0.3176470588235294, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.12156862745098039, - 0.07450980392156863, - 0.07450980392156863 + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.12549019607843137, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.050980392156862744, + 0.06666666666666667, + 0.06274509803921569, + 0.1450980392156863, + 0.12156862745098039, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.5254901960784314, + 0.7607843137254902, + 0.5568627450980392, + 0.8, + 0.8117647058823529, + 0.6392156862745098, + 0.9764705882352941, + 0.5686274509803921, + 0.6392156862745098, + 0.6039215686274509, + 0.6, + 0.7254901960784313, + 0.7725490196078433, + 0.6627450980392156, + 0.7294117647058823, + 0.7372549019607844, + 0.6784313725490196, + 0.6588235294117646, + 0.3882352941176471, + 0.2235294117647059, + 0.2235294117647059, + 0.25098039215686274, + 0.21176470588235294, + 0.1803921568627451, + 0.13333333333333333, + 0.16078431372549018, + 0.17647058823529413, + 0.14901960784313725, + 0.20392156862745098, + 0.16470588235294115, + 0.16078431372549018, + 0.19215686274509808, + 0.13725490196078433, + 0.12156862745098039, + 0.1176470588235294, + 0.10588235294117647, + 0.12941176470588237, + 0.5803921568627451, + 0.5568627450980392, + 0.7294117647058823, + 0.7411764705882353, + 0.8745098039215686, + 0.8901960784313725, + 0.6313725490196078, + 0.43137254901960786, + 0.6549019607843136, + 0.7529411764705882, + 0.6431372549019607, + 0.20784313725490197, + 0.5137254901960784, + 0.7372549019607844, + 0.6784313725490196, + 0.8901960784313725, + 0.5450980392156862, + 0.3176470588235294, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.12156862745098039, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.047058823529411764, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.09411764705882353, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.47450980392156855, - 0.5843137254901961, - 0.5490196078431373, - 0.803921568627451, - 0.7921568627450981, - 0.6, - 0.6274509803921569, - 0.41568627450980394, - 0.6274509803921569, - 0.6235294117647059, - 0.6313725490196078, - 0.6941176470588235, - 0.6666666666666665, - 0.7803921568627452, - 0.8588235294117647, - 0.8352941176470589, - 0.7764705882352942, - 0.615686274509804, - 0.8274509803921568, - 0.5411764705882353, - 0.30980392156862746, - 0.30980392156862746, - 0.2196078431372549, - 0.30196078431372547, - 0.24705882352941178, - 0.23921568627450981, - 0.23921568627450981, - 0.1411764705882353, - 0.12549019607843137, - 0.09411764705882353, - 0.1450980392156863, - 0.16862745098039217, - 0.1411764705882353, - 0.17647058823529413, - 0.11372549019607843, - 0.1176470588235294, - 0.11372549019607843, - 0.17647058823529413, - 0.615686274509804, - 0.7019607843137254, - 0.6078431372549019, - 0.6666666666666665, - 0.8470588235294118, - 0.7882352941176471, - 0.5882352941176471, - 0.45098039215686275, - 0.5098039215686274, - 0.6901960784313725, - 0.5764705882352941, - 0.33725490196078434, - 0.40784313725490196, - 0.807843137254902, - 0.803921568627451, - 0.8862745098039215, - 0.4235294117647059, - 0.34901960784313724, - 0.10196078431372549, - 0.07450980392156863, - 0.0784313725490196, - 0.10196078431372549, - 0.07450980392156863, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.047058823529411764, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.09411764705882353, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.47450980392156855, + 0.5843137254901961, + 0.5490196078431373, + 0.803921568627451, + 0.7921568627450981, + 0.6, + 0.6274509803921569, + 0.41568627450980394, + 0.6274509803921569, + 0.6235294117647059, + 0.6313725490196078, + 0.6941176470588235, + 0.6666666666666665, + 0.7803921568627452, + 0.8588235294117647, + 0.8352941176470589, + 0.7764705882352942, + 0.615686274509804, + 0.8274509803921568, + 0.5411764705882353, + 0.30980392156862746, + 0.30980392156862746, + 0.2196078431372549, + 0.30196078431372547, + 0.24705882352941178, + 0.23921568627450981, + 0.23921568627450981, + 0.1411764705882353, + 0.12549019607843137, + 0.09411764705882353, + 0.1450980392156863, + 0.16862745098039217, + 0.1411764705882353, + 0.17647058823529413, + 0.11372549019607843, + 0.1176470588235294, + 0.11372549019607843, + 0.17647058823529413, + 0.615686274509804, + 0.7019607843137254, + 0.6078431372549019, + 0.6666666666666665, + 0.8470588235294118, + 0.7882352941176471, + 0.5882352941176471, + 0.45098039215686275, + 0.5098039215686274, + 0.6901960784313725, + 0.5764705882352941, + 0.33725490196078434, + 0.40784313725490196, + 0.807843137254902, + 0.803921568627451, + 0.8862745098039215, + 0.4235294117647059, + 0.34901960784313724, + 0.10196078431372549, + 0.07450980392156863, + 0.0784313725490196, + 0.10196078431372549, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.09019607843137255, - 0.07450980392156863, - 0.06666666666666667, - 0.08627450980392157, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.10980392156862745, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.3764705882352941, - 0.5254901960784314, - 0.6274509803921569, - 0.7098039215686275, - 0.5607843137254902, - 0.5803921568627451, - 0.4588235294117647, - 0.5647058823529412, - 0.47843137254901963, - 0.6235294117647059, - 0.7254901960784313, - 0.8666666666666667, - 0.7176470588235294, - 0.803921568627451, - 0.8392156862745098, - 0.7882352941176471, - 0.8274509803921568, - 0.8470588235294118, - 0.7568627450980392, - 0.5372549019607843, - 0.2196078431372549, - 0.2784313725490196, - 0.22745098039215686, - 0.3137254901960784, - 0.34509803921568627, - 0.3411764705882353, - 0.2196078431372549, - 0.19607843137254904, - 0.14901960784313725, - 0.16470588235294115, - 0.20784313725490197, - 0.21176470588235294, - 0.19215686274509808, - 0.18823529411764706, - 0.10588235294117647, - 0.13333333333333333, - 0.1176470588235294, - 0.19215686274509808, - 0.5333333333333333, - 0.7450980392156863, - 0.7215686274509804, - 0.6274509803921569, - 0.8, - 0.8313725490196079, - 0.6392156862745098, - 0.4705882352941176, - 0.47450980392156855, - 0.6941176470588235, - 0.5137254901960784, - 0.3921568627450981, - 0.615686274509804, - 0.7803921568627452, - 0.9176470588235294, - 0.5803921568627451, - 0.403921568627451, - 0.0784313725490196, - 0.09803921568627452, - 0.07450980392156863, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196 + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.09019607843137255, + 0.07450980392156863, + 0.06666666666666667, + 0.08627450980392157, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.10980392156862745, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.3764705882352941, + 0.5254901960784314, + 0.6274509803921569, + 0.7098039215686275, + 0.5607843137254902, + 0.5803921568627451, + 0.4588235294117647, + 0.5647058823529412, + 0.47843137254901963, + 0.6235294117647059, + 0.7254901960784313, + 0.8666666666666667, + 0.7176470588235294, + 0.803921568627451, + 0.8392156862745098, + 0.7882352941176471, + 0.8274509803921568, + 0.8470588235294118, + 0.7568627450980392, + 0.5372549019607843, + 0.2196078431372549, + 0.2784313725490196, + 0.22745098039215686, + 0.3137254901960784, + 0.34509803921568627, + 0.3411764705882353, + 0.2196078431372549, + 0.19607843137254904, + 0.14901960784313725, + 0.16470588235294115, + 0.20784313725490197, + 0.21176470588235294, + 0.19215686274509808, + 0.18823529411764706, + 0.10588235294117647, + 0.13333333333333333, + 0.1176470588235294, + 0.19215686274509808, + 0.5333333333333333, + 0.7450980392156863, + 0.7215686274509804, + 0.6274509803921569, + 0.8, + 0.8313725490196079, + 0.6392156862745098, + 0.4705882352941176, + 0.47450980392156855, + 0.6941176470588235, + 0.5137254901960784, + 0.3921568627450981, + 0.615686274509804, + 0.7803921568627452, + 0.9176470588235294, + 0.5803921568627451, + 0.403921568627451, + 0.0784313725490196, + 0.09803921568627452, + 0.07450980392156863, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196 ], [ - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.08235294117647057, - 0.10196078431372549, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.08627450980392157, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.054901960784313725, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.5372549019607843, - 0.4235294117647059, - 0.4235294117647059, - 0.6274509803921569, - 0.5372549019607843, - 0.5294117647058824, - 0.4235294117647059, - 0.5411764705882353, - 0.48627450980392156, - 0.6352941176470588, - 0.6784313725490196, - 0.8, - 0.8666666666666667, - 0.9058823529411765, - 0.8313725490196079, - 0.8705882352941177, - 0.8941176470588236, - 0.8, - 0.7725490196078433, - 0.7215686274509804, - 0.5529411764705883, - 0.2196078431372549, - 0.2549019607843137, - 0.2352941176470588, - 0.3058823529411765, - 0.3568627450980392, - 0.2196078431372549, - 0.3137254901960784, - 0.27058823529411763, - 0.1803921568627451, - 0.18823529411764706, - 0.22745098039215686, - 0.1411764705882353, - 0.20392156862745098, - 0.1568627450980392, - 0.10588235294117647, - 0.1176470588235294, - 0.10980392156862745, - 0.10196078431372549, - 0.5843137254901961, - 0.7137254901960784, - 0.6078431372549019, - 0.6431372549019607, - 0.6666666666666665, - 0.7843137254901962, - 0.7568627450980392, - 0.3294117647058823, - 0.3568627450980392, - 0.10196078431372549, - 0.11372549019607843, - 0.13333333333333333, - 0.27058823529411763, - 0.1803921568627451, - 0.12549019607843137, - 0.10980392156862745, - 0.12941176470588237, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.08235294117647057, - 0.07450980392156863 + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.08235294117647057, + 0.10196078431372549, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.08627450980392157, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.054901960784313725, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.5372549019607843, + 0.4235294117647059, + 0.4235294117647059, + 0.6274509803921569, + 0.5372549019607843, + 0.5294117647058824, + 0.4235294117647059, + 0.5411764705882353, + 0.48627450980392156, + 0.6352941176470588, + 0.6784313725490196, + 0.8, + 0.8666666666666667, + 0.9058823529411765, + 0.8313725490196079, + 0.8705882352941177, + 0.8941176470588236, + 0.8, + 0.7725490196078433, + 0.7215686274509804, + 0.5529411764705883, + 0.2196078431372549, + 0.2549019607843137, + 0.2352941176470588, + 0.3058823529411765, + 0.3568627450980392, + 0.2196078431372549, + 0.3137254901960784, + 0.27058823529411763, + 0.1803921568627451, + 0.18823529411764706, + 0.22745098039215686, + 0.1411764705882353, + 0.20392156862745098, + 0.1568627450980392, + 0.10588235294117647, + 0.1176470588235294, + 0.10980392156862745, + 0.10196078431372549, + 0.5843137254901961, + 0.7137254901960784, + 0.6078431372549019, + 0.6431372549019607, + 0.6666666666666665, + 0.7843137254901962, + 0.7568627450980392, + 0.3294117647058823, + 0.3568627450980392, + 0.10196078431372549, + 0.11372549019607843, + 0.13333333333333333, + 0.27058823529411763, + 0.1803921568627451, + 0.12549019607843137, + 0.10980392156862745, + 0.12941176470588237, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.08235294117647057, + 0.07450980392156863 ], [ - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.09019607843137255, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.10588235294117647, - 0.0588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.09803921568627452, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.054901960784313725, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.5764705882352941, - 0.48627450980392156, - 0.45098039215686275, - 0.6274509803921569, - 0.6235294117647059, - 0.5333333333333333, - 0.5294117647058824, - 0.5764705882352941, - 0.6941176470588235, - 0.6745098039215687, - 0.6823529411764706, - 0.7607843137254902, - 0.7568627450980392, - 0.5411764705882353, - 0.6980392156862745, - 0.6901960784313725, - 0.7215686274509804, - 0.7294117647058823, - 0.7607843137254902, - 0.7294117647058823, - 0.592156862745098, - 0.2901960784313726, - 0.3568627450980392, - 0.26666666666666666, - 0.30980392156862746, - 0.3411764705882353, - 0.33725490196078434, - 0.34901960784313724, - 0.3058823529411765, - 0.14901960784313725, - 0.29411764705882354, - 0.23137254901960783, - 0.21176470588235294, - 0.1568627450980392, - 0.14901960784313725, - 0.12549019607843137, - 0.1176470588235294, - 0.11372549019607843, - 0.09411764705882353, - 0.615686274509804, - 0.7137254901960784, - 0.6509803921568627, - 0.615686274509804, - 0.6431372549019607, - 0.7215686274509804, - 0.7372549019607844, - 0.3254901960784313, - 0.2196078431372549, - 0.1176470588235294, - 0.08235294117647057, - 0.0588235294117647, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.09019607843137255, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.09019607843137255, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.10588235294117647, + 0.0588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.09803921568627452, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.054901960784313725, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.5764705882352941, + 0.48627450980392156, + 0.45098039215686275, + 0.6274509803921569, + 0.6235294117647059, + 0.5333333333333333, + 0.5294117647058824, + 0.5764705882352941, + 0.6941176470588235, + 0.6745098039215687, + 0.6823529411764706, + 0.7607843137254902, + 0.7568627450980392, + 0.5411764705882353, + 0.6980392156862745, + 0.6901960784313725, + 0.7215686274509804, + 0.7294117647058823, + 0.7607843137254902, + 0.7294117647058823, + 0.592156862745098, + 0.2901960784313726, + 0.3568627450980392, + 0.26666666666666666, + 0.30980392156862746, + 0.3411764705882353, + 0.33725490196078434, + 0.34901960784313724, + 0.3058823529411765, + 0.14901960784313725, + 0.29411764705882354, + 0.23137254901960783, + 0.21176470588235294, + 0.1568627450980392, + 0.14901960784313725, + 0.12549019607843137, + 0.1176470588235294, + 0.11372549019607843, + 0.09411764705882353, + 0.615686274509804, + 0.7137254901960784, + 0.6509803921568627, + 0.615686274509804, + 0.6431372549019607, + 0.7215686274509804, + 0.7372549019607844, + 0.3254901960784313, + 0.2196078431372549, + 0.1176470588235294, + 0.08235294117647057, + 0.0588235294117647, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.09019607843137255, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.1568627450980392, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.06666666666666667, - 0.09019607843137255, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.050980392156862744, - 0.06666666666666667, - 0.08235294117647057, - 0.09019607843137255, - 0.5058823529411764, - 0.5843137254901961, - 0.5215686274509804, - 0.6627450980392156, - 0.5843137254901961, - 0.6431372549019607, - 0.6078431372549019, - 0.6666666666666665, - 0.7098039215686275, - 0.6705882352941175, - 0.7176470588235294, - 0.6823529411764706, - 0.7725490196078433, - 0.8352941176470589, - 0.6901960784313725, - 0.6470588235294117, - 0.6784313725490196, - 0.7019607843137254, - 0.7254901960784313, - 0.6862745098039216, - 0.6470588235294117, - 0.2784313725490196, - 0.3137254901960784, - 0.2196078431372549, - 0.3607843137254902, - 0.3176470588235294, - 0.32156862745098036, - 0.32156862745098036, - 0.26666666666666666, - 0.33725490196078434, - 0.30196078431372547, - 0.34901960784313724, - 0.21176470588235294, - 0.2196078431372549, - 0.13333333333333333, - 0.10980392156862745, - 0.09803921568627452, - 0.1176470588235294, - 0.10980392156862745, - 0.6509803921568627, - 0.4823529411764706, - 0.6039215686274509, - 0.5764705882352941, - 0.4823529411764706, - 0.5372549019607843, - 0.6862745098039216, - 0.2823529411764706, - 0.2, - 0.23137254901960783, - 0.08235294117647057, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.0784313725490196, - 0.06274509803921569, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.08627450980392157, - 0.08235294117647057, - 0.0784313725490196, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.1568627450980392, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.06666666666666667, + 0.09019607843137255, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.050980392156862744, + 0.06666666666666667, + 0.08235294117647057, + 0.09019607843137255, + 0.5058823529411764, + 0.5843137254901961, + 0.5215686274509804, + 0.6627450980392156, + 0.5843137254901961, + 0.6431372549019607, + 0.6078431372549019, + 0.6666666666666665, + 0.7098039215686275, + 0.6705882352941175, + 0.7176470588235294, + 0.6823529411764706, + 0.7725490196078433, + 0.8352941176470589, + 0.6901960784313725, + 0.6470588235294117, + 0.6784313725490196, + 0.7019607843137254, + 0.7254901960784313, + 0.6862745098039216, + 0.6470588235294117, + 0.2784313725490196, + 0.3137254901960784, + 0.2196078431372549, + 0.3607843137254902, + 0.3176470588235294, + 0.32156862745098036, + 0.32156862745098036, + 0.26666666666666666, + 0.33725490196078434, + 0.30196078431372547, + 0.34901960784313724, + 0.21176470588235294, + 0.2196078431372549, + 0.13333333333333333, + 0.10980392156862745, + 0.09803921568627452, + 0.1176470588235294, + 0.10980392156862745, + 0.6509803921568627, + 0.4823529411764706, + 0.6039215686274509, + 0.5764705882352941, + 0.4823529411764706, + 0.5372549019607843, + 0.6862745098039216, + 0.2823529411764706, + 0.2, + 0.23137254901960783, + 0.08235294117647057, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.0784313725490196, + 0.06274509803921569, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.08627450980392157, + 0.08235294117647057, + 0.0784313725490196, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.054901960784313725, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.10196078431372549, - 0.07058823529411765, - 0.4117647058823529, - 0.4980392156862745, - 0.7137254901960784, - 0.5843137254901961, - 0.44313725490196076, - 0.6470588235294117, - 0.5294117647058824, - 0.7137254901960784, - 0.6274509803921569, - 0.6549019607843136, - 0.807843137254902, - 0.7647058823529411, - 0.7019607843137254, - 0.5882352941176471, - 0.7176470588235294, - 0.6352941176470588, - 0.7333333333333333, - 0.6862745098039216, - 0.7098039215686275, - 0.6823529411764706, - 0.6862745098039216, - 0.5529411764705883, - 0.4705882352941176, - 0.3568627450980392, - 0.32156862745098036, - 0.24705882352941178, - 0.34509803921568627, - 0.33725490196078434, - 0.3058823529411765, - 0.2980392156862745, - 0.23921568627450981, - 0.2549019607843137, - 0.3176470588235294, - 0.16078431372549018, - 0.32156862745098036, - 0.12549019607843137, - 0.1176470588235294, - 0.16078431372549018, - 0.12156862745098039, - 0.08235294117647057, - 0.6823529411764706, - 0.5803921568627451, - 0.611764705882353, - 0.615686274509804, - 0.596078431372549, - 0.6352941176470588, - 0.7019607843137254, - 0.2784313725490196, - 0.20784313725490197, - 0.1176470588235294, - 0.08235294117647057, - 0.0784313725490196, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.17647058823529413, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863 + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.054901960784313725, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.10196078431372549, + 0.07058823529411765, + 0.4117647058823529, + 0.4980392156862745, + 0.7137254901960784, + 0.5843137254901961, + 0.44313725490196076, + 0.6470588235294117, + 0.5294117647058824, + 0.7137254901960784, + 0.6274509803921569, + 0.6549019607843136, + 0.807843137254902, + 0.7647058823529411, + 0.7019607843137254, + 0.5882352941176471, + 0.7176470588235294, + 0.6352941176470588, + 0.7333333333333333, + 0.6862745098039216, + 0.7098039215686275, + 0.6823529411764706, + 0.6862745098039216, + 0.5529411764705883, + 0.4705882352941176, + 0.3568627450980392, + 0.32156862745098036, + 0.24705882352941178, + 0.34509803921568627, + 0.33725490196078434, + 0.3058823529411765, + 0.2980392156862745, + 0.23921568627450981, + 0.2549019607843137, + 0.3176470588235294, + 0.16078431372549018, + 0.32156862745098036, + 0.12549019607843137, + 0.1176470588235294, + 0.16078431372549018, + 0.12156862745098039, + 0.08235294117647057, + 0.6823529411764706, + 0.5803921568627451, + 0.611764705882353, + 0.615686274509804, + 0.596078431372549, + 0.6352941176470588, + 0.7019607843137254, + 0.2784313725490196, + 0.20784313725490197, + 0.1176470588235294, + 0.08235294117647057, + 0.0784313725490196, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.17647058823529413, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.08235294117647057, - 0.08627450980392157, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.09411764705882353, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.08235294117647057, - 0.06666666666666667, - 0.43137254901960786, - 0.5294117647058824, - 0.5725490196078431, - 0.6862745098039216, - 0.6470588235294117, - 0.5843137254901961, - 0.6941176470588235, - 0.6666666666666665, - 0.7333333333333333, - 0.7215686274509804, - 0.7529411764705882, - 0.7372549019607844, - 0.8, - 0.6745098039215687, - 0.6, - 0.6666666666666665, - 0.6392156862745098, - 0.6470588235294117, - 0.6509803921568627, - 0.6078431372549019, - 0.7294117647058823, - 0.6549019607843136, - 0.6431372549019607, - 0.4470588235294118, - 0.34509803921568627, - 0.23921568627450981, - 0.24313725490196078, - 0.2901960784313726, - 0.2549019607843137, - 0.3176470588235294, - 0.13333333333333333, - 0.25098039215686274, - 0.2, - 0.1803921568627451, - 0.33333333333333326, - 0.15294117647058825, - 0.2, - 0.15294117647058825, - 0.12549019607843137, - 0.10980392156862745, - 0.5568627450980392, - 0.5843137254901961, - 0.5254901960784314, - 0.6549019607843136, - 0.8509803921568627, - 0.6745098039215687, - 0.6901960784313725, - 0.1450980392156863, - 0.20784313725490197, - 0.0588235294117647, - 0.08627450980392157, - 0.0588235294117647, - 0.11372549019607843, - 0.08235294117647057, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.08235294117647057, + 0.08627450980392157, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.09411764705882353, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.08235294117647057, + 0.06666666666666667, + 0.43137254901960786, + 0.5294117647058824, + 0.5725490196078431, + 0.6862745098039216, + 0.6470588235294117, + 0.5843137254901961, + 0.6941176470588235, + 0.6666666666666665, + 0.7333333333333333, + 0.7215686274509804, + 0.7529411764705882, + 0.7372549019607844, + 0.8, + 0.6745098039215687, + 0.6, + 0.6666666666666665, + 0.6392156862745098, + 0.6470588235294117, + 0.6509803921568627, + 0.6078431372549019, + 0.7294117647058823, + 0.6549019607843136, + 0.6431372549019607, + 0.4470588235294118, + 0.34509803921568627, + 0.23921568627450981, + 0.24313725490196078, + 0.2901960784313726, + 0.2549019607843137, + 0.3176470588235294, + 0.13333333333333333, + 0.25098039215686274, + 0.2, + 0.1803921568627451, + 0.33333333333333326, + 0.15294117647058825, + 0.2, + 0.15294117647058825, + 0.12549019607843137, + 0.10980392156862745, + 0.5568627450980392, + 0.5843137254901961, + 0.5254901960784314, + 0.6549019607843136, + 0.8509803921568627, + 0.6745098039215687, + 0.6901960784313725, + 0.1450980392156863, + 0.20784313725490197, + 0.0588235294117647, + 0.08627450980392157, + 0.0588235294117647, + 0.11372549019607843, + 0.08235294117647057, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.047058823529411764, - 0.06274509803921569, - 0.0784313725490196, - 0.054901960784313725, - 0.4588235294117647, - 0.5333333333333333, - 0.596078431372549, - 0.5254901960784314, - 0.5490196078431373, - 0.7333333333333333, - 0.6392156862745098, - 0.8588235294117647, - 0.7960784313725491, - 0.7058823529411765, - 0.7607843137254902, - 0.7568627450980392, - 0.6862745098039216, - 0.596078431372549, - 0.48627450980392156, - 0.5764705882352941, - 0.5803921568627451, - 0.6941176470588235, - 0.6901960784313725, - 0.6039215686274509, - 0.6549019607843136, - 0.6509803921568627, - 0.615686274509804, - 0.4588235294117647, - 0.33725490196078434, - 0.32156862745098036, - 0.27058823529411763, - 0.14901960784313725, - 0.2980392156862745, - 0.30196078431372547, - 0.25098039215686274, - 0.3137254901960784, - 0.25882352941176473, - 0.2627450980392157, - 0.26666666666666666, - 0.2901960784313726, - 0.25882352941176473, - 0.22745098039215686, - 0.1411764705882353, - 0.11372549019607843, - 0.5019607843137255, - 0.45098039215686275, - 0.49411764705882355, - 0.6274509803921569, - 0.3764705882352941, - 0.4196078431372549, - 0.4549019607843137, - 0.2901960784313726, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.09019607843137255, - 0.06274509803921569, - 0.0784313725490196, - 0.08627450980392157, - 0.12549019607843137, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863, - 0.0784313725490196, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765 + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.047058823529411764, + 0.06274509803921569, + 0.0784313725490196, + 0.054901960784313725, + 0.4588235294117647, + 0.5333333333333333, + 0.596078431372549, + 0.5254901960784314, + 0.5490196078431373, + 0.7333333333333333, + 0.6392156862745098, + 0.8588235294117647, + 0.7960784313725491, + 0.7058823529411765, + 0.7607843137254902, + 0.7568627450980392, + 0.6862745098039216, + 0.596078431372549, + 0.48627450980392156, + 0.5764705882352941, + 0.5803921568627451, + 0.6941176470588235, + 0.6901960784313725, + 0.6039215686274509, + 0.6549019607843136, + 0.6509803921568627, + 0.615686274509804, + 0.4588235294117647, + 0.33725490196078434, + 0.32156862745098036, + 0.27058823529411763, + 0.14901960784313725, + 0.2980392156862745, + 0.30196078431372547, + 0.25098039215686274, + 0.3137254901960784, + 0.25882352941176473, + 0.2627450980392157, + 0.26666666666666666, + 0.2901960784313726, + 0.25882352941176473, + 0.22745098039215686, + 0.1411764705882353, + 0.11372549019607843, + 0.5019607843137255, + 0.45098039215686275, + 0.49411764705882355, + 0.6274509803921569, + 0.3764705882352941, + 0.4196078431372549, + 0.4549019607843137, + 0.2901960784313726, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.09019607843137255, + 0.06274509803921569, + 0.0784313725490196, + 0.08627450980392157, + 0.12549019607843137, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863, + 0.0784313725490196, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.30196078431372547, - 0.5098039215686274, - 0.5372549019607843, - 0.6392156862745098, - 0.592156862745098, - 0.6745098039215687, - 0.7921568627450981, - 0.7725490196078433, - 0.6705882352941175, - 0.8666666666666667, - 0.8392156862745098, - 0.7372549019607844, - 0.596078431372549, - 0.5137254901960784, - 0.5333333333333333, - 0.5450980392156862, - 0.5137254901960784, - 0.6196078431372549, - 0.5882352941176471, - 0.6509803921568627, - 0.5607843137254902, - 0.611764705882353, - 0.596078431372549, - 0.5019607843137255, - 0.35294117647058826, - 0.32156862745098036, - 0.2980392156862745, - 0.24313725490196078, - 0.23921568627450981, - 0.2549019607843137, - 0.12941176470588237, - 0.27450980392156865, - 0.22745098039215686, - 0.24705882352941178, - 0.2627450980392157, - 0.39607843137254906, - 0.2, - 0.29411764705882354, - 0.27450980392156865, - 0.08235294117647057, - 0.0784313725490196, - 0.054901960784313725, - 0.09019607843137255, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.07450980392156863, - 0.09019607843137255, - 0.0588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.09411764705882353, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.30196078431372547, + 0.5098039215686274, + 0.5372549019607843, + 0.6392156862745098, + 0.592156862745098, + 0.6745098039215687, + 0.7921568627450981, + 0.7725490196078433, + 0.6705882352941175, + 0.8666666666666667, + 0.8392156862745098, + 0.7372549019607844, + 0.596078431372549, + 0.5137254901960784, + 0.5333333333333333, + 0.5450980392156862, + 0.5137254901960784, + 0.6196078431372549, + 0.5882352941176471, + 0.6509803921568627, + 0.5607843137254902, + 0.611764705882353, + 0.596078431372549, + 0.5019607843137255, + 0.35294117647058826, + 0.32156862745098036, + 0.2980392156862745, + 0.24313725490196078, + 0.23921568627450981, + 0.2549019607843137, + 0.12941176470588237, + 0.27450980392156865, + 0.22745098039215686, + 0.24705882352941178, + 0.2627450980392157, + 0.39607843137254906, + 0.2, + 0.29411764705882354, + 0.27450980392156865, + 0.08235294117647057, + 0.0784313725490196, + 0.054901960784313725, + 0.09019607843137255, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.07450980392156863, + 0.09019607843137255, + 0.0588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.09411764705882353, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.054901960784313725, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.10588235294117647, - 0.07450980392156863, - 0.054901960784313725, - 0.5176470588235295, - 0.5490196078431373, - 0.7372549019607844, - 0.6196078431372549, - 0.7215686274509804, - 0.8196078431372549, - 0.7568627450980392, - 0.8627450980392157, - 0.7803921568627452, - 0.8274509803921568, - 0.7568627450980392, - 0.6941176470588235, - 0.6235294117647059, - 0.5686274509803921, - 0.5490196078431373, - 0.5372549019607843, - 0.5686274509803921, - 0.5019607843137255, - 0.5450980392156862, - 0.4549019607843137, - 0.5411764705882353, - 0.5882352941176471, - 0.6196078431372549, - 0.47843137254901963, - 0.4392156862745098, - 0.35294117647058826, - 0.3254901960784313, - 0.21176470588235294, - 0.13725490196078433, - 0.2196078431372549, - 0.26666666666666666, - 0.2352941176470588, - 0.2235294117647059, - 0.26666666666666666, - 0.28627450980392155, - 0.29411764705882354, - 0.24313725490196078, - 0.30980392156862746, - 0.26666666666666666, - 0.23921568627450981, - 0.08235294117647057, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.0784313725490196, - 0.08235294117647057, - 0.07450980392156863, - 0.11372549019607843, - 0.12549019607843137, - 0.06274509803921569, - 0.08235294117647057, - 0.0588235294117647, - 0.07450980392156863, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.09411764705882353, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.054901960784313725, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.10588235294117647, + 0.07450980392156863, + 0.054901960784313725, + 0.5176470588235295, + 0.5490196078431373, + 0.7372549019607844, + 0.6196078431372549, + 0.7215686274509804, + 0.8196078431372549, + 0.7568627450980392, + 0.8627450980392157, + 0.7803921568627452, + 0.8274509803921568, + 0.7568627450980392, + 0.6941176470588235, + 0.6235294117647059, + 0.5686274509803921, + 0.5490196078431373, + 0.5372549019607843, + 0.5686274509803921, + 0.5019607843137255, + 0.5450980392156862, + 0.4549019607843137, + 0.5411764705882353, + 0.5882352941176471, + 0.6196078431372549, + 0.47843137254901963, + 0.4392156862745098, + 0.35294117647058826, + 0.3254901960784313, + 0.21176470588235294, + 0.13725490196078433, + 0.2196078431372549, + 0.26666666666666666, + 0.2352941176470588, + 0.2235294117647059, + 0.26666666666666666, + 0.28627450980392155, + 0.29411764705882354, + 0.24313725490196078, + 0.30980392156862746, + 0.26666666666666666, + 0.23921568627450981, + 0.08235294117647057, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.0784313725490196, + 0.08235294117647057, + 0.07450980392156863, + 0.11372549019607843, + 0.12549019607843137, + 0.06274509803921569, + 0.08235294117647057, + 0.0588235294117647, + 0.07450980392156863, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.09411764705882353, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.047058823529411764, - 0.06666666666666667, - 0.0588235294117647, - 0.5725490196078431, - 0.6745098039215687, - 0.5098039215686274, - 0.6705882352941175, - 0.7921568627450981, - 0.8745098039215686, - 0.8901960784313725, - 0.8627450980392157, - 0.8470588235294118, - 0.8549019607843137, - 0.7725490196078433, - 0.6980392156862745, - 0.5607843137254902, - 0.5098039215686274, - 0.4666666666666666, - 0.5137254901960784, - 0.49019607843137253, - 0.6313725490196078, - 0.6313725490196078, - 0.6235294117647059, - 0.43137254901960786, - 0.4823529411764706, - 0.5725490196078431, - 0.5607843137254902, - 0.5176470588235295, - 0.3686274509803922, - 0.36470588235294116, - 0.26666666666666666, - 0.2627450980392157, - 0.2549019607843137, - 0.16862745098039217, - 0.16078431372549018, - 0.20392156862745098, - 0.21176470588235294, - 0.18823529411764706, - 0.3176470588235294, - 0.1568627450980392, - 0.32156862745098036, - 0.33725490196078434, - 0.2352941176470588, - 0.12549019607843137, - 0.10980392156862745, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.09411764705882353, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765 + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.047058823529411764, + 0.06666666666666667, + 0.0588235294117647, + 0.5725490196078431, + 0.6745098039215687, + 0.5098039215686274, + 0.6705882352941175, + 0.7921568627450981, + 0.8745098039215686, + 0.8901960784313725, + 0.8627450980392157, + 0.8470588235294118, + 0.8549019607843137, + 0.7725490196078433, + 0.6980392156862745, + 0.5607843137254902, + 0.5098039215686274, + 0.4666666666666666, + 0.5137254901960784, + 0.49019607843137253, + 0.6313725490196078, + 0.6313725490196078, + 0.6235294117647059, + 0.43137254901960786, + 0.4823529411764706, + 0.5725490196078431, + 0.5607843137254902, + 0.5176470588235295, + 0.3686274509803922, + 0.36470588235294116, + 0.26666666666666666, + 0.2627450980392157, + 0.2549019607843137, + 0.16862745098039217, + 0.16078431372549018, + 0.20392156862745098, + 0.21176470588235294, + 0.18823529411764706, + 0.3176470588235294, + 0.1568627450980392, + 0.32156862745098036, + 0.33725490196078434, + 0.2352941176470588, + 0.12549019607843137, + 0.10980392156862745, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.09411764705882353, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.054901960784313725, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.10196078431372549, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.050980392156862744, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.054901960784313725, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.054901960784313725, - 0.06274509803921569, - 0.06666666666666667, - 0.10196078431372549, - 0.07058823529411765, - 0.054901960784313725, - 0.49411764705882355, - 0.6980392156862745, - 0.6705882352941175, - 0.611764705882353, - 0.6666666666666665, - 0.8431372549019608, - 0.8941176470588236, - 0.9215686274509803, - 0.7843137254901962, - 0.8588235294117647, - 0.8156862745098039, - 0.8470588235294118, - 0.6549019607843136, - 0.5333333333333333, - 0.5098039215686274, - 0.43137254901960786, - 0.4666666666666666, - 0.5215686274509804, - 0.5019607843137255, - 0.5058823529411764, - 0.5450980392156862, - 0.5215686274509804, - 0.5490196078431373, - 0.5843137254901961, - 0.6, - 0.592156862745098, - 0.4196078431372549, - 0.32156862745098036, - 0.19607843137254904, - 0.25882352941176473, - 0.25882352941176473, - 0.12156862745098039, - 0.2196078431372549, - 0.23921568627450981, - 0.1568627450980392, - 0.12941176470588237, - 0.2784313725490196, - 0.23921568627450981, - 0.17647058823529413, - 0.29411764705882354, - 0.1411764705882353, - 0.2549019607843137, - 0.11372549019607843, - 0.09411764705882353, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.1176470588235294, - 0.08235294117647057, - 0.08235294117647057, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.054901960784313725, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.10196078431372549, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.050980392156862744, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.054901960784313725, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.054901960784313725, + 0.06274509803921569, + 0.06666666666666667, + 0.10196078431372549, + 0.07058823529411765, + 0.054901960784313725, + 0.49411764705882355, + 0.6980392156862745, + 0.6705882352941175, + 0.611764705882353, + 0.6666666666666665, + 0.8431372549019608, + 0.8941176470588236, + 0.9215686274509803, + 0.7843137254901962, + 0.8588235294117647, + 0.8156862745098039, + 0.8470588235294118, + 0.6549019607843136, + 0.5333333333333333, + 0.5098039215686274, + 0.43137254901960786, + 0.4666666666666666, + 0.5215686274509804, + 0.5019607843137255, + 0.5058823529411764, + 0.5450980392156862, + 0.5215686274509804, + 0.5490196078431373, + 0.5843137254901961, + 0.6, + 0.592156862745098, + 0.4196078431372549, + 0.32156862745098036, + 0.19607843137254904, + 0.25882352941176473, + 0.25882352941176473, + 0.12156862745098039, + 0.2196078431372549, + 0.23921568627450981, + 0.1568627450980392, + 0.12941176470588237, + 0.2784313725490196, + 0.23921568627450981, + 0.17647058823529413, + 0.29411764705882354, + 0.1411764705882353, + 0.2549019607843137, + 0.11372549019607843, + 0.09411764705882353, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.1176470588235294, + 0.08235294117647057, + 0.08235294117647057, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.08627450980392157, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.10196078431372549, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.050980392156862744, - 0.06666666666666667, - 0.09411764705882353, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.08235294117647057, - 0.10196078431372549, - 0.1843137254901961, - 0.7137254901960784, - 0.7058823529411765, - 0.5254901960784314, - 0.611764705882353, - 0.45098039215686275, - 0.8196078431372549, - 0.8156862745098039, - 0.7843137254901962, - 0.8941176470588236, - 0.8588235294117647, - 0.8431372549019608, - 0.7254901960784313, - 0.5450980392156862, - 0.5215686274509804, - 0.4705882352941176, - 0.5098039215686274, - 0.5607843137254902, - 0.4549019607843137, - 0.4196078431372549, - 0.5764705882352941, - 0.47843137254901963, - 0.4392156862745098, - 0.5450980392156862, - 0.4980392156862745, - 0.5647058823529412, - 0.5764705882352941, - 0.5254901960784314, - 0.26666666666666666, - 0.2235294117647059, - 0.15294117647058825, - 0.2235294117647059, - 0.23137254901960783, - 0.29411764705882354, - 0.25098039215686274, - 0.2352941176470588, - 0.24705882352941178, - 0.19215686274509808, - 0.24313725490196078, - 0.25098039215686274, - 0.2352941176470588, - 0.2, - 0.2784313725490196, - 0.25882352941176473, - 0.10980392156862745, - 0.08235294117647057, - 0.10980392156862745, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.07450980392156863, - 0.09803921568627452, - 0.08235294117647057, - 0.09019607843137255, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.0588235294117647, - 0.07450980392156863, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863 + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.08627450980392157, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.10196078431372549, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.050980392156862744, + 0.06666666666666667, + 0.09411764705882353, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.08235294117647057, + 0.10196078431372549, + 0.1843137254901961, + 0.7137254901960784, + 0.7058823529411765, + 0.5254901960784314, + 0.611764705882353, + 0.45098039215686275, + 0.8196078431372549, + 0.8156862745098039, + 0.7843137254901962, + 0.8941176470588236, + 0.8588235294117647, + 0.8431372549019608, + 0.7254901960784313, + 0.5450980392156862, + 0.5215686274509804, + 0.4705882352941176, + 0.5098039215686274, + 0.5607843137254902, + 0.4549019607843137, + 0.4196078431372549, + 0.5764705882352941, + 0.47843137254901963, + 0.4392156862745098, + 0.5450980392156862, + 0.4980392156862745, + 0.5647058823529412, + 0.5764705882352941, + 0.5254901960784314, + 0.26666666666666666, + 0.2235294117647059, + 0.15294117647058825, + 0.2235294117647059, + 0.23137254901960783, + 0.29411764705882354, + 0.25098039215686274, + 0.2352941176470588, + 0.24705882352941178, + 0.19215686274509808, + 0.24313725490196078, + 0.25098039215686274, + 0.2352941176470588, + 0.2, + 0.2784313725490196, + 0.25882352941176473, + 0.10980392156862745, + 0.08235294117647057, + 0.10980392156862745, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.07450980392156863, + 0.09803921568627452, + 0.08235294117647057, + 0.09019607843137255, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.0588235294117647, + 0.07450980392156863, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.09803921568627452, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.050980392156862744, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.09803921568627452, - 0.6274509803921569, - 0.7529411764705882, - 0.6588235294117646, - 0.611764705882353, - 0.6666666666666665, - 0.6784313725490196, - 0.8156862745098039, - 0.9058823529411765, - 0.9058823529411765, - 0.9058823529411765, - 0.8470588235294118, - 0.7803921568627452, - 0.6901960784313725, - 0.6941176470588235, - 0.5607843137254902, - 0.4823529411764706, - 0.42745098039215684, - 0.4666666666666666, - 0.5725490196078431, - 0.4823529411764706, - 0.43137254901960786, - 0.5137254901960784, - 0.4705882352941176, - 0.4470588235294118, - 0.48627450980392156, - 0.47450980392156855, - 0.5372549019607843, - 0.3764705882352941, - 0.29411764705882354, - 0.16470588235294115, - 0.2784313725490196, - 0.13725490196078433, - 0.2901960784313726, - 0.18823529411764706, - 0.21568627450980393, - 0.22745098039215686, - 0.20392156862745098, - 0.1568627450980392, - 0.34509803921568627, - 0.25882352941176473, - 0.1843137254901961, - 0.2235294117647059, - 0.2196078431372549, - 0.27058823529411763, - 0.20392156862745098, - 0.13333333333333333, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.050980392156862744, - 0.08627450980392157, - 0.0784313725490196, - 0.06274509803921569, - 0.054901960784313725, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.12156862745098039, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765 + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.09803921568627452, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.050980392156862744, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.09803921568627452, + 0.6274509803921569, + 0.7529411764705882, + 0.6588235294117646, + 0.611764705882353, + 0.6666666666666665, + 0.6784313725490196, + 0.8156862745098039, + 0.9058823529411765, + 0.9058823529411765, + 0.9058823529411765, + 0.8470588235294118, + 0.7803921568627452, + 0.6901960784313725, + 0.6941176470588235, + 0.5607843137254902, + 0.4823529411764706, + 0.42745098039215684, + 0.4666666666666666, + 0.5725490196078431, + 0.4823529411764706, + 0.43137254901960786, + 0.5137254901960784, + 0.4705882352941176, + 0.4470588235294118, + 0.48627450980392156, + 0.47450980392156855, + 0.5372549019607843, + 0.3764705882352941, + 0.29411764705882354, + 0.16470588235294115, + 0.2784313725490196, + 0.13725490196078433, + 0.2901960784313726, + 0.18823529411764706, + 0.21568627450980393, + 0.22745098039215686, + 0.20392156862745098, + 0.1568627450980392, + 0.34509803921568627, + 0.25882352941176473, + 0.1843137254901961, + 0.2235294117647059, + 0.2196078431372549, + 0.27058823529411763, + 0.20392156862745098, + 0.13333333333333333, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.050980392156862744, + 0.08627450980392157, + 0.0784313725490196, + 0.06274509803921569, + 0.054901960784313725, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.12156862745098039, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.06274509803921569, - 0.054901960784313725, - 0.0784313725490196, - 0.06666666666666667, - 0.050980392156862744, - 0.07058823529411765, - 0.07058823529411765, - 0.2352941176470588, - 0.7176470588235294, - 0.7058823529411765, - 0.6078431372549019, - 0.5803921568627451, - 0.6, - 0.8784313725490196, - 0.7803921568627452, - 0.807843137254902, - 0.8352941176470589, - 0.6705882352941175, - 0.6862745098039216, - 0.7333333333333333, - 0.6941176470588235, - 0.46274509803921565, - 0.5098039215686274, - 0.47450980392156855, - 0.4392156862745098, - 0.4588235294117647, - 0.46274509803921565, - 0.4117647058823529, - 0.44313725490196076, - 0.45098039215686275, - 0.4666666666666666, - 0.4117647058823529, - 0.42745098039215684, - 0.5137254901960784, - 0.4196078431372549, - 0.3764705882352941, - 0.3176470588235294, - 0.13725490196078433, - 0.2352941176470588, - 0.16078431372549018, - 0.27450980392156865, - 0.19215686274509808, - 0.27058823529411763, - 0.27058823529411763, - 0.28627450980392155, - 0.08627450980392157, - 0.30980392156862746, - 0.3137254901960784, - 0.19607843137254904, - 0.25098039215686274, - 0.3137254901960784, - 0.22745098039215686, - 0.1803921568627451, - 0.1803921568627451, - 0.06274509803921569, - 0.0588235294117647, - 0.06274509803921569, - 0.07450980392156863, - 0.08627450980392157, - 0.08627450980392157, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.054901960784313725, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.06274509803921569, + 0.054901960784313725, + 0.0784313725490196, + 0.06666666666666667, + 0.050980392156862744, + 0.07058823529411765, + 0.07058823529411765, + 0.2352941176470588, + 0.7176470588235294, + 0.7058823529411765, + 0.6078431372549019, + 0.5803921568627451, + 0.6, + 0.8784313725490196, + 0.7803921568627452, + 0.807843137254902, + 0.8352941176470589, + 0.6705882352941175, + 0.6862745098039216, + 0.7333333333333333, + 0.6941176470588235, + 0.46274509803921565, + 0.5098039215686274, + 0.47450980392156855, + 0.4392156862745098, + 0.4588235294117647, + 0.46274509803921565, + 0.4117647058823529, + 0.44313725490196076, + 0.45098039215686275, + 0.4666666666666666, + 0.4117647058823529, + 0.42745098039215684, + 0.5137254901960784, + 0.4196078431372549, + 0.3764705882352941, + 0.3176470588235294, + 0.13725490196078433, + 0.2352941176470588, + 0.16078431372549018, + 0.27450980392156865, + 0.19215686274509808, + 0.27058823529411763, + 0.27058823529411763, + 0.28627450980392155, + 0.08627450980392157, + 0.30980392156862746, + 0.3137254901960784, + 0.19607843137254904, + 0.25098039215686274, + 0.3137254901960784, + 0.22745098039215686, + 0.1803921568627451, + 0.1803921568627451, + 0.06274509803921569, + 0.0588235294117647, + 0.06274509803921569, + 0.07450980392156863, + 0.08627450980392157, + 0.08627450980392157, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.054901960784313725, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.10980392156862745, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.0588235294117647, - 0.09411764705882353, - 0.07058823529411765, - 0.0588235294117647, - 0.6235294117647059, - 0.7294117647058823, - 0.5882352941176471, - 0.6588235294117646, - 0.6039215686274509, - 0.6627450980392156, - 0.8117647058823529, - 0.5803921568627451, - 0.4980392156862745, - 0.5411764705882353, - 0.6549019607843136, - 0.6862745098039216, - 0.596078431372549, - 0.6, - 0.49411764705882355, - 0.4588235294117647, - 0.45098039215686275, - 0.4823529411764706, - 0.40784313725490196, - 0.43137254901960786, - 0.4549019607843137, - 0.39607843137254906, - 0.47843137254901963, - 0.48627450980392156, - 0.4823529411764706, - 0.6705882352941175, - 0.5294117647058824, - 0.4588235294117647, - 0.3294117647058823, - 0.2549019607843137, - 0.1450980392156863, - 0.2, - 0.14901960784313725, - 0.24705882352941178, - 0.2549019607843137, - 0.27058823529411763, - 0.25882352941176473, - 0.27450980392156865, - 0.1176470588235294, - 0.2627450980392157, - 0.3568627450980392, - 0.2549019607843137, - 0.1568627450980392, - 0.2549019607843137, - 0.2549019607843137, - 0.26666666666666666, - 0.26666666666666666, - 0.16470588235294115, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.06274509803921569, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.0588235294117647, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.10980392156862745, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.0588235294117647, + 0.09411764705882353, + 0.07058823529411765, + 0.0588235294117647, + 0.6235294117647059, + 0.7294117647058823, + 0.5882352941176471, + 0.6588235294117646, + 0.6039215686274509, + 0.6627450980392156, + 0.8117647058823529, + 0.5803921568627451, + 0.4980392156862745, + 0.5411764705882353, + 0.6549019607843136, + 0.6862745098039216, + 0.596078431372549, + 0.6, + 0.49411764705882355, + 0.4588235294117647, + 0.45098039215686275, + 0.4823529411764706, + 0.40784313725490196, + 0.43137254901960786, + 0.4549019607843137, + 0.39607843137254906, + 0.47843137254901963, + 0.48627450980392156, + 0.4823529411764706, + 0.6705882352941175, + 0.5294117647058824, + 0.4588235294117647, + 0.3294117647058823, + 0.2549019607843137, + 0.1450980392156863, + 0.2, + 0.14901960784313725, + 0.24705882352941178, + 0.2549019607843137, + 0.27058823529411763, + 0.25882352941176473, + 0.27450980392156865, + 0.1176470588235294, + 0.2627450980392157, + 0.3568627450980392, + 0.2549019607843137, + 0.1568627450980392, + 0.2549019607843137, + 0.2549019607843137, + 0.26666666666666666, + 0.26666666666666666, + 0.16470588235294115, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.06274509803921569, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.0588235294117647, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.11372549019607843, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.0588235294117647, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.054901960784313725, - 0.06274509803921569, - 0.06274509803921569, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.10196078431372549, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.11372549019607843, - 0.06274509803921569, - 0.047058823529411764, - 0.07058823529411765, - 0.7098039215686275, - 0.6509803921568627, - 0.6, - 0.6666666666666665, - 0.6039215686274509, - 0.7803921568627452, - 0.7058823529411765, - 0.4549019607843137, - 0.5137254901960784, - 0.45098039215686275, - 0.5176470588235295, - 0.611764705882353, - 0.5843137254901961, - 0.6039215686274509, - 0.4666666666666666, - 0.4588235294117647, - 0.47843137254901963, - 0.4235294117647059, - 0.43137254901960786, - 0.4196078431372549, - 0.44313725490196076, - 0.38431372549019616, - 0.4392156862745098, - 0.4, - 0.48627450980392156, - 0.5372549019607843, - 0.5490196078431373, - 0.4705882352941176, - 0.3921568627450981, - 0.2, - 0.1450980392156863, - 0.20392156862745098, - 0.1411764705882353, - 0.23921568627450981, - 0.30196078431372547, - 0.24313725490196078, - 0.25882352941176473, - 0.2627450980392157, - 0.1411764705882353, - 0.2823529411764706, - 0.3058823529411765, - 0.25098039215686274, - 0.12549019607843137, - 0.27450980392156865, - 0.23137254901960783, - 0.2901960784313726, - 0.1450980392156863, - 0.08627450980392157, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.050980392156862744, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.050980392156862744, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765 + 0.07058823529411765, + 0.11372549019607843, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.0588235294117647, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.054901960784313725, + 0.06274509803921569, + 0.06274509803921569, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.10196078431372549, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.11372549019607843, + 0.06274509803921569, + 0.047058823529411764, + 0.07058823529411765, + 0.7098039215686275, + 0.6509803921568627, + 0.6, + 0.6666666666666665, + 0.6039215686274509, + 0.7803921568627452, + 0.7058823529411765, + 0.4549019607843137, + 0.5137254901960784, + 0.45098039215686275, + 0.5176470588235295, + 0.611764705882353, + 0.5843137254901961, + 0.6039215686274509, + 0.4666666666666666, + 0.4588235294117647, + 0.47843137254901963, + 0.4235294117647059, + 0.43137254901960786, + 0.4196078431372549, + 0.44313725490196076, + 0.38431372549019616, + 0.4392156862745098, + 0.4, + 0.48627450980392156, + 0.5372549019607843, + 0.5490196078431373, + 0.4705882352941176, + 0.3921568627450981, + 0.2, + 0.1450980392156863, + 0.20392156862745098, + 0.1411764705882353, + 0.23921568627450981, + 0.30196078431372547, + 0.24313725490196078, + 0.25882352941176473, + 0.2627450980392157, + 0.1411764705882353, + 0.2823529411764706, + 0.3058823529411765, + 0.25098039215686274, + 0.12549019607843137, + 0.27450980392156865, + 0.23137254901960783, + 0.2901960784313726, + 0.1450980392156863, + 0.08627450980392157, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.050980392156862744, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.050980392156862744, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765 ], [ - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.050980392156862744, - 0.08235294117647057, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.054901960784313725, - 0.06274509803921569, - 0.07450980392156863, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.09803921568627452, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.07450980392156863, - 0.6, - 0.7490196078431373, - 0.5372549019607843, - 0.6039215686274509, - 0.5607843137254902, - 0.6274509803921569, - 0.7803921568627452, - 0.6274509803921569, - 0.43529411764705883, - 0.4666666666666666, - 0.49019607843137253, - 0.5019607843137255, - 0.5529411764705883, - 0.615686274509804, - 0.5411764705882353, - 0.48627450980392156, - 0.4549019607843137, - 0.49411764705882355, - 0.3607843137254902, - 0.4470588235294118, - 0.41568627450980394, - 0.5058823529411764, - 0.4117647058823529, - 0.3686274509803922, - 0.5725490196078431, - 0.4980392156862745, - 0.6, - 0.592156862745098, - 0.5372549019607843, - 0.4, - 0.23137254901960783, - 0.21568627450980393, - 0.19215686274509808, - 0.14901960784313725, - 0.20784313725490197, - 0.2980392156862745, - 0.2549019607843137, - 0.27058823529411763, - 0.22745098039215686, - 0.10980392156862745, - 0.27450980392156865, - 0.25098039215686274, - 0.25882352941176473, - 0.12941176470588237, - 0.25882352941176473, - 0.24313725490196078, - 0.2196078431372549, - 0.25098039215686274, - 0.16862745098039217, - 0.09019607843137255, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.050980392156862744, + 0.08235294117647057, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.054901960784313725, + 0.06274509803921569, + 0.07450980392156863, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.09803921568627452, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.07450980392156863, + 0.6, + 0.7490196078431373, + 0.5372549019607843, + 0.6039215686274509, + 0.5607843137254902, + 0.6274509803921569, + 0.7803921568627452, + 0.6274509803921569, + 0.43529411764705883, + 0.4666666666666666, + 0.49019607843137253, + 0.5019607843137255, + 0.5529411764705883, + 0.615686274509804, + 0.5411764705882353, + 0.48627450980392156, + 0.4549019607843137, + 0.49411764705882355, + 0.3607843137254902, + 0.4470588235294118, + 0.41568627450980394, + 0.5058823529411764, + 0.4117647058823529, + 0.3686274509803922, + 0.5725490196078431, + 0.4980392156862745, + 0.6, + 0.592156862745098, + 0.5372549019607843, + 0.4, + 0.23137254901960783, + 0.21568627450980393, + 0.19215686274509808, + 0.14901960784313725, + 0.20784313725490197, + 0.2980392156862745, + 0.2549019607843137, + 0.27058823529411763, + 0.22745098039215686, + 0.10980392156862745, + 0.27450980392156865, + 0.25098039215686274, + 0.25882352941176473, + 0.12941176470588237, + 0.25882352941176473, + 0.24313725490196078, + 0.2196078431372549, + 0.25098039215686274, + 0.16862745098039217, + 0.09019607843137255, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.08235294117647057, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.047058823529411764, - 0.054901960784313725, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.054901960784313725, - 0.16470588235294115, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.11372549019607843, - 0.6980392156862745, - 0.7333333333333333, - 0.6313725490196078, - 0.6392156862745098, - 0.592156862745098, - 0.7686274509803923, - 0.6823529411764706, - 0.6235294117647059, - 0.3058823529411765, - 0.4470588235294118, - 0.403921568627451, - 0.4823529411764706, - 0.5607843137254902, - 0.6431372549019607, - 0.6666666666666665, - 0.4549019607843137, - 0.45098039215686275, - 0.47843137254901963, - 0.39607843137254906, - 0.4470588235294118, - 0.4470588235294118, - 0.403921568627451, - 0.3176470588235294, - 0.4588235294117647, - 0.5019607843137255, - 0.5686274509803921, - 0.6039215686274509, - 0.5450980392156862, - 0.5215686274509804, - 0.44313725490196076, - 0.27058823529411763, - 0.2, - 0.2, - 0.2, - 0.3137254901960784, - 0.3137254901960784, - 0.30196078431372547, - 0.23137254901960783, - 0.27058823529411763, - 0.12549019607843137, - 0.34901960784313724, - 0.3607843137254902, - 0.2980392156862745, - 0.1843137254901961, - 0.19607843137254904, - 0.17254901960784313, - 0.2627450980392157, - 0.2627450980392157, - 0.21568627450980393, - 0.13333333333333333, - 0.054901960784313725, - 0.09411764705882353, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.10588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.08235294117647057, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.047058823529411764, + 0.054901960784313725, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.054901960784313725, + 0.16470588235294115, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.11372549019607843, + 0.6980392156862745, + 0.7333333333333333, + 0.6313725490196078, + 0.6392156862745098, + 0.592156862745098, + 0.7686274509803923, + 0.6823529411764706, + 0.6235294117647059, + 0.3058823529411765, + 0.4470588235294118, + 0.403921568627451, + 0.4823529411764706, + 0.5607843137254902, + 0.6431372549019607, + 0.6666666666666665, + 0.4549019607843137, + 0.45098039215686275, + 0.47843137254901963, + 0.39607843137254906, + 0.4470588235294118, + 0.4470588235294118, + 0.403921568627451, + 0.3176470588235294, + 0.4588235294117647, + 0.5019607843137255, + 0.5686274509803921, + 0.6039215686274509, + 0.5450980392156862, + 0.5215686274509804, + 0.44313725490196076, + 0.27058823529411763, + 0.2, + 0.2, + 0.2, + 0.3137254901960784, + 0.3137254901960784, + 0.30196078431372547, + 0.23137254901960783, + 0.27058823529411763, + 0.12549019607843137, + 0.34901960784313724, + 0.3607843137254902, + 0.2980392156862745, + 0.1843137254901961, + 0.19607843137254904, + 0.17254901960784313, + 0.2627450980392157, + 0.2627450980392157, + 0.21568627450980393, + 0.13333333333333333, + 0.054901960784313725, + 0.09411764705882353, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.10588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.10588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.09411764705882353, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.06274509803921569, - 0.054901960784313725, - 0.08235294117647057, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.09019607843137255, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.10588235294117647, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.054901960784313725, - 0.06666666666666667, - 0.06274509803921569, - 0.12156862745098039, - 0.06274509803921569, - 0.10196078431372549, - 0.07450980392156863, - 0.7176470588235294, - 0.6980392156862745, - 0.6274509803921569, - 0.5372549019607843, - 0.5372549019607843, - 0.8235294117647058, - 0.9450980392156861, - 0.8705882352941177, - 0.4980392156862745, - 0.4588235294117647, - 0.4823529411764706, - 0.44313725490196076, - 0.5294117647058824, - 0.49019607843137253, - 0.6352941176470588, - 0.611764705882353, - 0.5490196078431373, - 0.5137254901960784, - 0.43529411764705883, - 0.3921568627450981, - 0.2980392156862745, - 0.4666666666666666, - 0.40784313725490196, - 0.4392156862745098, - 0.3411764705882353, - 0.6196078431372549, - 0.5333333333333333, - 0.5686274509803921, - 0.5686274509803921, - 0.5215686274509804, - 0.4196078431372549, - 0.3058823529411765, - 0.21176470588235294, - 0.21176470588235294, - 0.2, - 0.13725490196078433, - 0.2823529411764706, - 0.21568627450980393, - 0.2549019607843137, - 0.16078431372549018, - 0.1450980392156863, - 0.34901960784313724, - 0.3137254901960784, - 0.35294117647058826, - 0.23137254901960783, - 0.18823529411764706, - 0.13725490196078433, - 0.3568627450980392, - 0.2823529411764706, - 0.22745098039215686, - 0.19607843137254904, - 0.0784313725490196, - 0.07058823529411765, - 0.050980392156862744, - 0.06274509803921569, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.10588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.09411764705882353, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.06274509803921569, + 0.054901960784313725, + 0.08235294117647057, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.09019607843137255, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.10588235294117647, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.054901960784313725, + 0.06666666666666667, + 0.06274509803921569, + 0.12156862745098039, + 0.06274509803921569, + 0.10196078431372549, + 0.07450980392156863, + 0.7176470588235294, + 0.6980392156862745, + 0.6274509803921569, + 0.5372549019607843, + 0.5372549019607843, + 0.8235294117647058, + 0.9450980392156861, + 0.8705882352941177, + 0.4980392156862745, + 0.4588235294117647, + 0.4823529411764706, + 0.44313725490196076, + 0.5294117647058824, + 0.49019607843137253, + 0.6352941176470588, + 0.611764705882353, + 0.5490196078431373, + 0.5137254901960784, + 0.43529411764705883, + 0.3921568627450981, + 0.2980392156862745, + 0.4666666666666666, + 0.40784313725490196, + 0.4392156862745098, + 0.3411764705882353, + 0.6196078431372549, + 0.5333333333333333, + 0.5686274509803921, + 0.5686274509803921, + 0.5215686274509804, + 0.4196078431372549, + 0.3058823529411765, + 0.21176470588235294, + 0.21176470588235294, + 0.2, + 0.13725490196078433, + 0.2823529411764706, + 0.21568627450980393, + 0.2549019607843137, + 0.16078431372549018, + 0.1450980392156863, + 0.34901960784313724, + 0.3137254901960784, + 0.35294117647058826, + 0.23137254901960783, + 0.18823529411764706, + 0.13725490196078433, + 0.3568627450980392, + 0.2823529411764706, + 0.22745098039215686, + 0.19607843137254904, + 0.0784313725490196, + 0.07058823529411765, + 0.050980392156862744, + 0.06274509803921569, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.0588235294117647, - 0.07450980392156863, - 0.09803921568627452, - 0.06274509803921569, - 0.07450980392156863, - 0.050980392156862744, - 0.06274509803921569, - 0.047058823529411764, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07058823529411765, - 0.08235294117647057, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.08235294117647057, - 0.22745098039215686, - 0.7176470588235294, - 0.6627450980392156, - 0.6, - 0.5803921568627451, - 0.6980392156862745, - 0.8196078431372549, - 0.8666666666666667, - 0.8745098039215686, - 0.592156862745098, - 0.3137254901960784, - 0.3254901960784313, - 0.4549019607843137, - 0.47843137254901963, - 0.5450980392156862, - 0.6862745098039216, - 0.6392156862745098, - 0.615686274509804, - 0.5411764705882353, - 0.46274509803921565, - 0.4705882352941176, - 0.47450980392156855, - 0.47450980392156855, - 0.4196078431372549, - 0.3607843137254902, - 0.4117647058823529, - 0.6235294117647059, - 0.7058823529411765, - 0.6352941176470588, - 0.5333333333333333, - 0.5568627450980392, - 0.25882352941176473, - 0.3176470588235294, - 0.23921568627450981, - 0.17647058823529413, - 0.10588235294117647, - 0.1843137254901961, - 0.29411764705882354, - 0.19607843137254904, - 0.24705882352941178, - 0.22745098039215686, - 0.16862745098039217, - 0.35294117647058826, - 0.4117647058823529, - 0.34509803921568627, - 0.30196078431372547, - 0.19215686274509808, - 0.25098039215686274, - 0.17647058823529413, - 0.1568627450980392, - 0.23137254901960783, - 0.17647058823529413, - 0.08235294117647057, - 0.0784313725490196, - 0.0784313725490196, - 0.06666666666666667, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.08627450980392157, - 0.0784313725490196, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.0588235294117647, + 0.07450980392156863, + 0.09803921568627452, + 0.06274509803921569, + 0.07450980392156863, + 0.050980392156862744, + 0.06274509803921569, + 0.047058823529411764, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07058823529411765, + 0.08235294117647057, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.08235294117647057, + 0.22745098039215686, + 0.7176470588235294, + 0.6627450980392156, + 0.6, + 0.5803921568627451, + 0.6980392156862745, + 0.8196078431372549, + 0.8666666666666667, + 0.8745098039215686, + 0.592156862745098, + 0.3137254901960784, + 0.3254901960784313, + 0.4549019607843137, + 0.47843137254901963, + 0.5450980392156862, + 0.6862745098039216, + 0.6392156862745098, + 0.615686274509804, + 0.5411764705882353, + 0.46274509803921565, + 0.4705882352941176, + 0.47450980392156855, + 0.47450980392156855, + 0.4196078431372549, + 0.3607843137254902, + 0.4117647058823529, + 0.6235294117647059, + 0.7058823529411765, + 0.6352941176470588, + 0.5333333333333333, + 0.5568627450980392, + 0.25882352941176473, + 0.3176470588235294, + 0.23921568627450981, + 0.17647058823529413, + 0.10588235294117647, + 0.1843137254901961, + 0.29411764705882354, + 0.19607843137254904, + 0.24705882352941178, + 0.22745098039215686, + 0.16862745098039217, + 0.35294117647058826, + 0.4117647058823529, + 0.34509803921568627, + 0.30196078431372547, + 0.19215686274509808, + 0.25098039215686274, + 0.17647058823529413, + 0.1568627450980392, + 0.23137254901960783, + 0.17647058823529413, + 0.08235294117647057, + 0.0784313725490196, + 0.0784313725490196, + 0.06666666666666667, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.08627450980392157, + 0.0784313725490196, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.09019607843137255, - 0.06666666666666667, - 0.08627450980392157, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.09019607843137255, - 0.06666666666666667, - 0.07450980392156863, - 0.0588235294117647, - 0.050980392156862744, - 0.06274509803921569, - 0.054901960784313725, - 0.10196078431372549, - 0.07058823529411765, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.14901960784313725, - 0.5725490196078431, - 0.7176470588235294, - 0.5529411764705883, - 0.5568627450980392, - 0.6078431372549019, - 0.7450980392156863, - 0.8666666666666667, - 0.8352941176470589, - 0.8274509803921568, - 0.5294117647058824, - 0.3764705882352941, - 0.3607843137254902, - 0.43529411764705883, - 0.4588235294117647, - 0.5882352941176471, - 0.596078431372549, - 0.592156862745098, - 0.5803921568627451, - 0.5411764705882353, - 0.4470588235294118, - 0.42745098039215684, - 0.39607843137254906, - 0.4235294117647059, - 0.39607843137254906, - 0.3882352941176471, - 0.47843137254901963, - 0.5568627450980392, - 0.6705882352941175, - 0.6431372549019607, - 0.5725490196078431, - 0.5647058823529412, - 0.33725490196078434, - 0.27058823529411763, - 0.28627450980392155, - 0.2235294117647059, - 0.19607843137254904, - 0.20392156862745098, - 0.17254901960784313, - 0.20784313725490197, - 0.24705882352941178, - 0.2352941176470588, - 0.2823529411764706, - 0.3764705882352941, - 0.33333333333333326, - 0.34901960784313724, - 0.3254901960784313, - 0.25098039215686274, - 0.20392156862745098, - 0.19607843137254904, - 0.2901960784313726, - 0.24705882352941178, - 0.21176470588235294, - 0.09411764705882353, - 0.08235294117647057, - 0.10196078431372549, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.09019607843137255, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.09019607843137255, + 0.06666666666666667, + 0.08627450980392157, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.09019607843137255, + 0.06666666666666667, + 0.07450980392156863, + 0.0588235294117647, + 0.050980392156862744, + 0.06274509803921569, + 0.054901960784313725, + 0.10196078431372549, + 0.07058823529411765, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.14901960784313725, + 0.5725490196078431, + 0.7176470588235294, + 0.5529411764705883, + 0.5568627450980392, + 0.6078431372549019, + 0.7450980392156863, + 0.8666666666666667, + 0.8352941176470589, + 0.8274509803921568, + 0.5294117647058824, + 0.3764705882352941, + 0.3607843137254902, + 0.43529411764705883, + 0.4588235294117647, + 0.5882352941176471, + 0.596078431372549, + 0.592156862745098, + 0.5803921568627451, + 0.5411764705882353, + 0.4470588235294118, + 0.42745098039215684, + 0.39607843137254906, + 0.4235294117647059, + 0.39607843137254906, + 0.3882352941176471, + 0.47843137254901963, + 0.5568627450980392, + 0.6705882352941175, + 0.6431372549019607, + 0.5725490196078431, + 0.5647058823529412, + 0.33725490196078434, + 0.27058823529411763, + 0.28627450980392155, + 0.2235294117647059, + 0.19607843137254904, + 0.20392156862745098, + 0.17254901960784313, + 0.20784313725490197, + 0.24705882352941178, + 0.2352941176470588, + 0.2823529411764706, + 0.3764705882352941, + 0.33333333333333326, + 0.34901960784313724, + 0.3254901960784313, + 0.25098039215686274, + 0.20392156862745098, + 0.19607843137254904, + 0.2901960784313726, + 0.24705882352941178, + 0.21176470588235294, + 0.09411764705882353, + 0.08235294117647057, + 0.10196078431372549, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.09019607843137255, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.06274509803921569, - 0.050980392156862744, - 0.06274509803921569, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.18823529411764706, - 0.6392156862745098, - 0.6784313725490196, - 0.6235294117647059, - 0.6274509803921569, - 0.6666666666666665, - 0.8117647058823529, - 0.8705882352941177, - 0.8431372549019608, - 0.6627450980392156, - 0.5647058823529412, - 0.4, - 0.40784313725490196, - 0.3803921568627451, - 0.4980392156862745, - 0.5647058823529412, - 0.5764705882352941, - 0.5450980392156862, - 0.6, - 0.5490196078431373, - 0.4392156862745098, - 0.39607843137254906, - 0.43137254901960786, - 0.4, - 0.3686274509803922, - 0.4, - 0.4588235294117647, - 0.5882352941176471, - 0.615686274509804, - 0.5450980392156862, - 0.6274509803921569, - 0.5098039215686274, - 0.43529411764705883, - 0.28627450980392155, - 0.2823529411764706, - 0.19215686274509808, - 0.1843137254901961, - 0.1176470588235294, - 0.17254901960784313, - 0.2784313725490196, - 0.18823529411764706, - 0.2352941176470588, - 0.2235294117647059, - 0.3607843137254902, - 0.33333333333333326, - 0.3176470588235294, - 0.3568627450980392, - 0.22745098039215686, - 0.20784313725490197, - 0.16862745098039217, - 0.21568627450980393, - 0.2823529411764706, - 0.22745098039215686, - 0.12941176470588237, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.08235294117647057, - 0.08235294117647057, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.10980392156862745 + 0.07058823529411765, + 0.06274509803921569, + 0.050980392156862744, + 0.06274509803921569, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.18823529411764706, + 0.6392156862745098, + 0.6784313725490196, + 0.6235294117647059, + 0.6274509803921569, + 0.6666666666666665, + 0.8117647058823529, + 0.8705882352941177, + 0.8431372549019608, + 0.6627450980392156, + 0.5647058823529412, + 0.4, + 0.40784313725490196, + 0.3803921568627451, + 0.4980392156862745, + 0.5647058823529412, + 0.5764705882352941, + 0.5450980392156862, + 0.6, + 0.5490196078431373, + 0.4392156862745098, + 0.39607843137254906, + 0.43137254901960786, + 0.4, + 0.3686274509803922, + 0.4, + 0.4588235294117647, + 0.5882352941176471, + 0.615686274509804, + 0.5450980392156862, + 0.6274509803921569, + 0.5098039215686274, + 0.43529411764705883, + 0.28627450980392155, + 0.2823529411764706, + 0.19215686274509808, + 0.1843137254901961, + 0.1176470588235294, + 0.17254901960784313, + 0.2784313725490196, + 0.18823529411764706, + 0.2352941176470588, + 0.2235294117647059, + 0.3607843137254902, + 0.33333333333333326, + 0.3176470588235294, + 0.3568627450980392, + 0.22745098039215686, + 0.20784313725490197, + 0.16862745098039217, + 0.21568627450980393, + 0.2823529411764706, + 0.22745098039215686, + 0.12941176470588237, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.08235294117647057, + 0.08235294117647057, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.10980392156862745 ], [ - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.06274509803921569, - 0.06274509803921569, - 0.054901960784313725, - 0.054901960784313725, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.0784313725490196, - 0.06274509803921569, - 0.047058823529411764, - 0.0588235294117647, - 0.054901960784313725, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.13725490196078433, - 0.06666666666666667, - 0.08627450980392157, - 0.06274509803921569, - 0.054901960784313725, - 0.49019607843137253, - 0.6470588235294117, - 0.6392156862745098, - 0.5607843137254902, - 0.5882352941176471, - 0.7843137254901962, - 0.9019607843137255, - 0.8235294117647058, - 0.8823529411764706, - 0.6745098039215687, - 0.5215686274509804, - 0.4549019607843137, - 0.33725490196078434, - 0.34509803921568627, - 0.5137254901960784, - 0.5607843137254902, - 0.6392156862745098, - 0.596078431372549, - 0.5882352941176471, - 0.48627450980392156, - 0.45098039215686275, - 0.3607843137254902, - 0.4235294117647059, - 0.3607843137254902, - 0.25882352941176473, - 0.44313725490196076, - 0.4196078431372549, - 0.5490196078431373, - 0.5803921568627451, - 0.5764705882352941, - 0.6078431372549019, - 0.4705882352941176, - 0.43137254901960786, - 0.2627450980392157, - 0.2980392156862745, - 0.17647058823529413, - 0.16862745098039217, - 0.2627450980392157, - 0.2352941176470588, - 0.16862745098039217, - 0.16862745098039217, - 0.18823529411764706, - 0.2980392156862745, - 0.3254901960784313, - 0.3411764705882353, - 0.3803921568627451, - 0.33333333333333326, - 0.2235294117647059, - 0.19607843137254904, - 0.2352941176470588, - 0.27058823529411763, - 0.1568627450980392, - 0.2, - 0.12156862745098039, - 0.10588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.09803921568627452, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.09803921568627452, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.06274509803921569, + 0.06274509803921569, + 0.054901960784313725, + 0.054901960784313725, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.0784313725490196, + 0.06274509803921569, + 0.047058823529411764, + 0.0588235294117647, + 0.054901960784313725, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.13725490196078433, + 0.06666666666666667, + 0.08627450980392157, + 0.06274509803921569, + 0.054901960784313725, + 0.49019607843137253, + 0.6470588235294117, + 0.6392156862745098, + 0.5607843137254902, + 0.5882352941176471, + 0.7843137254901962, + 0.9019607843137255, + 0.8235294117647058, + 0.8823529411764706, + 0.6745098039215687, + 0.5215686274509804, + 0.4549019607843137, + 0.33725490196078434, + 0.34509803921568627, + 0.5137254901960784, + 0.5607843137254902, + 0.6392156862745098, + 0.596078431372549, + 0.5882352941176471, + 0.48627450980392156, + 0.45098039215686275, + 0.3607843137254902, + 0.4235294117647059, + 0.3607843137254902, + 0.25882352941176473, + 0.44313725490196076, + 0.4196078431372549, + 0.5490196078431373, + 0.5803921568627451, + 0.5764705882352941, + 0.6078431372549019, + 0.4705882352941176, + 0.43137254901960786, + 0.2627450980392157, + 0.2980392156862745, + 0.17647058823529413, + 0.16862745098039217, + 0.2627450980392157, + 0.2352941176470588, + 0.16862745098039217, + 0.16862745098039217, + 0.18823529411764706, + 0.2980392156862745, + 0.3254901960784313, + 0.3411764705882353, + 0.3803921568627451, + 0.33333333333333326, + 0.2235294117647059, + 0.19607843137254904, + 0.2352941176470588, + 0.27058823529411763, + 0.1568627450980392, + 0.2, + 0.12156862745098039, + 0.10588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.09803921568627452, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.09803921568627452, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.0588235294117647, - 0.06274509803921569, - 0.06274509803921569, - 0.054901960784313725, - 0.06274509803921569, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.0784313725490196, - 0.06666666666666667, - 0.09803921568627452, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.0784313725490196, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.09411764705882353, - 0.1176470588235294, - 0.07058823529411765, - 0.28627450980392155, - 0.6431372549019607, - 0.5882352941176471, - 0.6, - 0.6470588235294117, - 0.5490196078431373, - 0.7411764705882353, - 0.9333333333333332, - 0.7921568627450981, - 0.7843137254901962, - 0.592156862745098, - 0.5176470588235295, - 0.3921568627450981, - 0.3411764705882353, - 0.33725490196078434, - 0.4980392156862745, - 0.5725490196078431, - 0.5490196078431373, - 0.6274509803921569, - 0.5254901960784314, - 0.5176470588235295, - 0.4117647058823529, - 0.403921568627451, - 0.40784313725490196, - 0.4392156862745098, - 0.4, - 0.2823529411764706, - 0.4392156862745098, - 0.592156862745098, - 0.6313725490196078, - 0.5372549019607843, - 0.6, - 0.48627450980392156, - 0.3764705882352941, - 0.23137254901960783, - 0.2627450980392157, - 0.2352941176470588, - 0.1411764705882353, - 0.1568627450980392, - 0.1450980392156863, - 0.19607843137254904, - 0.13725490196078433, - 0.17254901960784313, - 0.25882352941176473, - 0.2823529411764706, - 0.25882352941176473, - 0.2549019607843137, - 0.20392156862745098, - 0.30980392156862746, - 0.2352941176470588, - 0.2196078431372549, - 0.29411764705882354, - 0.17647058823529413, - 0.13725490196078433, - 0.10588235294117647, - 0.10196078431372549, - 0.08235294117647057, - 0.08235294117647057, - 0.08235294117647057, - 0.07450980392156863, - 0.07058823529411765, - 0.06274509803921569, - 0.09019607843137255, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863 + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.0588235294117647, + 0.06274509803921569, + 0.06274509803921569, + 0.054901960784313725, + 0.06274509803921569, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.0784313725490196, + 0.06666666666666667, + 0.09803921568627452, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.0784313725490196, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.09411764705882353, + 0.1176470588235294, + 0.07058823529411765, + 0.28627450980392155, + 0.6431372549019607, + 0.5882352941176471, + 0.6, + 0.6470588235294117, + 0.5490196078431373, + 0.7411764705882353, + 0.9333333333333332, + 0.7921568627450981, + 0.7843137254901962, + 0.592156862745098, + 0.5176470588235295, + 0.3921568627450981, + 0.3411764705882353, + 0.33725490196078434, + 0.4980392156862745, + 0.5725490196078431, + 0.5490196078431373, + 0.6274509803921569, + 0.5254901960784314, + 0.5176470588235295, + 0.4117647058823529, + 0.403921568627451, + 0.40784313725490196, + 0.4392156862745098, + 0.4, + 0.2823529411764706, + 0.4392156862745098, + 0.592156862745098, + 0.6313725490196078, + 0.5372549019607843, + 0.6, + 0.48627450980392156, + 0.3764705882352941, + 0.23137254901960783, + 0.2627450980392157, + 0.2352941176470588, + 0.1411764705882353, + 0.1568627450980392, + 0.1450980392156863, + 0.19607843137254904, + 0.13725490196078433, + 0.17254901960784313, + 0.25882352941176473, + 0.2823529411764706, + 0.25882352941176473, + 0.2549019607843137, + 0.20392156862745098, + 0.30980392156862746, + 0.2352941176470588, + 0.2196078431372549, + 0.29411764705882354, + 0.17647058823529413, + 0.13725490196078433, + 0.10588235294117647, + 0.10196078431372549, + 0.08235294117647057, + 0.08235294117647057, + 0.08235294117647057, + 0.07450980392156863, + 0.07058823529411765, + 0.06274509803921569, + 0.09019607843137255, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863 ], [ - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.08235294117647057, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06274509803921569, - 0.06274509803921569, - 0.054901960784313725, - 0.07450980392156863, - 0.054901960784313725, - 0.054901960784313725, - 0.1176470588235294, - 0.050980392156862744, - 0.054901960784313725, - 0.0588235294117647, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.07058823529411765, - 0.06274509803921569, - 0.5803921568627451, - 0.6235294117647059, - 0.5450980392156862, - 0.6235294117647059, - 0.6627450980392156, - 0.7215686274509804, - 0.8352941176470589, - 0.8901960784313725, - 0.7568627450980392, - 0.5686274509803921, - 0.615686274509804, - 0.44313725490196076, - 0.4666666666666666, - 0.3254901960784313, - 0.35294117647058826, - 0.43137254901960786, - 0.5882352941176471, - 0.5843137254901961, - 0.6274509803921569, - 0.5843137254901961, - 0.4235294117647059, - 0.39607843137254906, - 0.4549019607843137, - 0.3254901960784313, - 0.3686274509803922, - 0.3803921568627451, - 0.3921568627450981, - 0.4, - 0.5803921568627451, - 0.5686274509803921, - 0.5176470588235295, - 0.5058823529411764, - 0.3882352941176471, - 0.35294117647058826, - 0.3254901960784313, - 0.19215686274509808, - 0.20784313725490197, - 0.16862745098039217, - 0.1411764705882353, - 0.08627450980392157, - 0.20784313725490197, - 0.22745098039215686, - 0.2196078431372549, - 0.12941176470588237, - 0.23137254901960783, - 0.22745098039215686, - 0.24313725490196078, - 0.13333333333333333, - 0.1411764705882353, - 0.1843137254901961, - 0.22745098039215686, - 0.1411764705882353, - 0.2352941176470588, - 0.12156862745098039, - 0.12156862745098039, - 0.07058823529411765, - 0.07450980392156863, - 0.08235294117647057, - 0.1411764705882353, - 0.0588235294117647, - 0.0588235294117647, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765 + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.08235294117647057, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06274509803921569, + 0.06274509803921569, + 0.054901960784313725, + 0.07450980392156863, + 0.054901960784313725, + 0.054901960784313725, + 0.1176470588235294, + 0.050980392156862744, + 0.054901960784313725, + 0.0588235294117647, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.07058823529411765, + 0.06274509803921569, + 0.5803921568627451, + 0.6235294117647059, + 0.5450980392156862, + 0.6235294117647059, + 0.6627450980392156, + 0.7215686274509804, + 0.8352941176470589, + 0.8901960784313725, + 0.7568627450980392, + 0.5686274509803921, + 0.615686274509804, + 0.44313725490196076, + 0.4666666666666666, + 0.3254901960784313, + 0.35294117647058826, + 0.43137254901960786, + 0.5882352941176471, + 0.5843137254901961, + 0.6274509803921569, + 0.5843137254901961, + 0.4235294117647059, + 0.39607843137254906, + 0.4549019607843137, + 0.3254901960784313, + 0.3686274509803922, + 0.3803921568627451, + 0.3921568627450981, + 0.4, + 0.5803921568627451, + 0.5686274509803921, + 0.5176470588235295, + 0.5058823529411764, + 0.3882352941176471, + 0.35294117647058826, + 0.3254901960784313, + 0.19215686274509808, + 0.20784313725490197, + 0.16862745098039217, + 0.1411764705882353, + 0.08627450980392157, + 0.20784313725490197, + 0.22745098039215686, + 0.2196078431372549, + 0.12941176470588237, + 0.23137254901960783, + 0.22745098039215686, + 0.24313725490196078, + 0.13333333333333333, + 0.1411764705882353, + 0.1843137254901961, + 0.22745098039215686, + 0.1411764705882353, + 0.2352941176470588, + 0.12156862745098039, + 0.12156862745098039, + 0.07058823529411765, + 0.07450980392156863, + 0.08235294117647057, + 0.1411764705882353, + 0.0588235294117647, + 0.0588235294117647, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765 ], [ - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.047058823529411764, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.07058823529411765, - 0.0588235294117647, - 0.07058823529411765, - 0.06666666666666667, - 0.10196078431372549, - 0.6235294117647059, - 0.5490196078431373, - 0.5803921568627451, - 0.5803921568627451, - 0.6980392156862745, - 0.803921568627451, - 0.8156862745098039, - 0.7960784313725491, - 0.5568627450980392, - 0.6352941176470588, - 0.5647058823529412, - 0.611764705882353, - 0.47843137254901963, - 0.34509803921568627, - 0.3411764705882353, - 0.38431372549019616, - 0.5411764705882353, - 0.5764705882352941, - 0.6039215686274509, - 0.5686274509803921, - 0.3882352941176471, - 0.4196078431372549, - 0.41568627450980394, - 0.37254901960784315, - 0.38431372549019616, - 0.45098039215686275, - 0.36470588235294116, - 0.5254901960784314, - 0.6392156862745098, - 0.615686274509804, - 0.5882352941176471, - 0.5294117647058824, - 0.5254901960784314, - 0.44313725490196076, - 0.32156862745098036, - 0.2980392156862745, - 0.26666666666666666, - 0.17647058823529413, - 0.18823529411764706, - 0.17254901960784313, - 0.14901960784313725, - 0.1843137254901961, - 0.19607843137254904, - 0.1568627450980392, - 0.2196078431372549, - 0.13333333333333333, - 0.15294117647058825, - 0.21568627450980393, - 0.21176470588235294, - 0.23137254901960783, - 0.2235294117647059, - 0.19607843137254904, - 0.2784313725490196, - 0.2235294117647059, - 0.12941176470588237, - 0.10196078431372549, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765 + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.047058823529411764, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.07058823529411765, + 0.0588235294117647, + 0.07058823529411765, + 0.06666666666666667, + 0.10196078431372549, + 0.6235294117647059, + 0.5490196078431373, + 0.5803921568627451, + 0.5803921568627451, + 0.6980392156862745, + 0.803921568627451, + 0.8156862745098039, + 0.7960784313725491, + 0.5568627450980392, + 0.6352941176470588, + 0.5647058823529412, + 0.611764705882353, + 0.47843137254901963, + 0.34509803921568627, + 0.3411764705882353, + 0.38431372549019616, + 0.5411764705882353, + 0.5764705882352941, + 0.6039215686274509, + 0.5686274509803921, + 0.3882352941176471, + 0.4196078431372549, + 0.41568627450980394, + 0.37254901960784315, + 0.38431372549019616, + 0.45098039215686275, + 0.36470588235294116, + 0.5254901960784314, + 0.6392156862745098, + 0.615686274509804, + 0.5882352941176471, + 0.5294117647058824, + 0.5254901960784314, + 0.44313725490196076, + 0.32156862745098036, + 0.2980392156862745, + 0.26666666666666666, + 0.17647058823529413, + 0.18823529411764706, + 0.17254901960784313, + 0.14901960784313725, + 0.1843137254901961, + 0.19607843137254904, + 0.1568627450980392, + 0.2196078431372549, + 0.13333333333333333, + 0.15294117647058825, + 0.21568627450980393, + 0.21176470588235294, + 0.23137254901960783, + 0.2235294117647059, + 0.19607843137254904, + 0.2784313725490196, + 0.2235294117647059, + 0.12941176470588237, + 0.10196078431372549, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765 ], [ - 0.07058823529411765, - 0.0588235294117647, - 0.0588235294117647, - 0.0588235294117647, - 0.06666666666666667, - 0.0588235294117647, - 0.10980392156862745, - 0.06274509803921569, - 0.0588235294117647, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.054901960784313725, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.39607843137254906, - 0.615686274509804, - 0.6235294117647059, - 0.5843137254901961, - 0.6627450980392156, - 0.7647058823529411, - 0.6784313725490196, - 0.8, - 0.7686274509803923, - 0.6509803921568627, - 0.6196078431372549, - 0.6039215686274509, - 0.5607843137254902, - 0.4666666666666666, - 0.33333333333333326, - 0.30196078431372547, - 0.32156862745098036, - 0.5058823529411764, - 0.5529411764705883, - 0.596078431372549, - 0.5764705882352941, - 0.4666666666666666, - 0.4392156862745098, - 0.4, - 0.4117647058823529, - 0.35294117647058826, - 0.33725490196078434, - 0.4470588235294118, - 0.43529411764705883, - 0.5450980392156862, - 0.5647058823529412, - 0.6392156862745098, - 0.5372549019607843, - 0.46274509803921565, - 0.3882352941176471, - 0.33333333333333326, - 0.28627450980392155, - 0.21568627450980393, - 0.13725490196078433, - 0.15294117647058825, - 0.1411764705882353, - 0.20392156862745098, - 0.19215686274509808, - 0.2235294117647059, - 0.1803921568627451, - 0.22745098039215686, - 0.1450980392156863, - 0.16470588235294115, - 0.1411764705882353, - 0.16078431372549018, - 0.17254901960784313, - 0.23137254901960783, - 0.19607843137254904, - 0.1450980392156863, - 0.25098039215686274, - 0.09019607843137255, - 0.13333333333333333, - 0.07450980392156863, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.0784313725490196, - 0.09019607843137255, - 0.07058823529411765 + 0.07058823529411765, + 0.0588235294117647, + 0.0588235294117647, + 0.0588235294117647, + 0.06666666666666667, + 0.0588235294117647, + 0.10980392156862745, + 0.06274509803921569, + 0.0588235294117647, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.054901960784313725, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.39607843137254906, + 0.615686274509804, + 0.6235294117647059, + 0.5843137254901961, + 0.6627450980392156, + 0.7647058823529411, + 0.6784313725490196, + 0.8, + 0.7686274509803923, + 0.6509803921568627, + 0.6196078431372549, + 0.6039215686274509, + 0.5607843137254902, + 0.4666666666666666, + 0.33333333333333326, + 0.30196078431372547, + 0.32156862745098036, + 0.5058823529411764, + 0.5529411764705883, + 0.596078431372549, + 0.5764705882352941, + 0.4666666666666666, + 0.4392156862745098, + 0.4, + 0.4117647058823529, + 0.35294117647058826, + 0.33725490196078434, + 0.4470588235294118, + 0.43529411764705883, + 0.5450980392156862, + 0.5647058823529412, + 0.6392156862745098, + 0.5372549019607843, + 0.46274509803921565, + 0.3882352941176471, + 0.33333333333333326, + 0.28627450980392155, + 0.21568627450980393, + 0.13725490196078433, + 0.15294117647058825, + 0.1411764705882353, + 0.20392156862745098, + 0.19215686274509808, + 0.2235294117647059, + 0.1803921568627451, + 0.22745098039215686, + 0.1450980392156863, + 0.16470588235294115, + 0.1411764705882353, + 0.16078431372549018, + 0.17254901960784313, + 0.23137254901960783, + 0.19607843137254904, + 0.1450980392156863, + 0.25098039215686274, + 0.09019607843137255, + 0.13333333333333333, + 0.07450980392156863, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.0784313725490196, + 0.09019607843137255, + 0.07058823529411765 ], [ - 0.08627450980392157, - 0.06666666666666667, - 0.11372549019607843, - 0.06666666666666667, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.09019607843137255, - 0.09019607843137255, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.0784313725490196, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.08627450980392157, - 0.6274509803921569, - 0.592156862745098, - 0.6274509803921569, - 0.5882352941176471, - 0.6980392156862745, - 0.7372549019607844, - 0.8156862745098039, - 0.7137254901960784, - 0.8352941176470589, - 0.5725490196078431, - 0.615686274509804, - 0.6196078431372549, - 0.5450980392156862, - 0.43137254901960786, - 0.403921568627451, - 0.3176470588235294, - 0.3058823529411765, - 0.4117647058823529, - 0.5490196078431373, - 0.5725490196078431, - 0.5764705882352941, - 0.4117647058823529, - 0.4117647058823529, - 0.43137254901960786, - 0.41568627450980394, - 0.41568627450980394, - 0.3137254901960784, - 0.4117647058823529, - 0.41568627450980394, - 0.4705882352941176, - 0.49411764705882355, - 0.5764705882352941, - 0.615686274509804, - 0.4588235294117647, - 0.3568627450980392, - 0.29411764705882354, - 0.2901960784313726, - 0.1176470588235294, - 0.15294117647058825, - 0.1411764705882353, - 0.1411764705882353, - 0.16470588235294115, - 0.17647058823529413, - 0.22745098039215686, - 0.2549019607843137, - 0.2196078431372549, - 0.2549019607843137, - 0.25098039215686274, - 0.21176470588235294, - 0.12941176470588237, - 0.1568627450980392, - 0.16470588235294115, - 0.27450980392156865, - 0.3058823529411765, - 0.27450980392156865, - 0.10980392156862745, - 0.20392156862745098, - 0.06666666666666667, - 0.06274509803921569, - 0.07450980392156863, - 0.06666666666666667, - 0.09803921568627452, - 0.06666666666666667, - 0.07450980392156863, - 0.08627450980392157, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07058823529411765, - 0.08235294117647057, - 0.0784313725490196, - 0.06666666666666667 + 0.08627450980392157, + 0.06666666666666667, + 0.11372549019607843, + 0.06666666666666667, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.09019607843137255, + 0.09019607843137255, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.0784313725490196, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.08627450980392157, + 0.6274509803921569, + 0.592156862745098, + 0.6274509803921569, + 0.5882352941176471, + 0.6980392156862745, + 0.7372549019607844, + 0.8156862745098039, + 0.7137254901960784, + 0.8352941176470589, + 0.5725490196078431, + 0.615686274509804, + 0.6196078431372549, + 0.5450980392156862, + 0.43137254901960786, + 0.403921568627451, + 0.3176470588235294, + 0.3058823529411765, + 0.4117647058823529, + 0.5490196078431373, + 0.5725490196078431, + 0.5764705882352941, + 0.4117647058823529, + 0.4117647058823529, + 0.43137254901960786, + 0.41568627450980394, + 0.41568627450980394, + 0.3137254901960784, + 0.4117647058823529, + 0.41568627450980394, + 0.4705882352941176, + 0.49411764705882355, + 0.5764705882352941, + 0.615686274509804, + 0.4588235294117647, + 0.3568627450980392, + 0.29411764705882354, + 0.2901960784313726, + 0.1176470588235294, + 0.15294117647058825, + 0.1411764705882353, + 0.1411764705882353, + 0.16470588235294115, + 0.17647058823529413, + 0.22745098039215686, + 0.2549019607843137, + 0.2196078431372549, + 0.2549019607843137, + 0.25098039215686274, + 0.21176470588235294, + 0.12941176470588237, + 0.1568627450980392, + 0.16470588235294115, + 0.27450980392156865, + 0.3058823529411765, + 0.27450980392156865, + 0.10980392156862745, + 0.20392156862745098, + 0.06666666666666667, + 0.06274509803921569, + 0.07450980392156863, + 0.06666666666666667, + 0.09803921568627452, + 0.06666666666666667, + 0.07450980392156863, + 0.08627450980392157, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07058823529411765, + 0.08235294117647057, + 0.0784313725490196, + 0.06666666666666667 ], [ - 0.07058823529411765, - 0.07058823529411765, - 0.07058823529411765, - 0.06666666666666667, - 0.09411764705882353, - 0.09803921568627452, - 0.06274509803921569, - 0.07058823529411765, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07058823529411765, - 0.050980392156862744, - 0.08627450980392157, - 0.07058823529411765, - 0.06666666666666667, - 0.06274509803921569, - 0.07058823529411765, - 0.06666666666666667, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.07450980392156863, - 0.0784313725490196, - 0.07058823529411765, - 0.09019607843137255, - 0.12941176470588237, - 0.49019607843137253, - 0.5803921568627451, - 0.596078431372549, - 0.6078431372549019, - 0.7764705882352942, - 0.8, - 0.7529411764705882, - 0.7529411764705882, - 0.6862745098039216, - 0.6627450980392156, - 0.6862745098039216, - 0.5411764705882353, - 0.5411764705882353, - 0.4392156862745098, - 0.38431372549019616, - 0.32156862745098036, - 0.2980392156862745, - 0.34901960784313724, - 0.48627450980392156, - 0.6078431372549019, - 0.5450980392156862, - 0.4980392156862745, - 0.4235294117647059, - 0.40784313725490196, - 0.4235294117647059, - 0.3294117647058823, - 0.3411764705882353, - 0.37254901960784315, - 0.4117647058823529, - 0.5568627450980392, - 0.43529411764705883, - 0.4470588235294118, - 0.3921568627450981, - 0.27058823529411763, - 0.2823529411764706, - 0.3294117647058823, - 0.2823529411764706, - 0.1803921568627451, - 0.12941176470588237, - 0.12156862745098039, - 0.1568627450980392, - 0.14901960784313725, - 0.18823529411764706, - 0.25098039215686274, - 0.26666666666666666, - 0.17647058823529413, - 0.1568627450980392, - 0.15294117647058825, - 0.17647058823529413, - 0.16078431372549018, - 0.13333333333333333, - 0.21176470588235294, - 0.16470588235294115, - 0.2627450980392157, - 0.17647058823529413, - 0.13725490196078433, - 0.2549019607843137, - 0.07450980392156863, - 0.0588235294117647, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.07450980392156863, - 0.07450980392156863, - 0.08627450980392157, - 0.07058823529411765, - 0.07058823529411765, - 0.08235294117647057, - 0.07450980392156863, - 0.0588235294117647, - 0.06666666666666667, - 0.08627450980392157, - 0.07450980392156863 + 0.07058823529411765, + 0.07058823529411765, + 0.07058823529411765, + 0.06666666666666667, + 0.09411764705882353, + 0.09803921568627452, + 0.06274509803921569, + 0.07058823529411765, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07058823529411765, + 0.050980392156862744, + 0.08627450980392157, + 0.07058823529411765, + 0.06666666666666667, + 0.06274509803921569, + 0.07058823529411765, + 0.06666666666666667, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.07450980392156863, + 0.0784313725490196, + 0.07058823529411765, + 0.09019607843137255, + 0.12941176470588237, + 0.49019607843137253, + 0.5803921568627451, + 0.596078431372549, + 0.6078431372549019, + 0.7764705882352942, + 0.8, + 0.7529411764705882, + 0.7529411764705882, + 0.6862745098039216, + 0.6627450980392156, + 0.6862745098039216, + 0.5411764705882353, + 0.5411764705882353, + 0.4392156862745098, + 0.38431372549019616, + 0.32156862745098036, + 0.2980392156862745, + 0.34901960784313724, + 0.48627450980392156, + 0.6078431372549019, + 0.5450980392156862, + 0.4980392156862745, + 0.4235294117647059, + 0.40784313725490196, + 0.4235294117647059, + 0.3294117647058823, + 0.3411764705882353, + 0.37254901960784315, + 0.4117647058823529, + 0.5568627450980392, + 0.43529411764705883, + 0.4470588235294118, + 0.3921568627450981, + 0.27058823529411763, + 0.2823529411764706, + 0.3294117647058823, + 0.2823529411764706, + 0.1803921568627451, + 0.12941176470588237, + 0.12156862745098039, + 0.1568627450980392, + 0.14901960784313725, + 0.18823529411764706, + 0.25098039215686274, + 0.26666666666666666, + 0.17647058823529413, + 0.1568627450980392, + 0.15294117647058825, + 0.17647058823529413, + 0.16078431372549018, + 0.13333333333333333, + 0.21176470588235294, + 0.16470588235294115, + 0.2627450980392157, + 0.17647058823529413, + 0.13725490196078433, + 0.2549019607843137, + 0.07450980392156863, + 0.0588235294117647, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.07450980392156863, + 0.07450980392156863, + 0.08627450980392157, + 0.07058823529411765, + 0.07058823529411765, + 0.08235294117647057, + 0.07450980392156863, + 0.0588235294117647, + 0.06666666666666667, + 0.08627450980392157, + 0.07450980392156863 ], [ - 0.14901960784313725, - 0.07058823529411765, - 0.06274509803921569, - 0.07058823529411765, - 0.07058823529411765, - 0.09411764705882353, - 0.06274509803921569, - 0.08235294117647057, - 0.10980392156862745, - 0.06666666666666667, - 0.08235294117647057, - 0.07058823529411765, - 0.06274509803921569, - 0.0588235294117647, - 0.06666666666666667, - 0.10196078431372549, - 0.047058823529411764, - 0.06666666666666667, - 0.09019607843137255, - 0.06666666666666667, - 0.0784313725490196, - 0.07058823529411765, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.06666666666666667, - 0.08235294117647057, - 0.06274509803921569, - 0.06666666666666667, - 0.08235294117647057, - 0.5490196078431373, - 0.5450980392156862, - 0.596078431372549, - 0.592156862745098, - 0.6862745098039216, - 0.7686274509803923, - 0.7372549019607844, - 0.7725490196078433, - 0.7490196078431373, - 0.592156862745098, - 0.5843137254901961, - 0.6196078431372549, - 0.5529411764705883, - 0.5647058823529412, - 0.3921568627450981, - 0.39607843137254906, - 0.2901960784313726, - 0.27058823529411763, - 0.3294117647058823, - 0.5529411764705883, - 0.5529411764705883, - 0.592156862745098, - 0.4980392156862745, - 0.40784313725490196, - 0.4549019607843137, - 0.40784313725490196, - 0.38431372549019616, - 0.3568627450980392, - 0.3294117647058823, - 0.403921568627451, - 0.5058823529411764, - 0.5137254901960784, - 0.5137254901960784, - 0.4196078431372549, - 0.35294117647058826, - 0.27450980392156865, - 0.2823529411764706, - 0.17254901960784313, - 0.16078431372549018, - 0.14901960784313725, - 0.20784313725490197, - 0.21568627450980393, - 0.1450980392156863, - 0.1568627450980392, - 0.16470588235294115, - 0.13725490196078433, - 0.21176470588235294, - 0.1450980392156863, - 0.1411764705882353, - 0.10196078431372549, - 0.16078431372549018, - 0.1843137254901961, - 0.14901960784313725, - 0.2, - 0.22745098039215686, - 0.15294117647058825, - 0.16470588235294115, - 0.12549019607843137, - 0.08235294117647057, - 0.07058823529411765, - 0.07058823529411765, - 0.07450980392156863, - 0.06274509803921569, - 0.07450980392156863, - 0.0784313725490196, - 0.06274509803921569, - 0.0784313725490196, - 0.08627450980392157, - 0.07058823529411765, - 0.050980392156862744, - 0.07058823529411765, - 0.0784313725490196, - 0.07450980392156863, - 0.07450980392156863 + 0.14901960784313725, + 0.07058823529411765, + 0.06274509803921569, + 0.07058823529411765, + 0.07058823529411765, + 0.09411764705882353, + 0.06274509803921569, + 0.08235294117647057, + 0.10980392156862745, + 0.06666666666666667, + 0.08235294117647057, + 0.07058823529411765, + 0.06274509803921569, + 0.0588235294117647, + 0.06666666666666667, + 0.10196078431372549, + 0.047058823529411764, + 0.06666666666666667, + 0.09019607843137255, + 0.06666666666666667, + 0.0784313725490196, + 0.07058823529411765, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.06666666666666667, + 0.08235294117647057, + 0.06274509803921569, + 0.06666666666666667, + 0.08235294117647057, + 0.5490196078431373, + 0.5450980392156862, + 0.596078431372549, + 0.592156862745098, + 0.6862745098039216, + 0.7686274509803923, + 0.7372549019607844, + 0.7725490196078433, + 0.7490196078431373, + 0.592156862745098, + 0.5843137254901961, + 0.6196078431372549, + 0.5529411764705883, + 0.5647058823529412, + 0.3921568627450981, + 0.39607843137254906, + 0.2901960784313726, + 0.27058823529411763, + 0.3294117647058823, + 0.5529411764705883, + 0.5529411764705883, + 0.592156862745098, + 0.4980392156862745, + 0.40784313725490196, + 0.4549019607843137, + 0.40784313725490196, + 0.38431372549019616, + 0.3568627450980392, + 0.3294117647058823, + 0.403921568627451, + 0.5058823529411764, + 0.5137254901960784, + 0.5137254901960784, + 0.4196078431372549, + 0.35294117647058826, + 0.27450980392156865, + 0.2823529411764706, + 0.17254901960784313, + 0.16078431372549018, + 0.14901960784313725, + 0.20784313725490197, + 0.21568627450980393, + 0.1450980392156863, + 0.1568627450980392, + 0.16470588235294115, + 0.13725490196078433, + 0.21176470588235294, + 0.1450980392156863, + 0.1411764705882353, + 0.10196078431372549, + 0.16078431372549018, + 0.1843137254901961, + 0.14901960784313725, + 0.2, + 0.22745098039215686, + 0.15294117647058825, + 0.16470588235294115, + 0.12549019607843137, + 0.08235294117647057, + 0.07058823529411765, + 0.07058823529411765, + 0.07450980392156863, + 0.06274509803921569, + 0.07450980392156863, + 0.0784313725490196, + 0.06274509803921569, + 0.0784313725490196, + 0.08627450980392157, + 0.07058823529411765, + 0.050980392156862744, + 0.07058823529411765, + 0.0784313725490196, + 0.07450980392156863, + 0.07450980392156863 ], [ - 0.047058823529411764, - 0.0784313725490196, - 0.1411764705882353, - 0.0784313725490196, - 0.10588235294117647, - 0.0588235294117647, - 0.0784313725490196, - 0.07450980392156863, - 0.07058823529411765, - 0.06666666666666667, - 0.10980392156862745, - 0.06666666666666667, - 0.0588235294117647, - 0.10588235294117647, - 0.07058823529411765, - 0.050980392156862744, - 0.07450980392156863, - 0.08235294117647057, - 0.06274509803921569, - 0.07450980392156863, - 0.07058823529411765, - 0.07450980392156863, - 0.06666666666666667, - 0.06666666666666667, - 0.06274509803921569, - 0.06666666666666667, - 0.06666666666666667, - 0.0588235294117647, - 0.06666666666666667, - 0.06274509803921569, - 0.0588235294117647, - 0.0784313725490196, - 0.2, - 0.5372549019607843, - 0.5725490196078431, - 0.5019607843137255, - 0.5333333333333333, - 0.6588235294117646, - 0.6980392156862745, - 0.7215686274509804, - 0.7058823529411765, - 0.6745098039215687, - 0.5333333333333333, - 0.5254901960784314, - 0.5058823529411764, - 0.47450980392156855, - 0.3921568627450981, - 0.4117647058823529, - 0.3686274509803922, - 0.3058823529411765, - 0.2901960784313726, - 0.3254901960784313, - 0.42745098039215684, - 0.4588235294117647, - 0.4705882352941176, - 0.46274509803921565, - 0.47843137254901963, - 0.3921568627450981, - 0.4235294117647059, - 0.3294117647058823, - 0.3411764705882353, - 0.3803921568627451, - 0.5529411764705883, - 0.5725490196078431, - 0.5058823529411764, - 0.4588235294117647, - 0.4588235294117647, - 0.35294117647058826, - 0.2627450980392157, - 0.27058823529411763, - 0.20392156862745098, - 0.12156862745098039, - 0.1176470588235294, - 0.1450980392156863, - 0.1450980392156863, - 0.12156862745098039, - 0.12941176470588237, - 0.16470588235294115, - 0.15294117647058825, - 0.10588235294117647, - 0.12156862745098039, - 0.1176470588235294, - 0.12156862745098039, - 0.12549019607843137, - 0.10980392156862745, - 0.11372549019607843, - 0.24705882352941178, - 0.2235294117647059, - 0.20392156862745098, - 0.1568627450980392, - 0.12941176470588237, - 0.07450980392156863, - 0.07450980392156863, - 0.07450980392156863, - 0.0784313725490196, - 0.0588235294117647, - 0.08235294117647057, - 0.06274509803921569, - 0.10588235294117647, - 0.06666666666666667, - 0.054901960784313725, - 0.07058823529411765, - 0.0588235294117647, - 0.08627450980392157, - 0.07058823529411765, - 0.10980392156862745, - 0.09411764705882353 + 0.047058823529411764, + 0.0784313725490196, + 0.1411764705882353, + 0.0784313725490196, + 0.10588235294117647, + 0.0588235294117647, + 0.0784313725490196, + 0.07450980392156863, + 0.07058823529411765, + 0.06666666666666667, + 0.10980392156862745, + 0.06666666666666667, + 0.0588235294117647, + 0.10588235294117647, + 0.07058823529411765, + 0.050980392156862744, + 0.07450980392156863, + 0.08235294117647057, + 0.06274509803921569, + 0.07450980392156863, + 0.07058823529411765, + 0.07450980392156863, + 0.06666666666666667, + 0.06666666666666667, + 0.06274509803921569, + 0.06666666666666667, + 0.06666666666666667, + 0.0588235294117647, + 0.06666666666666667, + 0.06274509803921569, + 0.0588235294117647, + 0.0784313725490196, + 0.2, + 0.5372549019607843, + 0.5725490196078431, + 0.5019607843137255, + 0.5333333333333333, + 0.6588235294117646, + 0.6980392156862745, + 0.7215686274509804, + 0.7058823529411765, + 0.6745098039215687, + 0.5333333333333333, + 0.5254901960784314, + 0.5058823529411764, + 0.47450980392156855, + 0.3921568627450981, + 0.4117647058823529, + 0.3686274509803922, + 0.3058823529411765, + 0.2901960784313726, + 0.3254901960784313, + 0.42745098039215684, + 0.4588235294117647, + 0.4705882352941176, + 0.46274509803921565, + 0.47843137254901963, + 0.3921568627450981, + 0.4235294117647059, + 0.3294117647058823, + 0.3411764705882353, + 0.3803921568627451, + 0.5529411764705883, + 0.5725490196078431, + 0.5058823529411764, + 0.4588235294117647, + 0.4588235294117647, + 0.35294117647058826, + 0.2627450980392157, + 0.27058823529411763, + 0.20392156862745098, + 0.12156862745098039, + 0.1176470588235294, + 0.1450980392156863, + 0.1450980392156863, + 0.12156862745098039, + 0.12941176470588237, + 0.16470588235294115, + 0.15294117647058825, + 0.10588235294117647, + 0.12156862745098039, + 0.1176470588235294, + 0.12156862745098039, + 0.12549019607843137, + 0.10980392156862745, + 0.11372549019607843, + 0.24705882352941178, + 0.2235294117647059, + 0.20392156862745098, + 0.1568627450980392, + 0.12941176470588237, + 0.07450980392156863, + 0.07450980392156863, + 0.07450980392156863, + 0.0784313725490196, + 0.0588235294117647, + 0.08235294117647057, + 0.06274509803921569, + 0.10588235294117647, + 0.06666666666666667, + 0.054901960784313725, + 0.07058823529411765, + 0.0588235294117647, + 0.08627450980392157, + 0.07058823529411765, + 0.10980392156862745, + 0.09411764705882353 ] ] -module.exports = content; \ No newline at end of file +module.exports = content diff --git a/miniprogram/packageXRFrame/components/xr-particle-custom/index.js b/miniprogram/packageXRFrame/components/xr-particle-custom/index.js index fb836e60..b37cd303 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-custom/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-custom/index.js @@ -11,7 +11,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -21,45 +21,48 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() - const particle = xrScene.getElementById("human-face"); - // // 来自图片数据的二元数组content - var content = cont - // // 影响画作的大小与粒子疏密程度的因子 - var step = 0.02 - var height = Math.floor(step * content.length) - //设置箱型发射器的发射方向,与粒子初始位置范围 - particle.getComponent(xrFrameSystem.Particle).createBoxEmitter(xrFrameSystem.Vector3.createFromNumber(1.0, 0.0, 0), xrFrameSystem.Vector3.createFromNumber(1.0, 0.0, 0), - xrFrameSystem.Vector3.createFromNumber(0, 0, 0.5), xrFrameSystem.Vector3.createFromNumber(0, height, 0.0)); - //实现发射器的自定义粒子运作接口 - particle.getComponent(xrFrameSystem.Particle).particleEmitter.processInstance = (instance, deltaTime)=> { - var contentTemp = content - var cellNumY = contentTemp.length - var cellNumX = contentTemp[0].length - var width = Math.floor(step * cellNumX) - if(instance.position.x - instance.particleSystem.emitterPosition.x> width){ - instance.age = instance.lifeTime; - return; - } - instance.age = 0; - const posX = Math.floor((instance.position.x - instance.particleSystem.emitterPosition.x)/ step); - const posY = Math.floor(instance.position.y/ step); - const speed = contentTemp[cellNumY-1-posY][posX] * 0.97; - instance.position.x += ( 1 - speed * 0.97 ) * 0.03 + Math.random() * 0.007; - instance.color.w = speed * 0.3; - }; + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() + const particle = xrScene.getElementById('human-face') + // // 来自图片数据的二元数组content + const content = cont + // // 影响画作的大小与粒子疏密程度的因子 + const step = 0.02 + const height = Math.floor(step * content.length) + // 设置箱型发射器的发射方向,与粒子初始位置范围 + particle.getComponent(xrFrameSystem.Particle).createBoxEmitter( + xrFrameSystem.Vector3.createFromNumber(1.0, 0.0, 0), + xrFrameSystem.Vector3.createFromNumber(1.0, 0.0, 0), + xrFrameSystem.Vector3.createFromNumber(0, 0, 0.5), + xrFrameSystem.Vector3.createFromNumber(0, height, 0.0) + ) + // 实现发射器的自定义粒子运作接口 + particle.getComponent(xrFrameSystem.Particle).particleEmitter.processInstance = (instance, deltaTime) => { + const contentTemp = content + const cellNumY = contentTemp.length + const cellNumX = contentTemp[0].length + const width = Math.floor(step * cellNumX) + if (instance.position.x - instance.particleSystem.emitterPosition.x > width) { + instance.age = instance.lifeTime + return + } + instance.age = 0 + const posX = Math.floor((instance.position.x - instance.particleSystem.emitterPosition.x) / step) + const posY = Math.floor(instance.position.y / step) + const speed = contentTemp[cellNumY - 1 - posY][posX] * 0.97 + instance.position.x += (1 - speed * 0.97) * 0.03 + Math.random() * 0.007 + instance.color.w = speed * 0.3 + } }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-particle-firework/index.js b/miniprogram/packageXRFrame/components/xr-particle-firework/index.js index 1eea4cf6..a309930c 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-firework/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-firework/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,48 +19,47 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) const xrFrameSystem = wx.getXrFrameSystem() - const fireworkField = xrScene.getElementById("firework"); + const fireworkField = xrScene.getElementById('firework') const tempSystem = fireworkField.getComponent(xrFrameSystem.Particle) - tempSystem.addSizeGradient(0,0.2); - tempSystem.addSizeGradient(3,0.5); + tempSystem.addSizeGradient(0, 0.2) + tempSystem.addSizeGradient(3, 0.5) - var myData ={} + let myData = {} myData = { - "capacity": 200, - "emitRate": 0, //子发射器不进行每秒发射 - "burstCount": 200, // 一次爆发200粒子 - "burstTime": 0, // 爆发延时为0 - "burstCycle": 1, // 发射一次 - "size":[0.05], - "startColor":[1,1,0,1], - "endColor":[1,0,0,0], - "emitterType":"SphereShape", - "emitterProps": [["radius","0.8"]], - "lifeTime":[3], // 粒子生命周期为3秒 - "stopDuration":[3], // 子发射器生命周期为3秒 - "speed":[1], - "texture":"particle-texture" + capacity: 200, + emitRate: 0, // 子发射器不进行每秒发射 + burstCount: 200, // 一次爆发200粒子 + burstTime: 0, // 爆发延时为0 + burstCycle: 1, // 发射一次 + size: [0.05], + startColor: [1, 1, 0, 1], + endColor: [1, 0, 0, 0], + emitterType: 'SphereShape', + emitterProps: [['radius', '0.8']], + lifeTime: [3], // 粒子生命周期为3秒 + stopDuration: [3], // 子发射器生命周期为3秒 + speed: [1], + texture: 'particle-texture' } - var subEmitter = tempSystem.createSubEmitter(myData) + const subEmitter = tempSystem.createSubEmitter(myData) subEmitter.state = 1 // 设置为1为当粒子消失后出现作用子发射器 - //可以规定多个子发射器的阵列 + // 可以规定多个子发射器的阵列 tempSystem.subEmitters = [subEmitter] }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/index.js b/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/index.js index 6b44517f..0a437ad4 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/index.js @@ -1,4 +1,3 @@ - Component({ behaviors: [require('../common/share-behavior').default], properties: { @@ -10,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -20,28 +19,27 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() - const magicField = xrScene.getElementById("magicField"); - const tempSystem = magicField.getComponent(xrFrameSystem.Particle) - tempSystem.addSizeGradient(0,0.7); - tempSystem.addSizeGradient(0.5,1.0); - tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1,0.89,0.27,1)); - tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1,0.64,0,1)); - tempSystem.addAlphaGradient(0,0,0); - tempSystem.addAlphaGradient(0.5,1,1); - tempSystem.addAlphaGradient(1,0,0); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() + const magicField = xrScene.getElementById('magicField') + const tempSystem = magicField.getComponent(xrFrameSystem.Particle) + tempSystem.addSizeGradient(0, 0.7) + tempSystem.addSizeGradient(0.5, 1.0) + tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 0.89, 0.27, 1)) + tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.64, 0, 1)) + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/specialCylinder.js b/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/specialCylinder.js index 5e2bea20..85f49d05 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/specialCylinder.js +++ b/miniprogram/packageXRFrame/components/xr-particle-meshEmitter/specialCylinder.js @@ -1,56 +1,51 @@ -const vBufferSpecialCylinder = new Float32Array([-5.678913339579594e-9,-0.10497161746025085,-1,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,-1,0.08775380253791809,0.44548821449279785,-0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.19509032368659973,-0.10497161746025085,-0.9807852506637573,0.08775380253791809,0.44548821449279785,-0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.19509032368659973,-0.10497161746025085,-0.9807852506637573,0.25988829135894775,0.44548869132995605,-0.8567367792129517,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.3826834261417389,-0.10497161746025085,-0.9238795042037964,0.25988829135894775,0.44548869132995605,-0.8567367792129517,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.3826834261417389,-0.10497161746025085,-0.9238795042037964,0.42203545570373535,0.44548848271369934,-0.7895733714103699,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.5555702447891235,-0.10497161746025085,-0.8314695954322815,0.42203545570373535,0.44548848271369934,-0.7895733714103699,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.5555702447891235,-0.10497161746025085,-0.8314695954322815,0.5679646134376526,0.44548842310905457,-0.6920666098594666,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.7071067690849304,-0.10497161746025085,-0.7071067690849304,0.5679646134376526,0.44548842310905457,-0.6920666098594666,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.7071067690849304,-0.10497161746025085,-0.7071067690849304,0.6920667886734009,0.4454883933067322,-0.5679644346237183,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.8314695954322815,-0.10497161746025085,-0.5555702447891235,0.6920667886734009,0.4454883933067322,-0.5679644346237183,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.8314695954322815,-0.10497161746025085,-0.5555702447891235,0.7895731925964355,0.4454883635044098,-0.42203593254089355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9238795042037964,-0.10497161746025085,-0.3826834261417389,0.7895731925964355,0.4454883635044098,-0.42203593254089355,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9238795042037964,-0.10497161746025085,-0.3826834261417389,0.856736958026886,0.4454883933067322,-0.2598881423473358,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,-0.19509030878543854,0.856736958026886,0.4454883933067322,-0.2598881423473358,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9807852506637573,-0.10497161746025085,-0.19509030878543854,0.8909766674041748,0.4454883337020874,-0.0877537727355957,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,1,-0.10497161746025085,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,-0.0877537727355957,1.0009496212005615,0.0009514093399047852,0,0,0,0,1,-0.10497161746025085,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,0.0877537727355957,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,0.19509033858776093,0.856736958026886,0.44548842310905457,0.2598881423473358,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,0.19509033858776093,0.8909766674041748,0.4454883337020874,0.0877537727355957,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9238795042037964,-0.10497161746025085,0.38268348574638367,0.7895732522010803,0.44548821449279785,0.4220360517501831,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9238795042037964,-0.10497161746025085,0.38268348574638367,0.856736958026886,0.44548842310905457,0.2598881423473358,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.8314695954322815,-0.10497161746025085,0.5555702447891235,0.6920667886734009,0.4454882740974426,0.5679645538330078,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.8314695954322815,-0.10497161746025085,0.5555702447891235,0.7895732522010803,0.44548821449279785,0.4220360517501831,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.7071067690849304,-0.10497161746025085,0.7071067690849304,0.5679647326469421,0.4454883635044098,0.6920666694641113,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.7071067690849304,-0.10497161746025085,0.7071067690849304,0.6920667886734009,0.4454882740974426,0.5679645538330078,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.5555702447891235,-0.10497161746025085,0.8314695954322815,0.4220355749130249,0.4454882740974426,0.7895734310150146,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.5555702447891235,-0.10497161746025085,0.8314695954322815,0.5679647326469421,0.4454883635044098,0.6920666694641113,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.3826834261417389,-0.10497161746025085,0.9238795042037964,0.25988829135894775,0.44548851251602173,0.8567368388175964,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.3826834261417389,-0.10497161746025085,0.9238795042037964,0.4220355749130249,0.4454882740974426,0.7895734310150146,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.19509032368659973,-0.10497161746025085,0.9807852506637573,0.08775380253791809,0.44548818469047546,0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.19509032368659973,-0.10497161746025085,0.9807852506637573,0.25988829135894775,0.44548851251602173,0.8567368388175964,1.0009496212005615,0.0009514093399047852,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,1,-0.08775380253791809,0.44548821449279785,0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,1,0.08775380253791809,0.44548818469047546,0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.19509032368659973,-0.10497161746025085,0.9807852506637573,-0.25988826155662537,0.445488303899765,0.8567370772361755,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.19509032368659973,-0.10497161746025085,0.9807852506637573,-0.08775380253791809,0.44548821449279785,0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.38268348574638367,-0.10497161746025085,0.9238795042037964,-0.4220356345176697,0.44548842310905457,0.7895733118057251,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.38268348574638367,-0.10497161746025085,0.9238795042037964,-0.25988826155662537,0.445488303899765,0.8567370772361755,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.5555702447891235,-0.10497161746025085,0.8314695954322815,-0.5679647326469421,0.4454881548881531,0.6920667290687561,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.5555702447891235,-0.10497161746025085,0.8314695954322815,-0.4220356345176697,0.44548842310905457,0.7895733118057251,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.7071067690849304,-0.10497161746025085,0.7071067690849304,-0.6920667290687561,0.44548842310905457,0.567964494228363,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.7071067690849304,-0.10497161746025085,0.7071067690849304,-0.5679647326469421,0.4454881548881531,0.6920667290687561,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.8314695954322815,-0.10497161746025085,0.5555702447891235,-0.7895732522010803,0.44548821449279785,0.4220360517501831,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.8314695954322815,-0.10497161746025085,0.5555702447891235,-0.6920667290687561,0.44548842310905457,0.567964494228363,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9238795042037964,-0.10497161746025085,0.38268348574638367,-0.856736958026886,0.4454883933067322,0.2598881125450134,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9238795042037964,-0.10497161746025085,0.38268348574638367,-0.7895732522010803,0.44548821449279785,0.4220360517501831,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,0.19509033858776093,-0.8909767866134644,0.44548824429512024,0.08775343745946884,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9807852506637573,-0.10497161746025085,0.19509033858776093,-0.856736958026886,0.4454883933067322,0.2598881125450134,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9999999403953552,-0.10497161746025085,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9999999403953552,-0.10497161746025085,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,0.08775343745946884,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,-0.19509030878543854,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,-0.19509030878543854,-0.856736958026886,0.4454883933067322,-0.2598881721496582,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9238795042037964,-0.10497161746025085,-0.3826834261417389,-0.856736958026886,0.4454883933067322,-0.2598881721496582,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9238795042037964,-0.10497161746025085,-0.3826834261417389,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.8314695954322815,-0.10497161746025085,-0.5555702447891235,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.8314695954322815,-0.10497161746025085,-0.5555702447891235,-0.6920668482780457,0.44548824429512024,-0.567964494228363,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.7071067690849304,-0.10497161746025085,-0.7071067690849304,-0.6920668482780457,0.44548824429512024,-0.567964494228363,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.7071067690849304,-0.10497161746025085,-0.7071067690849304,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.5555702447891235,-0.10497161746025085,-0.8314695954322815,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.5555702447891235,-0.10497161746025085,-0.8314695954322815,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.38268348574638367,-0.10497161746025085,-0.9238795042037964,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.38268348574638367,-0.10497161746025085,-0.9238795042037964,-0.259888231754303,0.4454883933067322,-0.856736958026886,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.19509032368659973,-0.10497161746025085,-0.9807852506637573,-0.259888231754303,0.4454883933067322,-0.856736958026886,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.19509032368659973,-0.10497161746025085,-0.9807852506637573,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,-0.8950279951095581,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,-0.8950279951095581,0.08775380253791809,0.44548821449279785,-0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.17461130023002625,0.10497245192527771,-0.8778302073478699,0.08775380253791809,0.44548821449279785,-0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,0.17461130023002625,0.10497245192527771,-0.8778302073478699,0.25988829135894775,0.44548869132995605,-0.8567367792129517,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.3425123393535614,0.10497245192527771,-0.8268979787826538,0.25988829135894775,0.44548869132995605,-0.8567367792129517,0.9990485906600952,1.0009496212005615,0,0,0,0,0.3425123393535614,0.10497245192527771,-0.8268979787826538,0.42203545570373535,0.44548848271369934,-0.7895733714103699,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.49725088477134705,0.10497245192527771,-0.7441885471343994,0.42203545570373535,0.44548848271369934,-0.7895733714103699,0.9990485906600952,1.0009496212005615,0,0,0,0,0.49725088477134705,0.10497245192527771,-0.7441885471343994,0.5679646134376526,0.44548842310905457,-0.6920666098594666,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.6328803300857544,0.10497245192527771,-0.6328803300857544,0.5679646134376526,0.44548842310905457,-0.6920666098594666,0.9990485906600952,1.0009496212005615,0,0,0,0,0.6328803300857544,0.10497245192527771,-0.6328803300857544,0.6920667886734009,0.4454883933067322,-0.5679644346237183,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.7441885471343994,0.10497245192527771,-0.49725088477134705,0.6920667886734009,0.4454883933067322,-0.5679644346237183,0.9990485906600952,1.0009496212005615,0,0,0,0,0.7441885471343994,0.10497245192527771,-0.49725088477134705,0.7895731925964355,0.4454883635044098,-0.42203593254089355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8268979787826538,0.10497245192527771,-0.3425123393535614,0.7895731925964355,0.4454883635044098,-0.42203593254089355,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8268979787826538,0.10497245192527771,-0.3425123393535614,0.856736958026886,0.4454883933067322,-0.2598881423473358,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,-0.17461128532886505,0.856736958026886,0.4454883933067322,-0.2598881423473358,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8778302073478699,0.10497245192527771,-0.17461128532886505,0.8909766674041748,0.4454883337020874,-0.0877537727355957,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8950279951095581,0.10497245192527771,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,-0.0877537727355957,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8950279951095581,0.10497245192527771,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,0.0877537727355957,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,0.17461131513118744,0.856736958026886,0.44548842310905457,0.2598881423473358,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,0.17461131513118744,0.8909766674041748,0.4454883337020874,0.0877537727355957,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8268979787826538,0.10497245192527771,0.3425123989582062,0.7895732522010803,0.44548821449279785,0.4220360517501831,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8268979787826538,0.10497245192527771,0.3425123989582062,0.856736958026886,0.44548842310905457,0.2598881423473358,0.9990485906600952,1.0009496212005615,0,0,0,0,0.7441885471343994,0.10497245192527771,0.4972509443759918,0.6920667886734009,0.4454882740974426,0.5679645538330078,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.7441885471343994,0.10497245192527771,0.4972509443759918,0.7895732522010803,0.44548821449279785,0.4220360517501831,0.9990485906600952,1.0009496212005615,0,0,0,0,0.6328803300857544,0.10497245192527771,0.6328803300857544,0.5679647326469421,0.4454883635044098,0.6920666694641113,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.6328803300857544,0.10497245192527771,0.6328803300857544,0.6920667886734009,0.4454882740974426,0.5679645538330078,0.9990485906600952,1.0009496212005615,0,0,0,0,0.49725088477134705,0.10497245192527771,0.7441885471343994,0.4220355749130249,0.4454882740974426,0.7895734310150146,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.49725088477134705,0.10497245192527771,0.7441885471343994,0.5679647326469421,0.4454883635044098,0.6920666694641113,0.9990485906600952,1.0009496212005615,0,0,0,0,0.3425123393535614,0.10497245192527771,0.8268979787826538,0.25988829135894775,0.44548851251602173,0.8567368388175964,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.3425123393535614,0.10497245192527771,0.8268979787826538,0.4220355749130249,0.4454882740974426,0.7895734310150146,0.9990485906600952,1.0009496212005615,0,0,0,0,0.17461130023002625,0.10497245192527771,0.8778302073478699,0.08775380253791809,0.44548818469047546,0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.17461130023002625,0.10497245192527771,0.8778302073478699,0.25988829135894775,0.44548851251602173,0.8567368388175964,0.9990485906600952,1.0009496212005615,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,0.8950279951095581,-0.08775380253791809,0.44548821449279785,0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,0.8950279951095581,0.08775380253791809,0.44548818469047546,0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.17461130023002625,0.10497245192527771,0.8778302073478699,-0.25988826155662537,0.445488303899765,0.8567370772361755,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.17461130023002625,0.10497245192527771,0.8778302073478699,-0.08775380253791809,0.44548821449279785,0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.3425123989582062,0.10497245192527771,0.8268979787826538,-0.4220356345176697,0.44548842310905457,0.7895733118057251,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.3425123989582062,0.10497245192527771,0.8268979787826538,-0.25988826155662537,0.445488303899765,0.8567370772361755,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.4972509443759918,0.10497245192527771,0.7441885471343994,-0.5679647326469421,0.4454881548881531,0.6920667290687561,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.4972509443759918,0.10497245192527771,0.7441885471343994,-0.4220356345176697,0.44548842310905457,0.7895733118057251,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.6328803300857544,0.10497245192527771,0.6328803300857544,-0.6920667290687561,0.44548842310905457,0.567964494228363,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.6328803300857544,0.10497245192527771,0.6328803300857544,-0.5679647326469421,0.4454881548881531,0.6920667290687561,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.7441885471343994,0.10497245192527771,0.4972509443759918,-0.7895732522010803,0.44548821449279785,0.4220360517501831,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.7441885471343994,0.10497245192527771,0.4972509443759918,-0.6920667290687561,0.44548842310905457,0.567964494228363,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8268979787826538,0.10497245192527771,0.3425123989582062,-0.856736958026886,0.4454883933067322,0.2598881125450134,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8268979787826538,0.10497245192527771,0.3425123989582062,-0.7895732522010803,0.44548821449279785,0.4220360517501831,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,0.17461131513118744,-0.8909767866134644,0.44548824429512024,0.08775343745946884,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8778302073478699,0.10497245192527771,0.17461131513118744,-0.856736958026886,0.4454883933067322,0.2598881125450134,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8950279951095581,0.10497245192527771,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8950279951095581,0.10497245192527771,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,0.08775343745946884,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,-0.17461128532886505,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,-0.17461128532886505,-0.856736958026886,0.4454883933067322,-0.2598881721496582,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8268979787826538,0.10497245192527771,-0.3425123393535614,-0.856736958026886,0.4454883933067322,-0.2598881721496582,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8268979787826538,0.10497245192527771,-0.3425123393535614,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.7441885471343994,0.10497245192527771,-0.49725088477134705,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.7441885471343994,0.10497245192527771,-0.49725088477134705,-0.6920668482780457,0.44548824429512024,-0.567964494228363,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.6328803300857544,0.10497245192527771,-0.6328803300857544,-0.6920668482780457,0.44548824429512024,-0.567964494228363,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.6328803300857544,0.10497245192527771,-0.6328803300857544,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.4972509443759918,0.10497245192527771,-0.7441885471343994,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.4972509443759918,0.10497245192527771,-0.7441885471343994,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.3425123989582062,0.10497245192527771,-0.8268979787826538,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.3425123989582062,0.10497245192527771,-0.8268979787826538,-0.259888231754303,0.4454883933067322,-0.856736958026886,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.17461130023002625,0.10497245192527771,-0.8778302073478699,-0.259888231754303,0.4454883933067322,-0.856736958026886,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.17461130023002625,0.10497245192527771,-0.8778302073478699,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0]); -const iBufferSpecialCylinder = new Uint16Array([63,127,64,63,64,0,61,125,126,61,126,62,59,123,124,59,124,60,57,121,122,57,122,58,55,119,120,55,120,56,53,117,118,53,118,54,51,115,116,51,116,52,48,112,114,48,114,50,46,110,113,46,113,49,44,108,111,44,111,47,42,106,109,42,109,45,40,104,107,40,107,43,38,102,105,38,105,41,36,100,103,36,103,39,34,98,101,34,101,37,32,96,99,32,99,35,30,94,97,30,97,33,28,92,95,28,95,31,26,90,93,26,93,29,24,88,91,24,91,27,22,86,89,22,89,25,20,84,87,20,87,23,18,82,85,18,85,21,17,81,83,17,83,19,15,79,80,15,80,16,13,77,78,13,78,14,11,75,76,11,76,12,9,73,74,9,74,10,7,71,72,7,72,8,5,69,70,5,70,6,3,67,68,3,68,4,1,65,66,1,66,2]); +const vBufferSpecialCylinder = new Float32Array([-5.678913339579594e-9, -0.10497161746025085, -1, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, -1, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, -0.9807852506637573, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, -0.9807852506637573, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, -0.9238795042037964, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, -0.9238795042037964, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, -0.8314695954322815, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, -0.8314695954322815, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, -0.7071067690849304, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, -0.7071067690849304, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, -0.5555702447891235, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, -0.5555702447891235, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, -0.3826834261417389, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, -0.3826834261417389, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, -0.19509030878543854, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, -0.19509030878543854, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 1, -0.10497161746025085, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 1, -0.10497161746025085, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, 0.19509033858776093, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, 0.19509033858776093, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, 0.38268348574638367, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, 0.38268348574638367, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, 0.5555702447891235, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, 0.5555702447891235, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, 0.7071067690849304, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, 0.7071067690849304, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, 0.8314695954322815, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, 0.8314695954322815, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, 0.9238795042037964, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, 0.9238795042037964, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, 0.9807852506637573, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, 0.9807852506637573, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, 1, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, 1, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, 0.9807852506637573, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, 0.9807852506637573, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, 0.9238795042037964, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, 0.9238795042037964, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, 0.8314695954322815, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, 0.8314695954322815, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, 0.7071067690849304, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, 0.7071067690849304, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, 0.5555702447891235, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, 0.5555702447891235, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, 0.38268348574638367, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, 0.38268348574638367, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, 0.19509033858776093, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, 0.19509033858776093, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9999999403953552, -0.10497161746025085, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9999999403953552, -0.10497161746025085, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, -0.19509030878543854, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, -0.19509030878543854, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, -0.3826834261417389, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, -0.3826834261417389, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, -0.5555702447891235, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, -0.5555702447891235, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, -0.7071067690849304, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, -0.7071067690849304, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, -0.8314695954322815, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, -0.8314695954322815, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, -0.9238795042037964, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, -0.9238795042037964, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, -0.9807852506637573, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, -0.9807852506637573, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, -0.8950279951095581, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, -0.8950279951095581, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, -0.8778302073478699, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, -0.8778302073478699, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, -0.8268979787826538, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, -0.8268979787826538, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, -0.7441885471343994, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, -0.7441885471343994, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, -0.6328803300857544, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, -0.6328803300857544, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, -0.49725088477134705, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, -0.49725088477134705, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, -0.3425123393535614, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, -0.3425123393535614, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, -0.17461128532886505, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, -0.17461128532886505, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, 0.17461131513118744, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, 0.17461131513118744, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, 0.3425123989582062, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, 0.3425123989582062, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, 0.4972509443759918, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, 0.4972509443759918, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, 0.6328803300857544, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, 0.6328803300857544, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, 0.7441885471343994, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, 0.7441885471343994, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, 0.8268979787826538, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, 0.8268979787826538, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, 0.8778302073478699, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, 0.8778302073478699, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, 0.8950279951095581, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, 0.8950279951095581, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, 0.8778302073478699, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, 0.8778302073478699, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, 0.8268979787826538, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, 0.8268979787826538, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, 0.7441885471343994, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, 0.7441885471343994, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, 0.6328803300857544, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, 0.6328803300857544, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, 0.4972509443759918, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, 0.4972509443759918, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, 0.3425123989582062, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, 0.3425123989582062, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, 0.17461131513118744, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, 0.17461131513118744, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, -0.17461128532886505, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, -0.17461128532886505, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, -0.3425123393535614, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, -0.3425123393535614, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, -0.49725088477134705, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, -0.49725088477134705, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, -0.6328803300857544, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, -0.6328803300857544, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, -0.7441885471343994, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, -0.7441885471343994, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, -0.8268979787826538, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, -0.8268979787826538, -0.259888231754303, 0.4454883933067322, -0.856736958026886, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, -0.8778302073478699, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, -0.8778302073478699, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0]) +const iBufferSpecialCylinder = new Uint16Array([63, 127, 64, 63, 64, 0, 61, 125, 126, 61, 126, 62, 59, 123, 124, 59, 124, 60, 57, 121, 122, 57, 122, 58, 55, 119, 120, 55, 120, 56, 53, 117, 118, 53, 118, 54, 51, 115, 116, 51, 116, 52, 48, 112, 114, 48, 114, 50, 46, 110, 113, 46, 113, 49, 44, 108, 111, 44, 111, 47, 42, 106, 109, 42, 109, 45, 40, 104, 107, 40, 107, 43, 38, 102, 105, 38, 105, 41, 36, 100, 103, 36, 103, 39, 34, 98, 101, 34, 101, 37, 32, 96, 99, 32, 99, 35, 30, 94, 97, 30, 97, 33, 28, 92, 95, 28, 95, 31, 26, 90, 93, 26, 93, 29, 24, 88, 91, 24, 91, 27, 22, 86, 89, 22, 89, 25, 20, 84, 87, 20, 87, 23, 18, 82, 85, 18, 85, 21, 17, 81, 83, 17, 83, 19, 15, 79, 80, 15, 80, 16, 13, 77, 78, 13, 78, 14, 11, 75, 76, 11, 76, 12, 9, 73, 74, 9, 74, 10, 7, 71, 72, 7, 72, 8, 5, 69, 70, 5, 70, 6, 3, 67, 68, 3, 68, 4, 1, 65, 66, 1, 66, 2]) -const xrFrameSystem = wx.getXrFrameSystem(); -const boundCenter = xrFrameSystem.Vector3.createFromNumber(0, 0, 0); -const boundSize = xrFrameSystem.Vector3.createFromNumber(1, 1, 1); -const defaultSubMeshLength = iBufferSpecialCylinder.length; +const xrFrameSystem = wx.getXrFrameSystem() +const boundCenter = xrFrameSystem.Vector3.createFromNumber(0, 0, 0) +const boundSize = xrFrameSystem.Vector3.createFromNumber(1, 1, 1) +const defaultSubMeshLength = iBufferSpecialCylinder.length xrFrameSystem.registerGeometry('specialCylinder', scene => { - const geo = scene.createGeometry(getSpecialVertexLayout(scene), vBufferSpecialCylinder, iBufferSpecialCylinder); + const geo = scene.createGeometry(getSpecialVertexLayout(scene), vBufferSpecialCylinder, iBufferSpecialCylinder) - geo.setBoundBox(boundCenter, boundSize); - geo.addSubMesh(defaultSubMeshLength, 0, 0); + geo.setBoundBox(boundCenter, boundSize) + geo.addSubMesh(defaultSubMeshLength, 0, 0) - return geo; -}); + return geo +}) const defaultAttributes = [ { - name: "a_normal", + name: 'a_normal', format: 2, offset: 12, usage: 2 }, { - name: "a_position", + name: 'a_position', format: 2, offset: 0, usage: 1 }, { - name: "a_tangent", + name: 'a_tangent', format: 3, offset: 40, usage: 3 }, { - name: "a_texCoord", + name: 'a_texCoord', format: 1, offset: 24, usage: 4 } -]; -const defaultStride = 48; +] +const defaultStride = 48 -function getSpecialVertexLayout(scene){ +function getSpecialVertexLayout(scene) { return scene.createVertexLayout({ attributes: defaultAttributes, stride: defaultStride - }); + }) } - - - - - diff --git a/miniprogram/packageXRFrame/components/xr-particle-orb/index.js b/miniprogram/packageXRFrame/components/xr-particle-orb/index.js index a1e78bb6..1966eb4d 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-orb/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-orb/index.js @@ -1,65 +1,64 @@ Component({ - behaviors: [require('../common/share-behavior').default], - properties: { - capacity: { - type: Number, - value: 20 - }, - emitRate: { - type: Number, - value: 5 - }, - lifeTime: { - type: Number, - value: 3 - } + behaviors: [require('../common/share-behavior').default], + properties: { + capacity: { + type: Number, + value: 20 }, - data: { - loaded: false + emitRate: { + type: Number, + value: 5 }, - lifetimes: {}, - methods: { - handleReady({ - detail - }) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - const xrFrameSystem = wx.getXrFrameSystem() - - //orb vfx - const orb = xrScene.getElementById("orb"); - var tempSystem = orb.getComponent(xrFrameSystem.Particle); - tempSystem.addAlphaGradient(0, 0, 0); - tempSystem.addAlphaGradient(0.5, 1, 1); - tempSystem.addAlphaGradient(1, 0, 0); - tempSystem.addSizeGradient(0, 1, 1); - tempSystem.addSizeGradient(1, 0, 0); + lifeTime: { + type: Number, + value: 3 + } + }, + data: { + loaded: false + }, + lifetimes: {}, + methods: { + handleReady({ + detail + }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + const xrFrameSystem = wx.getXrFrameSystem() - //orbline vfx - const orbLine = xrScene.getElementById("orbLine"); - tempSystem = orbLine.getComponent(xrFrameSystem.Particle); - tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1)); - tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1)); - tempSystem.addAlphaGradient(0, 0, 0); - tempSystem.addAlphaGradient(0.5, 1, 1); - tempSystem.addAlphaGradient(1, 0, 0); - tempSystem.addSizeGradient(0, 1, 1); - tempSystem.addSizeGradient(1, 0, 0); - }, + // orb vfx + const orb = xrScene.getElementById('orb') + let tempSystem = orb.getComponent(xrFrameSystem.Particle) + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(1, 0, 0) - handleAssetsProgress: function ({ - detail - }) { - console.log('assets progress', detail.value); + // orbline vfx + const orbLine = xrScene.getElementById('orbLine') + tempSystem = orbLine.getComponent(xrFrameSystem.Particle) + tempSystem.addColorGradient(0, xrFrameSystem.Vector4.createFromNumber(1, 1, 0, 1)) + tempSystem.addColorGradient(1, xrFrameSystem.Vector4.createFromNumber(1, 0.68, 0, 1)) + tempSystem.addAlphaGradient(0, 0, 0) + tempSystem.addAlphaGradient(0.5, 1, 1) + tempSystem.addAlphaGradient(1, 0, 0) + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(1, 0, 0) + }, - }, - handleAssetsLoaded: function ({ - detail - }) { - console.log('assets loaded', detail.value); - this.setData({ - loaded: true - }); - } + handleAssetsProgress({ + detail + }) { + console.log('assets progress', detail.value) + }, + handleAssetsLoaded({ + detail + }) { + console.log('assets loaded', detail.value) + this.setData({ + loaded: true + }) } -}) \ No newline at end of file + } +}) diff --git a/miniprogram/packageXRFrame/components/xr-particle-portal/index.js b/miniprogram/packageXRFrame/components/xr-particle-portal/index.js index 974d4cd1..2b46efd8 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-portal/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-portal/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,27 +19,26 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) const xrFrameSystem = wx.getXrFrameSystem() - const portal = xrScene.getElementById("portal"); + const portal = xrScene.getElementById('portal') const tempSystem = portal.getComponent(xrFrameSystem.Particle) - tempSystem.addSizeGradient(0,1,1); - tempSystem.addSizeGradient(0.5,0.8,0.8); - tempSystem.addSizeGradient(0.75,0.5,0.5); - tempSystem.addSizeGradient(0.9,0.2,0.2); - tempSystem.addSizeGradient(1,0,0); + tempSystem.addSizeGradient(0, 1, 1) + tempSystem.addSizeGradient(0.5, 0.8, 0.8) + tempSystem.addSizeGradient(0.75, 0.5, 0.5) + tempSystem.addSizeGradient(0.9, 0.2, 0.2) + tempSystem.addSizeGradient(1, 0, 0) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-particle-shapeEmitter/index.js b/miniprogram/packageXRFrame/components/xr-particle-shapeEmitter/index.js index 343523b8..a2d767b2 100644 --- a/miniprogram/packageXRFrame/components/xr-particle-shapeEmitter/index.js +++ b/miniprogram/packageXRFrame/components/xr-particle-shapeEmitter/index.js @@ -9,7 +9,7 @@ Component({ type: Number, value: 5 }, - lifeTime:{ + lifeTime: { type: Number, value: 3 } @@ -19,17 +19,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { + handleReady({ detail }) { }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); - + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-physics-shoot/index.js b/miniprogram/packageXRFrame/components/xr-physics-shoot/index.js index 01ddfa84..f8f621bf 100644 --- a/miniprogram/packageXRFrame/components/xr-physics-shoot/index.js +++ b/miniprogram/packageXRFrame/components/xr-physics-shoot/index.js @@ -9,112 +9,113 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - this.cubeGeometry = this.scene.assets.getAsset("geometry", "cube"); - this.bricksRoot = this.scene.getElementById("bricksRoot"); - console.log('xr-scene', xrScene); - this.matMap = new Map(); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + this.cubeGeometry = this.scene.assets.getAsset('geometry', 'cube') + this.bricksRoot = this.scene.getElementById('bricksRoot') + console.log('xr-scene', xrScene) + this.matMap = new Map() }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARTrackerState({detail}) {console.log("ar state", detail.value.state); + handleARTrackerState({ detail }) { + console.log('ar state', detail.value.state) // 事件的值即为`ARTracker`实例 - const tracker = detail.value; + const tracker = detail.value // 获取当前状态和错误信息 - const {state, errorMessage} = tracker; + const { state, errorMessage } = tracker if (state === 2 && !this.inited) { - this.initBricks(); - this.inited = true; + this.initBricks() + this.inited = true } }, initBricks() { - const xr = wx.getXrFrameSystem(); - const logo = this.scene.assets.getAsset("raw", "logo"); - const logoView = new Uint8Array(logo); + const xr = wx.getXrFrameSystem() + const logo = this.scene.assets.getAsset('raw', 'logo') + const logoView = new Uint8Array(logo) if (logoView[0] !== 0x42 || logoView[1] !== 0x4D) { - console.error("Not a valid bmp file!"); - return; + console.error('Not a valid bmp file!') + return } - const dataOffset = logoView[10]; - const width = logoView[18]; - const height = logoView[22]; + const dataOffset = logoView[10] + const width = logoView[18] + const height = logoView[22] for (let i = 0; i < width; i++) { for (let j = 0; j < height; j++) { - const b = logoView[dataOffset + (j * width + i) * 4 + 0]; - const g = logoView[dataOffset + (j * width + i) * 4 + 1]; - const r = logoView[dataOffset + (j * width + i) * 4 + 2]; + const b = logoView[dataOffset + (j * width + i) * 4 + 0] + const g = logoView[dataOffset + (j * width + i) * 4 + 1] + const r = logoView[dataOffset + (j * width + i) * 4 + 2] if (r !== 0xff || g !== 0x0 || b !== 0x80) { // not transparent pixel - this.makeBrick((i - width * 0.5) * 0.11, (j - height * 0.5) * 0.11, r, g, b); + this.makeBrick((i - width * 0.5) * 0.11, (j - height * 0.5) * 0.11, r, g, b) } } } this.scene.event.add('touchstart', (e) => { - const touch0 = e.touches[0]; - this.shoot(((touch0.pageX / this.scene.frameWidth) * 2 - 1) * 1, ((1.0 - touch0.pageY / this.scene.frameHeight) * 2 - 1) * 1); - }); + const touch0 = e.touches[0] + this.shoot(((touch0.pageX / this.scene.frameWidth) * 2 - 1) * 1, ((1.0 - touch0.pageY / this.scene.frameHeight) * 2 - 1) * 1) + }) }, makeBrick(x, y, r, g, b) { - const xr = wx.getXrFrameSystem(); + const xr = wx.getXrFrameSystem() - let mat = this.matMap.get(r * 256 * 256 + g * 256 + b); + let mat = this.matMap.get(r * 256 * 256 + g * 256 + b) if (!mat) { - mat = new xr.Material(this.scene); - mat.initByEffect(this.scene.assets.getAsset("effect", "standard")); - mat.setVector("u_baseColorFactor", xr.Vector4.createFromNumber(r / 256, g / 256, b / 256, 1)); - this.matMap.set(r * 256 * 256 + g * 256 + b, mat); + mat = new xr.Material(this.scene) + mat.initByEffect(this.scene.assets.getAsset('effect', 'standard')) + mat.setVector('u_baseColorFactor', xr.Vector4.createFromNumber(r / 256, g / 256, b / 256, 1)) + this.matMap.set(r * 256 * 256 + g * 256 + b, mat) } const meshDesc = { geometry: this.cubeGeometry, material: mat - }; - const brickEl = this.scene.createElement(xr.XRNode); - this.bricksRoot.addChild(brickEl); - const brickMesh = brickEl.addComponent(xr.Mesh, meshDesc); - const transform = brickEl.getComponent("transform"); - transform.position.x = x; - transform.position.y = y; - transform.position.z = 0; - transform.scale.setValue(0.1, 0.1, 0.1); + } + const brickEl = this.scene.createElement(xr.XRNode) + this.bricksRoot.addChild(brickEl) + const brickMesh = brickEl.addComponent(xr.Mesh, meshDesc) + const transform = brickEl.getComponent('transform') + transform.position.x = x + transform.position.y = y + transform.position.z = 0 + transform.scale.setValue(0.1, 0.1, 0.1) + + const rigidbody = brickEl.addComponent(xr.Rigidbody, { useGravity: false }) + brickEl.addComponent(xr.CubeShape, { autoFit: true }) + brickEl.addComponent(xr.ShapeInteract, { collide: true, bounciness: 0 }) + rigidbody.sleep() - const rigidbody = brickEl.addComponent(xr.Rigidbody, { useGravity: false }); - brickEl.addComponent(xr.CubeShape, { autoFit: true }); - brickEl.addComponent(xr.ShapeInteract, { collide: true, bounciness: 0 }); - rigidbody.sleep(); - - return brickMesh; + return brickMesh }, shoot(x, y) { - const xr = wx.getXrFrameSystem(); + const xr = wx.getXrFrameSystem() - const camera = this.scene.getElementById("camera").getComponent("camera"); - const origin = this.scene.getElementById("camera").getComponent("transform"); + const camera = this.scene.getElementById('camera').getComponent('camera') + const origin = this.scene.getElementById('camera').getComponent('transform') const meshDesc = { - geometry: this.scene.assets.getAsset("geometry", "sphere") - }; - const bulletEl = this.scene.createElement(xr.XRNode); - this.bricksRoot.addChild(bulletEl); - const bulletMesh = bulletEl.addComponent(xr.Mesh, meshDesc); - const transform = bulletEl.getComponent("transform"); - transform.position.set(origin.position); - transform.scale.setValue(0.1, 0.1, 0.1); + geometry: this.scene.assets.getAsset('geometry', 'sphere') + } + const bulletEl = this.scene.createElement(xr.XRNode) + this.bricksRoot.addChild(bulletEl) + const bulletMesh = bulletEl.addComponent(xr.Mesh, meshDesc) + const transform = bulletEl.getComponent('transform') + transform.position.set(origin.position) + transform.scale.setValue(0.1, 0.1, 0.1) - const rigidbody = bulletEl.addComponent(xr.Rigidbody, { useGravity: false }); - bulletEl.addComponent(xr.SphereShape, { autoFit: true }); - bulletEl.addComponent(xr.ShapeInteract, { collide: true, bounciness: 0 }); - let ray = xr.Vector3.createFromNumber(0, 0, 0); - camera.convertClipPositionToWorld(xr.Vector3.createFromNumber(x, y, 0), ray); - ray = ray.sub(origin.position); - ray = ray.scale(10 / ray.length()); - rigidbody.addForce(ray, 1); + const rigidbody = bulletEl.addComponent(xr.Rigidbody, { useGravity: false }) + bulletEl.addComponent(xr.SphereShape, { autoFit: true }) + bulletEl.addComponent(xr.ShapeInteract, { collide: true, bounciness: 0 }) + let ray = xr.Vector3.createFromNumber(0, 0, 0) + camera.convertClipPositionToWorld(xr.Vector3.createFromNumber(x, y, 0), ray) + ray = ray.sub(origin.position) + ray = ray.scale(10 / ray.length()) + rigidbody.addForce(ray, 1) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-physics-throw/index.js b/miniprogram/packageXRFrame/components/xr-physics-throw/index.js index b34c57fc..e49c11ba 100644 --- a/miniprogram/packageXRFrame/components/xr-physics-throw/index.js +++ b/miniprogram/packageXRFrame/components/xr-physics-throw/index.js @@ -4,10 +4,10 @@ Component({ throwing: { type: Boolean, value: false, - observer: function(newVal, oldVal) { + observer(newVal, oldVal) { if (newVal !== oldVal) { - if (newVal) this.startThrowing(); - else this.endThrowing(); + if (newVal) this.startThrowing() + else this.endThrowing() } } } @@ -17,92 +17,92 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; + handleReady({ detail }) { + const xrScene = this.scene = detail.value - this.vQueueLength = 5; - this.vQueue = []; - this.vQueueHead = 0; + this.vQueueLength = 5 + this.vQueue = [] + this.vQueueHead = 0 }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) }, - handleARTrackerState({detail}) { + handleARTrackerState({ detail }) { // 事件的值即为`ARTracker`实例 - const tracker = detail.value; + const tracker = detail.value // 获取当前状态和错误信息 - const {state, errorMessage} = tracker; + const { state, errorMessage } = tracker if (state == 2) { - this.handleARDetected(); + this.handleARDetected() } }, handleARDetected() { - this.scene.event.addOnce('touchstart', this.placeTarget.bind(this)); + this.scene.event.addOnce('touchstart', this.placeTarget.bind(this)) }, placeTarget() { - this.scene.ar.placeHere("targetTransform"); + this.scene.ar.placeHere('targetTransform') this.setData({ showTarget: true - }); - this.triggerEvent("ar_detected"); + }) + this.triggerEvent('ar_detected') }, startThrowing() { - if (!this.data.showTarget) return; - this.makeBall(); + if (!this.data.showTarget) return + this.makeBall() }, endThrowing() { - this.releaseBall(); + this.releaseBall() }, makeBall() { - const xr = wx.getXrFrameSystem(); + const xr = wx.getXrFrameSystem() const el = this.scene.createElement(xr.XRMesh, { - geometry: "sphere", - scale: "0.1 0.1 0.1", - "sphere-shape": "autoFit: true", - rigidbody: "disabled: true", - "shape-interact": "collide: true; bounciness: 0.5;" - }); - const root = this.scene.getElementById("ballRoot"); - root.addChild(el); - this.placeBall(el.getComponent("transform")); - this.currentBall = el; + geometry: 'sphere', + scale: '0.1 0.1 0.1', + 'sphere-shape': 'autoFit: true', + rigidbody: 'disabled: true', + 'shape-interact': 'collide: true; bounciness: 0.5;' + }) + const root = this.scene.getElementById('ballRoot') + root.addChild(el) + this.placeBall(el.getComponent('transform')) + this.currentBall = el }, placeBall(transform) { - const camera = this.scene.getElementById("camera"); - const cam_trans = camera.getComponent("transform"); - transform.position.set(cam_trans.position.add(cam_trans.worldForward.scale(-1))); + const camera = this.scene.getElementById('camera') + const cam_trans = camera.getComponent('transform') + transform.position.set(cam_trans.position.add(cam_trans.worldForward.scale(-1))) }, - handleTick: function({detail}) { + handleTick({ detail }) { if (this.currentBall) { - this.placeBall(this.currentBall.getComponent("transform")); - this.recordPosition(detail); + this.placeBall(this.currentBall.getComponent('transform')) + this.recordPosition(detail) } }, releaseBall() { - if (!this.currentBall) return; - this.currentBall.getComponent("rigidbody").setData({ + if (!this.currentBall) return + this.currentBall.getComponent('rigidbody').setData({ disabled: false - }); - const r1 = this.vQueue[(this.vQueueHead - 1 + this.vQueueLength) % this.vQueueLength]; - const r2 = this.vQueue[this.vQueueHead]; + }) + const r1 = this.vQueue[(this.vQueueHead - 1 + this.vQueueLength) % this.vQueueLength] + const r2 = this.vQueue[this.vQueueHead] if (r1 && r2) { - const vscale = 1.3; // 初始速度调节 - const v = r1[0].sub(r2[0]).scale(vscale * 1000 / (r1[1] - r2[1])); - this.currentBall.getComponent("rigidbody").velocity = v; + const vscale = 1.3 // 初始速度调节 + const v = r1[0].sub(r2[0]).scale(vscale * 1000 / (r1[1] - r2[1])) + this.currentBall.getComponent('rigidbody').velocity = v } - this.currentBall = undefined; - this.vQueue = []; - this.vQueueHead = 0; + this.currentBall = undefined + this.vQueue = [] + this.vQueueHead = 0 }, recordPosition() { - const transform = this.currentBall.getComponent("transform"); - this.vQueue[this.vQueueHead] = [transform.position.clone(), Date.now()]; - this.vQueueHead = (this.vQueueHead + 1) % this.vQueueLength; + const transform = this.currentBall.getComponent('transform') + this.vQueue[this.vQueueHead] = [transform.position.clone(), Date.now()] + this.vQueueHead = (this.vQueueHead + 1) % this.vQueueLength } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-scan-render/index.js b/miniprogram/packageXRFrame/components/xr-scan-render/index.js index d77358c0..2ed953a8 100644 --- a/miniprogram/packageXRFrame/components/xr-scan-render/index.js +++ b/miniprogram/packageXRFrame/components/xr-scan-render/index.js @@ -11,16 +11,16 @@ Component({ }, lifetimes: {}, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) }, - handleAssetsProgress: function({detail}) { - console.log('assets progress', detail.value); + handleAssetsProgress({ detail }) { + console.log('assets progress', detail.value) }, - handleAssetsLoaded: function({detail}) { - console.log('assets loaded', detail.value); - this.setData({loaded: true}); + handleAssetsLoaded({ detail }) { + console.log('assets loaded', detail.value) + this.setData({ loaded: true }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/components/xr-scan-team/index.js b/miniprogram/packageXRFrame/components/xr-scan-team/index.js index 72399648..12fc4ee9 100644 --- a/miniprogram/packageXRFrame/components/xr-scan-team/index.js +++ b/miniprogram/packageXRFrame/components/xr-scan-team/index.js @@ -1,4 +1,4 @@ -import XrTeamCameraAnimation from '../../xr-custom/animations/XrTeamCameraAnimation'; +import XrTeamCameraAnimation from '../../xr-custom/animations/XrTeamCameraAnimation' Component({ behaviors: [require('../common/share-behavior').default], @@ -7,74 +7,74 @@ Component({ run: { type: Boolean, value: false, - observer: function(newVal, oldVal) { + observer(newVal, oldVal) { if (newVal && newVal !== oldVal) { - this.requireRun = true; + this.requireRun = true } } } }, lifetimes: { - detached: function() { - this.voice.stop(); - this.bgm.stop(); + detached() { + this.voice.stop() + this.bgm.stop() }, }, methods: { - handleReady({detail}) { - const xrScene = this.scene = detail.value; - console.log('xr-scene', xrScene); - this.bgm = wx.createInnerAudioContext({}); - this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/kaqituolitai.mp3'; - this.bgm.volume = 0.5; - this.voice = wx.createInnerAudioContext({useWebAudioImplement: true}); - this.voice.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/homo.m4a'; + handleReady({ detail }) { + const xrScene = this.scene = detail.value + console.log('xr-scene', xrScene) + this.bgm = wx.createInnerAudioContext({}) + this.bgm.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/kaqituolitai.mp3' + this.bgm.volume = 0.5 + this.voice = wx.createInnerAudioContext({ useWebAudioImplement: true }) + this.voice.src = 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/homo.m4a' this.voiceFrag = { xinyi: [4, 2], roam: [6.8, 2], hikari: [53.9, 2], jump: [8.9, 1.5] - }; - this.tmpV3 = new (wx.getXrFrameSystem().Vector3)(); + } + this.tmpV3 = new (wx.getXrFrameSystem().Vector3)() }, - handleAssetsLoaded: function({detail}) { - this.triggerEvent('assetsLoaded', detail.value); + handleAssetsLoaded({ detail }) { + this.triggerEvent('assetsLoaded', detail.value) }, - handleRaf: function({detail}) { + handleRaf({ detail }) { if (!this.init()) { - return; + return } - + if (this.requireRun) { - this.requireRun = false; - this.run(); + this.requireRun = false + this.run() } this.triggerEvent('syncPositions', [ this.getScreenPosition(this.hikari, '瞬光'), this.getScreenPosition(this.roam, 'roam'), this.getScreenPosition(this.xinyi, 'xinyi') - ]); + ]) }, - getScreenPosition: function(char, name) { - this.tmpV3.set(char.worldPosition); - this.tmpV3.x += -0.1; - this.tmpV3.y += 1.2; - const clipPos = this.camera.convertWorldPositionToClip(this.tmpV3); - const {frameWidth, frameHeight} = this.scene; - return [((clipPos.x + 1) / 2) * frameWidth, (1 - (clipPos.y + 1) / 2) * frameHeight, name]; + getScreenPosition(char, name) { + this.tmpV3.set(char.worldPosition) + this.tmpV3.x += -0.1 + this.tmpV3.y += 1.2 + const clipPos = this.camera.convertWorldPositionToClip(this.tmpV3) + const { frameWidth, frameHeight } = this.scene + return [((clipPos.x + 1) / 2) * frameWidth, (1 - (clipPos.y + 1) / 2) * frameHeight, name] }, - init: function() { + init() { if (!this.camera) { - const camEl = this.scene.getElementById('camera'); - this.camera = camEl.getComponent(wx.getXrFrameSystem().Camera); - this.cameraCtrl = camEl.getComponent('camera-orbit-control'); + const camEl = this.scene.getElementById('camera') + this.camera = camEl.getComponent(wx.getXrFrameSystem().Camera) + this.cameraCtrl = camEl.getComponent('camera-orbit-control') } - const inited = this.camera && this.hikari && this.roam && this.xinyi; + const inited = this.camera && this.hikari && this.roam && this.xinyi if (inited && !this.cameraAnim) { - this.cameraAnim = this.camera.el.addComponent(wx.getXrFrameSystem().Animator); + this.cameraAnim = this.camera.el.addComponent(wx.getXrFrameSystem().Animator) this.cameraAnim.createAnimation(XrTeamCameraAnimation, { targets: { hikari: this.hikari.position, @@ -84,80 +84,80 @@ Component({ }, startY: 1.2, finalY: 0.8 - }); + }) } - return inited; + return inited }, - handleModelLoaded: function({detail}) { - const {target} = detail.value; - this[target.id] = target.getComponent(wx.getXrFrameSystem().Transform); + handleModelLoaded({ detail }) { + const { target } = detail.value + this[target.id] = target.getComponent(wx.getXrFrameSystem().Transform) }, - run: async function() { - this.cameraCtrl.disable(); + async run() { + this.cameraCtrl.disable() - await this.prepareRun('xinyi'); - await this.prepareRun('roam'); - await this.prepareRun('hikari'); + await this.prepareRun('xinyi') + await this.prepareRun('roam') + await this.prepareRun('hikari') - await this.prepareCamera(); + await this.prepareCamera() - this.runOne(this.hikari); - this.runOne(this.roam); - this.runOne(this.xinyi); + this.runOne(this.hikari) + this.runOne(this.roam) + this.runOne(this.xinyi) - this.cameraCtrl.enable(); + this.cameraCtrl.enable() }, - prepareRun: async function(char) { - const voiceFrag = this.voiceFrag[char]; + async prepareRun(char) { + const voiceFrag = this.voiceFrag[char] return new Promise(resolve => { - const animator = this[char].el.getComponent(wx.getXrFrameSystem().Animator); + const animator = this[char].el.getComponent(wx.getXrFrameSystem().Animator) - this.cameraAnim.play(char); + this.cameraAnim.play(char) this.cameraAnim.el.event.addOnce('anim-stop', () => { - this.voice.seek(voiceFrag[0]); - this.voice.play(); + this.voice.seek(voiceFrag[0]) + this.voice.play() setTimeout(() => { - this.voice.stop(); - animator.stop(); - animator.pauseToFrame('Run', 0); - setTimeout(() => resolve(), 200); - }, voiceFrag[1] * 1000); - }); - }); + this.voice.stop() + animator.stop() + animator.pauseToFrame('Run', 0) + setTimeout(() => resolve(), 200) + }, voiceFrag[1] * 1000) + }) + }) }, - prepareCamera: async function() { - this.bgm.play(); - this.bgm.seek(46); + async prepareCamera() { + this.bgm.play() + this.bgm.seek(46) return new Promise(resolve => { - this.cameraAnim.play('final'); + this.cameraAnim.play('final') this.cameraAnim.el.event.addOnce('anim-stop', () => { setTimeout(() => { - resolve(); - }, 1000); - }); - }); + resolve() + }, 1000) + }) + }) }, - runOne: function(char) { - const animator = char.el.getComponent(wx.getXrFrameSystem().Animator); - animator.resume(); + runOne(char) { + const animator = char.el.getComponent(wx.getXrFrameSystem().Animator) + animator.resume() const jump = () => { - this.voice.seek(this.voiceFrag.jump[0]); - this.voice.play(); - animator.stop(); - animator.play('Jump', {loop: 0}); + this.voice.seek(this.voiceFrag.jump[0]) + this.voice.play() + animator.stop() + animator.play('Jump', { loop: 0 }) animator.el.event.addOnce('anim-stop', () => { - animator.play('Run'); - this.voice.stop(); - }); - char.el.event.addOnce('touch-shape', jump); + animator.play('Run') + this.voice.stop() + }) + char.el.event.addOnce('touch-shape', jump) } - char.el.event.addOnce('touch-shape', jump); + char.el.event.addOnce('touch-shape', jump) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-face/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-face/index.js index 970b53cc..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-face/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-face/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-osd/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-osd/index.js index d16edbe9..912c7eb9 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-osd/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-osd/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', markerImg: '' } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-perspect/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-perspect/index.js index f6c8a81e..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-perspect/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-perspect/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-portal/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-portal/index.js index 970b53cc..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-portal/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-portal/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-video/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-video/index.js index 16dcb942..9f73db9f 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-video/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-video/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene ar-system="modes:Marker" bind:ready="handleReady"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene ar-system="modes:Marker" bind:ready="handleReady"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="video-texture" asset-id="hikari" @@ -16,11 +17,10 @@ var xmlCode = `<xr-scene ar-system="modes:Marker" bind:ready=" background="ar" is-ar-camera /> </xr-node> -</xr-scene>`; +</xr-scene>` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-wxball/index.js b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-wxball/index.js index f6c8a81e..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-wxball/index.js +++ b/miniprogram/packageXRFrame/pages/ar-classic/scene-classic-wxball/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-2dmarker/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-2dmarker/index.js index b818d3c4..d966ac98 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-2dmarker/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-2dmarker/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene ar-system="modes:Marker" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene ar-system="modes:Marker" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-material asset-id="ar-anchor" effect="standrand" uniforms="u_baseColorFactor:0 1 0 1"></xr-asset-material> </xr-assets> @@ -20,26 +21,26 @@ var xmlCode = `<xr-scene ar-system="modes:Marker" id="xr-scene <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="3" /> </xr-node> </xr-scene> -`; +` Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/2dmarker-test.jpg' }, - handleChangeMarkerImg: function() { + handleChangeMarkerImg() { wx.chooseMedia({ count: 1, sizeType: ['compressed'], mediaType: ['image'], sourceType: ['album'], success: res => { - const fp = res.tempFiles[0].tempFilePath; - this.setData({markerImg: fp}); + const fp = res.tempFiles[0].tempFilePath + this.setData({ markerImg: fp }) }, fail: err => { - console.error('[xr-demo]chooseImage failed', err); + console.error('[xr-demo]chooseImage failed', err) } - }); + }) } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-basic/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-basic/index.js index 995d46ee..768ce5c8 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-basic/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-basic/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-item" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/just_a_girl/scene.gltf" /> <xr-asset-material asset-id="standard-mat" effect="standard" /> @@ -26,11 +27,10 @@ var xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene& <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="3" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-body-3d/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-body-3d/index.js index a0d9ed4d..17a3feee 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-body-3d/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-body-3d/index.js @@ -1,13 +1,14 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', score: undefined }, - handleInfo: function({detail}) { - this.setData({score: detail.score.toFixed(2)}); + handleInfo({ detail }) { + this.setData({ score: detail.score.toFixed(2) }) }, -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-body/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-body/index.js index a0d9ed4d..17a3feee 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-body/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-body/index.js @@ -1,13 +1,14 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', score: undefined }, - handleInfo: function({detail}) { - this.setData({score: detail.score.toFixed(2)}); + handleInfo({ detail }) { + this.setData({ score: detail.score.toFixed(2) }) }, -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-camera/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-camera/index.js index f34b875a..7425edfd 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-camera/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-camera/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene" ar-system="modes:Marker" bind:ready="handleReady" bind:tick="handleTick" bind:log="handleLog"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene" ar-system="modes:Marker" bind:ready="handleReady" bind:tick="handleTick" bind:log="handleLog"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="env-data" asset-id="env1" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/env-footprint/data.json" /> <xr-asset-load type="gltf" asset-id="gltf-table" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/metal_table/scene.gltf" /> @@ -22,11 +23,10 @@ var xmlCode = `<xr-scene id="xr-scene" ar-system="modes:Marker <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="2" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-face-3d/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-face-3d/index.js index 42c2db4f..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-face-3d/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-face-3d/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-face/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-face/index.js index 42c2db4f..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-face/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-face/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-hand-3d/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-hand-3d/index.js index dc8ea10b..4314ac01 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-hand-3d/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-hand-3d/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { @@ -8,7 +9,7 @@ Page({ gesture: undefined, score: undefined }, - handleInfo: function({detail}) { - this.setData({gesture: detail.gesture, score: detail.score.toFixed(2)}); + handleInfo({ detail }) { + this.setData({ gesture: detail.gesture, score: detail.score.toFixed(2) }) }, -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-hand/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-hand/index.js index dc8ea10b..4314ac01 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-hand/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-hand/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { @@ -8,7 +9,7 @@ Page({ gesture: undefined, score: undefined }, - handleInfo: function({detail}) { - this.setData({gesture: detail.gesture, score: detail.score.toFixed(2)}); + handleInfo({ detail }) { + this.setData({ gesture: detail.gesture, score: detail.score.toFixed(2) }) }, -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-osdmarker/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-osdmarker/index.js index d5fd5d66..74a21766 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-osdmarker/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-osdmarker/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene ar-system="modes:OSD" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene ar-system="modes:OSD" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-burger" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/burger/burger.gltf" /> <xr-asset-material asset-id="ar-anchor" effect="standrand" uniforms="u_baseColorFactor:0 1 0 1"></xr-asset-material> @@ -21,27 +22,26 @@ var xmlCode = `<xr-scene ar-system="modes:OSD" id="xr-scene&qu <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="3" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/osdmarker-test.jpg' }, - handleChangeMarkerImg: function() { + handleChangeMarkerImg() { wx.chooseMedia({ count: 1, sizeType: ['compressed'], mediaType: ['image'], sourceType: ['album'], success: res => { - const fp = res.tempFiles[0].tempFilePath; - this.setData({markerImg: fp}); + const fp = res.tempFiles[0].tempFilePath + this.setData({ markerImg: fp }) }, fail: err => { - console.error('[xr-demo]chooseImage failed', err); + console.error('[xr-demo]chooseImage failed', err) } - }); + }) } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-shoe/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-shoe/index.js index 42c2db4f..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-shoe/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-shoe/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-threeDof/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-threeDof/index.js index 995d46ee..768ce5c8 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-threeDof/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-threeDof/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene" bind:ready="handleReady" bind:arReady="handleARReady" bind:log="handleLog"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-item" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/just_a_girl/scene.gltf" /> <xr-asset-material asset-id="standard-mat" effect="standard" /> @@ -26,11 +27,10 @@ var xmlCode = `<xr-scene ar-system="modes:Plane" id="xr-scene& <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="3" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-depth/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-depth/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-depth/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-depth/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-marker/index.js b/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-marker/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-marker/index.js +++ b/miniprogram/packageXRFrame/pages/ar/scene-ar-vio-marker/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-alpha/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-alpha/index.js index 655ae4c8..72f13cc0 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-alpha/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-alpha/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { heightScale: 0.5, cubeAlpha: 100, @@ -18,31 +18,31 @@ Page({ changeClearR(e) { this.setData({ clearR: e.detail.value - }); + }) }, changeClearG(e) { this.setData({ clearG: e.detail.value - }); + }) }, changeClearB(e) { this.setData({ clearB: e.detail.value - }); + }) }, changeClearA(e) { this.setData({ clearA: e.detail.value - }); + }) }, changeCubeAlpha(e) { this.setData({ cubeAlpha: e.detail.value - }); + }) }, changeSphereAlpha(e) { this.setData({ sphereAlpha: e.detail.value - }); + }) } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-animation/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-animation/index.js index b9a699ea..07f54096 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-animation/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-animation/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load asset-id="basic-anim" type="keyframe" src="/assets/animation/basic-animation.json"/> <xr-asset-material asset-id="standard-mat" effect="standard" /> @@ -39,7 +40,7 @@ var xmlCode = `<xr-scene id="xr-scene"> /> </xr-node> </xr-scene> -`; +` const json = ` { @@ -88,13 +89,12 @@ const json = ` } -}`; +}` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', - json: json + json } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-envData/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-envData/index.js index 89b66504..de7137ba 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-envData/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-envData/index.js @@ -1,8 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-light/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-light/index.js index 36f16aa0..c7116161 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-light/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-light/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-material asset-id="standard-mat" effect="standard" /> </xr-assets> @@ -25,11 +26,10 @@ var xmlCode = `<xr-scene id="xr-scene"> <xr-light type="spot" position="0 0 0" color="0 0 1" range="12" intensity="12" rotation="0 120 0" inner-cone-angle="30" outer-cone-angle="35" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-particle/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-particle/index.js index 5addbbdf..8aa7ee53 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-particle/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-particle/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = `;`; +const xmlCode = ';' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', capacity: 0, @@ -12,50 +12,46 @@ Page({ lifeTime: 0, }, - calc: function(variable, add = true, number=1){ - var temp = variable; - var result = temp; - var count = 1; - while(Math.floor(temp/10)){ - count++; - temp = Math.floor(temp/10); + calc(variable, add = true, number = 1) { + let temp = variable + let result = temp + let count = 1 + while (Math.floor(temp / 10)) { + count++ + temp = Math.floor(temp / 10) } - if(add){ - result += number * Math.pow(10, count-1); - }else{ - if(result<=number * Math.pow(10,count-1)){ - count--; - if(count < 1 ){ - count = 1; + if (add) { + result += number * 10 ** (count - 1) + } else { + if (result <= number * 10 ** (count - 1)) { + count-- + if (count < 1) { + count = 1 } } - result -= number * Math.pow(10, count-1); - if(result < 0 ){ - result = 0; + result -= number * 10 ** (count - 1) + if (result < 0) { + result = 0 } } - return Number(result.toFixed(1)); + return Number(result.toFixed(1)) }, - handleAdd: function() { - this.setData({capacity:this.calc(this.data.capacity, true)}); + handleAdd() { + this.setData({ capacity: this.calc(this.data.capacity, true) }) }, - handleSub: function() { - this.setData({capacity:this.calc(this.data.capacity, false)}); + handleSub() { + this.setData({ capacity: this.calc(this.data.capacity, false) }) }, - handleRateAdd: function() { - this.setData({emitRate:this.calc(this.data.emitRate, true)}); + handleRateAdd() { + this.setData({ emitRate: this.calc(this.data.emitRate, true) }) }, - handleRateSub: function() { - this.setData({emitRate:this.calc(this.data.emitRate, false)}); + handleRateSub() { + this.setData({ emitRate: this.calc(this.data.emitRate, false) }) }, - handleTimeAdd: function() { - this.setData({lifeTime:this.calc(this.data.lifeTime, true, 0.1)}); + handleTimeAdd() { + this.setData({ lifeTime: this.calc(this.data.lifeTime, true, 0.1) }) }, - handleTimeSub: function() { - this.setData({lifeTime:this.calc(this.data.lifeTime, false, 0.1)}); + handleTimeSub() { + this.setData({ lifeTime: this.calc(this.data.lifeTime, false, 0.1) }) } -}); - - - - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-postprocessing/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-postprocessing/index.js index 2a84ee8e..48ba8521 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-postprocessing/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-postprocessing/index.js @@ -1,12 +1,13 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', type: 0, - + blurRadius: 16, bloomRadius: 16, bloomIntensity: 2, @@ -16,71 +17,70 @@ Page({ vignetteRoundness: 1, fxaaEnabled: false }, - handleProgress: function({detail}) { - this.setData({progressInfo: `${~~(detail.progress * 100)} %\n\n${detail.asset.assetId}(${detail.asset.type}): ${detail.asset.src}`}); + handleProgress({ detail }) { + this.setData({ progressInfo: `${~~(detail.progress * 100)} %\n\n${detail.asset.assetId}(${detail.asset.type}): ${detail.asset.src}` }) }, - handleLoaded: function({detail}) { - this.setData({loaded: true}); + handleLoaded({ detail }) { + this.setData({ loaded: true }) }, changeType(e) { - const type = e.detail.value; - if (type === "blur") { + const type = e.detail.value + if (type === 'blur') { this.setData({ type: 0 - }); - } else if (type === "bloom") { + }) + } else if (type === 'bloom') { this.setData({ type: 1 - }); - } else if (type === "vignette") { + }) + } else if (type === 'vignette') { this.setData({ type: 2 - }); - } else if (type === "fxaa") { + }) + } else if (type === 'fxaa') { this.setData({ type: 3 - }); + }) } }, changeBlurRadius(e) { this.setData({ blurRadius: e.detail.value - }); + }) }, changeBloomRadius(e) { this.setData({ bloomRadius: e.detail.value - }); + }) }, changeBloomIntensity(e) { this.setData({ bloomIntensity: e.detail.value - }); + }) }, changeBloomThreshold(e) { this.setData({ bloomThreshold: e.detail.value - }); + }) }, changeVignetteIntensity(e) { this.setData({ vignetteIntensity: e.detail.value - }); + }) }, changeVignetteSmoothness(e) { this.setData({ vignetteSmoothness: e.detail.value - }); + }) }, changeVignetteRoundness(e) { this.setData({ vignetteRoundness: e.detail.value - }); + }) }, switchFXAA(e) { this.setData({ fxaaEnabled: !this.data.fxaaEnabled - }); + }) } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-render-texture/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-render-texture/index.js index b0f9e7b6..a566bf8e 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-render-texture/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-render-texture/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-shadow/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-shadow/index.js index 966e7caf..784b908f 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-shadow/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-shadow/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var escapeMarkup = require('../../behavior-scene/util').escapeMarkup; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML +const escapeMarkup = require('../../behavior-scene/util').escapeMarkup -var xmlCode = escapeMarkup(` +const xmlCode = escapeMarkup(` -`); -var jsCode = ` +`) +const jsCode = ` ...
addOne() {
@@ -34,27 +34,26 @@ handleTick: function({detail}) {
},
... -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', - jsCode: jsCode, + jsCode, meshCount: 0 }, - handleIncMeshCount: function() { + handleIncMeshCount() { if (this.data.meshCount > 16) { - return; + return } - this.setData({meshCount: this.data.meshCount + 1}); + this.setData({ meshCount: this.data.meshCount + 1 }) }, - handleDecMeshCount: function() { + handleDecMeshCount() { if (this.data.meshCount <= 0) { - return; + return } - this.setData({meshCount: this.data.meshCount - 1}); + this.setData({ meshCount: this.data.meshCount - 1 }) } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-share/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-share/index.js index ecf7e615..cac0dc92 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-share/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-share/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') + Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { captureState: 0, recordState: 0, @@ -14,63 +15,62 @@ Page({ sceneWidth: 0, sceneHeight: 0 }, - handleReady: function({detail}) { + handleReady({ detail }) { this.setData({ sceneWidth: detail.width, sceneHeight: detail.height, recordWidth: detail.width, recordHeight: detail.height, - }); + }) }, changeCaptureState(e) { if (this.data.recordState) { wx.showToast({ title: '录屏中不允许!', - }); - return; + }) + return } if (this.data.captureState) { wx.showToast({ title: '等待上次完成!', - }); - return; + }) + return } - this.setData({captureState: 1}); + this.setData({ captureState: 1 }) // hack,其实应该等待异步方法完成 setTimeout(() => { - this.setData({captureState: 0}); - }, 1000); + this.setData({ captureState: 0 }) + }, 1000) }, changeRecordState(e) { - this.setData({recordState: this.data.recordState ? 0 : 1}); + this.setData({ recordState: this.data.recordState ? 0 : 1 }) }, changeCaptureType(e) { - this.setData({captureType: e.detail.value}); + this.setData({ captureType: e.detail.value }) }, changeCaptureQuality(e) { this.setData({ captureQuality: e.detail.value - }); + }) }, changeRecordFPS(e) { this.setData({ recordFPS: e.detail.value - }); + }) }, changeRecordBPS(e) { this.setData({ recordBPS: e.detail.value - }); + }) }, changeRecordScale(e) { - const scale = e.detail.value; + const scale = e.detail.value this.setData({ recordScale: scale, recordWidth: ~~(this.data.sceneWidth * scale), recordHeight: ~~(this.data.sceneHeight * scale), - }); + }) } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-touch/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-touch/index.js index 5d6cced7..7345b08a 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-touch/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-touch/index.js @@ -1,8 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var escapeMarkup = require('../../behavior-scene/util').escapeMarkup; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML +const escapeMarkup = require('../../behavior-scene/util').escapeMarkup -var xmlCode = escapeMarkup(` +const xmlCode = escapeMarkup(` @@ -21,14 +21,14 @@ var xmlCode = escapeMarkup(` -`); +`) -var jsCode = "not implemented"; +const jsCode = 'not implemented' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', - jsCode: jsCode + jsCode } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-video/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-video/index.js index b0f9e7b6..a566bf8e 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-video/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-video/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic-visible-layer/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic-visible-layer/index.js index 5afc4377..a963ad91 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic-visible-layer/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic-visible-layer/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', visibleIndex: 1, @@ -13,11 +13,11 @@ Page({ handleChangeVisible() { this.setData({ visibleIndex: 3 - this.data.visibleIndex - }); + }) }, handleChangeCullMask() { this.setData({ cullMask: ((this.data.cullMask ^ (((this.data.cullMask & 0b100) >> 2) * 0b111)) << 1) | 0b1 - }); + }) } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/basic/scene-basic/index.js b/miniprogram/packageXRFrame/pages/basic/scene-basic/index.js index 0a71896b..9dcc4844 100644 --- a/miniprogram/packageXRFrame/pages/basic/scene-basic/index.js +++ b/miniprogram/packageXRFrame/pages/basic/scene-basic/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = `<xr-scene id="xr-scene"> +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-material asset-id="standard-mat" effect="standard" /> </xr-assets> @@ -20,11 +20,11 @@ var xmlCode = `<xr-scene id="xr-scene"> <xr-light type="ambient" color="1 1 1" intensity="1" /> <xr-light type="directional" rotation="40 170 0" color="1 1 1" intensity="3" /> </xr-node> -</xr-scene>`; +</xr-scene>` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/behavior-scene/scene-ready.js b/miniprogram/packageXRFrame/pages/behavior-scene/scene-ready.js index 643e6562..b3261860 100644 --- a/miniprogram/packageXRFrame/pages/behavior-scene/scene-ready.js +++ b/miniprogram/packageXRFrame/pages/behavior-scene/scene-ready.js @@ -18,54 +18,54 @@ module.exports = Behavior({ arTrackerState: 'Init', arTrackerError: '' }, - attached: function(){}, + attached() {}, ready() { - const info = wx.getSystemInfoSync(); - const width = info.windowWidth; - const windowHeight = info.windowHeight; - const height = windowHeight * this.data.heightScale; - const dpi = info.pixelRatio; + const info = wx.getSystemInfoSync() + const width = info.windowWidth + const windowHeight = info.windowHeight + const height = windowHeight * this.data.heightScale + const dpi = info.pixelRatio this.setData({ width, height, renderWidth: width * dpi * this.data.dpiScale, renderHeight: height * dpi * this.data.dpiScale, windowHeight - }); + }) }, methods: { onLoad(options) { - wx.reportEvent("xr_frame", { - "xr_page_path": options.path - }); + wx.reportEvent('xr_frame', { + xr_page_path: options.path + }) }, onShareAppMessage() { try { if (wx.xrScene) { - const buffer = wx.xrScene.share.captureToArrayBuffer({quality: 0.5}); - const fp = `${wx.env.USER_DATA_PATH}/xr-frame-share.jpg`; - wx.getFileSystemManager().writeFileSync(fp, buffer, 'binary'); + const buffer = wx.xrScene.share.captureToArrayBuffer({ quality: 0.5 }) + const fp = `${wx.env.USER_DATA_PATH}/xr-frame-share.jpg` + wx.getFileSystemManager().writeFileSync(fp, buffer, 'binary') return { title: this.getTitle(), imageUrl: fp - }; + } } } catch (e) { return { title: this.getTitle() - }; + } } }, onShareTimeline() { try { if (wx.xrScene) { - const buffer = wx.xrScene.share.captureToArrayBuffer({quality: 0.5}); - const fp = `${wx.env.USER_DATA_PATH}/xr-frame-share.jpg`; - wx.getFileSystemManager().writeFileSync(fp, buffer, 'binary'); + const buffer = wx.xrScene.share.captureToArrayBuffer({ quality: 0.5 }) + const fp = `${wx.env.USER_DATA_PATH}/xr-frame-share.jpg` + wx.getFileSystemManager().writeFileSync(fp, buffer, 'binary') return { title: this.getTitle(), imageUrl: fp - }; + } } } catch (e) { return { @@ -74,15 +74,15 @@ module.exports = Behavior({ } }, getTitle() { - return wx.xrTitle ? `XR - ${wx.xrTitle}` : 'XR-FRAME官方示例'; + return wx.xrTitle ? `XR - ${wx.xrTitle}` : 'XR-FRAME官方示例' }, - handleARTrackerState({detail}) { - const {state, error} = detail; + handleARTrackerState({ detail }) { + const { state, error } = detail this.setData({ arTrackerShow: true, arTrackerState: wx.getXrFrameSystem().EARTrackerState[state], arTrackerError: error - }); + }) } } -}) \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/behavior-scene/util.js b/miniprogram/packageXRFrame/pages/behavior-scene/util.js index 7511e81d..ab47eeb6 100644 --- a/miniprogram/packageXRFrame/pages/behavior-scene/util.js +++ b/miniprogram/packageXRFrame/pages/behavior-scene/util.js @@ -1,56 +1,56 @@ -var handleDecodedXML = function(decodedXml) { - let rerurnXml = ''; +const handleDecodedXML = function (decodedXml) { + let rerurnXml = '' - const blockArr = decodedXml.split('<'); + const blockArr = decodedXml.split('<') for (let i = 0; i < blockArr.length; i++) { - let blockStr = blockArr[i]; - let handleBlockStr = ''; - let returnBlockStr = ''; + const blockStr = blockArr[i] + let handleBlockStr = '' + let returnBlockStr = '' - const sliceBlockStr = blockStr.split(' '); + const sliceBlockStr = blockStr.split(' ') - for(let j = 0; j < sliceBlockStr.length; j++) { - const subBlockStr = sliceBlockStr[j]; - - const eIndex = subBlockStr.indexOf('='); + for (let j = 0; j < sliceBlockStr.length; j++) { + const subBlockStr = sliceBlockStr[j] + + const eIndex = subBlockStr.indexOf('=') if (eIndex !== -1) { - handleBlockStr += ' ' + subBlockStr.slice(0, eIndex) +'' + subBlockStr.slice(eIndex); + handleBlockStr += ' ' + subBlockStr.slice(0, eIndex) + '' + subBlockStr.slice(eIndex) } else { - handleBlockStr += subBlockStr; + handleBlockStr += subBlockStr } } // console.log(sliceBlockStr); - const blockEndIndexB = handleBlockStr.indexOf(' '); - const blockEndIndexR = handleBlockStr.indexOf('>'); + const blockEndIndexB = handleBlockStr.indexOf(' ') + const blockEndIndexR = handleBlockStr.indexOf('>') // Handle XMLTag if (blockEndIndexB === -1 && blockEndIndexR === -1) { - continue; + continue } - const endBlockFlag = handleBlockStr[0] === '/'; + const endBlockFlag = handleBlockStr[0] === '/' if (blockEndIndexR !== -1) { handleBlockStr += '
' } if (blockEndIndexR < blockEndIndexB) { - returnBlockStr = '<' + (endBlockFlag ? '/' : '') + '' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexR) + '' + handleBlockStr.slice(blockEndIndexR); + returnBlockStr = '<' + (endBlockFlag ? '/' : '') + '' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexR) + '' + handleBlockStr.slice(blockEndIndexR) } else if (blockEndIndexB !== -1) { - returnBlockStr = '<' + (endBlockFlag ? '/' : '') +'' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexB) + '' + handleBlockStr.slice(blockEndIndexB); + returnBlockStr = '<' + (endBlockFlag ? '/' : '') + '' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexB) + '' + handleBlockStr.slice(blockEndIndexB) } else if (blockEndIndexR !== -1) { - returnBlockStr = '<' + (endBlockFlag ? '/' : '') + '' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexR) + '' + handleBlockStr.slice(blockEndIndexR); + returnBlockStr = '<' + (endBlockFlag ? '/' : '') + '' + handleBlockStr.slice(endBlockFlag ? 1 : 0, blockEndIndexR) + '' + handleBlockStr.slice(blockEndIndexR) } - rerurnXml += returnBlockStr; + rerurnXml += returnBlockStr } - return rerurnXml; + return rerurnXml } -var escapeMarkup = function(dangerousInput) { - const dangerousString = String(dangerousInput); - const matchHtmlRegExp = /["'&<>]/; - const match = matchHtmlRegExp.exec(dangerousString); +const escapeMarkup = function (dangerousInput) { + const dangerousString = String(dangerousInput) + const matchHtmlRegExp = /["'&<>]/ + const match = matchHtmlRegExp.exec(dangerousString) if (!match) { - return dangerousInput; + return dangerousInput } const encodedSymbolMap = { @@ -59,17 +59,16 @@ var escapeMarkup = function(dangerousInput) { '&': '&', '<': '<', '>': '>' - }; - const dangerousCharacters = dangerousString.split(''); + } + const dangerousCharacters = dangerousString.split('') const safeCharacters = dangerousCharacters.map(function (character) { - return encodedSymbolMap[character] || character; - }); - const safeString = safeCharacters.join(''); - return safeString; + return encodedSymbolMap[character] || character + }) + const safeString = safeCharacters.join('') + return safeString } - module.exports = { handleDecodedXML, escapeMarkup -} \ No newline at end of file +} diff --git a/miniprogram/packageXRFrame/pages/custom/scene-custom-logic/index.js b/miniprogram/packageXRFrame/pages/custom/scene-custom-logic/index.js index b0f9e7b6..a566bf8e 100644 --- a/miniprogram/packageXRFrame/pages/custom/scene-custom-logic/index.js +++ b/miniprogram/packageXRFrame/pages/custom/scene-custom-logic/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/custom/scene-custom-render/index.js b/miniprogram/packageXRFrame/pages/custom/scene-custom-render/index.js index b0f9e7b6..a566bf8e 100644 --- a/miniprogram/packageXRFrame/pages/custom/scene-custom-render/index.js +++ b/miniprogram/packageXRFrame/pages/custom/scene-custom-render/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-firework/index.js b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-firework/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-firework/index.js +++ b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-firework/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-meshEmitter/index.js b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-meshEmitter/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-meshEmitter/index.js +++ b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-meshEmitter/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-orb/index.js b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-orb/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-orb/index.js +++ b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-orb/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-portal/index.js b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-portal/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-portal/index.js +++ b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-portal/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-shapeEmitter/index.js b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-shapeEmitter/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-shapeEmitter/index.js +++ b/miniprogram/packageXRFrame/pages/customParticle/scene-customParticle-shapeEmitter/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-animation/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-animation/index.js index fff52a28..a668b8bc 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-animation/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-animation/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-damageHelmet" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/damage-helmet/DamagedHelmet.gltf" /> <xr-asset-load @@ -21,11 +22,10 @@ var xmlCode = `<xr-scene id="xr-scene"> <xr-light type="directional" rotation="40 180 0" color="1 1 1" intensity="2" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-compressTextures/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-compressTextures/index.js index f40d3d71..ae250984 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-compressTextures/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-compressTextures/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-damageHelmet/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-damageHelmet/index.js index 06d5ab7e..602ab6e5 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-damageHelmet/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-damageHelmet/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-light-loading/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-light-loading/index.js index 9fb8c697..96115ccf 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-light-loading/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-light-loading/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-Sponza" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/Sponza/gltf/Sponza.gltf" /> </xr-assets> @@ -29,23 +30,22 @@ var xmlCode = `<xr-scene id="xr-scene"> /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', progressInfo: '', loaded: false }, - handleProgress: function({detail}) { - console.log('assets progress', detail); + handleProgress({ detail }) { + console.log('assets progress', detail) - this.setData({progressInfo: `${~~(detail.progress * 100)} %\n\n${detail.asset.assetId}(${detail.asset.type}): ${detail.asset.src}`}); + this.setData({ progressInfo: `${~~(detail.progress * 100)} %\n\n${detail.asset.assetId}(${detail.asset.type}): ${detail.asset.src}` }) }, - handleLoaded: function({detail}) { - console.log('assets loaded', detail); + handleLoaded({ detail }) { + console.log('assets loaded', detail) - this.setData({loaded: true}); + this.setData({ loaded: true }) } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-lightsPunctual/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-lightsPunctual/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-lightsPunctual/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-lightsPunctual/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-morph/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-morph/index.js index 06d5ab7e..602ab6e5 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-morph/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-morph/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-sheen/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-sheen/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-sheen/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-sheen/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-specularGlossiness/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-specularGlossiness/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-specularGlossiness/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-specularGlossiness/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-textureTransform/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-textureTransform/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-textureTransform/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-textureTransform/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-transmission/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-transmission/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-transmission/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-transmission/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-unlit/index.js b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-unlit/index.js index e071701f..23ae280f 100644 --- a/miniprogram/packageXRFrame/pages/gltf/scene-gltf-unlit/index.js +++ b/miniprogram/packageXRFrame/pages/gltf/scene-gltf-unlit/index.js @@ -1,6 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = `<xr-scene id="xr-scene"> +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = `<xr-scene id="xr-scene"> <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded"> <xr-asset-load type="gltf" asset-id="gltf-just_a_girl" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/just_a_girl/scene.gltf" /> </xr-assets> @@ -18,11 +19,10 @@ var xmlCode = `<xr-scene id="xr-scene"> <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="2" /> </xr-node> </xr-scene> -`; +` Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/index/data/index.js b/miniprogram/packageXRFrame/pages/index/data/index.js index eb4768e8..de8382bc 100644 --- a/miniprogram/packageXRFrame/pages/index/data/index.js +++ b/miniprogram/packageXRFrame/pages/index/data/index.js @@ -63,229 +63,229 @@ const base = { path: '/pages/basic/scene-basic-envData/index', }, ], -}; +} const gltf = { name: 'glTF能力', tag: 'func', childArr: [{ - name: 'Standard', - label: '标准金属头盔', - path: '/pages/gltf/scene-gltf-damageHelmet/index', - }, - { - name: 'Unlit', - label: '无光照材质卡通模型', - path: '/pages/gltf/scene-gltf-unlit/index', - }, - { - name: 'Loading', - label: '加载界面与多光源场景', - path: '/pages/gltf/scene-gltf-light-loading/index', - }, - { - name: 'Animation', - label: 'gltf动画', - path: '/pages/gltf/scene-gltf-animation/index', - }, - { - name: 'Morph', - label: 'gltf morph', - path: '/pages/gltf/scene-gltf-morph/index', - }, - { - name: '扩展', - label: '压缩纹理', - path: '/pages/gltf/scene-gltf-compressTextures/index', - }, - { - name: '扩展', - label: 'KHR_texture_transform', - path: '/pages/gltf/scene-gltf-textureTransform/index', - }, - { - name: '扩展', - label: 'KHR_materials_pbrSpecularGlossiness', - path: '/pages/gltf/scene-gltf-specularGlossiness/index', - }, - { - name: '扩展', - label: 'KHR_materials_sheen', - path: '/pages/gltf/scene-gltf-sheen/index', - }, - { - name: '扩展', - label: 'KHR_materials_transmission', - path: '/pages/gltf/scene-gltf-transmission/index', - }, - { - name: '扩展', - label: 'KHR_lights_punctual', - path: '/pages/gltf/scene-gltf-lightsPunctual/index', - }, + name: 'Standard', + label: '标准金属头盔', + path: '/pages/gltf/scene-gltf-damageHelmet/index', + }, + { + name: 'Unlit', + label: '无光照材质卡通模型', + path: '/pages/gltf/scene-gltf-unlit/index', + }, + { + name: 'Loading', + label: '加载界面与多光源场景', + path: '/pages/gltf/scene-gltf-light-loading/index', + }, + { + name: 'Animation', + label: 'gltf动画', + path: '/pages/gltf/scene-gltf-animation/index', + }, + { + name: 'Morph', + label: 'gltf morph', + path: '/pages/gltf/scene-gltf-morph/index', + }, + { + name: '扩展', + label: '压缩纹理', + path: '/pages/gltf/scene-gltf-compressTextures/index', + }, + { + name: '扩展', + label: 'KHR_texture_transform', + path: '/pages/gltf/scene-gltf-textureTransform/index', + }, + { + name: '扩展', + label: 'KHR_materials_pbrSpecularGlossiness', + path: '/pages/gltf/scene-gltf-specularGlossiness/index', + }, + { + name: '扩展', + label: 'KHR_materials_sheen', + path: '/pages/gltf/scene-gltf-sheen/index', + }, + { + name: '扩展', + label: 'KHR_materials_transmission', + path: '/pages/gltf/scene-gltf-transmission/index', + }, + { + name: '扩展', + label: 'KHR_lights_punctual', + path: '/pages/gltf/scene-gltf-lightsPunctual/index', + }, ], -}; +} const ar = { name: 'AR能力', tag: 'func', childArr: [{ - name: 'Camera', - label: 'AR 相机渲染', - path: '/pages/ar/scene-ar-camera/index', - }, - { - name: 'Basic', - label: 'AR 平面识别', - path: '/pages/ar/scene-ar-basic/index', - }, + name: 'Camera', + label: 'AR 相机渲染', + path: '/pages/ar/scene-ar-camera/index', + }, + { + name: 'Basic', + label: 'AR 平面识别', + path: '/pages/ar/scene-ar-basic/index', + }, + { + name: 'ThreeDof', + label: 'AR 相机旋转', + path: '/pages/ar/scene-ar-threeDof/index', + }, + { + name: '2DMarker', + label: 'AR 2DMarker', + path: '/pages/ar/scene-ar-2dmarker/index', + }, + { + name: 'OSDMarker', + label: 'AR OSDMarker', + path: '/pages/ar/scene-ar-osdmarker/index', + }, + { + name: 'Face', + label: 'AR 人脸', + path: '/pages/ar/scene-ar-face/index', + }, + { + name: 'Face', + label: 'AR 三维人脸', + path: '/pages/ar/scene-ar-face-3d/index', + }, + { + name: 'Hand', + label: 'AR 人手', + path: '/pages/ar/scene-ar-hand/index', + }, + { + name: 'Hand', + label: 'AR 三维人手', + path: '/pages/ar/scene-ar-hand-3d/index', + }, + { + name: 'Body', + label: 'AR 人体', + path: '/pages/ar/scene-ar-body/index', + }, + { + name: 'Body', + label: 'AR 三维人体', + path: '/pages/ar/scene-ar-body-3d/index', + }, + { + name: 'Shoe', + label: 'AR 试鞋', + path: '/pages/ar/scene-ar-shoe/index', + }, + { + name: 'Plane+Marker', + label: 'AR 平面 Marker融合', + path: '/pages/ar/scene-ar-vio-marker/index', + }, + { + name: 'Plane+Depth', + label: 'AR 平面深度剔除', + path: '/pages/ar/scene-ar-vio-depth/index', + }, + ], +} + +const physics = { + name: '物理能力', + tag: 'func', + childArr: [ { - name: 'ThreeDof', - label: 'AR 相机旋转', - path: '/pages/ar/scene-ar-threeDof/index', + name: 'Shoot', + label: '射击积木', + path: '/pages/physics/scene-physics-shoot/index' }, { - name: '2DMarker', - label: 'AR 2DMarker', - path: '/pages/ar/scene-ar-2dmarker/index', - }, + name: 'Throw', + label: '投球入筐', + path: '/pages/physics/scene-physics-throw/index' + } + ] +} + +const particle = { + name: '粒子能力', + tag: 'func', + childArr: [ { - name: 'OSDMarker', - label: 'AR OSDMarker', - path: '/pages/ar/scene-ar-osdmarker/index', + name: 'Firework', + label: '喷射烟火', + path: '/pages/particle/scene-particle-firework/index' }, { - name: 'Face', - label: 'AR 人脸', - path: '/pages/ar/scene-ar-face/index', + name: 'Portal', + label: '传送门', + path: '/pages/particle/scene-particle-portal/index' }, { - name: 'Face', - label: 'AR 三维人脸', - path: '/pages/ar/scene-ar-face-3d/index', + name: 'Orb', + label: '闪电光球', + path: '/pages/particle/scene-particle-orb/index' }, { - name: 'Hand', - label: 'AR 人手', - path: '/pages/ar/scene-ar-hand/index', + name: 'ShapeEmitter', + label: '球形发射器', + path: '/pages/particle/scene-particle-shapeEmitter/index' }, { - name: 'Hand', - label: 'AR 三维人手', - path: '/pages/ar/scene-ar-hand-3d/index', + name: 'MeshEmitter', + label: '网格发射器', + path: '/pages/particle/scene-particle-meshEmitter/index' }, { - name: 'Body', - label: 'AR 人体', - path: '/pages/ar/scene-ar-body/index', + name: 'HumanFace', + label: '自定义粒子系统', + path: '/pages/particle/scene-particle-custom/index' }, + ] +} + +const customParticle = { + name: '粒子定制能力', + tag: 'func', + childArr: [ { - name: 'Body', - label: 'AR 三维人体', - path: '/pages/ar/scene-ar-body-3d/index', + name: 'Firework', + label: '喷射烟火', + path: '/pages/customParticle/scene-customParticle-firework/index' }, { - name: 'Shoe', - label: 'AR 试鞋', - path: '/pages/ar/scene-ar-shoe/index', + name: 'Portal', + label: '传送门', + path: '/pages/customParticle/scene-customParticle-portal/index' }, { - name: 'Plane+Marker', - label: 'AR 平面 Marker融合', - path: '/pages/ar/scene-ar-vio-marker/index', + name: 'Orb', + label: '闪电光球', + path: '/pages/customParticle/scene-customParticle-orb/index' }, - // { - // name: 'Plane+Depth', - // label: 'AR 平面深度剔除', - // path: '/pages/ar/scene-ar-vio-depth/index', - // }, - ], -}; - -const physics = { - name: '物理能力', - tag: 'func', - childArr: [ { - name: 'Shoot', - label: '射击积木', - path: '/pages/physics/scene-physics-shoot/index' + name: 'ShapeEmitter', + label: '球形发射器', + path: '/pages/customParticle/scene-customParticle-shapeEmitter/index' }, { - name: 'Throw', - label: '投球入筐', - path: '/pages/physics/scene-physics-throw/index' + name: 'MeshEmitter', + label: '网格发射器', + path: '/pages/customParticle/scene-customParticle-meshEmitter/index' } ] -}; - -const particle = { - name: '粒子能力', - tag: 'func', - childArr: [ - { - name: 'Firework', - label: '喷射烟火', - path: '/pages/particle/scene-particle-firework/index' - }, - { - name: 'Portal', - label: '传送门', - path: '/pages/particle/scene-particle-portal/index' - }, - { - name: 'Orb', - label: '闪电光球', - path: '/pages/particle/scene-particle-orb/index' - }, - { - name: 'ShapeEmitter', - label: '球形发射器', - path: '/pages/particle/scene-particle-shapeEmitter/index' - }, - { - name: 'MeshEmitter', - label: '网格发射器', - path: '/pages/particle/scene-particle-meshEmitter/index' - }, - { - name: 'HumanFace', - label: '自定义粒子系统', - path: '/pages/particle/scene-particle-custom/index' - }, - ] - }; - -const customParticle = { - name: '粒子定制能力', - tag: 'func', - childArr: [ - { - name: 'Firework', - label: '喷射烟火', - path: '/pages/customParticle/scene-customParticle-firework/index' - }, - { - name: 'Portal', - label: '传送门', - path: '/pages/customParticle/scene-customParticle-portal/index' - }, - { - name: 'Orb', - label: '闪电光球', - path: '/pages/customParticle/scene-customParticle-orb/index' - }, - { - name: 'ShapeEmitter', - label: '球形发射器', - path: '/pages/customParticle/scene-customParticle-shapeEmitter/index' - }, - { - name: 'MeshEmitter', - label: '网格发射器', - path: '/pages/customParticle/scene-customParticle-meshEmitter/index' - } - ] - }; +} const custom = { name: '高级定制', @@ -302,7 +302,7 @@ const custom = { path: '/pages/custom/scene-custom-render/index', } ] -}; +} const messageTemplate = { name: '混合通信、资源加载、互动', @@ -329,7 +329,7 @@ const messageTemplate = { path: '/pages/template/xr-template-select/index', }, ], -}; +} const arTemplate = { name: '常用AR定制能力', @@ -376,7 +376,7 @@ const arTemplate = { path: '/pages/template/xr-template-arui/index', }, ], -}; +} const customTemplate = { name: '常用定制(材质、几何体、流程)', @@ -393,9 +393,9 @@ const customTemplate = { path: '/pages/template/xr-template-toon/index', }, { - name: 'Effect', - label: '自定义PBR渲染', - path: '/pages/template/xr-template-pbr/index', + name: 'Effect', + label: '自定义PBR渲染', + path: '/pages/template/xr-template-pbr/index', }, { name: 'Effect', @@ -413,7 +413,7 @@ const customTemplate = { path: '/pages/template/xr-template-removeBlack/index', }, ], -}; +} const gltfEditTemplate = { name: 'glTF动态修改', @@ -445,7 +445,7 @@ const gltfEditTemplate = { path: '/pages/template/xr-template-blendDouble/index', }, ], -}; +} const toolTemplate = { name: '通用基础能力', @@ -467,9 +467,9 @@ const toolTemplate = { // path: '/pages/template/xr-template-volumeVideo/index', // }, { - name: 'Dissolve', - label: '消融特效', - path: '/pages/template/xr-template-dissolve/index', + name: 'Dissolve', + label: '消融特效', + path: '/pages/template/xr-template-dissolve/index', } // { // name: 'Video', @@ -482,7 +482,7 @@ const toolTemplate = { // path: '/pages/template/xr-template-featherVideo/index', // }, ] -}; +} const classic = { name: 'AR典型案例', @@ -519,8 +519,7 @@ const classic = { path: '/pages/ar-classic/scene-classic-wxball/index', } ], -}; - +} const scan = { name: '扫描还原案例', @@ -537,7 +536,7 @@ const scan = { path: '/pages/scan/scene-scan-team/index', } ], -}; +} const production = { name: '产品级案例', @@ -554,6 +553,6 @@ const production = { path: '/pages/scene-last-record/index' } ] -}; +} -export default [base, ar, gltf, physics, particle, customParticle, custom, messageTemplate, arTemplate, customTemplate, gltfEditTemplate, toolTemplate, classic, scan, production]; +export default [base, ar, gltf, physics, particle, customParticle, custom, messageTemplate, arTemplate, customTemplate, gltfEditTemplate, toolTemplate, classic, scan, production] diff --git a/miniprogram/packageXRFrame/pages/index/index.js b/miniprogram/packageXRFrame/pages/index/index.js index 30949960..04be2fe9 100644 --- a/miniprogram/packageXRFrame/pages/index/index.js +++ b/miniprogram/packageXRFrame/pages/index/index.js @@ -1,23 +1,23 @@ // 自定义组件 -import '../../xr-custom/components/AutoRotate'; -import '../../xr-custom/components/Particle/SystemProperty/BasicParticle'; -import '../../xr-custom/components/Particle/index'; -import '../../xr-custom/elements/xr-auto-rotate-touchable-gltf'; -import '../../xr-custom/elements/xr-custom-particle'; +import '../../xr-custom/components/AutoRotate' +import '../../xr-custom/components/Particle/SystemProperty/BasicParticle' +import '../../xr-custom/components/Particle/index' +import '../../xr-custom/elements/xr-auto-rotate-touchable-gltf' +import '../../xr-custom/elements/xr-custom-particle' // 自定义Geometry -import '../../xr-custom/assets/geometry-star'; -import '../../xr-custom/assets/geometry-specialCylinder'; +import '../../xr-custom/assets/geometry-star' +import '../../xr-custom/assets/geometry-specialCylinder' // 自定义材质 -import '../../xr-custom/elements/xr-shining-star'; +import '../../xr-custom/elements/xr-shining-star' // 自定义effect -import '../../xr-custom/assets/effect-shining'; -import '../../xr-custom/assets/effect-last-record-final'; +import '../../xr-custom/assets/effect-shining' +import '../../xr-custom/assets/effect-last-record-final' -import list from './data/index'; +import list from './data/index' -let lastOpened = false; -let lastCount = 0; -let first = true; +let lastOpened = false +let lastCount = 0 +let first = true Page({ data: { @@ -26,11 +26,11 @@ Page({ }, onLoad() { if (first) { - console.log('Entry xr-frame index page'); - wx.reportEvent("xr_frame", { - "xr_page_path": '/pages/index/index' - }); - first = false; + console.log('Entry xr-frame index page') + wx.reportEvent('xr_frame', { + xr_page_path: '/pages/index/index' + }) + first = false } }, onShareAppMessage() { @@ -44,16 +44,16 @@ Page({ } }, clickHandle(e) { - let root = this.data.root; - let { name, path } = e.detail.item; + const root = this.data.root + const { name, path } = e.detail.item if (!path) { - return; + return } if (path === '/pages/scene-last-record/index') { - this.handleLastRecord(); - return; + this.handleLastRecord() + return } if (path) { @@ -63,52 +63,52 @@ Page({ }, fail: () => { }, - }); + }) } }, - handleLastRecord: async function () { + async handleLastRecord() { if (lastOpened) { - return; + return } - lastCount += 1; + lastCount += 1 // if (Math.random() >= (0.34 + lastCount * 0.1)) { // return; // } - let root = this.data.root; - lastOpened = true; + const root = this.data.root + lastOpened = true wx.request({ url: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-gate.txt', - success: function (res) { + success(res) { wx.showModal({ title: '一把钥匙', content: res.data, confirmText: '探寻真实', cancelText: '放下钥匙', - success: function(res) { + success(res) { if (res.cancel) { wx.onAppShow((result) => { - lastOpened = false; - }); - return; + lastOpened = false + }) + return } wx.navigateTo({ url: root + '/pages/scene-last-record/index', success: () => { wx.onAppShow((result) => { - lastOpened = false; - }); + lastOpened = false + }) } - }); + }) } - }); + }) }, - fail: function (err) { - lastOpened = false; + fail(err) { + lastOpened = false } - }); + }) } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-custom/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-custom/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-custom/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-custom/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-firework/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-firework/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-firework/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-firework/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-meshEmitter/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-meshEmitter/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-meshEmitter/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-meshEmitter/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-orb/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-orb/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-orb/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-orb/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-portal/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-portal/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-portal/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-portal/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/particle/scene-particle-shapeEmitter/index.js b/miniprogram/packageXRFrame/pages/particle/scene-particle-shapeEmitter/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/particle/scene-particle-shapeEmitter/index.js +++ b/miniprogram/packageXRFrame/pages/particle/scene-particle-shapeEmitter/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/physics/scene-physics-shoot/index.js b/miniprogram/packageXRFrame/pages/physics/scene-physics-shoot/index.js index 0406bb2d..5082cb35 100644 --- a/miniprogram/packageXRFrame/pages/physics/scene-physics-shoot/index.js +++ b/miniprogram/packageXRFrame/pages/physics/scene-physics-shoot/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/physics/scene-physics-throw/index.js b/miniprogram/packageXRFrame/pages/physics/scene-physics-throw/index.js index 8060207f..2abca253 100644 --- a/miniprogram/packageXRFrame/pages/physics/scene-physics-throw/index.js +++ b/miniprogram/packageXRFrame/pages/physics/scene-physics-throw/index.js @@ -1,10 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', arDetected: false, @@ -13,16 +13,16 @@ Page({ handleARDetected() { this.setData({ arDetected: true - }); + }) }, handleThrowStart() { this.setData({ throwing: true - }); + }) }, handleThrowEnd() { this.setData({ throwing: false - }); + }) } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/scan/scene-scan-render/index.js b/miniprogram/packageXRFrame/pages/scan/scene-scan-render/index.js index 537df11a..b17c4251 100644 --- a/miniprogram/packageXRFrame/pages/scan/scene-scan-render/index.js +++ b/miniprogram/packageXRFrame/pages/scan/scene-scan-render/index.js @@ -1,29 +1,28 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML -var xmlCode = ``; +const xmlCode = '' - -var envWords = [ - "TiT创意园白天", - "TiT创意园晚上", - "海边夕阳", -]; +const envWords = [ + 'TiT创意园白天', + 'TiT创意园晚上', + '海边夕阳', +] Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
', envIndex: 0, - envWord: "TiT创意园白天", + envWord: 'TiT创意园白天', }, - handleEnv0: function() { - this.setData({envIndex: 0, envWord: envWords[0]}); + handleEnv0() { + this.setData({ envIndex: 0, envWord: envWords[0] }) }, - handleEnv1: function() { - this.setData({envIndex: 1, envWord: envWords[1]}); + handleEnv1() { + this.setData({ envIndex: 1, envWord: envWords[1] }) }, - handleEnv2: function() { - this.setData({envIndex: 2, envWord: envWords[2]}); + handleEnv2() { + this.setData({ envIndex: 2, envWord: envWords[2] }) } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/scan/scene-scan-team/index.js b/miniprogram/packageXRFrame/pages/scan/scene-scan-team/index.js index de53884b..f20b9b24 100644 --- a/miniprogram/packageXRFrame/pages/scan/scene-scan-team/index.js +++ b/miniprogram/packageXRFrame/pages/scan/scene-scan-team/index.js @@ -1,27 +1,27 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', loaded: false, run: false, positions: [[0, 0, '瞬光'], [0, 0, 'roam'], [0, 0, 'xinyi']], }, - handleLoaded: function({detail}) { - console.log('assets loaded', detail); + handleLoaded({ detail }) { + console.log('assets loaded', detail) - this.setData({loaded: true}); + this.setData({ loaded: true }) }, - handleSyncPositions: function({detail}) { - const info = detail; - this.setData({positions: info}); + handleSyncPositions({ detail }) { + const info = detail + this.setData({ positions: info }) }, - handleRun: function() { + handleRun() { if (this.data.loaded && !this.data.run) { - this.setData({run: true}); + this.setData({ run: true }) } } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/scene-beside-edge/index.js b/miniprogram/packageXRFrame/pages/scene-beside-edge/index.js index c5071c51..646e6525 100644 --- a/miniprogram/packageXRFrame/pages/scene-beside-edge/index.js +++ b/miniprogram/packageXRFrame/pages/scene-beside-edge/index.js @@ -1,35 +1,45 @@ Page({ data: { - width: 300, height: 300, - renderWidth: 300, renderHeight: 300, - showDialog: false, name: '', text: '', bg: 'rgba(0, 0, 0, 0)', - start: '', hint: '', end: '', - showLightButton: false, lightButtonDisable: true, lightProgress: 1, + width: 300, + height: 300, + renderWidth: 300, + renderHeight: 300, + showDialog: false, + name: '', + text: '', + bg: 'rgba(0, 0, 0, 0)', + start: '', + hint: '', + end: '', + showLightButton: false, + lightButtonDisable: true, + lightProgress: 1, nextAction: '' }, onShow() { - wx.hideHomeButton(); + wx.hideHomeButton() }, onHide() { - wx.showHomeButton(); + wx.showHomeButton() }, onLoad() { - const info = wx.getSystemInfoSync(); - const width = info.windowWidth; - const height = info.windowHeight; - const dpi = info.pixelRatio; + const info = wx.getSystemInfoSync() + const width = info.windowWidth + const height = info.windowHeight + const dpi = info.pixelRatio this.setData({ - width, height, + width, + height, renderWidth: width * dpi, renderHeight: height * dpi - }); + }) }, - handleRequireLight: function({detail}) { - const {state, wait} = detail; + handleRequireLight({ detail }) { + const { state, wait } = detail console.log('light', state, wait) if (state === 'hide') { - this.setData({showLightButton: false}); - return; + this.setData({ showLightButton: false }) + return } this.setData({ @@ -37,49 +47,51 @@ Page({ lightButtonDisable: state === 'cd', nextAction: '', lightProgress: state === 'cd' ? 1 - wait : 1 - }); + }) }, - handleRequireDialog: function({detail}) { - const {texts, name, from} = detail; - this.texts = texts; - this.textIndex = 0; - this.from = from; + handleRequireDialog({ detail }) { + const { texts, name, from } = detail + this.texts = texts + this.textIndex = 0 + this.from = from this.setData({ - name: name || '', text: texts[0], showDialog: true, + name: name || '', + text: texts[0], + showDialog: true, bg: from === 'step' ? '#000' : 'rgba(0, 0, 0, 0)' - }); + }) }, - handleClickDialog: function() { - this.textIndex += 1; + handleClickDialog() { + this.textIndex += 1 if (this.textIndex > this.texts.length) { - return; + return } if (this.textIndex === this.texts.length) { - this.setData({text: '', name: '', bg: '#000'}); + this.setData({ text: '', name: '', bg: '#000' }) setTimeout(() => { - this.textIndex = 0; - this.setData({showDialog: false, nextAction: this.from}); - }, 1000); - return; + this.textIndex = 0 + this.setData({ showDialog: false, nextAction: this.from }) + }, 1000) + return } - const text = this.texts[this.textIndex]; - const tmp = /[\s\S]+?\{\{([\s\S]+?)\}\}[\s\S]+?/.exec(text); + const text = this.texts[this.textIndex] + const tmp = /[\s\S]+?\{\{([\s\S]+?)\}\}[\s\S]+?/.exec(text) if (tmp) { - const hint = tmp[1]; - const [start, end] = text.split("{{" + hint + "}}"); - console.log({start, hint, end}) - this.setData({start, hint, end}); + const hint = tmp[1] + const [start, end] = text.split('{{' + hint + '}}') + console.log({ start, hint, end }) + this.setData({ start, hint, end }) } else { - this.setData({text: this.texts[this.textIndex], hint: ''}); + this.setData({ text: this.texts[this.textIndex], hint: '' }) } }, - handleTriggerLight: function() { + handleTriggerLight() { if (this.data.lightButtonDisable) { - return; + return } - this.setData({nextAction: 'light'}); + this.setData({ nextAction: 'light' }) } }) diff --git a/miniprogram/packageXRFrame/pages/scene-last-record/index.js b/miniprogram/packageXRFrame/pages/scene-last-record/index.js index f4e364b0..705f4133 100644 --- a/miniprogram/packageXRFrame/pages/scene-last-record/index.js +++ b/miniprogram/packageXRFrame/pages/scene-last-record/index.js @@ -1,35 +1,38 @@ Page({ data: { - width: 300, height: 300, - renderWidth: 300, renderHeight: 300, + width: 300, + height: 300, + renderWidth: 300, + renderHeight: 300, texts: [] }, onShow() { - wx.hideHomeButton(); + wx.hideHomeButton() }, onHide() { - wx.showHomeButton(); + wx.showHomeButton() }, onLoad() { - const info = wx.getSystemInfoSync(); - const width = info.windowWidth; - const height = info.windowHeight; - const dpi = info.pixelRatio; + const info = wx.getSystemInfoSync() + const width = info.windowWidth + const height = info.windowHeight + const dpi = info.pixelRatio this.setData({ - width, height, + width, + height, renderWidth: width * dpi, renderHeight: height * dpi - }); + }) }, - handleChangeTexts: function({detail}) { - this.setData({texts: detail}); + handleChangeTexts({ detail }) { + this.setData({ texts: detail }) }, - handleShowNote: function({detail}) { + handleShowNote({ detail }) { wx.showModal({ title: '最后的记录', content: detail, showCancel: false, confirmText: '放下记录' - }); + }) } }) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-arGlasses/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-arGlasses/index.js index 42c2db4f..8e7fffdd 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-arGlasses/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-arGlasses/index.js @@ -1,9 +1,10 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; -var xmlCode = ``; +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML + +const xmlCode = '' Page({ behaviors: [sceneReadyBehavior], data: { xmlCode: '
' + handleDecodedXML(xmlCode) + '
' } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-arLine/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-arLine/index.js index 11d7dd43..252261d0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-arLine/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-arLine/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], moveTimes: 0, data: { // 内置 @@ -9,7 +9,7 @@ Page({ heightScale: 0.85, showBackBtn: true, }, - onLoad( ) { + onLoad() { }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-arPreview/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-arPreview/index.js index 11d7dd43..252261d0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-arPreview/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-arPreview/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], moveTimes: 0, data: { // 内置 @@ -9,7 +9,7 @@ Page({ heightScale: 0.85, showBackBtn: true, }, - onLoad( ) { + onLoad() { }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-arui/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-arui/index.js index 11d7dd43..252261d0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-arui/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-arui/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], moveTimes: 0, data: { // 内置 @@ -9,7 +9,7 @@ Page({ heightScale: 0.85, showBackBtn: true, }, - onLoad( ) { + onLoad() { }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-blendDouble/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-blendDouble/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-blendDouble/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-blendDouble/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-control/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-control/index.js index debcfe4f..ad8e2104 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-control/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-control/index.js @@ -1,125 +1,123 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') // 当前触摸点位置 -let currentTouchX = 0; -let currentTouchY = 0; +let currentTouchX = 0 +let currentTouchY = 0 // 触摸点序号 -let rotateIdx = -1; -let moveIdx = -1; +let rotateIdx = -1 +let moveIdx = -1 -//摇杆所处中心 -let centerX = 50; -let centerY = 50; -//摇杆宽高 -let hWidth = 40; -let hHeight = 40; -//摇杆盘半径 -let radius = 50; +// 摇杆所处中心 +const centerX = 50 +const centerY = 50 +// 摇杆宽高 +const hWidth = 40 +const hHeight = 40 +// 摇杆盘半径 +const radius = 50 Page({ behaviors: [sceneReadyBehavior], data: { height: 600, heightScale: 0.8, - //重置初始位置的标记 + // 重置初始位置的标记 reset: 0, - //相对背景偏移,命名 h=handle 摇杆 + // 相对背景偏移,命名 h=handle 摇杆 hTop: 30, hLeft: 30, - transferData:{ - //相对摇杆中心的偏移 + transferData: { + // 相对摇杆中心的偏移 biasX: 0, biasY: 0, - //开始旋转时的基准点 + // 开始旋转时的基准点 initRotX: 0, initRotY: 0, - //旋转时的触摸点位置 + // 旋转时的触摸点位置 biasRotX: 0, biasRotY: 0, } }, - reset: function () { + reset() { this.setData({ - reset: this.data.reset + 1 + reset: this.data.reset + 1 }) }, touchStart(e) {}, - touchMove: function (e) { - //无旋转触摸点触屏时,保证移动触摸点为第一触摸点 + touchMove(e) { + // 无旋转触摸点触屏时,保证移动触摸点为第一触摸点 if (rotateIdx == -1) { - moveIdx = 0; + moveIdx = 0 } else { - //当两点触屏时,保证移动触摸点与旋转触摸点对应的点序列互斥 - moveIdx = ~rotateIdx & 0x01; + // 当两点触屏时,保证移动触摸点与旋转触摸点对应的点序列互斥 + moveIdx = ~rotateIdx & 0x01 } - var touchX = e.touches[moveIdx].clientX - 30; - var touchY = e.touches[moveIdx].clientY - (this.data.height - 100); - var posInfo = this.limitPosition(touchX, touchY); + const touchX = e.touches[moveIdx].clientX - 30 + const touchY = e.touches[moveIdx].clientY - (this.data.height - 100) + const posInfo = this.limitPosition(touchX, touchY) this.setData({ hLeft: centerX - hWidth / 2 + posInfo.posX, - hTop: centerY - hHeight / 2 + posInfo.posY, - transferData:{ + hTop: centerY - hHeight / 2 + posInfo.posY, + transferData: { biasX: posInfo.posX, biasY: posInfo.posY, } }) }, - touchEnd: function (e) { - moveIdx = -1; - //当位移触摸点松开时,保证旋转触摸点取的为第一接触点 - if (rotateIdx == 1) - rotateIdx = 0; + touchEnd(e) { + moveIdx = -1 + // 当位移触摸点松开时,保证旋转触摸点取的为第一接触点 + if (rotateIdx == 1) rotateIdx = 0 this.setData({ hLeft: centerX - hWidth / 2, hTop: centerY - hHeight / 2, - transferData:{ + transferData: { biasX: 0, biasY: 0, } - }); + }) }, - touchRotateStart: function (e) { + touchRotateStart(e) { if (moveIdx == -1) { - rotateIdx = 0; + rotateIdx = 0 } else { - rotateIdx = ~moveIdx & 0x01; + rotateIdx = ~moveIdx & 0x01 } - currentTouchX = e.touches[rotateIdx].clientX; - currentTouchY = e.touches[rotateIdx].clientY; + currentTouchX = e.touches[rotateIdx].clientX + currentTouchY = e.touches[rotateIdx].clientY this.setData({ - transferData:{ + transferData: { initRotX: currentTouchX, initRotY: currentTouchY, } }) }, - touchRotateMove: function (e) { + touchRotateMove(e) { if (moveIdx == -1) { - rotateIdx = 0; + rotateIdx = 0 } else { - rotateIdx = ~moveIdx & 0x01; + rotateIdx = ~moveIdx & 0x01 } - currentTouchX = e.touches[rotateIdx].clientX; - currentTouchY = e.touches[rotateIdx].clientY; + currentTouchX = e.touches[rotateIdx].clientX + currentTouchY = e.touches[rotateIdx].clientY this.setData({ - transferData:{ + transferData: { biasRotX: currentTouchX, biasRotY: currentTouchY, } }) }, - touchRotateEnd: function (e) { - rotateIdx = -1; - //当旋转触摸点松开时,保证位移触摸点取的为第一接触点 - if (moveIdx == 1) - moveIdx = 0; + touchRotateEnd(e) { + rotateIdx = -1 + // 当旋转触摸点松开时,保证位移触摸点取的为第一接触点 + if (moveIdx == 1) moveIdx = 0 this.setData({ - transferData:{ + transferData: { biasRotX: 0, biasRotY: 0, } @@ -127,29 +125,29 @@ Page({ }, // 将位移强度限制在摇杆盘的范围中 - limitPosition: function (touchX, touchY) { - var x = touchX - centerX; - var y = touchY - centerY; - var z = Math.sqrt(x * x + y * y); + limitPosition(touchX, touchY) { + let x = touchX - centerX + let y = touchY - centerY + const z = Math.sqrt(x * x + y * y) // 位移未超出摇杆盘范围时 if (z <= radius) { - x = Math.round(x); - y = Math.round(y); + x = Math.round(x) + y = Math.round(y) return { posX: x, posY: y - }; + } } else { // 位移超出摇杆盘范围,需要对应限制位移强度 - var ratio = radius / z; - x = x * ratio; - y = y * ratio; - x = Math.round(x); - y = Math.round(y); + const ratio = radius / z + x *= ratio + y *= ratio + x = Math.round(x) + y = Math.round(y) return { posX: x, posY: y - }; + } } } -}); \ No newline at end of file +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-dissolve/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-dissolve/index.js index 5f8e4d5d..67724be1 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-dissolve/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-dissolve/index.js @@ -1,30 +1,29 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; - +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { thresHold: 0, autoPlay: false, }, changeThresHold(e) { this.setData({ - autoPlay: false - }); + autoPlay: false + }) this.setData({ - thresHold: e.detail.value - }); + thresHold: e.detail.value + }) }, openAutoPlay(e) { - if(this.data.autoPlay == false){ - this.setData({ - autoPlay: true - }); - }else{ - this.setData({ - autoPlay: false - }); - } + if (this.data.autoPlay == false) { + this.setData({ + autoPlay: true + }) + } else { + this.setData({ + autoPlay: false + }) + } }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-featherVideo/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-featherVideo/index.js index 185988c3..871c35a5 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-featherVideo/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-featherVideo/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { showBackBtn: true, resourceData: { @@ -15,40 +15,40 @@ Page({ // 准备加载数据 }, tapResBtn(event) { - const dataSet = event.target.dataset; - const src = dataSet.src; - const index = dataSet.index; - let onFlags = this.data.onFlags; - onFlags = !onFlags; - let videoListNew; - if(onFlags){ - videoListNew = this.data.videoList; + const dataSet = event.target.dataset + const src = dataSet.src + const index = dataSet.index + let onFlags = this.data.onFlags + onFlags = !onFlags + let videoListNew + if (onFlags) { + videoListNew = this.data.videoList videoListNew.push({ id: index, - src: src - }); + src + }) } else { - let matchIndex = -1; + let matchIndex = -1 for (let i = 0; i < this.data.videoList.length; i++) { - if (this.data.videoList[i] && src === this.data.videoList[i].src) { - matchIndex = i; - break; + if (this.data.videoList[i] && src === this.data.videoList[i].src) { + matchIndex = i + break } } - this.data.videoList.splice(matchIndex, 1); - videoListNew = this.data.videoList; + this.data.videoList.splice(matchIndex, 1) + videoListNew = this.data.videoList } this.setData({ videoList: videoListNew, - onFlags: onFlags - }); + onFlags + }) }, handleInfoListener(cur) { - const detail = cur.detail; + const detail = cur.detail this.setData({ - }); + }) } - -}); + +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-frameEffect/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-frameEffect/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-frameEffect/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-frameEffect/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-geometry/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-geometry/index.js index db5d9793..975a43be 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-geometry/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-geometry/index.js @@ -1,8 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { dpiScale: 1 } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-gltfAnimation/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-gltfAnimation/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-gltfAnimation/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-gltfAnimation/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-gltfEdit/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-gltfEdit/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-gltfEdit/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-gltfEdit/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-gltfOcclusion/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-gltfOcclusion/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-gltfOcclusion/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-gltfOcclusion/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-gltfUVAnimation/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-gltfUVAnimation/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-gltfUVAnimation/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-gltfUVAnimation/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-loading/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-loading/index.js index e71c93bb..3e41aef3 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-loading/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-loading/index.js @@ -1,14 +1,14 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { showBackBtn: true, resourceData: { }, onFlags: [ false, false, // gltf - false, false, // image + false, false, // image false, false, false // video ], gltfList: [], @@ -19,99 +19,98 @@ Page({ // 准备加载数据 }, tapResBtn(event) { - const dataSet = event.target.dataset; + const dataSet = event.target.dataset // console.log(event); - const onFlags = this.data.onFlags; + const onFlags = this.data.onFlags - const src = dataSet.src; - const index = parseInt(dataSet.index); + const src = dataSet.src + const index = parseInt(dataSet.index) - onFlags[index] = !onFlags[index]; + onFlags[index] = !onFlags[index] switch (dataSet.type) { case 'gltf': - let gltfListNew; + let gltfListNew if (onFlags[index]) { - gltfListNew = this.data.gltfList; + gltfListNew = this.data.gltfList gltfListNew.push({ id: index, - src: src - }); + src + }) } else { - let matchIndex = -1; + let matchIndex = -1 for (let i = 0; i < this.data.gltfList.length; i++) { - if (this.data.gltfList[i] && src === this.data.gltfList[i].src) { - matchIndex = i; - break; + if (this.data.gltfList[i] && src === this.data.gltfList[i].src) { + matchIndex = i + break } } - this.data.gltfList.splice(matchIndex, 1); - gltfListNew = this.data.gltfList; + this.data.gltfList.splice(matchIndex, 1) + gltfListNew = this.data.gltfList } this.setData({ gltfList: gltfListNew, - onFlags: onFlags - }); - break; + onFlags + }) + break case 'image': - let imageListNew; + let imageListNew if (onFlags[index]) { - imageListNew = this.data.imageList; + imageListNew = this.data.imageList imageListNew.push({ id: index, - src: src - }); + src + }) } else { - let matchIndex = -1; + let matchIndex = -1 for (let i = 0; i < this.data.imageList.length; i++) { - if (this.data.imageList[i] && src === this.data.imageList[i].src) { - matchIndex = i; - break; + if (this.data.imageList[i] && src === this.data.imageList[i].src) { + matchIndex = i + break } } - this.data.imageList.splice(matchIndex, 1); - imageListNew = this.data.imageList; + this.data.imageList.splice(matchIndex, 1) + imageListNew = this.data.imageList } this.setData({ imageList: imageListNew, - onFlags: onFlags - }); + onFlags + }) break case 'video': - let videoListNew; + let videoListNew if (onFlags[index]) { - videoListNew = this.data.videoList; + videoListNew = this.data.videoList videoListNew.push({ id: index, - src: src - }); + src + }) } else { - let matchIndex = -1; + let matchIndex = -1 for (let i = 0; i < this.data.videoList.length; i++) { - if (this.data.videoList[i] && src === this.data.videoList[i].src) { - matchIndex = i; - break; + if (this.data.videoList[i] && src === this.data.videoList[i].src) { + matchIndex = i + break } } - this.data.videoList.splice(matchIndex, 1); - videoListNew = this.data.videoList; + this.data.videoList.splice(matchIndex, 1) + videoListNew = this.data.videoList } this.setData({ videoList: videoListNew, - onFlags: onFlags - }); + onFlags + }) break default: - break; + break } - }, handleInfoListener(cur) { - const detail = cur.detail; + const detail = cur.detail this.setData({ - }); + }) } - -}); + +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-lookat/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-lookat/index.js index 11d7dd43..252261d0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-lookat/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-lookat/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], moveTimes: 0, data: { // 内置 @@ -9,7 +9,7 @@ Page({ heightScale: 0.85, showBackBtn: true, }, - onLoad( ) { + onLoad() { }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-markerCenter/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-markerCenter/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-markerCenter/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-markerCenter/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-markerLock/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-markerLock/index.js index 40a7af9c..655282b0 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-markerLock/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-markerLock/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { xmlCode: '', } -}); - +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-message/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-message/index.js index f4f86ef1..9afeb9d2 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-message/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-message/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { messageData: { moveX: 0, @@ -17,9 +17,9 @@ Page({ this.setData({ messageData: { moveX: this.data.messageData.moveX + 1, - moveZ: this.data.messageData.moveZ + moveZ: this.data.messageData.moveZ } - }); + }) }, tapSubX() { this.setData({ @@ -27,7 +27,7 @@ Page({ moveX: this.data.messageData.moveX - 1, moveZ: this.data.messageData.moveZ } - }); + }) }, tapPlusZ() { this.setData({ @@ -35,7 +35,7 @@ Page({ moveX: this.data.messageData.moveX, moveZ: this.data.messageData.moveZ + 1, } - }); + }) }, tapSubZ() { this.setData({ @@ -43,7 +43,7 @@ Page({ moveX: this.data.messageData.moveX, moveZ: this.data.messageData.moveZ - 1, } - }); + }) }, tapClose() { this.setData({ @@ -51,14 +51,14 @@ Page({ }) }, handleInfoListener(cur) { - const detail = cur.detail; + const detail = cur.detail this.setData({ speedX: detail.speedX, speedZ: detail.speedZ, posX: detail.posX, posZ: detail.posZ - }); + }) } - -}); + +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-pbr/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-pbr/index.js index 50f3845e..dd75c6b7 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-pbr/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-pbr/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); - // 加载toonEffect -import '../../../xr-custom/assets/standard-shader/customPBR'; +import '../../../xr-custom/assets/standard-shader/customPBR' + +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { dpiScale: 1 } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-planeShadow/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-planeShadow/index.js index fe5ab735..01ed785e 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-planeShadow/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-planeShadow/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); - // 加载 planeShadow Effect -import '../../../xr-custom/assets/effect-planeShadow'; +import '../../../xr-custom/assets/effect-planeShadow' + +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { dpiScale: 1 } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-removeBlack/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-removeBlack/index.js index 1b786fd9..0d660f8d 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-removeBlack/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-removeBlack/index.js @@ -1,9 +1,9 @@ -import '../../../xr-custom/assets/effect-removeBlack'; +import '../../../xr-custom/assets/effect-removeBlack' -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-select/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-select/index.js index 68d77a98..f3359b4b 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-select/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-select/index.js @@ -1,85 +1,84 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { - menu:[], + menu: [], radius: 80 }, - touchEnd: function (e) { - moveIdx = -1; - //当位移触摸点松开时,保证旋转触摸点取的为第一接触点 - if (rotateIdx == 1) - rotateIdx = 0; + touchEnd(e) { + moveIdx = -1 + // 当位移触摸点松开时,保证旋转触摸点取的为第一接触点 + if (rotateIdx == 1) rotateIdx = 0 this.setData({ hLeft: centerX - hWidth / 2, hTop: centerY - hHeight / 2, - transferData:{ + transferData: { biasX: 0, biasY: 0, } - }); + }) }, - animateChoose: function(e) { - console.log("choose:", e.currentTarget.dataset.index) + animateChoose(e) { + console.log('choose:', e.currentTarget.dataset.index) this.setData({ itemIndex: e.currentTarget.dataset.index }) }, - processMenu: function(){ - - var positionX = (this.data.touchPos.x + 1) / 2 * this.data.width; - var positionY = (1 - (this.data.touchPos.y + 1) / 2) * this.data.height; - var radius = this.data.radius * this.data.len; - var item = []; - var animLength = this.data.clipName.length - var offsetAngle - if(animLength > 6 ){ + processMenu() { + const positionX = (this.data.touchPos.x + 1) / 2 * this.data.width + const positionY = (1 - (this.data.touchPos.y + 1) / 2) * this.data.height + const radius = this.data.radius * this.data.len + const item = [] + const animLength = this.data.clipName.length + let offsetAngle + if (animLength > 6) { offsetAngle = 2 * Math.PI / animLength - }else{ + } else { offsetAngle = Math.PI / animLength } - - var originAngle = - Math.PI / 2; - for(var i = 0; i < animLength; i++){ - var x = radius * Math.cos( originAngle + i * offsetAngle); - var y = radius * Math.sin( originAngle + i * offsetAngle); + const originAngle = -Math.PI / 2 + + for (let i = 0; i < animLength; i++) { + const x = radius * Math.cos(originAngle + i * offsetAngle) + const y = radius * Math.sin(originAngle + i * offsetAngle) - var text; - switch(i){ + var text + switch (i) { case 0: - text = "暂停" + text = '暂停' break case 1: - text = "继续" + text = '继续' break default: - text = this.data.clipName[i-2] + text = this.data.clipName[i - 2] break } - item.push({"index": i, "x":positionX, "y":positionY, "biasX": x, "biasY":y,"text":text}); + item.push({ + index: i, x: positionX, y: positionY, biasX: x, biasY: y, text + }) } this.setData({ - menu:item - }); + menu: item + }) }, handleInfoListener(cur) { - const detail = cur.detail; + const detail = cur.detail // console.log("receive:", detail) - if(detail.clipName){ + if (detail.clipName) { this.setData({ clipName: detail.clipName }) } - if(detail.position){ + if (detail.position) { this.setData({ touchPos: detail.position, len: detail.len }) this.processMenu() } - } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-share/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-share/index.js index a608ce8d..de7137ba 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-share/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-share/index.js @@ -1,9 +1,8 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; - +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-textEdit/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-textEdit/index.js index 9146bc35..a8214b09 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-textEdit/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-textEdit/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-toon/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-toon/index.js index 9b6d78bc..7bc837bb 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-toon/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-toon/index.js @@ -1,11 +1,11 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); - // 加载toonEffect -import '../../../xr-custom/assets/effect-toon'; +import '../../../xr-custom/assets/effect-toon' + +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { dpiScale: 1 } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-tracker/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-tracker/index.js index 9330e08d..c2c43e05 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-tracker/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-tracker/index.js @@ -1,7 +1,7 @@ -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], moveTimes: 0, data: { // 内置 @@ -25,8 +25,8 @@ Page({ // Debug debugMsg: 'Defalut Words', }, - onLoad( ) { - this.refreshData(); + onLoad() { + this.refreshData() }, resetData() { this.setData({ @@ -39,9 +39,9 @@ Page({ }) }, refreshData() { - this.resetData(); + this.resetData() // 模拟用的数据集合,可以跟进需要切换为后端接口 - const mockDataList = []; + const mockDataList = [] // 识别框 if (this.data.useScan) { @@ -50,7 +50,7 @@ Page({ markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/wxball.jpg', type: 'scan', src: '', - }); + }) } // glTF模型 @@ -60,7 +60,7 @@ Page({ markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/portalImage.jpg', type: 'gltf', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/fiesta_tea/scene.gltf', - }); + }) } // 视频 @@ -70,7 +70,7 @@ Page({ markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/2dmarker-test.jpg', type: 'video', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/videos/cat.mp4', - }); + }) } if (this.data.useVideo2) { @@ -79,7 +79,7 @@ Page({ markerImg: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/osdmarker-test.jpg', type: 'video', src: 'https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/videos/paris.mp4', - }); + }) } // 需要使用的marker @@ -89,9 +89,8 @@ Page({ let videoIndex = 0 let gltfIndex = 0 - for (let i = 0; i < mockDataList.length; i++) { - const mockItem = mockDataList[i]; + const mockItem = mockDataList[i] switch (mockItem.type) { case 'scan': // scan const scanId = 'scan' + scanIndex @@ -101,9 +100,9 @@ Page({ renderType: mockItem.type, markerImage: mockItem.markerImg, src: mockItem.src, - }); - scanIndex++; - break; + }) + scanIndex++ + break case 'video': // video const videoId = 'video' + videoIndex markerList.push({ @@ -112,9 +111,9 @@ Page({ renderType: mockItem.type, markerImage: mockItem.markerImg, src: mockItem.src, - }); - videoIndex++; - break; + }) + videoIndex++ + break case 'gltf': // gltf const gltfId = 'gltf' + gltfIndex markerList.push({ @@ -123,18 +122,18 @@ Page({ renderType: mockItem.type, markerImage: mockItem.markerImg, src: mockItem.src, - }); - gltfIndex++; - break; + }) + gltfIndex++ + break } } - console.log('markerList', markerList); + console.log('markerList', markerList) this.setData({ dataReady: true, - markerList: markerList - }); + markerList + }) this.setData({ debugMsg: 'markerList:' + markerList.length @@ -143,33 +142,33 @@ Page({ tapScan() { this.setData({ useScan: !this.data.useScan - }); + }) - this.refreshData(); + this.refreshData() }, tapGLTF() { this.setData({ useGLTF: !this.data.useGLTF - }); + }) - this.refreshData(); + this.refreshData() }, tapVideo1() { this.setData({ useVideo1: !this.data.useVideo1 - }); + }) - this.refreshData(); + this.refreshData() }, tapVideo2() { this.setData({ useVideo2: !this.data.useVideo2 - }); + }) - this.refreshData(); + this.refreshData() }, handleTrackerChange(cur) { - const item = cur.detail; + const item = cur.detail this.setData({ debugMsg: 'handleTrackerChange:' + item.name }) @@ -177,7 +176,7 @@ Page({ handleTrackerMove(cur) { const detail = cur.detail const trackerInfo = detail.trackerInfo - + this.moveTimes++ if (detail.type === 'scan') { @@ -197,4 +196,4 @@ Page({ } } }, -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/index.js b/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/index.js index 5f63d3da..fca3a24e 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/index.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/index.js @@ -1,10 +1,10 @@ -import './planeShadow'; -var sceneReadyBehavior = require('../../behavior-scene/scene-ready'); -var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML; +import './planeShadow' +const sceneReadyBehavior = require('../../behavior-scene/scene-ready') +const handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML Page({ - behaviors:[sceneReadyBehavior], + behaviors: [sceneReadyBehavior], data: { } -}); +}) diff --git a/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/planeShadow.js b/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/planeShadow.js index 314ef6f6..1ce85a83 100644 --- a/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/planeShadow.js +++ b/miniprogram/packageXRFrame/pages/template/xr-template-volumeVideo/planeShadow.js @@ -1,7 +1,7 @@ -const xrFrameSystem = wx.getXrFrameSystem(); +const xrFrameSystem = wx.getXrFrameSystem() xrFrameSystem.registerEffect('plane-shadow', scene => scene.createEffect({ - name: "plane-shadow", + name: 'plane-shadow', properties: [ // 需保证,至少存在一个properties用于创建effect共享内存 { @@ -13,17 +13,17 @@ xrFrameSystem.registerEffect('plane-shadow', scene => scene.createEffect({ images: [], defaultRenderQueue: 3000, passes: [{ - "renderStates": { + renderStates: { cullOn: false, blendOn: true, }, - lightMode: "ForwardBase", + lightMode: 'ForwardBase', useMaterialRenderStates: true, shaders: [0, 1] }], shaders: [ -// Vertex -`#version 100 + // Vertex + `#version 100 uniform highp mat4 u_view; uniform highp mat4 u_viewInverse; uniform highp mat4 u_vp; @@ -44,8 +44,8 @@ void main() #endif gl_Position = u_projection * u_view * worldPosition; }`, -// Fragemenet -`#version 100 + // Fragemenet + `#version 100 precision mediump float; precision highp int; varying highp vec2 v_UV; @@ -104,4 +104,4 @@ void main() gl_FragData[0] = result; } `], -})); \ No newline at end of file +})) diff --git a/miniprogram/packageXRFrame/xr-custom/assets/effect-toon.js b/miniprogram/packageXRFrame/xr-custom/assets/effect-toon.js index 661a51b5..ab47700c 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/effect-toon.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/effect-toon.js @@ -1,77 +1,78 @@ -import outlineVert from './toon-shader/outlineVert'; -import outlineFrag from './toon-shader/outlineFrag'; -import toonVert from './toon-shader/toonVert'; -import toonFrag from './toon-shader/toonFrag'; -const xrFrameSystem = wx.getXrFrameSystem(); +import outlineVert from './toon-shader/outlineVert' +import outlineFrag from './toon-shader/outlineFrag' +import toonVert from './toon-shader/toonVert' +import toonFrag from './toon-shader/toonFrag' + +const xrFrameSystem = wx.getXrFrameSystem() xrFrameSystem.registerEffect('toon-user', scene => scene.createEffect( { - name: "toon", + name: 'toon', defaultRenderQueue: 2000, passes: [ - // Outline - { - renderStates: { - blendOn: false, - depthWrite: true, - // Default FrontFace is CW - cullOn: true, - cullFace: xrFrameSystem.ECullMode.BACK, - }, - lightMode: "ForwardBase", - useMaterialRenderStates: false, - shaders: [0, 1] + // Outline + { + renderStates: { + blendOn: false, + depthWrite: true, + // Default FrontFace is CW + cullOn: true, + cullFace: xrFrameSystem.ECullMode.BACK, }, - // ForwardBase - { - renderStates: { - blendOn: false, - depthWrite: true, - // Default FrontFace is CW - cullOn: false, - cullFace: xrFrameSystem.ECullMode.NONE, - }, - lightMode: "ForwardBase", - useMaterialRenderStates: true, - shaders: [2, 3] + lightMode: 'ForwardBase', + useMaterialRenderStates: false, + shaders: [0, 1] + }, + // ForwardBase + { + renderStates: { + blendOn: false, + depthWrite: true, + // Default FrontFace is CW + cullOn: false, + cullFace: xrFrameSystem.ECullMode.NONE, }, - { - renderStates: { - cullOn: true, - blendOn: false, - depthWrite: true, - cullFace: xrFrameSystem.ECullMode.FRONT, - }, - lightMode: 'ShadowCaster', - useMaterialRenderStates: false, - shaders: [4, 5] + lightMode: 'ForwardBase', + useMaterialRenderStates: true, + shaders: [2, 3] + }, + { + renderStates: { + cullOn: true, + blendOn: false, + depthWrite: true, + cullFace: xrFrameSystem.ECullMode.FRONT, }, + lightMode: 'ShadowCaster', + useMaterialRenderStates: false, + shaders: [4, 5] + }, ], properties: [ - { key: 'u_baseColorFactor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 1, 1, 1] }, - { key: 'u_outlineColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [0.0, 0.0, 0.0, 0.0]}, - // { key: 'u_outlineWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [0.3]}, - { key: 'u_outlineWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [1.0]}, - { key: 'u_farthestDistance', type: xrFrameSystem.EUniformType.FLOAT, default: [100]}, - { key: 'u_nearestDistance', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5]}, - { key: 'u_offsetZ', type: xrFrameSystem.EUniformType.FLOAT, default: [2.0]} + { key: 'u_baseColorFactor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 1, 1, 1] }, + { key: 'u_outlineColor', type: xrFrameSystem.EUniformType.FLOAT4, default: [0.0, 0.0, 0.0, 0.0] }, + // { key: 'u_outlineWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [0.3]}, + { key: 'u_outlineWidth', type: xrFrameSystem.EUniformType.FLOAT, default: [1.0] }, + { key: 'u_farthestDistance', type: xrFrameSystem.EUniformType.FLOAT, default: [100] }, + { key: 'u_nearestDistance', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5] }, + { key: 'u_offsetZ', type: xrFrameSystem.EUniformType.FLOAT, default: [2.0] } ], images: [ - { key: 'u_baseColorMap', default: 'white', macro: 'WX_USE_BASECOLORMAP' }, - { key: 'u_gradientMap', default: 'white' } + { key: 'u_baseColorMap', default: 'white', macro: 'WX_USE_BASECOLORMAP' }, + { key: 'u_gradientMap', default: 'white' } ], shaders: [ - // === Outline === - // Vertex Shader Outline - outlineVert, - // Fragment Shader Outline - outlineFrag, - // === Toon === - // Vertex Shader Toon - toonVert, - // Fragment Shader Toon - toonFrag, - `#version 100 + // === Outline === + // Vertex Shader Outline + outlineVert, + // Fragment Shader Outline + outlineFrag, + // === Toon === + // Vertex Shader Toon + toonVert, + // Fragment Shader Toon + toonFrag, + `#version 100 uniform highp mat4 u_world; uniform highp mat4 u_lightSpaceMatrix; @@ -92,7 +93,7 @@ xrFrameSystem.registerEffect('toon-user', scene => scene.createEffect( gl_Position = lightPos; }`, - `#version 100 + `#version 100 precision mediump float; precision highp int; varying highp vec2 v_uv; @@ -122,5 +123,5 @@ xrFrameSystem.registerEffect('toon-user', scene => scene.createEffect( } ` ] -} -)); \ No newline at end of file + } +)) diff --git a/miniprogram/packageXRFrame/xr-custom/assets/geometry-specialCylinder.js b/miniprogram/packageXRFrame/xr-custom/assets/geometry-specialCylinder.js index 2c70cfaf..88bca923 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/geometry-specialCylinder.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/geometry-specialCylinder.js @@ -1,56 +1,51 @@ -const vBufferSpecialCylinder = new Float32Array([-5.678913339579594e-9,-0.10497161746025085,-1,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,-1,0.08775380253791809,0.44548821449279785,-0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.19509032368659973,-0.10497161746025085,-0.9807852506637573,0.08775380253791809,0.44548821449279785,-0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.19509032368659973,-0.10497161746025085,-0.9807852506637573,0.25988829135894775,0.44548869132995605,-0.8567367792129517,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.3826834261417389,-0.10497161746025085,-0.9238795042037964,0.25988829135894775,0.44548869132995605,-0.8567367792129517,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.3826834261417389,-0.10497161746025085,-0.9238795042037964,0.42203545570373535,0.44548848271369934,-0.7895733714103699,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.5555702447891235,-0.10497161746025085,-0.8314695954322815,0.42203545570373535,0.44548848271369934,-0.7895733714103699,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.5555702447891235,-0.10497161746025085,-0.8314695954322815,0.5679646134376526,0.44548842310905457,-0.6920666098594666,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.7071067690849304,-0.10497161746025085,-0.7071067690849304,0.5679646134376526,0.44548842310905457,-0.6920666098594666,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.7071067690849304,-0.10497161746025085,-0.7071067690849304,0.6920667886734009,0.4454883933067322,-0.5679644346237183,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.8314695954322815,-0.10497161746025085,-0.5555702447891235,0.6920667886734009,0.4454883933067322,-0.5679644346237183,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.8314695954322815,-0.10497161746025085,-0.5555702447891235,0.7895731925964355,0.4454883635044098,-0.42203593254089355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9238795042037964,-0.10497161746025085,-0.3826834261417389,0.7895731925964355,0.4454883635044098,-0.42203593254089355,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9238795042037964,-0.10497161746025085,-0.3826834261417389,0.856736958026886,0.4454883933067322,-0.2598881423473358,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,-0.19509030878543854,0.856736958026886,0.4454883933067322,-0.2598881423473358,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9807852506637573,-0.10497161746025085,-0.19509030878543854,0.8909766674041748,0.4454883337020874,-0.0877537727355957,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,1,-0.10497161746025085,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,-0.0877537727355957,1.0009496212005615,0.0009514093399047852,0,0,0,0,1,-0.10497161746025085,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,0.0877537727355957,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,0.19509033858776093,0.856736958026886,0.44548842310905457,0.2598881423473358,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9807852506637573,-0.10497161746025085,0.19509033858776093,0.8909766674041748,0.4454883337020874,0.0877537727355957,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.9238795042037964,-0.10497161746025085,0.38268348574638367,0.7895732522010803,0.44548821449279785,0.4220360517501831,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.9238795042037964,-0.10497161746025085,0.38268348574638367,0.856736958026886,0.44548842310905457,0.2598881423473358,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.8314695954322815,-0.10497161746025085,0.5555702447891235,0.6920667886734009,0.4454882740974426,0.5679645538330078,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.8314695954322815,-0.10497161746025085,0.5555702447891235,0.7895732522010803,0.44548821449279785,0.4220360517501831,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.7071067690849304,-0.10497161746025085,0.7071067690849304,0.5679647326469421,0.4454883635044098,0.6920666694641113,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.7071067690849304,-0.10497161746025085,0.7071067690849304,0.6920667886734009,0.4454882740974426,0.5679645538330078,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.5555702447891235,-0.10497161746025085,0.8314695954322815,0.4220355749130249,0.4454882740974426,0.7895734310150146,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.5555702447891235,-0.10497161746025085,0.8314695954322815,0.5679647326469421,0.4454883635044098,0.6920666694641113,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.3826834261417389,-0.10497161746025085,0.9238795042037964,0.25988829135894775,0.44548851251602173,0.8567368388175964,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.3826834261417389,-0.10497161746025085,0.9238795042037964,0.4220355749130249,0.4454882740974426,0.7895734310150146,1.0009496212005615,0.0009514093399047852,0,0,0,0,0.19509032368659973,-0.10497161746025085,0.9807852506637573,0.08775380253791809,0.44548818469047546,0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,0.19509032368659973,-0.10497161746025085,0.9807852506637573,0.25988829135894775,0.44548851251602173,0.8567368388175964,1.0009496212005615,0.0009514093399047852,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,1,-0.08775380253791809,0.44548821449279785,0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-5.678913339579594e-9,-0.10497161746025085,1,0.08775380253791809,0.44548818469047546,0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.19509032368659973,-0.10497161746025085,0.9807852506637573,-0.25988826155662537,0.445488303899765,0.8567370772361755,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.19509032368659973,-0.10497161746025085,0.9807852506637573,-0.08775380253791809,0.44548821449279785,0.8909766674041748,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.38268348574638367,-0.10497161746025085,0.9238795042037964,-0.4220356345176697,0.44548842310905457,0.7895733118057251,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.38268348574638367,-0.10497161746025085,0.9238795042037964,-0.25988826155662537,0.445488303899765,0.8567370772361755,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.5555702447891235,-0.10497161746025085,0.8314695954322815,-0.5679647326469421,0.4454881548881531,0.6920667290687561,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.5555702447891235,-0.10497161746025085,0.8314695954322815,-0.4220356345176697,0.44548842310905457,0.7895733118057251,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.7071067690849304,-0.10497161746025085,0.7071067690849304,-0.6920667290687561,0.44548842310905457,0.567964494228363,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.7071067690849304,-0.10497161746025085,0.7071067690849304,-0.5679647326469421,0.4454881548881531,0.6920667290687561,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.8314695954322815,-0.10497161746025085,0.5555702447891235,-0.7895732522010803,0.44548821449279785,0.4220360517501831,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.8314695954322815,-0.10497161746025085,0.5555702447891235,-0.6920667290687561,0.44548842310905457,0.567964494228363,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9238795042037964,-0.10497161746025085,0.38268348574638367,-0.856736958026886,0.4454883933067322,0.2598881125450134,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9238795042037964,-0.10497161746025085,0.38268348574638367,-0.7895732522010803,0.44548821449279785,0.4220360517501831,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,0.19509033858776093,-0.8909767866134644,0.44548824429512024,0.08775343745946884,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9807852506637573,-0.10497161746025085,0.19509033858776093,-0.856736958026886,0.4454883933067322,0.2598881125450134,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9999999403953552,-0.10497161746025085,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9999999403953552,-0.10497161746025085,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,0.08775343745946884,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,-0.19509030878543854,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9807852506637573,-0.10497161746025085,-0.19509030878543854,-0.856736958026886,0.4454883933067322,-0.2598881721496582,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.9238795042037964,-0.10497161746025085,-0.3826834261417389,-0.856736958026886,0.4454883933067322,-0.2598881721496582,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.9238795042037964,-0.10497161746025085,-0.3826834261417389,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.8314695954322815,-0.10497161746025085,-0.5555702447891235,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.8314695954322815,-0.10497161746025085,-0.5555702447891235,-0.6920668482780457,0.44548824429512024,-0.567964494228363,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.7071067690849304,-0.10497161746025085,-0.7071067690849304,-0.6920668482780457,0.44548824429512024,-0.567964494228363,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.7071067690849304,-0.10497161746025085,-0.7071067690849304,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.5555702447891235,-0.10497161746025085,-0.8314695954322815,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.5555702447891235,-0.10497161746025085,-0.8314695954322815,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.38268348574638367,-0.10497161746025085,-0.9238795042037964,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.38268348574638367,-0.10497161746025085,-0.9238795042037964,-0.259888231754303,0.4454883933067322,-0.856736958026886,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-0.19509032368659973,-0.10497161746025085,-0.9807852506637573,-0.259888231754303,0.4454883933067322,-0.856736958026886,1.0009496212005615,0.0009514093399047852,0,0,0,0,-0.19509032368659973,-0.10497161746025085,-0.9807852506637573,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,0.0009514391422271729,-0.0009496212005615234,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,-0.8950279951095581,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,-0.8950279951095581,0.08775380253791809,0.44548821449279785,-0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.17461130023002625,0.10497245192527771,-0.8778302073478699,0.08775380253791809,0.44548821449279785,-0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,0.17461130023002625,0.10497245192527771,-0.8778302073478699,0.25988829135894775,0.44548869132995605,-0.8567367792129517,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.3425123393535614,0.10497245192527771,-0.8268979787826538,0.25988829135894775,0.44548869132995605,-0.8567367792129517,0.9990485906600952,1.0009496212005615,0,0,0,0,0.3425123393535614,0.10497245192527771,-0.8268979787826538,0.42203545570373535,0.44548848271369934,-0.7895733714103699,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.49725088477134705,0.10497245192527771,-0.7441885471343994,0.42203545570373535,0.44548848271369934,-0.7895733714103699,0.9990485906600952,1.0009496212005615,0,0,0,0,0.49725088477134705,0.10497245192527771,-0.7441885471343994,0.5679646134376526,0.44548842310905457,-0.6920666098594666,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.6328803300857544,0.10497245192527771,-0.6328803300857544,0.5679646134376526,0.44548842310905457,-0.6920666098594666,0.9990485906600952,1.0009496212005615,0,0,0,0,0.6328803300857544,0.10497245192527771,-0.6328803300857544,0.6920667886734009,0.4454883933067322,-0.5679644346237183,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.7441885471343994,0.10497245192527771,-0.49725088477134705,0.6920667886734009,0.4454883933067322,-0.5679644346237183,0.9990485906600952,1.0009496212005615,0,0,0,0,0.7441885471343994,0.10497245192527771,-0.49725088477134705,0.7895731925964355,0.4454883635044098,-0.42203593254089355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8268979787826538,0.10497245192527771,-0.3425123393535614,0.7895731925964355,0.4454883635044098,-0.42203593254089355,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8268979787826538,0.10497245192527771,-0.3425123393535614,0.856736958026886,0.4454883933067322,-0.2598881423473358,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,-0.17461128532886505,0.856736958026886,0.4454883933067322,-0.2598881423473358,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8778302073478699,0.10497245192527771,-0.17461128532886505,0.8909766674041748,0.4454883337020874,-0.0877537727355957,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8950279951095581,0.10497245192527771,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,-0.0877537727355957,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8950279951095581,0.10497245192527771,1.955777406692505e-8,0.8909766674041748,0.4454883337020874,0.0877537727355957,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,0.17461131513118744,0.856736958026886,0.44548842310905457,0.2598881423473358,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8778302073478699,0.10497245192527771,0.17461131513118744,0.8909766674041748,0.4454883337020874,0.0877537727355957,0.9990485906600952,1.0009496212005615,0,0,0,0,0.8268979787826538,0.10497245192527771,0.3425123989582062,0.7895732522010803,0.44548821449279785,0.4220360517501831,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.8268979787826538,0.10497245192527771,0.3425123989582062,0.856736958026886,0.44548842310905457,0.2598881423473358,0.9990485906600952,1.0009496212005615,0,0,0,0,0.7441885471343994,0.10497245192527771,0.4972509443759918,0.6920667886734009,0.4454882740974426,0.5679645538330078,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.7441885471343994,0.10497245192527771,0.4972509443759918,0.7895732522010803,0.44548821449279785,0.4220360517501831,0.9990485906600952,1.0009496212005615,0,0,0,0,0.6328803300857544,0.10497245192527771,0.6328803300857544,0.5679647326469421,0.4454883635044098,0.6920666694641113,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.6328803300857544,0.10497245192527771,0.6328803300857544,0.6920667886734009,0.4454882740974426,0.5679645538330078,0.9990485906600952,1.0009496212005615,0,0,0,0,0.49725088477134705,0.10497245192527771,0.7441885471343994,0.4220355749130249,0.4454882740974426,0.7895734310150146,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.49725088477134705,0.10497245192527771,0.7441885471343994,0.5679647326469421,0.4454883635044098,0.6920666694641113,0.9990485906600952,1.0009496212005615,0,0,0,0,0.3425123393535614,0.10497245192527771,0.8268979787826538,0.25988829135894775,0.44548851251602173,0.8567368388175964,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.3425123393535614,0.10497245192527771,0.8268979787826538,0.4220355749130249,0.4454882740974426,0.7895734310150146,0.9990485906600952,1.0009496212005615,0,0,0,0,0.17461130023002625,0.10497245192527771,0.8778302073478699,0.08775380253791809,0.44548818469047546,0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,0.17461130023002625,0.10497245192527771,0.8778302073478699,0.25988829135894775,0.44548851251602173,0.8567368388175964,0.9990485906600952,1.0009496212005615,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,0.8950279951095581,-0.08775380253791809,0.44548821449279785,0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-5.678913339579594e-9,0.10497245192527771,0.8950279951095581,0.08775380253791809,0.44548818469047546,0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.17461130023002625,0.10497245192527771,0.8778302073478699,-0.25988826155662537,0.445488303899765,0.8567370772361755,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.17461130023002625,0.10497245192527771,0.8778302073478699,-0.08775380253791809,0.44548821449279785,0.8909766674041748,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.3425123989582062,0.10497245192527771,0.8268979787826538,-0.4220356345176697,0.44548842310905457,0.7895733118057251,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.3425123989582062,0.10497245192527771,0.8268979787826538,-0.25988826155662537,0.445488303899765,0.8567370772361755,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.4972509443759918,0.10497245192527771,0.7441885471343994,-0.5679647326469421,0.4454881548881531,0.6920667290687561,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.4972509443759918,0.10497245192527771,0.7441885471343994,-0.4220356345176697,0.44548842310905457,0.7895733118057251,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.6328803300857544,0.10497245192527771,0.6328803300857544,-0.6920667290687561,0.44548842310905457,0.567964494228363,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.6328803300857544,0.10497245192527771,0.6328803300857544,-0.5679647326469421,0.4454881548881531,0.6920667290687561,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.7441885471343994,0.10497245192527771,0.4972509443759918,-0.7895732522010803,0.44548821449279785,0.4220360517501831,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.7441885471343994,0.10497245192527771,0.4972509443759918,-0.6920667290687561,0.44548842310905457,0.567964494228363,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8268979787826538,0.10497245192527771,0.3425123989582062,-0.856736958026886,0.4454883933067322,0.2598881125450134,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8268979787826538,0.10497245192527771,0.3425123989582062,-0.7895732522010803,0.44548821449279785,0.4220360517501831,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,0.17461131513118744,-0.8909767866134644,0.44548824429512024,0.08775343745946884,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8778302073478699,0.10497245192527771,0.17461131513118744,-0.856736958026886,0.4454883933067322,0.2598881125450134,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8950279951095581,0.10497245192527771,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8950279951095581,0.10497245192527771,1.955777406692505e-8,-0.8909767866134644,0.44548824429512024,0.08775343745946884,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,-0.17461128532886505,-0.8909767866134644,0.44548824429512024,-0.08775343745946884,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8778302073478699,0.10497245192527771,-0.17461128532886505,-0.856736958026886,0.4454883933067322,-0.2598881721496582,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.8268979787826538,0.10497245192527771,-0.3425123393535614,-0.856736958026886,0.4454883933067322,-0.2598881721496582,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.8268979787826538,0.10497245192527771,-0.3425123393535614,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.7441885471343994,0.10497245192527771,-0.49725088477134705,-0.7895731925964355,0.4454882740974426,-0.42203593254089355,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.7441885471343994,0.10497245192527771,-0.49725088477134705,-0.6920668482780457,0.44548824429512024,-0.567964494228363,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.6328803300857544,0.10497245192527771,-0.6328803300857544,-0.6920668482780457,0.44548824429512024,-0.567964494228363,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.6328803300857544,0.10497245192527771,-0.6328803300857544,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.4972509443759918,0.10497245192527771,-0.7441885471343994,-0.5679647326469421,0.4454882740974426,-0.6920666694641113,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.4972509443759918,0.10497245192527771,-0.7441885471343994,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.3425123989582062,0.10497245192527771,-0.8268979787826538,-0.42203566431999207,0.44548851251602173,-0.7895731925964355,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.3425123989582062,0.10497245192527771,-0.8268979787826538,-0.259888231754303,0.4454883933067322,-0.856736958026886,-0.0009496510028839111,0.9990485906600952,0,0,0,0,-0.17461130023002625,0.10497245192527771,-0.8778302073478699,-0.259888231754303,0.4454883933067322,-0.856736958026886,0.9990485906600952,1.0009496212005615,0,0,0,0,-0.17461130023002625,0.10497245192527771,-0.8778302073478699,-0.08775380253791809,0.44548818469047546,-0.8909766674041748,-0.0009496510028839111,0.9990485906600952,0,0,0,0]); -const iBufferSpecialCylinder = new Uint16Array([63,127,64,63,64,0,61,125,126,61,126,62,59,123,124,59,124,60,57,121,122,57,122,58,55,119,120,55,120,56,53,117,118,53,118,54,51,115,116,51,116,52,48,112,114,48,114,50,46,110,113,46,113,49,44,108,111,44,111,47,42,106,109,42,109,45,40,104,107,40,107,43,38,102,105,38,105,41,36,100,103,36,103,39,34,98,101,34,101,37,32,96,99,32,99,35,30,94,97,30,97,33,28,92,95,28,95,31,26,90,93,26,93,29,24,88,91,24,91,27,22,86,89,22,89,25,20,84,87,20,87,23,18,82,85,18,85,21,17,81,83,17,83,19,15,79,80,15,80,16,13,77,78,13,78,14,11,75,76,11,76,12,9,73,74,9,74,10,7,71,72,7,72,8,5,69,70,5,70,6,3,67,68,3,68,4,1,65,66,1,66,2]); +const vBufferSpecialCylinder = new Float32Array([-5.678913339579594e-9, -0.10497161746025085, -1, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, -1, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, -0.9807852506637573, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, -0.9807852506637573, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, -0.9238795042037964, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, -0.9238795042037964, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, -0.8314695954322815, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, -0.8314695954322815, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, -0.7071067690849304, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, -0.7071067690849304, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, -0.5555702447891235, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, -0.5555702447891235, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, -0.3826834261417389, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, -0.3826834261417389, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, -0.19509030878543854, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, -0.19509030878543854, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 1, -0.10497161746025085, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 1, -0.10497161746025085, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, 0.19509033858776093, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9807852506637573, -0.10497161746025085, 0.19509033858776093, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, 0.38268348574638367, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.9238795042037964, -0.10497161746025085, 0.38268348574638367, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, 0.5555702447891235, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.8314695954322815, -0.10497161746025085, 0.5555702447891235, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, 0.7071067690849304, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.7071067690849304, -0.10497161746025085, 0.7071067690849304, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, 0.8314695954322815, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.5555702447891235, -0.10497161746025085, 0.8314695954322815, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, 0.9238795042037964, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.3826834261417389, -0.10497161746025085, 0.9238795042037964, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, 0.9807852506637573, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, 0.19509032368659973, -0.10497161746025085, 0.9807852506637573, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, 1, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -5.678913339579594e-9, -0.10497161746025085, 1, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, 0.9807852506637573, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, 0.9807852506637573, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, 0.9238795042037964, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, 0.9238795042037964, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, 0.8314695954322815, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, 0.8314695954322815, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, 0.7071067690849304, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, 0.7071067690849304, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, 0.5555702447891235, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, 0.5555702447891235, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, 0.38268348574638367, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, 0.38268348574638367, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, 0.19509033858776093, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, 0.19509033858776093, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9999999403953552, -0.10497161746025085, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9999999403953552, -0.10497161746025085, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, -0.19509030878543854, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9807852506637573, -0.10497161746025085, -0.19509030878543854, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, -0.3826834261417389, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.9238795042037964, -0.10497161746025085, -0.3826834261417389, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, -0.5555702447891235, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.8314695954322815, -0.10497161746025085, -0.5555702447891235, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, -0.7071067690849304, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.7071067690849304, -0.10497161746025085, -0.7071067690849304, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, -0.8314695954322815, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.5555702447891235, -0.10497161746025085, -0.8314695954322815, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, -0.9238795042037964, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.38268348574638367, -0.10497161746025085, -0.9238795042037964, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, -0.9807852506637573, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 1.0009496212005615, 0.0009514093399047852, 0, 0, 0, 0, -0.19509032368659973, -0.10497161746025085, -0.9807852506637573, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 0.0009514391422271729, -0.0009496212005615234, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, -0.8950279951095581, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, -0.8950279951095581, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, -0.8778302073478699, 0.08775380253791809, 0.44548821449279785, -0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, -0.8778302073478699, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, -0.8268979787826538, 0.25988829135894775, 0.44548869132995605, -0.8567367792129517, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, -0.8268979787826538, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, -0.7441885471343994, 0.42203545570373535, 0.44548848271369934, -0.7895733714103699, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, -0.7441885471343994, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, -0.6328803300857544, 0.5679646134376526, 0.44548842310905457, -0.6920666098594666, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, -0.6328803300857544, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, -0.49725088477134705, 0.6920667886734009, 0.4454883933067322, -0.5679644346237183, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, -0.49725088477134705, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, -0.3425123393535614, 0.7895731925964355, 0.4454883635044098, -0.42203593254089355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, -0.3425123393535614, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, -0.17461128532886505, 0.856736958026886, 0.4454883933067322, -0.2598881423473358, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, -0.17461128532886505, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, -0.0877537727355957, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, 0.17461131513118744, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8778302073478699, 0.10497245192527771, 0.17461131513118744, 0.8909766674041748, 0.4454883337020874, 0.0877537727355957, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, 0.3425123989582062, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.8268979787826538, 0.10497245192527771, 0.3425123989582062, 0.856736958026886, 0.44548842310905457, 0.2598881423473358, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, 0.4972509443759918, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.7441885471343994, 0.10497245192527771, 0.4972509443759918, 0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, 0.6328803300857544, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.6328803300857544, 0.10497245192527771, 0.6328803300857544, 0.6920667886734009, 0.4454882740974426, 0.5679645538330078, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, 0.7441885471343994, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.49725088477134705, 0.10497245192527771, 0.7441885471343994, 0.5679647326469421, 0.4454883635044098, 0.6920666694641113, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, 0.8268979787826538, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.3425123393535614, 0.10497245192527771, 0.8268979787826538, 0.4220355749130249, 0.4454882740974426, 0.7895734310150146, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, 0.8778302073478699, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, 0.17461130023002625, 0.10497245192527771, 0.8778302073478699, 0.25988829135894775, 0.44548851251602173, 0.8567368388175964, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, 0.8950279951095581, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -5.678913339579594e-9, 0.10497245192527771, 0.8950279951095581, 0.08775380253791809, 0.44548818469047546, 0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, 0.8778302073478699, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, 0.8778302073478699, -0.08775380253791809, 0.44548821449279785, 0.8909766674041748, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, 0.8268979787826538, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, 0.8268979787826538, -0.25988826155662537, 0.445488303899765, 0.8567370772361755, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, 0.7441885471343994, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, 0.7441885471343994, -0.4220356345176697, 0.44548842310905457, 0.7895733118057251, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, 0.6328803300857544, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, 0.6328803300857544, -0.5679647326469421, 0.4454881548881531, 0.6920667290687561, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, 0.4972509443759918, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, 0.4972509443759918, -0.6920667290687561, 0.44548842310905457, 0.567964494228363, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, 0.3425123989582062, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, 0.3425123989582062, -0.7895732522010803, 0.44548821449279785, 0.4220360517501831, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, 0.17461131513118744, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, 0.17461131513118744, -0.856736958026886, 0.4454883933067322, 0.2598881125450134, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8950279951095581, 0.10497245192527771, 1.955777406692505e-8, -0.8909767866134644, 0.44548824429512024, 0.08775343745946884, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, -0.17461128532886505, -0.8909767866134644, 0.44548824429512024, -0.08775343745946884, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8778302073478699, 0.10497245192527771, -0.17461128532886505, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, -0.3425123393535614, -0.856736958026886, 0.4454883933067322, -0.2598881721496582, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.8268979787826538, 0.10497245192527771, -0.3425123393535614, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, -0.49725088477134705, -0.7895731925964355, 0.4454882740974426, -0.42203593254089355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.7441885471343994, 0.10497245192527771, -0.49725088477134705, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, -0.6328803300857544, -0.6920668482780457, 0.44548824429512024, -0.567964494228363, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.6328803300857544, 0.10497245192527771, -0.6328803300857544, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, -0.7441885471343994, -0.5679647326469421, 0.4454882740974426, -0.6920666694641113, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.4972509443759918, 0.10497245192527771, -0.7441885471343994, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, -0.8268979787826538, -0.42203566431999207, 0.44548851251602173, -0.7895731925964355, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.3425123989582062, 0.10497245192527771, -0.8268979787826538, -0.259888231754303, 0.4454883933067322, -0.856736958026886, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, -0.8778302073478699, -0.259888231754303, 0.4454883933067322, -0.856736958026886, 0.9990485906600952, 1.0009496212005615, 0, 0, 0, 0, -0.17461130023002625, 0.10497245192527771, -0.8778302073478699, -0.08775380253791809, 0.44548818469047546, -0.8909766674041748, -0.0009496510028839111, 0.9990485906600952, 0, 0, 0, 0]) +const iBufferSpecialCylinder = new Uint16Array([63, 127, 64, 63, 64, 0, 61, 125, 126, 61, 126, 62, 59, 123, 124, 59, 124, 60, 57, 121, 122, 57, 122, 58, 55, 119, 120, 55, 120, 56, 53, 117, 118, 53, 118, 54, 51, 115, 116, 51, 116, 52, 48, 112, 114, 48, 114, 50, 46, 110, 113, 46, 113, 49, 44, 108, 111, 44, 111, 47, 42, 106, 109, 42, 109, 45, 40, 104, 107, 40, 107, 43, 38, 102, 105, 38, 105, 41, 36, 100, 103, 36, 103, 39, 34, 98, 101, 34, 101, 37, 32, 96, 99, 32, 99, 35, 30, 94, 97, 30, 97, 33, 28, 92, 95, 28, 95, 31, 26, 90, 93, 26, 93, 29, 24, 88, 91, 24, 91, 27, 22, 86, 89, 22, 89, 25, 20, 84, 87, 20, 87, 23, 18, 82, 85, 18, 85, 21, 17, 81, 83, 17, 83, 19, 15, 79, 80, 15, 80, 16, 13, 77, 78, 13, 78, 14, 11, 75, 76, 11, 76, 12, 9, 73, 74, 9, 74, 10, 7, 71, 72, 7, 72, 8, 5, 69, 70, 5, 70, 6, 3, 67, 68, 3, 68, 4, 1, 65, 66, 1, 66, 2]) -const xrFrameSystem = wx.getXrFrameSystem(); -const boundCenter = xrFrameSystem.Vector3.createFromNumber(0, 0, 0); -const boundSize = xrFrameSystem.Vector3.createFromNumber(1, 1, 1); -const defaultSubMeshLength = iBufferSpecialCylinder.length; +const xrFrameSystem = wx.getXrFrameSystem() +const boundCenter = xrFrameSystem.Vector3.createFromNumber(0, 0, 0) +const boundSize = xrFrameSystem.Vector3.createFromNumber(1, 1, 1) +const defaultSubMeshLength = iBufferSpecialCylinder.length xrFrameSystem.registerGeometry('specialCylinderCustom', scene => { - const geo = scene.createGeometry(getSpecialVertexLayout(scene), vBufferSpecialCylinder, iBufferSpecialCylinder); + const geo = scene.createGeometry(getSpecialVertexLayout(scene), vBufferSpecialCylinder, iBufferSpecialCylinder) - geo.setBoundBox(boundCenter, boundSize); - geo.addSubMesh(defaultSubMeshLength, 0, 0); + geo.setBoundBox(boundCenter, boundSize) + geo.addSubMesh(defaultSubMeshLength, 0, 0) - return geo; -}); + return geo +}) const defaultAttributes = [ { - name: "a_normal", + name: 'a_normal', format: 2, offset: 12, usage: 2 }, { - name: "a_position", + name: 'a_position', format: 2, offset: 0, usage: 1 }, { - name: "a_tangent", + name: 'a_tangent', format: 3, offset: 40, usage: 3 }, { - name: "a_texCoord", + name: 'a_texCoord', format: 1, offset: 24, usage: 4 } -]; -const defaultStride = 48; +] +const defaultStride = 48 -function getSpecialVertexLayout(scene){ +function getSpecialVertexLayout(scene) { return scene.createVertexLayout({ attributes: defaultAttributes, stride: defaultStride - }); + }) } - - - - - diff --git a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/bsdfs.js b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/bsdfs.js index 54dc9763..c04a3080 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/bsdfs.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/bsdfs.js @@ -119,4 +119,4 @@ void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const multiScatter += Fms * Ems; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonFrag.js b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonFrag.js index 78c2ba0c..49b96a13 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonFrag.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonFrag.js @@ -182,5 +182,4 @@ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { -`; - +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonVert.js b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonVert.js index b3a7a1ec..cd7b585f 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonVert.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/commonVert.js @@ -108,4 +108,4 @@ mat4 inverse4(mat4 m) { a31 * b01 - a30 * b03 - a32 * b00, a20 * b03 - a21 * b01 + a22 * b00) / det; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/customPBR.js b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/customPBR.js index a5d7b6f6..83b2b232 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/customPBR.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/customPBR.js @@ -1,63 +1,65 @@ -import pbr from "./pbr"; -import bsdfs from "./bsdfs"; -import commonFrag from "./commonFrag"; -import commonVert from "./commonVert"; +import pbr from './pbr' +import bsdfs from './bsdfs' +import commonFrag from './commonFrag' +import commonVert from './commonVert' const xrFrameSystem = wx.getXrFrameSystem() xrFrameSystem.registerEffect('custom-pbr', scene => scene.createEffect({ - name: "custom-pbr", + name: 'custom-pbr', defaultRenderQueue: 2000, passes: [{ - "renderStates": { + renderStates: { blendOn: false, depthWrite: true, cullOn: true, cullFace: xrFrameSystem.ECullMode.FRONT, }, - lightMode: "ForwardBase", + lightMode: 'ForwardBase', useMaterialRenderStates: true, shaders: [0, 1] }], - properties: [ - { key: 'u_baseColorFactor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 1, 1, 1] }, - { key: 'u_metallicRoughnessValues', type: xrFrameSystem.EUniformType.FLOAT2, default: [0, 1] }, - { key: 'u_normalScale', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, - { key: 'u_emissiveFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [0, 0, 0] }, - { key: 'u_occlusionStrength', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, - { key: 'u_specularFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [1, 1, 1] }, - { key: 'u_glossinessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, - { key: 'u_ior', type: xrFrameSystem.EUniformType.FLOAT, default: [1.5] }, - { key: 'u_clearcoatFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0] }, - { key: 'u_clearcoatRoughnessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0] }, - { key: 'u_clearcoatNormalScale', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, - { key: 'u_alphaCutoff', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5] }, - { key: 'u_diffuseSHMat', type: xrFrameSystem.EUniformType.FLOAT3, num: 9, default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }, - { key: 'u_transmissionFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, - { key: 'u_sheenColorFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [0.0, 0.0, 0.0] }, - { key: 'u_sheenRoughnessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0.0] }, - /** uvTransform */ - { key: 'u_uvTransform', type: xrFrameSystem.EUniformType.MAT4, default: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }, - { key: 'u_normalMapTransform', type: xrFrameSystem.EUniformType.MAT4, default: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }, - ], - images: [ - { key: 'u_brdfLUT', default: 'brdf-lut' }, - { key: 'u_baseColorMap', default: 'white', macro: 'WX_USE_BASECOLORMAP' }, - { key: 'u_metallicRoughnessMap', default: 'green', macro: 'WX_USE_METALROUGHNESSMAP' }, - { key: 'u_normalMap', default: 'white', macro: 'WX_USE_NORMALMAP' }, - { key: 'u_emissiveMap', default: 'white', macro: 'WX_USE_EMISSIVEMAP' }, - { key: 'u_occlusionMap', default: 'white', macro: 'WX_USE_OCCLUSIONMAP' }, - { key: 'u_clearcoatMap', default: 'white', macro: 'WX_USE_CLEARCOATMAP' }, - { key: 'u_specularGlossinessMap', default: 'white', macro: 'WX_USE_SPECULARGLOSSINESSMAP' }, - { key: 'u_transmissionMap', default: 'white', macro: 'WX_USE_TRANSMISSIONMAP' }, - { key: 'u_sheenColorMap', default: 'white', macro: 'WX_USE_SHEENCOLORMAP' }, - { key: 'u_metallicMap', default: 'black', macro: 'WX_USE_METALMAP' }, - { key: 'u_roughnessMap', default: 'white', macro: 'WX_USE_ROUGHNESSMAP' }, - { key: 'u_clearcoatRoughnessMap', default: 'white', macro: 'WX_USE_CLEARCOATROUGHNESSMAP' }, - { key: 'u_clearcoatNormalMap', default: 'white', macro: 'WX_USE_CLEARCOATNORMALMAP' }, - { key: 'u_sheenRoughnessMap', default: 'white', macro: 'WX_USE_SHEENROUGHNESSMAP' }, - { key: 'u_specularEnvMapMat', default: 'white' }, - ], + properties: [ + { key: 'u_baseColorFactor', type: xrFrameSystem.EUniformType.FLOAT4, default: [1, 1, 1, 1] }, + { key: 'u_metallicRoughnessValues', type: xrFrameSystem.EUniformType.FLOAT2, default: [0, 1] }, + { key: 'u_normalScale', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, + { key: 'u_emissiveFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [0, 0, 0] }, + { key: 'u_occlusionStrength', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, + { key: 'u_specularFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [1, 1, 1] }, + { key: 'u_glossinessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, + { key: 'u_ior', type: xrFrameSystem.EUniformType.FLOAT, default: [1.5] }, + { key: 'u_clearcoatFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0] }, + { key: 'u_clearcoatRoughnessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0] }, + { key: 'u_clearcoatNormalScale', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, + { key: 'u_alphaCutoff', type: xrFrameSystem.EUniformType.FLOAT, default: [0.5] }, + { + key: 'u_diffuseSHMat', type: xrFrameSystem.EUniformType.FLOAT3, num: 9, default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + }, + { key: 'u_transmissionFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [1] }, + { key: 'u_sheenColorFactor', type: xrFrameSystem.EUniformType.FLOAT3, default: [0.0, 0.0, 0.0] }, + { key: 'u_sheenRoughnessFactor', type: xrFrameSystem.EUniformType.FLOAT, default: [0.0] }, + /** uvTransform */ + { key: 'u_uvTransform', type: xrFrameSystem.EUniformType.MAT4, default: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }, + { key: 'u_normalMapTransform', type: xrFrameSystem.EUniformType.MAT4, default: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }, + ], + images: [ + { key: 'u_brdfLUT', default: 'brdf-lut' }, + { key: 'u_baseColorMap', default: 'white', macro: 'WX_USE_BASECOLORMAP' }, + { key: 'u_metallicRoughnessMap', default: 'green', macro: 'WX_USE_METALROUGHNESSMAP' }, + { key: 'u_normalMap', default: 'white', macro: 'WX_USE_NORMALMAP' }, + { key: 'u_emissiveMap', default: 'white', macro: 'WX_USE_EMISSIVEMAP' }, + { key: 'u_occlusionMap', default: 'white', macro: 'WX_USE_OCCLUSIONMAP' }, + { key: 'u_clearcoatMap', default: 'white', macro: 'WX_USE_CLEARCOATMAP' }, + { key: 'u_specularGlossinessMap', default: 'white', macro: 'WX_USE_SPECULARGLOSSINESSMAP' }, + { key: 'u_transmissionMap', default: 'white', macro: 'WX_USE_TRANSMISSIONMAP' }, + { key: 'u_sheenColorMap', default: 'white', macro: 'WX_USE_SHEENCOLORMAP' }, + { key: 'u_metallicMap', default: 'black', macro: 'WX_USE_METALMAP' }, + { key: 'u_roughnessMap', default: 'white', macro: 'WX_USE_ROUGHNESSMAP' }, + { key: 'u_clearcoatRoughnessMap', default: 'white', macro: 'WX_USE_CLEARCOATROUGHNESSMAP' }, + { key: 'u_clearcoatNormalMap', default: 'white', macro: 'WX_USE_CLEARCOATNORMALMAP' }, + { key: 'u_sheenRoughnessMap', default: 'white', macro: 'WX_USE_SHEENROUGHNESSMAP' }, + { key: 'u_specularEnvMapMat', default: 'white' }, + ], shaders: [ `#version 100 @@ -134,10 +136,8 @@ varying highp vec3 v_ViewPosition; varying highp vec3 v_AddLightsDir[WX_ADD_LIGHTS_COUNT]; varying highp vec3 v_AddLightsPos[WX_ADD_LIGHTS_COUNT]; #endif -` -+ -commonVert -+ +` + +commonVert + ` void main() { @@ -223,7 +223,7 @@ void main() }`, // Fragment Shader -`#version 100 + `#version 100 // Temp fix Uniform limit, remove lut #define WX_USE_BRDFLUT true @@ -270,15 +270,11 @@ varying highp vec3 v_ViewPosition; varying highp vec3 v_AddLightsDir[WX_ADD_LIGHTS_COUNT]; varying highp vec3 v_AddLightsPos[WX_ADD_LIGHTS_COUNT]; #endif -` -+ -commonFrag -+ -bsdfs -+ +` + +commonFrag + +bsdfs + // PBR Material Info -pbr -+ +pbr + ` void main() { @@ -806,4 +802,4 @@ void main() } ` ], -})); +})) diff --git a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/pbr.js b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/pbr.js index 835aa69e..985a8ac2 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/pbr.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/standard-shader/pbr.js @@ -481,4 +481,4 @@ vec3 getIBLRadiance(vec3 viewDir, vec3 normal, float roughness, mat3 envRotation // return unpackDepth(texture2D(u_shadowMap, shadowCoord.xy)); } #endif -`; +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/common.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/common.js index d00868bc..f66b1eff 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/common.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/common.js @@ -173,4 +173,4 @@ vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineFrag.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineFrag.js index 5bd10fe7..d8c486c8 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineFrag.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineFrag.js @@ -17,4 +17,4 @@ void main() { gl_FragData[0] = u_outlineColor; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineVert.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineVert.js index b03381f7..1671207f 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineVert.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/outlineVert.js @@ -1,4 +1,4 @@ -import skinningDefines from './skinningDefine'; +import skinningDefines from './skinningDefine' export default /* glsl */ @@ -69,4 +69,4 @@ void main() gl_Position.z = gl_Position.z + offsetZ * cameraPosCS.z; } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/skinningDefine.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/skinningDefine.js index 0a2c5a24..581d3cca 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/skinningDefine.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/skinningDefine.js @@ -52,4 +52,4 @@ vec4 getSkinningWorldPosition(vec4 origin) { #endif // WX_SKINNED } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonFrag.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonFrag.js index 30ceb7fe..fdb1d1e8 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonFrag.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonFrag.js @@ -1,4 +1,4 @@ -import common from './common'; +import common from './common' const toonInfo = ` uniform highp vec4 u_baseColorFactor; @@ -124,4 +124,4 @@ void main() gl_FragData[0] = vec4(color, 1.0); } -`; \ No newline at end of file +` diff --git a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonVert.js b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonVert.js index 183a228b..18265971 100644 --- a/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonVert.js +++ b/miniprogram/packageXRFrame/xr-custom/assets/toon-shader/toonVert.js @@ -1,4 +1,4 @@ -import skinningDefines from './skinningDefine'; +import skinningDefines from './skinningDefine' export default /* glsl */ @@ -76,4 +76,4 @@ void main() gl_Position = u_projection * mvPosition; } -`; \ No newline at end of file +` diff --git a/miniprogram/page/API/components/set-tab-bar/set-tab-bar.js b/miniprogram/page/API/components/set-tab-bar/set-tab-bar.js index 8f796b55..541dff2e 100644 --- a/miniprogram/page/API/components/set-tab-bar/set-tab-bar.js +++ b/miniprogram/page/API/components/set-tab-bar/set-tab-bar.js @@ -23,12 +23,12 @@ Component({ attached() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) if (this.data.theme == 'dark') { wx.setTabBarStyle(darkDefaultTabBarStyle) } else { @@ -104,7 +104,7 @@ Component({ }, showTabBar() { - this.setData({hasHiddenTabBar: false}) + this.setData({ hasHiddenTabBar: false }) wx.showTabBar() }, @@ -113,7 +113,7 @@ Component({ this.showTabBar() return } - this.setData({hasHiddenTabBar: true}) + this.setData({ hasHiddenTabBar: true }) wx.hideTabBar() }, @@ -122,7 +122,7 @@ Component({ this.removeCustomStyle() return } - this.setData({hasCustomedStyle: true}) + this.setData({ hasCustomedStyle: true }) wx.setTabBarStyle({ color: '#FFF', selectedColor: '#1AAD19', @@ -131,7 +131,7 @@ Component({ }, removeCustomStyle() { - this.setData({hasCustomedStyle: false}) + this.setData({ hasCustomedStyle: false }) if (this.data.theme == 'dark') { wx.setTabBarStyle(darkDefaultTabBarStyle) } else { @@ -144,7 +144,7 @@ Component({ this.removeCustomItem() return } - this.setData({hasCustomedItem: true}) + this.setData({ hasCustomedItem: true }) wx.setTabBarItem({ index: 1, text: 'API' @@ -152,7 +152,7 @@ Component({ }, removeCustomItem() { - this.setData({hasCustomedItem: false}) + this.setData({ hasCustomedItem: false }) wx.setTabBarItem({ index: 1, text: defaultItemName diff --git a/miniprogram/page/API/index.js b/miniprogram/page/API/index.js index 8804c6ea..8d736719 100644 --- a/miniprogram/page/API/index.js +++ b/miniprogram/page/API/index.js @@ -273,130 +273,130 @@ Page({ zh: 'mobileNetInt8', url: 'mobilenet_int8/index', } - ] + ] }, { id: 'ar', name: 'VisionKit视觉能力', pages: [{ - zh: 'VisionKit基础', - url: 'visionkit-basic/visionkit-basic' - }, - { - zh: 'VisionKit基础-v2', - url: 'visionkit-basic-v2/visionkit-basic-v2' - }, - { - zh: '水平面AR', - url: 'plane-ar/plane-ar' - }, - { - zh: '水平面AR-v2', - url: 'plane-ar-v2/plane-ar-v2' - }, - { - zh: '水平面AR-v2-marker识别', - url: 'plane-ar-v2-marker/plane-ar-v2-marker' - }, - // { - // zh: '水平面AR-v2-虚实遮挡', - // url: 'plane-ar-v2-depth/plane-ar-v2-depth' - // }, - { - zh: '水平面AR-v2-附加能力', - url: 'plane-ar-v2-options/plane-ar-v2-options' - }, - { - zh: '水平面旋转AR', - url: 'plane-ar-3dof/plane-ar-3dof' - }, - { - zh: '2DMarkerAR', - url: '2dmarker-ar/2dmarker-ar' - }, - { - zh: '3DMarkerAR-三维识别与重建', - url: '3dmarker-ar/3dmarker-ar' - }, - { - zh: '单样本检测(OSD)', - url: 'osd-ar/osd-ar' - }, - { - zh: '相机帧测试', - url: 'cameraBuffer-detect/cameraBuffer-detect' - }, - { - zh: '相机帧获取jpg图片', - url: 'cameraBuffer-jpg/cameraBuffer-jpg' - }, - { - zh: '实时深度图检测', - url: 'depth-detect/depth-detect' - }, - { - zh: '照片深度图检测', - url: 'photo-depth-detect/photo-depth-detect' - }, - { - zh: '照片OCR检测', - url: 'photo-ocr-detect/photo-ocr-detect' - }, - { - zh: '照片身份证检测', - url: 'photo-idcard-detect/photo-idcard-detect' - }, - { - zh: '实时人脸检测', - url: 'face-detect/face-detect' - }, - { - zh: '实时人脸检测3D', - url: 'face-detect-3d/face-detect-3d' - }, - { - zh: '实时人脸检测3D-眼镜试戴', - url: 'face-detect-3d-glasses/face-detect-3d-glasses' - }, - { - zh: '照片人脸检测', - url: 'photo-face-detect/photo-face-detect' - }, - { - zh: '实时人体检测', - url: 'body-detect/body-detect' - }, - { - zh: '实时人体检测3D', - url: 'body-detect-3d/body-detect-3d' - }, - { - zh: '照片人体检测', - url: 'photo-body-detect/photo-body-detect' - }, - { - zh: '实时手势检测', - url: 'hand-detect/hand-detect' - }, - { - zh: '实时手势检测3D', - url: 'hand-detect-3d/hand-detect-3d' - }, - { - zh: '照片手势检测', - url: 'photo-hand-detect/photo-hand-detect' - }, - { - zh: '实时鞋部检测-AR试鞋', - url: 'shoe-detect/shoe-detect' - }, - { - zh: 'GassianSplatting 预览', - url: 'gaussian-splatting/gaussian-splatting' - }, - { - zh: 'GassianSplatting AR预览', - url: 'gaussian-splatting/gaussian-splatting-ar' - }, + zh: 'VisionKit基础', + url: 'visionkit-basic/visionkit-basic' + }, + { + zh: 'VisionKit基础-v2', + url: 'visionkit-basic-v2/visionkit-basic-v2' + }, + { + zh: '水平面AR', + url: 'plane-ar/plane-ar' + }, + { + zh: '水平面AR-v2', + url: 'plane-ar-v2/plane-ar-v2' + }, + { + zh: '水平面AR-v2-marker识别', + url: 'plane-ar-v2-marker/plane-ar-v2-marker' + }, + // { + // zh: '水平面AR-v2-虚实遮挡', + // url: 'plane-ar-v2-depth/plane-ar-v2-depth' + // }, + { + zh: '水平面AR-v2-附加能力', + url: 'plane-ar-v2-options/plane-ar-v2-options' + }, + { + zh: '水平面旋转AR', + url: 'plane-ar-3dof/plane-ar-3dof' + }, + { + zh: '2DMarkerAR', + url: '2dmarker-ar/2dmarker-ar' + }, + { + zh: '3DMarkerAR-三维识别与重建', + url: '3dmarker-ar/3dmarker-ar' + }, + { + zh: '单样本检测(OSD)', + url: 'osd-ar/osd-ar' + }, + { + zh: '相机帧测试', + url: 'cameraBuffer-detect/cameraBuffer-detect' + }, + { + zh: '相机帧获取jpg图片', + url: 'cameraBuffer-jpg/cameraBuffer-jpg' + }, + { + zh: '实时深度图检测', + url: 'depth-detect/depth-detect' + }, + { + zh: '照片深度图检测', + url: 'photo-depth-detect/photo-depth-detect' + }, + { + zh: '照片OCR检测', + url: 'photo-ocr-detect/photo-ocr-detect' + }, + { + zh: '照片身份证检测', + url: 'photo-idcard-detect/photo-idcard-detect' + }, + { + zh: '实时人脸检测', + url: 'face-detect/face-detect' + }, + { + zh: '实时人脸检测3D', + url: 'face-detect-3d/face-detect-3d' + }, + { + zh: '实时人脸检测3D-眼镜试戴', + url: 'face-detect-3d-glasses/face-detect-3d-glasses' + }, + { + zh: '照片人脸检测', + url: 'photo-face-detect/photo-face-detect' + }, + { + zh: '实时人体检测', + url: 'body-detect/body-detect' + }, + { + zh: '实时人体检测3D', + url: 'body-detect-3d/body-detect-3d' + }, + { + zh: '照片人体检测', + url: 'photo-body-detect/photo-body-detect' + }, + { + zh: '实时手势检测', + url: 'hand-detect/hand-detect' + }, + { + zh: '实时手势检测3D', + url: 'hand-detect-3d/hand-detect-3d' + }, + { + zh: '照片手势检测', + url: 'photo-hand-detect/photo-hand-detect' + }, + { + zh: '实时鞋部检测-AR试鞋', + url: 'shoe-detect/shoe-detect' + }, + { + zh: 'GassianSplatting 预览', + url: 'gaussian-splatting/gaussian-splatting' + }, + { + zh: 'GassianSplatting AR预览', + url: 'gaussian-splatting/gaussian-splatting-ar' + }, ], }], isSetTabBarPage: false, @@ -409,7 +409,7 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { @@ -429,7 +429,7 @@ Page({ this.leaveSetTabBarPage() }, kindToggle(e) { - const id = e.currentTarget.id; + const id = e.currentTarget.id const list = this.data.list for (let i = 0, len = list.length; i < len; ++i) { @@ -459,4 +459,4 @@ Page({ isSetTabBarPage: false }) }, -}) \ No newline at end of file +}) diff --git a/miniprogram/page/animation/index.ts b/miniprogram/page/animation/index.ts index 2846af2e..9c6c5b0b 100644 --- a/miniprogram/page/animation/index.ts +++ b/miniprogram/page/animation/index.ts @@ -88,7 +88,7 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { diff --git a/miniprogram/page/cloud/index.js b/miniprogram/page/cloud/index.js index 02a60beb..c14c10dc 100644 --- a/miniprogram/page/cloud/index.js +++ b/miniprogram/page/cloud/index.js @@ -86,12 +86,12 @@ Page({ }, onLoad() { this.setData({ - theme: wx.getSystemInfoSync().theme || 'light' + theme: getApp().globalData.theme || 'light' }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, diff --git a/miniprogram/page/component/index.js b/miniprogram/page/component/index.js index 97f48a45..0093ffa1 100644 --- a/miniprogram/page/component/index.js +++ b/miniprogram/page/component/index.js @@ -7,8 +7,8 @@ Page({ }) if (wx.onThemeChange) { - wx.onThemeChange(({theme}) => { - this.setData({theme}) + wx.onThemeChange(({ theme }) => { + this.setData({ theme }) }) } }, @@ -33,13 +33,13 @@ Page({ console.log('getExptInfoSync expt_args_3', wx.getExptInfoSync(['expt_args_3'])) } if (wx.canIUse('reportEvent')) { - wx.reportEvent('expt_event_1', {expt_data: 1}) - wx.reportEvent('expt_event_2', {expt_data: 5}) - wx.reportEvent('expt_event_3', {expt_data: 9}) - wx.reportEvent('expt_event_4', {expt_data: 200}) + wx.reportEvent('expt_event_1', { expt_data: 1 }) + wx.reportEvent('expt_event_2', { expt_data: 5 }) + wx.reportEvent('expt_event_3', { expt_data: 9 }) + wx.reportEvent('expt_event_4', { expt_data: 200 }) - wx.reportEvent('weexpt_event_key_1', {option_1: 1, option_2: 10, option_str_1: 'abc'}) - wx.reportEvent('weexpt_event_key_1', {option_1: 'abc', option_2: '1000', option_str_1: '1'}) + wx.reportEvent('weexpt_event_key_1', { option_1: 1, option_2: 10, option_str_1: 'abc' }) + wx.reportEvent('weexpt_event_key_1', { option_1: 'abc', option_2: '1000', option_str_1: '1' }) } }, onUnload() { @@ -88,7 +88,7 @@ Page({ id: 'map', name: '地图', open: false, - pages: ['map', {appid: 'wxe3f314db2e921db0', name: '腾讯位置服务示例中心'}] + pages: ['map', { appid: 'wxe3f314db2e921db0', name: '腾讯位置服务示例中心' }] }, { id: 'canvas', name: '画布', @@ -132,7 +132,7 @@ Page({ }, // 打开自定义路由页面 goToCustomRoute: function goToCustomRoute(evt) { - const {url} = evt.currentTarget.dataset + const { url } = evt.currentTarget.dataset wx.navigateTo({ routeType: 'ScaleTransition', url: `/packageSkyline/pages/${url}` diff --git a/miniprogram/page/extend/base/CustomPage.js b/miniprogram/page/extend/base/CustomPage.js index 22acd349..3395be9e 100644 --- a/miniprogram/page/extend/base/CustomPage.js +++ b/miniprogram/page/extend/base/CustomPage.js @@ -2,7 +2,8 @@ import themeMixin from './behaviors/theme' const CustomPage = function (options) { return Page( - Object.assign({}, options, { + { + ...options, behaviors: [themeMixin].concat(options.behaviors || []), onLoad(query) { const app = getApp() @@ -19,7 +20,7 @@ const CustomPage = function (options) { if (options.onUnload) options.onUnload.call(this) } } - }) + } ) } diff --git a/miniprogram/page/extend/index.js b/miniprogram/page/extend/index.js index d37df7f5..37078cc1 100644 --- a/miniprogram/page/extend/index.js +++ b/miniprogram/page/extend/index.js @@ -68,13 +68,13 @@ CustomPage({ name: '多端适配(需在PC端体验)', open: false, pages: [ - {zh: '左右伸缩', url: 'adapt/telescopic/telescopic'}, - {zh: '换行排列', url: 'adapt/linebreak/linebreak'}, - {zh: '侧边导航栏', url: 'adapt/sidenavigation/sidenavigation'}, - {zh: '分页展现', url: 'adapt/pagination/pagination'}, - {zh: '自由布局', url: 'adapt/freelayout/freelayout'}, - {zh: '分层展现', url: 'adapt/layeredpresentation/layeredpresentation'}, - {zh: '横向拓展', url: 'adapt/horizontalexpansion/horizontalexpansion'} + { zh: '左右伸缩', url: 'adapt/telescopic/telescopic' }, + { zh: '换行排列', url: 'adapt/linebreak/linebreak' }, + { zh: '侧边导航栏', url: 'adapt/sidenavigation/sidenavigation' }, + { zh: '分页展现', url: 'adapt/pagination/pagination' }, + { zh: '自由布局', url: 'adapt/freelayout/freelayout' }, + { zh: '分层展现', url: 'adapt/layeredpresentation/layeredpresentation' }, + { zh: '横向拓展', url: 'adapt/horizontalexpansion/horizontalexpansion' } ] } ], @@ -114,7 +114,7 @@ CustomPage({ extendedList[i].open = false } } - const list = this.data.list.map((item) => ({...item, open: false})) + const list = this.data.list.map((item) => ({ ...item, open: false })) this.setData({ extendedList, list, @@ -130,12 +130,12 @@ CustomPage({ App.themeChanged('light') } } - }, - openPage(e) { - const { url, father, page } = e.currentTarget.dataset - const nextUrl = url ? `../../packageExtend/pages/${url}` : `../../packageExtend/pages/${father}/${page}/${page}` - wx.navigateTo({ - url: nextUrl - }) - } + }, + openPage(e) { + const { url, father, page } = e.currentTarget.dataset + const nextUrl = url ? `../../packageExtend/pages/${url}` : `../../packageExtend/pages/${father}/${page}/${page}` + wx.navigateTo({ + url: nextUrl + }) + } }) diff --git a/miniprogram/util/util.js b/miniprogram/util/util.js index 5a6c6fe4..1c8c209b 100644 --- a/miniprogram/util/util.js +++ b/miniprogram/util/util.js @@ -1,36 +1,36 @@ export const lightBlue = { - // 0: '#E1F5FE', - // 100: '#B3E5FC', - // 200: '#81D4FA', - // 300: '#4FC3F7', - // 400: '#29B6F6', - // 500: '#03A9F4', - // 600: '#039BE5', - // 700: '#0288D1', - // 800: '#0277BD', - // 900: '#01579B', - 0:'#efefef', - 100: '#d7d7d7', - 200:'#bdbdbd', - 300: '#a3a3a3', - 400: '#8f8f8f', - 500:'#7b7b7b', - 600:'#989898;', - 700: '#747474', - 800:'#696969', - 900:'#5f5f5f', - } - - export const generateList = (childCount) => { - const ans = [] - for (let i = 0; i < childCount; i++) { - ans.push({ - id: i, - color: lightBlue[`${100 * (i % 9)}`], - }) - } - return ans + // 0: '#E1F5FE', + // 100: '#B3E5FC', + // 200: '#81D4FA', + // 300: '#4FC3F7', + // 400: '#29B6F6', + // 500: '#03A9F4', + // 600: '#039BE5', + // 700: '#0288D1', + // 800: '#0277BD', + // 900: '#01579B', + 0: '#efefef', + 100: '#d7d7d7', + 200: '#bdbdbd', + 300: '#a3a3a3', + 400: '#8f8f8f', + 500: '#7b7b7b', + 600: '#989898;', + 700: '#747474', + 800: '#696969', + 900: '#5f5f5f', +} + +export const generateList = (childCount) => { + const ans = [] + for (let i = 0; i < childCount; i++) { + ans.push({ + id: i, + color: lightBlue[`${100 * (i % 9)}`], + }) } + return ans +} function formatTime(time) { if (typeof time !== 'number' || time < 0) { @@ -137,7 +137,7 @@ function getStatusBarHeight() { } function getFrameSliceOptions(frameWidth, frameHeight, displayWidth, displayHeight) { - let result = { + const result = { start: [0, 0, 0], size: [-1, -1, 3] } @@ -155,20 +155,20 @@ function getFrameSliceOptions(frameWidth, frameHeight, displayWidth, displayHeig return result } - function getRandomInt(max) { - return Math.floor(Math.random() * max) - } - - export const generateGridList = (childCount, columns) => { - const ans = [] - for (let i = 0; i < childCount; i++) { - ans.push({ - id: i, - sub: getRandomInt(columns) + 1, - }) - } - return ans +function getRandomInt(max) { + return Math.floor(Math.random() * max) +} + +export const generateGridList = (childCount, columns) => { + const ans = [] + for (let i = 0; i < childCount; i++) { + ans.push({ + id: i, + sub: getRandomInt(columns) + 1, + }) } + return ans +} module.exports = { formatTime, diff --git a/miniprogram/workers/gaussianSplatting/index.js b/miniprogram/workers/gaussianSplatting/index.js index 8bb24042..65d36a91 100644 --- a/miniprogram/workers/gaussianSplatting/index.js +++ b/miniprogram/workers/gaussianSplatting/index.js @@ -2,145 +2,143 @@ const data = {} let gaussians let depthIndex -const sortingAlgorithm = 'count sort'; +const sortingAlgorithm = 'count sort' -let loopTime = 0; +let loopTime = 0 function init(plyInfo, config) { - console.log('[Worker] gaussianSplatting init'); - - // console.log('plyInfo', plyInfo); - gaussians = plyInfo; - gaussians.totalCount = plyInfo.count; - gaussians.count = gaussians.totalCount; - - depthIndex = new Uint32Array(gaussians.count); - - console.log(`[Worker] Received ${gaussians.count} gaussians`) - - data.positions = new Float32Array(gaussians.count * 3) - data.opacities = new Float32Array(gaussians.count) - data.cov3Da = new Float32Array(gaussians.count * 3) - data.cov3Db = new Float32Array(gaussians.count * 3) - data.colors = new Float32Array(gaussians.count * 3) - - // data.positions = new Float32Array(config.sabPositions.buffer); - // data.opacities = new Float32Array(config.sabOpacities.buffer); - // data.cov3Da = new Float32Array(config.sabCov3Da.buffer); - // data.cov3Db = new Float32Array(config.sabCov3Db.buffer); - // data.colors = new Float32Array(config.sabcolors.buffer); - - // console.log(`[Worker] init data positions`, data.positions) - // console.log(`[Worker] init data opacities`, data.opacities) - // console.log(`[Worker] init data cov3Da`,data.cov3Da) - // console.log(`[Worker] init data cov3Db`, data.cov3Db) - // console.log(`[Worker] init data colors`, data.colors) - + console.log('[Worker] gaussianSplatting init') + + // console.log('plyInfo', plyInfo); + gaussians = plyInfo + gaussians.totalCount = plyInfo.count + gaussians.count = gaussians.totalCount + + depthIndex = new Uint32Array(gaussians.count) + + console.log(`[Worker] Received ${gaussians.count} gaussians`) + + data.positions = new Float32Array(gaussians.count * 3) + data.opacities = new Float32Array(gaussians.count) + data.cov3Da = new Float32Array(gaussians.count * 3) + data.cov3Db = new Float32Array(gaussians.count * 3) + data.colors = new Float32Array(gaussians.count * 3) + + // data.positions = new Float32Array(config.sabPositions.buffer); + // data.opacities = new Float32Array(config.sabOpacities.buffer); + // data.cov3Da = new Float32Array(config.sabCov3Da.buffer); + // data.cov3Db = new Float32Array(config.sabCov3Db.buffer); + // data.colors = new Float32Array(config.sabcolors.buffer); + + // console.log(`[Worker] init data positions`, data.positions) + // console.log(`[Worker] init data opacities`, data.opacities) + // console.log(`[Worker] init data cov3Da`,data.cov3Da) + // console.log(`[Worker] init data cov3Db`, data.cov3Db) + // console.log(`[Worker] init data colors`, data.colors) } function sort(params) { - // console.log('[worker] gaussianSplatting sort'); + // console.log('[worker] gaussianSplatting sort'); - loopTime++; + loopTime++ - const { viewProjectionMatrix } = params + const { viewProjectionMatrix } = params - const start = new Date().getTime() + const start = new Date().getTime() + // console.log('viewProjectionMatrix', viewProjectionMatrix) + // console.log('viewProjectionMatrix 2 6 10', viewProjectionMatrix[2], viewProjectionMatrix[6], viewProjectionMatrix[10]) + // console.log('viewProjectionMatrix 8 9 10', viewProjectionMatrix[8], viewProjectionMatrix[9], viewProjectionMatrix[10]) - // console.log('viewProjectionMatrix', viewProjectionMatrix) - // console.log('viewProjectionMatrix 2 6 10', viewProjectionMatrix[2], viewProjectionMatrix[6], viewProjectionMatrix[10]) - // console.log('viewProjectionMatrix 8 9 10', viewProjectionMatrix[8], viewProjectionMatrix[9], viewProjectionMatrix[10]) + // Sort the gaussians! + sortGaussiansByDepth(depthIndex, gaussians, viewProjectionMatrix) - // Sort the gaussians! - sortGaussiansByDepth(depthIndex, gaussians, viewProjectionMatrix) + const sortEnd = new Date().getTime() - const sortEnd = new Date().getTime(); + const sortTime = `${((sortEnd - start) / 1000).toFixed(3)}s` - const sortTime = `${((sortEnd - start)/1000).toFixed(3)}s` + // Update arrays containing the data + for (let j = 0; j < gaussians.count; j++) { + const i = depthIndex[j] - // Update arrays containing the data - for (let j = 0; j < gaussians.count; j++) { - const i = depthIndex[j] + data.colors[j * 3] = gaussians.colors[i * 3] + data.colors[j * 3 + 1] = gaussians.colors[i * 3 + 1] + data.colors[j * 3 + 2] = gaussians.colors[i * 3 + 2] - data.colors[j*3] = gaussians.colors[i*3] - data.colors[j*3+1] = gaussians.colors[i*3+1] - data.colors[j*3+2] = gaussians.colors[i*3+2] + data.positions[j * 3] = gaussians.positions[i * 3] + data.positions[j * 3 + 1] = gaussians.positions[i * 3 + 1] + data.positions[j * 3 + 2] = gaussians.positions[i * 3 + 2] - data.positions[j*3] = gaussians.positions[i*3] - data.positions[j*3+1] = gaussians.positions[i*3+1] - data.positions[j*3+2] = gaussians.positions[i*3+2] + data.opacities[j] = gaussians.opacities[i] - data.opacities[j] = gaussians.opacities[i] + // Split the covariance matrix into two vec3 + // so they can be used as vertex shader attributes + data.cov3Da[j * 3] = gaussians.cov3Ds[i * 6] + data.cov3Da[j * 3 + 1] = gaussians.cov3Ds[i * 6 + 1] + data.cov3Da[j * 3 + 2] = gaussians.cov3Ds[i * 6 + 2] - // Split the covariance matrix into two vec3 - // so they can be used as vertex shader attributes - data.cov3Da[j*3] = gaussians.cov3Ds[i*6] - data.cov3Da[j*3+1] = gaussians.cov3Ds[i*6+1] - data.cov3Da[j*3+2] = gaussians.cov3Ds[i*6+2] + data.cov3Db[j * 3] = gaussians.cov3Ds[i * 6 + 3] + data.cov3Db[j * 3 + 1] = gaussians.cov3Ds[i * 6 + 4] + data.cov3Db[j * 3 + 2] = gaussians.cov3Ds[i * 6 + 5] + } - data.cov3Db[j*3] = gaussians.cov3Ds[i*6+3] - data.cov3Db[j*3+1] = gaussians.cov3Ds[i*6+4] - data.cov3Db[j*3+2] = gaussians.cov3Ds[i*6+5] - } + const end = new Date().getTime() + + const writeTime = `${((end - sortEnd) / 1000).toFixed(3)}s` + // console.log(`[Worker] Sorted ${gaussians.count} gaussians in ${sortTime}.`) + // console.log(`[Worker] Writed ${gaussians.count} gaussians in ${writeTime}.`) - const end = new Date().getTime(); - - const writeTime = `${((end - sortEnd)/1000).toFixed(3)}s` - // console.log(`[Worker] Sorted ${gaussians.count} gaussians in ${sortTime}.`) - // console.log(`[Worker] Writed ${gaussians.count} gaussians in ${writeTime}.`) - - return { - data: { - colors: data.colors.buffer, - positions: data.positions.buffer, - opacities: data.opacities.buffer, - cov3Da: data.cov3Da.buffer, - cov3Db: data.cov3Db.buffer, - gaussiansCount: gaussians.count, - } - }; + return { + data: { + colors: data.colors.buffer, + positions: data.positions.buffer, + opacities: data.opacities.buffer, + cov3Da: data.cov3Da.buffer, + cov3Db: data.cov3Db.buffer, + gaussiansCount: gaussians.count, + } + } } // count排序, 这里本质就是从近到远排序 function sortGaussiansByDepth(depthIndex, gaussians, viewProjectionMatrix) { - const calcDepth = (i) => gaussians.positions[i*3] * viewProjectionMatrix[2] + - gaussians.positions[i*3+1] * viewProjectionMatrix[6] + - gaussians.positions[i*3+2] * viewProjectionMatrix[10] - - let maxDepth = -Infinity; - let minDepth = Infinity; - let sizeList = new Int32Array(gaussians.count); - - for (let i = 0; i < gaussians.count; i++) { - const depth = (calcDepth(i) * 4096) | 0 - - sizeList[i] = depth - maxDepth = Math.max(maxDepth, depth) - minDepth = Math.min(minDepth, depth) - } - - let depthInv = (256 * 256) / (maxDepth - minDepth); - let counts0 = new Uint32Array(256*256); - for (let i = 0; i < gaussians.count; i++) { - sizeList[i] = ((sizeList[i] - minDepth) * depthInv) | 0; - counts0[sizeList[i]]++; - } - let starts0 = new Uint32Array(256*256); - for (let i = 1; i < 256*256; i++) starts0[i] = starts0[i - 1] + counts0[i - 1]; - for (let i = 0; i < gaussians.count; i++) depthIndex[starts0[sizeList[i]]++] = i; + const calcDepth = (i) => gaussians.positions[i * 3] * viewProjectionMatrix[2] + + gaussians.positions[i * 3 + 1] * viewProjectionMatrix[6] + + gaussians.positions[i * 3 + 2] * viewProjectionMatrix[10] + + let maxDepth = -Infinity + let minDepth = Infinity + const sizeList = new Int32Array(gaussians.count) + + for (let i = 0; i < gaussians.count; i++) { + const depth = (calcDepth(i) * 4096) | 0 + + sizeList[i] = depth + maxDepth = Math.max(maxDepth, depth) + minDepth = Math.min(minDepth, depth) + } + + const depthInv = (256 * 256) / (maxDepth - minDepth) + const counts0 = new Uint32Array(256 * 256) + for (let i = 0; i < gaussians.count; i++) { + sizeList[i] = ((sizeList[i] - minDepth) * depthInv) | 0 + counts0[sizeList[i]]++ + } + const starts0 = new Uint32Array(256 * 256) + for (let i = 1; i < 256 * 256; i++) starts0[i] = starts0[i - 1] + counts0[i - 1] + for (let i = 0; i < gaussians.count; i++) depthIndex[starts0[sizeList[i]]++] = i } worker.onMessage(function (msg) { - if (msg.type === 'execFunc_init') { - worker.postMessage({ - type: 'execFunc_init', - result: init(msg.params[0], msg.params[1]) - }) - } else if(msg.type === 'execFunc_sort') { - worker.postMessage({ - type: 'execFunc_sort', - result: sort(msg.params[0]) - }) - } + if (msg.type === 'execFunc_init') { + worker.postMessage({ + type: 'execFunc_init', + result: init(msg.params[0], msg.params[1]) + }) + } else if (msg.type === 'execFunc_sort') { + worker.postMessage({ + type: 'execFunc_sort', + result: sort(msg.params[0]) + }) + } }) diff --git a/package.json b/package.json index 8d9677e3..3330ab8e 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,8 @@ }, "homepage": "https://github.com/wechat-miniprogram/miniprogram-demo#readme", "devDependencies": { - "@typescript-eslint/eslint-plugin": "^4.6.1", - "@typescript-eslint/parser": "^4.6.1", + "@typescript-eslint/eslint-plugin": "^8.26.1", + "@typescript-eslint/parser": "^8.26.1", "babel-eslint": "^10.1.0", "eslint": "^8.57.1", "eslint-config-airbnb-base": "^15.0.0", @@ -32,17 +32,20 @@ "eslint-plugin-node": "^7.0.1", "eslint-plugin-promise": "^4.0.0", "eslint-plugin-typescript": "^0.14.0", - "gulp": "^4.0.2", + "gulp": "^5.0.0", "gulp-if": "^3.0.0", "gulp-ignore": "^3.0.0", "gulp-postcss": "^9.0.1", "gulp-rename": "^2.0.0", "gulp-replace": "^1.1.3", - "jest": "^26.6.3", - "miniprogram-automator": "^0.10.0", + "jest": "^29.7.0", + "miniprogram-automator": "^0.5.1", "postcss": "^8.3.11", "postcss-css-variables": "^0.18.0", - "typescript": "^3.2.1", - "typescript-eslint-parser": "^22.0.0" + "typescript": "^5.8.2", + "typescript-eslint-parser": "^18.0.0" + }, + "dependencies": { + "miniprogram-ci": "^1.3.13" } } diff --git a/test/index.spec.js b/test/index.spec.js index be66a7b4..322fbc74 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -11,4 +11,4 @@ automator.launch({ await element.tap() await miniProgram.close() -}) \ No newline at end of file +})