- (cube-mesh LENGTH [normals?: NORMALS?] [cube-map?: CUBE-MAP?] [texture: TEXTURE] [color: COLOR] [winding: WINDING] [mode: MODE] [texture-type: TEXTURE-TYPE] [color-type: COLOR-TYPE] [index-type: INDEX-TYPE])procedure
Create a cube mesh with sides of LENGTH with the centre of the cube at the origin. Each face of the cube has a unique set of vertices – i.e. no face shares vertices. When NORMALS? is #t, normals are added to the mesh. When CUBE-MAP? is #t, three element texture coordinates are added to the mesh, corresponding to a unit-cube. Alternately, TEXTURE may be supplied, which expects a function of one argument: the index of a vertex. This texture function should return a three element list of the texture coordinate at that index. The cube mesh vertices are ordered as follows: each face has vertices (upper-left upper-right lower-left lower-right), and the faces are ordered (front right back left top bottom). The up direction for each face can be seen in the image below:
Likewise, COLOR expects a similar function that accepts one index as an argument, but should return a three element list of colour values. 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 defaults to #:float, while COLOUR-TYPE and INDEX-TYPE default to #:ushort.