sys.path.insert(0, os.path.join(scriptdir, '..')) import numpy from PIL import Image import ospray W = 1024 H = 1024 S = 16 RENDERER = 'pathtracer' cam_pos = (0.5, 0.5, 3.0) cam_up = (0.0, 1.0, 0.0) cam_view = (0.0, 0.0, -1.0) argv = ospray.init(sys.argv) # Enable logging output def error_callback(error, details): print('OSPRAY ERROR: %d (%s)' % (error, details)) def status_callback(message): print('OSPRAY STATUS: %s' % message) ospray.set_error_func(error_callback) ospray.set_status_func(status_callback)
[1.0, -1.0, 3.0], [0.1, 0.1, 0.3] ], dtype=numpy.float32) color = numpy.array([ [0.9, 0.5, 0.5, 1.0], [0.8, 0.8, 0.8, 1.0], [0.8, 0.8, 0.8, 1.0], [0.5, 0.9, 0.5, 1.0] ], dtype=numpy.float32) index = numpy.array([ [0, 1, 2], [1, 2, 3] ], dtype=numpy.uint32) ospray.init(sys.argv) camera = ospray.Camera('perspective') camera.set_param('aspect', W/H) camera.set_param('position', cam_pos) camera.set_param('direction', cam_view) camera.set_param('up', cam_up) camera.commit() mesh = ospray.Geometry('mesh') mesh.set_param('vertex.position', ospray.data_constructor_vec(vertex)) mesh.set_param('vertex.color', ospray.data_constructor_vec(color)) mesh.set_param('index', ospray.data_constructor_vec(index)) mesh.commit() gmodel = ospray.GeometricModel(mesh)
#!/usr/bin/env python import sys, getopt, os scriptdir = os.path.split(__file__)[0] sys.path.insert(0, os.path.join(scriptdir, '..')) import ospray ospray.init([]) print('Compile-time version:', ospray.VERSION) print('Run-time version:', ospray.version())