2013-11-24 37 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,則不應在面(測試)之間進行顏色插值。