gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 03:07:23 25 4
gpt4 key购买 nike

我正在寻找一种在 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com