X3D中的颜色面无效

时间:2016-08-30 08:57:23

标签: html colors xhtml x3d x3dom

我在X3D中定义了一些面孔,并尝试为它们指定颜色。我有下面的代码,但是当我加载模型时,什么都没有出现,它只显示“硬件缓冲”。当我摆脱与颜色定义相关的部分时,它加载好(并且形状是正确的)。任何想法在这里有什么问题?谢谢!

<x3d>
    <Scene>
        <Group>
        <Transform translation="0 1.829 0">
        <Transform center="0 -1.829 0" rotation="0.0000 0.0000 -1.0000 1.5708" translation="18.288 -3.658 11.582">
        <Transform center="0 -1.829 0" rotation="0 1 0 0.0000">
            <Shape>
                <Appearance><Material diffuseColor="0.0000 0.0000 1.0000"/></Appearance>
                <IndexedFaceSet solid='true' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
                    <Coordinate point='-0.004 1.829 0.174 0.004 1.829 0.174 0.004 1.829 -0.174 -0.004 1.829 -0.174 -0.004 -1.829 0.174 0.004 -1.829 0.174 0.004 -1.829 -0.174 -0.004 -1.829 -0.174'/>
                </IndexedFaceSet>
            </Shape>
            <Shape>
                <Appearance><Material/></Appearance>
                <IndexedFaceSet colorPerVertex='false' solid='true' colorIndex='1 1 0 1 1 1' coordIndex='0 1 2 3 -1 7 6 5 4 -1 0 4 5 1 -1 1 5 6 2 -1 2 6 7 3 -1 3 7 4 0 -1'>
                    <Color color="0.8627 0.8627 0.8627 0.0000 0.0000 1.0000"/>
                    <Coordinate point='-0.1015 1.829 0.174 0.1015 1.829 0.174 0.1015 1.829 0.16 -0.1015 1.829 0.16 -0.1015 -1.829 0.174 0.1015 -1.829 0.174 0.1015 -1.829 0.16 -0.1015 -1.829 0.16'/>
                </IndexedFaceSet>
            </Shape>
        </Transform>
        </Transform>
        </Transform>
        </Group>
    </Scene>
</x3d>

1 个答案:

答案 0 :(得分:0)

代码是正确的,但它不起作用的原因是我创建的是 .html 文件,而不是 x3dom 的xhtml 文件。