html - 无法在 x3dom 中使用 indexedfaceSet 为面部着色

标签 html google-chrome xhtml x3dom

我正在寻找一种在 Chrome 浏览器中使用颜色映射显示一些网格的方法,所以我尝试了 x3domindexedFaceSet。我假设有一种方法可以为顶点分配颜色,以便对面部颜色进行插值,或者至少我应该能够为每个面部分配不同的常量颜色。似乎无论我尝试什么,我都只能显示面部线条和定义的颜色没有效果。 目前,我有这个 html 代码:

<html>
<head>
<script type='text/javascript' src='http://www.x3dom.org/download/x3dom.js'> </script> 
<link rel='stylesheet' type='text/css' href='http://www.x3dom.org/download/x3dom.css'></link>
</head>

<body>
    <X3D width='600px' height='400px' showLog='true'>
        <Scene>
            <Shape>
                <IndexedFaceSet coordIndex='0 1 2 -1, 1 2 3 -1' colorPerVertex='true' solid='false'>
                    <Coordinate point='0 0 0, 1 0 0, 0 1 0, 1 1 0'/>
                    <Color color='0 1 0, 1 0 0, 0 0 1, 0 1 0'/>
                </IndexedFaceSet>
            </Shape>
        </Scene>
    </X3D>
</body>
</html>

我想,我要么遗漏了一些非常简单的东西,要么 x3dom 在我的机器上无法正常工作。

最佳答案

可能的解决方案是使用包含以下内容的 .xhtml 格式(而不是 .html):

<?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>
    <link rel='stylesheet' type='text/css' href='x3dom.css'/>
  </head>
  <body>
    <X3D width='600px' height='526px'>
      <Scene>
        <Transform>
          <Shape>
            <IndexedFaceSet solid='false' coordIndex='0 1 2 -1'>
              <Coordinate point='1 0 0 0 2 0 0 0 3'/>
              <Color color='1 0 0 0 1 0 0 0 1'/>
            </IndexedFaceSet>
          </Shape>
        </Transform>
      </Scene>
    </X3D>
  <script type="text/javascript" src='http://www.x3dom.org/download/x3dom.js'></script>
  </body>
</html>

创建此解决方案减少了 this example到我试图完成的“最小例子”。

关于html - 无法在 x3dom 中使用 indexedfaceSet 为面部着色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31976056/

相关文章:

html - 不同分辨率下导航栏外的链接

html - 悬停在单独的 Div 上时的 Div 不透明度

javascript - 以编程方式将非事件选项卡滚动到底部

google-chrome - Chrome和IE中的混合内容

CSS - 100% 宽度流体布局的奇怪浏览器问题,为什么?

css - em 和 % 在文本大小调整和固定宽度网站方面有什么区别? em 比 % 更炒作吗?

php - 处理表单是否需要服务器端脚本?

sqlite - 如何从 JavaScript 压缩 WebSQL 数据库

jQuery:一次只展开一个面板

JavaScript 以编程方式强制关闭选项卡?