Difference between revisions of "X3D and HTML5 examples"

From Web3D.org
Jump to: navigation, search
Line 2: Line 2:
  
  
       &lt;a href='aScene.x3d' title='A new X3D document.window'>Enter My Scene</a>
+
       &lt;a href='aScene.x3d' title='A new X3D document.window'>Enter My Scene&lt;/a>
  
 
* html anchor link.
 
* html anchor link.
Line 9: Line 9:
 
* <b>Draft Example #2, embedded using object element. </b>  
 
* <b>Draft Example #2, embedded using object element. </b>  
  
     <object name='x3d' type='model/x3d+xml'  
+
     &lt;object name='x3d' type='model/x3d+xml'  
 
       allow-same-origin allow-scripts>
 
       allow-same-origin allow-scripts>
       <param name='src' value='aScene.x3d'>
+
       &lt;param name='src' value='aScene.x3d'>
 
         &lt;table>...</table>
 
         &lt;table>...</table>
     </object>
+
     &lt;/object>
  
 
* Opens nested browsing context in parent block element.
 
* Opens nested browsing context in parent block element.
Line 22: Line 22:
 
* <b>Draft Example #3, served as application/xhtml+xml</b>
 
* <b>Draft Example #3, served as application/xhtml+xml</b>
  
       <?xml version="1.0" encoding="utf-8" ?>
+
       &lt;?xml version="1.0" encoding="utf-8" ?>
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
+
       &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  
 
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
       <html xmlns="http://www.w3.org/1999/xhtml">
+
       &lt;html xmlns="http://www.w3.org/1999/xhtml">
         <head>
+
         &lt;head>
           <style type=text/css'>
+
           &lt;style type=text/css'>
 
             x3d:X3D { height:200px;width:200px; }
 
             x3d:X3D { height:200px;width:200px; }
           </style>
+
           &lt;/style>
         </head>
+
         &lt;/head>
         <body>
+
         &lt;body>
           <x3d:x3d  
+
           &lt;x3d:x3d  
 
             xmlns:x3d=
 
             xmlns:x3d=
 
             "http://www.web3d.org/specifications/x3d-3.2.xsd">
 
             "http://www.web3d.org/specifications/x3d-3.2.xsd">
             <Scene>
+
             &lt;Scene>
               <Shape>
+
               &lt;Shape>
                 <Box size="4 4 4" />
+
                 &lt;Box size="4 4 4" />
               </Shape>
+
               &lt;/Shape>
               <Shape>
+
               &lt;Shape>
                 <Text string='"This is X3D Text"' />
+
                 &lt;Text string='"This is X3D Text"' />
               </Shape>
+
               &lt;/Shape>
           </Scene>
+
           &lt;/Scene>
         </x3d:x3d>
+
         &lt;/x3d:x3d>
       </body>
+
       &lt;/body>
       </html>
+
       &lt;/html>
  
  
 
* <b>Draft Example #4, served as text/html</b>
 
* <b>Draft Example #4, served as text/html</b>
  
       <!DOCTYPE html>
+
       &lt;!DOCTYPE html>
       <html>
+
       &lt;html>
         <head>
+
         &lt;head>
           <style type=text/css'>
+
           &lt;style type=text/css'>
 
             X3D { height:100%;width:100%; }
 
             X3D { height:100%;width:100%; }
           </style>
+
           &lt;/style>
         </head>
+
         &lt;/head>
         <body>
+
         &lt;body>
           <X3D name='x3dBlock' type='model/x3d+xml'  
+
           &lt;X3D name='x3dBlock' type='model/x3d+xml'  
 
             allow-same-origin allow-scripts>
 
             allow-same-origin allow-scripts>
             <Scene>
+
             &lt;Scene>
               <Viewpoint descrition='Start' />
+
               &lt;Viewpoint descrition='Start' />
               <Shape>
+
               &lt;Shape>
                 <Box size="4 4 4" />
+
                 &lt;Box size="4 4 4" />
               </Shape>
+
               &lt;/Shape>
               <Shape>
+
               &lt;Shape>
                 <Text string='"This is X3D Text"' />
+
                 &lt;Text string='"This is X3D Text"' />
               </Shape>
+
               &lt;/Shape>
             </Scene>
+
             &lt;/Scene>
           </X3D>
+
           &lt;/X3D>
           <mathml>
+
           &lt;mathml>
             <mrow><mi> x </mi><mo> + </mo>
+
             &lt;mrow>&lt;mi> x &lt;/mi>&lt;mo> + &lt;/mo>
             <mrow><mi> a </mi><mo> / </mo><mi> b </mi>
+
             &lt;mrow>&lt;mi> a &lt;/mi>&lt;mo> / &lt;/mo>&lt;mi> b &lt;/mi>
             </mrow></mrow>
+
             &lt;/mrow>&lt;/mrow>
           </mathml>
+
           &lt;/mathml>
           <ruby>
+
           &lt;ruby>
             <rb>WWW</rb><rt>World Wide Web</rt>
+
             &lt;rb>WWW&lt;/rb>&lt;rt>World Wide Web&lt;/rt>
           </ruby>
+
           &lt;/ruby>
         </body>
+
         &lt;/body>
       </html>
+
       &lt;/html>

Revision as of 00:22, 16 October 2009

  • 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, embedded 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 in this case.)
  • Connections with DOM via event listeners (DOM<=>SAI).
  • Set of negotiated <param> pairs: initialization and runtime.
  • 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">
            <Scene>
              <Shape>
                <Box size="4 4 4" />
              </Shape>
              <Shape>
                <Text string='"This is X3D Text"' />
              </Shape>
          </Scene>
        </x3d:x3d>
      </body>
      </html>


  • Draft Example #4, served as text/html
      <!DOCTYPE html>
      <html>
        <head>
          <style type=text/css'>
            X3D { height:100%;width:100%; }
          </style>
        </head>
        <body>
          <X3D name='x3dBlock' type='model/x3d+xml' 
            allow-same-origin allow-scripts>
            <Scene>
              <Viewpoint descrition='Start' />
              <Shape>
                <Box size="4 4 4" />
              </Shape>
              <Shape>
                <Text string='"This is X3D Text"' />
              </Shape>
            </Scene>
          </X3D>
          <mathml>
            <mrow><mi> x </mi><mo> + </mo>
            <mrow><mi> a </mi><mo> / </mo><mi> b </mi>
            </mrow></mrow>
          </mathml>
          <ruby>
            <rb>WWW</rb><rt>World Wide Web</rt>
          </ruby>
        </body>
      </html>