A very simple example of a complete OpenGEX file describing a green cube is shown in the listing below. It begins with a group of Metric structures that define the units of measurement and the global up direction. Those are followed by a single GeometryNode structure that provides the name and transform for the cube. The geometric data for the cube is stored in the GeometryObject structure that is referenced by the geometry node. The geometry object structure contains a single mesh of
triangle primitives that includes
per-vertex positions, normals, and texture coordinates. Finally, the Material structure at the end of the file contains the green diffuse reflection color. Metric (key = "distance") {float {0.01}} Metric (key = "up") {string {"z"}} GeometryNode $node1 { Name {string {"Cube"}} ObjectRef {ref {$geometry1}} MaterialRef {ref {$material1}} Transform { float[12] { {1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 50.0, 50.0, 0.0} } } } GeometryObject $geometry1 // Cube { Mesh (primitive = "triangles") { VertexArray (attrib = "position") { float[3] // 24 { {-50.0, -50.0, 0.0}, {-50.0, 50.0, 0.0}, {50.0, 50.0, 0.0}, {50.0, -50.0, 0.0}, {-50.0, -50.0, 100.0}, {50.0, -50.0, 100.0}, {50.0, 50.0, 100.0}, {-50.0, 50.0, 100.0}, {-50.0, -50.0, 0.0}, {50.0, -50.0, 0.0}, {50.0, -50.0, 100.0}, {-50.0, -50.0, 100.0}, {50.0, -50.0, 0.0}, {50.0, 50.0, 0.0}, {50.0, 50.0, 100.0}, {50.0, -50.0, 100.0}, {50.0, 50.0, 0.0}, {-50.0, 50.0, 0.0}, {-50.0, 50.0, 100.0}, {50.0, 50.0, 100.0}, {-50.0, 50.0, 0.0}, {-50.0, -50.0, 0.0}, {-50.0, -50.0, 100.0}, {-50.0, 50.0, 100.0} } } VertexArray (attrib = "normal") { float[3] // 24 { {0.0, 0.0, -1.0}, {0.0, 0.0, -1.0}, {0.0, 0.0, -1.0}, {0.0, 0.0, -1.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 1.0}, {0.0, 0.0, 1.0}, {0.0, -1.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, -1.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 1.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0}, {-1.0, 0.0, 0.0} } } VertexArray (attrib = "texcoord") { float[2] // 24 { {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}, {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0}, {0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}, {0.0, 1.0} } } IndexArray { uint32[3] // 12 { {0, 1, 2}, {2, 3, 0}, {4, 5, 6}, {6, 7, 4}, {8, 9, 10}, {10, 11, 8}, {12, 13, 14}, {14, 15, 12}, {16, 17, 18}, {18, 19, 16}, {20, 21, 22}, {22, 23, 20} } } } } Material $material1 { Name {string {"Green"}} Color (attrib = "diffuse") {float[3] } } == History ==