问题标签 [x3d]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
510 浏览

javascript - 如何在同一鼠标事件中同时旋转两个不同的 X3D 场景?

我需要一些java脚本或jQuery吗?我只是问,因为我需要这样的东西http://examples.x3dom.org/cadViewer/slimViewerConrod/index.html。如您所见,您可以使用轴(辅助场景)旋转主对象(主场景)以及相同的鼠标事件。我对 X3DOM 比较陌生,我只是想问一下,因为我不知道它是如何工作的。如果有帮助,我的 X3D 场景是:

<X3D id="x3dElement"> <Scene id='scene'>
<Viewpoint id="part7" position=" 0.028793486820279934 0.06097637432245687 -0.009845212995355457" description="camera"></Viewpoint> <Group id='alles' children='gr1 gr2 gr3' render='true'> <Group id='gr1' children='gr2 gr3' render='true'> <transform translation='0 0 0' rotation='0 0 0 0'> <Inline nameSpaceName="case" mapDEFToID="true" url="case1.x3d"/> </transform>
<transform translation='0 0.02 0.031' Rotation='0.86603 0 0 0'> <transform Rotation='0 0 0 0'> <Inline nameSpaceName="switch" mapDEFToID="true" url="switch1.x3d"/> <Inline id="b_sauele" nameSpaceName="inline" mapDEFToID="true" url="inlineSrc/bSauele/bolt1.x3d" onload="init()" ></Inline>
</transform> </transform> <transform translation='-0.03 -0.0155 0.024' rotation='0 1 0 1.5708'> <transform rotation='1 0 0 3.1416'> <Inline nameSpaceName="socket" mapDEFToID="true" url="socket2.x3d"/> </transform> </transform> <transform translation='-0.03 -0.0155 -0.024' rotation='1 0 0 3.1416'> <transform rotation='0 1 0 1.5708'> <Inline nameSpaceName="socket" mapDEFToID="true" url="socket2.x3d"/> </transform> </transform> <transform translation='0.03 -0.0155 -0.024' rotation='1 0 0 3.1416'> <transform rotation='0 1 0 1.5708'> <Inline nameSpaceName="socket" mapDEFToID="true" url="socket2.x3d"/> </transform> </transform> <transform translation='0.03 -0.0155 0.024' rotation='1 0 0 3.1416'> <transform rotation='0 1 0 1.5708'> <Inline nameSpaceName="socket" mapDEFToID="true" url="socket2.x3d"/> </transform> </transform> </Group> <Group id='gr2' children='gr3' render='true'> <transform translation='0 -0.018 -0.01988' Rotation='0 0 0 0'> <Inline nameSpaceName="head" mapDEFToID="true" url="head1.x3d"/> </transform> </Group> <Group id='gr3' render='true'> <transform translation='0 -0.05 -0.0275' Rotation='0 0 0 0'> <Inline nameSpaceName="shaft" mapDEFToID="true" url="shaft2.x3d"/> </transform> <transform translation='0.0129 0.0129 -0.009' Rotation='0 1 0 3.1416'> <Inline nameSpaceName="bolt" mapDEFToID="true" url="bolt1.x3d"/>
</transform> <transform translation='-0.0129 0.0129 0.009' Rotation='0 1 0 3.1416'> <Inline nameSpaceName="bolt" mapDEFToID="true" url="bolt1.x3d"/> </transform>
</Group>
</Group>
</Scene> </x3d>
<X3D id='CoordinateAxes' showStat='false' showLog='false'> <scene id="helper_scene"> <viewpoint id="coordinateAxesViewpoint" centerOfRotation='0 0 0' position='0 0 3'></viewpoint> <Inline mapDEFToID="true" nameSpaceName="CoordinateAxes" url="data/CoordinateAxes.x3d"></Inline> </scene> </X3D>'>

0 投票
2 回答
1064 浏览

x3d - 使用 X3D 和 Javascript

我应该使用 X3D 开发一个项目。我有一个想法创建一个 DXf 文件到 X3D 的转换器。但是,要做到这一点,我必须使用 Javascript 来正确管理它,但我还没有找到将 Javascript 与 X3D 集成的方法。有人知道这样做的方法吗?以前,我虽然在加载 dxf 文件时,得到我需要的数据,然后将其保存为 X3D 文件,就像编写 XML 一样。

提前致谢

0 投票
1 回答
470 浏览

javascript - 通过变量使用 X3D 变换转换进行操作

你能告诉我如何在 X3d 字段转换的字段值中使用变量吗?我喜欢以 mm 为单位处理场景中的对象,因为我有来自 autocad 的对象,所以我的想法是指定我的计算平均值,例如var mm = 0.0010236666666667然后像 setAttribute('translation','(mm*1000) 0 0'); 非常感谢大家 ;)

