Controlling how textures are mapped
cookie.wrl
#VRML V2.0 utf8
#
# Cookie texture mapping using texture coordinates
#
Transform {
rotation 1 0 0 1.57
scale 2.5 2.5 2.5
children [
Shape {
appearance Appearance {
material Material { }
texture ImageTexture { url "cookie.jpg" }
}
geometry IndexedFaceSet {
coord Coordinate {
point [
# Slice, pulled out of cookie
0.5 0.0 0.5, 0.88 0.0 1.42,
1.06 0.0 1.33, 1.21 0.0 1.21,
1.33 0.0 1.06, 1.42 0.0 0.88,
# Rest of cookie
0.00 0.0 0.00, 0.92 0.0 0.38,
0.98 0.0 0.20, 1.00 0.0 0.00,
0.98 0.0 -0.20, 0.92 0.0 -0.38,
0.83 0.0 -0.56, 0.71 0.0 -0.71,
0.56 0.0 -0.83, 0.38 0.0 -0.92,
0.20 0.0 -0.98, 0.00 0.0 -1.00,
-0.20 0.0 -0.98, -0.38 0.0 -0.92,
-0.56 0.0 -0.83, -0.71 0.0 -0.71,
-0.83 0.0 -0.56, -0.92 0.0 -0.38,
-0.98 0.0 -0.20, -1.00 0.0 0.00,
-0.98 0.0 0.20, -0.92 0.0 0.38,
-0.83 0.0 0.56, -0.71 0.0 0.71,
-0.56 0.0 0.83, -0.38 0.0 0.92,
-0.20 0.0 0.98, 0.00 0.0 1.00,
0.20 0.0 0.98, 0.38 0.0 0.92
]
}
coordIndex [
# Slice
0, 1, 2, 3, 4, 5, -1,
# Rest of cookie
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35
]
texCoord TextureCoordinate {
point [
# Center point of cookie image
0.5 0.5,
# Cookie perimeter
0.96 0.41, 0.97 0.50,
0.96 0.59, 0.93 0.68,
0.89 0.76, 0.83 0.83,
0.76 0.89, 0.68 0.93,
0.59 0.96, 0.50 0.97,
0.41 0.96, 0.32 0.93,
0.24 0.89, 0.17 0.83,
0.11 0.76, 0.07 0.68,
0.04 0.59, 0.03 0.50,
0.04 0.41, 0.07 0.32,
0.11 0.24, 0.17 0.17,
0.24 0.11, 0.32 0.07,
0.41 0.04, 0.50 0.03,
0.59 0.04,
# Slice perimeter
0.68 0.07, 0.76 0.11,
0.83 0.17, 0.89 0.24,
0.93 0.32
]
}
texCoordIndex [
# Slice
0, 28, 29, 30, 31, 32, -1,
# Rest of cookie
0, 32, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28
]
ccw TRUE
solid FALSE
convex FALSE
}
} # end of Shape node
]
}