chickadee » hypergiant » cylinder-mesh

(cylinder-mesh LENGTH RADIUS VERTICAL-SUBDIVISIONS RESOLUTION [normals? NORMALS?] [texture-width: TEXTURE-WIDTH] [texture-height: TEXTURE-HEIGHT] [texture-offset: TEXTURE-OFFSET] [texture: TEXTURE] [color: COLOR] [winding: WINDING] [mode: MODE] [texture-type: TEXTURE-TYPE] [color-type: COLOR-TYPE] [index-type: INDEX-TYPE])procedure

Create a cylindrical mesh of LENGTH and RADIUS, with the length oriented along the Y-axis, and the centre of the bottom of the cylinder at the origin. VERTICAL-SUBDIVISIONS sets the number of subdivisions along the length of the mesh, while RESOLUTION sets the number of subdivisions along the circumference. Setting both TEXTURE-WIDTH and TEXTURE-HEIGHT causes 2 element texture coordinates to be added to the mesh, with TEXTURE-OFFSET representing the upper left corner of the texture, defaulting to (0 0). The texture’s upper left corner is mapped to the left side of the cylinder, wrapping counter-clockwise such that the left half of the texture corresponds to the front half of the cylinder. Alternately, TEXTURE may be supplied, which expects a function of one argument: the index of a vertex. This texture function should return a two element list of the texture coordinate at that index. The cube mesh vertices are ordered as a rectangular array with RESOLUTION + 1 columns and VERTICAL-SUBDIVISIONS + 1 rows. The first row corresponds to the top of the cylinder pole, while the last corresponds to the bottom. The first column has the same position as the last. This array is wrapped counter-clockwise around the sphere, starting on the left. Likewise, COLOR expects a similar function that accepts one index as an argument, but should return a three element list of colour values. When NORMALS? is #t, normals are added to the mesh. WINDING controls the direction of the vertex winding, either counter-clockwise (#:ccw, the default), or clockwise (#:cw). MODE should be a valid argument to mode->gl, defaulting to #:triangles. TEXTURE-TYPE, COLOUR-TYPE, and INDEX-TYPE control the in-memory type of the texture attribute, the color attribute, and the index, and should be a valid argument to type->gl. TEXTURE-TYPE, COLOUR-TYPE and INDEX-TYPE all default to #:ushort.