VRML索引FaceSet

嗨,我正试图在VRML上使用Indexed FaceSet。问题是2张面孔没有出现,我真的不知道为什么。 代码是:
Shape {
                    geometry IndexedFaceSet {
                        coord Coordinate {
                            point [0 0 0,     #0
                                0.3 0 0,      #1
                                0 1.2 0,      #2
                                0.3 1.2 0,    #3
                                0 0 -1,       #4
                                0.3 0 -1,     #5
                                0 1.2 -1,     #6
                                0.3 1.2 -1,   #7
                                0.6 1.2 -0.3, #8
                                0.6 1.2 -0.7] #9
                            }   
                            coordIndex [6 7 9 8 3 2 -1,
                                0 1 5 4 -1,
                                1 5 9 8 -1,
                                0 1 3 2 -1,
                                4 5 7 6 -1,
                                0 4 6 2 -1,
                                3 1 8 -1,
                                7 5 9 -1
                            ]

                        }

                    appearance Appearance { material Material { diffuseColor 0 0 0.8 }}
                }
没有出现的两方是最后一方。有什么想法吗?     
已邀请:
首先,必须以逆时针顺序定义每一面以使其可见,因为除非使用
solid FALSE
,否则
IndexedFaceSet
对象是单侧的,这就是为什么模型中的某些面看起来像它们缺失的原因,但它们实际上是从另一方面。 解决方案1:固定FALSE 从两侧都可以看到面,因此顺时针或逆时针定义它们并不重要。这是一个简单的黑客,但它使观众在内部呈现的多边形数量增加了一倍。
#VRML V2.0 utf8

Shape {
    appearance Appearance {
        material Material {
            diffuseColor 0 0 0.8
        }
    }
    geometry IndexedFaceSet {
        solid FALSE
        coord Coordinate {
            point [0 0 0, 0.3 0 0, 0 1.2 0, 0.3 1.2 0, 0 0 -1 0.3 0 -1, 0 1.2 -1, 0.3 1.2 -1, 0.6 1.2 -0.3, 0.6 1.2 -0.7]
        }
        coordIndex [
            6 7 9 8 3 2 -1,
            0 1 5 4 -1,
            1 5 9 8 -1,
            0 1 3 2 -1,
            4 5 7 6 -1,
            0 4 6 2 -1,
            3 1 8 -1,
            7 5 9 -1
        ]
    }
}
解决方案2:翻转有缺陷的面孔 反转应翻转的特定面的顶点顺序。
#VRML V2.0 utf8

Shape {
    appearance Appearance {
        material Material {
            diffuseColor 0 0 0.8
        }
    }
    geometry IndexedFaceSet {
        coord Coordinate {
            point [0 0 0, 0.3 0 0, 0 1.2 0, 0.3 1.2 0, 0 0 -1 0.3 0 -1, 0 1.2 -1, 0.3 1.2 -1, 0.6 1.2 -0.3, 0.6 1.2 -0.7]
        }
        coordIndex [
            2 3 8 9 7 6 -1, # flipped
            4 5 1 0 -1,     # flipped
            1 5 9 8 -1,
            0 1 3 2 -1,
            6 7 5 4 -1,     # flipped
            2 6 4 0 -1,     # flipped
            3 1 8 -1,
            9 5 7 -1        # flipped
        ]
    }
}
    

要回复问题请先登录注册