index.js 2.1 KB

123456789101112131415161718192021222324252627282930
  1. var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
  2. var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML;
  3. var xmlCode = `<xr-scene id="xr-scene">
  4. <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">
  5. <xr-asset-material asset-id="standard-mat" effect="standard" />
  6. </xr-assets>
  7. <xr-node>
  8. <xr-mesh node-id="mesh-plane" position="0 -0.05 -4" rotation="0 0 0" scale="5 1 5" geometry="plane" material="standard-mat" uniforms="u_baseColorFactor:0.48 0.78 0.64 1"></xr-mesh>
  9. <xr-mesh node-id="mesh-cube" position="-1 0.5 -3.5" scale="1 1 1" rotation="0 45 0" geometry="cube" material="standard-mat" uniforms="u_baseColorFactor:0.298 0.764 0.85 1"></xr-mesh>
  10. <xr-mesh node-id="mesh-sphere" position="0 1.25 -5" scale="1.25 1.25 1.25" geometry="sphere" material="standard-mat" uniforms="u_baseColorFactor:0.937 0.176 0.368 1"></xr-mesh>
  11. <xr-mesh node-id="mesh-cylinder" position="1 0.7 -3.5" scale="1 0.7 1" geometry="cylinder" material="standard-mat" uniforms="u_baseColorFactor:1 0.776 0.364 1"></xr-mesh>
  12. <xr-camera
  13. id="camera" node-id="camera" position="0 1.6 0" clear-color="0.925 0.925 0.925 1"
  14. target="mesh-sphere"
  15. camera-orbit-control=""
  16. ></xr-camera>
  17. </xr-node>
  18. <xr-node node-id="lights">
  19. <xr-light type="ambient" color="1 1 1" intensity="1" />
  20. <xr-light type="directional" rotation="40 170 0" color="1 1 1" intensity="3" />
  21. </xr-node>
  22. </xr-scene>`;
  23. Page({
  24. behaviors:[sceneReadyBehavior],
  25. data: {
  26. xmlCode: '<div class="codeWrap">' + handleDecodedXML(xmlCode) + '</div>',
  27. }
  28. });