/* mesh_1.txt */ shape $mymesh; float $x; float $y; float $z; int $index[8]; int $tindex[5]; int $i; int $front; $mymesh = mesh(); $mymesh.loc = (10, 20, 0); $mymesh.Open(); $i = 0; for $x = -10 to 10 step 20 do { for $y = -10 to 10 step 20 do { for $z = -10 to 10 step 20 do { $index[$i] = $mymesh.AddPoint(($x, $y, $z)); $i = $i + 1; } } } $tindex[0] = $mymesh.AddTexCoord((0.0, 0.0)); $tindex[1] = $mymesh.AddTexCoord((1.0, 0.0)); $tindex[2] = $mymesh.AddTexCoord((1.0, 1.0)); $tindex[3] = $mymesh.AddTexCoord((0.0, 1.0)); $tindex[4] = $mymesh.AddTexCoord((0.5, 0.5)); /* left: */ $mymesh.OpenFace(0, 0); $mymesh.VertexN($index[0]); $mymesh.VertexN($index[2]); $mymesh.VertexN($index[3]); $mymesh.VertexN($index[1]); $mymesh.CloseFace(); /* front: */ $front = $mymesh.OpenFace(0, FACE_HAS_TEXCOORDS); $mymesh.TexCoordN($tindex[0]); $mymesh.VertexN($index[1]); $mymesh.TexCoordN($tindex[1]); $mymesh.VertexN($index[3]); $mymesh.TexCoordN($tindex[2]); $mymesh.VertexN($index[7]); $mymesh.TexCoordN($tindex[3]); $mymesh.VertexN($index[5]); $mymesh.CloseFace(); /* top: */ $mymesh.OpenFace(0, FACE_HAS_TEXCOORDS); $mymesh.TexCoordN($tindex[0]); $mymesh.VertexN($index[2]); $mymesh.TexCoordN($tindex[1]); $mymesh.VertexN($index[6]); $mymesh.TexCoordN($tindex[2]); $mymesh.VertexN($index[7]); $mymesh.TexCoordN($tindex[3]); $mymesh.VertexN($index[3]); $mymesh.CloseFace(); /* right: */ $mymesh.OpenFace(0, 0); $mymesh.VertexN($index[4]); $mymesh.VertexN($index[5]); $mymesh.VertexN($index[7]); $mymesh.VertexN($index[6]); $mymesh.CloseFace(); /* back: */ $mymesh.OpenFace(0, 0); $mymesh.VertexN($index[0]); $mymesh.VertexN($index[4]); $mymesh.VertexN($index[6]); $mymesh.VertexN($index[2]); $mymesh.CloseFace(); /* bottom: */ $mymesh.OpenFace(0, 0); $mymesh.VertexN($index[0]); $mymesh.VertexN($index[1]); $mymesh.VertexN($index[5]); $mymesh.VertexN($index[4]); $mymesh.CloseFace(); /* Remove texture coordinates from front face: */ $mymesh.SetFaceHasTexCoords($front, 0); $mymesh.RemoveUnusedData(); $mymesh.Close();