X3D and HTML5 examples

From Web3D.org
Revision as of 16:25, 13 October 2009 by Joedwil (Talk | contribs)

Jump to: navigation, search
  • (We likely need multiple examples corresponding to DOM/SAI approaches)
  • Joe - draft Example #1, Anchor link to new document


      <a href='aScene.x3d' title='A new X3D document.window'>Enter My Scene</a>
  • html anchor link.
  • In this case the host browser uses whatever it has access to in order to create a new window browsing context for the target .x3d resource.
  • Draft Example #2, embeddeed using object element.
    <object name='x3d' type='model/x3d+xml' allow-same-origin allow-scripts>
         <param name='src' value='aScene.x3d'>
        <table>...</table>
      </object>
  • Opens nested browsing context in parent block element.
  • Fallback to html table.
  • Connections with DOM via event listeners (DOM<=>SAI).
  • Set of negotiated <param> pairs: initialization and runtime.
  • Joe - draft Example #3, served as application/xhtml+xml
      <?xml version="1.0" encoding="utf-8" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
          <style type=text/css'>
            x3d:X3D { height:200px;width:200px; }
          </style>
        </head>
        <body>
          <x3d:x3d xmlns:x3d="http://www.web3d.org/specifications/x3d-3.2.xsd">
            <x3d:Scene>
              <x3d:Shape>
                <x3d:Box x3d:size="4 4 4" />
              </x3d:Shape>
              <x3d:Shape>
                <x3d:Text x3d:string='"This is X3D Text"' />
              <x3d:/Shape>
          </x3d:Scene>
        </x3d:x3d>
      </body>
      </html>


  • Joe - draft Example #4, served as text/html
      <!DOCTYPE html>
      <html>
        <head>
          <style type=text/css'>
            X3D { height:200px;width:200px; }
          </style>
        </head>
        <body>
          <X3D>
            <Scene>
              <Shape>
                <Box size="4 4 4" />
              </Shape>
              <Shape>
                <Text string='"This is X3D Text"' />
              </Shape>
            </Scene>
          </X3D>
        </body>
      </html>