0 投票
2 回答
2136 浏览

x3d - X3DOM 不拾取外部 x3d 文件

我是 3D 图形世界的新手。我有一个要在网络浏览器中显示的 x3d 文件。我正在尝试使用以下代码。

这是写在本地 html 文件中的,“full.x3d”文件与 html 文件位于同一目录中。当我打开 html 文件时,x3d 框只显示正在加载......即使经过很长时间也没有加载。

x3d 文件本身很好。如果我手动将其内容复制到 html 文件,我会得到一个很好的输出。

我不确定为什么 x3dom 没有从文件中获取数据。我没有使用任何本地服务器,直接在浏览器中打开html。

而且这个问题不仅限于我的文件。当我从 x3d 教程网站下载并运行示例文件时,它也无法加载附加的 x3d 文件。

0 投票
0 回答
183 浏览

javascript - X3DOM:ROUTE 与 DOM 操作

我想在 X3DOM 中做一些平移和旋转动画。

一种方法是使用 Routes、TimeSensors 和 PositionInterpolators。

另一种方法是通过 DOM 操作: document.getElementById('myTransform').translation='2 3 1'; 然后将通过 setTimeout 或 requestAnimationFrame 依次多次调用这些调用。

路由是否提供更好的性能?还有其他优点或缺点吗?

0 投票
1 回答
262 浏览

blender - x3d 光通过“墙壁”投射阴影

我想为建筑物和内部灯光建模。但是阴影存在问题......我附上了两张截图1)它应该是什么样子(在搅拌机中渲染场景)和2)它看起来如何(在浏览器中导出到x3d,x3dom)。

光线投射到四面八方,不仅通过立方体的开放面......

它应该是什么样子 它看起来如何,我不知道为什么 感谢您的帮助,如何实现仅一侧投射的光...

问候

阿德里安娜

0 投票
1 回答
83 浏览

textures - 呈现为完全透明的半透明像素

X3DOM(WebGL 框架)将纹理上的一些半透明像素渲染为完全透明:

http://54.213.93.173/fx/simple/

这将创建一个可见的边框。颜色应该与背景平滑融合,就像在纹理中一样:

http://54.213.93.173/fx/simple/transp.png

如果我在 X3D 文件中执行相同的操作并使用 X3D 查看器(例如 Instant Reality)进行渲染,则不会出现此问题:

http://54.213.93.173/fx/simple/simple.x3d

另外,我认为 X3DOM 不会呈现透明度高于 0.9 的任何内容。如果这是相关的,有没有办法提高这个门槛?

这是浏览器实现 WebGL 方式的问题吗?

0 投票
1 回答
3669 浏览

rotation - 在 x3d 中旋转对象

所以在过去的几个小时里,我一直在尝试让我从这里得到的这个沙发模型在它的 x 轴上旋转 360*,但没有成功。我一直在使用的代码如下。沙发模型本身包含一些不同的对象。就像手臂、腿和木臂一样,我试图让模型中的所有对象在 x 轴上旋转。

0 投票
2 回答
548 浏览

html - 在本地运行动画 x3d 文件

我有这个代码,它是一个嵌入了旋转的 x3d 对象的 HTML 页面。在网络浏览器中一切正常,但如果我尝试获取代码的 x3d 部分并将其保存为 x3d 文件,则该对象不会在 BS 联系人中运行。

所以基本上我要做的是让这个代码作为本地 x3d 文件而不是 html 文件运行。

0 投票
0 回答
77 浏览

android - x3d file export different than anticipated need other format to import models

I want to use blender to create my 3d models and then import them into my opengl project. I have a class named “Mesh” that also contains a list of sub Meshes.

In blender, I create three box meshes literally stacked on top of each other. The first is called “body” the next “neck” and finally “head.” In blender I simply went to "Add" then "Cube" and then moved the cube only vertically in the Y direction.

When I export the file as a x3d these are the results I get in the file... just as expected.

Now for my opengl project I want the main mesh to be the body, a submesh the neck and then a submesh of the neck, I want to be the head. So in blender, in the scene tree view, I drag the head into the neck and the neck into the body so I have this...

As a result, I expect the translation in the y dimension to change and become relative. Instead this is what I get...

As you can see, instead of being in the Y dimension, blender exported it and put the changes in the Z dimension.

Can anyone help me understand what I am doing wrong? These are the results I anticipated...

I will also take any other ideas how to get models into my project, so long as I can create the submeshes relationship in blender.