Anchor锚节点即超级衔接组节点,它的作用是衔接X3D三维立体空间中各个不同场景,使X3D世界变得更加生动有趣。可以利用Anchor锚节点直接上网,实现真正意义上的网络世界。
Anchor锚节点域、域名和域值:
DEF为节点定义一个名字,给该节点定义了唯一的ID,在其他节点就可以引用这个节点;
USE用来引用DEF定义的节点ID,即引用DEF定义的节点名字,同时忽略其他的属性和子对象;
description域:指定一个文本字符串提示,当移动光标到描点而不点击它时,浏览器现实该提示字符串文件;
url域:指定需装入文件的路径或网络导航器地址URL。
单击锚节点的子对象,可以跳转到其他网址;
parameter域:为X3D和HTML浏览器附加的信息,这些信息是一连串的字符串,格式上为“关键词=值”;
对传递的参数可以指定网络浏览器改变URL的存取方式;
bboxCenter域:指定了边界盒的中心从局部坐标系统原点的位置的偏移,默认值是:0.0 0.0 0.0;
bboxSize域:指定了边界盒尺寸在x、y、z轴方向的大小;
containerField域:表示容器域是field域标签的前缀,表示了子节点与父节点的关系;
children指定场景锚节点对象,他包含指向其他文件的超衔接。
class域:是用空格分开的类的列表,保留给XML样式表使用,只有X3D场景用XML编码时才支持class属性。
源代码:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE X3D PUBLIC "http://www.web3d.org/specifications/x3d-3.1.dtd"
- "file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd">
- <!--Warning: transitional DOCTYPE in source .x3d file-->
- <X3D profile="Immersive" version="3.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.1.xsd">
- <head>
- <meta content="px3d7-6.x3d" name="filename"/>
- <meta content="zjz-zjr-zjd" 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>
- <Scene>
- <Background skyColor="0.98 0.98 0.98"/>
- <Anchor description="main call px3d7-6-1.x3d" url="px3d7-6-1.x3d">
- <Transform translation="0 0 0">
- <Shape>
- <Appearance>
- <Material ambientIntensity="0.4" diffuseColor="0.3 0.2 0.0"
- shininess="0.2" specularColor="0.7 0.7 0.6"/>
- <ImageTexture url="men001.jpg"/>
- </Appearance>
- <Box size="4 7 0.5"/>
- </Shape>
- </Transform>
- <Transform translation="-1.6 -0.2 0.3">
- <Shape>
- <Appearance>
- <Material ambientIntensity="0.4" diffuseColor="0.5 0.5 0.7"
- shininess="0.2" specularColor="0.8 0.8 0.9"/>
- </Appearance>
- <Sphere radius="0.2"/>
- </Shape>
- </Transform>
- </Anchor>
- </Scene>
- </X3D>
被调用的px3d7-6-1.x3d文件源代码:
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE X3D PUBLIC "http://www.web3d.org/specifications/x3d-3.1.dtd"
- "file:///www.web3d.org/TaskGroups/x3d/translation/x3d-3.1.dtd">
- <!--Warning: transitional DOCTYPE in source .x3d file-->
- <X3D profile="Immersive" version="3.1"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.1.xsd">
- <head>
- <meta content="px3d7-6-1.x3d" name="filename"/>
- <meta content="zjz-zjr-zjd" 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>
- <Scene>
- <Anchor description="return main program" url="px3d7-6.x3d">
- <Background skyColor="0.98 0.98 0.98"/>
- <Transform translation="0 4 0">
- <Shape>
- <Appearance>
- <Material/>
- <ImageTexture url="0108.jpg"/>
- </Appearance>
- <Box size="4 2 1"/>
- </Shape>
- </Transform>
- <Transform translation="0 1 0">
- <Shape>
- <Appearance>
- <Material ambientIntensity="0.4" diffuseColor="0.5 0.5 0.7"
- shininess="0.2" specularColor="0.8 0.8 0.9"/>
- </Appearance>
- <Cylinder height="5" radius="0.3"/>
- </Shape>
- </Transform>
- <Transform translation="0 -1.5 0">
- <Shape>
- <Appearance>
- <Material ambientIntensity="0.4" diffuseColor="0.5 0.5 0.7"
- shininess="0.2" specularColor="0.8 0.8 0.9"/>
- </Appearance>
- <Cylinder height="0.3" radius="1"/>
- </Shape>
- </Transform>
- </Anchor>
- </Scene>
- </X3D>