index.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334
  1. var sceneReadyBehavior = require('../../behavior-scene/scene-ready');
  2. var handleDecodedXML = require('../../behavior-scene/util').handleDecodedXML;
  3. var escapeMarkup = require('../../behavior-scene/util').escapeMarkup;
  4. var xmlCode = escapeMarkup(`<xr-scene id="xr-scene" bind:tick="handleTick" bind:ready="handleReady">
  5. <xr-assets bind:progress="handleAssetsProgress" bind:loaded="handleAssetsLoaded">
  6. <xr-asset-load type="texture" asset-id="earth-texture" src="..." />
  7. <xr-asset-load type="texture" asset-id="moon-texture" src="..." />
  8. <xr-asset-material asset-id="standard-mat" effect="standard" />
  9. </xr-assets>
  10. <xr-node>
  11. <xr-mesh node-id="mesh-earth" position="0 0 0" scale="8 8 8" geometry="sphere" material="standard-mat" uniforms="u_baseColorMap: earth-texture" bind:dragShape="handleEarthRotation" sphere-shape></xr-mesh>
  12. <xr-mesh node-id="mesh-moon" position="10 0 0" scale="1.5 1.5 1.5" rotation="0 90 0" geometry="sphere" material="standard-mat" uniforms="u_baseColorMap: moon-texture" bind:dragShape="handleDragMoon" bind:touchShape="handleTouchMoon" bind:untouchShape="handleUntouchMoon" sphere-shape="radius: 1.5">
  13. </xr-mesh>
  14. <xr-camera
  15. id="camera" node-id="camera" position="0 20 -35" clear-color="0 0 0 1"
  16. target="mesh-earth"
  17. ></xr-camera>
  18. </xr-node>
  19. <xr-node node-id="lights">
  20. <xr-light type="ambient" color="1 1 1" intensity="0.1" />
  21. <xr-light id="directional-light" type="directional" rotation="0 60 0" color="1 1 1" intensity="5" />
  22. </xr-node>
  23. </xr-scene>`);
  24. var jsCode = "not implemented";
  25. Page({
  26. behaviors:[sceneReadyBehavior],
  27. data: {
  28. xmlCode: '<div class="codeWrap">' + handleDecodedXML(xmlCode) + '</div>',
  29. jsCode: jsCode
  30. }
  31. });