x3d文件语法结构

 x3d文件语法结构
        x3d文件语法结构包含文件结构、文件头、文件体和注释。
        x3d文件结构由x3d文件头、x3d主程序概貌组成。其中、x3d主程序概貌又包含头文档盒场景,头文档又包含组建和说明信息,场景包含x3d中的各种三维立体节点文件。
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE X3D PUBLIC "http://www.web3d.org/specifications/x3d-3.1.dtd"
  3.                      "file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd">
  4. <!--Warning:  transitional DOCTYPE in source .x3d file-->
  5. <X3D profile="Immersive" version="3.0"
  6.   xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.1.xsd">
  7.   <head>
  8.     <meta content="X3D Դʵ=name=" name="filename"/>
  9.     <meta content="name=zjz" name="author"/>
  10.     <meta content="*enter name of original author here*" name="creator"/>
  11.     <meta
  12.       content="*enter copyright information here* Example:  Copyright (c) Web3D Consortium Inc. 2006" name="rights"/>
  13.     <meta
  14.       content="*enter online Uniform Resource Identifier (URI) or Uniform Resource Locator (URL) address for this file here*" name="identifier"/>
  15.     <meta
  16.       content="X3D-Edit, http://www.web3d.org/x3d/content/README.X3D-Edit.html" name="generator"/>
  17.   </head>
  18.   <Scene>
  19.     <Background skyColor="0.98 0.98 0.98"/>
  20.     <Transform translation="0 1 0">
  21.       <Shape>
  22.         <Appearance>
  23.           <Material diffuseColor="0 1 0"/>
  24.         </Appearance>
  25.         <Sphere radius="1"/>
  26.       </Shape>
  27.     </Transform>
  28.     <Transform translation="0 -1.6 0">
  29.       <Shape>
  30.         <Appearance>
  31.           <Material diffuseColor="0 0 1"/>
  32.         </Appearance>
  33.         <Cone bottom="true" bottomRadius="2" height="4" side="true"/>
  34.       </Shape>
  35.     </Transform>
  36.   </Scene>
  37. </X3D>
 
 
  1. x3d头文件。在每个x3d文件中,文件头都必须位于x3d文件的第一行。x3d使用xml语法格式声明,<?xml version="1.0" encoding="UTF-8"?>,声明从“<?xml”开始,到“?>”结束,version属性指明编写文档的xml版本号,encoding表示使用编码字符集。
  2. x3d文档类型声明。x3d文档类型声明用来在文档中详细地说明文档信息,必须出现在文档的第一个元素前,文档类型采用DTD格式:<!DOCTYPE X3D PUBLIC "http://www.web3d.org/specifications/x3d-3.1.dtd"
                         "file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd">
  3. x3d文件体。x3d文件主要描述的是x3d主程序概貌(profile),主程序概貌又涵盖了组件和说明信息,以及场景中的各个节点信息。x3d根文档标签:<X3D profile="Immersive" version="3.0"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.1.xsd"> </x3d>                              
  4. x3d头文档<head>描述:  <head>
        <meta content="X3D &#1332;&#693;=name=" name="filename"/>
        <meta content="name=zjz" name="author"/>
        <meta content="*enter name of original author here*" name="creator"/>
        <meta
          content="*enter copyright information here* Example:  Copyright (c) Web3D Consortium Inc. 2006" name="rights"/>
        <meta
          content="*enter online Uniform Resource Identifier (URI) or Uniform Resource Locator (URL) address for this file here*" name="identifier"/>
        <meta
          content="X3D-Edit, http://www.web3d.org/x3d/content/README.X3D-Edit.html" name="generator"/>
      </head>
  5. x3d场景主题<Scene>描述,场景主体由一对<Scene>和</Scene>组成,中间可以插入背景节点、视角节点、导航节点、几何几点、复杂造型节点等,用这些节点来创建场景三维立体空间所需要的各种场景和造型。                                     <Scene>
        <Background skyColor="0.98 0.98 0.98"/>
        <Transform translation="0 1 0">
          <Shape>
            <Appearance>
              <Material diffuseColor="0 1 0"/>
            </Appearance>
            <Sphere radius="1"/>
          </Shape>
        </Transform>
        <Transform translation="0 -1.6 0">
          <Shape>
            <Appearance>
              <Material diffuseColor="0 0 1"/>
            </Appearance>
            <Cone bottom="true" bottomRadius="2" height="4" side="true"/>
          </Shape>
        </Transform>
      </Scene>
  6. x3d文件注释:<!--Warning:  transitional DOCTYPE in source .x3d file-->,注释以一个符号"<!--"开头,以"-->"结束。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值