index.wxml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <xr-scene id="xr-scene" ar-system="modes:Marker" bind:ready="handleReady" bind:ar-ready="handleARReady">
  2. <xr-assets >
  3. <xr-asset-material asset-id="video-bg-mat" effect="simple" uniforms="u_baseColorFactor: 0.0 0.0 0.0 1" />
  4. <xr-asset-material asset-id="loading-mat" effect="simple" uniforms="u_baseColorFactor: 1.0 1.0 1.0 0.8" />
  5. </xr-assets>
  6. <xr-node wx:if="{{arReady}}">
  7. <xr-ar-tracker
  8. mode="Marker"
  9. wx:for="{{markerList}}" wx:for-item="markerItem"
  10. id="marker-{{markerItem.id}}"
  11. src="{{markerItem.markerImage}}" bind:ar-tracker-switch="handleTrackerSwitch"
  12. >
  13. <!-- 扫描情况 -->
  14. <xr-node position="0.5 0 0" id="normal-right-{{markerItem.id}}" wx:if="{{markerItem.renderType === 'scan'}}"></xr-node>
  15. <!-- gltf情况 -->
  16. <xr-node wx:if="{{markerItem.renderType === 'gltf' && gltfLoaded}}">
  17. <xr-gltf node-id="mesh-gltf-fiesta_tea" position="0 -1.6 1" rotation="-90 0 0" scale="0.6 0.6 0.6" model="gltf-{{markerItem.id}}"
  18. states="stencilTestOn: true, stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
  19. ></xr-gltf>
  20. <xr-mesh node-id="plane-cull" position="0 0 0" rotation="0 0 0" scale="1 0.1 0.9" geometry="plane"
  21. states="renderQueue: 1, stencilTestOn: true, stencilComp: 7, stencilRef: 1, stencilReadMask: 1, stencilWriteMask: 1, stencilPass: 1, stencilFail: 2, stencilZFail: 2"
  22. ></xr-mesh>
  23. </xr-node>
  24. <!-- 视频情况 -->
  25. <xr-node wx:if="{{markerItem.renderType === 'video'}}">
  26. <xr-node wx:if="{{videoLoaded}}">
  27. <xr-mesh wx:if="{{videoRatioLoaded}}" scale="{{markerWidth}} 1 {{markerHeight}}" geometry="plane" material="video-bg-mat"
  28. states="cullOn: false"
  29. />
  30. <xr-mesh position="0 0.01 0" scale="{{markerWidth}} 1 {{markerHeight}}" geometry="plane" material="video-mat-{{markerItem.id}}" />
  31. </xr-node>
  32. <xr-node wx:else>
  33. <xr-mesh wx:if="{{videoRatioLoaded}}" scale="{{markerWidth}} 1 {{markerHeight}}" geometry="plane" material="loading-mat"
  34. states="cullOn: false, alphaMode: BLEND,renderQueue: 2501"
  35. />
  36. </xr-node>
  37. </xr-node>
  38. </xr-ar-tracker>
  39. <xr-camera
  40. id="camera" node-id="camera" position="0 0 4" clear-color="0.925 0.925 0.925 1"
  41. background="ar"
  42. near="0.1"
  43. far="2000"
  44. is-ar-camera
  45. ></xr-camera>
  46. </xr-node>
  47. <xr-node node-id="lights">
  48. <xr-light type="ambient" color="1 1 1" intensity="1" />
  49. <xr-light type="directional" rotation="40 170 0" color="1 1 1" intensity="3" />
  50. </xr-node>
  51. </xr-scene>