Original Spec|
Sample1
定義
IndexedFaceSet {
eventIn MFInt32 set_colorIndex
eventIn MFInt32 set_coordIndex
eventIn MFInt32 set_normalIndex
eventIn MFInt32 set_texCoordIndex
exposedField SFNode color NULL
exposedField SFNode coord NULL
exposedField SFNode normal NULL
exposedField SFNode texCoord NULL
field SFBool ccw TRUE
field MFInt32 colorIndex [] # [-1,)
field SFBool colorPerVertex TRUE
field SFBool convex TRUE
field MFInt32 coordIndex [] # [-1,)
field SFFloat creaseAngle 0 # [0,)
field MFInt32 normalIndex [] # [-1,)
field SFBool normalPerVertex TRUE
field SFBool solid TRUE
field MFInt32 texCoordIndex [] # [-1,)
}
自由曲面を書くいわゆるポリゴンをあらわすノードです。
- set_colorIndex
- colorIndexを設定するイベント
- set_coordIndex
- coordIndexを設定するイベント
- set_normalIndex
- normalIndexを設定するイベント
- set_texCoordIndex
- 後述texCoordIndexを設定するイベント
- color
- 使用する色の集合の設定。Colorノード使用。
- coord
- 使用する座標の集合の設定。Coordinateノード使用。
- normal
- 使用する法線の集合の設定。Normalノード使用。
- texCoord
- 使用するテキスチャの座標の集合の設定。
TextureCoordinateノード使用。
- ccw
- 面の法線を自動的に面の情報から生成する際にその方向を右手法で行う
- colorIndex
- 使用する色の指定
- colorPerVertex
- 頂点ごとに色が指定できるかの指定
- convex
- 凸かどうかの指定
- coordIndex
- 使用する座標の指定
- creaseAngle
- 二つの面が接するときその角度がここに指定されたもの以下の場合、
その辺での法線が滑らかに変化するようになります。
- normalIndex
- 使用する法線の指定
- normalPerVertex
- 頂点ごとに法線が指定できるかの指定。指定した場合面上で法線は連続的に変化します。
- solid
- 面の表裏が両方から見えるかどうかの指定
- texCoordIndex
- 使用するテキスチャの座標の指定
法線は光を当てたときに、テキスチャ座標はテキスチャを貼り付けるときに
影響します。
面への色のつけ方ですが、
- colorPerVertexがFALSEの場合
- 面単位で色を指定することができます.
面と色にはそれぞれcoordIndexとcolorsで指定された順に番号が付けられていて、
colorsIndexでその対応を指定します.指定しなければ同じ順で対応付けられます.
- colorPerVertexがTRUEの場合
- もし頂点ごとに色をしてすればよい場合はcolorIndexが指定しないでください.
この場合coordIndexにcolorsで指定された順に色づけされます。
もし各面ごとに頂点の色を変えたい場合はcolorIndexをcoordIndexと同じように設定することで
指定できます。
サンプル
色と座標の部分のみです
#VRML V2.0 utf8
Shape {
geometry IndexedFaceSet {
coord Coordinate {
point [0 .2 1, 1 0 0, 0 1 0, -1 0 0 ]
}
color Color {
color [1 0 0, 0 1 0, 0 0 1]
}
coordIndex [
0 1 2 -1
3 1 2 -1
0 3 2 -1
0 1 3 -1
]
colorIndex [0 1 2 -1 0 1 2 -1 0 0 0 -1 0 1 2 -1 ]
solid FALSE
}
}