index.wxml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <xr-scene ar-system="modes:Marker;" bind:ready="handleReady" bind:ar-ready="handleARReady">
  2. <xr-assets>
  3. <xr-asset-load
  4. type="env-data" asset-id="env1" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/env-test.bin"
  5. />
  6. <xr-asset-load type="gltf" asset-id="gltf-damageHelmet" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/damage-helmet/index.gltf" />
  7. </xr-assets>
  8. <xr-node>
  9. <xr-env env-data="env1" />
  10. <!-- marker -->
  11. <!-- <xr-ar-tracker id="lockTracker" mode="Marker" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/marker/2dmarker-test.jpg">
  12. <xr-node id="lockItem">
  13. <xr-gltf model="butterfly" anim-autoplay position="0.2 0 -0.2" scale="0.6 0.6 0.6" rotation="0 -50 0" />
  14. <xr-gltf model="butterfly" anim-autoplay position="0.4 0 0.3" scale="0.5 0.5 0.5" rotation="0 -50 0" />
  15. <xr-gltf model="butterfly" anim-autoplay position="-0.3 0 0.3" scale="0.4 0.4 0.4" rotation="0 -50 0" />
  16. </xr-node>
  17. </xr-ar-tracker> -->
  18. <!-- marker 会动态创建并放在root下 -->
  19. <xr-shadow id="root"></xr-shadow>
  20. <xr-camera
  21. id="camera" node-id="camera" clear-color="0.925 0.925 0.925 1"
  22. background="ar" is-ar-camera
  23. >
  24. <!-- 将模型放在相机内部,相当于是放在视图空间里面,只需要z轴正方向移动,就是远离相机 -->
  25. <!-- 放ar相机内部,这个流程有bug,感觉是vk返回的矩阵里面有负数,准备排查 -->
  26. <xr-gltf
  27. wx:if="{{markerMatch}}"
  28. node-id="gltf-damageHelmet" position="0 0 6" rotation="0 0 0" scale="1 1 -1" model="gltf-damageHelmet"
  29. ></xr-gltf>
  30. </xr-camera>
  31. </xr-node>
  32. <xr-node node-id="lights">
  33. <xr-light type="ambient" color="1 1 1" intensity="0.5" />
  34. <xr-light type="directional" rotation="20 120 0" color="1 1 1" intensity="2" />
  35. </xr-node>
  36. </xr-scene>