Exemple #1
0
def init_test_object():
    global _test_object, _child1, _child2, _child3, _child4
    color = np.array(
        [[1.0, 0.0, 0.0, 1.0], [0.5, 0.0, 0.0, 1.0], [0.0, 1.0, 0.0, 1.0],
         [0.0, 0.5, 0.0, 1.0], [0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 0.5, 1.0]],
        c_float)
    long_rect = RectPrismMesh(0.5, 0.1, 0.1, face_colors=color)
    _child1 = WorldObject(long_rect)
    _child2 = WorldObject(long_rect)
    _child3 = WorldObject(long_rect)
    _child4 = WorldObject(long_rect)
    _child1.set_local_position((1.25, 0.0, 0.0))
    _child2.set_local_position((0.0, 1.25, 0.0))
    _child3.set_local_position((-1.25, 0.0, 0.0))
    _child4.set_local_position((0.0, -1.25, 0.0))
    _child1.set_local_rotation((0.0, 0.0, 0.0))
    _child2.set_local_rotation((0.0, 0.0, glm.radians(90.0)))
    _child3.set_local_rotation((0.0, 0.0, glm.radians(180.0)))
    _child4.set_local_rotation((0.0, 0.0, glm.radians(270.0)))
    cube = RectPrismMesh(0.5, 0.5, 0.5, face_colors=color)
    _test_object = WorldObject(cube)
    _test_object.set_render_mode(gl.GL_LINE_LOOP)
    _test_object.add_child(_child1)
    _test_object.add_child(_child2)
    _test_object.add_child(_child3)
    _test_object.add_child(_child4)