2013-11-24 36 views
1

如何给多边形上色 - 例如,只有颜色1面向全红。我不希望线性插值发生在我移动颜色相邻的面时。我可以用以下代码对它进行着色,但颜色合并。当我将colorPerVertex设置为false时,着色看起来很奇怪。请指教。谢谢。X3D - 如何为X3D中的多边形着色

<X3D> 
<Scene> 
<Shape> 

    <IndexedFaceSet solid="false" colorPerVertex="true" 
     coordIndex="0 3 4 1 -1 
        1 4 5 2 -1 
        3 6 7 4 -1 
        4 7 8 5 -1"> 
    <Coordinate 
     point= "0 0 0, 1 0 0, 2 0 0 
       0 0 1, 1 3 1, 2 0 1 
       0 0 2, 1 0 2, 2 0 2" /> 

     <Color color= "0 0 0, 1 0 0, 2 0 0 
       0 0 1, 1 3 1, 2 0 1 
       0 0 2, 1 0 2, 2 0 2" /> 

    </IndexedFaceSet> 

    <Appearance> 
     <Material diffuseColor='1 0 0' /> 
    </Appearance> 

</Shape> 
</Scene> 
</X3D> 

回答

2

如果colorPerVertex为假并且colorIndex域不为空的,则一个颜色的方法适合于IndexedFaceSet的每个面上。

因此,如果您在示例中将colorPerVertex设置为FALSE,则不应在面(测试)之间进行颜色插值。