def test_engine2windows(): eng = Engine() eng.run() # create a world w = World(0) # create default camera cam = DefaultCamera() # add camera w.add(cam) # create image viewr a = np.random.random((100, 100, 100)) aff = np.eye(4) cds = ConnectedSlices(aff, a) # add cds to world w.add(cds) # add world to engine eng.add(w) # create a window wi = FosWindow() # attach window to world wi.attach(w) wi2 = FosWindow() # attach window to world wi2.attach(w)
def add(self, world): self.worlds.append(world) def update(self, dt): print "dt", dt # this should call the update of all the actors # in a world def stop(self): self.running = False if __name__ == '__main__': # eng = Engine() # eng.run() # create a world w = World(0) # create default camera cam = DefaultCamera() # add camera w.add(cam) # create a window # attach window to world wi = FosWindow(bgcolor=color.orange) wi.attach(w)
from fos.actor.surf import Surface aff = np.eye(4, dtype=np.float32) aff[:3, 3] = [150, 0, 0] s = Surface(vertices, faces, colors, affine=aff, add_lights=True, normals=normals) #vertices2=vertices+np.array([100,0,0],dtype=vertices.dtype) #s2=Surface(vertices2,faces,normals,colors) from fos.core.world import World w = World() w.add(s) #w.add(s2) from fos.core.camera import DefaultCamera cam = DefaultCamera() w.add(cam) from fos import Window, WindowManager wi = Window() wi.attach(w) wm = WindowManager() wm.add(wi) wm.run()