index.js 2.0 KB

1234567891011121314151617181920212223242526272829303132
  1. var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
  2. var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML;
  3. var xmlCode = `<xr-scene id="xr-scene" ar-system="modes:Marker" bind:ready="handleReady" bind:tick="handleTick" bind:log="handleLog">
  4. <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">
  5. <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" />
  6. <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" />
  7. </xr-assets>
  8. <xr-env env-data="env1"/>
  9. <xr-node wx:if="loaded">
  10. <xr-node node-id="camera-target" position="0 0 0"></xr-node>
  11. <xr-node node-id="table-wrap" position="0 0 0">
  12. <xr-gltf node-id="mesh-gltf-table" position="0 -1 0" rotation="0 45 0" scale="0.5 0.5 0.5" model="gltf-table"></xr-gltf>
  13. </xr-node>
  14. <xr-camera
  15. id="camera" node-id="camera" position="2 1 2" clear-color="0.925 0.925 0.925 1"
  16. target="camera-target" background="ar"
  17. camera-orbit-control=""
  18. ></xr-camera>
  19. </xr-node>
  20. <xr-node node-id="lights">
  21. <xr-light type="ambient" color="1 1 1" intensity="0.2" />
  22. <xr-light type="directional" rotation="180 0 0" color="1 1 1" intensity="2" />
  23. </xr-node>
  24. </xr-scene>
  25. `;
  26. Page({
  27. behaviors:[sceneReadyBehavior],
  28. data: {
  29. xmlCode: '<div class="codeWrap">' + handleDecodedXML(xmlCode) + '</div>',
  30. }
  31. });