<xr-scene ar-system="modes:Plane" id="xr-scene" bind:ready="handleReady" bind:ar-ready="handleARReady" bind:pause="handlePause" bind:resume="handleResume">
  <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">
    <xr-asset-load type="raw" asset-id="records" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-record.json" options="encoding:utf-8" />
    <xr-asset-load type="raw" asset-id="note" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-note.txt" options="encoding:utf-8" />
    <xr-asset-load asset-id="anchor" type="keyframe" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-record-anchor-animation.json"/>
    <xr-asset-load type="gltf" asset-id="loading" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/loading.glb" />
    <xr-asset-load type="gltf" asset-id="anchor" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/ar-plane-marker.glb" />
    <xr-asset-load type="gltf" asset-id="butterfly" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/butterfly/index.glb" />
    <xr-asset-load type="gltf" asset-id="sky" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/sky.gltf" />
    <xr-asset-load type="gltf" asset-id="office" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/last-record-unlit.glb" />
    <xr-asset-load type="gltf" asset-id="hikari" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/hikari-unlit.glb" />
    <xr-asset-load type="gltf" asset-id="roam" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/roam-unlit.glb" />
    <xr-asset-load type="gltf" asset-id="xinyi" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/xr-frame-team/xinyi-unlit.glb" />
    <xr-asset-load type="texture" asset-id="particle-point" src="https://mmbizwxaminiprogram-1258344707.cos.ap-guangzhou.myqcloud.com/xr-frame/demo/particles/point.png" />
  </xr-assets>
  <xr-node layer="1">
    <xr-ar-tracker wx:if="{{loaded && !placed}}" mode="Plane" visible="false">
      <xr-node node-id="anchor" anim-keyframe="anchor" anim-autoplay="clip:parent">
        <xr-gltf model="anchor" />
        <xr-particle
          position="0 0.8 0"
          cube-shape="size:0.8 1.6 0.8" bind:touch-shape="handleShowDoor"
          capacity="4000" emit-rate="20"
          size="0.01 0.03" life-time="2.5 5" speed="0.2 0.4"
          start-color="1 1 1 1" end-color="1 1 1 0.5"
          emitter-type="BoxShape"
          emitter-props="minEmitBox:-0.15 -0.8 -0.15,maxEmitBox:0.15 -0.6 0.15,direction:0 1 0,direction2:0 1 0"
          atlas="numbers" atlas-frames="0 1" atlas-speed="4" atlas-random
        />
      </xr-node>
    </xr-ar-tracker>

    <xr-node id="setitem" node-id="setitem" visible="false">
      <xr-gltf
        id="sky" model="sky"
        states="cullOn: false, stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
      />

      <xr-gltf
        id="scene-mesh" model="office"
        states="stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
      />

      <xr-gltf id="hikari"
        position="-0.192 0.073 -5.403" rotation="0 106 0" model="hikari"
        anim-autoplay="clip:Sitting" capsule-shape="height:1;raduis:0.2;center:0 0.7 0"
        states="stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
        bind:touch-shape="handleTouchObj"
      />

      <xr-gltf id="roam"
        position="-2.404 0.015 -5.152" rotation="0 -84 0" model="roam"
        anim-autoplay="clip:Sitting" capsule-shape="height:1;raduis:0.2;center:0 0.7 0"
        states="stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
        bind:touch-shape="handleTouchObj"
      />

      <xr-gltf id="xinyi"
        position="-0.883 0.089 -7.118" rotation="0 -60 0" model="xinyi"
        anim-autoplay="clip:Sitting" capsule-shape="height:1;raduis:0.2;center:0 0.7 0"
        states="stencilComp: 3, stencilRef: 1, stencilReadMask: 1"
        bind:touch-shape="handleTouchObj"
      />

      <xr-node
        id="hikari-keyboard" position="-0.865 0.775 -5.276" rotation="0 9 0"
        cube-shape="size:0.3 0.05 0.4" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-telephone" position="-1.103 0.809 -4.786" rotation="0 0 0"
        cube-shape="size:0.07 0.16 0.2" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-qq" position="-1.14 1.344 -5.195" rotation="0 0 0"
        cube-shape="size:0.1 0.2 0.2" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-cap" position="-0.493 0.786 -4.598" rotation="0 56 0"
        cube-shape="size:0.3 0.05 0.15" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-calendar" position="-0.798 0.8 -4.674" rotation="0 111 0"
        cube-shape="size:0.2 0.05 0.1" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-drinks" position="-0.617 0.795 -4.749" rotation="0 52 0"
        cube-shape="size:0.15 0.1 0.1" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="chair" position="-0.413 0.638 -4.054" rotation="0 3 0"
        cube-shape="size:0.4 0.5 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="hikari-earphone" position="-0.892 0.752 -4.934" rotation="0 10 0"
        cube-shape="size:0.1 0.03 0.1" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="roam-pc" position="-1.69 0.805 -5.272" rotation="0 6 0"
        cube-shape="size:0.2 0.05 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="roam-monitor" position="-1.577 1.085 -4.565" rotation="0 143 0"
        cube-shape="size:0.05 0.4 0.5" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="xinyi-desktop" position="-0.181 0.787 -7.306" rotation="0 10 0"
        cube-shape="size:0.33 0.06 0.67" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="xinyi-plant" position="0.164 0.896 -7.923" rotation="0 10 0"
        cube-shape="size:0.33 0.3 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="xinyi-plant" position="0.164 0.896 -7.923" rotation="0 10 0"
        cube-shape="size:0.33 0.3 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="xinyi-box" position="-0.254 0.282 -8.048" rotation="0 0 0"
        cube-shape="size:0.5 0.5 0.5" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="disorder-desktop" position="-1.181 0.906 -4.05" rotation="0 272 0"
        cube-shape="size:0.5 0.3 0.65" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="fan" position="-2.179 0.459 -4.022" rotation="0 272 0"
        cube-shape="size:0.3 1 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="face-mask" position="-4.124 0.795 -4.512" rotation="0 286 0"
        cube-shape="size:0.2 0.05 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="oscilloscope" position="-1.729 0.875 -4.084" rotation="0 25 0"
        cube-shape="size:0.3 0.3 0.2" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="vege-dog" position="-1.872 0.833 -4.227" rotation="0 26 0"
        cube-shape="size:0.4 0.2 0.2" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="trash" position="-3.164 0.405 -3.856" rotation="0 0 0"
        cube-shape="size:0.3 0.63 0.55" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="light-monitor" position="-2.682 0.984 -7.266" rotation="0 0 0"
        cube-shape="size:0.1 0.28 0.55" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="charge-pal" position="-2.438 0.181 -7.887" rotation="0 0 0"
        cube-shape="size:0.2 0.28 0.3" bind:touch-shape="handleTouchObj"
      />
      <xr-node
        id="note" position="-0.719 0.747 -5.008" rotation="0 16 0"
        cube-shape="size:0.22 0.04 0.15" bind:touch-shape="handleTouchNote"
      />

      <xr-node wx:if="{{gateClosed}}">
        <xr-particle
          material="particle-mat" position="-2.2 0.2 -5"
          capacity="2000" emit-rate="40" never-cull
          size="0.06 0.12" life-time="15 20" speed="0.2 0.4"
          start-color="1 1 1 1" end-color="1 1 1 0.4"
          emitter-type="BoxShape"
          emitter-props="minEmitBox:-20 0 -20,maxEmitBox:20 0 20,direction:0 1 0,direction2:0 1 0"
          texture="particle-point"
        />
        <xr-node
          id="oberon" position="0 1.4 1" rotation="0 0 0"
          sphere-shape="radius:0.3" bind:touch-shape="handleTouchObj"
        >
          <xr-particle
            capacity="1000" emit-rate="80" never-cull
            size="0.02 0.03" life-time="1.5 2" speed="0.04 0.08"
            start-color="0.5 0.9 0.7 1" end-color="0.5 0.9 0.7 0.4"
            emitter-type="SphereShape"
            emitter-props="radius:0.05,randomizeDirection:0"
            texture="particle-point"
          />
        </xr-node>
        <xr-node
          id="noname" position="-1 1.4 1" rotation="0 0 0"
          sphere-shape="radius:0.3" bind:touch-shape="handleTouchObj"
        >
          <xr-particle
            capacity="1000" emit-rate="80" never-cull
            size="0.02 0.03" life-time="1.5 2" speed="0.04 0.08"
            start-color="0.5 0.7 0.9 1" end-color="0.5 0.7 0.9 0.4"
            emitter-type="SphereShape"
            emitter-props="radius:0.05,randomizeDirection:0"
            texture="particle-point"
          />
        </xr-node>
      </xr-node>

      <xr-node
        wx:if="{{placed && !gateClosed}}" id="door" position="0 1 0" scale="0 0 0"
      >
        <xr-mesh
          id="door-mesh" rotation="90 0 0" scale="0.8 1 1.6"
          geometry="plane"
          states="renderQueue: 1, stencilComp: 7, stencilRef: 1, stencilReadMask: 1, stencilWriteMask: 1, stencilPass: 1, stencilFail: 2, stencilZFail: 2"
        />
      </xr-node>
    </xr-node>

    <xr-element wx:if="{{!gateClosed}}">
      <xr-asset-render-texture asset-id="ar-camera" width="{{width}}" height="{{height}}" />
      <xr-asset-render-texture asset-id="main-camera" width="{{width}}" height="{{height}}" />

      <xr-asset-post-process asset-id="blur" type="blur" data="radius:0" />
      <xr-asset-post-process
        asset-id="vignette" type="vignette"
        data="intensity:0,smoothness:2,color:0.1 0.1 0.1 1"
      />
      <xr-camera
        id="ar-bg-camera" cull-mask="0" depth="0"
        background="ar" post-process="blur vignette"
        render-target="ar-camera"
      />

      <xr-asset-material asset-id="final" effect="last-record-final" uniforms="u_arBg:render-ar-camera,u_main:render-main-camera" />
      <xr-mesh node-id="final" layer="2" geometry="ar-camera-plane" material="final" position="0 0 2" />
      <xr-camera
        id="final-camera" cull-mask="0b101" depth="2"
        target="final" is-clear-color="false"
      />
    </xr-element>

    <xr-asset-post-process asset-id="bloom" type="bloom" is-hdr data="radius:32,intensity:2,threshold:0.7" />
    <xr-asset-post-process asset-id="tone" type="tone" />
    <xr-camera
      id="main-camera" near="0.1" far="2000" cull-mask="0b11" depth="1"
      is-ar-camera clear-color="0 0 0 0" post-process="bloom tone"
      render-target="main-camera"
    >
      <xr-gltf wx:if="{{arReady && !loaded}}" position="0 0 10" model="loading" anim-autoplay />
    </xr-camera>
  </xr-node>
  <xr-node node-id="lights">
    <xr-light type="ambient" color="1 1 1" intensity="2" />
  </xr-node>
</xr-scene>
