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 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)
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()
import numpy as np from fos.core.world import World from fos.core.fos_window import FosWindow from fos.core.camera import DefaultCamera from fos.actor.volslicer import ConnectedSlices from fos.actor.triangle import Triangle from fos.actor.network import AttributeNetwork w = World(0) cam = DefaultCamera() w.add(cam) tri = Triangle() w.add(tri) wi = FosWindow() wi.attach(w)
print vertices.min(),vertices.max(),vertices.mean() print normals.min(),normals.max(), normals.mean() print vertices.dtype,faces.dtype, colors.dtype, normals.dtype 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()