-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathships.py
34 lines (30 loc) · 786 Bytes
/
ships.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import numpy as np
from vtk import *
from structures import *
from rendering import *
import sys
game = Game()
ram = np.fromfile("ram.dat", dtype=np.uint8)
game.update(ram)
for ship in game.ship_data:
if not ship:
continue
print("Vertices:", ship.num_vertices)
print("Edges:", ship.num_edges)
print("Faces:", ship.num_faces)
mapper = vtkPolyDataMapper()
mapper.SetInputData(ship_model(ship))
actor = vtkActor()
prop = actor.GetProperty()
prop.SetColor(0.4,0.4,0.4)
prop.EdgeVisibilityOn()
prop.SetLineWidth(3)
prop.SetEdgeColor(1,1,1)
actor.SetMapper(mapper)
renderer = vtkRenderer()
renderer.AddActor(actor)
window = vtkRenderWindow()
window.AddRenderer(renderer)
interactor = vtkRenderWindowInteractor()
interactor.SetRenderWindow(window)
interactor.Start()