x3d从内联网址导入和导出节点 [英] x3d import and export nodes from inline url

查看:188
本文介绍了x3d从内联网址导入和导出节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从父级x3d文件中的内联x3d文件访问节点。例如,说我们有一个房间模型作为一个x3d文件。我们用几把椅子填充这个房间。我们使用内联网址来填充room.x3d和几个chair.x3d文件。我们在room.x3d文件里面有这样的东西放置椅子:

 < Transform DEF ='Chair'
translation ='0 0 0'
scale ='1 1 1'
rotation =' - 0.600546 0.600546 90 0'>
<内联DEF ='chr'url ='Chair.x3d'/>
< / Transform>

现在,我需要访问Chair.x3d中的几个节点来操纵场景。我已经阅读了有关IMPORT和EXPORT以及如何使用它们从内联网址获取节点,但是我还没有找到一个很好的工作示例。我看过这个:



http://www.web3d.org/x3d/content/examples/Basic/development/_pages/page27.html



但似乎不起作用。



我也读过这个:



http://www.web3d.org/files /specifications/19775-1/V3.2/Part01/components/networking.html



但语法是VRML而不是x3d。



如果有人可以给我一个如何使用IMPORT和EXPORT以及如何从内联网址路由节点的例子,以便我可以发送事件等,这将是很大的赞赏。让我知道我是否不够清楚。

解决方案

这对我有用:
X3D的源文件对象(棕色圆柱):

 <?xml version =1.0encoding =UTF-8?> 
<!DOCTYPE X3D PUBLICISO // Web3D // DTD X3D 3.0 // EN.stuff ..>
< X3D profile ='Interchange'version ='3.0'
xmlns:xsd ='http://www.w3.org/2001/XMLSchema-instance'..stuff ..>
<场景>
<变形DEF ='XFER_OBJECT'>
< Shape>
<圆柱半径='1'height ='1'/>
<外观>
< Material diffuseColor ='。9 .3 .3'/>
< /外观>
< / Shape>
< / Transform>
< Export localDEF ='XFER_OBJECT'as ='Cyl'/>
< / Scene>
< / X3D>

和我的xhtml文件中的url / import代码:

 <变换翻译='2 0 0'> 
<内联DEF ='objectBrnCyl'url ='test33.x3d'/>
< / Transform>
< IMPORT InlineDEF ='objectBrnCyl'exportDEF ='Cyl'as ='brnCyl'/>

尚未完成案例测试命令 - 文档有点怪异。 >

I need to get access to nodes from an inline x3d file in a parent x3d file. For example, say we have a room model as an x3d file. We populate this room with several chairs. We use the inline url to populate room.x3d with several chair.x3d files. We've got something like this inside the room.x3d file to place chairs:

<Transform DEF = 'Chair'
        translation = '0 0 0'
        scale = '1 1 1'
        rotation='-0.600546 0.600546 90 0'>
        <Inline DEF ='chr' url = 'Chair.x3d' />
    </Transform>

Now, I need to get access to a few nodes within Chair.x3d to manipulate the scene. I have read about IMPORT and EXPORT and how they are used to get nodes from an inline url, however I have not found a good working example yet. I've looked at this:

http://www.web3d.org/x3d/content/examples/Basic/development/_pages/page27.html

But it does not seem to work.

I've also read this:

http://www.web3d.org/files/specifications/19775-1/V3.2/Part01/components/networking.html

But the syntax is VRML as opposed to x3d.

If anyone could give me a quick example of how to use IMPORT and EXPORT and how to route the nodes from the inline url so I can send it events, etc. it would be greatly appreciated. Let me know if I'm not being clear enough.

解决方案

This works for me: Source FILE of X3D object ( a brown cylinder):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" .stuff..>
<X3D profile='Interchange' version='3.0'
    xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' ..stuff..>
<Scene>
<Transform DEF='XFER_OBJECT'>
    <Shape> 
        <Cylinder radius='1' height='1'/> 
        <Appearance> 
            <Material diffuseColor='.9 .3 .3'/> 
        </Appearance>
    </Shape> 
</Transform>
<Export localDEF='XFER_OBJECT' as='Cyl'/>
</Scene>
</X3D>

and the url/import code in my xhtml file:

<Transform translation='2 0 0' >
    <Inline DEF='objectBrnCyl' url='"test33.x3d"' />
</Transform>
<IMPORT InlineDEF='objectBrnCyl' exportDEF='Cyl' as='brnCyl'/>

Haven't finished case testing the commands yet -- the documentation is a little spooky.

这篇关于x3d从内联网址导入和导出节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