Esempio n. 1
0
def scene1():
    scene = Scene()

    obj = GameObject('0')
    obj.load_mesh('../data/deer.obj')
    obj.set_scale(1 / 30)
    obj.translate_x(10)
    obj.rotate_y(-35)
    scene.objects += [obj]

    obj = GameObject('1')
    obj.load_mesh('../data/cube.obj')
    obj.set_scale(100)
    obj.translate_x(-50)
    obj.translate_y(-100)
    obj.translate_z(-50)
    scene.objects += [obj]

    obj = GameObject('2')
    obj.load_mesh('../data/camero.obj')
    obj.load_texture('../data/camero.png', 64)
    obj.set_scale(10)
    obj.translate_x(-20)
    obj.translate_z(8)
    obj.rotate_y(-45)
    scene.objects += [obj]

    scene.light = Light()
    scene.light.shadow_map_dim = 64
    scene.light.shadow_map_bias = 1
    scene.light.translate_z(1000)
    scene.light.translate_y(1500)
    scene.light.translate_x(2000)
    scene.light.rotate_y(100)
    scene.light.rotate_x(35)

    image_width = 320
    image_height = 240

    scene.camera = Camera(0.98, 0.735, image_width, image_height, 1, 10000, 20,
                          np.eye(4))
    scene.camera.translate_y(60)
    scene.camera.translate_z(60)
    scene.camera.rotate_x(35)

    print(scene.camera.world_to_camera)

    return scene
Esempio n. 2
0
    obj.load_mesh('../data/deer.obj')
    obj.set_scale(1 / 30)
    mesh_array = export_mesh(obj)
    np.save('01_mesh.npy', mesh_array)
    obj.translate_x(10)
    obj.rotate_y(-35)
    np.save('01_trns.npy', obj.transform)

    obj = GameObject('1')
    obj.load_mesh('../data/cube.obj')
    obj.set_scale(100)
    mesh_array = export_mesh(obj)
    np.save('02_mesh.npy', mesh_array)
    obj.translate_x(-50)
    obj.translate_y(-100)
    obj.translate_z(-50)
    np.save('02_trns.npy', obj.transform)

    obj = GameObject('2')
    obj.load_mesh('../data/camero.obj')
    obj.load_texture('../data/camero.png', 64)
    obj.set_scale(10)
    mesh_array = export_mesh(obj)
    txtr_array = export_txtr(obj)
    np.save('03_mesh.npy', mesh_array)
    np.save('03_txtr.npy', txtr_array)
    obj.translate_x(-20)
    obj.translate_z(8)
    obj.rotate_y(-45)
    np.save('03_trns.npy', obj.transform)