第一弹:IndexedLineSet线集合
注:学习阶段,不喜勿喷!
编译软件:VrmlPad
**
线集合语法:
IndexedLineSet{
coord Coordinate {
point [ #里面存放各个顶点,顶点编号从0开始依次相加
]
}
coordIndex [ #里面指出哪些点连成一条直线
]
color Color {
color [ #里面给出颜色,每个颜色用,分隔开,颜色数目和线段数目相同
]
}
colorIndex [ #给出线段编号对应上面的颜色
]
colorPerVertex #指明着色方式是基于端点还是基于线段(TRUE/FALSE),默认基于端点(TRUE)
}
**
#VRML V2.0 utf8
Shape {
appearance Appearance {}
geometry IndexedLineSet {
coord Coordinate {
point [
0 0 0, #index=0
1 0 0, #index=1
1 -0.5 0.75, #index=2
0 -0.5 0.75, #index=3
0 -1.5 0.75, #index=4
1 -1.5 0.75, #index=5
1 -2.5 0.75, #index=6
0 -2.5 0.75, #index=7
0 -3.0 1.5, #index=8
1 -3.0 1.5, #index=9
]
}
coordIndex [
0 1 2 3 0 -1,
2 3 4 5 2 -1,
4 5 6 7 4 -1,
6 7 8 9 6 -1,
]
color Color {
color [
1 1 1,
1 1 1,
1 1 1,
1 1 1,
]
}
colorIndex [0 1 2 3]
colorPerVertex FALSE
}
}
**